xcstrings-cli 2.5.1 → 2.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +130 -88
- package/dist/index.js +1944 -1548
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,721 +1,231 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import
|
|
3
|
-
import { hideBin as
|
|
4
|
-
import { resolve as
|
|
5
|
-
import { cosmiconfig as
|
|
6
|
-
import
|
|
7
|
-
import { select as
|
|
2
|
+
import Kr from "yargs";
|
|
3
|
+
import { hideBin as Wr } from "yargs/helpers";
|
|
4
|
+
import { resolve as Ne, relative as ke, dirname as yn, basename as qr, join as Ee, extname as Gr } from "node:path";
|
|
5
|
+
import { cosmiconfig as Vr } from "cosmiconfig";
|
|
6
|
+
import He from "json5";
|
|
7
|
+
import { select as Xr, editor as Jr, checkbox as vn, confirm as Qr } from "@inquirer/prompts";
|
|
8
8
|
import S from "chalk";
|
|
9
|
-
import { readFile as
|
|
10
|
-
import { XcodeProject as
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
`${Le}.json`,
|
|
14
|
-
`${Le}.json5`
|
|
15
|
-
],
|
|
16
|
-
loaders: {
|
|
17
|
-
".json5": async (e, n) => De.parse(n)
|
|
18
|
-
},
|
|
19
|
-
cache: !1
|
|
20
|
-
});
|
|
21
|
-
async function We(e) {
|
|
22
|
-
if (e) {
|
|
23
|
-
const r = await sn.load(e);
|
|
24
|
-
return r ? r.config : null;
|
|
25
|
-
}
|
|
26
|
-
const n = await sn.search();
|
|
27
|
-
return n ? n.config : null;
|
|
9
|
+
import { readFile as Ke, writeFile as Ze, readdir as en, rm as Yn, mkdir as xn, stat as Zr } from "node:fs/promises";
|
|
10
|
+
import { XcodeProject as ei } from "@bacons/xcode";
|
|
11
|
+
function Hn(e) {
|
|
12
|
+
return typeof e > "u" || e === null;
|
|
28
13
|
}
|
|
29
|
-
function
|
|
30
|
-
|
|
31
|
-
for (const r of e)
|
|
32
|
-
if (typeof r != "string" && r.alias === n)
|
|
33
|
-
return r.path;
|
|
34
|
-
return null;
|
|
14
|
+
function ni(e) {
|
|
15
|
+
return typeof e == "object" && e !== null;
|
|
35
16
|
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
const l = cn(i, e);
|
|
45
|
-
if (l)
|
|
46
|
-
return l;
|
|
47
|
-
const a = !e.includes("/") && !e.endsWith(".xcstrings");
|
|
48
|
-
if (t && a)
|
|
49
|
-
throw new Error(`Unknown alias: ${e}`);
|
|
50
|
-
if (e === r && i && i.length > 0) {
|
|
51
|
-
if (i.length === 1) {
|
|
52
|
-
const u = i[0];
|
|
53
|
-
return typeof u == "string" ? u : u.path;
|
|
54
|
-
}
|
|
55
|
-
const s = i.map((u) => typeof u == "string" ? { name: u, value: u } : { name: `${u.alias} (${u.path})`, value: u.path });
|
|
56
|
-
return await Pr({
|
|
57
|
-
message: "Select xcstrings file:",
|
|
58
|
-
choices: s
|
|
59
|
-
});
|
|
60
|
-
}
|
|
17
|
+
function ri(e) {
|
|
18
|
+
return Array.isArray(e) ? e : Hn(e) ? [] : [e];
|
|
19
|
+
}
|
|
20
|
+
function ii(e, n) {
|
|
21
|
+
var r, i, t, o;
|
|
22
|
+
if (n)
|
|
23
|
+
for (o = Object.keys(n), r = 0, i = o.length; r < i; r += 1)
|
|
24
|
+
t = o[r], e[t] = n[t];
|
|
61
25
|
return e;
|
|
62
26
|
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
27
|
+
function ti(e, n) {
|
|
28
|
+
var r = "", i;
|
|
29
|
+
for (i = 0; i < n; i += 1)
|
|
30
|
+
r += e;
|
|
31
|
+
return r;
|
|
67
32
|
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
await Nn(e, i + `
|
|
71
|
-
`, "utf-8");
|
|
33
|
+
function oi(e) {
|
|
34
|
+
return e === 0 && Number.NEGATIVE_INFINITY === 1 / e;
|
|
72
35
|
}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
r = !r, n += o;
|
|
87
|
-
continue;
|
|
88
|
-
}
|
|
89
|
-
if (!r && o === ":") {
|
|
90
|
-
n += " :";
|
|
91
|
-
continue;
|
|
92
|
-
}
|
|
93
|
-
n += o;
|
|
94
|
-
}
|
|
95
|
-
return n;
|
|
36
|
+
var li = Hn, ai = ni, si = ri, ci = ti, ui = oi, fi = ii, T = {
|
|
37
|
+
isNothing: li,
|
|
38
|
+
isObject: ai,
|
|
39
|
+
toArray: si,
|
|
40
|
+
repeat: ci,
|
|
41
|
+
isNegativeZero: ui,
|
|
42
|
+
extend: fi
|
|
43
|
+
};
|
|
44
|
+
function Kn(e, n) {
|
|
45
|
+
var r = "", i = e.reason || "(unknown reason)";
|
|
46
|
+
return e.mark ? (e.mark.name && (r += 'in "' + e.mark.name + '" '), r += "(" + (e.mark.line + 1) + ":" + (e.mark.column + 1) + ")", !n && e.mark.snippet && (r += `
|
|
47
|
+
|
|
48
|
+
` + e.mark.snippet), i + " " + r) : i;
|
|
96
49
|
}
|
|
97
|
-
function
|
|
98
|
-
|
|
50
|
+
function ge(e, n) {
|
|
51
|
+
Error.call(this), this.name = "YAMLException", this.reason = e, this.mark = n, this.message = Kn(this, !1), Error.captureStackTrace ? Error.captureStackTrace(this, this.constructor) : this.stack = new Error().stack || "";
|
|
99
52
|
}
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
53
|
+
ge.prototype = Object.create(Error.prototype);
|
|
54
|
+
ge.prototype.constructor = ge;
|
|
55
|
+
ge.prototype.toString = function(n) {
|
|
56
|
+
return this.name + ": " + Kn(this, n);
|
|
57
|
+
};
|
|
58
|
+
var M = ge;
|
|
59
|
+
function Me(e, n, r, i, t) {
|
|
60
|
+
var o = "", l = "", a = Math.floor(t / 2) - 1;
|
|
61
|
+
return i - n > a && (o = " ... ", n = i - a + o.length), r - i > a && (l = " ...", r = i + a - l.length), {
|
|
62
|
+
str: o + e.slice(n, r).replace(/\t/g, "→") + l,
|
|
63
|
+
pos: i - n + o.length
|
|
64
|
+
// relative position
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
function De(e, n) {
|
|
68
|
+
return T.repeat(" ", n - e.length) + e;
|
|
69
|
+
}
|
|
70
|
+
function pi(e, n) {
|
|
71
|
+
if (n = Object.create(n || null), !e.buffer) return null;
|
|
72
|
+
n.maxLength || (n.maxLength = 79), typeof n.indent != "number" && (n.indent = 1), typeof n.linesBefore != "number" && (n.linesBefore = 3), typeof n.linesAfter != "number" && (n.linesAfter = 2);
|
|
73
|
+
for (var r = /\r?\n|\r|\0/g, i = [0], t = [], o, l = -1; o = r.exec(e.buffer); )
|
|
74
|
+
t.push(o.index), i.push(o.index + o[0].length), e.position <= o.index && l < 0 && (l = i.length - 2);
|
|
75
|
+
l < 0 && (l = i.length - 1);
|
|
76
|
+
var a = "", s, c, f = Math.min(e.line + n.linesAfter, t.length).toString().length, u = n.maxLength - (n.indent + f + 3);
|
|
77
|
+
for (s = 1; s <= n.linesBefore && !(l - s < 0); s++)
|
|
78
|
+
c = Me(
|
|
79
|
+
e.buffer,
|
|
80
|
+
i[l - s],
|
|
81
|
+
t[l - s],
|
|
82
|
+
e.position - (i[l] - i[l - s]),
|
|
83
|
+
u
|
|
84
|
+
), a = T.repeat(" ", n.indent) + De((e.line - s + 1).toString(), f) + " | " + c.str + `
|
|
85
|
+
` + a;
|
|
86
|
+
for (c = Me(e.buffer, i[l], t[l], e.position, u), a += T.repeat(" ", n.indent) + De((e.line + 1).toString(), f) + " | " + c.str + `
|
|
87
|
+
`, a += T.repeat("-", n.indent + f + 3 + c.pos) + `^
|
|
88
|
+
`, s = 1; s <= n.linesAfter && !(l + s >= t.length); s++)
|
|
89
|
+
c = Me(
|
|
90
|
+
e.buffer,
|
|
91
|
+
i[l + s],
|
|
92
|
+
t[l + s],
|
|
93
|
+
e.position - (i[l] - i[l + s]),
|
|
94
|
+
u
|
|
95
|
+
), a += T.repeat(" ", n.indent) + De((e.line + s + 1).toString(), f) + " | " + c.str + `
|
|
96
|
+
`;
|
|
97
|
+
return a.replace(/\n$/, "");
|
|
98
|
+
}
|
|
99
|
+
var di = pi, hi = [
|
|
100
|
+
"kind",
|
|
101
|
+
"multi",
|
|
102
|
+
"resolve",
|
|
103
|
+
"construct",
|
|
104
|
+
"instanceOf",
|
|
105
|
+
"predicate",
|
|
106
|
+
"represent",
|
|
107
|
+
"representName",
|
|
108
|
+
"defaultStyle",
|
|
109
|
+
"styleAliases"
|
|
110
|
+
], gi = [
|
|
111
|
+
"scalar",
|
|
112
|
+
"sequence",
|
|
113
|
+
"mapping"
|
|
114
|
+
];
|
|
115
|
+
function mi(e) {
|
|
116
|
+
var n = {};
|
|
117
|
+
return e !== null && Object.keys(e).forEach(function(r) {
|
|
118
|
+
e[r].forEach(function(i) {
|
|
119
|
+
n[String(i)] = r;
|
|
120
|
+
});
|
|
121
|
+
}), n;
|
|
122
|
+
}
|
|
123
|
+
function yi(e, n) {
|
|
124
|
+
if (n = n || {}, Object.keys(n).forEach(function(r) {
|
|
125
|
+
if (hi.indexOf(r) === -1)
|
|
126
|
+
throw new M('Unknown option "' + r + '" is met in definition of "' + e + '" YAML type.');
|
|
127
|
+
}), this.options = n, this.tag = e, this.kind = n.kind || null, this.resolve = n.resolve || function() {
|
|
128
|
+
return !0;
|
|
129
|
+
}, this.construct = n.construct || function(r) {
|
|
130
|
+
return r;
|
|
131
|
+
}, this.instanceOf = n.instanceOf || null, this.predicate = n.predicate || null, this.represent = n.represent || null, this.representName = n.representName || null, this.defaultStyle = n.defaultStyle || null, this.multi = n.multi || !1, this.styleAliases = mi(n.styleAliases || null), gi.indexOf(this.kind) === -1)
|
|
132
|
+
throw new M('Unknown kind "' + this.kind + '" is specified for "' + e + '" YAML type.');
|
|
133
|
+
}
|
|
134
|
+
var j = yi;
|
|
135
|
+
function wn(e, n) {
|
|
136
|
+
var r = [];
|
|
137
|
+
return e[n].forEach(function(i) {
|
|
138
|
+
var t = r.length;
|
|
139
|
+
r.forEach(function(o, l) {
|
|
140
|
+
o.tag === i.tag && o.kind === i.kind && o.multi === i.multi && (t = l);
|
|
141
|
+
}), r[t] = i;
|
|
142
|
+
}), r;
|
|
143
|
+
}
|
|
144
|
+
function vi() {
|
|
145
|
+
var e = {
|
|
146
|
+
scalar: {},
|
|
147
|
+
sequence: {},
|
|
148
|
+
mapping: {},
|
|
149
|
+
fallback: {},
|
|
150
|
+
multi: {
|
|
151
|
+
scalar: [],
|
|
152
|
+
sequence: [],
|
|
153
|
+
mapping: [],
|
|
154
|
+
fallback: []
|
|
170
155
|
}
|
|
171
|
-
|
|
156
|
+
}, n, r;
|
|
157
|
+
function i(t) {
|
|
158
|
+
t.multi ? (e.multi[t.kind].push(t), e.multi.fallback.push(t)) : e[t.kind][t.tag] = e.fallback[t.tag] = t;
|
|
172
159
|
}
|
|
173
|
-
|
|
160
|
+
for (n = 0, r = arguments.length; n < r; n += 1)
|
|
161
|
+
arguments[n].forEach(i);
|
|
162
|
+
return e;
|
|
174
163
|
}
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
parent: p[o]
|
|
207
|
-
};
|
|
208
|
-
m[o] = A;
|
|
164
|
+
function We(e) {
|
|
165
|
+
return this.extend(e);
|
|
166
|
+
}
|
|
167
|
+
We.prototype.extend = function(n) {
|
|
168
|
+
var r = [], i = [];
|
|
169
|
+
if (n instanceof j)
|
|
170
|
+
i.push(n);
|
|
171
|
+
else if (Array.isArray(n))
|
|
172
|
+
i = i.concat(n);
|
|
173
|
+
else if (n && (Array.isArray(n.implicit) || Array.isArray(n.explicit)))
|
|
174
|
+
n.implicit && (r = r.concat(n.implicit)), n.explicit && (i = i.concat(n.explicit));
|
|
175
|
+
else
|
|
176
|
+
throw new M("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");
|
|
177
|
+
r.forEach(function(o) {
|
|
178
|
+
if (!(o instanceof j))
|
|
179
|
+
throw new M("Specified list of YAML types (or a single Type object) contains a non-Type object.");
|
|
180
|
+
if (o.loadKind && o.loadKind !== "scalar")
|
|
181
|
+
throw new M("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");
|
|
182
|
+
if (o.multi)
|
|
183
|
+
throw new M("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.");
|
|
184
|
+
}), i.forEach(function(o) {
|
|
185
|
+
if (!(o instanceof j))
|
|
186
|
+
throw new M("Specified list of YAML types (or a single Type object) contains a non-Type object.");
|
|
187
|
+
});
|
|
188
|
+
var t = Object.create(We.prototype);
|
|
189
|
+
return t.implicit = (this.implicit || []).concat(r), t.explicit = (this.explicit || []).concat(i), t.compiledImplicit = wn(t, "implicit"), t.compiledExplicit = wn(t, "explicit"), t.compiledTypeMap = vi(t.compiledImplicit, t.compiledExplicit), t;
|
|
190
|
+
};
|
|
191
|
+
var Wn = We, qn = new j("tag:yaml.org,2002:str", {
|
|
192
|
+
kind: "scalar",
|
|
193
|
+
construct: function(e) {
|
|
194
|
+
return e !== null ? e : "";
|
|
209
195
|
}
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
}), p[t] = k;
|
|
196
|
+
}), Gn = new j("tag:yaml.org,2002:seq", {
|
|
197
|
+
kind: "sequence",
|
|
198
|
+
construct: function(e) {
|
|
199
|
+
return e !== null ? e : [];
|
|
215
200
|
}
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
201
|
+
}), Vn = new j("tag:yaml.org,2002:map", {
|
|
202
|
+
kind: "mapping",
|
|
203
|
+
construct: function(e) {
|
|
204
|
+
return e !== null ? e : {};
|
|
220
205
|
}
|
|
221
|
-
|
|
222
|
-
p = p || {}, p.browser = p.browser || {};
|
|
223
|
-
const m = p.browser.transmit;
|
|
224
|
-
if (m && typeof m.send != "function")
|
|
225
|
-
throw Error("pino: transmit option must have a send function");
|
|
226
|
-
const A = p.browser.write || n;
|
|
227
|
-
p.browser.write && (p.browser.asObject = !0);
|
|
228
|
-
const k = p.serializers || {}, E = c(p.browser.serialize, k);
|
|
229
|
-
let z = p.browser.serialize;
|
|
230
|
-
Array.isArray(p.browser.serialize) && p.browser.serialize.indexOf("!stdSerializers.err") > -1 && (z = !1);
|
|
231
|
-
const K = Object.keys(p.customLevels || {}), O = ["error", "fatal", "warn", "info", "debug", "trace"].concat(K);
|
|
232
|
-
typeof A == "function" && O.forEach(function(B) {
|
|
233
|
-
A[B] = A;
|
|
234
|
-
}), (p.enabled === !1 || p.browser.disabled) && (p.level = "silent");
|
|
235
|
-
const M = p.level || "info", w = Object.create(A);
|
|
236
|
-
w.log || (w.log = se), s(w, O, A), a({}, w), Object.defineProperty(w, "levelVal", {
|
|
237
|
-
get: ve
|
|
238
|
-
}), Object.defineProperty(w, "level", {
|
|
239
|
-
get: Z,
|
|
240
|
-
set: jr
|
|
241
|
-
});
|
|
242
|
-
const Y = {
|
|
243
|
-
transmit: m,
|
|
244
|
-
serialize: E,
|
|
245
|
-
asObject: p.browser.asObject,
|
|
246
|
-
formatters: p.browser.formatters,
|
|
247
|
-
levels: O,
|
|
248
|
-
timestamp: J(p)
|
|
249
|
-
};
|
|
250
|
-
w.levels = f(p), w.level = M, w.setMaxListeners = w.getMaxListeners = w.emit = w.addListener = w.on = w.prependListener = w.once = w.prependOnceListener = w.removeListener = w.removeAllListeners = w.listeners = w.listenerCount = w.eventNames = w.write = w.flush = se, w.serializers = k, w._serialize = E, w._stdErrSerialize = z, w.child = Ir, m && (w._logEvent = L());
|
|
251
|
-
function ve() {
|
|
252
|
-
return i(this.level, this);
|
|
253
|
-
}
|
|
254
|
-
function Z() {
|
|
255
|
-
return this._level;
|
|
256
|
-
}
|
|
257
|
-
function jr(B) {
|
|
258
|
-
if (B !== "silent" && !this.levels.values[B])
|
|
259
|
-
throw Error("unknown level " + B);
|
|
260
|
-
this._level = B, y(this, Y, w, "error"), y(this, Y, w, "fatal"), y(this, Y, w, "warn"), y(this, Y, w, "info"), y(this, Y, w, "debug"), y(this, Y, w, "trace"), K.forEach((ee) => {
|
|
261
|
-
y(this, Y, w, ee);
|
|
262
|
-
});
|
|
263
|
-
}
|
|
264
|
-
function Ir(B, ee) {
|
|
265
|
-
if (!B)
|
|
266
|
-
throw new Error("missing bindings for child Pino");
|
|
267
|
-
ee = ee || {}, E && B.serializers && (ee.serializers = B.serializers);
|
|
268
|
-
const rn = ee.serializers;
|
|
269
|
-
if (E && rn) {
|
|
270
|
-
var xe = Object.assign({}, k, rn), tn = p.browser.serialize === !0 ? Object.keys(xe) : E;
|
|
271
|
-
delete B.serializers, x([B], tn, xe, this._stdErrSerialize);
|
|
272
|
-
}
|
|
273
|
-
function on(ln) {
|
|
274
|
-
this._childLevel = (ln._childLevel | 0) + 1, this.bindings = B, xe && (this.serializers = xe, this._serialize = tn), m && (this._logEvent = L(
|
|
275
|
-
[].concat(ln._logEvent.bindings, B)
|
|
276
|
-
));
|
|
277
|
-
}
|
|
278
|
-
on.prototype = this;
|
|
279
|
-
const Te = new on(this);
|
|
280
|
-
return a(this, Te), Te.level = this.level, Te;
|
|
281
|
-
}
|
|
282
|
-
return w;
|
|
283
|
-
}
|
|
284
|
-
function f(p) {
|
|
285
|
-
const m = p.customLevels || {}, A = Object.assign({}, u.levels.values, m), k = Object.assign({}, u.levels.labels, h(m));
|
|
286
|
-
return {
|
|
287
|
-
values: A,
|
|
288
|
-
labels: k
|
|
289
|
-
};
|
|
290
|
-
}
|
|
291
|
-
function h(p) {
|
|
292
|
-
const m = {};
|
|
293
|
-
return Object.keys(p).forEach(function(A) {
|
|
294
|
-
m[p[A]] = A;
|
|
295
|
-
}), m;
|
|
296
|
-
}
|
|
297
|
-
u.levels = {
|
|
298
|
-
values: {
|
|
299
|
-
fatal: 60,
|
|
300
|
-
error: 50,
|
|
301
|
-
warn: 40,
|
|
302
|
-
info: 30,
|
|
303
|
-
debug: 20,
|
|
304
|
-
trace: 10
|
|
305
|
-
},
|
|
306
|
-
labels: {
|
|
307
|
-
10: "trace",
|
|
308
|
-
20: "debug",
|
|
309
|
-
30: "info",
|
|
310
|
-
40: "warn",
|
|
311
|
-
50: "error",
|
|
312
|
-
60: "fatal"
|
|
313
|
-
}
|
|
314
|
-
}, u.stdSerializers = r, u.stdTimeFunctions = Object.assign({}, { nullTime: en, epochTime: nn, unixTime: Fr, isoTime: Tr });
|
|
315
|
-
function g(p) {
|
|
316
|
-
const m = [];
|
|
317
|
-
p.bindings && m.push(p.bindings);
|
|
318
|
-
let A = p[o];
|
|
319
|
-
for (; A.parent; )
|
|
320
|
-
A = A.parent, A.logger.bindings && m.push(A.logger.bindings);
|
|
321
|
-
return m.reverse();
|
|
322
|
-
}
|
|
323
|
-
function y(p, m, A, k) {
|
|
324
|
-
if (Object.defineProperty(p, k, {
|
|
325
|
-
value: i(p.level, A) > i(k, A) ? se : A[t][k],
|
|
326
|
-
writable: !0,
|
|
327
|
-
enumerable: !0,
|
|
328
|
-
configurable: !0
|
|
329
|
-
}), !m.transmit && p[k] === se)
|
|
330
|
-
return;
|
|
331
|
-
p[k] = b(p, m, A, k);
|
|
332
|
-
const E = g(p);
|
|
333
|
-
E.length !== 0 && (p[k] = d(E, p[k]));
|
|
334
|
-
}
|
|
335
|
-
function d(p, m) {
|
|
336
|
-
return function() {
|
|
337
|
-
return m.apply(this, [...p, ...arguments]);
|
|
338
|
-
};
|
|
339
|
-
}
|
|
340
|
-
function b(p, m, A, k) {
|
|
341
|
-
return /* @__PURE__ */ (function(E) {
|
|
342
|
-
return function() {
|
|
343
|
-
const K = m.timestamp(), O = new Array(arguments.length), M = Object.getPrototypeOf && Object.getPrototypeOf(this) === n ? n : this;
|
|
344
|
-
for (var w = 0; w < O.length; w++) O[w] = arguments[w];
|
|
345
|
-
if (m.serialize && !m.asObject && x(O, this._serialize, this.serializers, this._stdErrSerialize), m.asObject || m.formatters ? E.call(M, C(this, k, O, K, m.formatters)) : E.apply(M, O), m.transmit) {
|
|
346
|
-
const Y = m.transmit.level || p._level, ve = A.levels.values[Y], Z = A.levels.values[k];
|
|
347
|
-
if (Z < ve) return;
|
|
348
|
-
_(this, {
|
|
349
|
-
ts: K,
|
|
350
|
-
methodLevel: k,
|
|
351
|
-
methodValue: Z,
|
|
352
|
-
transmitValue: A.levels.values[m.transmit.level || p._level],
|
|
353
|
-
send: m.transmit.send,
|
|
354
|
-
val: i(p._level, A)
|
|
355
|
-
}, O);
|
|
356
|
-
}
|
|
357
|
-
};
|
|
358
|
-
})(p[t][k]);
|
|
359
|
-
}
|
|
360
|
-
function C(p, m, A, k, E = {}) {
|
|
361
|
-
const {
|
|
362
|
-
level: z = () => p.levels.values[m],
|
|
363
|
-
log: K = (Z) => Z
|
|
364
|
-
} = E;
|
|
365
|
-
p._serialize && x(A, p._serialize, p.serializers, p._stdErrSerialize);
|
|
366
|
-
const O = A.slice();
|
|
367
|
-
let M = O[0];
|
|
368
|
-
const w = {};
|
|
369
|
-
k && (w.time = k), w.level = z(m, p.levels.values[m]);
|
|
370
|
-
let Y = (p._childLevel | 0) + 1;
|
|
371
|
-
if (Y < 1 && (Y = 1), M !== null && typeof M == "object") {
|
|
372
|
-
for (; Y-- && typeof O[0] == "object"; )
|
|
373
|
-
Object.assign(w, O.shift());
|
|
374
|
-
M = O.length ? e(O.shift(), O) : void 0;
|
|
375
|
-
} else typeof M == "string" && (M = e(O.shift(), O));
|
|
376
|
-
return M !== void 0 && (w.msg = M), K(w);
|
|
377
|
-
}
|
|
378
|
-
function x(p, m, A, k) {
|
|
379
|
-
for (const E in p)
|
|
380
|
-
if (k && p[E] instanceof Error)
|
|
381
|
-
p[E] = u.stdSerializers.err(p[E]);
|
|
382
|
-
else if (typeof p[E] == "object" && !Array.isArray(p[E]))
|
|
383
|
-
for (const z in p[E])
|
|
384
|
-
m && m.indexOf(z) > -1 && z in A && (p[E][z] = A[z](p[E][z]));
|
|
385
|
-
}
|
|
386
|
-
function _(p, m, A) {
|
|
387
|
-
const k = m.send, E = m.ts, z = m.methodLevel, K = m.methodValue, O = m.val, M = p._logEvent.bindings;
|
|
388
|
-
x(
|
|
389
|
-
A,
|
|
390
|
-
p._serialize || Object.keys(p.serializers),
|
|
391
|
-
p.serializers,
|
|
392
|
-
p._stdErrSerialize === void 0 ? !0 : p._stdErrSerialize
|
|
393
|
-
), p._logEvent.ts = E, p._logEvent.messages = A.filter(function(w) {
|
|
394
|
-
return M.indexOf(w) === -1;
|
|
395
|
-
}), p._logEvent.level.label = z, p._logEvent.level.value = K, k(z, p._logEvent, O), p._logEvent = L(M);
|
|
396
|
-
}
|
|
397
|
-
function L(p) {
|
|
398
|
-
return {
|
|
399
|
-
ts: 0,
|
|
400
|
-
messages: [],
|
|
401
|
-
bindings: p || [],
|
|
402
|
-
level: { label: "", value: 0 }
|
|
403
|
-
};
|
|
404
|
-
}
|
|
405
|
-
function R(p) {
|
|
406
|
-
const m = {
|
|
407
|
-
type: p.constructor.name,
|
|
408
|
-
msg: p.message,
|
|
409
|
-
stack: p.stack
|
|
410
|
-
};
|
|
411
|
-
for (const A in p)
|
|
412
|
-
m[A] === void 0 && (m[A] = p[A]);
|
|
413
|
-
return m;
|
|
414
|
-
}
|
|
415
|
-
function J(p) {
|
|
416
|
-
return typeof p.timestamp == "function" ? p.timestamp : p.timestamp === !1 ? en : nn;
|
|
417
|
-
}
|
|
418
|
-
function V() {
|
|
419
|
-
return {};
|
|
420
|
-
}
|
|
421
|
-
function I(p) {
|
|
422
|
-
return p;
|
|
423
|
-
}
|
|
424
|
-
function se() {
|
|
425
|
-
}
|
|
426
|
-
function en() {
|
|
427
|
-
return !1;
|
|
428
|
-
}
|
|
429
|
-
function nn() {
|
|
430
|
-
return Date.now();
|
|
431
|
-
}
|
|
432
|
-
function Fr() {
|
|
433
|
-
return Math.round(Date.now() / 1e3);
|
|
434
|
-
}
|
|
435
|
-
function Tr() {
|
|
436
|
-
return new Date(Date.now()).toISOString();
|
|
437
|
-
}
|
|
438
|
-
function Lr() {
|
|
439
|
-
function p(m) {
|
|
440
|
-
return typeof m < "u" && m;
|
|
441
|
-
}
|
|
442
|
-
try {
|
|
443
|
-
return typeof globalThis < "u" || Object.defineProperty(Object.prototype, "globalThis", {
|
|
444
|
-
get: function() {
|
|
445
|
-
return delete Object.prototype.globalThis, this.globalThis = this;
|
|
446
|
-
},
|
|
447
|
-
configurable: !0
|
|
448
|
-
}), globalThis;
|
|
449
|
-
} catch {
|
|
450
|
-
return p(self) || p(window) || p(this) || {};
|
|
451
|
-
}
|
|
452
|
-
}
|
|
453
|
-
return ce.exports.default = u, ce.exports.pino = u, ce.exports;
|
|
454
|
-
}
|
|
455
|
-
var Wr = Kr();
|
|
456
|
-
const qr = /* @__PURE__ */ Yr(Wr), X = qr({
|
|
457
|
-
level: process.env.LOG_LEVEL || "info"
|
|
458
|
-
});
|
|
459
|
-
function Gr() {
|
|
460
|
-
return {
|
|
461
|
-
command: "languages",
|
|
462
|
-
describe: "List supported languages from xcodeproj or xcstrings",
|
|
463
|
-
handler: async (e) => {
|
|
464
|
-
const n = await Pn(e.path, e.config);
|
|
465
|
-
X.info(n.join(" "));
|
|
466
|
-
}
|
|
467
|
-
};
|
|
468
|
-
}
|
|
469
|
-
function Vr(e) {
|
|
470
|
-
const n = Oe(e, "project.pbxproj");
|
|
471
|
-
return (zr.open(n).rootObject.props.knownRegions ?? []).filter((o) => o !== "Base").sort();
|
|
472
|
-
}
|
|
473
|
-
async function Xr(e) {
|
|
474
|
-
const n = await me(e), r = /* @__PURE__ */ new Set();
|
|
475
|
-
if (!n.sourceLanguage)
|
|
476
|
-
throw new Error('The xcstrings file is missing "sourceLanguage".');
|
|
477
|
-
r.add(n.sourceLanguage);
|
|
478
|
-
for (const i of Object.keys(n.strings)) {
|
|
479
|
-
const t = n.strings[i];
|
|
480
|
-
if (t.localizations)
|
|
481
|
-
for (const o of Object.keys(t.localizations))
|
|
482
|
-
r.add(o);
|
|
483
|
-
}
|
|
484
|
-
return Array.from(r).sort();
|
|
485
|
-
}
|
|
486
|
-
async function Pn(e, n) {
|
|
487
|
-
const { sourceLanguage: r } = await me(e);
|
|
488
|
-
if (!r)
|
|
489
|
-
throw new Error('The xcstrings file is missing "sourceLanguage".');
|
|
490
|
-
const i = await We(n);
|
|
491
|
-
if (i?.xcodeprojPaths && i.xcodeprojPaths.length > 0) {
|
|
492
|
-
const l = /* @__PURE__ */ new Set();
|
|
493
|
-
l.add(r);
|
|
494
|
-
for (const a of i.xcodeprojPaths)
|
|
495
|
-
Vr(a).forEach((c) => l.add(c));
|
|
496
|
-
return Array.from(l).sort();
|
|
497
|
-
}
|
|
498
|
-
const t = await Xr(e), o = new Set(t);
|
|
499
|
-
return o.add(r), Array.from(o).sort();
|
|
500
|
-
}
|
|
501
|
-
function Dn(e) {
|
|
502
|
-
return typeof e > "u" || e === null;
|
|
503
|
-
}
|
|
504
|
-
function Qr(e) {
|
|
505
|
-
return typeof e == "object" && e !== null;
|
|
506
|
-
}
|
|
507
|
-
function Jr(e) {
|
|
508
|
-
return Array.isArray(e) ? e : Dn(e) ? [] : [e];
|
|
509
|
-
}
|
|
510
|
-
function Zr(e, n) {
|
|
511
|
-
var r, i, t, o;
|
|
512
|
-
if (n)
|
|
513
|
-
for (o = Object.keys(n), r = 0, i = o.length; r < i; r += 1)
|
|
514
|
-
t = o[r], e[t] = n[t];
|
|
515
|
-
return e;
|
|
516
|
-
}
|
|
517
|
-
function ei(e, n) {
|
|
518
|
-
var r = "", i;
|
|
519
|
-
for (i = 0; i < n; i += 1)
|
|
520
|
-
r += e;
|
|
521
|
-
return r;
|
|
522
|
-
}
|
|
523
|
-
function ni(e) {
|
|
524
|
-
return e === 0 && Number.NEGATIVE_INFINITY === 1 / e;
|
|
525
|
-
}
|
|
526
|
-
var ri = Dn, ii = Qr, ti = Jr, oi = ei, li = ni, ai = Zr, T = {
|
|
527
|
-
isNothing: ri,
|
|
528
|
-
isObject: ii,
|
|
529
|
-
toArray: ti,
|
|
530
|
-
repeat: oi,
|
|
531
|
-
isNegativeZero: li,
|
|
532
|
-
extend: ai
|
|
533
|
-
};
|
|
534
|
-
function $n(e, n) {
|
|
535
|
-
var r = "", i = e.reason || "(unknown reason)";
|
|
536
|
-
return e.mark ? (e.mark.name && (r += 'in "' + e.mark.name + '" '), r += "(" + (e.mark.line + 1) + ":" + (e.mark.column + 1) + ")", !n && e.mark.snippet && (r += `
|
|
537
|
-
|
|
538
|
-
` + e.mark.snippet), i + " " + r) : i;
|
|
539
|
-
}
|
|
540
|
-
function fe(e, n) {
|
|
541
|
-
Error.call(this), this.name = "YAMLException", this.reason = e, this.mark = n, this.message = $n(this, !1), Error.captureStackTrace ? Error.captureStackTrace(this, this.constructor) : this.stack = new Error().stack || "";
|
|
542
|
-
}
|
|
543
|
-
fe.prototype = Object.create(Error.prototype);
|
|
544
|
-
fe.prototype.constructor = fe;
|
|
545
|
-
fe.prototype.toString = function(n) {
|
|
546
|
-
return this.name + ": " + $n(this, n);
|
|
547
|
-
};
|
|
548
|
-
var P = fe;
|
|
549
|
-
function Ie(e, n, r, i, t) {
|
|
550
|
-
var o = "", l = "", a = Math.floor(t / 2) - 1;
|
|
551
|
-
return i - n > a && (o = " ... ", n = i - a + o.length), r - i > a && (l = " ...", r = i + a - l.length), {
|
|
552
|
-
str: o + e.slice(n, r).replace(/\t/g, "→") + l,
|
|
553
|
-
pos: i - n + o.length
|
|
554
|
-
// relative position
|
|
555
|
-
};
|
|
556
|
-
}
|
|
557
|
-
function Ne(e, n) {
|
|
558
|
-
return T.repeat(" ", n - e.length) + e;
|
|
559
|
-
}
|
|
560
|
-
function si(e, n) {
|
|
561
|
-
if (n = Object.create(n || null), !e.buffer) return null;
|
|
562
|
-
n.maxLength || (n.maxLength = 79), typeof n.indent != "number" && (n.indent = 1), typeof n.linesBefore != "number" && (n.linesBefore = 3), typeof n.linesAfter != "number" && (n.linesAfter = 2);
|
|
563
|
-
for (var r = /\r?\n|\r|\0/g, i = [0], t = [], o, l = -1; o = r.exec(e.buffer); )
|
|
564
|
-
t.push(o.index), i.push(o.index + o[0].length), e.position <= o.index && l < 0 && (l = i.length - 2);
|
|
565
|
-
l < 0 && (l = i.length - 1);
|
|
566
|
-
var a = "", s, c, u = Math.min(e.line + n.linesAfter, t.length).toString().length, f = n.maxLength - (n.indent + u + 3);
|
|
567
|
-
for (s = 1; s <= n.linesBefore && !(l - s < 0); s++)
|
|
568
|
-
c = Ie(
|
|
569
|
-
e.buffer,
|
|
570
|
-
i[l - s],
|
|
571
|
-
t[l - s],
|
|
572
|
-
e.position - (i[l] - i[l - s]),
|
|
573
|
-
f
|
|
574
|
-
), a = T.repeat(" ", n.indent) + Ne((e.line - s + 1).toString(), u) + " | " + c.str + `
|
|
575
|
-
` + a;
|
|
576
|
-
for (c = Ie(e.buffer, i[l], t[l], e.position, f), a += T.repeat(" ", n.indent) + Ne((e.line + 1).toString(), u) + " | " + c.str + `
|
|
577
|
-
`, a += T.repeat("-", n.indent + u + 3 + c.pos) + `^
|
|
578
|
-
`, s = 1; s <= n.linesAfter && !(l + s >= t.length); s++)
|
|
579
|
-
c = Ie(
|
|
580
|
-
e.buffer,
|
|
581
|
-
i[l + s],
|
|
582
|
-
t[l + s],
|
|
583
|
-
e.position - (i[l] - i[l + s]),
|
|
584
|
-
f
|
|
585
|
-
), a += T.repeat(" ", n.indent) + Ne((e.line + s + 1).toString(), u) + " | " + c.str + `
|
|
586
|
-
`;
|
|
587
|
-
return a.replace(/\n$/, "");
|
|
588
|
-
}
|
|
589
|
-
var ci = si, ui = [
|
|
590
|
-
"kind",
|
|
591
|
-
"multi",
|
|
592
|
-
"resolve",
|
|
593
|
-
"construct",
|
|
594
|
-
"instanceOf",
|
|
595
|
-
"predicate",
|
|
596
|
-
"represent",
|
|
597
|
-
"representName",
|
|
598
|
-
"defaultStyle",
|
|
599
|
-
"styleAliases"
|
|
600
|
-
], fi = [
|
|
601
|
-
"scalar",
|
|
602
|
-
"sequence",
|
|
603
|
-
"mapping"
|
|
604
|
-
];
|
|
605
|
-
function pi(e) {
|
|
606
|
-
var n = {};
|
|
607
|
-
return e !== null && Object.keys(e).forEach(function(r) {
|
|
608
|
-
e[r].forEach(function(i) {
|
|
609
|
-
n[String(i)] = r;
|
|
610
|
-
});
|
|
611
|
-
}), n;
|
|
612
|
-
}
|
|
613
|
-
function di(e, n) {
|
|
614
|
-
if (n = n || {}, Object.keys(n).forEach(function(r) {
|
|
615
|
-
if (ui.indexOf(r) === -1)
|
|
616
|
-
throw new P('Unknown option "' + r + '" is met in definition of "' + e + '" YAML type.');
|
|
617
|
-
}), this.options = n, this.tag = e, this.kind = n.kind || null, this.resolve = n.resolve || function() {
|
|
618
|
-
return !0;
|
|
619
|
-
}, this.construct = n.construct || function(r) {
|
|
620
|
-
return r;
|
|
621
|
-
}, this.instanceOf = n.instanceOf || null, this.predicate = n.predicate || null, this.represent = n.represent || null, this.representName = n.representName || null, this.defaultStyle = n.defaultStyle || null, this.multi = n.multi || !1, this.styleAliases = pi(n.styleAliases || null), fi.indexOf(this.kind) === -1)
|
|
622
|
-
throw new P('Unknown kind "' + this.kind + '" is specified for "' + e + '" YAML type.');
|
|
623
|
-
}
|
|
624
|
-
var j = di;
|
|
625
|
-
function pn(e, n) {
|
|
626
|
-
var r = [];
|
|
627
|
-
return e[n].forEach(function(i) {
|
|
628
|
-
var t = r.length;
|
|
629
|
-
r.forEach(function(o, l) {
|
|
630
|
-
o.tag === i.tag && o.kind === i.kind && o.multi === i.multi && (t = l);
|
|
631
|
-
}), r[t] = i;
|
|
632
|
-
}), r;
|
|
633
|
-
}
|
|
634
|
-
function hi() {
|
|
635
|
-
var e = {
|
|
636
|
-
scalar: {},
|
|
637
|
-
sequence: {},
|
|
638
|
-
mapping: {},
|
|
639
|
-
fallback: {},
|
|
640
|
-
multi: {
|
|
641
|
-
scalar: [],
|
|
642
|
-
sequence: [],
|
|
643
|
-
mapping: [],
|
|
644
|
-
fallback: []
|
|
645
|
-
}
|
|
646
|
-
}, n, r;
|
|
647
|
-
function i(t) {
|
|
648
|
-
t.multi ? (e.multi[t.kind].push(t), e.multi.fallback.push(t)) : e[t.kind][t.tag] = e.fallback[t.tag] = t;
|
|
649
|
-
}
|
|
650
|
-
for (n = 0, r = arguments.length; n < r; n += 1)
|
|
651
|
-
arguments[n].forEach(i);
|
|
652
|
-
return e;
|
|
653
|
-
}
|
|
654
|
-
function ze(e) {
|
|
655
|
-
return this.extend(e);
|
|
656
|
-
}
|
|
657
|
-
ze.prototype.extend = function(n) {
|
|
658
|
-
var r = [], i = [];
|
|
659
|
-
if (n instanceof j)
|
|
660
|
-
i.push(n);
|
|
661
|
-
else if (Array.isArray(n))
|
|
662
|
-
i = i.concat(n);
|
|
663
|
-
else if (n && (Array.isArray(n.implicit) || Array.isArray(n.explicit)))
|
|
664
|
-
n.implicit && (r = r.concat(n.implicit)), n.explicit && (i = i.concat(n.explicit));
|
|
665
|
-
else
|
|
666
|
-
throw new P("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");
|
|
667
|
-
r.forEach(function(o) {
|
|
668
|
-
if (!(o instanceof j))
|
|
669
|
-
throw new P("Specified list of YAML types (or a single Type object) contains a non-Type object.");
|
|
670
|
-
if (o.loadKind && o.loadKind !== "scalar")
|
|
671
|
-
throw new P("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");
|
|
672
|
-
if (o.multi)
|
|
673
|
-
throw new P("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.");
|
|
674
|
-
}), i.forEach(function(o) {
|
|
675
|
-
if (!(o instanceof j))
|
|
676
|
-
throw new P("Specified list of YAML types (or a single Type object) contains a non-Type object.");
|
|
677
|
-
});
|
|
678
|
-
var t = Object.create(ze.prototype);
|
|
679
|
-
return t.implicit = (this.implicit || []).concat(r), t.explicit = (this.explicit || []).concat(i), t.compiledImplicit = pn(t, "implicit"), t.compiledExplicit = pn(t, "explicit"), t.compiledTypeMap = hi(t.compiledImplicit, t.compiledExplicit), t;
|
|
680
|
-
};
|
|
681
|
-
var zn = ze, Bn = new j("tag:yaml.org,2002:str", {
|
|
682
|
-
kind: "scalar",
|
|
683
|
-
construct: function(e) {
|
|
684
|
-
return e !== null ? e : "";
|
|
685
|
-
}
|
|
686
|
-
}), Un = new j("tag:yaml.org,2002:seq", {
|
|
687
|
-
kind: "sequence",
|
|
688
|
-
construct: function(e) {
|
|
689
|
-
return e !== null ? e : [];
|
|
690
|
-
}
|
|
691
|
-
}), Yn = new j("tag:yaml.org,2002:map", {
|
|
692
|
-
kind: "mapping",
|
|
693
|
-
construct: function(e) {
|
|
694
|
-
return e !== null ? e : {};
|
|
695
|
-
}
|
|
696
|
-
}), Hn = new zn({
|
|
206
|
+
}), Xn = new Wn({
|
|
697
207
|
explicit: [
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
208
|
+
qn,
|
|
209
|
+
Gn,
|
|
210
|
+
Vn
|
|
701
211
|
]
|
|
702
212
|
});
|
|
703
|
-
function
|
|
213
|
+
function xi(e) {
|
|
704
214
|
if (e === null) return !0;
|
|
705
215
|
var n = e.length;
|
|
706
216
|
return n === 1 && e === "~" || n === 4 && (e === "null" || e === "Null" || e === "NULL");
|
|
707
217
|
}
|
|
708
|
-
function
|
|
218
|
+
function wi() {
|
|
709
219
|
return null;
|
|
710
220
|
}
|
|
711
|
-
function
|
|
221
|
+
function bi(e) {
|
|
712
222
|
return e === null;
|
|
713
223
|
}
|
|
714
|
-
var
|
|
224
|
+
var Jn = new j("tag:yaml.org,2002:null", {
|
|
715
225
|
kind: "scalar",
|
|
716
|
-
resolve:
|
|
717
|
-
construct:
|
|
718
|
-
predicate:
|
|
226
|
+
resolve: xi,
|
|
227
|
+
construct: wi,
|
|
228
|
+
predicate: bi,
|
|
719
229
|
represent: {
|
|
720
230
|
canonical: function() {
|
|
721
231
|
return "~";
|
|
@@ -735,22 +245,22 @@ var Kn = new j("tag:yaml.org,2002:null", {
|
|
|
735
245
|
},
|
|
736
246
|
defaultStyle: "lowercase"
|
|
737
247
|
});
|
|
738
|
-
function
|
|
248
|
+
function Ai(e) {
|
|
739
249
|
if (e === null) return !1;
|
|
740
250
|
var n = e.length;
|
|
741
251
|
return n === 4 && (e === "true" || e === "True" || e === "TRUE") || n === 5 && (e === "false" || e === "False" || e === "FALSE");
|
|
742
252
|
}
|
|
743
|
-
function
|
|
253
|
+
function ki(e) {
|
|
744
254
|
return e === "true" || e === "True" || e === "TRUE";
|
|
745
255
|
}
|
|
746
|
-
function
|
|
256
|
+
function Si(e) {
|
|
747
257
|
return Object.prototype.toString.call(e) === "[object Boolean]";
|
|
748
258
|
}
|
|
749
|
-
var
|
|
259
|
+
var Qn = new j("tag:yaml.org,2002:bool", {
|
|
750
260
|
kind: "scalar",
|
|
751
|
-
resolve:
|
|
752
|
-
construct:
|
|
753
|
-
predicate:
|
|
261
|
+
resolve: Ai,
|
|
262
|
+
construct: ki,
|
|
263
|
+
predicate: Si,
|
|
754
264
|
represent: {
|
|
755
265
|
lowercase: function(e) {
|
|
756
266
|
return e ? "true" : "false";
|
|
@@ -764,16 +274,16 @@ var Wn = new j("tag:yaml.org,2002:bool", {
|
|
|
764
274
|
},
|
|
765
275
|
defaultStyle: "lowercase"
|
|
766
276
|
});
|
|
767
|
-
function
|
|
277
|
+
function Ci(e) {
|
|
768
278
|
return 48 <= e && e <= 57 || 65 <= e && e <= 70 || 97 <= e && e <= 102;
|
|
769
279
|
}
|
|
770
|
-
function
|
|
280
|
+
function Ei(e) {
|
|
771
281
|
return 48 <= e && e <= 55;
|
|
772
282
|
}
|
|
773
|
-
function
|
|
283
|
+
function Oi(e) {
|
|
774
284
|
return 48 <= e && e <= 57;
|
|
775
285
|
}
|
|
776
|
-
function
|
|
286
|
+
function _i(e) {
|
|
777
287
|
if (e === null) return !1;
|
|
778
288
|
var n = e.length, r = 0, i = !1, t;
|
|
779
289
|
if (!n) return !1;
|
|
@@ -790,7 +300,7 @@ function Si(e) {
|
|
|
790
300
|
if (t === "x") {
|
|
791
301
|
for (r++; r < n; r++)
|
|
792
302
|
if (t = e[r], t !== "_") {
|
|
793
|
-
if (!
|
|
303
|
+
if (!Ci(e.charCodeAt(r))) return !1;
|
|
794
304
|
i = !0;
|
|
795
305
|
}
|
|
796
306
|
return i && t !== "_";
|
|
@@ -798,7 +308,7 @@ function Si(e) {
|
|
|
798
308
|
if (t === "o") {
|
|
799
309
|
for (r++; r < n; r++)
|
|
800
310
|
if (t = e[r], t !== "_") {
|
|
801
|
-
if (!
|
|
311
|
+
if (!Ei(e.charCodeAt(r))) return !1;
|
|
802
312
|
i = !0;
|
|
803
313
|
}
|
|
804
314
|
return i && t !== "_";
|
|
@@ -807,13 +317,13 @@ function Si(e) {
|
|
|
807
317
|
if (t === "_") return !1;
|
|
808
318
|
for (; r < n; r++)
|
|
809
319
|
if (t = e[r], t !== "_") {
|
|
810
|
-
if (!
|
|
320
|
+
if (!Oi(e.charCodeAt(r)))
|
|
811
321
|
return !1;
|
|
812
322
|
i = !0;
|
|
813
323
|
}
|
|
814
324
|
return !(!i || t === "_");
|
|
815
325
|
}
|
|
816
|
-
function
|
|
326
|
+
function Fi(e) {
|
|
817
327
|
var n = e, r = 1, i;
|
|
818
328
|
if (n.indexOf("_") !== -1 && (n = n.replace(/_/g, "")), i = n[0], (i === "-" || i === "+") && (i === "-" && (r = -1), n = n.slice(1), i = n[0]), n === "0") return 0;
|
|
819
329
|
if (i === "0") {
|
|
@@ -823,14 +333,14 @@ function ki(e) {
|
|
|
823
333
|
}
|
|
824
334
|
return r * parseInt(n, 10);
|
|
825
335
|
}
|
|
826
|
-
function
|
|
336
|
+
function Ti(e) {
|
|
827
337
|
return Object.prototype.toString.call(e) === "[object Number]" && e % 1 === 0 && !T.isNegativeZero(e);
|
|
828
338
|
}
|
|
829
|
-
var
|
|
339
|
+
var Zn = new j("tag:yaml.org,2002:int", {
|
|
830
340
|
kind: "scalar",
|
|
831
|
-
resolve:
|
|
832
|
-
construct:
|
|
833
|
-
predicate:
|
|
341
|
+
resolve: _i,
|
|
342
|
+
construct: Fi,
|
|
343
|
+
predicate: Ti,
|
|
834
344
|
represent: {
|
|
835
345
|
binary: function(e) {
|
|
836
346
|
return e >= 0 ? "0b" + e.toString(2) : "-0b" + e.toString(2).slice(1);
|
|
@@ -853,21 +363,21 @@ var qn = new j("tag:yaml.org,2002:int", {
|
|
|
853
363
|
decimal: [10, "dec"],
|
|
854
364
|
hexadecimal: [16, "hex"]
|
|
855
365
|
}
|
|
856
|
-
}),
|
|
366
|
+
}), Li = new RegExp(
|
|
857
367
|
// 2.5e4, 2.5 and integers
|
|
858
368
|
"^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$"
|
|
859
369
|
);
|
|
860
|
-
function
|
|
861
|
-
return !(e === null || !
|
|
370
|
+
function ji(e) {
|
|
371
|
+
return !(e === null || !Li.test(e) || // Quick hack to not allow integers end with `_`
|
|
862
372
|
// Probably should update regexp & check speed
|
|
863
373
|
e[e.length - 1] === "_");
|
|
864
374
|
}
|
|
865
|
-
function
|
|
375
|
+
function Ii(e) {
|
|
866
376
|
var n, r;
|
|
867
377
|
return n = e.replace(/_/g, "").toLowerCase(), r = n[0] === "-" ? -1 : 1, "+-".indexOf(n[0]) >= 0 && (n = n.slice(1)), n === ".inf" ? r === 1 ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY : n === ".nan" ? NaN : r * parseFloat(n, 10);
|
|
868
378
|
}
|
|
869
|
-
var
|
|
870
|
-
function
|
|
379
|
+
var Ni = /^[-+]?[0-9]+e/;
|
|
380
|
+
function Pi(e, n) {
|
|
871
381
|
var r;
|
|
872
382
|
if (isNaN(e))
|
|
873
383
|
switch (n) {
|
|
@@ -898,36 +408,36 @@ function Li(e, n) {
|
|
|
898
408
|
}
|
|
899
409
|
else if (T.isNegativeZero(e))
|
|
900
410
|
return "-0.0";
|
|
901
|
-
return r = e.toString(10),
|
|
411
|
+
return r = e.toString(10), Ni.test(r) ? r.replace("e", ".e") : r;
|
|
902
412
|
}
|
|
903
|
-
function
|
|
413
|
+
function Ri(e) {
|
|
904
414
|
return Object.prototype.toString.call(e) === "[object Number]" && (e % 1 !== 0 || T.isNegativeZero(e));
|
|
905
415
|
}
|
|
906
|
-
var
|
|
416
|
+
var er = new j("tag:yaml.org,2002:float", {
|
|
907
417
|
kind: "scalar",
|
|
908
|
-
resolve:
|
|
909
|
-
construct:
|
|
910
|
-
predicate:
|
|
911
|
-
represent:
|
|
418
|
+
resolve: ji,
|
|
419
|
+
construct: Ii,
|
|
420
|
+
predicate: Ri,
|
|
421
|
+
represent: Pi,
|
|
912
422
|
defaultStyle: "lowercase"
|
|
913
|
-
}),
|
|
423
|
+
}), nr = Xn.extend({
|
|
914
424
|
implicit: [
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
425
|
+
Jn,
|
|
426
|
+
Qn,
|
|
427
|
+
Zn,
|
|
428
|
+
er
|
|
919
429
|
]
|
|
920
|
-
}),
|
|
430
|
+
}), rr = nr, ir = new RegExp(
|
|
921
431
|
"^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"
|
|
922
|
-
),
|
|
432
|
+
), tr = new RegExp(
|
|
923
433
|
"^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$"
|
|
924
434
|
);
|
|
925
|
-
function
|
|
926
|
-
return e === null ? !1 :
|
|
435
|
+
function Mi(e) {
|
|
436
|
+
return e === null ? !1 : ir.exec(e) !== null || tr.exec(e) !== null;
|
|
927
437
|
}
|
|
928
|
-
function
|
|
929
|
-
var n, r, i, t, o, l, a, s = 0, c = null,
|
|
930
|
-
if (n =
|
|
438
|
+
function Di(e) {
|
|
439
|
+
var n, r, i, t, o, l, a, s = 0, c = null, f, u, h;
|
|
440
|
+
if (n = ir.exec(e), n === null && (n = tr.exec(e)), n === null) throw new Error("Date resolve error");
|
|
931
441
|
if (r = +n[1], i = +n[2] - 1, t = +n[3], !n[4])
|
|
932
442
|
return new Date(Date.UTC(r, i, t));
|
|
933
443
|
if (o = +n[4], l = +n[5], a = +n[6], n[7]) {
|
|
@@ -935,29 +445,29 @@ function Ni(e) {
|
|
|
935
445
|
s += "0";
|
|
936
446
|
s = +s;
|
|
937
447
|
}
|
|
938
|
-
return n[9] && (
|
|
448
|
+
return n[9] && (f = +n[10], u = +(n[11] || 0), c = (f * 60 + u) * 6e4, n[9] === "-" && (c = -c)), h = new Date(Date.UTC(r, i, t, o, l, a, s)), c && h.setTime(h.getTime() - c), h;
|
|
939
449
|
}
|
|
940
|
-
function
|
|
450
|
+
function zi(e) {
|
|
941
451
|
return e.toISOString();
|
|
942
452
|
}
|
|
943
|
-
var
|
|
453
|
+
var or = new j("tag:yaml.org,2002:timestamp", {
|
|
944
454
|
kind: "scalar",
|
|
945
|
-
resolve:
|
|
946
|
-
construct:
|
|
455
|
+
resolve: Mi,
|
|
456
|
+
construct: Di,
|
|
947
457
|
instanceOf: Date,
|
|
948
|
-
represent:
|
|
458
|
+
represent: zi
|
|
949
459
|
});
|
|
950
|
-
function
|
|
460
|
+
function $i(e) {
|
|
951
461
|
return e === "<<" || e === null;
|
|
952
462
|
}
|
|
953
|
-
var
|
|
463
|
+
var lr = new j("tag:yaml.org,2002:merge", {
|
|
954
464
|
kind: "scalar",
|
|
955
|
-
resolve:
|
|
956
|
-
}),
|
|
465
|
+
resolve: $i
|
|
466
|
+
}), nn = `ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=
|
|
957
467
|
\r`;
|
|
958
|
-
function
|
|
468
|
+
function Ui(e) {
|
|
959
469
|
if (e === null) return !1;
|
|
960
|
-
var n, r, i = 0, t = e.length, o =
|
|
470
|
+
var n, r, i = 0, t = e.length, o = nn;
|
|
961
471
|
for (r = 0; r < t; r++)
|
|
962
472
|
if (n = o.indexOf(e.charAt(r)), !(n > 64)) {
|
|
963
473
|
if (n < 0) return !1;
|
|
@@ -965,35 +475,35 @@ function Pi(e) {
|
|
|
965
475
|
}
|
|
966
476
|
return i % 8 === 0;
|
|
967
477
|
}
|
|
968
|
-
function
|
|
969
|
-
var n, r, i = e.replace(/[\r\n=]/g, ""), t = i.length, o =
|
|
478
|
+
function Bi(e) {
|
|
479
|
+
var n, r, i = e.replace(/[\r\n=]/g, ""), t = i.length, o = nn, l = 0, a = [];
|
|
970
480
|
for (n = 0; n < t; n++)
|
|
971
481
|
n % 4 === 0 && n && (a.push(l >> 16 & 255), a.push(l >> 8 & 255), a.push(l & 255)), l = l << 6 | o.indexOf(i.charAt(n));
|
|
972
482
|
return r = t % 4 * 6, r === 0 ? (a.push(l >> 16 & 255), a.push(l >> 8 & 255), a.push(l & 255)) : r === 18 ? (a.push(l >> 10 & 255), a.push(l >> 2 & 255)) : r === 12 && a.push(l >> 4 & 255), new Uint8Array(a);
|
|
973
483
|
}
|
|
974
|
-
function
|
|
975
|
-
var n = "", r = 0, i, t, o = e.length, l =
|
|
484
|
+
function Yi(e) {
|
|
485
|
+
var n = "", r = 0, i, t, o = e.length, l = nn;
|
|
976
486
|
for (i = 0; i < o; i++)
|
|
977
487
|
i % 3 === 0 && i && (n += l[r >> 18 & 63], n += l[r >> 12 & 63], n += l[r >> 6 & 63], n += l[r & 63]), r = (r << 8) + e[i];
|
|
978
488
|
return t = o % 3, t === 0 ? (n += l[r >> 18 & 63], n += l[r >> 12 & 63], n += l[r >> 6 & 63], n += l[r & 63]) : t === 2 ? (n += l[r >> 10 & 63], n += l[r >> 4 & 63], n += l[r << 2 & 63], n += l[64]) : t === 1 && (n += l[r >> 2 & 63], n += l[r << 4 & 63], n += l[64], n += l[64]), n;
|
|
979
489
|
}
|
|
980
|
-
function
|
|
490
|
+
function Hi(e) {
|
|
981
491
|
return Object.prototype.toString.call(e) === "[object Uint8Array]";
|
|
982
492
|
}
|
|
983
|
-
var
|
|
493
|
+
var ar = new j("tag:yaml.org,2002:binary", {
|
|
984
494
|
kind: "scalar",
|
|
985
|
-
resolve:
|
|
986
|
-
construct:
|
|
987
|
-
predicate:
|
|
988
|
-
represent:
|
|
989
|
-
}),
|
|
990
|
-
function
|
|
495
|
+
resolve: Ui,
|
|
496
|
+
construct: Bi,
|
|
497
|
+
predicate: Hi,
|
|
498
|
+
represent: Yi
|
|
499
|
+
}), Ki = Object.prototype.hasOwnProperty, Wi = Object.prototype.toString;
|
|
500
|
+
function qi(e) {
|
|
991
501
|
if (e === null) return !0;
|
|
992
502
|
var n = [], r, i, t, o, l, a = e;
|
|
993
503
|
for (r = 0, i = a.length; r < i; r += 1) {
|
|
994
|
-
if (t = a[r], l = !1,
|
|
504
|
+
if (t = a[r], l = !1, Wi.call(t) !== "[object Object]") return !1;
|
|
995
505
|
for (o in t)
|
|
996
|
-
if (
|
|
506
|
+
if (Ki.call(t, o))
|
|
997
507
|
if (!l) l = !0;
|
|
998
508
|
else return !1;
|
|
999
509
|
if (!l) return !1;
|
|
@@ -1002,98 +512,98 @@ function Yi(e) {
|
|
|
1002
512
|
}
|
|
1003
513
|
return !0;
|
|
1004
514
|
}
|
|
1005
|
-
function
|
|
515
|
+
function Gi(e) {
|
|
1006
516
|
return e !== null ? e : [];
|
|
1007
517
|
}
|
|
1008
|
-
var
|
|
518
|
+
var sr = new j("tag:yaml.org,2002:omap", {
|
|
1009
519
|
kind: "sequence",
|
|
1010
|
-
resolve:
|
|
1011
|
-
construct:
|
|
1012
|
-
}),
|
|
1013
|
-
function
|
|
520
|
+
resolve: qi,
|
|
521
|
+
construct: Gi
|
|
522
|
+
}), Vi = Object.prototype.toString;
|
|
523
|
+
function Xi(e) {
|
|
1014
524
|
if (e === null) return !0;
|
|
1015
525
|
var n, r, i, t, o, l = e;
|
|
1016
526
|
for (o = new Array(l.length), n = 0, r = l.length; n < r; n += 1) {
|
|
1017
|
-
if (i = l[n],
|
|
527
|
+
if (i = l[n], Vi.call(i) !== "[object Object]" || (t = Object.keys(i), t.length !== 1)) return !1;
|
|
1018
528
|
o[n] = [t[0], i[t[0]]];
|
|
1019
529
|
}
|
|
1020
530
|
return !0;
|
|
1021
531
|
}
|
|
1022
|
-
function
|
|
532
|
+
function Ji(e) {
|
|
1023
533
|
if (e === null) return [];
|
|
1024
534
|
var n, r, i, t, o, l = e;
|
|
1025
535
|
for (o = new Array(l.length), n = 0, r = l.length; n < r; n += 1)
|
|
1026
536
|
i = l[n], t = Object.keys(i), o[n] = [t[0], i[t[0]]];
|
|
1027
537
|
return o;
|
|
1028
538
|
}
|
|
1029
|
-
var
|
|
539
|
+
var cr = new j("tag:yaml.org,2002:pairs", {
|
|
1030
540
|
kind: "sequence",
|
|
1031
|
-
resolve:
|
|
1032
|
-
construct:
|
|
1033
|
-
}),
|
|
1034
|
-
function
|
|
541
|
+
resolve: Xi,
|
|
542
|
+
construct: Ji
|
|
543
|
+
}), Qi = Object.prototype.hasOwnProperty;
|
|
544
|
+
function Zi(e) {
|
|
1035
545
|
if (e === null) return !0;
|
|
1036
546
|
var n, r = e;
|
|
1037
547
|
for (n in r)
|
|
1038
|
-
if (
|
|
548
|
+
if (Qi.call(r, n) && r[n] !== null)
|
|
1039
549
|
return !1;
|
|
1040
550
|
return !0;
|
|
1041
551
|
}
|
|
1042
|
-
function
|
|
552
|
+
function et(e) {
|
|
1043
553
|
return e !== null ? e : {};
|
|
1044
554
|
}
|
|
1045
|
-
var
|
|
555
|
+
var ur = new j("tag:yaml.org,2002:set", {
|
|
1046
556
|
kind: "mapping",
|
|
1047
|
-
resolve:
|
|
1048
|
-
construct:
|
|
1049
|
-
}),
|
|
557
|
+
resolve: Zi,
|
|
558
|
+
construct: et
|
|
559
|
+
}), rn = rr.extend({
|
|
1050
560
|
implicit: [
|
|
1051
|
-
|
|
1052
|
-
|
|
561
|
+
or,
|
|
562
|
+
lr
|
|
1053
563
|
],
|
|
1054
564
|
explicit: [
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
565
|
+
ar,
|
|
566
|
+
sr,
|
|
567
|
+
cr,
|
|
568
|
+
ur
|
|
1059
569
|
]
|
|
1060
|
-
}), G = Object.prototype.hasOwnProperty,
|
|
1061
|
-
function
|
|
570
|
+
}), G = Object.prototype.hasOwnProperty, Oe = 1, fr = 2, pr = 3, _e = 4, ze = 1, nt = 2, bn = 3, rt = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/, it = /[\x85\u2028\u2029]/, tt = /[,\[\]\{\}]/, dr = /^(?:!|!!|![a-z\-]+!)$/i, hr = /^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;
|
|
571
|
+
function An(e) {
|
|
1062
572
|
return Object.prototype.toString.call(e);
|
|
1063
573
|
}
|
|
1064
574
|
function H(e) {
|
|
1065
575
|
return e === 10 || e === 13;
|
|
1066
576
|
}
|
|
1067
|
-
function
|
|
577
|
+
function J(e) {
|
|
1068
578
|
return e === 9 || e === 32;
|
|
1069
579
|
}
|
|
1070
|
-
function
|
|
580
|
+
function B(e) {
|
|
1071
581
|
return e === 9 || e === 32 || e === 10 || e === 13;
|
|
1072
582
|
}
|
|
1073
|
-
function
|
|
583
|
+
function te(e) {
|
|
1074
584
|
return e === 44 || e === 91 || e === 93 || e === 123 || e === 125;
|
|
1075
585
|
}
|
|
1076
|
-
function
|
|
586
|
+
function ot(e) {
|
|
1077
587
|
var n;
|
|
1078
588
|
return 48 <= e && e <= 57 ? e - 48 : (n = e | 32, 97 <= n && n <= 102 ? n - 97 + 10 : -1);
|
|
1079
589
|
}
|
|
1080
|
-
function
|
|
590
|
+
function lt(e) {
|
|
1081
591
|
return e === 120 ? 2 : e === 117 ? 4 : e === 85 ? 8 : 0;
|
|
1082
592
|
}
|
|
1083
|
-
function
|
|
593
|
+
function at(e) {
|
|
1084
594
|
return 48 <= e && e <= 57 ? e - 48 : -1;
|
|
1085
595
|
}
|
|
1086
|
-
function
|
|
596
|
+
function kn(e) {
|
|
1087
597
|
return e === 48 ? "\0" : e === 97 ? "\x07" : e === 98 ? "\b" : e === 116 || e === 9 ? " " : e === 110 ? `
|
|
1088
598
|
` : e === 118 ? "\v" : e === 102 ? "\f" : e === 114 ? "\r" : e === 101 ? "\x1B" : e === 32 ? " " : e === 34 ? '"' : e === 47 ? "/" : e === 92 ? "\\" : e === 78 ? "
" : e === 95 ? " " : e === 76 ? "\u2028" : e === 80 ? "\u2029" : "";
|
|
1089
599
|
}
|
|
1090
|
-
function
|
|
600
|
+
function st(e) {
|
|
1091
601
|
return e <= 65535 ? String.fromCharCode(e) : String.fromCharCode(
|
|
1092
602
|
(e - 65536 >> 10) + 55296,
|
|
1093
603
|
(e - 65536 & 1023) + 56320
|
|
1094
604
|
);
|
|
1095
605
|
}
|
|
1096
|
-
function
|
|
606
|
+
function gr(e, n, r) {
|
|
1097
607
|
n === "__proto__" ? Object.defineProperty(e, n, {
|
|
1098
608
|
configurable: !0,
|
|
1099
609
|
enumerable: !0,
|
|
@@ -1101,13 +611,13 @@ function cr(e, n, r) {
|
|
|
1101
611
|
value: r
|
|
1102
612
|
}) : e[n] = r;
|
|
1103
613
|
}
|
|
1104
|
-
var
|
|
1105
|
-
for (var
|
|
1106
|
-
|
|
1107
|
-
function
|
|
1108
|
-
this.input = e, this.filename = n.filename || null, this.schema = n.schema ||
|
|
614
|
+
var mr = new Array(256), yr = new Array(256);
|
|
615
|
+
for (var re = 0; re < 256; re++)
|
|
616
|
+
mr[re] = kn(re) ? 1 : 0, yr[re] = kn(re);
|
|
617
|
+
function ct(e, n) {
|
|
618
|
+
this.input = e, this.filename = n.filename || null, this.schema = n.schema || rn, this.onWarning = n.onWarning || null, this.legacy = n.legacy || !1, this.json = n.json || !1, this.listener = n.listener || null, this.implicitTypes = this.schema.compiledImplicit, this.typeMap = this.schema.compiledTypeMap, this.length = e.length, this.position = 0, this.line = 0, this.lineStart = 0, this.lineIndent = 0, this.firstTabInLine = -1, this.documents = [];
|
|
1109
619
|
}
|
|
1110
|
-
function
|
|
620
|
+
function vr(e, n) {
|
|
1111
621
|
var r = {
|
|
1112
622
|
name: e.filename,
|
|
1113
623
|
buffer: e.input.slice(0, -1),
|
|
@@ -1116,26 +626,26 @@ function pr(e, n) {
|
|
|
1116
626
|
line: e.line,
|
|
1117
627
|
column: e.position - e.lineStart
|
|
1118
628
|
};
|
|
1119
|
-
return r.snippet =
|
|
629
|
+
return r.snippet = di(r), new M(n, r);
|
|
1120
630
|
}
|
|
1121
|
-
function
|
|
1122
|
-
throw
|
|
631
|
+
function x(e, n) {
|
|
632
|
+
throw vr(e, n);
|
|
1123
633
|
}
|
|
1124
|
-
function
|
|
1125
|
-
e.onWarning && e.onWarning.call(null,
|
|
634
|
+
function Fe(e, n) {
|
|
635
|
+
e.onWarning && e.onWarning.call(null, vr(e, n));
|
|
1126
636
|
}
|
|
1127
|
-
var
|
|
637
|
+
var Sn = {
|
|
1128
638
|
YAML: function(n, r, i) {
|
|
1129
639
|
var t, o, l;
|
|
1130
|
-
n.version !== null &&
|
|
640
|
+
n.version !== null && x(n, "duplication of %YAML directive"), i.length !== 1 && x(n, "YAML directive accepts exactly one argument"), t = /^([0-9]+)\.([0-9]+)$/.exec(i[0]), t === null && x(n, "ill-formed argument of the YAML directive"), o = parseInt(t[1], 10), l = parseInt(t[2], 10), o !== 1 && x(n, "unacceptable YAML version of the document"), n.version = i[0], n.checkLineBreaks = l < 2, l !== 1 && l !== 2 && Fe(n, "unsupported YAML version of the document");
|
|
1131
641
|
},
|
|
1132
642
|
TAG: function(n, r, i) {
|
|
1133
643
|
var t, o;
|
|
1134
|
-
i.length !== 2 &&
|
|
644
|
+
i.length !== 2 && x(n, "TAG directive accepts exactly two arguments"), t = i[0], o = i[1], dr.test(t) || x(n, "ill-formed tag handle (first argument) of the TAG directive"), G.call(n.tagMap, t) && x(n, 'there is a previously declared suffix for "' + t + '" tag handle'), hr.test(o) || x(n, "ill-formed tag prefix (second argument) of the TAG directive");
|
|
1135
645
|
try {
|
|
1136
646
|
o = decodeURIComponent(o);
|
|
1137
647
|
} catch {
|
|
1138
|
-
|
|
648
|
+
x(n, "tag prefix is malformed: " + o);
|
|
1139
649
|
}
|
|
1140
650
|
n.tagMap[t] = o;
|
|
1141
651
|
}
|
|
@@ -1145,87 +655,87 @@ function q(e, n, r, i) {
|
|
|
1145
655
|
if (n < r) {
|
|
1146
656
|
if (a = e.input.slice(n, r), i)
|
|
1147
657
|
for (t = 0, o = a.length; t < o; t += 1)
|
|
1148
|
-
l = a.charCodeAt(t), l === 9 || 32 <= l && l <= 1114111 ||
|
|
1149
|
-
else
|
|
658
|
+
l = a.charCodeAt(t), l === 9 || 32 <= l && l <= 1114111 || x(e, "expected valid JSON character");
|
|
659
|
+
else rt.test(a) && x(e, "the stream contains non-printable characters");
|
|
1150
660
|
e.result += a;
|
|
1151
661
|
}
|
|
1152
662
|
}
|
|
1153
|
-
function
|
|
663
|
+
function Cn(e, n, r, i) {
|
|
1154
664
|
var t, o, l, a;
|
|
1155
|
-
for (T.isObject(r) ||
|
|
1156
|
-
o = t[l], G.call(n, o) || (
|
|
665
|
+
for (T.isObject(r) || x(e, "cannot merge mappings; the provided source object is unacceptable"), t = Object.keys(r), l = 0, a = t.length; l < a; l += 1)
|
|
666
|
+
o = t[l], G.call(n, o) || (gr(n, o, r[o]), i[o] = !0);
|
|
1157
667
|
}
|
|
1158
|
-
function
|
|
1159
|
-
var c,
|
|
668
|
+
function oe(e, n, r, i, t, o, l, a, s) {
|
|
669
|
+
var c, f;
|
|
1160
670
|
if (Array.isArray(t))
|
|
1161
|
-
for (t = Array.prototype.slice.call(t), c = 0,
|
|
1162
|
-
Array.isArray(t[c]) &&
|
|
1163
|
-
if (typeof t == "object" &&
|
|
671
|
+
for (t = Array.prototype.slice.call(t), c = 0, f = t.length; c < f; c += 1)
|
|
672
|
+
Array.isArray(t[c]) && x(e, "nested arrays are not supported inside keys"), typeof t == "object" && An(t[c]) === "[object Object]" && (t[c] = "[object Object]");
|
|
673
|
+
if (typeof t == "object" && An(t) === "[object Object]" && (t = "[object Object]"), t = String(t), n === null && (n = {}), i === "tag:yaml.org,2002:merge")
|
|
1164
674
|
if (Array.isArray(o))
|
|
1165
|
-
for (c = 0,
|
|
1166
|
-
|
|
675
|
+
for (c = 0, f = o.length; c < f; c += 1)
|
|
676
|
+
Cn(e, n, o[c], r);
|
|
1167
677
|
else
|
|
1168
|
-
|
|
678
|
+
Cn(e, n, o, r);
|
|
1169
679
|
else
|
|
1170
|
-
!e.json && !G.call(r, t) && G.call(n, t) && (e.line = l || e.line, e.lineStart = a || e.lineStart, e.position = s || e.position,
|
|
680
|
+
!e.json && !G.call(r, t) && G.call(n, t) && (e.line = l || e.line, e.lineStart = a || e.lineStart, e.position = s || e.position, x(e, "duplicated mapping key")), gr(n, t, o), delete r[t];
|
|
1171
681
|
return n;
|
|
1172
682
|
}
|
|
1173
|
-
function
|
|
683
|
+
function tn(e) {
|
|
1174
684
|
var n;
|
|
1175
|
-
n = e.input.charCodeAt(e.position), n === 10 ? e.position++ : n === 13 ? (e.position++, e.input.charCodeAt(e.position) === 10 && e.position++) :
|
|
685
|
+
n = e.input.charCodeAt(e.position), n === 10 ? e.position++ : n === 13 ? (e.position++, e.input.charCodeAt(e.position) === 10 && e.position++) : x(e, "a line break is expected"), e.line += 1, e.lineStart = e.position, e.firstTabInLine = -1;
|
|
1176
686
|
}
|
|
1177
687
|
function F(e, n, r) {
|
|
1178
688
|
for (var i = 0, t = e.input.charCodeAt(e.position); t !== 0; ) {
|
|
1179
|
-
for (;
|
|
689
|
+
for (; J(t); )
|
|
1180
690
|
t === 9 && e.firstTabInLine === -1 && (e.firstTabInLine = e.position), t = e.input.charCodeAt(++e.position);
|
|
1181
691
|
if (n && t === 35)
|
|
1182
692
|
do
|
|
1183
693
|
t = e.input.charCodeAt(++e.position);
|
|
1184
694
|
while (t !== 10 && t !== 13 && t !== 0);
|
|
1185
695
|
if (H(t))
|
|
1186
|
-
for (
|
|
696
|
+
for (tn(e), t = e.input.charCodeAt(e.position), i++, e.lineIndent = 0; t === 32; )
|
|
1187
697
|
e.lineIndent++, t = e.input.charCodeAt(++e.position);
|
|
1188
698
|
else
|
|
1189
699
|
break;
|
|
1190
700
|
}
|
|
1191
|
-
return r !== -1 && i !== 0 && e.lineIndent < r &&
|
|
701
|
+
return r !== -1 && i !== 0 && e.lineIndent < r && Fe(e, "deficient indentation"), i;
|
|
1192
702
|
}
|
|
1193
|
-
function
|
|
703
|
+
function Pe(e) {
|
|
1194
704
|
var n = e.position, r;
|
|
1195
|
-
return r = e.input.charCodeAt(n), !!((r === 45 || r === 46) && r === e.input.charCodeAt(n + 1) && r === e.input.charCodeAt(n + 2) && (n += 3, r = e.input.charCodeAt(n), r === 0 ||
|
|
705
|
+
return r = e.input.charCodeAt(n), !!((r === 45 || r === 46) && r === e.input.charCodeAt(n + 1) && r === e.input.charCodeAt(n + 2) && (n += 3, r = e.input.charCodeAt(n), r === 0 || B(r)));
|
|
1196
706
|
}
|
|
1197
|
-
function
|
|
707
|
+
function on(e, n) {
|
|
1198
708
|
n === 1 ? e.result += " " : n > 1 && (e.result += T.repeat(`
|
|
1199
709
|
`, n - 1));
|
|
1200
710
|
}
|
|
1201
|
-
function
|
|
1202
|
-
var i, t, o, l, a, s, c,
|
|
1203
|
-
if (g = e.input.charCodeAt(e.position),
|
|
711
|
+
function ut(e, n, r) {
|
|
712
|
+
var i, t, o, l, a, s, c, f, u = e.kind, h = e.result, g;
|
|
713
|
+
if (g = e.input.charCodeAt(e.position), B(g) || te(g) || g === 35 || g === 38 || g === 42 || g === 33 || g === 124 || g === 62 || g === 39 || g === 34 || g === 37 || g === 64 || g === 96 || (g === 63 || g === 45) && (t = e.input.charCodeAt(e.position + 1), B(t) || r && te(t)))
|
|
1204
714
|
return !1;
|
|
1205
715
|
for (e.kind = "scalar", e.result = "", o = l = e.position, a = !1; g !== 0; ) {
|
|
1206
716
|
if (g === 58) {
|
|
1207
|
-
if (t = e.input.charCodeAt(e.position + 1),
|
|
717
|
+
if (t = e.input.charCodeAt(e.position + 1), B(t) || r && te(t))
|
|
1208
718
|
break;
|
|
1209
719
|
} else if (g === 35) {
|
|
1210
|
-
if (i = e.input.charCodeAt(e.position - 1),
|
|
720
|
+
if (i = e.input.charCodeAt(e.position - 1), B(i))
|
|
1211
721
|
break;
|
|
1212
722
|
} else {
|
|
1213
|
-
if (e.position === e.lineStart &&
|
|
723
|
+
if (e.position === e.lineStart && Pe(e) || r && te(g))
|
|
1214
724
|
break;
|
|
1215
725
|
if (H(g))
|
|
1216
|
-
if (s = e.line, c = e.lineStart,
|
|
726
|
+
if (s = e.line, c = e.lineStart, f = e.lineIndent, F(e, !1, -1), e.lineIndent >= n) {
|
|
1217
727
|
a = !0, g = e.input.charCodeAt(e.position);
|
|
1218
728
|
continue;
|
|
1219
729
|
} else {
|
|
1220
|
-
e.position = l, e.line = s, e.lineStart = c, e.lineIndent =
|
|
730
|
+
e.position = l, e.line = s, e.lineStart = c, e.lineIndent = f;
|
|
1221
731
|
break;
|
|
1222
732
|
}
|
|
1223
733
|
}
|
|
1224
|
-
a && (q(e, o, l, !1),
|
|
734
|
+
a && (q(e, o, l, !1), on(e, e.line - s), o = l = e.position, a = !1), J(g) || (l = e.position + 1), g = e.input.charCodeAt(++e.position);
|
|
1225
735
|
}
|
|
1226
|
-
return q(e, o, l, !1), e.result ? !0 : (e.kind =
|
|
736
|
+
return q(e, o, l, !1), e.result ? !0 : (e.kind = u, e.result = h, !1);
|
|
1227
737
|
}
|
|
1228
|
-
function
|
|
738
|
+
function ft(e, n) {
|
|
1229
739
|
var r, i, t;
|
|
1230
740
|
if (r = e.input.charCodeAt(e.position), r !== 39)
|
|
1231
741
|
return !1;
|
|
@@ -1235,10 +745,10 @@ function at(e, n) {
|
|
|
1235
745
|
i = e.position, e.position++, t = e.position;
|
|
1236
746
|
else
|
|
1237
747
|
return !0;
|
|
1238
|
-
else H(r) ? (q(e, i, t, !0),
|
|
1239
|
-
|
|
748
|
+
else H(r) ? (q(e, i, t, !0), on(e, F(e, !1, n)), i = t = e.position) : e.position === e.lineStart && Pe(e) ? x(e, "unexpected end of the document within a single quoted scalar") : (e.position++, t = e.position);
|
|
749
|
+
x(e, "unexpected end of the stream within a single quoted scalar");
|
|
1240
750
|
}
|
|
1241
|
-
function
|
|
751
|
+
function pt(e, n) {
|
|
1242
752
|
var r, i, t, o, l, a;
|
|
1243
753
|
if (a = e.input.charCodeAt(e.position), a !== 34)
|
|
1244
754
|
return !1;
|
|
@@ -1248,194 +758,194 @@ function st(e, n) {
|
|
|
1248
758
|
if (a === 92) {
|
|
1249
759
|
if (q(e, r, e.position, !0), a = e.input.charCodeAt(++e.position), H(a))
|
|
1250
760
|
F(e, !1, n);
|
|
1251
|
-
else if (a < 256 &&
|
|
1252
|
-
e.result +=
|
|
1253
|
-
else if ((l =
|
|
761
|
+
else if (a < 256 && mr[a])
|
|
762
|
+
e.result += yr[a], e.position++;
|
|
763
|
+
else if ((l = lt(a)) > 0) {
|
|
1254
764
|
for (t = l, o = 0; t > 0; t--)
|
|
1255
|
-
a = e.input.charCodeAt(++e.position), (l =
|
|
1256
|
-
e.result +=
|
|
765
|
+
a = e.input.charCodeAt(++e.position), (l = ot(a)) >= 0 ? o = (o << 4) + l : x(e, "expected hexadecimal character");
|
|
766
|
+
e.result += st(o), e.position++;
|
|
1257
767
|
} else
|
|
1258
|
-
|
|
768
|
+
x(e, "unknown escape sequence");
|
|
1259
769
|
r = i = e.position;
|
|
1260
|
-
} else H(a) ? (q(e, r, i, !0),
|
|
770
|
+
} else H(a) ? (q(e, r, i, !0), on(e, F(e, !1, n)), r = i = e.position) : e.position === e.lineStart && Pe(e) ? x(e, "unexpected end of the document within a double quoted scalar") : (e.position++, i = e.position);
|
|
1261
771
|
}
|
|
1262
|
-
|
|
772
|
+
x(e, "unexpected end of the stream within a double quoted scalar");
|
|
1263
773
|
}
|
|
1264
|
-
function
|
|
1265
|
-
var r = !0, i, t, o, l = e.tag, a, s = e.anchor, c,
|
|
1266
|
-
if (
|
|
1267
|
-
|
|
1268
|
-
else if (
|
|
1269
|
-
|
|
774
|
+
function dt(e, n) {
|
|
775
|
+
var r = !0, i, t, o, l = e.tag, a, s = e.anchor, c, f, u, h, g, m = /* @__PURE__ */ Object.create(null), d, w, k, v;
|
|
776
|
+
if (v = e.input.charCodeAt(e.position), v === 91)
|
|
777
|
+
f = 93, g = !1, a = [];
|
|
778
|
+
else if (v === 123)
|
|
779
|
+
f = 125, g = !0, a = {};
|
|
1270
780
|
else
|
|
1271
781
|
return !1;
|
|
1272
|
-
for (e.anchor !== null && (e.anchorMap[e.anchor] = a),
|
|
1273
|
-
if (F(e, !0, n),
|
|
782
|
+
for (e.anchor !== null && (e.anchorMap[e.anchor] = a), v = e.input.charCodeAt(++e.position); v !== 0; ) {
|
|
783
|
+
if (F(e, !0, n), v = e.input.charCodeAt(e.position), v === f)
|
|
1274
784
|
return e.position++, e.tag = l, e.anchor = s, e.kind = g ? "mapping" : "sequence", e.result = a, !0;
|
|
1275
|
-
r ?
|
|
785
|
+
r ? v === 44 && x(e, "expected the node content, but found ','") : x(e, "missed comma between flow collection entries"), w = d = k = null, u = h = !1, v === 63 && (c = e.input.charCodeAt(e.position + 1), B(c) && (u = h = !0, e.position++, F(e, !0, n))), i = e.line, t = e.lineStart, o = e.position, se(e, n, Oe, !1, !0), w = e.tag, d = e.result, F(e, !0, n), v = e.input.charCodeAt(e.position), (h || e.line === i) && v === 58 && (u = !0, v = e.input.charCodeAt(++e.position), F(e, !0, n), se(e, n, Oe, !1, !0), k = e.result), g ? oe(e, a, m, w, d, k, i, t, o) : u ? a.push(oe(e, null, m, w, d, k, i, t, o)) : a.push(d), F(e, !0, n), v = e.input.charCodeAt(e.position), v === 44 ? (r = !0, v = e.input.charCodeAt(++e.position)) : r = !1;
|
|
1276
786
|
}
|
|
1277
|
-
|
|
787
|
+
x(e, "unexpected end of the stream within a flow collection");
|
|
1278
788
|
}
|
|
1279
|
-
function
|
|
1280
|
-
var r, i, t =
|
|
1281
|
-
if (
|
|
789
|
+
function ht(e, n) {
|
|
790
|
+
var r, i, t = ze, o = !1, l = !1, a = n, s = 0, c = !1, f, u;
|
|
791
|
+
if (u = e.input.charCodeAt(e.position), u === 124)
|
|
1282
792
|
i = !1;
|
|
1283
|
-
else if (
|
|
793
|
+
else if (u === 62)
|
|
1284
794
|
i = !0;
|
|
1285
795
|
else
|
|
1286
796
|
return !1;
|
|
1287
|
-
for (e.kind = "scalar", e.result = "";
|
|
1288
|
-
if (
|
|
1289
|
-
|
|
1290
|
-
else if ((
|
|
1291
|
-
|
|
797
|
+
for (e.kind = "scalar", e.result = ""; u !== 0; )
|
|
798
|
+
if (u = e.input.charCodeAt(++e.position), u === 43 || u === 45)
|
|
799
|
+
ze === t ? t = u === 43 ? bn : nt : x(e, "repeat of a chomping mode identifier");
|
|
800
|
+
else if ((f = at(u)) >= 0)
|
|
801
|
+
f === 0 ? x(e, "bad explicit indentation width of a block scalar; it cannot be less than one") : l ? x(e, "repeat of an indentation width identifier") : (a = n + f - 1, l = !0);
|
|
1292
802
|
else
|
|
1293
803
|
break;
|
|
1294
|
-
if (
|
|
804
|
+
if (J(u)) {
|
|
1295
805
|
do
|
|
1296
|
-
|
|
1297
|
-
while (
|
|
1298
|
-
if (
|
|
806
|
+
u = e.input.charCodeAt(++e.position);
|
|
807
|
+
while (J(u));
|
|
808
|
+
if (u === 35)
|
|
1299
809
|
do
|
|
1300
|
-
|
|
1301
|
-
while (!H(
|
|
810
|
+
u = e.input.charCodeAt(++e.position);
|
|
811
|
+
while (!H(u) && u !== 0);
|
|
1302
812
|
}
|
|
1303
|
-
for (;
|
|
1304
|
-
for (
|
|
1305
|
-
e.lineIndent++,
|
|
1306
|
-
if (!l && e.lineIndent > a && (a = e.lineIndent), H(
|
|
813
|
+
for (; u !== 0; ) {
|
|
814
|
+
for (tn(e), e.lineIndent = 0, u = e.input.charCodeAt(e.position); (!l || e.lineIndent < a) && u === 32; )
|
|
815
|
+
e.lineIndent++, u = e.input.charCodeAt(++e.position);
|
|
816
|
+
if (!l && e.lineIndent > a && (a = e.lineIndent), H(u)) {
|
|
1307
817
|
s++;
|
|
1308
818
|
continue;
|
|
1309
819
|
}
|
|
1310
820
|
if (e.lineIndent < a) {
|
|
1311
|
-
t ===
|
|
1312
|
-
`, o ? 1 + s : s) : t ===
|
|
821
|
+
t === bn ? e.result += T.repeat(`
|
|
822
|
+
`, o ? 1 + s : s) : t === ze && o && (e.result += `
|
|
1313
823
|
`);
|
|
1314
824
|
break;
|
|
1315
825
|
}
|
|
1316
|
-
for (i ?
|
|
826
|
+
for (i ? J(u) ? (c = !0, e.result += T.repeat(`
|
|
1317
827
|
`, o ? 1 + s : s)) : c ? (c = !1, e.result += T.repeat(`
|
|
1318
828
|
`, s + 1)) : s === 0 ? o && (e.result += " ") : e.result += T.repeat(`
|
|
1319
829
|
`, s) : e.result += T.repeat(`
|
|
1320
|
-
`, o ? 1 + s : s), o = !0, l = !0, s = 0, r = e.position; !H(
|
|
1321
|
-
|
|
830
|
+
`, o ? 1 + s : s), o = !0, l = !0, s = 0, r = e.position; !H(u) && u !== 0; )
|
|
831
|
+
u = e.input.charCodeAt(++e.position);
|
|
1322
832
|
q(e, r, e.position, !1);
|
|
1323
833
|
}
|
|
1324
834
|
return !0;
|
|
1325
835
|
}
|
|
1326
|
-
function
|
|
836
|
+
function En(e, n) {
|
|
1327
837
|
var r, i = e.tag, t = e.anchor, o = [], l, a = !1, s;
|
|
1328
838
|
if (e.firstTabInLine !== -1) return !1;
|
|
1329
|
-
for (e.anchor !== null && (e.anchorMap[e.anchor] = o), s = e.input.charCodeAt(e.position); s !== 0 && (e.firstTabInLine !== -1 && (e.position = e.firstTabInLine,
|
|
839
|
+
for (e.anchor !== null && (e.anchorMap[e.anchor] = o), s = e.input.charCodeAt(e.position); s !== 0 && (e.firstTabInLine !== -1 && (e.position = e.firstTabInLine, x(e, "tab characters must not be used in indentation")), !(s !== 45 || (l = e.input.charCodeAt(e.position + 1), !B(l)))); ) {
|
|
1330
840
|
if (a = !0, e.position++, F(e, !0, -1) && e.lineIndent <= n) {
|
|
1331
841
|
o.push(null), s = e.input.charCodeAt(e.position);
|
|
1332
842
|
continue;
|
|
1333
843
|
}
|
|
1334
|
-
if (r = e.line,
|
|
1335
|
-
|
|
844
|
+
if (r = e.line, se(e, n, pr, !1, !0), o.push(e.result), F(e, !0, -1), s = e.input.charCodeAt(e.position), (e.line === r || e.lineIndent > n) && s !== 0)
|
|
845
|
+
x(e, "bad indentation of a sequence entry");
|
|
1336
846
|
else if (e.lineIndent < n)
|
|
1337
847
|
break;
|
|
1338
848
|
}
|
|
1339
849
|
return a ? (e.tag = i, e.anchor = t, e.kind = "sequence", e.result = o, !0) : !1;
|
|
1340
850
|
}
|
|
1341
|
-
function
|
|
1342
|
-
var i, t, o, l, a, s, c = e.tag,
|
|
851
|
+
function gt(e, n, r) {
|
|
852
|
+
var i, t, o, l, a, s, c = e.tag, f = e.anchor, u = {}, h = /* @__PURE__ */ Object.create(null), g = null, m = null, d = null, w = !1, k = !1, v;
|
|
1343
853
|
if (e.firstTabInLine !== -1) return !1;
|
|
1344
|
-
for (e.anchor !== null && (e.anchorMap[e.anchor] =
|
|
1345
|
-
if (!
|
|
1346
|
-
|
|
854
|
+
for (e.anchor !== null && (e.anchorMap[e.anchor] = u), v = e.input.charCodeAt(e.position); v !== 0; ) {
|
|
855
|
+
if (!w && e.firstTabInLine !== -1 && (e.position = e.firstTabInLine, x(e, "tab characters must not be used in indentation")), i = e.input.charCodeAt(e.position + 1), o = e.line, (v === 63 || v === 58) && B(i))
|
|
856
|
+
v === 63 ? (w && (oe(e, u, h, g, m, null, l, a, s), g = m = d = null), k = !0, w = !0, t = !0) : w ? (w = !1, t = !0) : x(e, "incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line"), e.position += 1, v = i;
|
|
1347
857
|
else {
|
|
1348
|
-
if (l = e.line, a = e.lineStart, s = e.position, !
|
|
858
|
+
if (l = e.line, a = e.lineStart, s = e.position, !se(e, r, fr, !1, !0))
|
|
1349
859
|
break;
|
|
1350
860
|
if (e.line === o) {
|
|
1351
|
-
for (
|
|
1352
|
-
|
|
1353
|
-
if (
|
|
1354
|
-
|
|
1355
|
-
else if (
|
|
1356
|
-
|
|
861
|
+
for (v = e.input.charCodeAt(e.position); J(v); )
|
|
862
|
+
v = e.input.charCodeAt(++e.position);
|
|
863
|
+
if (v === 58)
|
|
864
|
+
v = e.input.charCodeAt(++e.position), B(v) || x(e, "a whitespace character is expected after the key-value separator within a block mapping"), w && (oe(e, u, h, g, m, null, l, a, s), g = m = d = null), k = !0, w = !1, t = !1, g = e.tag, m = e.result;
|
|
865
|
+
else if (k)
|
|
866
|
+
x(e, "can not read an implicit mapping pair; a colon is missed");
|
|
1357
867
|
else
|
|
1358
|
-
return e.tag = c, e.anchor =
|
|
1359
|
-
} else if (
|
|
1360
|
-
|
|
868
|
+
return e.tag = c, e.anchor = f, !0;
|
|
869
|
+
} else if (k)
|
|
870
|
+
x(e, "can not read a block mapping entry; a multiline key may not be an implicit key");
|
|
1361
871
|
else
|
|
1362
|
-
return e.tag = c, e.anchor =
|
|
872
|
+
return e.tag = c, e.anchor = f, !0;
|
|
1363
873
|
}
|
|
1364
|
-
if ((e.line === o || e.lineIndent > n) && (
|
|
1365
|
-
|
|
874
|
+
if ((e.line === o || e.lineIndent > n) && (w && (l = e.line, a = e.lineStart, s = e.position), se(e, n, _e, !0, t) && (w ? m = e.result : d = e.result), w || (oe(e, u, h, g, m, d, l, a, s), g = m = d = null), F(e, !0, -1), v = e.input.charCodeAt(e.position)), (e.line === o || e.lineIndent > n) && v !== 0)
|
|
875
|
+
x(e, "bad indentation of a mapping entry");
|
|
1366
876
|
else if (e.lineIndent < n)
|
|
1367
877
|
break;
|
|
1368
878
|
}
|
|
1369
|
-
return
|
|
879
|
+
return w && oe(e, u, h, g, m, null, l, a, s), k && (e.tag = c, e.anchor = f, e.kind = "mapping", e.result = u), k;
|
|
1370
880
|
}
|
|
1371
|
-
function
|
|
881
|
+
function mt(e) {
|
|
1372
882
|
var n, r = !1, i = !1, t, o, l;
|
|
1373
883
|
if (l = e.input.charCodeAt(e.position), l !== 33) return !1;
|
|
1374
|
-
if (e.tag !== null &&
|
|
884
|
+
if (e.tag !== null && x(e, "duplication of a tag property"), l = e.input.charCodeAt(++e.position), l === 60 ? (r = !0, l = e.input.charCodeAt(++e.position)) : l === 33 ? (i = !0, t = "!!", l = e.input.charCodeAt(++e.position)) : t = "!", n = e.position, r) {
|
|
1375
885
|
do
|
|
1376
886
|
l = e.input.charCodeAt(++e.position);
|
|
1377
887
|
while (l !== 0 && l !== 62);
|
|
1378
|
-
e.position < e.length ? (o = e.input.slice(n, e.position), l = e.input.charCodeAt(++e.position)) :
|
|
888
|
+
e.position < e.length ? (o = e.input.slice(n, e.position), l = e.input.charCodeAt(++e.position)) : x(e, "unexpected end of the stream within a verbatim tag");
|
|
1379
889
|
} else {
|
|
1380
|
-
for (; l !== 0 && !
|
|
1381
|
-
l === 33 && (i ?
|
|
1382
|
-
o = e.input.slice(n, e.position),
|
|
890
|
+
for (; l !== 0 && !B(l); )
|
|
891
|
+
l === 33 && (i ? x(e, "tag suffix cannot contain exclamation marks") : (t = e.input.slice(n - 1, e.position + 1), dr.test(t) || x(e, "named tag handle cannot contain such characters"), i = !0, n = e.position + 1)), l = e.input.charCodeAt(++e.position);
|
|
892
|
+
o = e.input.slice(n, e.position), tt.test(o) && x(e, "tag suffix cannot contain flow indicator characters");
|
|
1383
893
|
}
|
|
1384
|
-
o && !
|
|
894
|
+
o && !hr.test(o) && x(e, "tag name cannot contain such characters: " + o);
|
|
1385
895
|
try {
|
|
1386
896
|
o = decodeURIComponent(o);
|
|
1387
897
|
} catch {
|
|
1388
|
-
|
|
898
|
+
x(e, "tag name is malformed: " + o);
|
|
1389
899
|
}
|
|
1390
|
-
return r ? e.tag = o : G.call(e.tagMap, t) ? e.tag = e.tagMap[t] + o : t === "!" ? e.tag = "!" + o : t === "!!" ? e.tag = "tag:yaml.org,2002:" + o :
|
|
900
|
+
return r ? e.tag = o : G.call(e.tagMap, t) ? e.tag = e.tagMap[t] + o : t === "!" ? e.tag = "!" + o : t === "!!" ? e.tag = "tag:yaml.org,2002:" + o : x(e, 'undeclared tag handle "' + t + '"'), !0;
|
|
1391
901
|
}
|
|
1392
|
-
function
|
|
902
|
+
function yt(e) {
|
|
1393
903
|
var n, r;
|
|
1394
904
|
if (r = e.input.charCodeAt(e.position), r !== 38) return !1;
|
|
1395
|
-
for (e.anchor !== null &&
|
|
905
|
+
for (e.anchor !== null && x(e, "duplication of an anchor property"), r = e.input.charCodeAt(++e.position), n = e.position; r !== 0 && !B(r) && !te(r); )
|
|
1396
906
|
r = e.input.charCodeAt(++e.position);
|
|
1397
|
-
return e.position === n &&
|
|
907
|
+
return e.position === n && x(e, "name of an anchor node must contain at least one character"), e.anchor = e.input.slice(n, e.position), !0;
|
|
1398
908
|
}
|
|
1399
|
-
function
|
|
909
|
+
function vt(e) {
|
|
1400
910
|
var n, r, i;
|
|
1401
911
|
if (i = e.input.charCodeAt(e.position), i !== 42) return !1;
|
|
1402
|
-
for (i = e.input.charCodeAt(++e.position), n = e.position; i !== 0 && !
|
|
912
|
+
for (i = e.input.charCodeAt(++e.position), n = e.position; i !== 0 && !B(i) && !te(i); )
|
|
1403
913
|
i = e.input.charCodeAt(++e.position);
|
|
1404
|
-
return e.position === n &&
|
|
914
|
+
return e.position === n && x(e, "name of an alias node must contain at least one character"), r = e.input.slice(n, e.position), G.call(e.anchorMap, r) || x(e, 'unidentified alias "' + r + '"'), e.result = e.anchorMap[r], F(e, !0, -1), !0;
|
|
1405
915
|
}
|
|
1406
|
-
function
|
|
1407
|
-
var o, l, a, s = 1, c = !1,
|
|
1408
|
-
if (e.listener !== null && e.listener("open", e), e.tag = null, e.anchor = null, e.kind = null, e.result = null, o = l = a =
|
|
1409
|
-
for (;
|
|
916
|
+
function se(e, n, r, i, t) {
|
|
917
|
+
var o, l, a, s = 1, c = !1, f = !1, u, h, g, m, d, w;
|
|
918
|
+
if (e.listener !== null && e.listener("open", e), e.tag = null, e.anchor = null, e.kind = null, e.result = null, o = l = a = _e === r || pr === r, i && F(e, !0, -1) && (c = !0, e.lineIndent > n ? s = 1 : e.lineIndent === n ? s = 0 : e.lineIndent < n && (s = -1)), s === 1)
|
|
919
|
+
for (; mt(e) || yt(e); )
|
|
1410
920
|
F(e, !0, -1) ? (c = !0, a = o, e.lineIndent > n ? s = 1 : e.lineIndent === n ? s = 0 : e.lineIndent < n && (s = -1)) : a = !1;
|
|
1411
|
-
if (a && (a = c || t), (s === 1 ||
|
|
921
|
+
if (a && (a = c || t), (s === 1 || _e === r) && (Oe === r || fr === r ? d = n : d = n + 1, w = e.position - e.lineStart, s === 1 ? a && (En(e, w) || gt(e, w, d)) || dt(e, d) ? f = !0 : (l && ht(e, d) || ft(e, d) || pt(e, d) ? f = !0 : vt(e) ? (f = !0, (e.tag !== null || e.anchor !== null) && x(e, "alias node should not have any properties")) : ut(e, d, Oe === r) && (f = !0, e.tag === null && (e.tag = "?")), e.anchor !== null && (e.anchorMap[e.anchor] = e.result)) : s === 0 && (f = a && En(e, w))), e.tag === null)
|
|
1412
922
|
e.anchor !== null && (e.anchorMap[e.anchor] = e.result);
|
|
1413
923
|
else if (e.tag === "?") {
|
|
1414
|
-
for (e.result !== null && e.kind !== "scalar" &&
|
|
1415
|
-
if (
|
|
1416
|
-
e.result =
|
|
924
|
+
for (e.result !== null && e.kind !== "scalar" && x(e, 'unacceptable node kind for !<?> tag; it should be "scalar", not "' + e.kind + '"'), u = 0, h = e.implicitTypes.length; u < h; u += 1)
|
|
925
|
+
if (m = e.implicitTypes[u], m.resolve(e.result)) {
|
|
926
|
+
e.result = m.construct(e.result), e.tag = m.tag, e.anchor !== null && (e.anchorMap[e.anchor] = e.result);
|
|
1417
927
|
break;
|
|
1418
928
|
}
|
|
1419
929
|
} else if (e.tag !== "!") {
|
|
1420
930
|
if (G.call(e.typeMap[e.kind || "fallback"], e.tag))
|
|
1421
|
-
|
|
931
|
+
m = e.typeMap[e.kind || "fallback"][e.tag];
|
|
1422
932
|
else
|
|
1423
|
-
for (
|
|
1424
|
-
if (e.tag.slice(0, g[
|
|
1425
|
-
|
|
933
|
+
for (m = null, g = e.typeMap.multi[e.kind || "fallback"], u = 0, h = g.length; u < h; u += 1)
|
|
934
|
+
if (e.tag.slice(0, g[u].tag.length) === g[u].tag) {
|
|
935
|
+
m = g[u];
|
|
1426
936
|
break;
|
|
1427
937
|
}
|
|
1428
|
-
|
|
938
|
+
m || x(e, "unknown tag !<" + e.tag + ">"), e.result !== null && m.kind !== e.kind && x(e, "unacceptable node kind for !<" + e.tag + '> tag; it should be "' + m.kind + '", not "' + e.kind + '"'), m.resolve(e.result, e.tag) ? (e.result = m.construct(e.result, e.tag), e.anchor !== null && (e.anchorMap[e.anchor] = e.result)) : x(e, "cannot resolve a node with !<" + e.tag + "> explicit tag");
|
|
1429
939
|
}
|
|
1430
|
-
return e.listener !== null && e.listener("close", e), e.tag !== null || e.anchor !== null ||
|
|
940
|
+
return e.listener !== null && e.listener("close", e), e.tag !== null || e.anchor !== null || f;
|
|
1431
941
|
}
|
|
1432
|
-
function
|
|
942
|
+
function xt(e) {
|
|
1433
943
|
var n = e.position, r, i, t, o = !1, l;
|
|
1434
944
|
for (e.version = null, e.checkLineBreaks = e.legacy, e.tagMap = /* @__PURE__ */ Object.create(null), e.anchorMap = /* @__PURE__ */ Object.create(null); (l = e.input.charCodeAt(e.position)) !== 0 && (F(e, !0, -1), l = e.input.charCodeAt(e.position), !(e.lineIndent > 0 || l !== 37)); ) {
|
|
1435
|
-
for (o = !0, l = e.input.charCodeAt(++e.position), r = e.position; l !== 0 && !
|
|
945
|
+
for (o = !0, l = e.input.charCodeAt(++e.position), r = e.position; l !== 0 && !B(l); )
|
|
1436
946
|
l = e.input.charCodeAt(++e.position);
|
|
1437
|
-
for (i = e.input.slice(r, e.position), t = [], i.length < 1 &&
|
|
1438
|
-
for (;
|
|
947
|
+
for (i = e.input.slice(r, e.position), t = [], i.length < 1 && x(e, "directive name must not be less than one character in length"); l !== 0; ) {
|
|
948
|
+
for (; J(l); )
|
|
1439
949
|
l = e.input.charCodeAt(++e.position);
|
|
1440
950
|
if (l === 35) {
|
|
1441
951
|
do
|
|
@@ -1444,51 +954,51 @@ function gt(e) {
|
|
|
1444
954
|
break;
|
|
1445
955
|
}
|
|
1446
956
|
if (H(l)) break;
|
|
1447
|
-
for (r = e.position; l !== 0 && !
|
|
957
|
+
for (r = e.position; l !== 0 && !B(l); )
|
|
1448
958
|
l = e.input.charCodeAt(++e.position);
|
|
1449
959
|
t.push(e.input.slice(r, e.position));
|
|
1450
960
|
}
|
|
1451
|
-
l !== 0 &&
|
|
961
|
+
l !== 0 && tn(e), G.call(Sn, i) ? Sn[i](e, i, t) : Fe(e, 'unknown document directive "' + i + '"');
|
|
1452
962
|
}
|
|
1453
|
-
if (F(e, !0, -1), e.lineIndent === 0 && e.input.charCodeAt(e.position) === 45 && e.input.charCodeAt(e.position + 1) === 45 && e.input.charCodeAt(e.position + 2) === 45 ? (e.position += 3, F(e, !0, -1)) : o &&
|
|
963
|
+
if (F(e, !0, -1), e.lineIndent === 0 && e.input.charCodeAt(e.position) === 45 && e.input.charCodeAt(e.position + 1) === 45 && e.input.charCodeAt(e.position + 2) === 45 ? (e.position += 3, F(e, !0, -1)) : o && x(e, "directives end mark is expected"), se(e, e.lineIndent - 1, _e, !1, !0), F(e, !0, -1), e.checkLineBreaks && it.test(e.input.slice(n, e.position)) && Fe(e, "non-ASCII line breaks are interpreted as content"), e.documents.push(e.result), e.position === e.lineStart && Pe(e)) {
|
|
1454
964
|
e.input.charCodeAt(e.position) === 46 && (e.position += 3, F(e, !0, -1));
|
|
1455
965
|
return;
|
|
1456
966
|
}
|
|
1457
967
|
if (e.position < e.length - 1)
|
|
1458
|
-
|
|
968
|
+
x(e, "end of the stream or a document separator is expected");
|
|
1459
969
|
else
|
|
1460
970
|
return;
|
|
1461
971
|
}
|
|
1462
|
-
function
|
|
972
|
+
function xr(e, n) {
|
|
1463
973
|
e = String(e), n = n || {}, e.length !== 0 && (e.charCodeAt(e.length - 1) !== 10 && e.charCodeAt(e.length - 1) !== 13 && (e += `
|
|
1464
974
|
`), e.charCodeAt(0) === 65279 && (e = e.slice(1)));
|
|
1465
|
-
var r = new
|
|
1466
|
-
for (i !== -1 && (r.position = i,
|
|
975
|
+
var r = new ct(e, n), i = e.indexOf("\0");
|
|
976
|
+
for (i !== -1 && (r.position = i, x(r, "null byte is not allowed in input")), r.input += "\0"; r.input.charCodeAt(r.position) === 32; )
|
|
1467
977
|
r.lineIndent += 1, r.position += 1;
|
|
1468
978
|
for (; r.position < r.length - 1; )
|
|
1469
|
-
|
|
979
|
+
xt(r);
|
|
1470
980
|
return r.documents;
|
|
1471
981
|
}
|
|
1472
|
-
function
|
|
982
|
+
function wt(e, n, r) {
|
|
1473
983
|
n !== null && typeof n == "object" && typeof r > "u" && (r = n, n = null);
|
|
1474
|
-
var i =
|
|
984
|
+
var i = xr(e, r);
|
|
1475
985
|
if (typeof n != "function")
|
|
1476
986
|
return i;
|
|
1477
987
|
for (var t = 0, o = i.length; t < o; t += 1)
|
|
1478
988
|
n(i[t]);
|
|
1479
989
|
}
|
|
1480
|
-
function
|
|
1481
|
-
var r =
|
|
990
|
+
function bt(e, n) {
|
|
991
|
+
var r = xr(e, n);
|
|
1482
992
|
if (r.length !== 0) {
|
|
1483
993
|
if (r.length === 1)
|
|
1484
994
|
return r[0];
|
|
1485
|
-
throw new
|
|
995
|
+
throw new M("expected a single document in the stream, but found more");
|
|
1486
996
|
}
|
|
1487
997
|
}
|
|
1488
|
-
var
|
|
1489
|
-
loadAll:
|
|
1490
|
-
load:
|
|
1491
|
-
},
|
|
998
|
+
var At = wt, kt = bt, wr = {
|
|
999
|
+
loadAll: At,
|
|
1000
|
+
load: kt
|
|
1001
|
+
}, br = Object.prototype.toString, Ar = Object.prototype.hasOwnProperty, ln = 65279, St = 9, me = 10, Ct = 13, Et = 32, Ot = 33, _t = 34, qe = 35, Ft = 37, Tt = 38, Lt = 39, jt = 42, kr = 44, It = 45, Te = 58, Nt = 61, Pt = 62, Rt = 63, Mt = 64, Sr = 91, Cr = 93, Dt = 96, Er = 123, zt = 124, Or = 125, N = {};
|
|
1492
1002
|
N[0] = "\\0";
|
|
1493
1003
|
N[7] = "\\a";
|
|
1494
1004
|
N[8] = "\\b";
|
|
@@ -1504,7 +1014,7 @@ N[133] = "\\N";
|
|
|
1504
1014
|
N[160] = "\\_";
|
|
1505
1015
|
N[8232] = "\\L";
|
|
1506
1016
|
N[8233] = "\\P";
|
|
1507
|
-
var
|
|
1017
|
+
var $t = [
|
|
1508
1018
|
"y",
|
|
1509
1019
|
"Y",
|
|
1510
1020
|
"yes",
|
|
@@ -1521,15 +1031,15 @@ var Mt = [
|
|
|
1521
1031
|
"off",
|
|
1522
1032
|
"Off",
|
|
1523
1033
|
"OFF"
|
|
1524
|
-
],
|
|
1525
|
-
function
|
|
1034
|
+
], Ut = /^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;
|
|
1035
|
+
function Bt(e, n) {
|
|
1526
1036
|
var r, i, t, o, l, a, s;
|
|
1527
1037
|
if (n === null) return {};
|
|
1528
1038
|
for (r = {}, i = Object.keys(n), t = 0, o = i.length; t < o; t += 1)
|
|
1529
|
-
l = i[t], a = String(n[l]), l.slice(0, 2) === "!!" && (l = "tag:yaml.org,2002:" + l.slice(2)), s = e.compiledTypeMap.fallback[l], s &&
|
|
1039
|
+
l = i[t], a = String(n[l]), l.slice(0, 2) === "!!" && (l = "tag:yaml.org,2002:" + l.slice(2)), s = e.compiledTypeMap.fallback[l], s && Ar.call(s.styleAliases, a) && (a = s.styleAliases[a]), r[l] = a;
|
|
1530
1040
|
return r;
|
|
1531
1041
|
}
|
|
1532
|
-
function
|
|
1042
|
+
function Yt(e) {
|
|
1533
1043
|
var n, r, i;
|
|
1534
1044
|
if (n = e.toString(16).toUpperCase(), e <= 255)
|
|
1535
1045
|
r = "x", i = 2;
|
|
@@ -1538,331 +1048,854 @@ function $t(e) {
|
|
|
1538
1048
|
else if (e <= 4294967295)
|
|
1539
1049
|
r = "U", i = 8;
|
|
1540
1050
|
else
|
|
1541
|
-
throw new
|
|
1051
|
+
throw new M("code point within a string may not be greater than 0xFFFFFFFF");
|
|
1542
1052
|
return "\\" + r + T.repeat("0", i - n.length) + n;
|
|
1543
1053
|
}
|
|
1544
|
-
var
|
|
1545
|
-
function
|
|
1546
|
-
this.schema = e.schema ||
|
|
1054
|
+
var Ht = 1, ye = 2;
|
|
1055
|
+
function Kt(e) {
|
|
1056
|
+
this.schema = e.schema || rn, this.indent = Math.max(1, e.indent || 2), this.noArrayIndent = e.noArrayIndent || !1, this.skipInvalid = e.skipInvalid || !1, this.flowLevel = T.isNothing(e.flowLevel) ? -1 : e.flowLevel, this.styleMap = Bt(this.schema, e.styles || null), this.sortKeys = e.sortKeys || !1, this.lineWidth = e.lineWidth || 80, this.noRefs = e.noRefs || !1, this.noCompatMode = e.noCompatMode || !1, this.condenseFlow = e.condenseFlow || !1, this.quotingType = e.quotingType === '"' ? ye : Ht, this.forceQuotes = e.forceQuotes || !1, this.replacer = typeof e.replacer == "function" ? e.replacer : null, this.implicitTypes = this.schema.compiledImplicit, this.explicitTypes = this.schema.compiledExplicit, this.tag = null, this.result = "", this.duplicates = [], this.usedDuplicates = null;
|
|
1547
1057
|
}
|
|
1548
|
-
function
|
|
1058
|
+
function On(e, n) {
|
|
1549
1059
|
for (var r = T.repeat(" ", n), i = 0, t = -1, o = "", l, a = e.length; i < a; )
|
|
1550
1060
|
t = e.indexOf(`
|
|
1551
1061
|
`, i), t === -1 ? (l = e.slice(i), i = a) : (l = e.slice(i, t + 1), i = t + 1), l.length && l !== `
|
|
1552
1062
|
` && (o += r), o += l;
|
|
1553
1063
|
return o;
|
|
1554
1064
|
}
|
|
1555
|
-
function
|
|
1065
|
+
function Ge(e, n) {
|
|
1556
1066
|
return `
|
|
1557
1067
|
` + T.repeat(" ", e.indent * n);
|
|
1558
1068
|
}
|
|
1559
|
-
function
|
|
1069
|
+
function Wt(e, n) {
|
|
1560
1070
|
var r, i, t;
|
|
1561
1071
|
for (r = 0, i = e.implicitTypes.length; r < i; r += 1)
|
|
1562
1072
|
if (t = e.implicitTypes[r], t.resolve(n))
|
|
1563
1073
|
return !0;
|
|
1564
1074
|
return !1;
|
|
1565
1075
|
}
|
|
1566
|
-
function
|
|
1567
|
-
return e ===
|
|
1076
|
+
function Le(e) {
|
|
1077
|
+
return e === Et || e === St;
|
|
1078
|
+
}
|
|
1079
|
+
function ve(e) {
|
|
1080
|
+
return 32 <= e && e <= 126 || 161 <= e && e <= 55295 && e !== 8232 && e !== 8233 || 57344 <= e && e <= 65533 && e !== ln || 65536 <= e && e <= 1114111;
|
|
1081
|
+
}
|
|
1082
|
+
function _n(e) {
|
|
1083
|
+
return ve(e) && e !== ln && e !== Ct && e !== me;
|
|
1084
|
+
}
|
|
1085
|
+
function Fn(e, n, r) {
|
|
1086
|
+
var i = _n(e), t = i && !Le(e);
|
|
1087
|
+
return (
|
|
1088
|
+
// ns-plain-safe
|
|
1089
|
+
(r ? (
|
|
1090
|
+
// c = flow-in
|
|
1091
|
+
i
|
|
1092
|
+
) : i && e !== kr && e !== Sr && e !== Cr && e !== Er && e !== Or) && e !== qe && !(n === Te && !t) || _n(n) && !Le(n) && e === qe || n === Te && t
|
|
1093
|
+
);
|
|
1094
|
+
}
|
|
1095
|
+
function qt(e) {
|
|
1096
|
+
return ve(e) && e !== ln && !Le(e) && e !== It && e !== Rt && e !== Te && e !== kr && e !== Sr && e !== Cr && e !== Er && e !== Or && e !== qe && e !== Tt && e !== jt && e !== Ot && e !== zt && e !== Nt && e !== Pt && e !== Lt && e !== _t && e !== Ft && e !== Mt && e !== Dt;
|
|
1097
|
+
}
|
|
1098
|
+
function Gt(e) {
|
|
1099
|
+
return !Le(e) && e !== Te;
|
|
1100
|
+
}
|
|
1101
|
+
function he(e, n) {
|
|
1102
|
+
var r = e.charCodeAt(n), i;
|
|
1103
|
+
return r >= 55296 && r <= 56319 && n + 1 < e.length && (i = e.charCodeAt(n + 1), i >= 56320 && i <= 57343) ? (r - 55296) * 1024 + i - 56320 + 65536 : r;
|
|
1104
|
+
}
|
|
1105
|
+
function _r(e) {
|
|
1106
|
+
var n = /^\n* /;
|
|
1107
|
+
return n.test(e);
|
|
1108
|
+
}
|
|
1109
|
+
var Fr = 1, Ve = 2, Tr = 3, Lr = 4, ie = 5;
|
|
1110
|
+
function Vt(e, n, r, i, t, o, l, a) {
|
|
1111
|
+
var s, c = 0, f = null, u = !1, h = !1, g = i !== -1, m = -1, d = qt(he(e, 0)) && Gt(he(e, e.length - 1));
|
|
1112
|
+
if (n || l)
|
|
1113
|
+
for (s = 0; s < e.length; c >= 65536 ? s += 2 : s++) {
|
|
1114
|
+
if (c = he(e, s), !ve(c))
|
|
1115
|
+
return ie;
|
|
1116
|
+
d = d && Fn(c, f, a), f = c;
|
|
1117
|
+
}
|
|
1118
|
+
else {
|
|
1119
|
+
for (s = 0; s < e.length; c >= 65536 ? s += 2 : s++) {
|
|
1120
|
+
if (c = he(e, s), c === me)
|
|
1121
|
+
u = !0, g && (h = h || // Foldable line = too long, and not more-indented.
|
|
1122
|
+
s - m - 1 > i && e[m + 1] !== " ", m = s);
|
|
1123
|
+
else if (!ve(c))
|
|
1124
|
+
return ie;
|
|
1125
|
+
d = d && Fn(c, f, a), f = c;
|
|
1126
|
+
}
|
|
1127
|
+
h = h || g && s - m - 1 > i && e[m + 1] !== " ";
|
|
1128
|
+
}
|
|
1129
|
+
return !u && !h ? d && !l && !t(e) ? Fr : o === ye ? ie : Ve : r > 9 && _r(e) ? ie : l ? o === ye ? ie : Ve : h ? Lr : Tr;
|
|
1130
|
+
}
|
|
1131
|
+
function Xt(e, n, r, i, t) {
|
|
1132
|
+
e.dump = (function() {
|
|
1133
|
+
if (n.length === 0)
|
|
1134
|
+
return e.quotingType === ye ? '""' : "''";
|
|
1135
|
+
if (!e.noCompatMode && ($t.indexOf(n) !== -1 || Ut.test(n)))
|
|
1136
|
+
return e.quotingType === ye ? '"' + n + '"' : "'" + n + "'";
|
|
1137
|
+
var o = e.indent * Math.max(1, r), l = e.lineWidth === -1 ? -1 : Math.max(Math.min(e.lineWidth, 40), e.lineWidth - o), a = i || e.flowLevel > -1 && r >= e.flowLevel;
|
|
1138
|
+
function s(c) {
|
|
1139
|
+
return Wt(e, c);
|
|
1140
|
+
}
|
|
1141
|
+
switch (Vt(
|
|
1142
|
+
n,
|
|
1143
|
+
a,
|
|
1144
|
+
e.indent,
|
|
1145
|
+
l,
|
|
1146
|
+
s,
|
|
1147
|
+
e.quotingType,
|
|
1148
|
+
e.forceQuotes && !i,
|
|
1149
|
+
t
|
|
1150
|
+
)) {
|
|
1151
|
+
case Fr:
|
|
1152
|
+
return n;
|
|
1153
|
+
case Ve:
|
|
1154
|
+
return "'" + n.replace(/'/g, "''") + "'";
|
|
1155
|
+
case Tr:
|
|
1156
|
+
return "|" + Tn(n, e.indent) + Ln(On(n, o));
|
|
1157
|
+
case Lr:
|
|
1158
|
+
return ">" + Tn(n, e.indent) + Ln(On(Jt(n, l), o));
|
|
1159
|
+
case ie:
|
|
1160
|
+
return '"' + Qt(n) + '"';
|
|
1161
|
+
default:
|
|
1162
|
+
throw new M("impossible error: invalid scalar style");
|
|
1163
|
+
}
|
|
1164
|
+
})();
|
|
1165
|
+
}
|
|
1166
|
+
function Tn(e, n) {
|
|
1167
|
+
var r = _r(e) ? String(n) : "", i = e[e.length - 1] === `
|
|
1168
|
+
`, t = i && (e[e.length - 2] === `
|
|
1169
|
+
` || e === `
|
|
1170
|
+
`), o = t ? "+" : i ? "" : "-";
|
|
1171
|
+
return r + o + `
|
|
1172
|
+
`;
|
|
1173
|
+
}
|
|
1174
|
+
function Ln(e) {
|
|
1175
|
+
return e[e.length - 1] === `
|
|
1176
|
+
` ? e.slice(0, -1) : e;
|
|
1177
|
+
}
|
|
1178
|
+
function Jt(e, n) {
|
|
1179
|
+
for (var r = /(\n+)([^\n]*)/g, i = (function() {
|
|
1180
|
+
var c = e.indexOf(`
|
|
1181
|
+
`);
|
|
1182
|
+
return c = c !== -1 ? c : e.length, r.lastIndex = c, jn(e.slice(0, c), n);
|
|
1183
|
+
})(), t = e[0] === `
|
|
1184
|
+
` || e[0] === " ", o, l; l = r.exec(e); ) {
|
|
1185
|
+
var a = l[1], s = l[2];
|
|
1186
|
+
o = s[0] === " ", i += a + (!t && !o && s !== "" ? `
|
|
1187
|
+
` : "") + jn(s, n), t = o;
|
|
1188
|
+
}
|
|
1189
|
+
return i;
|
|
1190
|
+
}
|
|
1191
|
+
function jn(e, n) {
|
|
1192
|
+
if (e === "" || e[0] === " ") return e;
|
|
1193
|
+
for (var r = / [^ ]/g, i, t = 0, o, l = 0, a = 0, s = ""; i = r.exec(e); )
|
|
1194
|
+
a = i.index, a - t > n && (o = l > t ? l : a, s += `
|
|
1195
|
+
` + e.slice(t, o), t = o + 1), l = a;
|
|
1196
|
+
return s += `
|
|
1197
|
+
`, e.length - t > n && l > t ? s += e.slice(t, l) + `
|
|
1198
|
+
` + e.slice(l + 1) : s += e.slice(t), s.slice(1);
|
|
1199
|
+
}
|
|
1200
|
+
function Qt(e) {
|
|
1201
|
+
for (var n = "", r = 0, i, t = 0; t < e.length; r >= 65536 ? t += 2 : t++)
|
|
1202
|
+
r = he(e, t), i = N[r], !i && ve(r) ? (n += e[t], r >= 65536 && (n += e[t + 1])) : n += i || Yt(r);
|
|
1203
|
+
return n;
|
|
1204
|
+
}
|
|
1205
|
+
function Zt(e, n, r) {
|
|
1206
|
+
var i = "", t = e.tag, o, l, a;
|
|
1207
|
+
for (o = 0, l = r.length; o < l; o += 1)
|
|
1208
|
+
a = r[o], e.replacer && (a = e.replacer.call(r, String(o), a)), (W(e, n, a, !1, !1) || typeof a > "u" && W(e, n, null, !1, !1)) && (i !== "" && (i += "," + (e.condenseFlow ? "" : " ")), i += e.dump);
|
|
1209
|
+
e.tag = t, e.dump = "[" + i + "]";
|
|
1210
|
+
}
|
|
1211
|
+
function In(e, n, r, i) {
|
|
1212
|
+
var t = "", o = e.tag, l, a, s;
|
|
1213
|
+
for (l = 0, a = r.length; l < a; l += 1)
|
|
1214
|
+
s = r[l], e.replacer && (s = e.replacer.call(r, String(l), s)), (W(e, n + 1, s, !0, !0, !1, !0) || typeof s > "u" && W(e, n + 1, null, !0, !0, !1, !0)) && ((!i || t !== "") && (t += Ge(e, n)), e.dump && me === e.dump.charCodeAt(0) ? t += "-" : t += "- ", t += e.dump);
|
|
1215
|
+
e.tag = o, e.dump = t || "[]";
|
|
1216
|
+
}
|
|
1217
|
+
function eo(e, n, r) {
|
|
1218
|
+
var i = "", t = e.tag, o = Object.keys(r), l, a, s, c, f;
|
|
1219
|
+
for (l = 0, a = o.length; l < a; l += 1)
|
|
1220
|
+
f = "", i !== "" && (f += ", "), e.condenseFlow && (f += '"'), s = o[l], c = r[s], e.replacer && (c = e.replacer.call(r, s, c)), W(e, n, s, !1, !1) && (e.dump.length > 1024 && (f += "? "), f += e.dump + (e.condenseFlow ? '"' : "") + ":" + (e.condenseFlow ? "" : " "), W(e, n, c, !1, !1) && (f += e.dump, i += f));
|
|
1221
|
+
e.tag = t, e.dump = "{" + i + "}";
|
|
1222
|
+
}
|
|
1223
|
+
function no(e, n, r, i) {
|
|
1224
|
+
var t = "", o = e.tag, l = Object.keys(r), a, s, c, f, u, h;
|
|
1225
|
+
if (e.sortKeys === !0)
|
|
1226
|
+
l.sort();
|
|
1227
|
+
else if (typeof e.sortKeys == "function")
|
|
1228
|
+
l.sort(e.sortKeys);
|
|
1229
|
+
else if (e.sortKeys)
|
|
1230
|
+
throw new M("sortKeys must be a boolean or a function");
|
|
1231
|
+
for (a = 0, s = l.length; a < s; a += 1)
|
|
1232
|
+
h = "", (!i || t !== "") && (h += Ge(e, n)), c = l[a], f = r[c], e.replacer && (f = e.replacer.call(r, c, f)), W(e, n + 1, c, !0, !0, !0) && (u = e.tag !== null && e.tag !== "?" || e.dump && e.dump.length > 1024, u && (e.dump && me === e.dump.charCodeAt(0) ? h += "?" : h += "? "), h += e.dump, u && (h += Ge(e, n)), W(e, n + 1, f, !0, u) && (e.dump && me === e.dump.charCodeAt(0) ? h += ":" : h += ": ", h += e.dump, t += h));
|
|
1233
|
+
e.tag = o, e.dump = t || "{}";
|
|
1234
|
+
}
|
|
1235
|
+
function Nn(e, n, r) {
|
|
1236
|
+
var i, t, o, l, a, s;
|
|
1237
|
+
for (t = r ? e.explicitTypes : e.implicitTypes, o = 0, l = t.length; o < l; o += 1)
|
|
1238
|
+
if (a = t[o], (a.instanceOf || a.predicate) && (!a.instanceOf || typeof n == "object" && n instanceof a.instanceOf) && (!a.predicate || a.predicate(n))) {
|
|
1239
|
+
if (r ? a.multi && a.representName ? e.tag = a.representName(n) : e.tag = a.tag : e.tag = "?", a.represent) {
|
|
1240
|
+
if (s = e.styleMap[a.tag] || a.defaultStyle, br.call(a.represent) === "[object Function]")
|
|
1241
|
+
i = a.represent(n, s);
|
|
1242
|
+
else if (Ar.call(a.represent, s))
|
|
1243
|
+
i = a.represent[s](n, s);
|
|
1244
|
+
else
|
|
1245
|
+
throw new M("!<" + a.tag + '> tag resolver accepts not "' + s + '" style');
|
|
1246
|
+
e.dump = i;
|
|
1247
|
+
}
|
|
1248
|
+
return !0;
|
|
1249
|
+
}
|
|
1250
|
+
return !1;
|
|
1251
|
+
}
|
|
1252
|
+
function W(e, n, r, i, t, o, l) {
|
|
1253
|
+
e.tag = null, e.dump = r, Nn(e, r, !1) || Nn(e, r, !0);
|
|
1254
|
+
var a = br.call(e.dump), s = i, c;
|
|
1255
|
+
i && (i = e.flowLevel < 0 || e.flowLevel > n);
|
|
1256
|
+
var f = a === "[object Object]" || a === "[object Array]", u, h;
|
|
1257
|
+
if (f && (u = e.duplicates.indexOf(r), h = u !== -1), (e.tag !== null && e.tag !== "?" || h || e.indent !== 2 && n > 0) && (t = !1), h && e.usedDuplicates[u])
|
|
1258
|
+
e.dump = "*ref_" + u;
|
|
1259
|
+
else {
|
|
1260
|
+
if (f && h && !e.usedDuplicates[u] && (e.usedDuplicates[u] = !0), a === "[object Object]")
|
|
1261
|
+
i && Object.keys(e.dump).length !== 0 ? (no(e, n, e.dump, t), h && (e.dump = "&ref_" + u + e.dump)) : (eo(e, n, e.dump), h && (e.dump = "&ref_" + u + " " + e.dump));
|
|
1262
|
+
else if (a === "[object Array]")
|
|
1263
|
+
i && e.dump.length !== 0 ? (e.noArrayIndent && !l && n > 0 ? In(e, n - 1, e.dump, t) : In(e, n, e.dump, t), h && (e.dump = "&ref_" + u + e.dump)) : (Zt(e, n, e.dump), h && (e.dump = "&ref_" + u + " " + e.dump));
|
|
1264
|
+
else if (a === "[object String]")
|
|
1265
|
+
e.tag !== "?" && Xt(e, e.dump, n, o, s);
|
|
1266
|
+
else {
|
|
1267
|
+
if (a === "[object Undefined]")
|
|
1268
|
+
return !1;
|
|
1269
|
+
if (e.skipInvalid) return !1;
|
|
1270
|
+
throw new M("unacceptable kind of an object to dump " + a);
|
|
1271
|
+
}
|
|
1272
|
+
e.tag !== null && e.tag !== "?" && (c = encodeURI(
|
|
1273
|
+
e.tag[0] === "!" ? e.tag.slice(1) : e.tag
|
|
1274
|
+
).replace(/!/g, "%21"), e.tag[0] === "!" ? c = "!" + c : c.slice(0, 18) === "tag:yaml.org,2002:" ? c = "!!" + c.slice(18) : c = "!<" + c + ">", e.dump = c + " " + e.dump);
|
|
1275
|
+
}
|
|
1276
|
+
return !0;
|
|
1568
1277
|
}
|
|
1569
|
-
function
|
|
1570
|
-
|
|
1278
|
+
function ro(e, n) {
|
|
1279
|
+
var r = [], i = [], t, o;
|
|
1280
|
+
for (Xe(e, r, i), t = 0, o = i.length; t < o; t += 1)
|
|
1281
|
+
n.duplicates.push(r[i[t]]);
|
|
1282
|
+
n.usedDuplicates = new Array(o);
|
|
1571
1283
|
}
|
|
1572
|
-
function
|
|
1573
|
-
|
|
1284
|
+
function Xe(e, n, r) {
|
|
1285
|
+
var i, t, o;
|
|
1286
|
+
if (e !== null && typeof e == "object")
|
|
1287
|
+
if (t = n.indexOf(e), t !== -1)
|
|
1288
|
+
r.indexOf(t) === -1 && r.push(t);
|
|
1289
|
+
else if (n.push(e), Array.isArray(e))
|
|
1290
|
+
for (t = 0, o = e.length; t < o; t += 1)
|
|
1291
|
+
Xe(e[t], n, r);
|
|
1292
|
+
else
|
|
1293
|
+
for (i = Object.keys(e), t = 0, o = i.length; t < o; t += 1)
|
|
1294
|
+
Xe(e[i[t]], n, r);
|
|
1295
|
+
}
|
|
1296
|
+
function io(e, n) {
|
|
1297
|
+
n = n || {};
|
|
1298
|
+
var r = new Kt(n);
|
|
1299
|
+
r.noRefs || ro(e, r);
|
|
1300
|
+
var i = e;
|
|
1301
|
+
return r.replacer && (i = r.replacer.call({ "": i }, "", i)), W(r, 0, i, !0, !0) ? r.dump + `
|
|
1302
|
+
` : "";
|
|
1303
|
+
}
|
|
1304
|
+
var to = io, oo = {
|
|
1305
|
+
dump: to
|
|
1306
|
+
};
|
|
1307
|
+
function an(e, n) {
|
|
1308
|
+
return function() {
|
|
1309
|
+
throw new Error("Function yaml." + e + " is removed in js-yaml 4. Use yaml." + n + " instead, which is now safe by default.");
|
|
1310
|
+
};
|
|
1311
|
+
}
|
|
1312
|
+
var lo = j, ao = Wn, so = Xn, co = nr, uo = rr, fo = rn, po = wr.load, ho = wr.loadAll, go = oo.dump, mo = M, yo = {
|
|
1313
|
+
binary: ar,
|
|
1314
|
+
float: er,
|
|
1315
|
+
map: Vn,
|
|
1316
|
+
null: Jn,
|
|
1317
|
+
pairs: cr,
|
|
1318
|
+
set: ur,
|
|
1319
|
+
timestamp: or,
|
|
1320
|
+
bool: Qn,
|
|
1321
|
+
int: Zn,
|
|
1322
|
+
merge: lr,
|
|
1323
|
+
omap: sr,
|
|
1324
|
+
seq: Gn,
|
|
1325
|
+
str: qn
|
|
1326
|
+
}, vo = an("safeLoad", "load"), xo = an("safeLoadAll", "loadAll"), wo = an("safeDump", "dump"), je = {
|
|
1327
|
+
Type: lo,
|
|
1328
|
+
Schema: ao,
|
|
1329
|
+
FAILSAFE_SCHEMA: so,
|
|
1330
|
+
JSON_SCHEMA: co,
|
|
1331
|
+
CORE_SCHEMA: uo,
|
|
1332
|
+
DEFAULT_SCHEMA: fo,
|
|
1333
|
+
load: po,
|
|
1334
|
+
loadAll: ho,
|
|
1335
|
+
dump: go,
|
|
1336
|
+
YAMLException: mo,
|
|
1337
|
+
types: yo,
|
|
1338
|
+
safeLoad: vo,
|
|
1339
|
+
safeLoadAll: xo,
|
|
1340
|
+
safeDump: wo
|
|
1341
|
+
};
|
|
1342
|
+
const pe = "xcstrings-cli", Pn = Vr(pe, {
|
|
1343
|
+
searchPlaces: [
|
|
1344
|
+
`${pe}.json`,
|
|
1345
|
+
`${pe}.json5`,
|
|
1346
|
+
`${pe}.yaml`,
|
|
1347
|
+
`${pe}.yml`
|
|
1348
|
+
],
|
|
1349
|
+
loaders: {
|
|
1350
|
+
".json5": (e, n) => He.parse(n),
|
|
1351
|
+
".yaml": (e, n) => je.load(n),
|
|
1352
|
+
".yml": (e, n) => je.load(n)
|
|
1353
|
+
},
|
|
1354
|
+
cache: !1
|
|
1355
|
+
});
|
|
1356
|
+
async function sn(e) {
|
|
1357
|
+
if (e) {
|
|
1358
|
+
const r = await Pn.load(e);
|
|
1359
|
+
return r ? r.config : null;
|
|
1360
|
+
}
|
|
1361
|
+
const n = await Pn.search();
|
|
1362
|
+
return n ? n.config : null;
|
|
1363
|
+
}
|
|
1364
|
+
function Rn(e, n) {
|
|
1365
|
+
if (!e || e.length === 0) return null;
|
|
1366
|
+
for (const r of e)
|
|
1367
|
+
if (typeof r != "string" && r.alias === n)
|
|
1368
|
+
return r.path;
|
|
1369
|
+
return null;
|
|
1370
|
+
}
|
|
1371
|
+
async function bo(e, n, r) {
|
|
1372
|
+
const i = n?.xcstringsPaths, t = i?.some((s) => typeof s != "string") ?? !1, o = e.startsWith("alias:") ? e.slice(6) : null;
|
|
1373
|
+
if (o) {
|
|
1374
|
+
const s = Rn(i, o);
|
|
1375
|
+
if (!s)
|
|
1376
|
+
throw new Error(`Unknown alias: ${o}`);
|
|
1377
|
+
return s;
|
|
1378
|
+
}
|
|
1379
|
+
const l = Rn(i, e);
|
|
1380
|
+
if (l)
|
|
1381
|
+
return l;
|
|
1382
|
+
const a = !e.includes("/") && !e.endsWith(".xcstrings");
|
|
1383
|
+
if (t && a)
|
|
1384
|
+
throw new Error(`Unknown alias: ${e}`);
|
|
1385
|
+
if (e === r && i && i.length > 0) {
|
|
1386
|
+
if (i.length === 1) {
|
|
1387
|
+
const f = i[0];
|
|
1388
|
+
return typeof f == "string" ? f : f.path;
|
|
1389
|
+
}
|
|
1390
|
+
const s = i.map((f) => typeof f == "string" ? { name: f, value: f } : {
|
|
1391
|
+
name: `${f.alias} (${f.path})`,
|
|
1392
|
+
value: f.path
|
|
1393
|
+
});
|
|
1394
|
+
return await Xr({
|
|
1395
|
+
message: "Select xcstrings file:",
|
|
1396
|
+
choices: s
|
|
1397
|
+
});
|
|
1398
|
+
}
|
|
1399
|
+
return e;
|
|
1574
1400
|
}
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
);
|
|
1401
|
+
const Je = [
|
|
1402
|
+
"translated",
|
|
1403
|
+
"needs_review",
|
|
1404
|
+
"new",
|
|
1405
|
+
"stale"
|
|
1406
|
+
];
|
|
1407
|
+
async function Q(e) {
|
|
1408
|
+
const n = await Ke(e, "utf-8");
|
|
1409
|
+
return JSON.parse(n);
|
|
1584
1410
|
}
|
|
1585
|
-
function
|
|
1586
|
-
|
|
1411
|
+
async function cn(e, n) {
|
|
1412
|
+
const r = JSON.stringify(n, null, 2), i = Ao(r);
|
|
1413
|
+
await Ze(e, i + `
|
|
1414
|
+
`, "utf-8");
|
|
1587
1415
|
}
|
|
1588
|
-
function
|
|
1589
|
-
|
|
1416
|
+
function Ao(e) {
|
|
1417
|
+
let n = "", r = !1, i = !1;
|
|
1418
|
+
for (let t = 0; t < e.length; t++) {
|
|
1419
|
+
const o = e[t];
|
|
1420
|
+
if (r && o === "\\" && !i) {
|
|
1421
|
+
i = !0, n += o;
|
|
1422
|
+
continue;
|
|
1423
|
+
}
|
|
1424
|
+
if (i) {
|
|
1425
|
+
i = !1, n += o;
|
|
1426
|
+
continue;
|
|
1427
|
+
}
|
|
1428
|
+
if (o === '"') {
|
|
1429
|
+
r = !r, n += o;
|
|
1430
|
+
continue;
|
|
1431
|
+
}
|
|
1432
|
+
if (!r && o === ":") {
|
|
1433
|
+
n += " :";
|
|
1434
|
+
continue;
|
|
1435
|
+
}
|
|
1436
|
+
n += o;
|
|
1437
|
+
}
|
|
1438
|
+
return n;
|
|
1590
1439
|
}
|
|
1591
|
-
function
|
|
1592
|
-
|
|
1593
|
-
|
|
1440
|
+
async function ko() {
|
|
1441
|
+
const e = await Jr({
|
|
1442
|
+
message: "Enter strings payload (YAML or JSON). Save and close to submit.",
|
|
1443
|
+
default: ""
|
|
1444
|
+
});
|
|
1445
|
+
return typeof e == "string" ? e : "";
|
|
1594
1446
|
}
|
|
1595
|
-
function
|
|
1596
|
-
|
|
1597
|
-
return n.test(e);
|
|
1447
|
+
function So(e) {
|
|
1448
|
+
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
1598
1449
|
}
|
|
1599
|
-
var
|
|
1600
|
-
function
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1450
|
+
var de = { exports: {} }, $e, Mn;
|
|
1451
|
+
function Co() {
|
|
1452
|
+
if (Mn) return $e;
|
|
1453
|
+
Mn = 1;
|
|
1454
|
+
function e(r) {
|
|
1455
|
+
try {
|
|
1456
|
+
return JSON.stringify(r);
|
|
1457
|
+
} catch {
|
|
1458
|
+
return '"[Circular]"';
|
|
1607
1459
|
}
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1460
|
+
}
|
|
1461
|
+
$e = n;
|
|
1462
|
+
function n(r, i, t) {
|
|
1463
|
+
var o = t && t.stringify || e, l = 1;
|
|
1464
|
+
if (typeof r == "object" && r !== null) {
|
|
1465
|
+
var a = i.length + l;
|
|
1466
|
+
if (a === 1) return r;
|
|
1467
|
+
var s = new Array(a);
|
|
1468
|
+
s[0] = o(r);
|
|
1469
|
+
for (var c = 1; c < a; c++)
|
|
1470
|
+
s[c] = o(i[c]);
|
|
1471
|
+
return s.join(" ");
|
|
1472
|
+
}
|
|
1473
|
+
if (typeof r != "string")
|
|
1474
|
+
return r;
|
|
1475
|
+
var f = i.length;
|
|
1476
|
+
if (f === 0) return r;
|
|
1477
|
+
for (var u = "", h = 1 - l, g = -1, m = r && r.length || 0, d = 0; d < m; ) {
|
|
1478
|
+
if (r.charCodeAt(d) === 37 && d + 1 < m) {
|
|
1479
|
+
switch (g = g > -1 ? g : 0, r.charCodeAt(d + 1)) {
|
|
1480
|
+
case 100:
|
|
1481
|
+
// 'd'
|
|
1482
|
+
case 102:
|
|
1483
|
+
if (h >= f || i[h] == null) break;
|
|
1484
|
+
g < d && (u += r.slice(g, d)), u += Number(i[h]), g = d + 2, d++;
|
|
1485
|
+
break;
|
|
1486
|
+
case 105:
|
|
1487
|
+
if (h >= f || i[h] == null) break;
|
|
1488
|
+
g < d && (u += r.slice(g, d)), u += Math.floor(Number(i[h])), g = d + 2, d++;
|
|
1489
|
+
break;
|
|
1490
|
+
case 79:
|
|
1491
|
+
// 'O'
|
|
1492
|
+
case 111:
|
|
1493
|
+
// 'o'
|
|
1494
|
+
case 106:
|
|
1495
|
+
if (h >= f || i[h] === void 0) break;
|
|
1496
|
+
g < d && (u += r.slice(g, d));
|
|
1497
|
+
var w = typeof i[h];
|
|
1498
|
+
if (w === "string") {
|
|
1499
|
+
u += "'" + i[h] + "'", g = d + 2, d++;
|
|
1500
|
+
break;
|
|
1501
|
+
}
|
|
1502
|
+
if (w === "function") {
|
|
1503
|
+
u += i[h].name || "<anonymous>", g = d + 2, d++;
|
|
1504
|
+
break;
|
|
1505
|
+
}
|
|
1506
|
+
u += o(i[h]), g = d + 2, d++;
|
|
1507
|
+
break;
|
|
1508
|
+
case 115:
|
|
1509
|
+
if (h >= f)
|
|
1510
|
+
break;
|
|
1511
|
+
g < d && (u += r.slice(g, d)), u += String(i[h]), g = d + 2, d++;
|
|
1512
|
+
break;
|
|
1513
|
+
case 37:
|
|
1514
|
+
g < d && (u += r.slice(g, d)), u += "%", g = d + 2, d++, h--;
|
|
1515
|
+
break;
|
|
1516
|
+
}
|
|
1517
|
+
++h;
|
|
1518
|
+
}
|
|
1519
|
+
++d;
|
|
1616
1520
|
}
|
|
1617
|
-
|
|
1521
|
+
return g === -1 ? r : (g < m && (u += r.slice(g)), u);
|
|
1618
1522
|
}
|
|
1619
|
-
return
|
|
1523
|
+
return $e;
|
|
1620
1524
|
}
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1525
|
+
var Dn;
|
|
1526
|
+
function Eo() {
|
|
1527
|
+
if (Dn) return de.exports;
|
|
1528
|
+
Dn = 1;
|
|
1529
|
+
const e = Co();
|
|
1530
|
+
de.exports = f;
|
|
1531
|
+
const n = Br().console || {}, r = {
|
|
1532
|
+
mapHttpRequest: V,
|
|
1533
|
+
mapHttpResponse: V,
|
|
1534
|
+
wrapRequestSerializer: I,
|
|
1535
|
+
wrapResponseSerializer: I,
|
|
1536
|
+
wrapErrorSerializer: I,
|
|
1537
|
+
req: V,
|
|
1538
|
+
res: V,
|
|
1539
|
+
err: P,
|
|
1540
|
+
errWithCause: P
|
|
1541
|
+
};
|
|
1542
|
+
function i(p, y) {
|
|
1543
|
+
return p === "silent" ? 1 / 0 : y.levels.values[p];
|
|
1544
|
+
}
|
|
1545
|
+
const t = Symbol("pino.logFuncs"), o = Symbol("pino.hierarchy"), l = {
|
|
1546
|
+
error: "log",
|
|
1547
|
+
fatal: "error",
|
|
1548
|
+
warn: "error",
|
|
1549
|
+
info: "log",
|
|
1550
|
+
debug: "log",
|
|
1551
|
+
trace: "log"
|
|
1552
|
+
};
|
|
1553
|
+
function a(p, y) {
|
|
1554
|
+
const A = {
|
|
1555
|
+
logger: y,
|
|
1556
|
+
parent: p[o]
|
|
1557
|
+
};
|
|
1558
|
+
y[o] = A;
|
|
1559
|
+
}
|
|
1560
|
+
function s(p, y, A) {
|
|
1561
|
+
const C = {};
|
|
1562
|
+
y.forEach((E) => {
|
|
1563
|
+
C[E] = A[E] ? A[E] : n[E] || n[l[E] || "log"] || fe;
|
|
1564
|
+
}), p[t] = C;
|
|
1565
|
+
}
|
|
1566
|
+
function c(p, y) {
|
|
1567
|
+
return Array.isArray(p) ? p.filter(function(C) {
|
|
1568
|
+
return C !== "!stdSerializers.err";
|
|
1569
|
+
}) : p === !0 ? Object.keys(y) : !1;
|
|
1570
|
+
}
|
|
1571
|
+
function f(p) {
|
|
1572
|
+
p = p || {}, p.browser = p.browser || {};
|
|
1573
|
+
const y = p.browser.transmit;
|
|
1574
|
+
if (y && typeof y.send != "function")
|
|
1575
|
+
throw Error("pino: transmit option must have a send function");
|
|
1576
|
+
const A = p.browser.write || n;
|
|
1577
|
+
p.browser.write && (p.browser.asObject = !0);
|
|
1578
|
+
const C = p.serializers || {}, E = c(p.browser.serialize, C);
|
|
1579
|
+
let $ = p.browser.serialize;
|
|
1580
|
+
Array.isArray(p.browser.serialize) && p.browser.serialize.indexOf("!stdSerializers.err") > -1 && ($ = !1);
|
|
1581
|
+
const K = Object.keys(p.customLevels || {}), _ = ["error", "fatal", "warn", "info", "debug", "trace"].concat(K);
|
|
1582
|
+
typeof A == "function" && _.forEach(function(U) {
|
|
1583
|
+
A[U] = A;
|
|
1584
|
+
}), (p.enabled === !1 || p.browser.disabled) && (p.level = "silent");
|
|
1585
|
+
const R = p.level || "info", b = Object.create(A);
|
|
1586
|
+
b.log || (b.log = fe), s(b, _, A), a({}, b), Object.defineProperty(b, "levelVal", {
|
|
1587
|
+
get: be
|
|
1588
|
+
}), Object.defineProperty(b, "level", {
|
|
1589
|
+
get: ee,
|
|
1590
|
+
set: Yr
|
|
1591
|
+
});
|
|
1592
|
+
const Y = {
|
|
1593
|
+
transmit: y,
|
|
1594
|
+
serialize: E,
|
|
1595
|
+
asObject: p.browser.asObject,
|
|
1596
|
+
formatters: p.browser.formatters,
|
|
1597
|
+
levels: _,
|
|
1598
|
+
timestamp: Z(p)
|
|
1599
|
+
};
|
|
1600
|
+
b.levels = u(p), b.level = R, b.setMaxListeners = b.getMaxListeners = b.emit = b.addListener = b.on = b.prependListener = b.once = b.prependOnceListener = b.removeListener = b.removeAllListeners = b.listeners = b.listenerCount = b.eventNames = b.write = b.flush = fe, b.serializers = C, b._serialize = E, b._stdErrSerialize = $, b.child = Hr, y && (b._logEvent = L());
|
|
1601
|
+
function be() {
|
|
1602
|
+
return i(this.level, this);
|
|
1630
1603
|
}
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
a,
|
|
1634
|
-
e.indent,
|
|
1635
|
-
l,
|
|
1636
|
-
s,
|
|
1637
|
-
e.quotingType,
|
|
1638
|
-
e.forceQuotes && !i,
|
|
1639
|
-
t
|
|
1640
|
-
)) {
|
|
1641
|
-
case Cr:
|
|
1642
|
-
return n;
|
|
1643
|
-
case Ye:
|
|
1644
|
-
return "'" + n.replace(/'/g, "''") + "'";
|
|
1645
|
-
case Sr:
|
|
1646
|
-
return "|" + An(n, e.indent) + Cn(xn(n, o));
|
|
1647
|
-
case kr:
|
|
1648
|
-
return ">" + An(n, e.indent) + Cn(xn(qt(n, l), o));
|
|
1649
|
-
case re:
|
|
1650
|
-
return '"' + Gt(n) + '"';
|
|
1651
|
-
default:
|
|
1652
|
-
throw new P("impossible error: invalid scalar style");
|
|
1604
|
+
function ee() {
|
|
1605
|
+
return this._level;
|
|
1653
1606
|
}
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
}
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1607
|
+
function Yr(U) {
|
|
1608
|
+
if (U !== "silent" && !this.levels.values[U])
|
|
1609
|
+
throw Error("unknown level " + U);
|
|
1610
|
+
this._level = U, m(this, Y, b, "error"), m(this, Y, b, "fatal"), m(this, Y, b, "warn"), m(this, Y, b, "info"), m(this, Y, b, "debug"), m(this, Y, b, "trace"), K.forEach((ne) => {
|
|
1611
|
+
m(this, Y, b, ne);
|
|
1612
|
+
});
|
|
1613
|
+
}
|
|
1614
|
+
function Hr(U, ne) {
|
|
1615
|
+
if (!U)
|
|
1616
|
+
throw new Error("missing bindings for child Pino");
|
|
1617
|
+
ne = ne || {}, E && U.serializers && (ne.serializers = U.serializers);
|
|
1618
|
+
const dn = ne.serializers;
|
|
1619
|
+
if (E && dn) {
|
|
1620
|
+
var Ae = Object.assign({}, C, dn), hn = p.browser.serialize === !0 ? Object.keys(Ae) : E;
|
|
1621
|
+
delete U.serializers, v([U], hn, Ae, this._stdErrSerialize);
|
|
1622
|
+
}
|
|
1623
|
+
function gn(mn) {
|
|
1624
|
+
this._childLevel = (mn._childLevel | 0) + 1, this.bindings = U, Ae && (this.serializers = Ae, this._serialize = hn), y && (this._logEvent = L(
|
|
1625
|
+
[].concat(mn._logEvent.bindings, U)
|
|
1626
|
+
));
|
|
1627
|
+
}
|
|
1628
|
+
gn.prototype = this;
|
|
1629
|
+
const Re = new gn(this);
|
|
1630
|
+
return a(this, Re), Re.level = this.level, Re;
|
|
1631
|
+
}
|
|
1632
|
+
return b;
|
|
1633
|
+
}
|
|
1634
|
+
function u(p) {
|
|
1635
|
+
const y = p.customLevels || {}, A = Object.assign({}, f.levels.values, y), C = Object.assign({}, f.levels.labels, h(y));
|
|
1636
|
+
return {
|
|
1637
|
+
values: A,
|
|
1638
|
+
labels: C
|
|
1639
|
+
};
|
|
1640
|
+
}
|
|
1641
|
+
function h(p) {
|
|
1642
|
+
const y = {};
|
|
1643
|
+
return Object.keys(p).forEach(function(A) {
|
|
1644
|
+
y[p[A]] = A;
|
|
1645
|
+
}), y;
|
|
1646
|
+
}
|
|
1647
|
+
f.levels = {
|
|
1648
|
+
values: {
|
|
1649
|
+
fatal: 60,
|
|
1650
|
+
error: 50,
|
|
1651
|
+
warn: 40,
|
|
1652
|
+
info: 30,
|
|
1653
|
+
debug: 20,
|
|
1654
|
+
trace: 10
|
|
1655
|
+
},
|
|
1656
|
+
labels: {
|
|
1657
|
+
10: "trace",
|
|
1658
|
+
20: "debug",
|
|
1659
|
+
30: "info",
|
|
1660
|
+
40: "warn",
|
|
1661
|
+
50: "error",
|
|
1662
|
+
60: "fatal"
|
|
1663
|
+
}
|
|
1664
|
+
}, f.stdSerializers = r, f.stdTimeFunctions = Object.assign({}, { nullTime: fn, epochTime: pn, unixTime: $r, isoTime: Ur });
|
|
1665
|
+
function g(p) {
|
|
1666
|
+
const y = [];
|
|
1667
|
+
p.bindings && y.push(p.bindings);
|
|
1668
|
+
let A = p[o];
|
|
1669
|
+
for (; A.parent; )
|
|
1670
|
+
A = A.parent, A.logger.bindings && y.push(A.logger.bindings);
|
|
1671
|
+
return y.reverse();
|
|
1672
|
+
}
|
|
1673
|
+
function m(p, y, A, C) {
|
|
1674
|
+
if (Object.defineProperty(p, C, {
|
|
1675
|
+
value: i(p.level, A) > i(C, A) ? fe : A[t][C],
|
|
1676
|
+
writable: !0,
|
|
1677
|
+
enumerable: !0,
|
|
1678
|
+
configurable: !0
|
|
1679
|
+
}), !y.transmit && p[C] === fe)
|
|
1680
|
+
return;
|
|
1681
|
+
p[C] = w(p, y, A, C);
|
|
1682
|
+
const E = g(p);
|
|
1683
|
+
E.length !== 0 && (p[C] = d(E, p[C]));
|
|
1684
|
+
}
|
|
1685
|
+
function d(p, y) {
|
|
1686
|
+
return function() {
|
|
1687
|
+
return y.apply(this, [...p, ...arguments]);
|
|
1688
|
+
};
|
|
1689
|
+
}
|
|
1690
|
+
function w(p, y, A, C) {
|
|
1691
|
+
return /* @__PURE__ */ (function(E) {
|
|
1692
|
+
return function() {
|
|
1693
|
+
const K = y.timestamp(), _ = new Array(arguments.length), R = Object.getPrototypeOf && Object.getPrototypeOf(this) === n ? n : this;
|
|
1694
|
+
for (var b = 0; b < _.length; b++) _[b] = arguments[b];
|
|
1695
|
+
if (y.serialize && !y.asObject && v(_, this._serialize, this.serializers, this._stdErrSerialize), y.asObject || y.formatters ? E.call(R, k(this, C, _, K, y.formatters)) : E.apply(R, _), y.transmit) {
|
|
1696
|
+
const Y = y.transmit.level || p._level, be = A.levels.values[Y], ee = A.levels.values[C];
|
|
1697
|
+
if (ee < be) return;
|
|
1698
|
+
O(this, {
|
|
1699
|
+
ts: K,
|
|
1700
|
+
methodLevel: C,
|
|
1701
|
+
methodValue: ee,
|
|
1702
|
+
transmitValue: A.levels.values[y.transmit.level || p._level],
|
|
1703
|
+
send: y.transmit.send,
|
|
1704
|
+
val: i(p._level, A)
|
|
1705
|
+
}, _);
|
|
1706
|
+
}
|
|
1707
|
+
};
|
|
1708
|
+
})(p[t][C]);
|
|
1709
|
+
}
|
|
1710
|
+
function k(p, y, A, C, E = {}) {
|
|
1711
|
+
const {
|
|
1712
|
+
level: $ = () => p.levels.values[y],
|
|
1713
|
+
log: K = (ee) => ee
|
|
1714
|
+
} = E;
|
|
1715
|
+
p._serialize && v(A, p._serialize, p.serializers, p._stdErrSerialize);
|
|
1716
|
+
const _ = A.slice();
|
|
1717
|
+
let R = _[0];
|
|
1718
|
+
const b = {};
|
|
1719
|
+
C && (b.time = C), b.level = $(y, p.levels.values[y]);
|
|
1720
|
+
let Y = (p._childLevel | 0) + 1;
|
|
1721
|
+
if (Y < 1 && (Y = 1), R !== null && typeof R == "object") {
|
|
1722
|
+
for (; Y-- && typeof _[0] == "object"; )
|
|
1723
|
+
Object.assign(b, _.shift());
|
|
1724
|
+
R = _.length ? e(_.shift(), _) : void 0;
|
|
1725
|
+
} else typeof R == "string" && (R = e(_.shift(), _));
|
|
1726
|
+
return R !== void 0 && (b.msg = R), K(b);
|
|
1727
|
+
}
|
|
1728
|
+
function v(p, y, A, C) {
|
|
1729
|
+
for (const E in p)
|
|
1730
|
+
if (C && p[E] instanceof Error)
|
|
1731
|
+
p[E] = f.stdSerializers.err(p[E]);
|
|
1732
|
+
else if (typeof p[E] == "object" && !Array.isArray(p[E]))
|
|
1733
|
+
for (const $ in p[E])
|
|
1734
|
+
y && y.indexOf($) > -1 && $ in A && (p[E][$] = A[$](p[E][$]));
|
|
1735
|
+
}
|
|
1736
|
+
function O(p, y, A) {
|
|
1737
|
+
const C = y.send, E = y.ts, $ = y.methodLevel, K = y.methodValue, _ = y.val, R = p._logEvent.bindings;
|
|
1738
|
+
v(
|
|
1739
|
+
A,
|
|
1740
|
+
p._serialize || Object.keys(p.serializers),
|
|
1741
|
+
p.serializers,
|
|
1742
|
+
p._stdErrSerialize === void 0 ? !0 : p._stdErrSerialize
|
|
1743
|
+
), p._logEvent.ts = E, p._logEvent.messages = A.filter(function(b) {
|
|
1744
|
+
return R.indexOf(b) === -1;
|
|
1745
|
+
}), p._logEvent.level.label = $, p._logEvent.level.value = K, C($, p._logEvent, _), p._logEvent = L(R);
|
|
1746
|
+
}
|
|
1747
|
+
function L(p) {
|
|
1748
|
+
return {
|
|
1749
|
+
ts: 0,
|
|
1750
|
+
messages: [],
|
|
1751
|
+
bindings: p || [],
|
|
1752
|
+
level: { label: "", value: 0 }
|
|
1753
|
+
};
|
|
1754
|
+
}
|
|
1755
|
+
function P(p) {
|
|
1756
|
+
const y = {
|
|
1757
|
+
type: p.constructor.name,
|
|
1758
|
+
msg: p.message,
|
|
1759
|
+
stack: p.stack
|
|
1760
|
+
};
|
|
1761
|
+
for (const A in p)
|
|
1762
|
+
y[A] === void 0 && (y[A] = p[A]);
|
|
1763
|
+
return y;
|
|
1764
|
+
}
|
|
1765
|
+
function Z(p) {
|
|
1766
|
+
return typeof p.timestamp == "function" ? p.timestamp : p.timestamp === !1 ? fn : pn;
|
|
1767
|
+
}
|
|
1768
|
+
function V() {
|
|
1769
|
+
return {};
|
|
1678
1770
|
}
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
}
|
|
1690
|
-
function
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
e.tag = t, e.dump = "[" + i + "]";
|
|
1700
|
-
}
|
|
1701
|
-
function kn(e, n, r, i) {
|
|
1702
|
-
var t = "", o = e.tag, l, a, s;
|
|
1703
|
-
for (l = 0, a = r.length; l < a; l += 1)
|
|
1704
|
-
s = r[l], e.replacer && (s = e.replacer.call(r, String(l), s)), (W(e, n + 1, s, !0, !0, !1, !0) || typeof s > "u" && W(e, n + 1, null, !0, !0, !1, !0)) && ((!i || t !== "") && (t += Ue(e, n)), e.dump && pe === e.dump.charCodeAt(0) ? t += "-" : t += "- ", t += e.dump);
|
|
1705
|
-
e.tag = o, e.dump = t || "[]";
|
|
1706
|
-
}
|
|
1707
|
-
function Xt(e, n, r) {
|
|
1708
|
-
var i = "", t = e.tag, o = Object.keys(r), l, a, s, c, u;
|
|
1709
|
-
for (l = 0, a = o.length; l < a; l += 1)
|
|
1710
|
-
u = "", i !== "" && (u += ", "), e.condenseFlow && (u += '"'), s = o[l], c = r[s], e.replacer && (c = e.replacer.call(r, s, c)), W(e, n, s, !1, !1) && (e.dump.length > 1024 && (u += "? "), u += e.dump + (e.condenseFlow ? '"' : "") + ":" + (e.condenseFlow ? "" : " "), W(e, n, c, !1, !1) && (u += e.dump, i += u));
|
|
1711
|
-
e.tag = t, e.dump = "{" + i + "}";
|
|
1712
|
-
}
|
|
1713
|
-
function Qt(e, n, r, i) {
|
|
1714
|
-
var t = "", o = e.tag, l = Object.keys(r), a, s, c, u, f, h;
|
|
1715
|
-
if (e.sortKeys === !0)
|
|
1716
|
-
l.sort();
|
|
1717
|
-
else if (typeof e.sortKeys == "function")
|
|
1718
|
-
l.sort(e.sortKeys);
|
|
1719
|
-
else if (e.sortKeys)
|
|
1720
|
-
throw new P("sortKeys must be a boolean or a function");
|
|
1721
|
-
for (a = 0, s = l.length; a < s; a += 1)
|
|
1722
|
-
h = "", (!i || t !== "") && (h += Ue(e, n)), c = l[a], u = r[c], e.replacer && (u = e.replacer.call(r, c, u)), W(e, n + 1, c, !0, !0, !0) && (f = e.tag !== null && e.tag !== "?" || e.dump && e.dump.length > 1024, f && (e.dump && pe === e.dump.charCodeAt(0) ? h += "?" : h += "? "), h += e.dump, f && (h += Ue(e, n)), W(e, n + 1, u, !0, f) && (e.dump && pe === e.dump.charCodeAt(0) ? h += ":" : h += ": ", h += e.dump, t += h));
|
|
1723
|
-
e.tag = o, e.dump = t || "{}";
|
|
1724
|
-
}
|
|
1725
|
-
function En(e, n, r) {
|
|
1726
|
-
var i, t, o, l, a, s;
|
|
1727
|
-
for (t = r ? e.explicitTypes : e.implicitTypes, o = 0, l = t.length; o < l; o += 1)
|
|
1728
|
-
if (a = t[o], (a.instanceOf || a.predicate) && (!a.instanceOf || typeof n == "object" && n instanceof a.instanceOf) && (!a.predicate || a.predicate(n))) {
|
|
1729
|
-
if (r ? a.multi && a.representName ? e.tag = a.representName(n) : e.tag = a.tag : e.tag = "?", a.represent) {
|
|
1730
|
-
if (s = e.styleMap[a.tag] || a.defaultStyle, gr.call(a.represent) === "[object Function]")
|
|
1731
|
-
i = a.represent(n, s);
|
|
1732
|
-
else if (mr.call(a.represent, s))
|
|
1733
|
-
i = a.represent[s](n, s);
|
|
1734
|
-
else
|
|
1735
|
-
throw new P("!<" + a.tag + '> tag resolver accepts not "' + s + '" style');
|
|
1736
|
-
e.dump = i;
|
|
1737
|
-
}
|
|
1738
|
-
return !0;
|
|
1771
|
+
function I(p) {
|
|
1772
|
+
return p;
|
|
1773
|
+
}
|
|
1774
|
+
function fe() {
|
|
1775
|
+
}
|
|
1776
|
+
function fn() {
|
|
1777
|
+
return !1;
|
|
1778
|
+
}
|
|
1779
|
+
function pn() {
|
|
1780
|
+
return Date.now();
|
|
1781
|
+
}
|
|
1782
|
+
function $r() {
|
|
1783
|
+
return Math.round(Date.now() / 1e3);
|
|
1784
|
+
}
|
|
1785
|
+
function Ur() {
|
|
1786
|
+
return new Date(Date.now()).toISOString();
|
|
1787
|
+
}
|
|
1788
|
+
function Br() {
|
|
1789
|
+
function p(y) {
|
|
1790
|
+
return typeof y < "u" && y;
|
|
1739
1791
|
}
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
function
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
else {
|
|
1750
|
-
if (u && h && !e.usedDuplicates[f] && (e.usedDuplicates[f] = !0), a === "[object Object]")
|
|
1751
|
-
i && Object.keys(e.dump).length !== 0 ? (Qt(e, n, e.dump, t), h && (e.dump = "&ref_" + f + e.dump)) : (Xt(e, n, e.dump), h && (e.dump = "&ref_" + f + " " + e.dump));
|
|
1752
|
-
else if (a === "[object Array]")
|
|
1753
|
-
i && e.dump.length !== 0 ? (e.noArrayIndent && !l && n > 0 ? kn(e, n - 1, e.dump, t) : kn(e, n, e.dump, t), h && (e.dump = "&ref_" + f + e.dump)) : (Vt(e, n, e.dump), h && (e.dump = "&ref_" + f + " " + e.dump));
|
|
1754
|
-
else if (a === "[object String]")
|
|
1755
|
-
e.tag !== "?" && Wt(e, e.dump, n, o, s);
|
|
1756
|
-
else {
|
|
1757
|
-
if (a === "[object Undefined]")
|
|
1758
|
-
return !1;
|
|
1759
|
-
if (e.skipInvalid) return !1;
|
|
1760
|
-
throw new P("unacceptable kind of an object to dump " + a);
|
|
1792
|
+
try {
|
|
1793
|
+
return typeof globalThis < "u" || Object.defineProperty(Object.prototype, "globalThis", {
|
|
1794
|
+
get: function() {
|
|
1795
|
+
return delete Object.prototype.globalThis, this.globalThis = this;
|
|
1796
|
+
},
|
|
1797
|
+
configurable: !0
|
|
1798
|
+
}), globalThis;
|
|
1799
|
+
} catch {
|
|
1800
|
+
return p(self) || p(window) || p(this) || {};
|
|
1761
1801
|
}
|
|
1762
|
-
e.tag !== null && e.tag !== "?" && (c = encodeURI(
|
|
1763
|
-
e.tag[0] === "!" ? e.tag.slice(1) : e.tag
|
|
1764
|
-
).replace(/!/g, "%21"), e.tag[0] === "!" ? c = "!" + c : c.slice(0, 18) === "tag:yaml.org,2002:" ? c = "!!" + c.slice(18) : c = "!<" + c + ">", e.dump = c + " " + e.dump);
|
|
1765
1802
|
}
|
|
1766
|
-
return
|
|
1803
|
+
return de.exports.default = f, de.exports.pino = f, de.exports;
|
|
1767
1804
|
}
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1805
|
+
var Oo = Eo();
|
|
1806
|
+
const _o = /* @__PURE__ */ So(Oo), X = _o({
|
|
1807
|
+
level: process.env.LOG_LEVEL || "info"
|
|
1808
|
+
});
|
|
1809
|
+
function Fo() {
|
|
1810
|
+
return {
|
|
1811
|
+
command: "languages",
|
|
1812
|
+
describe: "List supported languages from xcodeproj or xcstrings",
|
|
1813
|
+
handler: async (e) => {
|
|
1814
|
+
const n = await jr(
|
|
1815
|
+
e.path,
|
|
1816
|
+
e.config
|
|
1817
|
+
);
|
|
1818
|
+
X.info(n.join(" "));
|
|
1819
|
+
}
|
|
1820
|
+
};
|
|
1773
1821
|
}
|
|
1774
|
-
function
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
if (t = n.indexOf(e), t !== -1)
|
|
1778
|
-
r.indexOf(t) === -1 && r.push(t);
|
|
1779
|
-
else if (n.push(e), Array.isArray(e))
|
|
1780
|
-
for (t = 0, o = e.length; t < o; t += 1)
|
|
1781
|
-
He(e[t], n, r);
|
|
1782
|
-
else
|
|
1783
|
-
for (i = Object.keys(e), t = 0, o = i.length; t < o; t += 1)
|
|
1784
|
-
He(e[i[t]], n, r);
|
|
1822
|
+
function To(e) {
|
|
1823
|
+
const n = Ne(e, "project.pbxproj");
|
|
1824
|
+
return (ei.open(n).rootObject.props.knownRegions ?? []).filter((o) => o !== "Base").sort();
|
|
1785
1825
|
}
|
|
1786
|
-
function
|
|
1787
|
-
n =
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1826
|
+
async function Lo(e) {
|
|
1827
|
+
const n = await Q(e), r = /* @__PURE__ */ new Set();
|
|
1828
|
+
if (!n.sourceLanguage)
|
|
1829
|
+
throw new Error('The xcstrings file is missing "sourceLanguage".');
|
|
1830
|
+
r.add(n.sourceLanguage);
|
|
1831
|
+
for (const i of Object.keys(n.strings)) {
|
|
1832
|
+
const t = n.strings[i];
|
|
1833
|
+
if (t.localizations)
|
|
1834
|
+
for (const o of Object.keys(t.localizations))
|
|
1835
|
+
r.add(o);
|
|
1836
|
+
}
|
|
1837
|
+
return Array.from(r).sort();
|
|
1793
1838
|
}
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1839
|
+
async function jr(e, n) {
|
|
1840
|
+
const { sourceLanguage: r } = await Q(e);
|
|
1841
|
+
if (!r)
|
|
1842
|
+
throw new Error('The xcstrings file is missing "sourceLanguage".');
|
|
1843
|
+
const i = await sn(n);
|
|
1844
|
+
if (i?.xcodeprojPaths && i.xcodeprojPaths.length > 0) {
|
|
1845
|
+
const l = /* @__PURE__ */ new Set();
|
|
1846
|
+
l.add(r);
|
|
1847
|
+
for (const a of i.xcodeprojPaths)
|
|
1848
|
+
To(a).forEach((c) => l.add(c));
|
|
1849
|
+
return Array.from(l).sort();
|
|
1850
|
+
}
|
|
1851
|
+
const t = await Lo(e), o = new Set(t);
|
|
1852
|
+
return o.add(r), Array.from(o).sort();
|
|
1801
1853
|
}
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
set: tr,
|
|
1809
|
-
timestamp: Zn,
|
|
1810
|
-
bool: Wn,
|
|
1811
|
-
int: qn,
|
|
1812
|
-
merge: er,
|
|
1813
|
-
omap: rr,
|
|
1814
|
-
seq: Un,
|
|
1815
|
-
str: Bn
|
|
1816
|
-
}, ho = Je("safeLoad", "load"), go = Je("safeLoadAll", "loadAll"), mo = Je("safeDump", "dump"), _n = {
|
|
1817
|
-
Type: ro,
|
|
1818
|
-
Schema: io,
|
|
1819
|
-
FAILSAFE_SCHEMA: to,
|
|
1820
|
-
JSON_SCHEMA: oo,
|
|
1821
|
-
CORE_SCHEMA: lo,
|
|
1822
|
-
DEFAULT_SCHEMA: ao,
|
|
1823
|
-
load: so,
|
|
1824
|
-
loadAll: co,
|
|
1825
|
-
dump: uo,
|
|
1826
|
-
YAMLException: fo,
|
|
1827
|
-
types: po,
|
|
1828
|
-
safeLoad: ho,
|
|
1829
|
-
safeLoadAll: go,
|
|
1830
|
-
safeDump: mo
|
|
1831
|
-
};
|
|
1832
|
-
const be = (e) => e instanceof Error ? e.message : String(e), Ae = (e, n) => {
|
|
1854
|
+
class ae extends Error {
|
|
1855
|
+
constructor(n) {
|
|
1856
|
+
super(n), this.name = "ArgumentError";
|
|
1857
|
+
}
|
|
1858
|
+
}
|
|
1859
|
+
const Se = (e) => e instanceof Error ? e.message : String(e), Ce = (e, n) => {
|
|
1833
1860
|
if (e && typeof e == "object" && !Array.isArray(e))
|
|
1834
1861
|
return e;
|
|
1835
1862
|
throw new Error(`Parsed --strings as ${n}, but it was not an object.`);
|
|
1836
|
-
},
|
|
1863
|
+
}, jo = (e, n) => {
|
|
1837
1864
|
const r = e.trim();
|
|
1838
1865
|
if (!r)
|
|
1839
1866
|
return {};
|
|
1840
1867
|
if (n === "json")
|
|
1841
1868
|
try {
|
|
1842
|
-
return
|
|
1869
|
+
return Ce(He.parse(r), "json");
|
|
1843
1870
|
} catch (t) {
|
|
1844
|
-
throw new Error(
|
|
1871
|
+
throw new Error(
|
|
1872
|
+
`Failed to parse --strings as JSON. Hint: check --strings-format=json. ${Se(t)}`
|
|
1873
|
+
);
|
|
1845
1874
|
}
|
|
1846
1875
|
if (n === "yaml")
|
|
1847
1876
|
try {
|
|
1848
|
-
return
|
|
1877
|
+
return Ce(je.load(r), "yaml");
|
|
1849
1878
|
} catch (t) {
|
|
1850
|
-
throw new Error(
|
|
1879
|
+
throw new Error(
|
|
1880
|
+
`Failed to parse --strings as YAML. Hint: check --strings-format=yaml. ${Se(t)}`
|
|
1881
|
+
);
|
|
1851
1882
|
}
|
|
1852
1883
|
const i = [];
|
|
1853
1884
|
try {
|
|
1854
|
-
return
|
|
1885
|
+
return Ce(je.load(r), "yaml");
|
|
1855
1886
|
} catch (t) {
|
|
1856
|
-
i.push(`yaml error: ${
|
|
1887
|
+
i.push(`yaml error: ${Se(t)}`);
|
|
1857
1888
|
}
|
|
1858
1889
|
try {
|
|
1859
|
-
return
|
|
1890
|
+
return Ce(He.parse(r), "json");
|
|
1860
1891
|
} catch (t) {
|
|
1861
|
-
i.push(`json error: ${
|
|
1892
|
+
i.push(`json error: ${Se(t)}`);
|
|
1862
1893
|
}
|
|
1863
|
-
throw new Error(
|
|
1894
|
+
throw new Error(
|
|
1895
|
+
`Failed to parse --strings input. Provide valid YAML or JSON, or specify --strings-format. ${i.join(" | ")}`
|
|
1896
|
+
);
|
|
1864
1897
|
};
|
|
1865
|
-
async function
|
|
1898
|
+
async function Ir() {
|
|
1866
1899
|
return new Promise((e) => {
|
|
1867
1900
|
let n = "";
|
|
1868
1901
|
process.stdin.setEncoding("utf8"), process.stdin.on("data", (r) => {
|
|
@@ -1872,12 +1905,14 @@ async function Er() {
|
|
|
1872
1905
|
}), process.stdin.readableEnded && e("");
|
|
1873
1906
|
});
|
|
1874
1907
|
}
|
|
1875
|
-
const
|
|
1908
|
+
const Nr = (e) => {
|
|
1876
1909
|
if (e === void 0) return "translated";
|
|
1877
|
-
if (
|
|
1910
|
+
if (Je.includes(e))
|
|
1878
1911
|
return e;
|
|
1879
|
-
throw new Error(
|
|
1880
|
-
}
|
|
1912
|
+
throw new Error(
|
|
1913
|
+
`Invalid state "${e}". Allowed values: ${Je.join(", ")}.`
|
|
1914
|
+
);
|
|
1915
|
+
}, Pr = (e, n) => {
|
|
1881
1916
|
if (typeof e == "string")
|
|
1882
1917
|
return { value: e, state: void 0 };
|
|
1883
1918
|
if (e && typeof e == "object" && !Array.isArray(e)) {
|
|
@@ -1885,18 +1920,23 @@ const _r = (e) => {
|
|
|
1885
1920
|
if (typeof r.value != "string")
|
|
1886
1921
|
throw new Error(`${n} must include a string "value".`);
|
|
1887
1922
|
let i;
|
|
1888
|
-
return r.state !== void 0 && (i =
|
|
1923
|
+
return r.state !== void 0 && (i = Nr(String(r.state))), { value: r.value, state: i };
|
|
1889
1924
|
}
|
|
1890
|
-
throw new Error(
|
|
1891
|
-
}
|
|
1925
|
+
throw new Error(
|
|
1926
|
+
`${n} must be a string or an object with "value" (and optional "state").`
|
|
1927
|
+
);
|
|
1928
|
+
}, Qe = (e, n) => {
|
|
1892
1929
|
if (e === void 0) return;
|
|
1893
1930
|
if (!e || typeof e != "object" || Array.isArray(e))
|
|
1894
1931
|
throw new Error(`${n} must be an object of language -> text.`);
|
|
1895
1932
|
const r = {};
|
|
1896
1933
|
for (const [i, t] of Object.entries(e))
|
|
1897
|
-
r[i] =
|
|
1934
|
+
r[i] = Pr(
|
|
1935
|
+
t,
|
|
1936
|
+
`${n} for "${i}"`
|
|
1937
|
+
);
|
|
1898
1938
|
return r;
|
|
1899
|
-
},
|
|
1939
|
+
}, Io = (e, n) => {
|
|
1900
1940
|
if (e == null)
|
|
1901
1941
|
return {};
|
|
1902
1942
|
if (typeof e == "string")
|
|
@@ -1905,33 +1945,43 @@ const _r = (e) => {
|
|
|
1905
1945
|
throw new Error(`Value for "${n}" must be an object.`);
|
|
1906
1946
|
const r = e, i = {};
|
|
1907
1947
|
typeof r.comment == "string" && (i.comment = r.comment);
|
|
1908
|
-
const t =
|
|
1948
|
+
const t = Qe(r.translations, `translations for "${n}"`) || {}, o = {};
|
|
1909
1949
|
for (const [a, s] of Object.entries(r))
|
|
1910
|
-
a === "comment" || a === "translations" || (o[a] =
|
|
1911
|
-
|
|
1950
|
+
a === "comment" || a === "translations" || (o[a] = Pr(
|
|
1951
|
+
s,
|
|
1952
|
+
`Translation for "${a}" in "${n}"`
|
|
1953
|
+
));
|
|
1954
|
+
const l = {
|
|
1955
|
+
...t,
|
|
1956
|
+
...o
|
|
1957
|
+
};
|
|
1912
1958
|
return Object.keys(l).length > 0 && (i.translations = l), i;
|
|
1913
|
-
},
|
|
1959
|
+
}, No = (e) => {
|
|
1914
1960
|
if (typeof e == "string") return !0;
|
|
1915
1961
|
if (e && typeof e == "object" && !Array.isArray(e)) {
|
|
1916
1962
|
const n = e;
|
|
1917
1963
|
return typeof n.value == "string" && (n.state === void 0 || typeof n.state == "string");
|
|
1918
1964
|
}
|
|
1919
1965
|
return !1;
|
|
1920
|
-
},
|
|
1921
|
-
if (
|
|
1922
|
-
return { kind: "single", translations:
|
|
1923
|
-
if (Object.keys(e).every(
|
|
1924
|
-
|
|
1966
|
+
}, Po = (e) => Object.values(e).every((n) => No(n)), Ro = (e) => {
|
|
1967
|
+
if (Po(e))
|
|
1968
|
+
return { kind: "single", translations: Qe(e, "translations") || {} };
|
|
1969
|
+
if (Object.keys(e).every(
|
|
1970
|
+
(i) => i === "translations" || i === "comment"
|
|
1971
|
+
) && "translations" in e) {
|
|
1972
|
+
const i = Qe(e.translations, "translations") || {}, t = typeof e.comment == "string" ? e.comment : void 0;
|
|
1925
1973
|
return { kind: "single", translations: i, comment: t };
|
|
1926
1974
|
}
|
|
1927
1975
|
const r = {};
|
|
1928
1976
|
for (const [i, t] of Object.entries(e))
|
|
1929
|
-
r[i] =
|
|
1977
|
+
r[i] = Io(t, i);
|
|
1930
1978
|
return { kind: "multi", entries: r };
|
|
1931
|
-
},
|
|
1979
|
+
}, Mo = (e, n) => {
|
|
1932
1980
|
if (!e) return n;
|
|
1933
1981
|
if (e.kind !== n.kind)
|
|
1934
|
-
throw new Error(
|
|
1982
|
+
throw new Error(
|
|
1983
|
+
"Cannot merge single and multi --strings payloads. Provide one consistent shape."
|
|
1984
|
+
);
|
|
1935
1985
|
if (e.kind === "single" && n.kind === "single")
|
|
1936
1986
|
return {
|
|
1937
1987
|
kind: "single",
|
|
@@ -1944,19 +1994,22 @@ const _r = (e) => {
|
|
|
1944
1994
|
const o = r[i] || {};
|
|
1945
1995
|
r[i] = {
|
|
1946
1996
|
comment: t.comment ?? o.comment,
|
|
1947
|
-
translations: {
|
|
1997
|
+
translations: {
|
|
1998
|
+
...o.translations || {},
|
|
1999
|
+
...t.translations || {}
|
|
2000
|
+
}
|
|
1948
2001
|
};
|
|
1949
2002
|
}
|
|
1950
2003
|
return { kind: "multi", entries: r };
|
|
1951
2004
|
}
|
|
1952
2005
|
return e;
|
|
1953
2006
|
};
|
|
1954
|
-
async function
|
|
2007
|
+
async function Rr(e, n = Ir, r = "auto") {
|
|
1955
2008
|
if (e === void 0)
|
|
1956
2009
|
return;
|
|
1957
2010
|
const i = async (t) => {
|
|
1958
2011
|
if (t.trim())
|
|
1959
|
-
return
|
|
2012
|
+
return Ro(jo(t, r));
|
|
1960
2013
|
};
|
|
1961
2014
|
if (e === "") {
|
|
1962
2015
|
const t = await n();
|
|
@@ -1969,7 +2022,7 @@ async function Co(e, n = Er, r = "auto") {
|
|
|
1969
2022
|
for (const o of e)
|
|
1970
2023
|
if (typeof o == "string") {
|
|
1971
2024
|
const l = await i(o);
|
|
1972
|
-
l && (t =
|
|
2025
|
+
l && (t = Mo(t, l));
|
|
1973
2026
|
}
|
|
1974
2027
|
return t;
|
|
1975
2028
|
}
|
|
@@ -1978,7 +2031,64 @@ async function Co(e, n = Er, r = "auto") {
|
|
|
1978
2031
|
return i(t);
|
|
1979
2032
|
}
|
|
1980
2033
|
}
|
|
1981
|
-
async function
|
|
2034
|
+
async function Do(e) {
|
|
2035
|
+
const n = await ko();
|
|
2036
|
+
if (!n.trim())
|
|
2037
|
+
throw new Error(
|
|
2038
|
+
"Interactive input was empty. Provide YAML or JSON payload."
|
|
2039
|
+
);
|
|
2040
|
+
const r = (a) => a instanceof Error ? a.message : String(a);
|
|
2041
|
+
let i;
|
|
2042
|
+
try {
|
|
2043
|
+
i = await Rr(
|
|
2044
|
+
n,
|
|
2045
|
+
async () => Promise.resolve(""),
|
|
2046
|
+
"auto"
|
|
2047
|
+
);
|
|
2048
|
+
} catch (a) {
|
|
2049
|
+
throw new Error(`Failed to parse interactive input. ${r(a)}`);
|
|
2050
|
+
}
|
|
2051
|
+
if (!i)
|
|
2052
|
+
throw new Error(
|
|
2053
|
+
"Interactive input was empty. Provide YAML or JSON payload."
|
|
2054
|
+
);
|
|
2055
|
+
if (i.kind === "multi") {
|
|
2056
|
+
if (e.key || e.comment || e.defaultString !== void 0 || e.language)
|
|
2057
|
+
throw new ae(
|
|
2058
|
+
"When adding multiple strings via interactive payload, omit --key, --comment, --text, and --language."
|
|
2059
|
+
);
|
|
2060
|
+
const a = [];
|
|
2061
|
+
for (const [s, c] of Object.entries(i.entries))
|
|
2062
|
+
await Ie(
|
|
2063
|
+
e.path,
|
|
2064
|
+
s,
|
|
2065
|
+
c.comment,
|
|
2066
|
+
c.translations,
|
|
2067
|
+
e.configPath,
|
|
2068
|
+
void 0,
|
|
2069
|
+
void 0,
|
|
2070
|
+
e.state
|
|
2071
|
+
), a.push(s);
|
|
2072
|
+
return { kind: "multi", keys: a };
|
|
2073
|
+
}
|
|
2074
|
+
const t = e.key;
|
|
2075
|
+
if (!t)
|
|
2076
|
+
throw new ae(
|
|
2077
|
+
"--key is required unless the interactive payload contains multiple keys."
|
|
2078
|
+
);
|
|
2079
|
+
const o = i.kind === "single" ? i.comment : void 0, l = i.kind === "single" ? i.translations : void 0;
|
|
2080
|
+
return await Ie(
|
|
2081
|
+
e.path,
|
|
2082
|
+
t,
|
|
2083
|
+
e.comment ?? o,
|
|
2084
|
+
l,
|
|
2085
|
+
e.configPath,
|
|
2086
|
+
e.defaultString,
|
|
2087
|
+
e.language,
|
|
2088
|
+
e.state
|
|
2089
|
+
), { kind: "single", keys: [t] };
|
|
2090
|
+
}
|
|
2091
|
+
async function zo({
|
|
1982
2092
|
path: e,
|
|
1983
2093
|
key: n,
|
|
1984
2094
|
comment: r,
|
|
@@ -1986,30 +2096,75 @@ async function So({
|
|
|
1986
2096
|
stringsFormat: t,
|
|
1987
2097
|
defaultString: o,
|
|
1988
2098
|
language: l,
|
|
1989
|
-
stdinReader: a =
|
|
2099
|
+
stdinReader: a = Ir,
|
|
1990
2100
|
configPath: s,
|
|
1991
|
-
state: c
|
|
2101
|
+
state: c,
|
|
2102
|
+
interactive: f
|
|
1992
2103
|
}) {
|
|
1993
|
-
const u =
|
|
1994
|
-
if (
|
|
2104
|
+
const u = Nr(c);
|
|
2105
|
+
if (f) {
|
|
2106
|
+
if (i !== void 0)
|
|
2107
|
+
throw new ae(
|
|
2108
|
+
"--interactive cannot be combined with --strings input."
|
|
2109
|
+
);
|
|
2110
|
+
return Do({
|
|
2111
|
+
path: e,
|
|
2112
|
+
key: n,
|
|
2113
|
+
comment: r,
|
|
2114
|
+
defaultString: o,
|
|
2115
|
+
language: l,
|
|
2116
|
+
configPath: s,
|
|
2117
|
+
state: u
|
|
2118
|
+
});
|
|
2119
|
+
}
|
|
2120
|
+
const h = await Rr(
|
|
2121
|
+
i,
|
|
2122
|
+
a,
|
|
2123
|
+
t
|
|
2124
|
+
);
|
|
2125
|
+
if (h?.kind === "multi") {
|
|
1995
2126
|
if (n || r || o !== void 0 || l)
|
|
1996
|
-
throw new
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2127
|
+
throw new ae(
|
|
2128
|
+
"When adding multiple strings via --strings payload, omit --key, --comment, --text, and --language."
|
|
2129
|
+
);
|
|
2130
|
+
const w = [];
|
|
2131
|
+
for (const [k, v] of Object.entries(h.entries))
|
|
2132
|
+
await Ie(
|
|
2133
|
+
e,
|
|
2134
|
+
k,
|
|
2135
|
+
v.comment,
|
|
2136
|
+
v.translations,
|
|
2137
|
+
s,
|
|
2138
|
+
void 0,
|
|
2139
|
+
void 0,
|
|
2140
|
+
u
|
|
2141
|
+
), w.push(k);
|
|
2142
|
+
return { kind: "multi", keys: w };
|
|
2143
|
+
}
|
|
2144
|
+
const g = n;
|
|
2145
|
+
if (!g)
|
|
2146
|
+
throw new ae(
|
|
2147
|
+
"--key is required unless the --strings payload contains multiple keys."
|
|
2148
|
+
);
|
|
2149
|
+
const m = h?.kind === "single" ? h.translations : void 0, d = h?.kind === "single" ? h.comment : void 0;
|
|
2150
|
+
return await Ie(
|
|
2151
|
+
e,
|
|
2152
|
+
g,
|
|
2153
|
+
r ?? d,
|
|
2154
|
+
m,
|
|
2155
|
+
s,
|
|
2156
|
+
o,
|
|
2157
|
+
l,
|
|
2158
|
+
u
|
|
2159
|
+
), { kind: "single", keys: [g] };
|
|
2160
|
+
}
|
|
2161
|
+
const $o = (e) => {
|
|
2162
|
+
const n = Object.entries(e).sort(
|
|
2163
|
+
([r], [i]) => r.localeCompare(i, "en", { sensitivity: "case" })
|
|
2164
|
+
);
|
|
2010
2165
|
return Object.fromEntries(n);
|
|
2011
2166
|
};
|
|
2012
|
-
function
|
|
2167
|
+
function Uo() {
|
|
2013
2168
|
return {
|
|
2014
2169
|
command: "add",
|
|
2015
2170
|
describe: "Add a string",
|
|
@@ -2026,7 +2181,7 @@ function Eo() {
|
|
|
2026
2181
|
describe: "The language of the string provided with --text"
|
|
2027
2182
|
}).option("state", {
|
|
2028
2183
|
type: "string",
|
|
2029
|
-
choices:
|
|
2184
|
+
choices: Je,
|
|
2030
2185
|
describe: "State to apply to added strings (translated | needs_review | new | stale)"
|
|
2031
2186
|
}).option("text", {
|
|
2032
2187
|
type: "string",
|
|
@@ -2039,9 +2194,13 @@ function Eo() {
|
|
|
2039
2194
|
choices: ["auto", "json", "yaml"],
|
|
2040
2195
|
default: "auto",
|
|
2041
2196
|
describe: "Format for the data provided with --strings"
|
|
2197
|
+
}).option("interactive", {
|
|
2198
|
+
type: "boolean",
|
|
2199
|
+
alias: "i",
|
|
2200
|
+
describe: "Add strings in an interactive flow"
|
|
2042
2201
|
}),
|
|
2043
2202
|
handler: async (e) => {
|
|
2044
|
-
const n = await
|
|
2203
|
+
const n = await zo({
|
|
2045
2204
|
path: e.path,
|
|
2046
2205
|
key: e.key,
|
|
2047
2206
|
comment: e.comment,
|
|
@@ -2051,74 +2210,81 @@ function Eo() {
|
|
|
2051
2210
|
language: e.language,
|
|
2052
2211
|
state: e.state,
|
|
2053
2212
|
stdinReader: void 0,
|
|
2054
|
-
configPath: e.config
|
|
2213
|
+
configPath: e.config,
|
|
2214
|
+
interactive: e.interactive
|
|
2055
2215
|
});
|
|
2056
|
-
X.info(
|
|
2216
|
+
X.info(
|
|
2217
|
+
S.green(
|
|
2218
|
+
`✓ Added keys:
|
|
2057
2219
|
${n.keys.map((r) => `- ${r}`).join(`
|
|
2058
|
-
`)}`
|
|
2220
|
+
`)}`
|
|
2221
|
+
)
|
|
2222
|
+
);
|
|
2059
2223
|
}
|
|
2060
2224
|
};
|
|
2061
2225
|
}
|
|
2062
|
-
async function
|
|
2063
|
-
const s = await
|
|
2226
|
+
async function Ie(e, n, r, i, t, o, l, a) {
|
|
2227
|
+
const s = await Q(e);
|
|
2064
2228
|
if (!s.sourceLanguage)
|
|
2065
2229
|
throw new Error('The xcstrings file is missing "sourceLanguage".');
|
|
2066
2230
|
const c = s.sourceLanguage;
|
|
2067
2231
|
s.strings || (s.strings = {});
|
|
2068
|
-
const
|
|
2232
|
+
const u = (await sn(t))?.missingLanguagePolicy || "skip";
|
|
2069
2233
|
let h;
|
|
2070
|
-
const g = async (
|
|
2071
|
-
X.warn(
|
|
2234
|
+
const g = async (O) => u === "include" ? !0 : (h || (h = await jr(e, t)), h.includes(O)), m = (O) => {
|
|
2235
|
+
X.warn(
|
|
2236
|
+
`Language "${O}" is not supported. Skipped adding its translation (missingLanguagePolicy=skip).`
|
|
2237
|
+
);
|
|
2072
2238
|
}, d = {
|
|
2073
2239
|
...s.strings[n],
|
|
2074
2240
|
extractionState: "manual"
|
|
2075
2241
|
};
|
|
2076
2242
|
r && (d.comment = r);
|
|
2077
|
-
const
|
|
2078
|
-
if (
|
|
2079
|
-
return typeof
|
|
2243
|
+
const w = a ?? "translated", k = (O) => {
|
|
2244
|
+
if (O !== void 0)
|
|
2245
|
+
return typeof O == "string" ? { value: O } : O;
|
|
2080
2246
|
};
|
|
2081
2247
|
if (o !== void 0) {
|
|
2082
|
-
const
|
|
2083
|
-
if (!await g(
|
|
2084
|
-
|
|
2248
|
+
const O = l ?? c;
|
|
2249
|
+
if (!await g(O))
|
|
2250
|
+
m(O);
|
|
2085
2251
|
else {
|
|
2086
2252
|
d.localizations = d.localizations || {};
|
|
2087
|
-
const L =
|
|
2088
|
-
d.localizations[
|
|
2253
|
+
const L = k(i?.[O]);
|
|
2254
|
+
d.localizations[O] = {
|
|
2089
2255
|
stringUnit: {
|
|
2090
|
-
state: L?.state ??
|
|
2256
|
+
state: L?.state ?? w,
|
|
2091
2257
|
value: o
|
|
2092
2258
|
}
|
|
2093
2259
|
};
|
|
2094
2260
|
}
|
|
2095
2261
|
}
|
|
2096
|
-
const
|
|
2097
|
-
if (
|
|
2098
|
-
const
|
|
2099
|
-
for (const [L,
|
|
2262
|
+
const v = i ? { ...i } : void 0;
|
|
2263
|
+
if (v) {
|
|
2264
|
+
const O = [];
|
|
2265
|
+
for (const [L, P] of Object.entries(v)) {
|
|
2100
2266
|
if (o !== void 0 && L === (l ?? c))
|
|
2101
2267
|
continue;
|
|
2102
|
-
if (
|
|
2103
|
-
const I =
|
|
2104
|
-
I &&
|
|
2268
|
+
if (u === "include" ? !0 : L === c || await g(L)) {
|
|
2269
|
+
const I = k(P);
|
|
2270
|
+
I && O.push([L, I]);
|
|
2105
2271
|
} else
|
|
2106
|
-
|
|
2272
|
+
m(L);
|
|
2107
2273
|
}
|
|
2108
|
-
if (
|
|
2274
|
+
if (O.length > 0) {
|
|
2109
2275
|
d.localizations = d.localizations || {};
|
|
2110
|
-
for (const [L,
|
|
2276
|
+
for (const [L, P] of O)
|
|
2111
2277
|
d.localizations[L] = {
|
|
2112
2278
|
stringUnit: {
|
|
2113
|
-
state:
|
|
2114
|
-
value:
|
|
2279
|
+
state: P.state ?? w,
|
|
2280
|
+
value: P.value
|
|
2115
2281
|
}
|
|
2116
2282
|
};
|
|
2117
2283
|
}
|
|
2118
2284
|
}
|
|
2119
|
-
s.strings[n] = d, d.localizations && (d.localizations =
|
|
2285
|
+
s.strings[n] = d, d.localizations && (d.localizations = $o(d.localizations)), await cn(e, s);
|
|
2120
2286
|
}
|
|
2121
|
-
function
|
|
2287
|
+
function Bo() {
|
|
2122
2288
|
return {
|
|
2123
2289
|
command: "remove",
|
|
2124
2290
|
describe: "Remove a string",
|
|
@@ -2139,10 +2305,12 @@ function _o() {
|
|
|
2139
2305
|
}).check((n) => {
|
|
2140
2306
|
if (n.key || n.languages && n.languages.length > 0)
|
|
2141
2307
|
return !0;
|
|
2142
|
-
throw new Error(
|
|
2308
|
+
throw new Error(
|
|
2309
|
+
"Either --key or --languages must be provided"
|
|
2310
|
+
);
|
|
2143
2311
|
}),
|
|
2144
2312
|
handler: async (e) => {
|
|
2145
|
-
const n = await
|
|
2313
|
+
const n = await Ho(
|
|
2146
2314
|
e.path,
|
|
2147
2315
|
e.key,
|
|
2148
2316
|
e.languages,
|
|
@@ -2159,50 +2327,50 @@ ${r}`));
|
|
|
2159
2327
|
}
|
|
2160
2328
|
};
|
|
2161
2329
|
}
|
|
2162
|
-
function
|
|
2330
|
+
function Yo(e, n, r, i, t) {
|
|
2163
2331
|
if (e.localizations) {
|
|
2164
2332
|
for (const o of n)
|
|
2165
2333
|
e.localizations[o] && (t[i] ??= [], t[i].push(o), r || delete e.localizations[o]);
|
|
2166
2334
|
!r && e.localizations && Object.keys(e.localizations).length === 0 && delete e.localizations;
|
|
2167
2335
|
}
|
|
2168
2336
|
}
|
|
2169
|
-
async function
|
|
2170
|
-
const t = await
|
|
2337
|
+
async function Ho(e, n, r, i = !1) {
|
|
2338
|
+
const t = await Q(e), o = {}, l = t.strings || {};
|
|
2171
2339
|
t.strings = l;
|
|
2172
2340
|
const a = n ? [n] : Object.keys(l);
|
|
2173
2341
|
let s = !1;
|
|
2174
2342
|
for (const c of a) {
|
|
2175
|
-
const
|
|
2176
|
-
if (!
|
|
2343
|
+
const f = l[c];
|
|
2344
|
+
if (!f)
|
|
2177
2345
|
continue;
|
|
2178
2346
|
if (!r || r.length === 0) {
|
|
2179
|
-
const g = Object.keys(
|
|
2347
|
+
const g = Object.keys(f.localizations ?? {});
|
|
2180
2348
|
o[c] = g, i || delete l[c], s = !0;
|
|
2181
2349
|
continue;
|
|
2182
2350
|
}
|
|
2183
|
-
|
|
2184
|
-
const
|
|
2185
|
-
!(
|
|
2351
|
+
Yo(f, r, i, c, o);
|
|
2352
|
+
const u = o[c]?.length ?? 0;
|
|
2353
|
+
!(f.localizations && Object.keys(f.localizations).length > 0) && u > 0 && (i || delete l[c]), u > 0 && (s = !0);
|
|
2186
2354
|
}
|
|
2187
|
-
return !i && s && await
|
|
2355
|
+
return !i && s && await cn(e, t), o;
|
|
2188
2356
|
}
|
|
2189
|
-
const
|
|
2190
|
-
function
|
|
2357
|
+
const Ue = "xcstrings-cli.yaml";
|
|
2358
|
+
function Ko() {
|
|
2191
2359
|
return {
|
|
2192
2360
|
command: "init",
|
|
2193
2361
|
describe: "Initialize configuration file",
|
|
2194
2362
|
handler: async () => {
|
|
2195
|
-
await
|
|
2363
|
+
await Go();
|
|
2196
2364
|
}
|
|
2197
2365
|
};
|
|
2198
2366
|
}
|
|
2199
|
-
async function
|
|
2367
|
+
async function Wo(e) {
|
|
2200
2368
|
const n = [];
|
|
2201
2369
|
async function r(i) {
|
|
2202
2370
|
try {
|
|
2203
|
-
const t = await
|
|
2371
|
+
const t = await en(i, { withFileTypes: !0 });
|
|
2204
2372
|
for (const o of t) {
|
|
2205
|
-
const l =
|
|
2373
|
+
const l = Ne(i, o.name);
|
|
2206
2374
|
o.isDirectory() ? !o.name.startsWith(".") && o.name !== "node_modules" && await r(l) : o.name.endsWith(".xcstrings") && n.push(l);
|
|
2207
2375
|
}
|
|
2208
2376
|
} catch {
|
|
@@ -2210,104 +2378,120 @@ async function Lo(e) {
|
|
|
2210
2378
|
}
|
|
2211
2379
|
return await r(e), n;
|
|
2212
2380
|
}
|
|
2213
|
-
async function
|
|
2381
|
+
async function qo(e) {
|
|
2214
2382
|
const n = [];
|
|
2215
2383
|
let r = e;
|
|
2216
2384
|
try {
|
|
2217
|
-
const i = await
|
|
2385
|
+
const i = await en(r, { withFileTypes: !0 });
|
|
2218
2386
|
for (const t of i)
|
|
2219
|
-
t.isDirectory() && t.name.endsWith(".xcodeproj") && n.push(
|
|
2387
|
+
t.isDirectory() && t.name.endsWith(".xcodeproj") && n.push(Ne(r, t.name));
|
|
2220
2388
|
} catch {
|
|
2221
2389
|
}
|
|
2222
2390
|
return n;
|
|
2223
2391
|
}
|
|
2224
|
-
async function
|
|
2392
|
+
async function Go() {
|
|
2225
2393
|
const e = process.cwd();
|
|
2226
2394
|
console.log(), console.log(S.bold.cyan("🚀 xcstrings-cli Configuration Setup")), console.log(S.dim("─".repeat(40))), console.log(), console.log(S.yellow("🔍 Searching for .xcstrings files..."));
|
|
2227
|
-
const n = await
|
|
2395
|
+
const n = await Wo(e);
|
|
2228
2396
|
console.log(S.yellow("🔍 Searching for .xcodeproj directories..."));
|
|
2229
|
-
const r = await
|
|
2397
|
+
const r = await qo(e);
|
|
2230
2398
|
console.log();
|
|
2231
2399
|
let i = [];
|
|
2232
2400
|
if (n.length > 0) {
|
|
2233
|
-
console.log(
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2401
|
+
console.log(
|
|
2402
|
+
S.green(`✓ Found ${n.length} .xcstrings file(s)`)
|
|
2403
|
+
), console.log();
|
|
2404
|
+
const c = n.map((f) => ({
|
|
2405
|
+
name: S.white(ke(e, f)) + S.dim(` (${f})`),
|
|
2406
|
+
value: ke(e, f),
|
|
2237
2407
|
checked: !0
|
|
2238
2408
|
}));
|
|
2239
|
-
i = await
|
|
2409
|
+
i = await vn({
|
|
2240
2410
|
message: S.bold("Select .xcstrings files to manage:"),
|
|
2241
2411
|
choices: c
|
|
2242
2412
|
});
|
|
2243
2413
|
} else
|
|
2244
|
-
console.log(
|
|
2414
|
+
console.log(
|
|
2415
|
+
S.dim(" No .xcstrings files found in current directory")
|
|
2416
|
+
);
|
|
2245
2417
|
console.log();
|
|
2246
2418
|
let t = [];
|
|
2247
2419
|
if (r.length > 0) {
|
|
2248
|
-
console.log(
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2420
|
+
console.log(
|
|
2421
|
+
S.green(
|
|
2422
|
+
`✓ Found ${r.length} .xcodeproj director${r.length === 1 ? "y" : "ies"}`
|
|
2423
|
+
)
|
|
2424
|
+
), console.log();
|
|
2425
|
+
const c = r.map((f) => ({
|
|
2426
|
+
name: S.white(ke(e, f) || f) + S.dim(` (${f})`),
|
|
2427
|
+
value: ke(e, f) || f,
|
|
2252
2428
|
checked: !0
|
|
2253
2429
|
}));
|
|
2254
|
-
t = await
|
|
2255
|
-
message: S.bold(
|
|
2430
|
+
t = await vn({
|
|
2431
|
+
message: S.bold(
|
|
2432
|
+
"Select .xcodeproj directories for language detection:"
|
|
2433
|
+
),
|
|
2256
2434
|
choices: c
|
|
2257
2435
|
});
|
|
2258
2436
|
} else
|
|
2259
2437
|
console.log(S.dim(" No .xcodeproj directories found"));
|
|
2260
|
-
if (console.log(), console.log(S.dim("─".repeat(40))), console.log(), console.log(S.bold("📋 Configuration Summary:")), console.log(), console.log(S.cyan(" xcstringsPaths:")), i.length > 0 ? i.forEach(
|
|
2261
|
-
|
|
2438
|
+
if (console.log(), console.log(S.dim("─".repeat(40))), console.log(), console.log(S.bold("📋 Configuration Summary:")), console.log(), console.log(S.cyan(" xcstringsPaths:")), i.length > 0 ? i.forEach(
|
|
2439
|
+
(c) => console.log(S.white(` • ${c}`))
|
|
2440
|
+
) : console.log(S.dim(" (none)")), console.log(), console.log(S.cyan(" xcodeprojPaths:")), t.length > 0 ? t.forEach(
|
|
2441
|
+
(c) => console.log(S.white(` • ${c}`))
|
|
2442
|
+
) : console.log(S.dim(" (none)")), console.log(), !await Qr({
|
|
2443
|
+
message: S.bold(`Create ${S.yellow(Ue)}?`),
|
|
2262
2444
|
default: !0
|
|
2263
2445
|
})) {
|
|
2264
2446
|
console.log(S.dim(" Configuration cancelled."));
|
|
2265
2447
|
return;
|
|
2266
2448
|
}
|
|
2267
|
-
const l = i.
|
|
2268
|
-
`
|
|
2269
|
-
`),
|
|
2270
|
-
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
missingLanguagePolicy: "skip",
|
|
2280
|
-
}
|
|
2449
|
+
const l = i.length > 0 ? `
|
|
2450
|
+
` + i.map((c) => ` - "${c}"`).join(`
|
|
2451
|
+
`) : " []", a = t.length > 0 ? `
|
|
2452
|
+
` + t.map((c) => ` - "${c}"`).join(`
|
|
2453
|
+
`) : " []", s = `# Behavior for handling missing languages when adding strings.
|
|
2454
|
+
missingLanguagePolicy: "skip"
|
|
2455
|
+
|
|
2456
|
+
# Paths to .xcstrings files to manage. Specify relative or absolute paths.
|
|
2457
|
+
xcstringsPaths:${l}
|
|
2458
|
+
|
|
2459
|
+
# Paths to .xcodeproj directories. Used for discovering supported languages.
|
|
2460
|
+
xcodeprojPaths:${a}
|
|
2281
2461
|
`;
|
|
2282
|
-
await
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
|
|
2462
|
+
await Ze(Ue, s, "utf-8"), console.log(), console.log(S.bold.green(`✓ Created ${Ue}`)), console.log(
|
|
2463
|
+
S.dim(
|
|
2464
|
+
` Run ${S.cyan("xcstrings --help")} to see available commands.`
|
|
2465
|
+
)
|
|
2466
|
+
), console.log();
|
|
2467
|
+
}
|
|
2468
|
+
var Vo = Object.prototype.toString, ue = Array.isArray || function(n) {
|
|
2469
|
+
return Vo.call(n) === "[object Array]";
|
|
2286
2470
|
};
|
|
2287
|
-
function
|
|
2471
|
+
function un(e) {
|
|
2288
2472
|
return typeof e == "function";
|
|
2289
2473
|
}
|
|
2290
|
-
function
|
|
2291
|
-
return
|
|
2474
|
+
function Xo(e) {
|
|
2475
|
+
return ue(e) ? "array" : typeof e;
|
|
2292
2476
|
}
|
|
2293
|
-
function
|
|
2477
|
+
function Be(e) {
|
|
2294
2478
|
return e.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&");
|
|
2295
2479
|
}
|
|
2296
|
-
function
|
|
2480
|
+
function zn(e, n) {
|
|
2297
2481
|
return e != null && typeof e == "object" && n in e;
|
|
2298
2482
|
}
|
|
2299
|
-
function
|
|
2483
|
+
function Jo(e, n) {
|
|
2300
2484
|
return e != null && typeof e != "object" && e.hasOwnProperty && e.hasOwnProperty(n);
|
|
2301
2485
|
}
|
|
2302
|
-
var
|
|
2303
|
-
function
|
|
2304
|
-
return
|
|
2486
|
+
var Qo = RegExp.prototype.test;
|
|
2487
|
+
function Zo(e, n) {
|
|
2488
|
+
return Qo.call(e, n);
|
|
2305
2489
|
}
|
|
2306
|
-
var
|
|
2307
|
-
function
|
|
2308
|
-
return !
|
|
2490
|
+
var el = /\S/;
|
|
2491
|
+
function nl(e) {
|
|
2492
|
+
return !Zo(el, e);
|
|
2309
2493
|
}
|
|
2310
|
-
var
|
|
2494
|
+
var rl = {
|
|
2311
2495
|
"&": "&",
|
|
2312
2496
|
"<": "<",
|
|
2313
2497
|
">": ">",
|
|
@@ -2317,17 +2501,17 @@ var Bo = {
|
|
|
2317
2501
|
"`": "`",
|
|
2318
2502
|
"=": "="
|
|
2319
2503
|
};
|
|
2320
|
-
function
|
|
2504
|
+
function il(e) {
|
|
2321
2505
|
return String(e).replace(/[&<>"'`=\/]/g, function(r) {
|
|
2322
|
-
return
|
|
2506
|
+
return rl[r];
|
|
2323
2507
|
});
|
|
2324
2508
|
}
|
|
2325
|
-
var
|
|
2326
|
-
function
|
|
2509
|
+
var tl = /\s*/, ol = /\s+/, $n = /\s*=/, ll = /\s*\}/, al = /#|\^|\/|>|\{|&|=|!/;
|
|
2510
|
+
function sl(e, n) {
|
|
2327
2511
|
if (!e)
|
|
2328
2512
|
return [];
|
|
2329
2513
|
var r = !1, i = [], t = [], o = [], l = !1, a = !1, s = "", c = 0;
|
|
2330
|
-
function
|
|
2514
|
+
function f() {
|
|
2331
2515
|
if (l && !a)
|
|
2332
2516
|
for (; o.length; )
|
|
2333
2517
|
delete t[o.pop()];
|
|
@@ -2335,41 +2519,41 @@ function qo(e, n) {
|
|
|
2335
2519
|
o = [];
|
|
2336
2520
|
l = !1, a = !1;
|
|
2337
2521
|
}
|
|
2338
|
-
var
|
|
2339
|
-
function
|
|
2340
|
-
if (typeof I == "string" && (I = I.split(
|
|
2522
|
+
var u, h, g;
|
|
2523
|
+
function m(I) {
|
|
2524
|
+
if (typeof I == "string" && (I = I.split(ol, 2)), !ue(I) || I.length !== 2)
|
|
2341
2525
|
throw new Error("Invalid tags: " + I);
|
|
2342
|
-
|
|
2343
|
-
}
|
|
2344
|
-
|
|
2345
|
-
for (var d = new
|
|
2346
|
-
if (
|
|
2347
|
-
for (var
|
|
2348
|
-
|
|
2349
|
-
` && (
|
|
2350
|
-
if (!d.scan(
|
|
2526
|
+
u = new RegExp(Be(I[0]) + "\\s*"), h = new RegExp("\\s*" + Be(I[1])), g = new RegExp("\\s*" + Be("}" + I[1]));
|
|
2527
|
+
}
|
|
2528
|
+
m(n || D.tags);
|
|
2529
|
+
for (var d = new we(e), w, k, v, O, L, P; !d.eos(); ) {
|
|
2530
|
+
if (w = d.pos, v = d.scanUntil(u), v)
|
|
2531
|
+
for (var Z = 0, V = v.length; Z < V; ++Z)
|
|
2532
|
+
O = v.charAt(Z), nl(O) ? (o.push(t.length), s += O) : (a = !0, r = !0, s += " "), t.push(["text", O, w, w + 1]), w += 1, O === `
|
|
2533
|
+
` && (f(), s = "", c = 0, r = !1);
|
|
2534
|
+
if (!d.scan(u))
|
|
2351
2535
|
break;
|
|
2352
|
-
if (l = !0,
|
|
2536
|
+
if (l = !0, k = d.scan(al) || "name", d.scan(tl), k === "=" ? (v = d.scanUntil($n), d.scan($n), d.scanUntil(h)) : k === "{" ? (v = d.scanUntil(g), d.scan(ll), d.scanUntil(h), k = "&") : v = d.scanUntil(h), !d.scan(h))
|
|
2353
2537
|
throw new Error("Unclosed tag at " + d.pos);
|
|
2354
|
-
if (
|
|
2538
|
+
if (k == ">" ? L = [k, v, w, d.pos, s, c, r] : L = [k, v, w, d.pos], c++, t.push(L), k === "#" || k === "^")
|
|
2355
2539
|
i.push(L);
|
|
2356
|
-
else if (
|
|
2357
|
-
if (
|
|
2358
|
-
throw new Error('Unopened section "' +
|
|
2359
|
-
if (
|
|
2360
|
-
throw new Error('Unclosed section "' +
|
|
2361
|
-
} else
|
|
2362
|
-
}
|
|
2363
|
-
if (
|
|
2364
|
-
throw new Error('Unclosed section "' +
|
|
2365
|
-
return
|
|
2366
|
-
}
|
|
2367
|
-
function
|
|
2540
|
+
else if (k === "/") {
|
|
2541
|
+
if (P = i.pop(), !P)
|
|
2542
|
+
throw new Error('Unopened section "' + v + '" at ' + w);
|
|
2543
|
+
if (P[1] !== v)
|
|
2544
|
+
throw new Error('Unclosed section "' + P[1] + '" at ' + w);
|
|
2545
|
+
} else k === "name" || k === "{" || k === "&" ? a = !0 : k === "=" && m(v);
|
|
2546
|
+
}
|
|
2547
|
+
if (f(), P = i.pop(), P)
|
|
2548
|
+
throw new Error('Unclosed section "' + P[1] + '" at ' + d.pos);
|
|
2549
|
+
return ul(cl(t));
|
|
2550
|
+
}
|
|
2551
|
+
function cl(e) {
|
|
2368
2552
|
for (var n = [], r, i, t = 0, o = e.length; t < o; ++t)
|
|
2369
2553
|
r = e[t], r && (r[0] === "text" && i && i[0] === "text" ? (i[1] += r[1], i[3] = r[3]) : (n.push(r), i = r));
|
|
2370
2554
|
return n;
|
|
2371
2555
|
}
|
|
2372
|
-
function
|
|
2556
|
+
function ul(e) {
|
|
2373
2557
|
for (var n = [], r = n, i = [], t, o, l = 0, a = e.length; l < a; ++l)
|
|
2374
2558
|
switch (t = e[l], t[0]) {
|
|
2375
2559
|
case "#":
|
|
@@ -2384,20 +2568,20 @@ function Vo(e) {
|
|
|
2384
2568
|
}
|
|
2385
2569
|
return n;
|
|
2386
2570
|
}
|
|
2387
|
-
function
|
|
2571
|
+
function we(e) {
|
|
2388
2572
|
this.string = e, this.tail = e, this.pos = 0;
|
|
2389
2573
|
}
|
|
2390
|
-
|
|
2574
|
+
we.prototype.eos = function() {
|
|
2391
2575
|
return this.tail === "";
|
|
2392
2576
|
};
|
|
2393
|
-
|
|
2577
|
+
we.prototype.scan = function(n) {
|
|
2394
2578
|
var r = this.tail.match(n);
|
|
2395
2579
|
if (!r || r.index !== 0)
|
|
2396
2580
|
return "";
|
|
2397
2581
|
var i = r[0];
|
|
2398
2582
|
return this.tail = this.tail.substring(i.length), this.pos += i.length, i;
|
|
2399
2583
|
};
|
|
2400
|
-
|
|
2584
|
+
we.prototype.scanUntil = function(n) {
|
|
2401
2585
|
var r = this.tail.search(n), i;
|
|
2402
2586
|
switch (r) {
|
|
2403
2587
|
case -1:
|
|
@@ -2411,13 +2595,13 @@ ye.prototype.scanUntil = function(n) {
|
|
|
2411
2595
|
}
|
|
2412
2596
|
return this.pos += i.length, i;
|
|
2413
2597
|
};
|
|
2414
|
-
function
|
|
2598
|
+
function ce(e, n) {
|
|
2415
2599
|
this.view = e, this.cache = { ".": this.view }, this.parent = n;
|
|
2416
2600
|
}
|
|
2417
|
-
|
|
2418
|
-
return new
|
|
2601
|
+
ce.prototype.push = function(n) {
|
|
2602
|
+
return new ce(n, this);
|
|
2419
2603
|
};
|
|
2420
|
-
|
|
2604
|
+
ce.prototype.lookup = function(n) {
|
|
2421
2605
|
var r = this.cache, i;
|
|
2422
2606
|
if (r.hasOwnProperty(n))
|
|
2423
2607
|
i = r[n];
|
|
@@ -2425,9 +2609,9 @@ le.prototype.lookup = function(n) {
|
|
|
2425
2609
|
for (var t = this, o, l, a, s = !1; t; ) {
|
|
2426
2610
|
if (n.indexOf(".") > 0)
|
|
2427
2611
|
for (o = t.view, l = n.split("."), a = 0; o != null && a < l.length; )
|
|
2428
|
-
a === l.length - 1 && (s =
|
|
2612
|
+
a === l.length - 1 && (s = zn(o, l[a]) || Jo(o, l[a])), o = o[l[a++]];
|
|
2429
2613
|
else
|
|
2430
|
-
o = t.view[n], s =
|
|
2614
|
+
o = t.view[n], s = zn(t.view, n);
|
|
2431
2615
|
if (s) {
|
|
2432
2616
|
i = o;
|
|
2433
2617
|
break;
|
|
@@ -2436,9 +2620,9 @@ le.prototype.lookup = function(n) {
|
|
|
2436
2620
|
}
|
|
2437
2621
|
r[n] = i;
|
|
2438
2622
|
}
|
|
2439
|
-
return
|
|
2623
|
+
return un(i) && (i = i.call(this.view)), i;
|
|
2440
2624
|
};
|
|
2441
|
-
function
|
|
2625
|
+
function z() {
|
|
2442
2626
|
this.templateCache = {
|
|
2443
2627
|
_cache: {},
|
|
2444
2628
|
set: function(n, r) {
|
|
@@ -2452,34 +2636,34 @@ function $() {
|
|
|
2452
2636
|
}
|
|
2453
2637
|
};
|
|
2454
2638
|
}
|
|
2455
|
-
|
|
2639
|
+
z.prototype.clearCache = function() {
|
|
2456
2640
|
typeof this.templateCache < "u" && this.templateCache.clear();
|
|
2457
2641
|
};
|
|
2458
|
-
|
|
2642
|
+
z.prototype.parse = function(n, r) {
|
|
2459
2643
|
var i = this.templateCache, t = n + ":" + (r || D.tags).join(":"), o = typeof i < "u", l = o ? i.get(t) : void 0;
|
|
2460
|
-
return l == null && (l =
|
|
2644
|
+
return l == null && (l = sl(n, r), o && i.set(t, l)), l;
|
|
2461
2645
|
};
|
|
2462
|
-
|
|
2463
|
-
var o = this.getConfigTags(t), l = this.parse(n, o), a = r instanceof
|
|
2646
|
+
z.prototype.render = function(n, r, i, t) {
|
|
2647
|
+
var o = this.getConfigTags(t), l = this.parse(n, o), a = r instanceof ce ? r : new ce(r, void 0);
|
|
2464
2648
|
return this.renderTokens(l, a, i, n, t);
|
|
2465
2649
|
};
|
|
2466
|
-
|
|
2467
|
-
for (var l = "", a, s, c,
|
|
2468
|
-
c = void 0, a = n[
|
|
2650
|
+
z.prototype.renderTokens = function(n, r, i, t, o) {
|
|
2651
|
+
for (var l = "", a, s, c, f = 0, u = n.length; f < u; ++f)
|
|
2652
|
+
c = void 0, a = n[f], s = a[0], s === "#" ? c = this.renderSection(a, r, i, t, o) : s === "^" ? c = this.renderInverted(a, r, i, t, o) : s === ">" ? c = this.renderPartial(a, r, i, o) : s === "&" ? c = this.unescapedValue(a, r) : s === "name" ? c = this.escapedValue(a, r, o) : s === "text" && (c = this.rawValue(a)), c !== void 0 && (l += c);
|
|
2469
2653
|
return l;
|
|
2470
2654
|
};
|
|
2471
|
-
|
|
2655
|
+
z.prototype.renderSection = function(n, r, i, t, o) {
|
|
2472
2656
|
var l = this, a = "", s = r.lookup(n[1]);
|
|
2473
2657
|
function c(h) {
|
|
2474
2658
|
return l.render(h, r, i, o);
|
|
2475
2659
|
}
|
|
2476
2660
|
if (s) {
|
|
2477
|
-
if (
|
|
2478
|
-
for (var
|
|
2479
|
-
a += this.renderTokens(n[4], r.push(s[
|
|
2661
|
+
if (ue(s))
|
|
2662
|
+
for (var f = 0, u = s.length; f < u; ++f)
|
|
2663
|
+
a += this.renderTokens(n[4], r.push(s[f]), i, t, o);
|
|
2480
2664
|
else if (typeof s == "object" || typeof s == "string" || typeof s == "number")
|
|
2481
2665
|
a += this.renderTokens(n[4], r.push(s), i, t, o);
|
|
2482
|
-
else if (
|
|
2666
|
+
else if (un(s)) {
|
|
2483
2667
|
if (typeof t != "string")
|
|
2484
2668
|
throw new Error("Cannot use higher-order sections without the original template");
|
|
2485
2669
|
s = s.call(r.view, t.slice(n[3], n[5]), c), s != null && (a += s);
|
|
@@ -2488,47 +2672,47 @@ $.prototype.renderSection = function(n, r, i, t, o) {
|
|
|
2488
2672
|
return a;
|
|
2489
2673
|
}
|
|
2490
2674
|
};
|
|
2491
|
-
|
|
2675
|
+
z.prototype.renderInverted = function(n, r, i, t, o) {
|
|
2492
2676
|
var l = r.lookup(n[1]);
|
|
2493
|
-
if (!l ||
|
|
2677
|
+
if (!l || ue(l) && l.length === 0)
|
|
2494
2678
|
return this.renderTokens(n[4], r, i, t, o);
|
|
2495
2679
|
};
|
|
2496
|
-
|
|
2680
|
+
z.prototype.indentPartial = function(n, r, i) {
|
|
2497
2681
|
for (var t = r.replace(/[^ \t]/g, ""), o = n.split(`
|
|
2498
2682
|
`), l = 0; l < o.length; l++)
|
|
2499
2683
|
o[l].length && (l > 0 || !i) && (o[l] = t + o[l]);
|
|
2500
2684
|
return o.join(`
|
|
2501
2685
|
`);
|
|
2502
2686
|
};
|
|
2503
|
-
|
|
2687
|
+
z.prototype.renderPartial = function(n, r, i, t) {
|
|
2504
2688
|
if (i) {
|
|
2505
|
-
var o = this.getConfigTags(t), l =
|
|
2689
|
+
var o = this.getConfigTags(t), l = un(i) ? i(n[1]) : i[n[1]];
|
|
2506
2690
|
if (l != null) {
|
|
2507
|
-
var a = n[6], s = n[5], c = n[4],
|
|
2508
|
-
s == 0 && c && (
|
|
2509
|
-
var
|
|
2510
|
-
return this.renderTokens(
|
|
2691
|
+
var a = n[6], s = n[5], c = n[4], f = l;
|
|
2692
|
+
s == 0 && c && (f = this.indentPartial(l, c, a));
|
|
2693
|
+
var u = this.parse(f, o);
|
|
2694
|
+
return this.renderTokens(u, r, i, f, t);
|
|
2511
2695
|
}
|
|
2512
2696
|
}
|
|
2513
2697
|
};
|
|
2514
|
-
|
|
2698
|
+
z.prototype.unescapedValue = function(n, r) {
|
|
2515
2699
|
var i = r.lookup(n[1]);
|
|
2516
2700
|
if (i != null)
|
|
2517
2701
|
return i;
|
|
2518
2702
|
};
|
|
2519
|
-
|
|
2703
|
+
z.prototype.escapedValue = function(n, r, i) {
|
|
2520
2704
|
var t = this.getConfigEscape(i) || D.escape, o = r.lookup(n[1]);
|
|
2521
2705
|
if (o != null)
|
|
2522
2706
|
return typeof o == "number" && t === D.escape ? String(o) : t(o);
|
|
2523
2707
|
};
|
|
2524
|
-
|
|
2708
|
+
z.prototype.rawValue = function(n) {
|
|
2525
2709
|
return n[1];
|
|
2526
2710
|
};
|
|
2527
|
-
|
|
2528
|
-
return
|
|
2711
|
+
z.prototype.getConfigTags = function(n) {
|
|
2712
|
+
return ue(n) ? n : n && typeof n == "object" ? n.tags : void 0;
|
|
2529
2713
|
};
|
|
2530
|
-
|
|
2531
|
-
if (n && typeof n == "object" && !
|
|
2714
|
+
z.prototype.getConfigEscape = function(n) {
|
|
2715
|
+
if (n && typeof n == "object" && !ue(n))
|
|
2532
2716
|
return n.escape;
|
|
2533
2717
|
};
|
|
2534
2718
|
var D = {
|
|
@@ -2548,31 +2732,31 @@ var D = {
|
|
|
2548
2732
|
* the cache by setting it to the literal `undefined`.
|
|
2549
2733
|
*/
|
|
2550
2734
|
set templateCache(e) {
|
|
2551
|
-
|
|
2735
|
+
xe.templateCache = e;
|
|
2552
2736
|
},
|
|
2553
2737
|
/**
|
|
2554
2738
|
* Gets the default or overridden caching object from the default writer.
|
|
2555
2739
|
*/
|
|
2556
2740
|
get templateCache() {
|
|
2557
|
-
return
|
|
2741
|
+
return xe.templateCache;
|
|
2558
2742
|
}
|
|
2559
|
-
},
|
|
2743
|
+
}, xe = new z();
|
|
2560
2744
|
D.clearCache = function() {
|
|
2561
|
-
return
|
|
2745
|
+
return xe.clearCache();
|
|
2562
2746
|
};
|
|
2563
2747
|
D.parse = function(n, r) {
|
|
2564
|
-
return
|
|
2748
|
+
return xe.parse(n, r);
|
|
2565
2749
|
};
|
|
2566
2750
|
D.render = function(n, r, i, t) {
|
|
2567
2751
|
if (typeof n != "string")
|
|
2568
|
-
throw new TypeError('Invalid template! Template should be a "string" but "' +
|
|
2569
|
-
return
|
|
2752
|
+
throw new TypeError('Invalid template! Template should be a "string" but "' + Xo(n) + '" was given as the first argument for mustache#render(template, view, partials)');
|
|
2753
|
+
return xe.render(n, r, i, t);
|
|
2570
2754
|
};
|
|
2571
|
-
D.escape =
|
|
2572
|
-
D.Scanner =
|
|
2573
|
-
D.Context =
|
|
2574
|
-
D.Writer =
|
|
2575
|
-
function
|
|
2755
|
+
D.escape = il;
|
|
2756
|
+
D.Scanner = we;
|
|
2757
|
+
D.Context = ce;
|
|
2758
|
+
D.Writer = z;
|
|
2759
|
+
function Un(e, {
|
|
2576
2760
|
glob: n,
|
|
2577
2761
|
regex: r,
|
|
2578
2762
|
substring: i
|
|
@@ -2580,39 +2764,94 @@ function Ln(e, {
|
|
|
2580
2764
|
const t = [n, r, i].filter((o) => o !== void 0);
|
|
2581
2765
|
if (t.length !== 0) {
|
|
2582
2766
|
if (t.length > 1)
|
|
2583
|
-
throw new Error(
|
|
2767
|
+
throw new Error(
|
|
2768
|
+
`Specify only one of --${e}, --${e}-glob, --${e}-regex, --${e}-substring`
|
|
2769
|
+
);
|
|
2584
2770
|
return r !== void 0 ? { pattern: r, mode: "regex" } : i !== void 0 ? { pattern: i, mode: "substring" } : { pattern: n, mode: "glob" };
|
|
2585
2771
|
}
|
|
2586
2772
|
}
|
|
2587
|
-
function
|
|
2773
|
+
function fl(e) {
|
|
2774
|
+
const n = e.replace(/[.+^${}()|\\]/g, "\\$&").replace(/\*/g, ".*").replace(/\?/g, ".");
|
|
2775
|
+
return new RegExp(`^${n}$`);
|
|
2776
|
+
}
|
|
2777
|
+
function le(e) {
|
|
2778
|
+
if (!e) return () => !0;
|
|
2779
|
+
if (e.mode === "regex") {
|
|
2780
|
+
const r = new RegExp(e.pattern);
|
|
2781
|
+
return (i) => r.test(i);
|
|
2782
|
+
}
|
|
2783
|
+
if (e.mode === "substring") {
|
|
2784
|
+
const r = e.pattern;
|
|
2785
|
+
return (i) => i.includes(r);
|
|
2786
|
+
}
|
|
2787
|
+
const n = fl(e.pattern);
|
|
2788
|
+
return (r) => n.test(r);
|
|
2789
|
+
}
|
|
2790
|
+
function Mr(e) {
|
|
2791
|
+
return e.option("key", {
|
|
2792
|
+
type: "string",
|
|
2793
|
+
describe: "Filter keys by glob (default)"
|
|
2794
|
+
}).option("key-glob", {
|
|
2795
|
+
type: "string",
|
|
2796
|
+
describe: "Filter keys by glob (explicit)"
|
|
2797
|
+
}).option("key-regex", {
|
|
2798
|
+
type: "string",
|
|
2799
|
+
describe: "Filter keys by regex"
|
|
2800
|
+
}).option("key-substring", {
|
|
2801
|
+
type: "string",
|
|
2802
|
+
describe: "Filter keys by substring match"
|
|
2803
|
+
}).option("text", {
|
|
2804
|
+
type: "string",
|
|
2805
|
+
describe: "Filter translations by glob (default)"
|
|
2806
|
+
}).option("text-glob", {
|
|
2807
|
+
type: "string",
|
|
2808
|
+
describe: "Filter translations by glob (explicit)"
|
|
2809
|
+
}).option("text-regex", {
|
|
2810
|
+
type: "string",
|
|
2811
|
+
describe: "Filter translations by regex"
|
|
2812
|
+
}).option("text-substring", {
|
|
2813
|
+
type: "string",
|
|
2814
|
+
describe: "Filter translations by substring match"
|
|
2815
|
+
});
|
|
2816
|
+
}
|
|
2817
|
+
function Dr(e) {
|
|
2818
|
+
const n = [e.key, e["key-glob"]].filter(
|
|
2819
|
+
(a) => a !== void 0
|
|
2820
|
+
).length, r = e["key-regex"] ? 1 : 0, i = e["key-substring"] ? 1 : 0;
|
|
2821
|
+
if (n + r + i > 1)
|
|
2822
|
+
throw new Error(
|
|
2823
|
+
"Specify only one of --key/--key-glob, --key-regex, or --key-substring"
|
|
2824
|
+
);
|
|
2825
|
+
const t = [e.text, e["text-glob"]].filter(
|
|
2826
|
+
(a) => a !== void 0
|
|
2827
|
+
).length, o = e["text-regex"] ? 1 : 0, l = e["text-substring"] ? 1 : 0;
|
|
2828
|
+
if (t + o + l > 1)
|
|
2829
|
+
throw new Error(
|
|
2830
|
+
"Specify only one of --text/--text-glob, --text-regex, or --text-substring"
|
|
2831
|
+
);
|
|
2832
|
+
return !0;
|
|
2833
|
+
}
|
|
2834
|
+
function zr(e) {
|
|
2835
|
+
const n = [e.key, e["key-glob"]].filter(
|
|
2836
|
+
(o) => o !== void 0
|
|
2837
|
+
), r = [e.text, e["text-glob"]].filter(
|
|
2838
|
+
(o) => o !== void 0
|
|
2839
|
+
), i = Un("key", {
|
|
2840
|
+
glob: n[0],
|
|
2841
|
+
regex: e["key-regex"],
|
|
2842
|
+
substring: e["key-substring"]
|
|
2843
|
+
}), t = Un("text", {
|
|
2844
|
+
glob: r[0],
|
|
2845
|
+
regex: e["text-regex"],
|
|
2846
|
+
substring: e["text-substring"]
|
|
2847
|
+
});
|
|
2848
|
+
return { keyFilter: i, textFilter: t };
|
|
2849
|
+
}
|
|
2850
|
+
function pl() {
|
|
2588
2851
|
return {
|
|
2589
2852
|
command: "strings",
|
|
2590
2853
|
describe: "List strings in the xcstrings file",
|
|
2591
|
-
builder: (e) => e.option("
|
|
2592
|
-
type: "string",
|
|
2593
|
-
describe: "Filter keys by glob (default)"
|
|
2594
|
-
}).option("key-glob", {
|
|
2595
|
-
type: "string",
|
|
2596
|
-
describe: "Filter keys by glob (explicit)"
|
|
2597
|
-
}).option("key-regex", {
|
|
2598
|
-
type: "string",
|
|
2599
|
-
describe: "Filter keys by regex"
|
|
2600
|
-
}).option("key-substring", {
|
|
2601
|
-
type: "string",
|
|
2602
|
-
describe: "Filter keys by substring match"
|
|
2603
|
-
}).option("text", {
|
|
2604
|
-
type: "string",
|
|
2605
|
-
describe: "Filter translations by glob (default)"
|
|
2606
|
-
}).option("text-glob", {
|
|
2607
|
-
type: "string",
|
|
2608
|
-
describe: "Filter translations by glob (explicit)"
|
|
2609
|
-
}).option("text-regex", {
|
|
2610
|
-
type: "string",
|
|
2611
|
-
describe: "Filter translations by regex"
|
|
2612
|
-
}).option("text-substring", {
|
|
2613
|
-
type: "string",
|
|
2614
|
-
describe: "Filter translations by substring match"
|
|
2615
|
-
}).option("languages", {
|
|
2854
|
+
builder: (e) => Mr(e).option("languages", {
|
|
2616
2855
|
type: "string",
|
|
2617
2856
|
array: !0,
|
|
2618
2857
|
alias: "l",
|
|
@@ -2624,54 +2863,21 @@ function Xo() {
|
|
|
2624
2863
|
}).option("format", {
|
|
2625
2864
|
type: "string",
|
|
2626
2865
|
describe: "Mustache template. Available variables: {{language}}, {{key}}, {{text}}"
|
|
2627
|
-
}).check((n) =>
|
|
2628
|
-
const r = [n.key, n["key-glob"]].filter((s) => s !== void 0).length, i = n["key-regex"] ? 1 : 0, t = n["key-substring"] ? 1 : 0;
|
|
2629
|
-
if (r + i + t > 1)
|
|
2630
|
-
throw new Error("Specify only one of --key/--key-glob, --key-regex, or --key-substring");
|
|
2631
|
-
const o = [n.text, n["text-glob"]].filter((s) => s !== void 0).length, l = n["text-regex"] ? 1 : 0, a = n["text-substring"] ? 1 : 0;
|
|
2632
|
-
if (o + l + a > 1)
|
|
2633
|
-
throw new Error("Specify only one of --text/--text-glob, --text-regex, or --text-substring");
|
|
2634
|
-
return !0;
|
|
2635
|
-
}),
|
|
2866
|
+
}).check((n) => Dr(n)),
|
|
2636
2867
|
handler: async (e) => {
|
|
2637
|
-
const
|
|
2638
|
-
glob: n[0],
|
|
2639
|
-
regex: e["key-regex"],
|
|
2640
|
-
substring: e["key-substring"]
|
|
2641
|
-
}), t = Ln("text", {
|
|
2642
|
-
glob: r[0],
|
|
2643
|
-
regex: e["text-regex"],
|
|
2644
|
-
substring: e["text-substring"]
|
|
2645
|
-
}), o = await Zo({
|
|
2868
|
+
const { keyFilter: n, textFilter: r } = zr(e), i = await hl({
|
|
2646
2869
|
path: e.path,
|
|
2647
2870
|
languages: e.languages,
|
|
2648
2871
|
missingLanguages: e["missing-languages"],
|
|
2649
|
-
keyFilter:
|
|
2650
|
-
textFilter:
|
|
2872
|
+
keyFilter: n,
|
|
2873
|
+
textFilter: r,
|
|
2651
2874
|
format: e.format
|
|
2652
2875
|
});
|
|
2653
|
-
|
|
2876
|
+
i && console.log(i);
|
|
2654
2877
|
}
|
|
2655
2878
|
};
|
|
2656
2879
|
}
|
|
2657
|
-
function
|
|
2658
|
-
const n = e.replace(/[.+^${}()|\\]/g, "\\$&").replace(/\*/g, ".*").replace(/\?/g, ".");
|
|
2659
|
-
return new RegExp(`^${n}$`);
|
|
2660
|
-
}
|
|
2661
|
-
function jn(e) {
|
|
2662
|
-
if (!e) return () => !0;
|
|
2663
|
-
if (e.mode === "regex") {
|
|
2664
|
-
const r = new RegExp(e.pattern);
|
|
2665
|
-
return (i) => r.test(i);
|
|
2666
|
-
}
|
|
2667
|
-
if (e.mode === "substring") {
|
|
2668
|
-
const r = e.pattern;
|
|
2669
|
-
return (i) => i.includes(r);
|
|
2670
|
-
}
|
|
2671
|
-
const n = Qo(e.pattern);
|
|
2672
|
-
return (r) => n.test(r);
|
|
2673
|
-
}
|
|
2674
|
-
function Jo(e, n) {
|
|
2880
|
+
function dl(e, n) {
|
|
2675
2881
|
const r = D.escape;
|
|
2676
2882
|
D.escape = (i) => i;
|
|
2677
2883
|
try {
|
|
@@ -2680,39 +2886,229 @@ function Jo(e, n) {
|
|
|
2680
2886
|
D.escape = r;
|
|
2681
2887
|
}
|
|
2682
2888
|
}
|
|
2683
|
-
async function
|
|
2684
|
-
const r = (await
|
|
2889
|
+
async function hl(e) {
|
|
2890
|
+
const r = (await Q(e.path)).strings ?? {}, i = le(e.keyFilter), t = le(e.textFilter), o = e.languages ? new Set(e.languages) : null, l = e.missingLanguages ? new Set(e.missingLanguages) : null, a = !!e.format, s = [];
|
|
2685
2891
|
for (const c of Object.keys(r)) {
|
|
2686
2892
|
if (!i(c)) continue;
|
|
2687
|
-
const
|
|
2893
|
+
const u = r[c]?.localizations ?? {}, h = Object.keys(u), g = l ? Array.from(l).some(
|
|
2894
|
+
(d) => !(d in u)
|
|
2895
|
+
) : !0, m = [];
|
|
2688
2896
|
for (const d of h) {
|
|
2689
2897
|
if (o && !o.has(d)) continue;
|
|
2690
|
-
const
|
|
2691
|
-
t(
|
|
2898
|
+
const w = u[d]?.stringUnit?.value ?? "";
|
|
2899
|
+
t(w) && (a && e.format ? m.push(
|
|
2900
|
+
dl(e.format, {
|
|
2901
|
+
language: d,
|
|
2902
|
+
key: c,
|
|
2903
|
+
text: w
|
|
2904
|
+
})
|
|
2905
|
+
) : m.push(` ${d}: ${JSON.stringify(w)}`));
|
|
2692
2906
|
}
|
|
2693
|
-
|
|
2907
|
+
m.length !== 0 && g && (a ? s.push(...m) : s.push(`${c}:`, ...m));
|
|
2694
2908
|
}
|
|
2695
2909
|
return s.join(`
|
|
2696
2910
|
`);
|
|
2697
2911
|
}
|
|
2698
|
-
|
|
2699
|
-
|
|
2912
|
+
async function Ye(e) {
|
|
2913
|
+
try {
|
|
2914
|
+
return await Zr(e), !0;
|
|
2915
|
+
} catch {
|
|
2916
|
+
return !1;
|
|
2917
|
+
}
|
|
2918
|
+
}
|
|
2919
|
+
function gl(e) {
|
|
2920
|
+
const n = Gr(e).toLowerCase();
|
|
2921
|
+
return n ? n === ".strings" ? e.slice(0, -n.length) + ".xcstrings" : e : `${e}.xcstrings`;
|
|
2922
|
+
}
|
|
2923
|
+
async function ml(e, n) {
|
|
2924
|
+
try {
|
|
2925
|
+
const r = await en(e, { withFileTypes: !0 });
|
|
2926
|
+
for (const i of r)
|
|
2927
|
+
!i.isDirectory() || !i.name.endsWith(".lproj") || await Yn(Ee(e, i.name, n), {
|
|
2928
|
+
recursive: !0,
|
|
2929
|
+
force: !0
|
|
2930
|
+
});
|
|
2931
|
+
} catch {
|
|
2932
|
+
}
|
|
2933
|
+
}
|
|
2934
|
+
function yl() {
|
|
2935
|
+
return {
|
|
2936
|
+
command: "export <outpath>",
|
|
2937
|
+
describe: "Export xcstrings to a filtered xcstrings or traditional strings format",
|
|
2938
|
+
builder: (e) => Mr(e).positional("outpath", {
|
|
2939
|
+
type: "string",
|
|
2940
|
+
demandOption: !0,
|
|
2941
|
+
describe: "Output path for the exported strings"
|
|
2942
|
+
}).option("output", {
|
|
2943
|
+
alias: "o",
|
|
2944
|
+
type: "string",
|
|
2945
|
+
choices: ["auto", "xcstrings", "strings"],
|
|
2946
|
+
default: "auto",
|
|
2947
|
+
describe: "Output format. If auto, inferred from outpath extension if possible."
|
|
2948
|
+
}).option("merge-policy", {
|
|
2949
|
+
alias: "m",
|
|
2950
|
+
type: "string",
|
|
2951
|
+
choices: [
|
|
2952
|
+
"error",
|
|
2953
|
+
"force",
|
|
2954
|
+
"output-first",
|
|
2955
|
+
"existing-first"
|
|
2956
|
+
],
|
|
2957
|
+
default: "error",
|
|
2958
|
+
describe: "How to handle existing translation files"
|
|
2959
|
+
}).option("languages", {
|
|
2960
|
+
type: "string",
|
|
2961
|
+
array: !0,
|
|
2962
|
+
alias: "l",
|
|
2963
|
+
describe: "Include only these languages"
|
|
2964
|
+
}).check((n) => Dr(n)),
|
|
2965
|
+
handler: async (e) => {
|
|
2966
|
+
const n = e.outpath;
|
|
2967
|
+
let r = e.output;
|
|
2968
|
+
if (r === "auto")
|
|
2969
|
+
n.toLowerCase().endsWith(".xcstrings") ? r = "xcstrings" : n.toLowerCase().endsWith(".strings") ? r = "strings" : r = "xcstrings";
|
|
2970
|
+
else if (r === "strings" && n.toLowerCase().endsWith(".xcstrings"))
|
|
2971
|
+
throw new Error(
|
|
2972
|
+
"Output format mismatch: specified --output strings but the outpath has .xcstrings extension."
|
|
2973
|
+
);
|
|
2974
|
+
const { keyFilter: i, textFilter: t } = zr(e);
|
|
2975
|
+
await vl({
|
|
2976
|
+
sourcePath: e.path,
|
|
2977
|
+
outpath: n,
|
|
2978
|
+
outputFormat: r,
|
|
2979
|
+
mergePolicy: e.mergePolicy || e.m || "error",
|
|
2980
|
+
keyFilter: i,
|
|
2981
|
+
textFilter: t,
|
|
2982
|
+
languages: e.languages
|
|
2983
|
+
});
|
|
2984
|
+
}
|
|
2985
|
+
};
|
|
2986
|
+
}
|
|
2987
|
+
async function vl(e) {
|
|
2988
|
+
if (e.outputFormat === "xcstrings") {
|
|
2989
|
+
const n = await Q(e.sourcePath), r = le(e.keyFilter), i = le(e.textFilter), t = e.languages ? new Set(e.languages) : null, o = gl(e.outpath);
|
|
2990
|
+
let l = {
|
|
2991
|
+
sourceLanguage: n.sourceLanguage,
|
|
2992
|
+
version: n.version ?? "1.0",
|
|
2993
|
+
strings: {}
|
|
2994
|
+
};
|
|
2995
|
+
if (await Ye(o)) {
|
|
2996
|
+
if (e.mergePolicy === "error")
|
|
2997
|
+
throw new Error(
|
|
2998
|
+
`Output file already exists: ${o}. Use --merge-policy to override.`
|
|
2999
|
+
);
|
|
3000
|
+
if (e.mergePolicy === "force" && await Yn(o, { recursive: !0, force: !0 }), e.mergePolicy === "existing-first" || e.mergePolicy === "output-first")
|
|
3001
|
+
try {
|
|
3002
|
+
const s = await Ke(
|
|
3003
|
+
o,
|
|
3004
|
+
"utf8"
|
|
3005
|
+
);
|
|
3006
|
+
l = JSON.parse(s), l.strings = l.strings ?? {};
|
|
3007
|
+
} catch {
|
|
3008
|
+
}
|
|
3009
|
+
}
|
|
3010
|
+
for (const [s, c] of Object.entries(n.strings ?? {})) {
|
|
3011
|
+
if (!r(s)) continue;
|
|
3012
|
+
const f = JSON.parse(JSON.stringify(c));
|
|
3013
|
+
if (f.localizations)
|
|
3014
|
+
for (const u of Object.keys(f.localizations)) {
|
|
3015
|
+
if (t && !t.has(u)) {
|
|
3016
|
+
delete f.localizations[u];
|
|
3017
|
+
continue;
|
|
3018
|
+
}
|
|
3019
|
+
const h = f.localizations[u]?.stringUnit?.value ?? "";
|
|
3020
|
+
i(h) || delete f.localizations[u];
|
|
3021
|
+
}
|
|
3022
|
+
if (!(f.localizations && Object.keys(f.localizations).length === 0))
|
|
3023
|
+
if (!l.strings[s])
|
|
3024
|
+
l.strings[s] = f;
|
|
3025
|
+
else {
|
|
3026
|
+
const u = l.strings[s];
|
|
3027
|
+
if (e.mergePolicy === "output-first") {
|
|
3028
|
+
u.comment = f.comment ?? u.comment, u.extractionState = f.extractionState ?? u.extractionState, u.localizations = u.localizations ?? {};
|
|
3029
|
+
const h = Object.entries(f.localizations ?? {});
|
|
3030
|
+
if (h.length > 0)
|
|
3031
|
+
for (const [g, m] of h)
|
|
3032
|
+
u.localizations[g] = m;
|
|
3033
|
+
} else if (e.mergePolicy === "existing-first") {
|
|
3034
|
+
u.localizations = u.localizations ?? {};
|
|
3035
|
+
const h = Object.entries(f.localizations ?? {});
|
|
3036
|
+
if (h.length > 0)
|
|
3037
|
+
for (const [g, m] of h)
|
|
3038
|
+
u.localizations[g] || (u.localizations[g] = m);
|
|
3039
|
+
}
|
|
3040
|
+
}
|
|
3041
|
+
}
|
|
3042
|
+
await xn(yn(o), { recursive: !0 }), await cn(o, l);
|
|
3043
|
+
} else {
|
|
3044
|
+
const n = await Q(e.sourcePath), r = le(e.keyFilter), i = le(e.textFilter), t = e.languages ? new Set(e.languages) : null;
|
|
3045
|
+
let o = yn(e.outpath), l = qr(e.outpath);
|
|
3046
|
+
l.endsWith(".strings") || (l += ".strings"), e.mergePolicy === "force" && await ml(o, l);
|
|
3047
|
+
const a = /* @__PURE__ */ new Map();
|
|
3048
|
+
for (const [s, c] of Object.entries(n.strings ?? {})) {
|
|
3049
|
+
if (!r(s)) continue;
|
|
3050
|
+
const f = c.localizations ?? {};
|
|
3051
|
+
for (const [u, h] of Object.entries(f)) {
|
|
3052
|
+
if (t && !t.has(u)) continue;
|
|
3053
|
+
const g = h?.stringUnit?.value ?? "";
|
|
3054
|
+
i(g) && (a.has(u) || a.set(u, /* @__PURE__ */ new Map()), a.get(u).set(s, g));
|
|
3055
|
+
}
|
|
3056
|
+
}
|
|
3057
|
+
if (e.mergePolicy === "error")
|
|
3058
|
+
for (const s of a.keys()) {
|
|
3059
|
+
const c = Ee(o, `${s}.lproj`, l);
|
|
3060
|
+
if (await Ye(c))
|
|
3061
|
+
throw new Error(
|
|
3062
|
+
`Output file already exists: ${c}. Use --merge-policy to override.`
|
|
3063
|
+
);
|
|
3064
|
+
}
|
|
3065
|
+
for (const [s, c] of a.entries()) {
|
|
3066
|
+
const f = Ee(o, `${s}.lproj`), u = Ee(f, l), h = await Ye(u), g = /* @__PURE__ */ new Map();
|
|
3067
|
+
if (h && (e.mergePolicy === "existing-first" || e.mergePolicy === "output-first"))
|
|
3068
|
+
try {
|
|
3069
|
+
const d = await Ke(u, "utf8"), w = /"((?:[^"\\]|\\.)*)"\s*=\s*"((?:[^"\\]|\\.)*)";/g;
|
|
3070
|
+
let k;
|
|
3071
|
+
for (; (k = w.exec(d)) !== null; ) {
|
|
3072
|
+
const v = k[1].replace(/\\"/g, '"'), O = k[2].replace(/\\"/g, '"');
|
|
3073
|
+
g.set(v, O);
|
|
3074
|
+
}
|
|
3075
|
+
} catch {
|
|
3076
|
+
}
|
|
3077
|
+
for (const [d, w] of c.entries())
|
|
3078
|
+
g.has(d) && e.mergePolicy === "existing-first" || g.set(d, w);
|
|
3079
|
+
let m = "";
|
|
3080
|
+
for (const [d, w] of g.entries()) {
|
|
3081
|
+
const k = d.replace(/"/g, '\\"').replace(/\n/g, "\\n"), v = w.replace(/"/g, '\\"').replace(/\n/g, "\\n");
|
|
3082
|
+
m += `"${k}" = "${v}";
|
|
3083
|
+
`;
|
|
3084
|
+
}
|
|
3085
|
+
m.length > 0 && (await xn(f, { recursive: !0 }), await Ze(u, m, "utf8"));
|
|
3086
|
+
}
|
|
3087
|
+
}
|
|
3088
|
+
}
|
|
3089
|
+
const Bn = Ne(process.cwd(), "Localizable.xcstrings");
|
|
3090
|
+
Kr(Wr(process.argv)).scriptName("xcstrings").usage("$0 <cmd> [args]").option("config", {
|
|
2700
3091
|
type: "string",
|
|
2701
3092
|
describe: "Path to config file"
|
|
2702
3093
|
}).option("path", {
|
|
2703
3094
|
type: "string",
|
|
2704
|
-
describe: "Path to xcstrings file",
|
|
2705
|
-
default:
|
|
3095
|
+
describe: "Path or alias to xcstrings file",
|
|
3096
|
+
default: Bn
|
|
2706
3097
|
}).middleware(async (e) => {
|
|
2707
|
-
const n = await
|
|
2708
|
-
e.path = await
|
|
3098
|
+
const n = await sn(e.config);
|
|
3099
|
+
e.path = await bo(
|
|
3100
|
+
e.path,
|
|
3101
|
+
n,
|
|
3102
|
+
Bn
|
|
3103
|
+
);
|
|
2709
3104
|
}).command([
|
|
2710
|
-
|
|
2711
|
-
|
|
2712
|
-
|
|
2713
|
-
|
|
2714
|
-
|
|
2715
|
-
|
|
2716
|
-
|
|
2717
|
-
|
|
3105
|
+
Uo(),
|
|
3106
|
+
Bo(),
|
|
3107
|
+
Ko(),
|
|
3108
|
+
Fo(),
|
|
3109
|
+
pl(),
|
|
3110
|
+
yl()
|
|
3111
|
+
]).demandCommand(1, "").strictCommands().recommendCommands().fail((e, n, r) => {
|
|
3112
|
+
const i = n instanceof ae;
|
|
3113
|
+
(e || i) && (console.error(S.red(e || n?.message || n)), console.log(), r.showHelp(), process.exit(1)), n && (console.error(S.red(n.message || n)), process.exit(1)), process.exit(1);
|
|
2718
3114
|
}).help().argv;
|