@johpaz/hive-sdk 0.0.5 → 0.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agents/index.js +171573 -11091
- package/dist/channels/index.js +3702 -51
- package/dist/cron/index.js +806 -7
- package/dist/database/index.js +2636 -2
- package/dist/ethics/index.js +2636 -2
- package/dist/hivelearn/index.d.ts +11 -0
- package/dist/hivelearn/index.js +5033 -0
- package/dist/hivelearn/src/agent/agent-loop.d.ts +14 -0
- package/dist/hivelearn/src/agent/executor.d.ts +10 -0
- package/dist/hivelearn/src/agent/prompts.d.ts +1 -0
- package/dist/hivelearn/src/agent/runner.d.ts +8 -0
- package/dist/hivelearn/src/agent/tool-map.d.ts +12 -0
- package/dist/hivelearn/src/agents/coordinator.prompt.d.ts +9 -0
- package/dist/hivelearn/src/agents/prompts/audio.prompt.d.ts +1 -0
- package/dist/hivelearn/src/agents/prompts/challenge.prompt.d.ts +1 -0
- package/dist/hivelearn/src/agents/prompts/code.prompt.d.ts +1 -0
- package/dist/hivelearn/src/agents/prompts/evaluation.prompt.d.ts +1 -0
- package/dist/hivelearn/src/agents/prompts/exercise.prompt.d.ts +1 -0
- package/dist/hivelearn/src/agents/prompts/explanation.prompt.d.ts +1 -0
- package/dist/hivelearn/src/agents/prompts/feedback.prompt.d.ts +1 -0
- package/dist/hivelearn/src/agents/prompts/gamification.prompt.d.ts +1 -0
- package/dist/hivelearn/src/agents/prompts/gif.prompt.d.ts +1 -0
- package/dist/hivelearn/src/agents/prompts/infographic.prompt.d.ts +1 -0
- package/dist/hivelearn/src/agents/prompts/intent.prompt.d.ts +1 -0
- package/dist/hivelearn/src/agents/prompts/profile.prompt.d.ts +1 -0
- package/dist/hivelearn/src/agents/prompts/quiz.prompt.d.ts +1 -0
- package/dist/hivelearn/src/agents/prompts/structure.prompt.d.ts +1 -0
- package/dist/hivelearn/src/agents/prompts/svg.prompt.d.ts +1 -0
- package/dist/hivelearn/src/agents/registry.d.ts +43 -0
- package/dist/hivelearn/src/cache/CacheInvalidator.d.ts +9 -0
- package/dist/hivelearn/src/cache/NodeCache.d.ts +15 -0
- package/dist/hivelearn/src/events/swarm-events.d.ts +12 -0
- package/dist/hivelearn/src/index.d.ts +17 -0
- package/dist/hivelearn/src/persistence/LessonPersistence.d.ts +90 -0
- package/dist/hivelearn/src/scheduler/dag/DAGScheduler.d.ts +29 -0
- package/dist/hivelearn/src/scheduler/dag/EventBridge.d.ts +16 -0
- package/dist/hivelearn/src/scheduler/dag/TaskGraph.d.ts +18 -0
- package/dist/hivelearn/src/scheduler/dag/TaskNode.d.ts +40 -0
- package/dist/hivelearn/src/scheduler/dag/TaskResult.d.ts +19 -0
- package/dist/hivelearn/src/scheduler/dag/errors.d.ts +17 -0
- package/dist/hivelearn/src/scheduler/dag/index.d.ts +13 -0
- package/dist/hivelearn/src/scheduler/dag/strategies/ParallelStrategy.d.ts +11 -0
- package/dist/hivelearn/src/swarm/HiveLearnSwarm.d.ts +16 -0
- package/dist/hivelearn/src/swarm/orchestrator.d.ts +15 -0
- package/dist/hivelearn/src/swarm/presets/HiveLearnPreset.d.ts +35 -0
- package/dist/hivelearn/src/swarm/session.d.ts +15 -0
- package/dist/hivelearn/src/tools/canvas/disenar-estructura.tool.d.ts +3 -0
- package/dist/hivelearn/src/tools/canvas/poblar-nodo.tool.d.ts +2 -0
- package/dist/hivelearn/src/tools/content/generar-audio.tool.d.ts +2 -0
- package/dist/hivelearn/src/tools/content/generar-codigo.tool.d.ts +2 -0
- package/dist/hivelearn/src/tools/content/generar-ejercicio.tool.d.ts +2 -0
- package/dist/hivelearn/src/tools/content/generar-explicacion.tool.d.ts +2 -0
- package/dist/hivelearn/src/tools/content/generar-frames-gif.tool.d.ts +2 -0
- package/dist/hivelearn/src/tools/content/generar-imagen.tool.d.ts +2 -0
- package/dist/hivelearn/src/tools/content/generar-infografia.tool.d.ts +2 -0
- package/dist/hivelearn/src/tools/content/generar-quiz.tool.d.ts +2 -0
- package/dist/hivelearn/src/tools/content/generar-reto.tool.d.ts +2 -0
- package/dist/hivelearn/src/tools/content/generar-svg.tool.d.ts +2 -0
- package/dist/hivelearn/src/tools/coordinator/delegar-enjambre.tool.d.ts +6 -0
- package/dist/hivelearn/src/tools/coordinator/revisar-programa.tool.d.ts +6 -0
- package/dist/hivelearn/src/tools/evaluation/calificar-evaluacion.tool.d.ts +20 -0
- package/dist/hivelearn/src/tools/evaluation/generar-evaluacion.tool.d.ts +2 -0
- package/dist/hivelearn/src/tools/index.d.ts +26 -0
- package/dist/hivelearn/src/tools/profile/clasificar-intencion.tool.d.ts +2 -0
- package/dist/hivelearn/src/tools/search/buscar-curriculo-existente.tool.d.ts +2 -0
- package/dist/hivelearn/src/tools/search/buscar-en-hivelearn.tool.d.ts +2 -0
- package/dist/hivelearn/src/types/tool.d.ts +17 -0
- package/dist/hivelearn/src/types.d.ts +187 -0
- package/dist/hivelearn/src/utils/logger.d.ts +21 -0
- package/dist/index.js +172848 -11349
- package/dist/mcp/index.js +25 -0
- package/dist/skills/index.js +2636 -2
- package/dist/tools/index.js +167497 -7015
- package/package.json +9 -3
- package/src/hivelearn/index.ts +43 -0
package/dist/channels/index.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
// @bun
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
2
4
|
var __defProp = Object.defineProperty;
|
|
3
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
6
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -6,6 +8,28 @@ var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
|
6
8
|
function __accessProp(key) {
|
|
7
9
|
return this[key];
|
|
8
10
|
}
|
|
11
|
+
var __toESMCache_node;
|
|
12
|
+
var __toESMCache_esm;
|
|
13
|
+
var __toESM = (mod, isNodeMode, target) => {
|
|
14
|
+
var canCache = mod != null && typeof mod === "object";
|
|
15
|
+
if (canCache) {
|
|
16
|
+
var cache = isNodeMode ? __toESMCache_node ??= new WeakMap : __toESMCache_esm ??= new WeakMap;
|
|
17
|
+
var cached = cache.get(mod);
|
|
18
|
+
if (cached)
|
|
19
|
+
return cached;
|
|
20
|
+
}
|
|
21
|
+
target = mod != null ? __create(__getProtoOf(mod)) : {};
|
|
22
|
+
const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
|
|
23
|
+
for (let key of __getOwnPropNames(mod))
|
|
24
|
+
if (!__hasOwnProp.call(to, key))
|
|
25
|
+
__defProp(to, key, {
|
|
26
|
+
get: __accessProp.bind(mod, key),
|
|
27
|
+
enumerable: true
|
|
28
|
+
});
|
|
29
|
+
if (canCache)
|
|
30
|
+
cache.set(mod, to);
|
|
31
|
+
return to;
|
|
32
|
+
};
|
|
9
33
|
var __toCommonJS = (from) => {
|
|
10
34
|
var entry = (__moduleCache ??= new WeakMap).get(from), desc;
|
|
11
35
|
if (entry)
|
|
@@ -23,6 +47,7 @@ var __toCommonJS = (from) => {
|
|
|
23
47
|
return entry;
|
|
24
48
|
};
|
|
25
49
|
var __moduleCache;
|
|
50
|
+
var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
26
51
|
var __returnValue = (v) => v;
|
|
27
52
|
function __exportSetter(name, newValue) {
|
|
28
53
|
this[name] = __returnValue.bind(null, newValue);
|
|
@@ -1704,47 +1729,2656 @@ function encrypt(text) {
|
|
|
1704
1729
|
encrypted: encrypted + ":" + authTag,
|
|
1705
1730
|
iv: iv.toString("hex")
|
|
1706
1731
|
};
|
|
1707
|
-
}
|
|
1708
|
-
function decrypt(data) {
|
|
1709
|
-
const key = getEncryptionKey();
|
|
1710
|
-
const iv = Buffer.from(data.iv, "hex");
|
|
1711
|
-
const [encrypted, authTag] = data.encrypted.split(":");
|
|
1712
|
-
const decipher = createDecipheriv("aes-256-gcm", key, iv);
|
|
1713
|
-
decipher.setAuthTag(Buffer.from(authTag, "hex"));
|
|
1714
|
-
let decrypted = decipher.update(encrypted, "hex", "utf8");
|
|
1715
|
-
decrypted += decipher.final("utf8");
|
|
1716
|
-
return decrypted;
|
|
1717
|
-
}
|
|
1718
|
-
function encryptApiKey(apiKey) {
|
|
1719
|
-
return encrypt(apiKey);
|
|
1720
|
-
}
|
|
1721
|
-
function decryptApiKey(encrypted, iv) {
|
|
1722
|
-
return decrypt({ encrypted, iv });
|
|
1723
|
-
}
|
|
1724
|
-
function encryptConfig(config) {
|
|
1725
|
-
return encrypt(JSON.stringify(config));
|
|
1726
|
-
}
|
|
1727
|
-
function decryptConfig(encrypted, iv) {
|
|
1728
|
-
const decrypted = decrypt({ encrypted, iv });
|
|
1729
|
-
return JSON.parse(decrypted);
|
|
1730
|
-
}
|
|
1731
|
-
function hashPassword(password) {
|
|
1732
|
-
const hasher = new Bun.CryptoHasher("sha256");
|
|
1733
|
-
hasher.update(password);
|
|
1734
|
-
return hasher.digest("hex");
|
|
1735
|
-
}
|
|
1736
|
-
function verifyPassword(password, hash) {
|
|
1737
|
-
const hasher = new Bun.CryptoHasher("sha256");
|
|
1738
|
-
hasher.update(password);
|
|
1739
|
-
return hasher.digest("hex") === hash;
|
|
1740
|
-
}
|
|
1741
|
-
function maskApiKey(apiKey) {
|
|
1742
|
-
if (!apiKey || apiKey.length < 8)
|
|
1743
|
-
return "\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022";
|
|
1744
|
-
return apiKey.slice(0, 4) + "\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022" + apiKey.slice(-4);
|
|
1745
|
-
}
|
|
1746
|
-
var _encryptionKey = null;
|
|
1747
|
-
var init_crypto = () => {};
|
|
1732
|
+
}
|
|
1733
|
+
function decrypt(data) {
|
|
1734
|
+
const key = getEncryptionKey();
|
|
1735
|
+
const iv = Buffer.from(data.iv, "hex");
|
|
1736
|
+
const [encrypted, authTag] = data.encrypted.split(":");
|
|
1737
|
+
const decipher = createDecipheriv("aes-256-gcm", key, iv);
|
|
1738
|
+
decipher.setAuthTag(Buffer.from(authTag, "hex"));
|
|
1739
|
+
let decrypted = decipher.update(encrypted, "hex", "utf8");
|
|
1740
|
+
decrypted += decipher.final("utf8");
|
|
1741
|
+
return decrypted;
|
|
1742
|
+
}
|
|
1743
|
+
function encryptApiKey(apiKey) {
|
|
1744
|
+
return encrypt(apiKey);
|
|
1745
|
+
}
|
|
1746
|
+
function decryptApiKey(encrypted, iv) {
|
|
1747
|
+
return decrypt({ encrypted, iv });
|
|
1748
|
+
}
|
|
1749
|
+
function encryptConfig(config) {
|
|
1750
|
+
return encrypt(JSON.stringify(config));
|
|
1751
|
+
}
|
|
1752
|
+
function decryptConfig(encrypted, iv) {
|
|
1753
|
+
const decrypted = decrypt({ encrypted, iv });
|
|
1754
|
+
return JSON.parse(decrypted);
|
|
1755
|
+
}
|
|
1756
|
+
function hashPassword(password) {
|
|
1757
|
+
const hasher = new Bun.CryptoHasher("sha256");
|
|
1758
|
+
hasher.update(password);
|
|
1759
|
+
return hasher.digest("hex");
|
|
1760
|
+
}
|
|
1761
|
+
function verifyPassword(password, hash) {
|
|
1762
|
+
const hasher = new Bun.CryptoHasher("sha256");
|
|
1763
|
+
hasher.update(password);
|
|
1764
|
+
return hasher.digest("hex") === hash;
|
|
1765
|
+
}
|
|
1766
|
+
function maskApiKey(apiKey) {
|
|
1767
|
+
if (!apiKey || apiKey.length < 8)
|
|
1768
|
+
return "\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022";
|
|
1769
|
+
return apiKey.slice(0, 4) + "\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022" + apiKey.slice(-4);
|
|
1770
|
+
}
|
|
1771
|
+
var _encryptionKey = null;
|
|
1772
|
+
var init_crypto = () => {};
|
|
1773
|
+
|
|
1774
|
+
// ../../node_modules/.bun/js-yaml@4.1.1/node_modules/js-yaml/dist/js-yaml.mjs
|
|
1775
|
+
function isNothing(subject) {
|
|
1776
|
+
return typeof subject === "undefined" || subject === null;
|
|
1777
|
+
}
|
|
1778
|
+
function isObject(subject) {
|
|
1779
|
+
return typeof subject === "object" && subject !== null;
|
|
1780
|
+
}
|
|
1781
|
+
function toArray(sequence) {
|
|
1782
|
+
if (Array.isArray(sequence))
|
|
1783
|
+
return sequence;
|
|
1784
|
+
else if (isNothing(sequence))
|
|
1785
|
+
return [];
|
|
1786
|
+
return [sequence];
|
|
1787
|
+
}
|
|
1788
|
+
function extend(target, source) {
|
|
1789
|
+
var index, length, key, sourceKeys;
|
|
1790
|
+
if (source) {
|
|
1791
|
+
sourceKeys = Object.keys(source);
|
|
1792
|
+
for (index = 0, length = sourceKeys.length;index < length; index += 1) {
|
|
1793
|
+
key = sourceKeys[index];
|
|
1794
|
+
target[key] = source[key];
|
|
1795
|
+
}
|
|
1796
|
+
}
|
|
1797
|
+
return target;
|
|
1798
|
+
}
|
|
1799
|
+
function repeat(string2, count) {
|
|
1800
|
+
var result = "", cycle;
|
|
1801
|
+
for (cycle = 0;cycle < count; cycle += 1) {
|
|
1802
|
+
result += string2;
|
|
1803
|
+
}
|
|
1804
|
+
return result;
|
|
1805
|
+
}
|
|
1806
|
+
function isNegativeZero(number2) {
|
|
1807
|
+
return number2 === 0 && Number.NEGATIVE_INFINITY === 1 / number2;
|
|
1808
|
+
}
|
|
1809
|
+
function formatError(exception, compact) {
|
|
1810
|
+
var where = "", message = exception.reason || "(unknown reason)";
|
|
1811
|
+
if (!exception.mark)
|
|
1812
|
+
return message;
|
|
1813
|
+
if (exception.mark.name) {
|
|
1814
|
+
where += 'in "' + exception.mark.name + '" ';
|
|
1815
|
+
}
|
|
1816
|
+
where += "(" + (exception.mark.line + 1) + ":" + (exception.mark.column + 1) + ")";
|
|
1817
|
+
if (!compact && exception.mark.snippet) {
|
|
1818
|
+
where += `
|
|
1819
|
+
|
|
1820
|
+
` + exception.mark.snippet;
|
|
1821
|
+
}
|
|
1822
|
+
return message + " " + where;
|
|
1823
|
+
}
|
|
1824
|
+
function YAMLException$1(reason, mark) {
|
|
1825
|
+
Error.call(this);
|
|
1826
|
+
this.name = "YAMLException";
|
|
1827
|
+
this.reason = reason;
|
|
1828
|
+
this.mark = mark;
|
|
1829
|
+
this.message = formatError(this, false);
|
|
1830
|
+
if (Error.captureStackTrace) {
|
|
1831
|
+
Error.captureStackTrace(this, this.constructor);
|
|
1832
|
+
} else {
|
|
1833
|
+
this.stack = new Error().stack || "";
|
|
1834
|
+
}
|
|
1835
|
+
}
|
|
1836
|
+
function getLine(buffer, lineStart, lineEnd, position, maxLineLength) {
|
|
1837
|
+
var head = "";
|
|
1838
|
+
var tail = "";
|
|
1839
|
+
var maxHalfLength = Math.floor(maxLineLength / 2) - 1;
|
|
1840
|
+
if (position - lineStart > maxHalfLength) {
|
|
1841
|
+
head = " ... ";
|
|
1842
|
+
lineStart = position - maxHalfLength + head.length;
|
|
1843
|
+
}
|
|
1844
|
+
if (lineEnd - position > maxHalfLength) {
|
|
1845
|
+
tail = " ...";
|
|
1846
|
+
lineEnd = position + maxHalfLength - tail.length;
|
|
1847
|
+
}
|
|
1848
|
+
return {
|
|
1849
|
+
str: head + buffer.slice(lineStart, lineEnd).replace(/\t/g, "\u2192") + tail,
|
|
1850
|
+
pos: position - lineStart + head.length
|
|
1851
|
+
};
|
|
1852
|
+
}
|
|
1853
|
+
function padStart(string2, max) {
|
|
1854
|
+
return common.repeat(" ", max - string2.length) + string2;
|
|
1855
|
+
}
|
|
1856
|
+
function makeSnippet(mark, options) {
|
|
1857
|
+
options = Object.create(options || null);
|
|
1858
|
+
if (!mark.buffer)
|
|
1859
|
+
return null;
|
|
1860
|
+
if (!options.maxLength)
|
|
1861
|
+
options.maxLength = 79;
|
|
1862
|
+
if (typeof options.indent !== "number")
|
|
1863
|
+
options.indent = 1;
|
|
1864
|
+
if (typeof options.linesBefore !== "number")
|
|
1865
|
+
options.linesBefore = 3;
|
|
1866
|
+
if (typeof options.linesAfter !== "number")
|
|
1867
|
+
options.linesAfter = 2;
|
|
1868
|
+
var re = /\r?\n|\r|\0/g;
|
|
1869
|
+
var lineStarts = [0];
|
|
1870
|
+
var lineEnds = [];
|
|
1871
|
+
var match;
|
|
1872
|
+
var foundLineNo = -1;
|
|
1873
|
+
while (match = re.exec(mark.buffer)) {
|
|
1874
|
+
lineEnds.push(match.index);
|
|
1875
|
+
lineStarts.push(match.index + match[0].length);
|
|
1876
|
+
if (mark.position <= match.index && foundLineNo < 0) {
|
|
1877
|
+
foundLineNo = lineStarts.length - 2;
|
|
1878
|
+
}
|
|
1879
|
+
}
|
|
1880
|
+
if (foundLineNo < 0)
|
|
1881
|
+
foundLineNo = lineStarts.length - 1;
|
|
1882
|
+
var result = "", i, line;
|
|
1883
|
+
var lineNoLength = Math.min(mark.line + options.linesAfter, lineEnds.length).toString().length;
|
|
1884
|
+
var maxLineLength = options.maxLength - (options.indent + lineNoLength + 3);
|
|
1885
|
+
for (i = 1;i <= options.linesBefore; i++) {
|
|
1886
|
+
if (foundLineNo - i < 0)
|
|
1887
|
+
break;
|
|
1888
|
+
line = getLine(mark.buffer, lineStarts[foundLineNo - i], lineEnds[foundLineNo - i], mark.position - (lineStarts[foundLineNo] - lineStarts[foundLineNo - i]), maxLineLength);
|
|
1889
|
+
result = common.repeat(" ", options.indent) + padStart((mark.line - i + 1).toString(), lineNoLength) + " | " + line.str + `
|
|
1890
|
+
` + result;
|
|
1891
|
+
}
|
|
1892
|
+
line = getLine(mark.buffer, lineStarts[foundLineNo], lineEnds[foundLineNo], mark.position, maxLineLength);
|
|
1893
|
+
result += common.repeat(" ", options.indent) + padStart((mark.line + 1).toString(), lineNoLength) + " | " + line.str + `
|
|
1894
|
+
`;
|
|
1895
|
+
result += common.repeat("-", options.indent + lineNoLength + 3 + line.pos) + "^" + `
|
|
1896
|
+
`;
|
|
1897
|
+
for (i = 1;i <= options.linesAfter; i++) {
|
|
1898
|
+
if (foundLineNo + i >= lineEnds.length)
|
|
1899
|
+
break;
|
|
1900
|
+
line = getLine(mark.buffer, lineStarts[foundLineNo + i], lineEnds[foundLineNo + i], mark.position - (lineStarts[foundLineNo] - lineStarts[foundLineNo + i]), maxLineLength);
|
|
1901
|
+
result += common.repeat(" ", options.indent) + padStart((mark.line + i + 1).toString(), lineNoLength) + " | " + line.str + `
|
|
1902
|
+
`;
|
|
1903
|
+
}
|
|
1904
|
+
return result.replace(/\n$/, "");
|
|
1905
|
+
}
|
|
1906
|
+
function compileStyleAliases(map) {
|
|
1907
|
+
var result = {};
|
|
1908
|
+
if (map !== null) {
|
|
1909
|
+
Object.keys(map).forEach(function(style) {
|
|
1910
|
+
map[style].forEach(function(alias) {
|
|
1911
|
+
result[String(alias)] = style;
|
|
1912
|
+
});
|
|
1913
|
+
});
|
|
1914
|
+
}
|
|
1915
|
+
return result;
|
|
1916
|
+
}
|
|
1917
|
+
function Type$1(tag, options) {
|
|
1918
|
+
options = options || {};
|
|
1919
|
+
Object.keys(options).forEach(function(name) {
|
|
1920
|
+
if (TYPE_CONSTRUCTOR_OPTIONS.indexOf(name) === -1) {
|
|
1921
|
+
throw new exception('Unknown option "' + name + '" is met in definition of "' + tag + '" YAML type.');
|
|
1922
|
+
}
|
|
1923
|
+
});
|
|
1924
|
+
this.options = options;
|
|
1925
|
+
this.tag = tag;
|
|
1926
|
+
this.kind = options["kind"] || null;
|
|
1927
|
+
this.resolve = options["resolve"] || function() {
|
|
1928
|
+
return true;
|
|
1929
|
+
};
|
|
1930
|
+
this.construct = options["construct"] || function(data) {
|
|
1931
|
+
return data;
|
|
1932
|
+
};
|
|
1933
|
+
this.instanceOf = options["instanceOf"] || null;
|
|
1934
|
+
this.predicate = options["predicate"] || null;
|
|
1935
|
+
this.represent = options["represent"] || null;
|
|
1936
|
+
this.representName = options["representName"] || null;
|
|
1937
|
+
this.defaultStyle = options["defaultStyle"] || null;
|
|
1938
|
+
this.multi = options["multi"] || false;
|
|
1939
|
+
this.styleAliases = compileStyleAliases(options["styleAliases"] || null);
|
|
1940
|
+
if (YAML_NODE_KINDS.indexOf(this.kind) === -1) {
|
|
1941
|
+
throw new exception('Unknown kind "' + this.kind + '" is specified for "' + tag + '" YAML type.');
|
|
1942
|
+
}
|
|
1943
|
+
}
|
|
1944
|
+
function compileList(schema, name) {
|
|
1945
|
+
var result = [];
|
|
1946
|
+
schema[name].forEach(function(currentType) {
|
|
1947
|
+
var newIndex = result.length;
|
|
1948
|
+
result.forEach(function(previousType, previousIndex) {
|
|
1949
|
+
if (previousType.tag === currentType.tag && previousType.kind === currentType.kind && previousType.multi === currentType.multi) {
|
|
1950
|
+
newIndex = previousIndex;
|
|
1951
|
+
}
|
|
1952
|
+
});
|
|
1953
|
+
result[newIndex] = currentType;
|
|
1954
|
+
});
|
|
1955
|
+
return result;
|
|
1956
|
+
}
|
|
1957
|
+
function compileMap() {
|
|
1958
|
+
var result = {
|
|
1959
|
+
scalar: {},
|
|
1960
|
+
sequence: {},
|
|
1961
|
+
mapping: {},
|
|
1962
|
+
fallback: {},
|
|
1963
|
+
multi: {
|
|
1964
|
+
scalar: [],
|
|
1965
|
+
sequence: [],
|
|
1966
|
+
mapping: [],
|
|
1967
|
+
fallback: []
|
|
1968
|
+
}
|
|
1969
|
+
}, index, length;
|
|
1970
|
+
function collectType(type2) {
|
|
1971
|
+
if (type2.multi) {
|
|
1972
|
+
result.multi[type2.kind].push(type2);
|
|
1973
|
+
result.multi["fallback"].push(type2);
|
|
1974
|
+
} else {
|
|
1975
|
+
result[type2.kind][type2.tag] = result["fallback"][type2.tag] = type2;
|
|
1976
|
+
}
|
|
1977
|
+
}
|
|
1978
|
+
for (index = 0, length = arguments.length;index < length; index += 1) {
|
|
1979
|
+
arguments[index].forEach(collectType);
|
|
1980
|
+
}
|
|
1981
|
+
return result;
|
|
1982
|
+
}
|
|
1983
|
+
function Schema$1(definition) {
|
|
1984
|
+
return this.extend(definition);
|
|
1985
|
+
}
|
|
1986
|
+
function resolveYamlNull(data) {
|
|
1987
|
+
if (data === null)
|
|
1988
|
+
return true;
|
|
1989
|
+
var max = data.length;
|
|
1990
|
+
return max === 1 && data === "~" || max === 4 && (data === "null" || data === "Null" || data === "NULL");
|
|
1991
|
+
}
|
|
1992
|
+
function constructYamlNull() {
|
|
1993
|
+
return null;
|
|
1994
|
+
}
|
|
1995
|
+
function isNull(object2) {
|
|
1996
|
+
return object2 === null;
|
|
1997
|
+
}
|
|
1998
|
+
function resolveYamlBoolean(data) {
|
|
1999
|
+
if (data === null)
|
|
2000
|
+
return false;
|
|
2001
|
+
var max = data.length;
|
|
2002
|
+
return max === 4 && (data === "true" || data === "True" || data === "TRUE") || max === 5 && (data === "false" || data === "False" || data === "FALSE");
|
|
2003
|
+
}
|
|
2004
|
+
function constructYamlBoolean(data) {
|
|
2005
|
+
return data === "true" || data === "True" || data === "TRUE";
|
|
2006
|
+
}
|
|
2007
|
+
function isBoolean(object2) {
|
|
2008
|
+
return Object.prototype.toString.call(object2) === "[object Boolean]";
|
|
2009
|
+
}
|
|
2010
|
+
function isHexCode(c) {
|
|
2011
|
+
return 48 <= c && c <= 57 || 65 <= c && c <= 70 || 97 <= c && c <= 102;
|
|
2012
|
+
}
|
|
2013
|
+
function isOctCode(c) {
|
|
2014
|
+
return 48 <= c && c <= 55;
|
|
2015
|
+
}
|
|
2016
|
+
function isDecCode(c) {
|
|
2017
|
+
return 48 <= c && c <= 57;
|
|
2018
|
+
}
|
|
2019
|
+
function resolveYamlInteger(data) {
|
|
2020
|
+
if (data === null)
|
|
2021
|
+
return false;
|
|
2022
|
+
var max = data.length, index = 0, hasDigits = false, ch;
|
|
2023
|
+
if (!max)
|
|
2024
|
+
return false;
|
|
2025
|
+
ch = data[index];
|
|
2026
|
+
if (ch === "-" || ch === "+") {
|
|
2027
|
+
ch = data[++index];
|
|
2028
|
+
}
|
|
2029
|
+
if (ch === "0") {
|
|
2030
|
+
if (index + 1 === max)
|
|
2031
|
+
return true;
|
|
2032
|
+
ch = data[++index];
|
|
2033
|
+
if (ch === "b") {
|
|
2034
|
+
index++;
|
|
2035
|
+
for (;index < max; index++) {
|
|
2036
|
+
ch = data[index];
|
|
2037
|
+
if (ch === "_")
|
|
2038
|
+
continue;
|
|
2039
|
+
if (ch !== "0" && ch !== "1")
|
|
2040
|
+
return false;
|
|
2041
|
+
hasDigits = true;
|
|
2042
|
+
}
|
|
2043
|
+
return hasDigits && ch !== "_";
|
|
2044
|
+
}
|
|
2045
|
+
if (ch === "x") {
|
|
2046
|
+
index++;
|
|
2047
|
+
for (;index < max; index++) {
|
|
2048
|
+
ch = data[index];
|
|
2049
|
+
if (ch === "_")
|
|
2050
|
+
continue;
|
|
2051
|
+
if (!isHexCode(data.charCodeAt(index)))
|
|
2052
|
+
return false;
|
|
2053
|
+
hasDigits = true;
|
|
2054
|
+
}
|
|
2055
|
+
return hasDigits && ch !== "_";
|
|
2056
|
+
}
|
|
2057
|
+
if (ch === "o") {
|
|
2058
|
+
index++;
|
|
2059
|
+
for (;index < max; index++) {
|
|
2060
|
+
ch = data[index];
|
|
2061
|
+
if (ch === "_")
|
|
2062
|
+
continue;
|
|
2063
|
+
if (!isOctCode(data.charCodeAt(index)))
|
|
2064
|
+
return false;
|
|
2065
|
+
hasDigits = true;
|
|
2066
|
+
}
|
|
2067
|
+
return hasDigits && ch !== "_";
|
|
2068
|
+
}
|
|
2069
|
+
}
|
|
2070
|
+
if (ch === "_")
|
|
2071
|
+
return false;
|
|
2072
|
+
for (;index < max; index++) {
|
|
2073
|
+
ch = data[index];
|
|
2074
|
+
if (ch === "_")
|
|
2075
|
+
continue;
|
|
2076
|
+
if (!isDecCode(data.charCodeAt(index))) {
|
|
2077
|
+
return false;
|
|
2078
|
+
}
|
|
2079
|
+
hasDigits = true;
|
|
2080
|
+
}
|
|
2081
|
+
if (!hasDigits || ch === "_")
|
|
2082
|
+
return false;
|
|
2083
|
+
return true;
|
|
2084
|
+
}
|
|
2085
|
+
function constructYamlInteger(data) {
|
|
2086
|
+
var value = data, sign = 1, ch;
|
|
2087
|
+
if (value.indexOf("_") !== -1) {
|
|
2088
|
+
value = value.replace(/_/g, "");
|
|
2089
|
+
}
|
|
2090
|
+
ch = value[0];
|
|
2091
|
+
if (ch === "-" || ch === "+") {
|
|
2092
|
+
if (ch === "-")
|
|
2093
|
+
sign = -1;
|
|
2094
|
+
value = value.slice(1);
|
|
2095
|
+
ch = value[0];
|
|
2096
|
+
}
|
|
2097
|
+
if (value === "0")
|
|
2098
|
+
return 0;
|
|
2099
|
+
if (ch === "0") {
|
|
2100
|
+
if (value[1] === "b")
|
|
2101
|
+
return sign * parseInt(value.slice(2), 2);
|
|
2102
|
+
if (value[1] === "x")
|
|
2103
|
+
return sign * parseInt(value.slice(2), 16);
|
|
2104
|
+
if (value[1] === "o")
|
|
2105
|
+
return sign * parseInt(value.slice(2), 8);
|
|
2106
|
+
}
|
|
2107
|
+
return sign * parseInt(value, 10);
|
|
2108
|
+
}
|
|
2109
|
+
function isInteger(object2) {
|
|
2110
|
+
return Object.prototype.toString.call(object2) === "[object Number]" && (object2 % 1 === 0 && !common.isNegativeZero(object2));
|
|
2111
|
+
}
|
|
2112
|
+
function resolveYamlFloat(data) {
|
|
2113
|
+
if (data === null)
|
|
2114
|
+
return false;
|
|
2115
|
+
if (!YAML_FLOAT_PATTERN.test(data) || data[data.length - 1] === "_") {
|
|
2116
|
+
return false;
|
|
2117
|
+
}
|
|
2118
|
+
return true;
|
|
2119
|
+
}
|
|
2120
|
+
function constructYamlFloat(data) {
|
|
2121
|
+
var value, sign;
|
|
2122
|
+
value = data.replace(/_/g, "").toLowerCase();
|
|
2123
|
+
sign = value[0] === "-" ? -1 : 1;
|
|
2124
|
+
if ("+-".indexOf(value[0]) >= 0) {
|
|
2125
|
+
value = value.slice(1);
|
|
2126
|
+
}
|
|
2127
|
+
if (value === ".inf") {
|
|
2128
|
+
return sign === 1 ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY;
|
|
2129
|
+
} else if (value === ".nan") {
|
|
2130
|
+
return NaN;
|
|
2131
|
+
}
|
|
2132
|
+
return sign * parseFloat(value, 10);
|
|
2133
|
+
}
|
|
2134
|
+
function representYamlFloat(object2, style) {
|
|
2135
|
+
var res;
|
|
2136
|
+
if (isNaN(object2)) {
|
|
2137
|
+
switch (style) {
|
|
2138
|
+
case "lowercase":
|
|
2139
|
+
return ".nan";
|
|
2140
|
+
case "uppercase":
|
|
2141
|
+
return ".NAN";
|
|
2142
|
+
case "camelcase":
|
|
2143
|
+
return ".NaN";
|
|
2144
|
+
}
|
|
2145
|
+
} else if (Number.POSITIVE_INFINITY === object2) {
|
|
2146
|
+
switch (style) {
|
|
2147
|
+
case "lowercase":
|
|
2148
|
+
return ".inf";
|
|
2149
|
+
case "uppercase":
|
|
2150
|
+
return ".INF";
|
|
2151
|
+
case "camelcase":
|
|
2152
|
+
return ".Inf";
|
|
2153
|
+
}
|
|
2154
|
+
} else if (Number.NEGATIVE_INFINITY === object2) {
|
|
2155
|
+
switch (style) {
|
|
2156
|
+
case "lowercase":
|
|
2157
|
+
return "-.inf";
|
|
2158
|
+
case "uppercase":
|
|
2159
|
+
return "-.INF";
|
|
2160
|
+
case "camelcase":
|
|
2161
|
+
return "-.Inf";
|
|
2162
|
+
}
|
|
2163
|
+
} else if (common.isNegativeZero(object2)) {
|
|
2164
|
+
return "-0.0";
|
|
2165
|
+
}
|
|
2166
|
+
res = object2.toString(10);
|
|
2167
|
+
return SCIENTIFIC_WITHOUT_DOT.test(res) ? res.replace("e", ".e") : res;
|
|
2168
|
+
}
|
|
2169
|
+
function isFloat(object2) {
|
|
2170
|
+
return Object.prototype.toString.call(object2) === "[object Number]" && (object2 % 1 !== 0 || common.isNegativeZero(object2));
|
|
2171
|
+
}
|
|
2172
|
+
function resolveYamlTimestamp(data) {
|
|
2173
|
+
if (data === null)
|
|
2174
|
+
return false;
|
|
2175
|
+
if (YAML_DATE_REGEXP.exec(data) !== null)
|
|
2176
|
+
return true;
|
|
2177
|
+
if (YAML_TIMESTAMP_REGEXP.exec(data) !== null)
|
|
2178
|
+
return true;
|
|
2179
|
+
return false;
|
|
2180
|
+
}
|
|
2181
|
+
function constructYamlTimestamp(data) {
|
|
2182
|
+
var match, year, month, day, hour, minute, second, fraction = 0, delta = null, tz_hour, tz_minute, date;
|
|
2183
|
+
match = YAML_DATE_REGEXP.exec(data);
|
|
2184
|
+
if (match === null)
|
|
2185
|
+
match = YAML_TIMESTAMP_REGEXP.exec(data);
|
|
2186
|
+
if (match === null)
|
|
2187
|
+
throw new Error("Date resolve error");
|
|
2188
|
+
year = +match[1];
|
|
2189
|
+
month = +match[2] - 1;
|
|
2190
|
+
day = +match[3];
|
|
2191
|
+
if (!match[4]) {
|
|
2192
|
+
return new Date(Date.UTC(year, month, day));
|
|
2193
|
+
}
|
|
2194
|
+
hour = +match[4];
|
|
2195
|
+
minute = +match[5];
|
|
2196
|
+
second = +match[6];
|
|
2197
|
+
if (match[7]) {
|
|
2198
|
+
fraction = match[7].slice(0, 3);
|
|
2199
|
+
while (fraction.length < 3) {
|
|
2200
|
+
fraction += "0";
|
|
2201
|
+
}
|
|
2202
|
+
fraction = +fraction;
|
|
2203
|
+
}
|
|
2204
|
+
if (match[9]) {
|
|
2205
|
+
tz_hour = +match[10];
|
|
2206
|
+
tz_minute = +(match[11] || 0);
|
|
2207
|
+
delta = (tz_hour * 60 + tz_minute) * 60000;
|
|
2208
|
+
if (match[9] === "-")
|
|
2209
|
+
delta = -delta;
|
|
2210
|
+
}
|
|
2211
|
+
date = new Date(Date.UTC(year, month, day, hour, minute, second, fraction));
|
|
2212
|
+
if (delta)
|
|
2213
|
+
date.setTime(date.getTime() - delta);
|
|
2214
|
+
return date;
|
|
2215
|
+
}
|
|
2216
|
+
function representYamlTimestamp(object2) {
|
|
2217
|
+
return object2.toISOString();
|
|
2218
|
+
}
|
|
2219
|
+
function resolveYamlMerge(data) {
|
|
2220
|
+
return data === "<<" || data === null;
|
|
2221
|
+
}
|
|
2222
|
+
function resolveYamlBinary(data) {
|
|
2223
|
+
if (data === null)
|
|
2224
|
+
return false;
|
|
2225
|
+
var code, idx, bitlen = 0, max = data.length, map2 = BASE64_MAP;
|
|
2226
|
+
for (idx = 0;idx < max; idx++) {
|
|
2227
|
+
code = map2.indexOf(data.charAt(idx));
|
|
2228
|
+
if (code > 64)
|
|
2229
|
+
continue;
|
|
2230
|
+
if (code < 0)
|
|
2231
|
+
return false;
|
|
2232
|
+
bitlen += 6;
|
|
2233
|
+
}
|
|
2234
|
+
return bitlen % 8 === 0;
|
|
2235
|
+
}
|
|
2236
|
+
function constructYamlBinary(data) {
|
|
2237
|
+
var idx, tailbits, input = data.replace(/[\r\n=]/g, ""), max = input.length, map2 = BASE64_MAP, bits = 0, result = [];
|
|
2238
|
+
for (idx = 0;idx < max; idx++) {
|
|
2239
|
+
if (idx % 4 === 0 && idx) {
|
|
2240
|
+
result.push(bits >> 16 & 255);
|
|
2241
|
+
result.push(bits >> 8 & 255);
|
|
2242
|
+
result.push(bits & 255);
|
|
2243
|
+
}
|
|
2244
|
+
bits = bits << 6 | map2.indexOf(input.charAt(idx));
|
|
2245
|
+
}
|
|
2246
|
+
tailbits = max % 4 * 6;
|
|
2247
|
+
if (tailbits === 0) {
|
|
2248
|
+
result.push(bits >> 16 & 255);
|
|
2249
|
+
result.push(bits >> 8 & 255);
|
|
2250
|
+
result.push(bits & 255);
|
|
2251
|
+
} else if (tailbits === 18) {
|
|
2252
|
+
result.push(bits >> 10 & 255);
|
|
2253
|
+
result.push(bits >> 2 & 255);
|
|
2254
|
+
} else if (tailbits === 12) {
|
|
2255
|
+
result.push(bits >> 4 & 255);
|
|
2256
|
+
}
|
|
2257
|
+
return new Uint8Array(result);
|
|
2258
|
+
}
|
|
2259
|
+
function representYamlBinary(object2) {
|
|
2260
|
+
var result = "", bits = 0, idx, tail, max = object2.length, map2 = BASE64_MAP;
|
|
2261
|
+
for (idx = 0;idx < max; idx++) {
|
|
2262
|
+
if (idx % 3 === 0 && idx) {
|
|
2263
|
+
result += map2[bits >> 18 & 63];
|
|
2264
|
+
result += map2[bits >> 12 & 63];
|
|
2265
|
+
result += map2[bits >> 6 & 63];
|
|
2266
|
+
result += map2[bits & 63];
|
|
2267
|
+
}
|
|
2268
|
+
bits = (bits << 8) + object2[idx];
|
|
2269
|
+
}
|
|
2270
|
+
tail = max % 3;
|
|
2271
|
+
if (tail === 0) {
|
|
2272
|
+
result += map2[bits >> 18 & 63];
|
|
2273
|
+
result += map2[bits >> 12 & 63];
|
|
2274
|
+
result += map2[bits >> 6 & 63];
|
|
2275
|
+
result += map2[bits & 63];
|
|
2276
|
+
} else if (tail === 2) {
|
|
2277
|
+
result += map2[bits >> 10 & 63];
|
|
2278
|
+
result += map2[bits >> 4 & 63];
|
|
2279
|
+
result += map2[bits << 2 & 63];
|
|
2280
|
+
result += map2[64];
|
|
2281
|
+
} else if (tail === 1) {
|
|
2282
|
+
result += map2[bits >> 2 & 63];
|
|
2283
|
+
result += map2[bits << 4 & 63];
|
|
2284
|
+
result += map2[64];
|
|
2285
|
+
result += map2[64];
|
|
2286
|
+
}
|
|
2287
|
+
return result;
|
|
2288
|
+
}
|
|
2289
|
+
function isBinary(obj) {
|
|
2290
|
+
return Object.prototype.toString.call(obj) === "[object Uint8Array]";
|
|
2291
|
+
}
|
|
2292
|
+
function resolveYamlOmap(data) {
|
|
2293
|
+
if (data === null)
|
|
2294
|
+
return true;
|
|
2295
|
+
var objectKeys = [], index, length, pair, pairKey, pairHasKey, object2 = data;
|
|
2296
|
+
for (index = 0, length = object2.length;index < length; index += 1) {
|
|
2297
|
+
pair = object2[index];
|
|
2298
|
+
pairHasKey = false;
|
|
2299
|
+
if (_toString$2.call(pair) !== "[object Object]")
|
|
2300
|
+
return false;
|
|
2301
|
+
for (pairKey in pair) {
|
|
2302
|
+
if (_hasOwnProperty$3.call(pair, pairKey)) {
|
|
2303
|
+
if (!pairHasKey)
|
|
2304
|
+
pairHasKey = true;
|
|
2305
|
+
else
|
|
2306
|
+
return false;
|
|
2307
|
+
}
|
|
2308
|
+
}
|
|
2309
|
+
if (!pairHasKey)
|
|
2310
|
+
return false;
|
|
2311
|
+
if (objectKeys.indexOf(pairKey) === -1)
|
|
2312
|
+
objectKeys.push(pairKey);
|
|
2313
|
+
else
|
|
2314
|
+
return false;
|
|
2315
|
+
}
|
|
2316
|
+
return true;
|
|
2317
|
+
}
|
|
2318
|
+
function constructYamlOmap(data) {
|
|
2319
|
+
return data !== null ? data : [];
|
|
2320
|
+
}
|
|
2321
|
+
function resolveYamlPairs(data) {
|
|
2322
|
+
if (data === null)
|
|
2323
|
+
return true;
|
|
2324
|
+
var index, length, pair, keys, result, object2 = data;
|
|
2325
|
+
result = new Array(object2.length);
|
|
2326
|
+
for (index = 0, length = object2.length;index < length; index += 1) {
|
|
2327
|
+
pair = object2[index];
|
|
2328
|
+
if (_toString$1.call(pair) !== "[object Object]")
|
|
2329
|
+
return false;
|
|
2330
|
+
keys = Object.keys(pair);
|
|
2331
|
+
if (keys.length !== 1)
|
|
2332
|
+
return false;
|
|
2333
|
+
result[index] = [keys[0], pair[keys[0]]];
|
|
2334
|
+
}
|
|
2335
|
+
return true;
|
|
2336
|
+
}
|
|
2337
|
+
function constructYamlPairs(data) {
|
|
2338
|
+
if (data === null)
|
|
2339
|
+
return [];
|
|
2340
|
+
var index, length, pair, keys, result, object2 = data;
|
|
2341
|
+
result = new Array(object2.length);
|
|
2342
|
+
for (index = 0, length = object2.length;index < length; index += 1) {
|
|
2343
|
+
pair = object2[index];
|
|
2344
|
+
keys = Object.keys(pair);
|
|
2345
|
+
result[index] = [keys[0], pair[keys[0]]];
|
|
2346
|
+
}
|
|
2347
|
+
return result;
|
|
2348
|
+
}
|
|
2349
|
+
function resolveYamlSet(data) {
|
|
2350
|
+
if (data === null)
|
|
2351
|
+
return true;
|
|
2352
|
+
var key, object2 = data;
|
|
2353
|
+
for (key in object2) {
|
|
2354
|
+
if (_hasOwnProperty$2.call(object2, key)) {
|
|
2355
|
+
if (object2[key] !== null)
|
|
2356
|
+
return false;
|
|
2357
|
+
}
|
|
2358
|
+
}
|
|
2359
|
+
return true;
|
|
2360
|
+
}
|
|
2361
|
+
function constructYamlSet(data) {
|
|
2362
|
+
return data !== null ? data : {};
|
|
2363
|
+
}
|
|
2364
|
+
function _class(obj) {
|
|
2365
|
+
return Object.prototype.toString.call(obj);
|
|
2366
|
+
}
|
|
2367
|
+
function is_EOL(c) {
|
|
2368
|
+
return c === 10 || c === 13;
|
|
2369
|
+
}
|
|
2370
|
+
function is_WHITE_SPACE(c) {
|
|
2371
|
+
return c === 9 || c === 32;
|
|
2372
|
+
}
|
|
2373
|
+
function is_WS_OR_EOL(c) {
|
|
2374
|
+
return c === 9 || c === 32 || c === 10 || c === 13;
|
|
2375
|
+
}
|
|
2376
|
+
function is_FLOW_INDICATOR(c) {
|
|
2377
|
+
return c === 44 || c === 91 || c === 93 || c === 123 || c === 125;
|
|
2378
|
+
}
|
|
2379
|
+
function fromHexCode(c) {
|
|
2380
|
+
var lc;
|
|
2381
|
+
if (48 <= c && c <= 57) {
|
|
2382
|
+
return c - 48;
|
|
2383
|
+
}
|
|
2384
|
+
lc = c | 32;
|
|
2385
|
+
if (97 <= lc && lc <= 102) {
|
|
2386
|
+
return lc - 97 + 10;
|
|
2387
|
+
}
|
|
2388
|
+
return -1;
|
|
2389
|
+
}
|
|
2390
|
+
function escapedHexLen(c) {
|
|
2391
|
+
if (c === 120) {
|
|
2392
|
+
return 2;
|
|
2393
|
+
}
|
|
2394
|
+
if (c === 117) {
|
|
2395
|
+
return 4;
|
|
2396
|
+
}
|
|
2397
|
+
if (c === 85) {
|
|
2398
|
+
return 8;
|
|
2399
|
+
}
|
|
2400
|
+
return 0;
|
|
2401
|
+
}
|
|
2402
|
+
function fromDecimalCode(c) {
|
|
2403
|
+
if (48 <= c && c <= 57) {
|
|
2404
|
+
return c - 48;
|
|
2405
|
+
}
|
|
2406
|
+
return -1;
|
|
2407
|
+
}
|
|
2408
|
+
function simpleEscapeSequence(c) {
|
|
2409
|
+
return c === 48 ? "\x00" : c === 97 ? "\x07" : c === 98 ? "\b" : c === 116 ? "\t" : c === 9 ? "\t" : c === 110 ? `
|
|
2410
|
+
` : c === 118 ? "\v" : c === 102 ? "\f" : c === 114 ? "\r" : c === 101 ? "\x1B" : c === 32 ? " " : c === 34 ? '"' : c === 47 ? "/" : c === 92 ? "\\" : c === 78 ? "\x85" : c === 95 ? "\xA0" : c === 76 ? "\u2028" : c === 80 ? "\u2029" : "";
|
|
2411
|
+
}
|
|
2412
|
+
function charFromCodepoint(c) {
|
|
2413
|
+
if (c <= 65535) {
|
|
2414
|
+
return String.fromCharCode(c);
|
|
2415
|
+
}
|
|
2416
|
+
return String.fromCharCode((c - 65536 >> 10) + 55296, (c - 65536 & 1023) + 56320);
|
|
2417
|
+
}
|
|
2418
|
+
function setProperty(object2, key, value) {
|
|
2419
|
+
if (key === "__proto__") {
|
|
2420
|
+
Object.defineProperty(object2, key, {
|
|
2421
|
+
configurable: true,
|
|
2422
|
+
enumerable: true,
|
|
2423
|
+
writable: true,
|
|
2424
|
+
value
|
|
2425
|
+
});
|
|
2426
|
+
} else {
|
|
2427
|
+
object2[key] = value;
|
|
2428
|
+
}
|
|
2429
|
+
}
|
|
2430
|
+
function State$1(input, options) {
|
|
2431
|
+
this.input = input;
|
|
2432
|
+
this.filename = options["filename"] || null;
|
|
2433
|
+
this.schema = options["schema"] || _default;
|
|
2434
|
+
this.onWarning = options["onWarning"] || null;
|
|
2435
|
+
this.legacy = options["legacy"] || false;
|
|
2436
|
+
this.json = options["json"] || false;
|
|
2437
|
+
this.listener = options["listener"] || null;
|
|
2438
|
+
this.implicitTypes = this.schema.compiledImplicit;
|
|
2439
|
+
this.typeMap = this.schema.compiledTypeMap;
|
|
2440
|
+
this.length = input.length;
|
|
2441
|
+
this.position = 0;
|
|
2442
|
+
this.line = 0;
|
|
2443
|
+
this.lineStart = 0;
|
|
2444
|
+
this.lineIndent = 0;
|
|
2445
|
+
this.firstTabInLine = -1;
|
|
2446
|
+
this.documents = [];
|
|
2447
|
+
}
|
|
2448
|
+
function generateError(state, message) {
|
|
2449
|
+
var mark = {
|
|
2450
|
+
name: state.filename,
|
|
2451
|
+
buffer: state.input.slice(0, -1),
|
|
2452
|
+
position: state.position,
|
|
2453
|
+
line: state.line,
|
|
2454
|
+
column: state.position - state.lineStart
|
|
2455
|
+
};
|
|
2456
|
+
mark.snippet = snippet(mark);
|
|
2457
|
+
return new exception(message, mark);
|
|
2458
|
+
}
|
|
2459
|
+
function throwError(state, message) {
|
|
2460
|
+
throw generateError(state, message);
|
|
2461
|
+
}
|
|
2462
|
+
function throwWarning(state, message) {
|
|
2463
|
+
if (state.onWarning) {
|
|
2464
|
+
state.onWarning.call(null, generateError(state, message));
|
|
2465
|
+
}
|
|
2466
|
+
}
|
|
2467
|
+
function captureSegment(state, start, end, checkJson) {
|
|
2468
|
+
var _position, _length, _character, _result;
|
|
2469
|
+
if (start < end) {
|
|
2470
|
+
_result = state.input.slice(start, end);
|
|
2471
|
+
if (checkJson) {
|
|
2472
|
+
for (_position = 0, _length = _result.length;_position < _length; _position += 1) {
|
|
2473
|
+
_character = _result.charCodeAt(_position);
|
|
2474
|
+
if (!(_character === 9 || 32 <= _character && _character <= 1114111)) {
|
|
2475
|
+
throwError(state, "expected valid JSON character");
|
|
2476
|
+
}
|
|
2477
|
+
}
|
|
2478
|
+
} else if (PATTERN_NON_PRINTABLE.test(_result)) {
|
|
2479
|
+
throwError(state, "the stream contains non-printable characters");
|
|
2480
|
+
}
|
|
2481
|
+
state.result += _result;
|
|
2482
|
+
}
|
|
2483
|
+
}
|
|
2484
|
+
function mergeMappings(state, destination, source, overridableKeys) {
|
|
2485
|
+
var sourceKeys, key, index, quantity;
|
|
2486
|
+
if (!common.isObject(source)) {
|
|
2487
|
+
throwError(state, "cannot merge mappings; the provided source object is unacceptable");
|
|
2488
|
+
}
|
|
2489
|
+
sourceKeys = Object.keys(source);
|
|
2490
|
+
for (index = 0, quantity = sourceKeys.length;index < quantity; index += 1) {
|
|
2491
|
+
key = sourceKeys[index];
|
|
2492
|
+
if (!_hasOwnProperty$1.call(destination, key)) {
|
|
2493
|
+
setProperty(destination, key, source[key]);
|
|
2494
|
+
overridableKeys[key] = true;
|
|
2495
|
+
}
|
|
2496
|
+
}
|
|
2497
|
+
}
|
|
2498
|
+
function storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, startLine, startLineStart, startPos) {
|
|
2499
|
+
var index, quantity;
|
|
2500
|
+
if (Array.isArray(keyNode)) {
|
|
2501
|
+
keyNode = Array.prototype.slice.call(keyNode);
|
|
2502
|
+
for (index = 0, quantity = keyNode.length;index < quantity; index += 1) {
|
|
2503
|
+
if (Array.isArray(keyNode[index])) {
|
|
2504
|
+
throwError(state, "nested arrays are not supported inside keys");
|
|
2505
|
+
}
|
|
2506
|
+
if (typeof keyNode === "object" && _class(keyNode[index]) === "[object Object]") {
|
|
2507
|
+
keyNode[index] = "[object Object]";
|
|
2508
|
+
}
|
|
2509
|
+
}
|
|
2510
|
+
}
|
|
2511
|
+
if (typeof keyNode === "object" && _class(keyNode) === "[object Object]") {
|
|
2512
|
+
keyNode = "[object Object]";
|
|
2513
|
+
}
|
|
2514
|
+
keyNode = String(keyNode);
|
|
2515
|
+
if (_result === null) {
|
|
2516
|
+
_result = {};
|
|
2517
|
+
}
|
|
2518
|
+
if (keyTag === "tag:yaml.org,2002:merge") {
|
|
2519
|
+
if (Array.isArray(valueNode)) {
|
|
2520
|
+
for (index = 0, quantity = valueNode.length;index < quantity; index += 1) {
|
|
2521
|
+
mergeMappings(state, _result, valueNode[index], overridableKeys);
|
|
2522
|
+
}
|
|
2523
|
+
} else {
|
|
2524
|
+
mergeMappings(state, _result, valueNode, overridableKeys);
|
|
2525
|
+
}
|
|
2526
|
+
} else {
|
|
2527
|
+
if (!state.json && !_hasOwnProperty$1.call(overridableKeys, keyNode) && _hasOwnProperty$1.call(_result, keyNode)) {
|
|
2528
|
+
state.line = startLine || state.line;
|
|
2529
|
+
state.lineStart = startLineStart || state.lineStart;
|
|
2530
|
+
state.position = startPos || state.position;
|
|
2531
|
+
throwError(state, "duplicated mapping key");
|
|
2532
|
+
}
|
|
2533
|
+
setProperty(_result, keyNode, valueNode);
|
|
2534
|
+
delete overridableKeys[keyNode];
|
|
2535
|
+
}
|
|
2536
|
+
return _result;
|
|
2537
|
+
}
|
|
2538
|
+
function readLineBreak(state) {
|
|
2539
|
+
var ch;
|
|
2540
|
+
ch = state.input.charCodeAt(state.position);
|
|
2541
|
+
if (ch === 10) {
|
|
2542
|
+
state.position++;
|
|
2543
|
+
} else if (ch === 13) {
|
|
2544
|
+
state.position++;
|
|
2545
|
+
if (state.input.charCodeAt(state.position) === 10) {
|
|
2546
|
+
state.position++;
|
|
2547
|
+
}
|
|
2548
|
+
} else {
|
|
2549
|
+
throwError(state, "a line break is expected");
|
|
2550
|
+
}
|
|
2551
|
+
state.line += 1;
|
|
2552
|
+
state.lineStart = state.position;
|
|
2553
|
+
state.firstTabInLine = -1;
|
|
2554
|
+
}
|
|
2555
|
+
function skipSeparationSpace(state, allowComments, checkIndent) {
|
|
2556
|
+
var lineBreaks = 0, ch = state.input.charCodeAt(state.position);
|
|
2557
|
+
while (ch !== 0) {
|
|
2558
|
+
while (is_WHITE_SPACE(ch)) {
|
|
2559
|
+
if (ch === 9 && state.firstTabInLine === -1) {
|
|
2560
|
+
state.firstTabInLine = state.position;
|
|
2561
|
+
}
|
|
2562
|
+
ch = state.input.charCodeAt(++state.position);
|
|
2563
|
+
}
|
|
2564
|
+
if (allowComments && ch === 35) {
|
|
2565
|
+
do {
|
|
2566
|
+
ch = state.input.charCodeAt(++state.position);
|
|
2567
|
+
} while (ch !== 10 && ch !== 13 && ch !== 0);
|
|
2568
|
+
}
|
|
2569
|
+
if (is_EOL(ch)) {
|
|
2570
|
+
readLineBreak(state);
|
|
2571
|
+
ch = state.input.charCodeAt(state.position);
|
|
2572
|
+
lineBreaks++;
|
|
2573
|
+
state.lineIndent = 0;
|
|
2574
|
+
while (ch === 32) {
|
|
2575
|
+
state.lineIndent++;
|
|
2576
|
+
ch = state.input.charCodeAt(++state.position);
|
|
2577
|
+
}
|
|
2578
|
+
} else {
|
|
2579
|
+
break;
|
|
2580
|
+
}
|
|
2581
|
+
}
|
|
2582
|
+
if (checkIndent !== -1 && lineBreaks !== 0 && state.lineIndent < checkIndent) {
|
|
2583
|
+
throwWarning(state, "deficient indentation");
|
|
2584
|
+
}
|
|
2585
|
+
return lineBreaks;
|
|
2586
|
+
}
|
|
2587
|
+
function testDocumentSeparator(state) {
|
|
2588
|
+
var _position = state.position, ch;
|
|
2589
|
+
ch = state.input.charCodeAt(_position);
|
|
2590
|
+
if ((ch === 45 || ch === 46) && ch === state.input.charCodeAt(_position + 1) && ch === state.input.charCodeAt(_position + 2)) {
|
|
2591
|
+
_position += 3;
|
|
2592
|
+
ch = state.input.charCodeAt(_position);
|
|
2593
|
+
if (ch === 0 || is_WS_OR_EOL(ch)) {
|
|
2594
|
+
return true;
|
|
2595
|
+
}
|
|
2596
|
+
}
|
|
2597
|
+
return false;
|
|
2598
|
+
}
|
|
2599
|
+
function writeFoldedLines(state, count) {
|
|
2600
|
+
if (count === 1) {
|
|
2601
|
+
state.result += " ";
|
|
2602
|
+
} else if (count > 1) {
|
|
2603
|
+
state.result += common.repeat(`
|
|
2604
|
+
`, count - 1);
|
|
2605
|
+
}
|
|
2606
|
+
}
|
|
2607
|
+
function readPlainScalar(state, nodeIndent, withinFlowCollection) {
|
|
2608
|
+
var preceding, following, captureStart, captureEnd, hasPendingContent, _line, _lineStart, _lineIndent, _kind = state.kind, _result = state.result, ch;
|
|
2609
|
+
ch = state.input.charCodeAt(state.position);
|
|
2610
|
+
if (is_WS_OR_EOL(ch) || is_FLOW_INDICATOR(ch) || ch === 35 || ch === 38 || ch === 42 || ch === 33 || ch === 124 || ch === 62 || ch === 39 || ch === 34 || ch === 37 || ch === 64 || ch === 96) {
|
|
2611
|
+
return false;
|
|
2612
|
+
}
|
|
2613
|
+
if (ch === 63 || ch === 45) {
|
|
2614
|
+
following = state.input.charCodeAt(state.position + 1);
|
|
2615
|
+
if (is_WS_OR_EOL(following) || withinFlowCollection && is_FLOW_INDICATOR(following)) {
|
|
2616
|
+
return false;
|
|
2617
|
+
}
|
|
2618
|
+
}
|
|
2619
|
+
state.kind = "scalar";
|
|
2620
|
+
state.result = "";
|
|
2621
|
+
captureStart = captureEnd = state.position;
|
|
2622
|
+
hasPendingContent = false;
|
|
2623
|
+
while (ch !== 0) {
|
|
2624
|
+
if (ch === 58) {
|
|
2625
|
+
following = state.input.charCodeAt(state.position + 1);
|
|
2626
|
+
if (is_WS_OR_EOL(following) || withinFlowCollection && is_FLOW_INDICATOR(following)) {
|
|
2627
|
+
break;
|
|
2628
|
+
}
|
|
2629
|
+
} else if (ch === 35) {
|
|
2630
|
+
preceding = state.input.charCodeAt(state.position - 1);
|
|
2631
|
+
if (is_WS_OR_EOL(preceding)) {
|
|
2632
|
+
break;
|
|
2633
|
+
}
|
|
2634
|
+
} else if (state.position === state.lineStart && testDocumentSeparator(state) || withinFlowCollection && is_FLOW_INDICATOR(ch)) {
|
|
2635
|
+
break;
|
|
2636
|
+
} else if (is_EOL(ch)) {
|
|
2637
|
+
_line = state.line;
|
|
2638
|
+
_lineStart = state.lineStart;
|
|
2639
|
+
_lineIndent = state.lineIndent;
|
|
2640
|
+
skipSeparationSpace(state, false, -1);
|
|
2641
|
+
if (state.lineIndent >= nodeIndent) {
|
|
2642
|
+
hasPendingContent = true;
|
|
2643
|
+
ch = state.input.charCodeAt(state.position);
|
|
2644
|
+
continue;
|
|
2645
|
+
} else {
|
|
2646
|
+
state.position = captureEnd;
|
|
2647
|
+
state.line = _line;
|
|
2648
|
+
state.lineStart = _lineStart;
|
|
2649
|
+
state.lineIndent = _lineIndent;
|
|
2650
|
+
break;
|
|
2651
|
+
}
|
|
2652
|
+
}
|
|
2653
|
+
if (hasPendingContent) {
|
|
2654
|
+
captureSegment(state, captureStart, captureEnd, false);
|
|
2655
|
+
writeFoldedLines(state, state.line - _line);
|
|
2656
|
+
captureStart = captureEnd = state.position;
|
|
2657
|
+
hasPendingContent = false;
|
|
2658
|
+
}
|
|
2659
|
+
if (!is_WHITE_SPACE(ch)) {
|
|
2660
|
+
captureEnd = state.position + 1;
|
|
2661
|
+
}
|
|
2662
|
+
ch = state.input.charCodeAt(++state.position);
|
|
2663
|
+
}
|
|
2664
|
+
captureSegment(state, captureStart, captureEnd, false);
|
|
2665
|
+
if (state.result) {
|
|
2666
|
+
return true;
|
|
2667
|
+
}
|
|
2668
|
+
state.kind = _kind;
|
|
2669
|
+
state.result = _result;
|
|
2670
|
+
return false;
|
|
2671
|
+
}
|
|
2672
|
+
function readSingleQuotedScalar(state, nodeIndent) {
|
|
2673
|
+
var ch, captureStart, captureEnd;
|
|
2674
|
+
ch = state.input.charCodeAt(state.position);
|
|
2675
|
+
if (ch !== 39) {
|
|
2676
|
+
return false;
|
|
2677
|
+
}
|
|
2678
|
+
state.kind = "scalar";
|
|
2679
|
+
state.result = "";
|
|
2680
|
+
state.position++;
|
|
2681
|
+
captureStart = captureEnd = state.position;
|
|
2682
|
+
while ((ch = state.input.charCodeAt(state.position)) !== 0) {
|
|
2683
|
+
if (ch === 39) {
|
|
2684
|
+
captureSegment(state, captureStart, state.position, true);
|
|
2685
|
+
ch = state.input.charCodeAt(++state.position);
|
|
2686
|
+
if (ch === 39) {
|
|
2687
|
+
captureStart = state.position;
|
|
2688
|
+
state.position++;
|
|
2689
|
+
captureEnd = state.position;
|
|
2690
|
+
} else {
|
|
2691
|
+
return true;
|
|
2692
|
+
}
|
|
2693
|
+
} else if (is_EOL(ch)) {
|
|
2694
|
+
captureSegment(state, captureStart, captureEnd, true);
|
|
2695
|
+
writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent));
|
|
2696
|
+
captureStart = captureEnd = state.position;
|
|
2697
|
+
} else if (state.position === state.lineStart && testDocumentSeparator(state)) {
|
|
2698
|
+
throwError(state, "unexpected end of the document within a single quoted scalar");
|
|
2699
|
+
} else {
|
|
2700
|
+
state.position++;
|
|
2701
|
+
captureEnd = state.position;
|
|
2702
|
+
}
|
|
2703
|
+
}
|
|
2704
|
+
throwError(state, "unexpected end of the stream within a single quoted scalar");
|
|
2705
|
+
}
|
|
2706
|
+
function readDoubleQuotedScalar(state, nodeIndent) {
|
|
2707
|
+
var captureStart, captureEnd, hexLength, hexResult, tmp, ch;
|
|
2708
|
+
ch = state.input.charCodeAt(state.position);
|
|
2709
|
+
if (ch !== 34) {
|
|
2710
|
+
return false;
|
|
2711
|
+
}
|
|
2712
|
+
state.kind = "scalar";
|
|
2713
|
+
state.result = "";
|
|
2714
|
+
state.position++;
|
|
2715
|
+
captureStart = captureEnd = state.position;
|
|
2716
|
+
while ((ch = state.input.charCodeAt(state.position)) !== 0) {
|
|
2717
|
+
if (ch === 34) {
|
|
2718
|
+
captureSegment(state, captureStart, state.position, true);
|
|
2719
|
+
state.position++;
|
|
2720
|
+
return true;
|
|
2721
|
+
} else if (ch === 92) {
|
|
2722
|
+
captureSegment(state, captureStart, state.position, true);
|
|
2723
|
+
ch = state.input.charCodeAt(++state.position);
|
|
2724
|
+
if (is_EOL(ch)) {
|
|
2725
|
+
skipSeparationSpace(state, false, nodeIndent);
|
|
2726
|
+
} else if (ch < 256 && simpleEscapeCheck[ch]) {
|
|
2727
|
+
state.result += simpleEscapeMap[ch];
|
|
2728
|
+
state.position++;
|
|
2729
|
+
} else if ((tmp = escapedHexLen(ch)) > 0) {
|
|
2730
|
+
hexLength = tmp;
|
|
2731
|
+
hexResult = 0;
|
|
2732
|
+
for (;hexLength > 0; hexLength--) {
|
|
2733
|
+
ch = state.input.charCodeAt(++state.position);
|
|
2734
|
+
if ((tmp = fromHexCode(ch)) >= 0) {
|
|
2735
|
+
hexResult = (hexResult << 4) + tmp;
|
|
2736
|
+
} else {
|
|
2737
|
+
throwError(state, "expected hexadecimal character");
|
|
2738
|
+
}
|
|
2739
|
+
}
|
|
2740
|
+
state.result += charFromCodepoint(hexResult);
|
|
2741
|
+
state.position++;
|
|
2742
|
+
} else {
|
|
2743
|
+
throwError(state, "unknown escape sequence");
|
|
2744
|
+
}
|
|
2745
|
+
captureStart = captureEnd = state.position;
|
|
2746
|
+
} else if (is_EOL(ch)) {
|
|
2747
|
+
captureSegment(state, captureStart, captureEnd, true);
|
|
2748
|
+
writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent));
|
|
2749
|
+
captureStart = captureEnd = state.position;
|
|
2750
|
+
} else if (state.position === state.lineStart && testDocumentSeparator(state)) {
|
|
2751
|
+
throwError(state, "unexpected end of the document within a double quoted scalar");
|
|
2752
|
+
} else {
|
|
2753
|
+
state.position++;
|
|
2754
|
+
captureEnd = state.position;
|
|
2755
|
+
}
|
|
2756
|
+
}
|
|
2757
|
+
throwError(state, "unexpected end of the stream within a double quoted scalar");
|
|
2758
|
+
}
|
|
2759
|
+
function readFlowCollection(state, nodeIndent) {
|
|
2760
|
+
var readNext = true, _line, _lineStart, _pos, _tag = state.tag, _result, _anchor = state.anchor, following, terminator, isPair, isExplicitPair, isMapping, overridableKeys = Object.create(null), keyNode, keyTag, valueNode, ch;
|
|
2761
|
+
ch = state.input.charCodeAt(state.position);
|
|
2762
|
+
if (ch === 91) {
|
|
2763
|
+
terminator = 93;
|
|
2764
|
+
isMapping = false;
|
|
2765
|
+
_result = [];
|
|
2766
|
+
} else if (ch === 123) {
|
|
2767
|
+
terminator = 125;
|
|
2768
|
+
isMapping = true;
|
|
2769
|
+
_result = {};
|
|
2770
|
+
} else {
|
|
2771
|
+
return false;
|
|
2772
|
+
}
|
|
2773
|
+
if (state.anchor !== null) {
|
|
2774
|
+
state.anchorMap[state.anchor] = _result;
|
|
2775
|
+
}
|
|
2776
|
+
ch = state.input.charCodeAt(++state.position);
|
|
2777
|
+
while (ch !== 0) {
|
|
2778
|
+
skipSeparationSpace(state, true, nodeIndent);
|
|
2779
|
+
ch = state.input.charCodeAt(state.position);
|
|
2780
|
+
if (ch === terminator) {
|
|
2781
|
+
state.position++;
|
|
2782
|
+
state.tag = _tag;
|
|
2783
|
+
state.anchor = _anchor;
|
|
2784
|
+
state.kind = isMapping ? "mapping" : "sequence";
|
|
2785
|
+
state.result = _result;
|
|
2786
|
+
return true;
|
|
2787
|
+
} else if (!readNext) {
|
|
2788
|
+
throwError(state, "missed comma between flow collection entries");
|
|
2789
|
+
} else if (ch === 44) {
|
|
2790
|
+
throwError(state, "expected the node content, but found ','");
|
|
2791
|
+
}
|
|
2792
|
+
keyTag = keyNode = valueNode = null;
|
|
2793
|
+
isPair = isExplicitPair = false;
|
|
2794
|
+
if (ch === 63) {
|
|
2795
|
+
following = state.input.charCodeAt(state.position + 1);
|
|
2796
|
+
if (is_WS_OR_EOL(following)) {
|
|
2797
|
+
isPair = isExplicitPair = true;
|
|
2798
|
+
state.position++;
|
|
2799
|
+
skipSeparationSpace(state, true, nodeIndent);
|
|
2800
|
+
}
|
|
2801
|
+
}
|
|
2802
|
+
_line = state.line;
|
|
2803
|
+
_lineStart = state.lineStart;
|
|
2804
|
+
_pos = state.position;
|
|
2805
|
+
composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true);
|
|
2806
|
+
keyTag = state.tag;
|
|
2807
|
+
keyNode = state.result;
|
|
2808
|
+
skipSeparationSpace(state, true, nodeIndent);
|
|
2809
|
+
ch = state.input.charCodeAt(state.position);
|
|
2810
|
+
if ((isExplicitPair || state.line === _line) && ch === 58) {
|
|
2811
|
+
isPair = true;
|
|
2812
|
+
ch = state.input.charCodeAt(++state.position);
|
|
2813
|
+
skipSeparationSpace(state, true, nodeIndent);
|
|
2814
|
+
composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true);
|
|
2815
|
+
valueNode = state.result;
|
|
2816
|
+
}
|
|
2817
|
+
if (isMapping) {
|
|
2818
|
+
storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, _line, _lineStart, _pos);
|
|
2819
|
+
} else if (isPair) {
|
|
2820
|
+
_result.push(storeMappingPair(state, null, overridableKeys, keyTag, keyNode, valueNode, _line, _lineStart, _pos));
|
|
2821
|
+
} else {
|
|
2822
|
+
_result.push(keyNode);
|
|
2823
|
+
}
|
|
2824
|
+
skipSeparationSpace(state, true, nodeIndent);
|
|
2825
|
+
ch = state.input.charCodeAt(state.position);
|
|
2826
|
+
if (ch === 44) {
|
|
2827
|
+
readNext = true;
|
|
2828
|
+
ch = state.input.charCodeAt(++state.position);
|
|
2829
|
+
} else {
|
|
2830
|
+
readNext = false;
|
|
2831
|
+
}
|
|
2832
|
+
}
|
|
2833
|
+
throwError(state, "unexpected end of the stream within a flow collection");
|
|
2834
|
+
}
|
|
2835
|
+
function readBlockScalar(state, nodeIndent) {
|
|
2836
|
+
var captureStart, folding, chomping = CHOMPING_CLIP, didReadContent = false, detectedIndent = false, textIndent = nodeIndent, emptyLines = 0, atMoreIndented = false, tmp, ch;
|
|
2837
|
+
ch = state.input.charCodeAt(state.position);
|
|
2838
|
+
if (ch === 124) {
|
|
2839
|
+
folding = false;
|
|
2840
|
+
} else if (ch === 62) {
|
|
2841
|
+
folding = true;
|
|
2842
|
+
} else {
|
|
2843
|
+
return false;
|
|
2844
|
+
}
|
|
2845
|
+
state.kind = "scalar";
|
|
2846
|
+
state.result = "";
|
|
2847
|
+
while (ch !== 0) {
|
|
2848
|
+
ch = state.input.charCodeAt(++state.position);
|
|
2849
|
+
if (ch === 43 || ch === 45) {
|
|
2850
|
+
if (CHOMPING_CLIP === chomping) {
|
|
2851
|
+
chomping = ch === 43 ? CHOMPING_KEEP : CHOMPING_STRIP;
|
|
2852
|
+
} else {
|
|
2853
|
+
throwError(state, "repeat of a chomping mode identifier");
|
|
2854
|
+
}
|
|
2855
|
+
} else if ((tmp = fromDecimalCode(ch)) >= 0) {
|
|
2856
|
+
if (tmp === 0) {
|
|
2857
|
+
throwError(state, "bad explicit indentation width of a block scalar; it cannot be less than one");
|
|
2858
|
+
} else if (!detectedIndent) {
|
|
2859
|
+
textIndent = nodeIndent + tmp - 1;
|
|
2860
|
+
detectedIndent = true;
|
|
2861
|
+
} else {
|
|
2862
|
+
throwError(state, "repeat of an indentation width identifier");
|
|
2863
|
+
}
|
|
2864
|
+
} else {
|
|
2865
|
+
break;
|
|
2866
|
+
}
|
|
2867
|
+
}
|
|
2868
|
+
if (is_WHITE_SPACE(ch)) {
|
|
2869
|
+
do {
|
|
2870
|
+
ch = state.input.charCodeAt(++state.position);
|
|
2871
|
+
} while (is_WHITE_SPACE(ch));
|
|
2872
|
+
if (ch === 35) {
|
|
2873
|
+
do {
|
|
2874
|
+
ch = state.input.charCodeAt(++state.position);
|
|
2875
|
+
} while (!is_EOL(ch) && ch !== 0);
|
|
2876
|
+
}
|
|
2877
|
+
}
|
|
2878
|
+
while (ch !== 0) {
|
|
2879
|
+
readLineBreak(state);
|
|
2880
|
+
state.lineIndent = 0;
|
|
2881
|
+
ch = state.input.charCodeAt(state.position);
|
|
2882
|
+
while ((!detectedIndent || state.lineIndent < textIndent) && ch === 32) {
|
|
2883
|
+
state.lineIndent++;
|
|
2884
|
+
ch = state.input.charCodeAt(++state.position);
|
|
2885
|
+
}
|
|
2886
|
+
if (!detectedIndent && state.lineIndent > textIndent) {
|
|
2887
|
+
textIndent = state.lineIndent;
|
|
2888
|
+
}
|
|
2889
|
+
if (is_EOL(ch)) {
|
|
2890
|
+
emptyLines++;
|
|
2891
|
+
continue;
|
|
2892
|
+
}
|
|
2893
|
+
if (state.lineIndent < textIndent) {
|
|
2894
|
+
if (chomping === CHOMPING_KEEP) {
|
|
2895
|
+
state.result += common.repeat(`
|
|
2896
|
+
`, didReadContent ? 1 + emptyLines : emptyLines);
|
|
2897
|
+
} else if (chomping === CHOMPING_CLIP) {
|
|
2898
|
+
if (didReadContent) {
|
|
2899
|
+
state.result += `
|
|
2900
|
+
`;
|
|
2901
|
+
}
|
|
2902
|
+
}
|
|
2903
|
+
break;
|
|
2904
|
+
}
|
|
2905
|
+
if (folding) {
|
|
2906
|
+
if (is_WHITE_SPACE(ch)) {
|
|
2907
|
+
atMoreIndented = true;
|
|
2908
|
+
state.result += common.repeat(`
|
|
2909
|
+
`, didReadContent ? 1 + emptyLines : emptyLines);
|
|
2910
|
+
} else if (atMoreIndented) {
|
|
2911
|
+
atMoreIndented = false;
|
|
2912
|
+
state.result += common.repeat(`
|
|
2913
|
+
`, emptyLines + 1);
|
|
2914
|
+
} else if (emptyLines === 0) {
|
|
2915
|
+
if (didReadContent) {
|
|
2916
|
+
state.result += " ";
|
|
2917
|
+
}
|
|
2918
|
+
} else {
|
|
2919
|
+
state.result += common.repeat(`
|
|
2920
|
+
`, emptyLines);
|
|
2921
|
+
}
|
|
2922
|
+
} else {
|
|
2923
|
+
state.result += common.repeat(`
|
|
2924
|
+
`, didReadContent ? 1 + emptyLines : emptyLines);
|
|
2925
|
+
}
|
|
2926
|
+
didReadContent = true;
|
|
2927
|
+
detectedIndent = true;
|
|
2928
|
+
emptyLines = 0;
|
|
2929
|
+
captureStart = state.position;
|
|
2930
|
+
while (!is_EOL(ch) && ch !== 0) {
|
|
2931
|
+
ch = state.input.charCodeAt(++state.position);
|
|
2932
|
+
}
|
|
2933
|
+
captureSegment(state, captureStart, state.position, false);
|
|
2934
|
+
}
|
|
2935
|
+
return true;
|
|
2936
|
+
}
|
|
2937
|
+
function readBlockSequence(state, nodeIndent) {
|
|
2938
|
+
var _line, _tag = state.tag, _anchor = state.anchor, _result = [], following, detected = false, ch;
|
|
2939
|
+
if (state.firstTabInLine !== -1)
|
|
2940
|
+
return false;
|
|
2941
|
+
if (state.anchor !== null) {
|
|
2942
|
+
state.anchorMap[state.anchor] = _result;
|
|
2943
|
+
}
|
|
2944
|
+
ch = state.input.charCodeAt(state.position);
|
|
2945
|
+
while (ch !== 0) {
|
|
2946
|
+
if (state.firstTabInLine !== -1) {
|
|
2947
|
+
state.position = state.firstTabInLine;
|
|
2948
|
+
throwError(state, "tab characters must not be used in indentation");
|
|
2949
|
+
}
|
|
2950
|
+
if (ch !== 45) {
|
|
2951
|
+
break;
|
|
2952
|
+
}
|
|
2953
|
+
following = state.input.charCodeAt(state.position + 1);
|
|
2954
|
+
if (!is_WS_OR_EOL(following)) {
|
|
2955
|
+
break;
|
|
2956
|
+
}
|
|
2957
|
+
detected = true;
|
|
2958
|
+
state.position++;
|
|
2959
|
+
if (skipSeparationSpace(state, true, -1)) {
|
|
2960
|
+
if (state.lineIndent <= nodeIndent) {
|
|
2961
|
+
_result.push(null);
|
|
2962
|
+
ch = state.input.charCodeAt(state.position);
|
|
2963
|
+
continue;
|
|
2964
|
+
}
|
|
2965
|
+
}
|
|
2966
|
+
_line = state.line;
|
|
2967
|
+
composeNode(state, nodeIndent, CONTEXT_BLOCK_IN, false, true);
|
|
2968
|
+
_result.push(state.result);
|
|
2969
|
+
skipSeparationSpace(state, true, -1);
|
|
2970
|
+
ch = state.input.charCodeAt(state.position);
|
|
2971
|
+
if ((state.line === _line || state.lineIndent > nodeIndent) && ch !== 0) {
|
|
2972
|
+
throwError(state, "bad indentation of a sequence entry");
|
|
2973
|
+
} else if (state.lineIndent < nodeIndent) {
|
|
2974
|
+
break;
|
|
2975
|
+
}
|
|
2976
|
+
}
|
|
2977
|
+
if (detected) {
|
|
2978
|
+
state.tag = _tag;
|
|
2979
|
+
state.anchor = _anchor;
|
|
2980
|
+
state.kind = "sequence";
|
|
2981
|
+
state.result = _result;
|
|
2982
|
+
return true;
|
|
2983
|
+
}
|
|
2984
|
+
return false;
|
|
2985
|
+
}
|
|
2986
|
+
function readBlockMapping(state, nodeIndent, flowIndent) {
|
|
2987
|
+
var following, allowCompact, _line, _keyLine, _keyLineStart, _keyPos, _tag = state.tag, _anchor = state.anchor, _result = {}, overridableKeys = Object.create(null), keyTag = null, keyNode = null, valueNode = null, atExplicitKey = false, detected = false, ch;
|
|
2988
|
+
if (state.firstTabInLine !== -1)
|
|
2989
|
+
return false;
|
|
2990
|
+
if (state.anchor !== null) {
|
|
2991
|
+
state.anchorMap[state.anchor] = _result;
|
|
2992
|
+
}
|
|
2993
|
+
ch = state.input.charCodeAt(state.position);
|
|
2994
|
+
while (ch !== 0) {
|
|
2995
|
+
if (!atExplicitKey && state.firstTabInLine !== -1) {
|
|
2996
|
+
state.position = state.firstTabInLine;
|
|
2997
|
+
throwError(state, "tab characters must not be used in indentation");
|
|
2998
|
+
}
|
|
2999
|
+
following = state.input.charCodeAt(state.position + 1);
|
|
3000
|
+
_line = state.line;
|
|
3001
|
+
if ((ch === 63 || ch === 58) && is_WS_OR_EOL(following)) {
|
|
3002
|
+
if (ch === 63) {
|
|
3003
|
+
if (atExplicitKey) {
|
|
3004
|
+
storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos);
|
|
3005
|
+
keyTag = keyNode = valueNode = null;
|
|
3006
|
+
}
|
|
3007
|
+
detected = true;
|
|
3008
|
+
atExplicitKey = true;
|
|
3009
|
+
allowCompact = true;
|
|
3010
|
+
} else if (atExplicitKey) {
|
|
3011
|
+
atExplicitKey = false;
|
|
3012
|
+
allowCompact = true;
|
|
3013
|
+
} else {
|
|
3014
|
+
throwError(state, "incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line");
|
|
3015
|
+
}
|
|
3016
|
+
state.position += 1;
|
|
3017
|
+
ch = following;
|
|
3018
|
+
} else {
|
|
3019
|
+
_keyLine = state.line;
|
|
3020
|
+
_keyLineStart = state.lineStart;
|
|
3021
|
+
_keyPos = state.position;
|
|
3022
|
+
if (!composeNode(state, flowIndent, CONTEXT_FLOW_OUT, false, true)) {
|
|
3023
|
+
break;
|
|
3024
|
+
}
|
|
3025
|
+
if (state.line === _line) {
|
|
3026
|
+
ch = state.input.charCodeAt(state.position);
|
|
3027
|
+
while (is_WHITE_SPACE(ch)) {
|
|
3028
|
+
ch = state.input.charCodeAt(++state.position);
|
|
3029
|
+
}
|
|
3030
|
+
if (ch === 58) {
|
|
3031
|
+
ch = state.input.charCodeAt(++state.position);
|
|
3032
|
+
if (!is_WS_OR_EOL(ch)) {
|
|
3033
|
+
throwError(state, "a whitespace character is expected after the key-value separator within a block mapping");
|
|
3034
|
+
}
|
|
3035
|
+
if (atExplicitKey) {
|
|
3036
|
+
storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos);
|
|
3037
|
+
keyTag = keyNode = valueNode = null;
|
|
3038
|
+
}
|
|
3039
|
+
detected = true;
|
|
3040
|
+
atExplicitKey = false;
|
|
3041
|
+
allowCompact = false;
|
|
3042
|
+
keyTag = state.tag;
|
|
3043
|
+
keyNode = state.result;
|
|
3044
|
+
} else if (detected) {
|
|
3045
|
+
throwError(state, "can not read an implicit mapping pair; a colon is missed");
|
|
3046
|
+
} else {
|
|
3047
|
+
state.tag = _tag;
|
|
3048
|
+
state.anchor = _anchor;
|
|
3049
|
+
return true;
|
|
3050
|
+
}
|
|
3051
|
+
} else if (detected) {
|
|
3052
|
+
throwError(state, "can not read a block mapping entry; a multiline key may not be an implicit key");
|
|
3053
|
+
} else {
|
|
3054
|
+
state.tag = _tag;
|
|
3055
|
+
state.anchor = _anchor;
|
|
3056
|
+
return true;
|
|
3057
|
+
}
|
|
3058
|
+
}
|
|
3059
|
+
if (state.line === _line || state.lineIndent > nodeIndent) {
|
|
3060
|
+
if (atExplicitKey) {
|
|
3061
|
+
_keyLine = state.line;
|
|
3062
|
+
_keyLineStart = state.lineStart;
|
|
3063
|
+
_keyPos = state.position;
|
|
3064
|
+
}
|
|
3065
|
+
if (composeNode(state, nodeIndent, CONTEXT_BLOCK_OUT, true, allowCompact)) {
|
|
3066
|
+
if (atExplicitKey) {
|
|
3067
|
+
keyNode = state.result;
|
|
3068
|
+
} else {
|
|
3069
|
+
valueNode = state.result;
|
|
3070
|
+
}
|
|
3071
|
+
}
|
|
3072
|
+
if (!atExplicitKey) {
|
|
3073
|
+
storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, _keyLine, _keyLineStart, _keyPos);
|
|
3074
|
+
keyTag = keyNode = valueNode = null;
|
|
3075
|
+
}
|
|
3076
|
+
skipSeparationSpace(state, true, -1);
|
|
3077
|
+
ch = state.input.charCodeAt(state.position);
|
|
3078
|
+
}
|
|
3079
|
+
if ((state.line === _line || state.lineIndent > nodeIndent) && ch !== 0) {
|
|
3080
|
+
throwError(state, "bad indentation of a mapping entry");
|
|
3081
|
+
} else if (state.lineIndent < nodeIndent) {
|
|
3082
|
+
break;
|
|
3083
|
+
}
|
|
3084
|
+
}
|
|
3085
|
+
if (atExplicitKey) {
|
|
3086
|
+
storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos);
|
|
3087
|
+
}
|
|
3088
|
+
if (detected) {
|
|
3089
|
+
state.tag = _tag;
|
|
3090
|
+
state.anchor = _anchor;
|
|
3091
|
+
state.kind = "mapping";
|
|
3092
|
+
state.result = _result;
|
|
3093
|
+
}
|
|
3094
|
+
return detected;
|
|
3095
|
+
}
|
|
3096
|
+
function readTagProperty(state) {
|
|
3097
|
+
var _position, isVerbatim = false, isNamed = false, tagHandle, tagName, ch;
|
|
3098
|
+
ch = state.input.charCodeAt(state.position);
|
|
3099
|
+
if (ch !== 33)
|
|
3100
|
+
return false;
|
|
3101
|
+
if (state.tag !== null) {
|
|
3102
|
+
throwError(state, "duplication of a tag property");
|
|
3103
|
+
}
|
|
3104
|
+
ch = state.input.charCodeAt(++state.position);
|
|
3105
|
+
if (ch === 60) {
|
|
3106
|
+
isVerbatim = true;
|
|
3107
|
+
ch = state.input.charCodeAt(++state.position);
|
|
3108
|
+
} else if (ch === 33) {
|
|
3109
|
+
isNamed = true;
|
|
3110
|
+
tagHandle = "!!";
|
|
3111
|
+
ch = state.input.charCodeAt(++state.position);
|
|
3112
|
+
} else {
|
|
3113
|
+
tagHandle = "!";
|
|
3114
|
+
}
|
|
3115
|
+
_position = state.position;
|
|
3116
|
+
if (isVerbatim) {
|
|
3117
|
+
do {
|
|
3118
|
+
ch = state.input.charCodeAt(++state.position);
|
|
3119
|
+
} while (ch !== 0 && ch !== 62);
|
|
3120
|
+
if (state.position < state.length) {
|
|
3121
|
+
tagName = state.input.slice(_position, state.position);
|
|
3122
|
+
ch = state.input.charCodeAt(++state.position);
|
|
3123
|
+
} else {
|
|
3124
|
+
throwError(state, "unexpected end of the stream within a verbatim tag");
|
|
3125
|
+
}
|
|
3126
|
+
} else {
|
|
3127
|
+
while (ch !== 0 && !is_WS_OR_EOL(ch)) {
|
|
3128
|
+
if (ch === 33) {
|
|
3129
|
+
if (!isNamed) {
|
|
3130
|
+
tagHandle = state.input.slice(_position - 1, state.position + 1);
|
|
3131
|
+
if (!PATTERN_TAG_HANDLE.test(tagHandle)) {
|
|
3132
|
+
throwError(state, "named tag handle cannot contain such characters");
|
|
3133
|
+
}
|
|
3134
|
+
isNamed = true;
|
|
3135
|
+
_position = state.position + 1;
|
|
3136
|
+
} else {
|
|
3137
|
+
throwError(state, "tag suffix cannot contain exclamation marks");
|
|
3138
|
+
}
|
|
3139
|
+
}
|
|
3140
|
+
ch = state.input.charCodeAt(++state.position);
|
|
3141
|
+
}
|
|
3142
|
+
tagName = state.input.slice(_position, state.position);
|
|
3143
|
+
if (PATTERN_FLOW_INDICATORS.test(tagName)) {
|
|
3144
|
+
throwError(state, "tag suffix cannot contain flow indicator characters");
|
|
3145
|
+
}
|
|
3146
|
+
}
|
|
3147
|
+
if (tagName && !PATTERN_TAG_URI.test(tagName)) {
|
|
3148
|
+
throwError(state, "tag name cannot contain such characters: " + tagName);
|
|
3149
|
+
}
|
|
3150
|
+
try {
|
|
3151
|
+
tagName = decodeURIComponent(tagName);
|
|
3152
|
+
} catch (err) {
|
|
3153
|
+
throwError(state, "tag name is malformed: " + tagName);
|
|
3154
|
+
}
|
|
3155
|
+
if (isVerbatim) {
|
|
3156
|
+
state.tag = tagName;
|
|
3157
|
+
} else if (_hasOwnProperty$1.call(state.tagMap, tagHandle)) {
|
|
3158
|
+
state.tag = state.tagMap[tagHandle] + tagName;
|
|
3159
|
+
} else if (tagHandle === "!") {
|
|
3160
|
+
state.tag = "!" + tagName;
|
|
3161
|
+
} else if (tagHandle === "!!") {
|
|
3162
|
+
state.tag = "tag:yaml.org,2002:" + tagName;
|
|
3163
|
+
} else {
|
|
3164
|
+
throwError(state, 'undeclared tag handle "' + tagHandle + '"');
|
|
3165
|
+
}
|
|
3166
|
+
return true;
|
|
3167
|
+
}
|
|
3168
|
+
function readAnchorProperty(state) {
|
|
3169
|
+
var _position, ch;
|
|
3170
|
+
ch = state.input.charCodeAt(state.position);
|
|
3171
|
+
if (ch !== 38)
|
|
3172
|
+
return false;
|
|
3173
|
+
if (state.anchor !== null) {
|
|
3174
|
+
throwError(state, "duplication of an anchor property");
|
|
3175
|
+
}
|
|
3176
|
+
ch = state.input.charCodeAt(++state.position);
|
|
3177
|
+
_position = state.position;
|
|
3178
|
+
while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) {
|
|
3179
|
+
ch = state.input.charCodeAt(++state.position);
|
|
3180
|
+
}
|
|
3181
|
+
if (state.position === _position) {
|
|
3182
|
+
throwError(state, "name of an anchor node must contain at least one character");
|
|
3183
|
+
}
|
|
3184
|
+
state.anchor = state.input.slice(_position, state.position);
|
|
3185
|
+
return true;
|
|
3186
|
+
}
|
|
3187
|
+
function readAlias(state) {
|
|
3188
|
+
var _position, alias, ch;
|
|
3189
|
+
ch = state.input.charCodeAt(state.position);
|
|
3190
|
+
if (ch !== 42)
|
|
3191
|
+
return false;
|
|
3192
|
+
ch = state.input.charCodeAt(++state.position);
|
|
3193
|
+
_position = state.position;
|
|
3194
|
+
while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) {
|
|
3195
|
+
ch = state.input.charCodeAt(++state.position);
|
|
3196
|
+
}
|
|
3197
|
+
if (state.position === _position) {
|
|
3198
|
+
throwError(state, "name of an alias node must contain at least one character");
|
|
3199
|
+
}
|
|
3200
|
+
alias = state.input.slice(_position, state.position);
|
|
3201
|
+
if (!_hasOwnProperty$1.call(state.anchorMap, alias)) {
|
|
3202
|
+
throwError(state, 'unidentified alias "' + alias + '"');
|
|
3203
|
+
}
|
|
3204
|
+
state.result = state.anchorMap[alias];
|
|
3205
|
+
skipSeparationSpace(state, true, -1);
|
|
3206
|
+
return true;
|
|
3207
|
+
}
|
|
3208
|
+
function composeNode(state, parentIndent, nodeContext, allowToSeek, allowCompact) {
|
|
3209
|
+
var allowBlockStyles, allowBlockScalars, allowBlockCollections, indentStatus = 1, atNewLine = false, hasContent = false, typeIndex, typeQuantity, typeList, type2, flowIndent, blockIndent;
|
|
3210
|
+
if (state.listener !== null) {
|
|
3211
|
+
state.listener("open", state);
|
|
3212
|
+
}
|
|
3213
|
+
state.tag = null;
|
|
3214
|
+
state.anchor = null;
|
|
3215
|
+
state.kind = null;
|
|
3216
|
+
state.result = null;
|
|
3217
|
+
allowBlockStyles = allowBlockScalars = allowBlockCollections = CONTEXT_BLOCK_OUT === nodeContext || CONTEXT_BLOCK_IN === nodeContext;
|
|
3218
|
+
if (allowToSeek) {
|
|
3219
|
+
if (skipSeparationSpace(state, true, -1)) {
|
|
3220
|
+
atNewLine = true;
|
|
3221
|
+
if (state.lineIndent > parentIndent) {
|
|
3222
|
+
indentStatus = 1;
|
|
3223
|
+
} else if (state.lineIndent === parentIndent) {
|
|
3224
|
+
indentStatus = 0;
|
|
3225
|
+
} else if (state.lineIndent < parentIndent) {
|
|
3226
|
+
indentStatus = -1;
|
|
3227
|
+
}
|
|
3228
|
+
}
|
|
3229
|
+
}
|
|
3230
|
+
if (indentStatus === 1) {
|
|
3231
|
+
while (readTagProperty(state) || readAnchorProperty(state)) {
|
|
3232
|
+
if (skipSeparationSpace(state, true, -1)) {
|
|
3233
|
+
atNewLine = true;
|
|
3234
|
+
allowBlockCollections = allowBlockStyles;
|
|
3235
|
+
if (state.lineIndent > parentIndent) {
|
|
3236
|
+
indentStatus = 1;
|
|
3237
|
+
} else if (state.lineIndent === parentIndent) {
|
|
3238
|
+
indentStatus = 0;
|
|
3239
|
+
} else if (state.lineIndent < parentIndent) {
|
|
3240
|
+
indentStatus = -1;
|
|
3241
|
+
}
|
|
3242
|
+
} else {
|
|
3243
|
+
allowBlockCollections = false;
|
|
3244
|
+
}
|
|
3245
|
+
}
|
|
3246
|
+
}
|
|
3247
|
+
if (allowBlockCollections) {
|
|
3248
|
+
allowBlockCollections = atNewLine || allowCompact;
|
|
3249
|
+
}
|
|
3250
|
+
if (indentStatus === 1 || CONTEXT_BLOCK_OUT === nodeContext) {
|
|
3251
|
+
if (CONTEXT_FLOW_IN === nodeContext || CONTEXT_FLOW_OUT === nodeContext) {
|
|
3252
|
+
flowIndent = parentIndent;
|
|
3253
|
+
} else {
|
|
3254
|
+
flowIndent = parentIndent + 1;
|
|
3255
|
+
}
|
|
3256
|
+
blockIndent = state.position - state.lineStart;
|
|
3257
|
+
if (indentStatus === 1) {
|
|
3258
|
+
if (allowBlockCollections && (readBlockSequence(state, blockIndent) || readBlockMapping(state, blockIndent, flowIndent)) || readFlowCollection(state, flowIndent)) {
|
|
3259
|
+
hasContent = true;
|
|
3260
|
+
} else {
|
|
3261
|
+
if (allowBlockScalars && readBlockScalar(state, flowIndent) || readSingleQuotedScalar(state, flowIndent) || readDoubleQuotedScalar(state, flowIndent)) {
|
|
3262
|
+
hasContent = true;
|
|
3263
|
+
} else if (readAlias(state)) {
|
|
3264
|
+
hasContent = true;
|
|
3265
|
+
if (state.tag !== null || state.anchor !== null) {
|
|
3266
|
+
throwError(state, "alias node should not have any properties");
|
|
3267
|
+
}
|
|
3268
|
+
} else if (readPlainScalar(state, flowIndent, CONTEXT_FLOW_IN === nodeContext)) {
|
|
3269
|
+
hasContent = true;
|
|
3270
|
+
if (state.tag === null) {
|
|
3271
|
+
state.tag = "?";
|
|
3272
|
+
}
|
|
3273
|
+
}
|
|
3274
|
+
if (state.anchor !== null) {
|
|
3275
|
+
state.anchorMap[state.anchor] = state.result;
|
|
3276
|
+
}
|
|
3277
|
+
}
|
|
3278
|
+
} else if (indentStatus === 0) {
|
|
3279
|
+
hasContent = allowBlockCollections && readBlockSequence(state, blockIndent);
|
|
3280
|
+
}
|
|
3281
|
+
}
|
|
3282
|
+
if (state.tag === null) {
|
|
3283
|
+
if (state.anchor !== null) {
|
|
3284
|
+
state.anchorMap[state.anchor] = state.result;
|
|
3285
|
+
}
|
|
3286
|
+
} else if (state.tag === "?") {
|
|
3287
|
+
if (state.result !== null && state.kind !== "scalar") {
|
|
3288
|
+
throwError(state, 'unacceptable node kind for !<?> tag; it should be "scalar", not "' + state.kind + '"');
|
|
3289
|
+
}
|
|
3290
|
+
for (typeIndex = 0, typeQuantity = state.implicitTypes.length;typeIndex < typeQuantity; typeIndex += 1) {
|
|
3291
|
+
type2 = state.implicitTypes[typeIndex];
|
|
3292
|
+
if (type2.resolve(state.result)) {
|
|
3293
|
+
state.result = type2.construct(state.result);
|
|
3294
|
+
state.tag = type2.tag;
|
|
3295
|
+
if (state.anchor !== null) {
|
|
3296
|
+
state.anchorMap[state.anchor] = state.result;
|
|
3297
|
+
}
|
|
3298
|
+
break;
|
|
3299
|
+
}
|
|
3300
|
+
}
|
|
3301
|
+
} else if (state.tag !== "!") {
|
|
3302
|
+
if (_hasOwnProperty$1.call(state.typeMap[state.kind || "fallback"], state.tag)) {
|
|
3303
|
+
type2 = state.typeMap[state.kind || "fallback"][state.tag];
|
|
3304
|
+
} else {
|
|
3305
|
+
type2 = null;
|
|
3306
|
+
typeList = state.typeMap.multi[state.kind || "fallback"];
|
|
3307
|
+
for (typeIndex = 0, typeQuantity = typeList.length;typeIndex < typeQuantity; typeIndex += 1) {
|
|
3308
|
+
if (state.tag.slice(0, typeList[typeIndex].tag.length) === typeList[typeIndex].tag) {
|
|
3309
|
+
type2 = typeList[typeIndex];
|
|
3310
|
+
break;
|
|
3311
|
+
}
|
|
3312
|
+
}
|
|
3313
|
+
}
|
|
3314
|
+
if (!type2) {
|
|
3315
|
+
throwError(state, "unknown tag !<" + state.tag + ">");
|
|
3316
|
+
}
|
|
3317
|
+
if (state.result !== null && type2.kind !== state.kind) {
|
|
3318
|
+
throwError(state, "unacceptable node kind for !<" + state.tag + '> tag; it should be "' + type2.kind + '", not "' + state.kind + '"');
|
|
3319
|
+
}
|
|
3320
|
+
if (!type2.resolve(state.result, state.tag)) {
|
|
3321
|
+
throwError(state, "cannot resolve a node with !<" + state.tag + "> explicit tag");
|
|
3322
|
+
} else {
|
|
3323
|
+
state.result = type2.construct(state.result, state.tag);
|
|
3324
|
+
if (state.anchor !== null) {
|
|
3325
|
+
state.anchorMap[state.anchor] = state.result;
|
|
3326
|
+
}
|
|
3327
|
+
}
|
|
3328
|
+
}
|
|
3329
|
+
if (state.listener !== null) {
|
|
3330
|
+
state.listener("close", state);
|
|
3331
|
+
}
|
|
3332
|
+
return state.tag !== null || state.anchor !== null || hasContent;
|
|
3333
|
+
}
|
|
3334
|
+
function readDocument(state) {
|
|
3335
|
+
var documentStart = state.position, _position, directiveName, directiveArgs, hasDirectives = false, ch;
|
|
3336
|
+
state.version = null;
|
|
3337
|
+
state.checkLineBreaks = state.legacy;
|
|
3338
|
+
state.tagMap = Object.create(null);
|
|
3339
|
+
state.anchorMap = Object.create(null);
|
|
3340
|
+
while ((ch = state.input.charCodeAt(state.position)) !== 0) {
|
|
3341
|
+
skipSeparationSpace(state, true, -1);
|
|
3342
|
+
ch = state.input.charCodeAt(state.position);
|
|
3343
|
+
if (state.lineIndent > 0 || ch !== 37) {
|
|
3344
|
+
break;
|
|
3345
|
+
}
|
|
3346
|
+
hasDirectives = true;
|
|
3347
|
+
ch = state.input.charCodeAt(++state.position);
|
|
3348
|
+
_position = state.position;
|
|
3349
|
+
while (ch !== 0 && !is_WS_OR_EOL(ch)) {
|
|
3350
|
+
ch = state.input.charCodeAt(++state.position);
|
|
3351
|
+
}
|
|
3352
|
+
directiveName = state.input.slice(_position, state.position);
|
|
3353
|
+
directiveArgs = [];
|
|
3354
|
+
if (directiveName.length < 1) {
|
|
3355
|
+
throwError(state, "directive name must not be less than one character in length");
|
|
3356
|
+
}
|
|
3357
|
+
while (ch !== 0) {
|
|
3358
|
+
while (is_WHITE_SPACE(ch)) {
|
|
3359
|
+
ch = state.input.charCodeAt(++state.position);
|
|
3360
|
+
}
|
|
3361
|
+
if (ch === 35) {
|
|
3362
|
+
do {
|
|
3363
|
+
ch = state.input.charCodeAt(++state.position);
|
|
3364
|
+
} while (ch !== 0 && !is_EOL(ch));
|
|
3365
|
+
break;
|
|
3366
|
+
}
|
|
3367
|
+
if (is_EOL(ch))
|
|
3368
|
+
break;
|
|
3369
|
+
_position = state.position;
|
|
3370
|
+
while (ch !== 0 && !is_WS_OR_EOL(ch)) {
|
|
3371
|
+
ch = state.input.charCodeAt(++state.position);
|
|
3372
|
+
}
|
|
3373
|
+
directiveArgs.push(state.input.slice(_position, state.position));
|
|
3374
|
+
}
|
|
3375
|
+
if (ch !== 0)
|
|
3376
|
+
readLineBreak(state);
|
|
3377
|
+
if (_hasOwnProperty$1.call(directiveHandlers, directiveName)) {
|
|
3378
|
+
directiveHandlers[directiveName](state, directiveName, directiveArgs);
|
|
3379
|
+
} else {
|
|
3380
|
+
throwWarning(state, 'unknown document directive "' + directiveName + '"');
|
|
3381
|
+
}
|
|
3382
|
+
}
|
|
3383
|
+
skipSeparationSpace(state, true, -1);
|
|
3384
|
+
if (state.lineIndent === 0 && state.input.charCodeAt(state.position) === 45 && state.input.charCodeAt(state.position + 1) === 45 && state.input.charCodeAt(state.position + 2) === 45) {
|
|
3385
|
+
state.position += 3;
|
|
3386
|
+
skipSeparationSpace(state, true, -1);
|
|
3387
|
+
} else if (hasDirectives) {
|
|
3388
|
+
throwError(state, "directives end mark is expected");
|
|
3389
|
+
}
|
|
3390
|
+
composeNode(state, state.lineIndent - 1, CONTEXT_BLOCK_OUT, false, true);
|
|
3391
|
+
skipSeparationSpace(state, true, -1);
|
|
3392
|
+
if (state.checkLineBreaks && PATTERN_NON_ASCII_LINE_BREAKS.test(state.input.slice(documentStart, state.position))) {
|
|
3393
|
+
throwWarning(state, "non-ASCII line breaks are interpreted as content");
|
|
3394
|
+
}
|
|
3395
|
+
state.documents.push(state.result);
|
|
3396
|
+
if (state.position === state.lineStart && testDocumentSeparator(state)) {
|
|
3397
|
+
if (state.input.charCodeAt(state.position) === 46) {
|
|
3398
|
+
state.position += 3;
|
|
3399
|
+
skipSeparationSpace(state, true, -1);
|
|
3400
|
+
}
|
|
3401
|
+
return;
|
|
3402
|
+
}
|
|
3403
|
+
if (state.position < state.length - 1) {
|
|
3404
|
+
throwError(state, "end of the stream or a document separator is expected");
|
|
3405
|
+
} else {
|
|
3406
|
+
return;
|
|
3407
|
+
}
|
|
3408
|
+
}
|
|
3409
|
+
function loadDocuments(input, options) {
|
|
3410
|
+
input = String(input);
|
|
3411
|
+
options = options || {};
|
|
3412
|
+
if (input.length !== 0) {
|
|
3413
|
+
if (input.charCodeAt(input.length - 1) !== 10 && input.charCodeAt(input.length - 1) !== 13) {
|
|
3414
|
+
input += `
|
|
3415
|
+
`;
|
|
3416
|
+
}
|
|
3417
|
+
if (input.charCodeAt(0) === 65279) {
|
|
3418
|
+
input = input.slice(1);
|
|
3419
|
+
}
|
|
3420
|
+
}
|
|
3421
|
+
var state = new State$1(input, options);
|
|
3422
|
+
var nullpos = input.indexOf("\x00");
|
|
3423
|
+
if (nullpos !== -1) {
|
|
3424
|
+
state.position = nullpos;
|
|
3425
|
+
throwError(state, "null byte is not allowed in input");
|
|
3426
|
+
}
|
|
3427
|
+
state.input += "\x00";
|
|
3428
|
+
while (state.input.charCodeAt(state.position) === 32) {
|
|
3429
|
+
state.lineIndent += 1;
|
|
3430
|
+
state.position += 1;
|
|
3431
|
+
}
|
|
3432
|
+
while (state.position < state.length - 1) {
|
|
3433
|
+
readDocument(state);
|
|
3434
|
+
}
|
|
3435
|
+
return state.documents;
|
|
3436
|
+
}
|
|
3437
|
+
function loadAll$1(input, iterator, options) {
|
|
3438
|
+
if (iterator !== null && typeof iterator === "object" && typeof options === "undefined") {
|
|
3439
|
+
options = iterator;
|
|
3440
|
+
iterator = null;
|
|
3441
|
+
}
|
|
3442
|
+
var documents = loadDocuments(input, options);
|
|
3443
|
+
if (typeof iterator !== "function") {
|
|
3444
|
+
return documents;
|
|
3445
|
+
}
|
|
3446
|
+
for (var index = 0, length = documents.length;index < length; index += 1) {
|
|
3447
|
+
iterator(documents[index]);
|
|
3448
|
+
}
|
|
3449
|
+
}
|
|
3450
|
+
function load$1(input, options) {
|
|
3451
|
+
var documents = loadDocuments(input, options);
|
|
3452
|
+
if (documents.length === 0) {
|
|
3453
|
+
return;
|
|
3454
|
+
} else if (documents.length === 1) {
|
|
3455
|
+
return documents[0];
|
|
3456
|
+
}
|
|
3457
|
+
throw new exception("expected a single document in the stream, but found more");
|
|
3458
|
+
}
|
|
3459
|
+
function compileStyleMap(schema2, map2) {
|
|
3460
|
+
var result, keys, index, length, tag, style, type2;
|
|
3461
|
+
if (map2 === null)
|
|
3462
|
+
return {};
|
|
3463
|
+
result = {};
|
|
3464
|
+
keys = Object.keys(map2);
|
|
3465
|
+
for (index = 0, length = keys.length;index < length; index += 1) {
|
|
3466
|
+
tag = keys[index];
|
|
3467
|
+
style = String(map2[tag]);
|
|
3468
|
+
if (tag.slice(0, 2) === "!!") {
|
|
3469
|
+
tag = "tag:yaml.org,2002:" + tag.slice(2);
|
|
3470
|
+
}
|
|
3471
|
+
type2 = schema2.compiledTypeMap["fallback"][tag];
|
|
3472
|
+
if (type2 && _hasOwnProperty.call(type2.styleAliases, style)) {
|
|
3473
|
+
style = type2.styleAliases[style];
|
|
3474
|
+
}
|
|
3475
|
+
result[tag] = style;
|
|
3476
|
+
}
|
|
3477
|
+
return result;
|
|
3478
|
+
}
|
|
3479
|
+
function encodeHex(character) {
|
|
3480
|
+
var string2, handle, length;
|
|
3481
|
+
string2 = character.toString(16).toUpperCase();
|
|
3482
|
+
if (character <= 255) {
|
|
3483
|
+
handle = "x";
|
|
3484
|
+
length = 2;
|
|
3485
|
+
} else if (character <= 65535) {
|
|
3486
|
+
handle = "u";
|
|
3487
|
+
length = 4;
|
|
3488
|
+
} else if (character <= 4294967295) {
|
|
3489
|
+
handle = "U";
|
|
3490
|
+
length = 8;
|
|
3491
|
+
} else {
|
|
3492
|
+
throw new exception("code point within a string may not be greater than 0xFFFFFFFF");
|
|
3493
|
+
}
|
|
3494
|
+
return "\\" + handle + common.repeat("0", length - string2.length) + string2;
|
|
3495
|
+
}
|
|
3496
|
+
function State(options) {
|
|
3497
|
+
this.schema = options["schema"] || _default;
|
|
3498
|
+
this.indent = Math.max(1, options["indent"] || 2);
|
|
3499
|
+
this.noArrayIndent = options["noArrayIndent"] || false;
|
|
3500
|
+
this.skipInvalid = options["skipInvalid"] || false;
|
|
3501
|
+
this.flowLevel = common.isNothing(options["flowLevel"]) ? -1 : options["flowLevel"];
|
|
3502
|
+
this.styleMap = compileStyleMap(this.schema, options["styles"] || null);
|
|
3503
|
+
this.sortKeys = options["sortKeys"] || false;
|
|
3504
|
+
this.lineWidth = options["lineWidth"] || 80;
|
|
3505
|
+
this.noRefs = options["noRefs"] || false;
|
|
3506
|
+
this.noCompatMode = options["noCompatMode"] || false;
|
|
3507
|
+
this.condenseFlow = options["condenseFlow"] || false;
|
|
3508
|
+
this.quotingType = options["quotingType"] === '"' ? QUOTING_TYPE_DOUBLE : QUOTING_TYPE_SINGLE;
|
|
3509
|
+
this.forceQuotes = options["forceQuotes"] || false;
|
|
3510
|
+
this.replacer = typeof options["replacer"] === "function" ? options["replacer"] : null;
|
|
3511
|
+
this.implicitTypes = this.schema.compiledImplicit;
|
|
3512
|
+
this.explicitTypes = this.schema.compiledExplicit;
|
|
3513
|
+
this.tag = null;
|
|
3514
|
+
this.result = "";
|
|
3515
|
+
this.duplicates = [];
|
|
3516
|
+
this.usedDuplicates = null;
|
|
3517
|
+
}
|
|
3518
|
+
function indentString(string2, spaces) {
|
|
3519
|
+
var ind = common.repeat(" ", spaces), position = 0, next = -1, result = "", line, length = string2.length;
|
|
3520
|
+
while (position < length) {
|
|
3521
|
+
next = string2.indexOf(`
|
|
3522
|
+
`, position);
|
|
3523
|
+
if (next === -1) {
|
|
3524
|
+
line = string2.slice(position);
|
|
3525
|
+
position = length;
|
|
3526
|
+
} else {
|
|
3527
|
+
line = string2.slice(position, next + 1);
|
|
3528
|
+
position = next + 1;
|
|
3529
|
+
}
|
|
3530
|
+
if (line.length && line !== `
|
|
3531
|
+
`)
|
|
3532
|
+
result += ind;
|
|
3533
|
+
result += line;
|
|
3534
|
+
}
|
|
3535
|
+
return result;
|
|
3536
|
+
}
|
|
3537
|
+
function generateNextLine(state, level) {
|
|
3538
|
+
return `
|
|
3539
|
+
` + common.repeat(" ", state.indent * level);
|
|
3540
|
+
}
|
|
3541
|
+
function testImplicitResolving(state, str2) {
|
|
3542
|
+
var index, length, type2;
|
|
3543
|
+
for (index = 0, length = state.implicitTypes.length;index < length; index += 1) {
|
|
3544
|
+
type2 = state.implicitTypes[index];
|
|
3545
|
+
if (type2.resolve(str2)) {
|
|
3546
|
+
return true;
|
|
3547
|
+
}
|
|
3548
|
+
}
|
|
3549
|
+
return false;
|
|
3550
|
+
}
|
|
3551
|
+
function isWhitespace(c) {
|
|
3552
|
+
return c === CHAR_SPACE || c === CHAR_TAB;
|
|
3553
|
+
}
|
|
3554
|
+
function isPrintable(c) {
|
|
3555
|
+
return 32 <= c && c <= 126 || 161 <= c && c <= 55295 && c !== 8232 && c !== 8233 || 57344 <= c && c <= 65533 && c !== CHAR_BOM || 65536 <= c && c <= 1114111;
|
|
3556
|
+
}
|
|
3557
|
+
function isNsCharOrWhitespace(c) {
|
|
3558
|
+
return isPrintable(c) && c !== CHAR_BOM && c !== CHAR_CARRIAGE_RETURN && c !== CHAR_LINE_FEED;
|
|
3559
|
+
}
|
|
3560
|
+
function isPlainSafe(c, prev, inblock) {
|
|
3561
|
+
var cIsNsCharOrWhitespace = isNsCharOrWhitespace(c);
|
|
3562
|
+
var cIsNsChar = cIsNsCharOrWhitespace && !isWhitespace(c);
|
|
3563
|
+
return (inblock ? cIsNsCharOrWhitespace : cIsNsCharOrWhitespace && c !== CHAR_COMMA && c !== CHAR_LEFT_SQUARE_BRACKET && c !== CHAR_RIGHT_SQUARE_BRACKET && c !== CHAR_LEFT_CURLY_BRACKET && c !== CHAR_RIGHT_CURLY_BRACKET) && c !== CHAR_SHARP && !(prev === CHAR_COLON && !cIsNsChar) || isNsCharOrWhitespace(prev) && !isWhitespace(prev) && c === CHAR_SHARP || prev === CHAR_COLON && cIsNsChar;
|
|
3564
|
+
}
|
|
3565
|
+
function isPlainSafeFirst(c) {
|
|
3566
|
+
return isPrintable(c) && c !== CHAR_BOM && !isWhitespace(c) && c !== CHAR_MINUS && c !== CHAR_QUESTION && c !== CHAR_COLON && c !== CHAR_COMMA && c !== CHAR_LEFT_SQUARE_BRACKET && c !== CHAR_RIGHT_SQUARE_BRACKET && c !== CHAR_LEFT_CURLY_BRACKET && c !== CHAR_RIGHT_CURLY_BRACKET && c !== CHAR_SHARP && c !== CHAR_AMPERSAND && c !== CHAR_ASTERISK && c !== CHAR_EXCLAMATION && c !== CHAR_VERTICAL_LINE && c !== CHAR_EQUALS && c !== CHAR_GREATER_THAN && c !== CHAR_SINGLE_QUOTE && c !== CHAR_DOUBLE_QUOTE && c !== CHAR_PERCENT && c !== CHAR_COMMERCIAL_AT && c !== CHAR_GRAVE_ACCENT;
|
|
3567
|
+
}
|
|
3568
|
+
function isPlainSafeLast(c) {
|
|
3569
|
+
return !isWhitespace(c) && c !== CHAR_COLON;
|
|
3570
|
+
}
|
|
3571
|
+
function codePointAt(string2, pos) {
|
|
3572
|
+
var first = string2.charCodeAt(pos), second;
|
|
3573
|
+
if (first >= 55296 && first <= 56319 && pos + 1 < string2.length) {
|
|
3574
|
+
second = string2.charCodeAt(pos + 1);
|
|
3575
|
+
if (second >= 56320 && second <= 57343) {
|
|
3576
|
+
return (first - 55296) * 1024 + second - 56320 + 65536;
|
|
3577
|
+
}
|
|
3578
|
+
}
|
|
3579
|
+
return first;
|
|
3580
|
+
}
|
|
3581
|
+
function needIndentIndicator(string2) {
|
|
3582
|
+
var leadingSpaceRe = /^\n* /;
|
|
3583
|
+
return leadingSpaceRe.test(string2);
|
|
3584
|
+
}
|
|
3585
|
+
function chooseScalarStyle(string2, singleLineOnly, indentPerLevel, lineWidth, testAmbiguousType, quotingType, forceQuotes, inblock) {
|
|
3586
|
+
var i2;
|
|
3587
|
+
var char = 0;
|
|
3588
|
+
var prevChar = null;
|
|
3589
|
+
var hasLineBreak = false;
|
|
3590
|
+
var hasFoldableLine = false;
|
|
3591
|
+
var shouldTrackWidth = lineWidth !== -1;
|
|
3592
|
+
var previousLineBreak = -1;
|
|
3593
|
+
var plain = isPlainSafeFirst(codePointAt(string2, 0)) && isPlainSafeLast(codePointAt(string2, string2.length - 1));
|
|
3594
|
+
if (singleLineOnly || forceQuotes) {
|
|
3595
|
+
for (i2 = 0;i2 < string2.length; char >= 65536 ? i2 += 2 : i2++) {
|
|
3596
|
+
char = codePointAt(string2, i2);
|
|
3597
|
+
if (!isPrintable(char)) {
|
|
3598
|
+
return STYLE_DOUBLE;
|
|
3599
|
+
}
|
|
3600
|
+
plain = plain && isPlainSafe(char, prevChar, inblock);
|
|
3601
|
+
prevChar = char;
|
|
3602
|
+
}
|
|
3603
|
+
} else {
|
|
3604
|
+
for (i2 = 0;i2 < string2.length; char >= 65536 ? i2 += 2 : i2++) {
|
|
3605
|
+
char = codePointAt(string2, i2);
|
|
3606
|
+
if (char === CHAR_LINE_FEED) {
|
|
3607
|
+
hasLineBreak = true;
|
|
3608
|
+
if (shouldTrackWidth) {
|
|
3609
|
+
hasFoldableLine = hasFoldableLine || i2 - previousLineBreak - 1 > lineWidth && string2[previousLineBreak + 1] !== " ";
|
|
3610
|
+
previousLineBreak = i2;
|
|
3611
|
+
}
|
|
3612
|
+
} else if (!isPrintable(char)) {
|
|
3613
|
+
return STYLE_DOUBLE;
|
|
3614
|
+
}
|
|
3615
|
+
plain = plain && isPlainSafe(char, prevChar, inblock);
|
|
3616
|
+
prevChar = char;
|
|
3617
|
+
}
|
|
3618
|
+
hasFoldableLine = hasFoldableLine || shouldTrackWidth && (i2 - previousLineBreak - 1 > lineWidth && string2[previousLineBreak + 1] !== " ");
|
|
3619
|
+
}
|
|
3620
|
+
if (!hasLineBreak && !hasFoldableLine) {
|
|
3621
|
+
if (plain && !forceQuotes && !testAmbiguousType(string2)) {
|
|
3622
|
+
return STYLE_PLAIN;
|
|
3623
|
+
}
|
|
3624
|
+
return quotingType === QUOTING_TYPE_DOUBLE ? STYLE_DOUBLE : STYLE_SINGLE;
|
|
3625
|
+
}
|
|
3626
|
+
if (indentPerLevel > 9 && needIndentIndicator(string2)) {
|
|
3627
|
+
return STYLE_DOUBLE;
|
|
3628
|
+
}
|
|
3629
|
+
if (!forceQuotes) {
|
|
3630
|
+
return hasFoldableLine ? STYLE_FOLDED : STYLE_LITERAL;
|
|
3631
|
+
}
|
|
3632
|
+
return quotingType === QUOTING_TYPE_DOUBLE ? STYLE_DOUBLE : STYLE_SINGLE;
|
|
3633
|
+
}
|
|
3634
|
+
function writeScalar(state, string2, level, iskey, inblock) {
|
|
3635
|
+
state.dump = function() {
|
|
3636
|
+
if (string2.length === 0) {
|
|
3637
|
+
return state.quotingType === QUOTING_TYPE_DOUBLE ? '""' : "''";
|
|
3638
|
+
}
|
|
3639
|
+
if (!state.noCompatMode) {
|
|
3640
|
+
if (DEPRECATED_BOOLEANS_SYNTAX.indexOf(string2) !== -1 || DEPRECATED_BASE60_SYNTAX.test(string2)) {
|
|
3641
|
+
return state.quotingType === QUOTING_TYPE_DOUBLE ? '"' + string2 + '"' : "'" + string2 + "'";
|
|
3642
|
+
}
|
|
3643
|
+
}
|
|
3644
|
+
var indent = state.indent * Math.max(1, level);
|
|
3645
|
+
var lineWidth = state.lineWidth === -1 ? -1 : Math.max(Math.min(state.lineWidth, 40), state.lineWidth - indent);
|
|
3646
|
+
var singleLineOnly = iskey || state.flowLevel > -1 && level >= state.flowLevel;
|
|
3647
|
+
function testAmbiguity(string3) {
|
|
3648
|
+
return testImplicitResolving(state, string3);
|
|
3649
|
+
}
|
|
3650
|
+
switch (chooseScalarStyle(string2, singleLineOnly, state.indent, lineWidth, testAmbiguity, state.quotingType, state.forceQuotes && !iskey, inblock)) {
|
|
3651
|
+
case STYLE_PLAIN:
|
|
3652
|
+
return string2;
|
|
3653
|
+
case STYLE_SINGLE:
|
|
3654
|
+
return "'" + string2.replace(/'/g, "''") + "'";
|
|
3655
|
+
case STYLE_LITERAL:
|
|
3656
|
+
return "|" + blockHeader(string2, state.indent) + dropEndingNewline(indentString(string2, indent));
|
|
3657
|
+
case STYLE_FOLDED:
|
|
3658
|
+
return ">" + blockHeader(string2, state.indent) + dropEndingNewline(indentString(foldString(string2, lineWidth), indent));
|
|
3659
|
+
case STYLE_DOUBLE:
|
|
3660
|
+
return '"' + escapeString(string2) + '"';
|
|
3661
|
+
default:
|
|
3662
|
+
throw new exception("impossible error: invalid scalar style");
|
|
3663
|
+
}
|
|
3664
|
+
}();
|
|
3665
|
+
}
|
|
3666
|
+
function blockHeader(string2, indentPerLevel) {
|
|
3667
|
+
var indentIndicator = needIndentIndicator(string2) ? String(indentPerLevel) : "";
|
|
3668
|
+
var clip = string2[string2.length - 1] === `
|
|
3669
|
+
`;
|
|
3670
|
+
var keep = clip && (string2[string2.length - 2] === `
|
|
3671
|
+
` || string2 === `
|
|
3672
|
+
`);
|
|
3673
|
+
var chomp = keep ? "+" : clip ? "" : "-";
|
|
3674
|
+
return indentIndicator + chomp + `
|
|
3675
|
+
`;
|
|
3676
|
+
}
|
|
3677
|
+
function dropEndingNewline(string2) {
|
|
3678
|
+
return string2[string2.length - 1] === `
|
|
3679
|
+
` ? string2.slice(0, -1) : string2;
|
|
3680
|
+
}
|
|
3681
|
+
function foldString(string2, width) {
|
|
3682
|
+
var lineRe = /(\n+)([^\n]*)/g;
|
|
3683
|
+
var result = function() {
|
|
3684
|
+
var nextLF = string2.indexOf(`
|
|
3685
|
+
`);
|
|
3686
|
+
nextLF = nextLF !== -1 ? nextLF : string2.length;
|
|
3687
|
+
lineRe.lastIndex = nextLF;
|
|
3688
|
+
return foldLine(string2.slice(0, nextLF), width);
|
|
3689
|
+
}();
|
|
3690
|
+
var prevMoreIndented = string2[0] === `
|
|
3691
|
+
` || string2[0] === " ";
|
|
3692
|
+
var moreIndented;
|
|
3693
|
+
var match;
|
|
3694
|
+
while (match = lineRe.exec(string2)) {
|
|
3695
|
+
var prefix = match[1], line = match[2];
|
|
3696
|
+
moreIndented = line[0] === " ";
|
|
3697
|
+
result += prefix + (!prevMoreIndented && !moreIndented && line !== "" ? `
|
|
3698
|
+
` : "") + foldLine(line, width);
|
|
3699
|
+
prevMoreIndented = moreIndented;
|
|
3700
|
+
}
|
|
3701
|
+
return result;
|
|
3702
|
+
}
|
|
3703
|
+
function foldLine(line, width) {
|
|
3704
|
+
if (line === "" || line[0] === " ")
|
|
3705
|
+
return line;
|
|
3706
|
+
var breakRe = / [^ ]/g;
|
|
3707
|
+
var match;
|
|
3708
|
+
var start = 0, end, curr = 0, next = 0;
|
|
3709
|
+
var result = "";
|
|
3710
|
+
while (match = breakRe.exec(line)) {
|
|
3711
|
+
next = match.index;
|
|
3712
|
+
if (next - start > width) {
|
|
3713
|
+
end = curr > start ? curr : next;
|
|
3714
|
+
result += `
|
|
3715
|
+
` + line.slice(start, end);
|
|
3716
|
+
start = end + 1;
|
|
3717
|
+
}
|
|
3718
|
+
curr = next;
|
|
3719
|
+
}
|
|
3720
|
+
result += `
|
|
3721
|
+
`;
|
|
3722
|
+
if (line.length - start > width && curr > start) {
|
|
3723
|
+
result += line.slice(start, curr) + `
|
|
3724
|
+
` + line.slice(curr + 1);
|
|
3725
|
+
} else {
|
|
3726
|
+
result += line.slice(start);
|
|
3727
|
+
}
|
|
3728
|
+
return result.slice(1);
|
|
3729
|
+
}
|
|
3730
|
+
function escapeString(string2) {
|
|
3731
|
+
var result = "";
|
|
3732
|
+
var char = 0;
|
|
3733
|
+
var escapeSeq;
|
|
3734
|
+
for (var i2 = 0;i2 < string2.length; char >= 65536 ? i2 += 2 : i2++) {
|
|
3735
|
+
char = codePointAt(string2, i2);
|
|
3736
|
+
escapeSeq = ESCAPE_SEQUENCES[char];
|
|
3737
|
+
if (!escapeSeq && isPrintable(char)) {
|
|
3738
|
+
result += string2[i2];
|
|
3739
|
+
if (char >= 65536)
|
|
3740
|
+
result += string2[i2 + 1];
|
|
3741
|
+
} else {
|
|
3742
|
+
result += escapeSeq || encodeHex(char);
|
|
3743
|
+
}
|
|
3744
|
+
}
|
|
3745
|
+
return result;
|
|
3746
|
+
}
|
|
3747
|
+
function writeFlowSequence(state, level, object2) {
|
|
3748
|
+
var _result = "", _tag = state.tag, index, length, value;
|
|
3749
|
+
for (index = 0, length = object2.length;index < length; index += 1) {
|
|
3750
|
+
value = object2[index];
|
|
3751
|
+
if (state.replacer) {
|
|
3752
|
+
value = state.replacer.call(object2, String(index), value);
|
|
3753
|
+
}
|
|
3754
|
+
if (writeNode(state, level, value, false, false) || typeof value === "undefined" && writeNode(state, level, null, false, false)) {
|
|
3755
|
+
if (_result !== "")
|
|
3756
|
+
_result += "," + (!state.condenseFlow ? " " : "");
|
|
3757
|
+
_result += state.dump;
|
|
3758
|
+
}
|
|
3759
|
+
}
|
|
3760
|
+
state.tag = _tag;
|
|
3761
|
+
state.dump = "[" + _result + "]";
|
|
3762
|
+
}
|
|
3763
|
+
function writeBlockSequence(state, level, object2, compact) {
|
|
3764
|
+
var _result = "", _tag = state.tag, index, length, value;
|
|
3765
|
+
for (index = 0, length = object2.length;index < length; index += 1) {
|
|
3766
|
+
value = object2[index];
|
|
3767
|
+
if (state.replacer) {
|
|
3768
|
+
value = state.replacer.call(object2, String(index), value);
|
|
3769
|
+
}
|
|
3770
|
+
if (writeNode(state, level + 1, value, true, true, false, true) || typeof value === "undefined" && writeNode(state, level + 1, null, true, true, false, true)) {
|
|
3771
|
+
if (!compact || _result !== "") {
|
|
3772
|
+
_result += generateNextLine(state, level);
|
|
3773
|
+
}
|
|
3774
|
+
if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {
|
|
3775
|
+
_result += "-";
|
|
3776
|
+
} else {
|
|
3777
|
+
_result += "- ";
|
|
3778
|
+
}
|
|
3779
|
+
_result += state.dump;
|
|
3780
|
+
}
|
|
3781
|
+
}
|
|
3782
|
+
state.tag = _tag;
|
|
3783
|
+
state.dump = _result || "[]";
|
|
3784
|
+
}
|
|
3785
|
+
function writeFlowMapping(state, level, object2) {
|
|
3786
|
+
var _result = "", _tag = state.tag, objectKeyList = Object.keys(object2), index, length, objectKey, objectValue, pairBuffer;
|
|
3787
|
+
for (index = 0, length = objectKeyList.length;index < length; index += 1) {
|
|
3788
|
+
pairBuffer = "";
|
|
3789
|
+
if (_result !== "")
|
|
3790
|
+
pairBuffer += ", ";
|
|
3791
|
+
if (state.condenseFlow)
|
|
3792
|
+
pairBuffer += '"';
|
|
3793
|
+
objectKey = objectKeyList[index];
|
|
3794
|
+
objectValue = object2[objectKey];
|
|
3795
|
+
if (state.replacer) {
|
|
3796
|
+
objectValue = state.replacer.call(object2, objectKey, objectValue);
|
|
3797
|
+
}
|
|
3798
|
+
if (!writeNode(state, level, objectKey, false, false)) {
|
|
3799
|
+
continue;
|
|
3800
|
+
}
|
|
3801
|
+
if (state.dump.length > 1024)
|
|
3802
|
+
pairBuffer += "? ";
|
|
3803
|
+
pairBuffer += state.dump + (state.condenseFlow ? '"' : "") + ":" + (state.condenseFlow ? "" : " ");
|
|
3804
|
+
if (!writeNode(state, level, objectValue, false, false)) {
|
|
3805
|
+
continue;
|
|
3806
|
+
}
|
|
3807
|
+
pairBuffer += state.dump;
|
|
3808
|
+
_result += pairBuffer;
|
|
3809
|
+
}
|
|
3810
|
+
state.tag = _tag;
|
|
3811
|
+
state.dump = "{" + _result + "}";
|
|
3812
|
+
}
|
|
3813
|
+
function writeBlockMapping(state, level, object2, compact) {
|
|
3814
|
+
var _result = "", _tag = state.tag, objectKeyList = Object.keys(object2), index, length, objectKey, objectValue, explicitPair, pairBuffer;
|
|
3815
|
+
if (state.sortKeys === true) {
|
|
3816
|
+
objectKeyList.sort();
|
|
3817
|
+
} else if (typeof state.sortKeys === "function") {
|
|
3818
|
+
objectKeyList.sort(state.sortKeys);
|
|
3819
|
+
} else if (state.sortKeys) {
|
|
3820
|
+
throw new exception("sortKeys must be a boolean or a function");
|
|
3821
|
+
}
|
|
3822
|
+
for (index = 0, length = objectKeyList.length;index < length; index += 1) {
|
|
3823
|
+
pairBuffer = "";
|
|
3824
|
+
if (!compact || _result !== "") {
|
|
3825
|
+
pairBuffer += generateNextLine(state, level);
|
|
3826
|
+
}
|
|
3827
|
+
objectKey = objectKeyList[index];
|
|
3828
|
+
objectValue = object2[objectKey];
|
|
3829
|
+
if (state.replacer) {
|
|
3830
|
+
objectValue = state.replacer.call(object2, objectKey, objectValue);
|
|
3831
|
+
}
|
|
3832
|
+
if (!writeNode(state, level + 1, objectKey, true, true, true)) {
|
|
3833
|
+
continue;
|
|
3834
|
+
}
|
|
3835
|
+
explicitPair = state.tag !== null && state.tag !== "?" || state.dump && state.dump.length > 1024;
|
|
3836
|
+
if (explicitPair) {
|
|
3837
|
+
if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {
|
|
3838
|
+
pairBuffer += "?";
|
|
3839
|
+
} else {
|
|
3840
|
+
pairBuffer += "? ";
|
|
3841
|
+
}
|
|
3842
|
+
}
|
|
3843
|
+
pairBuffer += state.dump;
|
|
3844
|
+
if (explicitPair) {
|
|
3845
|
+
pairBuffer += generateNextLine(state, level);
|
|
3846
|
+
}
|
|
3847
|
+
if (!writeNode(state, level + 1, objectValue, true, explicitPair)) {
|
|
3848
|
+
continue;
|
|
3849
|
+
}
|
|
3850
|
+
if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {
|
|
3851
|
+
pairBuffer += ":";
|
|
3852
|
+
} else {
|
|
3853
|
+
pairBuffer += ": ";
|
|
3854
|
+
}
|
|
3855
|
+
pairBuffer += state.dump;
|
|
3856
|
+
_result += pairBuffer;
|
|
3857
|
+
}
|
|
3858
|
+
state.tag = _tag;
|
|
3859
|
+
state.dump = _result || "{}";
|
|
3860
|
+
}
|
|
3861
|
+
function detectType(state, object2, explicit) {
|
|
3862
|
+
var _result, typeList, index, length, type2, style;
|
|
3863
|
+
typeList = explicit ? state.explicitTypes : state.implicitTypes;
|
|
3864
|
+
for (index = 0, length = typeList.length;index < length; index += 1) {
|
|
3865
|
+
type2 = typeList[index];
|
|
3866
|
+
if ((type2.instanceOf || type2.predicate) && (!type2.instanceOf || typeof object2 === "object" && object2 instanceof type2.instanceOf) && (!type2.predicate || type2.predicate(object2))) {
|
|
3867
|
+
if (explicit) {
|
|
3868
|
+
if (type2.multi && type2.representName) {
|
|
3869
|
+
state.tag = type2.representName(object2);
|
|
3870
|
+
} else {
|
|
3871
|
+
state.tag = type2.tag;
|
|
3872
|
+
}
|
|
3873
|
+
} else {
|
|
3874
|
+
state.tag = "?";
|
|
3875
|
+
}
|
|
3876
|
+
if (type2.represent) {
|
|
3877
|
+
style = state.styleMap[type2.tag] || type2.defaultStyle;
|
|
3878
|
+
if (_toString.call(type2.represent) === "[object Function]") {
|
|
3879
|
+
_result = type2.represent(object2, style);
|
|
3880
|
+
} else if (_hasOwnProperty.call(type2.represent, style)) {
|
|
3881
|
+
_result = type2.represent[style](object2, style);
|
|
3882
|
+
} else {
|
|
3883
|
+
throw new exception("!<" + type2.tag + '> tag resolver accepts not "' + style + '" style');
|
|
3884
|
+
}
|
|
3885
|
+
state.dump = _result;
|
|
3886
|
+
}
|
|
3887
|
+
return true;
|
|
3888
|
+
}
|
|
3889
|
+
}
|
|
3890
|
+
return false;
|
|
3891
|
+
}
|
|
3892
|
+
function writeNode(state, level, object2, block, compact, iskey, isblockseq) {
|
|
3893
|
+
state.tag = null;
|
|
3894
|
+
state.dump = object2;
|
|
3895
|
+
if (!detectType(state, object2, false)) {
|
|
3896
|
+
detectType(state, object2, true);
|
|
3897
|
+
}
|
|
3898
|
+
var type2 = _toString.call(state.dump);
|
|
3899
|
+
var inblock = block;
|
|
3900
|
+
var tagStr;
|
|
3901
|
+
if (block) {
|
|
3902
|
+
block = state.flowLevel < 0 || state.flowLevel > level;
|
|
3903
|
+
}
|
|
3904
|
+
var objectOrArray = type2 === "[object Object]" || type2 === "[object Array]", duplicateIndex, duplicate;
|
|
3905
|
+
if (objectOrArray) {
|
|
3906
|
+
duplicateIndex = state.duplicates.indexOf(object2);
|
|
3907
|
+
duplicate = duplicateIndex !== -1;
|
|
3908
|
+
}
|
|
3909
|
+
if (state.tag !== null && state.tag !== "?" || duplicate || state.indent !== 2 && level > 0) {
|
|
3910
|
+
compact = false;
|
|
3911
|
+
}
|
|
3912
|
+
if (duplicate && state.usedDuplicates[duplicateIndex]) {
|
|
3913
|
+
state.dump = "*ref_" + duplicateIndex;
|
|
3914
|
+
} else {
|
|
3915
|
+
if (objectOrArray && duplicate && !state.usedDuplicates[duplicateIndex]) {
|
|
3916
|
+
state.usedDuplicates[duplicateIndex] = true;
|
|
3917
|
+
}
|
|
3918
|
+
if (type2 === "[object Object]") {
|
|
3919
|
+
if (block && Object.keys(state.dump).length !== 0) {
|
|
3920
|
+
writeBlockMapping(state, level, state.dump, compact);
|
|
3921
|
+
if (duplicate) {
|
|
3922
|
+
state.dump = "&ref_" + duplicateIndex + state.dump;
|
|
3923
|
+
}
|
|
3924
|
+
} else {
|
|
3925
|
+
writeFlowMapping(state, level, state.dump);
|
|
3926
|
+
if (duplicate) {
|
|
3927
|
+
state.dump = "&ref_" + duplicateIndex + " " + state.dump;
|
|
3928
|
+
}
|
|
3929
|
+
}
|
|
3930
|
+
} else if (type2 === "[object Array]") {
|
|
3931
|
+
if (block && state.dump.length !== 0) {
|
|
3932
|
+
if (state.noArrayIndent && !isblockseq && level > 0) {
|
|
3933
|
+
writeBlockSequence(state, level - 1, state.dump, compact);
|
|
3934
|
+
} else {
|
|
3935
|
+
writeBlockSequence(state, level, state.dump, compact);
|
|
3936
|
+
}
|
|
3937
|
+
if (duplicate) {
|
|
3938
|
+
state.dump = "&ref_" + duplicateIndex + state.dump;
|
|
3939
|
+
}
|
|
3940
|
+
} else {
|
|
3941
|
+
writeFlowSequence(state, level, state.dump);
|
|
3942
|
+
if (duplicate) {
|
|
3943
|
+
state.dump = "&ref_" + duplicateIndex + " " + state.dump;
|
|
3944
|
+
}
|
|
3945
|
+
}
|
|
3946
|
+
} else if (type2 === "[object String]") {
|
|
3947
|
+
if (state.tag !== "?") {
|
|
3948
|
+
writeScalar(state, state.dump, level, iskey, inblock);
|
|
3949
|
+
}
|
|
3950
|
+
} else if (type2 === "[object Undefined]") {
|
|
3951
|
+
return false;
|
|
3952
|
+
} else {
|
|
3953
|
+
if (state.skipInvalid)
|
|
3954
|
+
return false;
|
|
3955
|
+
throw new exception("unacceptable kind of an object to dump " + type2);
|
|
3956
|
+
}
|
|
3957
|
+
if (state.tag !== null && state.tag !== "?") {
|
|
3958
|
+
tagStr = encodeURI(state.tag[0] === "!" ? state.tag.slice(1) : state.tag).replace(/!/g, "%21");
|
|
3959
|
+
if (state.tag[0] === "!") {
|
|
3960
|
+
tagStr = "!" + tagStr;
|
|
3961
|
+
} else if (tagStr.slice(0, 18) === "tag:yaml.org,2002:") {
|
|
3962
|
+
tagStr = "!!" + tagStr.slice(18);
|
|
3963
|
+
} else {
|
|
3964
|
+
tagStr = "!<" + tagStr + ">";
|
|
3965
|
+
}
|
|
3966
|
+
state.dump = tagStr + " " + state.dump;
|
|
3967
|
+
}
|
|
3968
|
+
}
|
|
3969
|
+
return true;
|
|
3970
|
+
}
|
|
3971
|
+
function getDuplicateReferences(object2, state) {
|
|
3972
|
+
var objects = [], duplicatesIndexes = [], index, length;
|
|
3973
|
+
inspectNode(object2, objects, duplicatesIndexes);
|
|
3974
|
+
for (index = 0, length = duplicatesIndexes.length;index < length; index += 1) {
|
|
3975
|
+
state.duplicates.push(objects[duplicatesIndexes[index]]);
|
|
3976
|
+
}
|
|
3977
|
+
state.usedDuplicates = new Array(length);
|
|
3978
|
+
}
|
|
3979
|
+
function inspectNode(object2, objects, duplicatesIndexes) {
|
|
3980
|
+
var objectKeyList, index, length;
|
|
3981
|
+
if (object2 !== null && typeof object2 === "object") {
|
|
3982
|
+
index = objects.indexOf(object2);
|
|
3983
|
+
if (index !== -1) {
|
|
3984
|
+
if (duplicatesIndexes.indexOf(index) === -1) {
|
|
3985
|
+
duplicatesIndexes.push(index);
|
|
3986
|
+
}
|
|
3987
|
+
} else {
|
|
3988
|
+
objects.push(object2);
|
|
3989
|
+
if (Array.isArray(object2)) {
|
|
3990
|
+
for (index = 0, length = object2.length;index < length; index += 1) {
|
|
3991
|
+
inspectNode(object2[index], objects, duplicatesIndexes);
|
|
3992
|
+
}
|
|
3993
|
+
} else {
|
|
3994
|
+
objectKeyList = Object.keys(object2);
|
|
3995
|
+
for (index = 0, length = objectKeyList.length;index < length; index += 1) {
|
|
3996
|
+
inspectNode(object2[objectKeyList[index]], objects, duplicatesIndexes);
|
|
3997
|
+
}
|
|
3998
|
+
}
|
|
3999
|
+
}
|
|
4000
|
+
}
|
|
4001
|
+
}
|
|
4002
|
+
function dump$1(input, options) {
|
|
4003
|
+
options = options || {};
|
|
4004
|
+
var state = new State(options);
|
|
4005
|
+
if (!state.noRefs)
|
|
4006
|
+
getDuplicateReferences(input, state);
|
|
4007
|
+
var value = input;
|
|
4008
|
+
if (state.replacer) {
|
|
4009
|
+
value = state.replacer.call({ "": value }, "", value);
|
|
4010
|
+
}
|
|
4011
|
+
if (writeNode(state, 0, value, true, true))
|
|
4012
|
+
return state.dump + `
|
|
4013
|
+
`;
|
|
4014
|
+
return "";
|
|
4015
|
+
}
|
|
4016
|
+
function renamed(from, to) {
|
|
4017
|
+
return function() {
|
|
4018
|
+
throw new Error("Function yaml." + from + " is removed in js-yaml 4. " + "Use yaml." + to + " instead, which is now safe by default.");
|
|
4019
|
+
};
|
|
4020
|
+
}
|
|
4021
|
+
var isNothing_1, isObject_1, toArray_1, repeat_1, isNegativeZero_1, extend_1, common, exception, snippet, TYPE_CONSTRUCTOR_OPTIONS, YAML_NODE_KINDS, type, schema, str, seq, map, failsafe, _null, bool, int, YAML_FLOAT_PATTERN, SCIENTIFIC_WITHOUT_DOT, float, json, core, YAML_DATE_REGEXP, YAML_TIMESTAMP_REGEXP, timestamp, merge, BASE64_MAP = `ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=
|
|
4022
|
+
\r`, binary, _hasOwnProperty$3, _toString$2, omap, _toString$1, pairs, _hasOwnProperty$2, set, _default, _hasOwnProperty$1, CONTEXT_FLOW_IN = 1, CONTEXT_FLOW_OUT = 2, CONTEXT_BLOCK_IN = 3, CONTEXT_BLOCK_OUT = 4, CHOMPING_CLIP = 1, CHOMPING_STRIP = 2, CHOMPING_KEEP = 3, PATTERN_NON_PRINTABLE, PATTERN_NON_ASCII_LINE_BREAKS, PATTERN_FLOW_INDICATORS, PATTERN_TAG_HANDLE, PATTERN_TAG_URI, simpleEscapeCheck, simpleEscapeMap, i, directiveHandlers, loadAll_1, load_1, loader, _toString, _hasOwnProperty, CHAR_BOM = 65279, CHAR_TAB = 9, CHAR_LINE_FEED = 10, CHAR_CARRIAGE_RETURN = 13, CHAR_SPACE = 32, CHAR_EXCLAMATION = 33, CHAR_DOUBLE_QUOTE = 34, CHAR_SHARP = 35, CHAR_PERCENT = 37, CHAR_AMPERSAND = 38, CHAR_SINGLE_QUOTE = 39, CHAR_ASTERISK = 42, CHAR_COMMA = 44, CHAR_MINUS = 45, CHAR_COLON = 58, CHAR_EQUALS = 61, CHAR_GREATER_THAN = 62, CHAR_QUESTION = 63, CHAR_COMMERCIAL_AT = 64, CHAR_LEFT_SQUARE_BRACKET = 91, CHAR_RIGHT_SQUARE_BRACKET = 93, CHAR_GRAVE_ACCENT = 96, CHAR_LEFT_CURLY_BRACKET = 123, CHAR_VERTICAL_LINE = 124, CHAR_RIGHT_CURLY_BRACKET = 125, ESCAPE_SEQUENCES, DEPRECATED_BOOLEANS_SYNTAX, DEPRECATED_BASE60_SYNTAX, QUOTING_TYPE_SINGLE = 1, QUOTING_TYPE_DOUBLE = 2, STYLE_PLAIN = 1, STYLE_SINGLE = 2, STYLE_LITERAL = 3, STYLE_FOLDED = 4, STYLE_DOUBLE = 5, dump_1, dumper, load, loadAll, dump, safeLoad, safeLoadAll, safeDump;
|
|
4023
|
+
var init_js_yaml = __esm(() => {
|
|
4024
|
+
/*! js-yaml 4.1.1 https://github.com/nodeca/js-yaml @license MIT */
|
|
4025
|
+
isNothing_1 = isNothing;
|
|
4026
|
+
isObject_1 = isObject;
|
|
4027
|
+
toArray_1 = toArray;
|
|
4028
|
+
repeat_1 = repeat;
|
|
4029
|
+
isNegativeZero_1 = isNegativeZero;
|
|
4030
|
+
extend_1 = extend;
|
|
4031
|
+
common = {
|
|
4032
|
+
isNothing: isNothing_1,
|
|
4033
|
+
isObject: isObject_1,
|
|
4034
|
+
toArray: toArray_1,
|
|
4035
|
+
repeat: repeat_1,
|
|
4036
|
+
isNegativeZero: isNegativeZero_1,
|
|
4037
|
+
extend: extend_1
|
|
4038
|
+
};
|
|
4039
|
+
YAMLException$1.prototype = Object.create(Error.prototype);
|
|
4040
|
+
YAMLException$1.prototype.constructor = YAMLException$1;
|
|
4041
|
+
YAMLException$1.prototype.toString = function toString(compact) {
|
|
4042
|
+
return this.name + ": " + formatError(this, compact);
|
|
4043
|
+
};
|
|
4044
|
+
exception = YAMLException$1;
|
|
4045
|
+
snippet = makeSnippet;
|
|
4046
|
+
TYPE_CONSTRUCTOR_OPTIONS = [
|
|
4047
|
+
"kind",
|
|
4048
|
+
"multi",
|
|
4049
|
+
"resolve",
|
|
4050
|
+
"construct",
|
|
4051
|
+
"instanceOf",
|
|
4052
|
+
"predicate",
|
|
4053
|
+
"represent",
|
|
4054
|
+
"representName",
|
|
4055
|
+
"defaultStyle",
|
|
4056
|
+
"styleAliases"
|
|
4057
|
+
];
|
|
4058
|
+
YAML_NODE_KINDS = [
|
|
4059
|
+
"scalar",
|
|
4060
|
+
"sequence",
|
|
4061
|
+
"mapping"
|
|
4062
|
+
];
|
|
4063
|
+
type = Type$1;
|
|
4064
|
+
Schema$1.prototype.extend = function extend2(definition) {
|
|
4065
|
+
var implicit = [];
|
|
4066
|
+
var explicit = [];
|
|
4067
|
+
if (definition instanceof type) {
|
|
4068
|
+
explicit.push(definition);
|
|
4069
|
+
} else if (Array.isArray(definition)) {
|
|
4070
|
+
explicit = explicit.concat(definition);
|
|
4071
|
+
} else if (definition && (Array.isArray(definition.implicit) || Array.isArray(definition.explicit))) {
|
|
4072
|
+
if (definition.implicit)
|
|
4073
|
+
implicit = implicit.concat(definition.implicit);
|
|
4074
|
+
if (definition.explicit)
|
|
4075
|
+
explicit = explicit.concat(definition.explicit);
|
|
4076
|
+
} else {
|
|
4077
|
+
throw new exception("Schema.extend argument should be a Type, [ Type ], " + "or a schema definition ({ implicit: [...], explicit: [...] })");
|
|
4078
|
+
}
|
|
4079
|
+
implicit.forEach(function(type$1) {
|
|
4080
|
+
if (!(type$1 instanceof type)) {
|
|
4081
|
+
throw new exception("Specified list of YAML types (or a single Type object) contains a non-Type object.");
|
|
4082
|
+
}
|
|
4083
|
+
if (type$1.loadKind && type$1.loadKind !== "scalar") {
|
|
4084
|
+
throw new exception("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");
|
|
4085
|
+
}
|
|
4086
|
+
if (type$1.multi) {
|
|
4087
|
+
throw new exception("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.");
|
|
4088
|
+
}
|
|
4089
|
+
});
|
|
4090
|
+
explicit.forEach(function(type$1) {
|
|
4091
|
+
if (!(type$1 instanceof type)) {
|
|
4092
|
+
throw new exception("Specified list of YAML types (or a single Type object) contains a non-Type object.");
|
|
4093
|
+
}
|
|
4094
|
+
});
|
|
4095
|
+
var result = Object.create(Schema$1.prototype);
|
|
4096
|
+
result.implicit = (this.implicit || []).concat(implicit);
|
|
4097
|
+
result.explicit = (this.explicit || []).concat(explicit);
|
|
4098
|
+
result.compiledImplicit = compileList(result, "implicit");
|
|
4099
|
+
result.compiledExplicit = compileList(result, "explicit");
|
|
4100
|
+
result.compiledTypeMap = compileMap(result.compiledImplicit, result.compiledExplicit);
|
|
4101
|
+
return result;
|
|
4102
|
+
};
|
|
4103
|
+
schema = Schema$1;
|
|
4104
|
+
str = new type("tag:yaml.org,2002:str", {
|
|
4105
|
+
kind: "scalar",
|
|
4106
|
+
construct: function(data) {
|
|
4107
|
+
return data !== null ? data : "";
|
|
4108
|
+
}
|
|
4109
|
+
});
|
|
4110
|
+
seq = new type("tag:yaml.org,2002:seq", {
|
|
4111
|
+
kind: "sequence",
|
|
4112
|
+
construct: function(data) {
|
|
4113
|
+
return data !== null ? data : [];
|
|
4114
|
+
}
|
|
4115
|
+
});
|
|
4116
|
+
map = new type("tag:yaml.org,2002:map", {
|
|
4117
|
+
kind: "mapping",
|
|
4118
|
+
construct: function(data) {
|
|
4119
|
+
return data !== null ? data : {};
|
|
4120
|
+
}
|
|
4121
|
+
});
|
|
4122
|
+
failsafe = new schema({
|
|
4123
|
+
explicit: [
|
|
4124
|
+
str,
|
|
4125
|
+
seq,
|
|
4126
|
+
map
|
|
4127
|
+
]
|
|
4128
|
+
});
|
|
4129
|
+
_null = new type("tag:yaml.org,2002:null", {
|
|
4130
|
+
kind: "scalar",
|
|
4131
|
+
resolve: resolveYamlNull,
|
|
4132
|
+
construct: constructYamlNull,
|
|
4133
|
+
predicate: isNull,
|
|
4134
|
+
represent: {
|
|
4135
|
+
canonical: function() {
|
|
4136
|
+
return "~";
|
|
4137
|
+
},
|
|
4138
|
+
lowercase: function() {
|
|
4139
|
+
return "null";
|
|
4140
|
+
},
|
|
4141
|
+
uppercase: function() {
|
|
4142
|
+
return "NULL";
|
|
4143
|
+
},
|
|
4144
|
+
camelcase: function() {
|
|
4145
|
+
return "Null";
|
|
4146
|
+
},
|
|
4147
|
+
empty: function() {
|
|
4148
|
+
return "";
|
|
4149
|
+
}
|
|
4150
|
+
},
|
|
4151
|
+
defaultStyle: "lowercase"
|
|
4152
|
+
});
|
|
4153
|
+
bool = new type("tag:yaml.org,2002:bool", {
|
|
4154
|
+
kind: "scalar",
|
|
4155
|
+
resolve: resolveYamlBoolean,
|
|
4156
|
+
construct: constructYamlBoolean,
|
|
4157
|
+
predicate: isBoolean,
|
|
4158
|
+
represent: {
|
|
4159
|
+
lowercase: function(object2) {
|
|
4160
|
+
return object2 ? "true" : "false";
|
|
4161
|
+
},
|
|
4162
|
+
uppercase: function(object2) {
|
|
4163
|
+
return object2 ? "TRUE" : "FALSE";
|
|
4164
|
+
},
|
|
4165
|
+
camelcase: function(object2) {
|
|
4166
|
+
return object2 ? "True" : "False";
|
|
4167
|
+
}
|
|
4168
|
+
},
|
|
4169
|
+
defaultStyle: "lowercase"
|
|
4170
|
+
});
|
|
4171
|
+
int = new type("tag:yaml.org,2002:int", {
|
|
4172
|
+
kind: "scalar",
|
|
4173
|
+
resolve: resolveYamlInteger,
|
|
4174
|
+
construct: constructYamlInteger,
|
|
4175
|
+
predicate: isInteger,
|
|
4176
|
+
represent: {
|
|
4177
|
+
binary: function(obj) {
|
|
4178
|
+
return obj >= 0 ? "0b" + obj.toString(2) : "-0b" + obj.toString(2).slice(1);
|
|
4179
|
+
},
|
|
4180
|
+
octal: function(obj) {
|
|
4181
|
+
return obj >= 0 ? "0o" + obj.toString(8) : "-0o" + obj.toString(8).slice(1);
|
|
4182
|
+
},
|
|
4183
|
+
decimal: function(obj) {
|
|
4184
|
+
return obj.toString(10);
|
|
4185
|
+
},
|
|
4186
|
+
hexadecimal: function(obj) {
|
|
4187
|
+
return obj >= 0 ? "0x" + obj.toString(16).toUpperCase() : "-0x" + obj.toString(16).toUpperCase().slice(1);
|
|
4188
|
+
}
|
|
4189
|
+
},
|
|
4190
|
+
defaultStyle: "decimal",
|
|
4191
|
+
styleAliases: {
|
|
4192
|
+
binary: [2, "bin"],
|
|
4193
|
+
octal: [8, "oct"],
|
|
4194
|
+
decimal: [10, "dec"],
|
|
4195
|
+
hexadecimal: [16, "hex"]
|
|
4196
|
+
}
|
|
4197
|
+
});
|
|
4198
|
+
YAML_FLOAT_PATTERN = new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?" + "|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?" + "|[-+]?\\.(?:inf|Inf|INF)" + "|\\.(?:nan|NaN|NAN))$");
|
|
4199
|
+
SCIENTIFIC_WITHOUT_DOT = /^[-+]?[0-9]+e/;
|
|
4200
|
+
float = new type("tag:yaml.org,2002:float", {
|
|
4201
|
+
kind: "scalar",
|
|
4202
|
+
resolve: resolveYamlFloat,
|
|
4203
|
+
construct: constructYamlFloat,
|
|
4204
|
+
predicate: isFloat,
|
|
4205
|
+
represent: representYamlFloat,
|
|
4206
|
+
defaultStyle: "lowercase"
|
|
4207
|
+
});
|
|
4208
|
+
json = failsafe.extend({
|
|
4209
|
+
implicit: [
|
|
4210
|
+
_null,
|
|
4211
|
+
bool,
|
|
4212
|
+
int,
|
|
4213
|
+
float
|
|
4214
|
+
]
|
|
4215
|
+
});
|
|
4216
|
+
core = json;
|
|
4217
|
+
YAML_DATE_REGEXP = new RegExp("^([0-9][0-9][0-9][0-9])" + "-([0-9][0-9])" + "-([0-9][0-9])$");
|
|
4218
|
+
YAML_TIMESTAMP_REGEXP = new RegExp("^([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]))?))?$");
|
|
4219
|
+
timestamp = new type("tag:yaml.org,2002:timestamp", {
|
|
4220
|
+
kind: "scalar",
|
|
4221
|
+
resolve: resolveYamlTimestamp,
|
|
4222
|
+
construct: constructYamlTimestamp,
|
|
4223
|
+
instanceOf: Date,
|
|
4224
|
+
represent: representYamlTimestamp
|
|
4225
|
+
});
|
|
4226
|
+
merge = new type("tag:yaml.org,2002:merge", {
|
|
4227
|
+
kind: "scalar",
|
|
4228
|
+
resolve: resolveYamlMerge
|
|
4229
|
+
});
|
|
4230
|
+
binary = new type("tag:yaml.org,2002:binary", {
|
|
4231
|
+
kind: "scalar",
|
|
4232
|
+
resolve: resolveYamlBinary,
|
|
4233
|
+
construct: constructYamlBinary,
|
|
4234
|
+
predicate: isBinary,
|
|
4235
|
+
represent: representYamlBinary
|
|
4236
|
+
});
|
|
4237
|
+
_hasOwnProperty$3 = Object.prototype.hasOwnProperty;
|
|
4238
|
+
_toString$2 = Object.prototype.toString;
|
|
4239
|
+
omap = new type("tag:yaml.org,2002:omap", {
|
|
4240
|
+
kind: "sequence",
|
|
4241
|
+
resolve: resolveYamlOmap,
|
|
4242
|
+
construct: constructYamlOmap
|
|
4243
|
+
});
|
|
4244
|
+
_toString$1 = Object.prototype.toString;
|
|
4245
|
+
pairs = new type("tag:yaml.org,2002:pairs", {
|
|
4246
|
+
kind: "sequence",
|
|
4247
|
+
resolve: resolveYamlPairs,
|
|
4248
|
+
construct: constructYamlPairs
|
|
4249
|
+
});
|
|
4250
|
+
_hasOwnProperty$2 = Object.prototype.hasOwnProperty;
|
|
4251
|
+
set = new type("tag:yaml.org,2002:set", {
|
|
4252
|
+
kind: "mapping",
|
|
4253
|
+
resolve: resolveYamlSet,
|
|
4254
|
+
construct: constructYamlSet
|
|
4255
|
+
});
|
|
4256
|
+
_default = core.extend({
|
|
4257
|
+
implicit: [
|
|
4258
|
+
timestamp,
|
|
4259
|
+
merge
|
|
4260
|
+
],
|
|
4261
|
+
explicit: [
|
|
4262
|
+
binary,
|
|
4263
|
+
omap,
|
|
4264
|
+
pairs,
|
|
4265
|
+
set
|
|
4266
|
+
]
|
|
4267
|
+
});
|
|
4268
|
+
_hasOwnProperty$1 = Object.prototype.hasOwnProperty;
|
|
4269
|
+
PATTERN_NON_PRINTABLE = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/;
|
|
4270
|
+
PATTERN_NON_ASCII_LINE_BREAKS = /[\x85\u2028\u2029]/;
|
|
4271
|
+
PATTERN_FLOW_INDICATORS = /[,\[\]\{\}]/;
|
|
4272
|
+
PATTERN_TAG_HANDLE = /^(?:!|!!|![a-z\-]+!)$/i;
|
|
4273
|
+
PATTERN_TAG_URI = /^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;
|
|
4274
|
+
simpleEscapeCheck = new Array(256);
|
|
4275
|
+
simpleEscapeMap = new Array(256);
|
|
4276
|
+
for (i = 0;i < 256; i++) {
|
|
4277
|
+
simpleEscapeCheck[i] = simpleEscapeSequence(i) ? 1 : 0;
|
|
4278
|
+
simpleEscapeMap[i] = simpleEscapeSequence(i);
|
|
4279
|
+
}
|
|
4280
|
+
directiveHandlers = {
|
|
4281
|
+
YAML: function handleYamlDirective(state, name, args) {
|
|
4282
|
+
var match, major, minor;
|
|
4283
|
+
if (state.version !== null) {
|
|
4284
|
+
throwError(state, "duplication of %YAML directive");
|
|
4285
|
+
}
|
|
4286
|
+
if (args.length !== 1) {
|
|
4287
|
+
throwError(state, "YAML directive accepts exactly one argument");
|
|
4288
|
+
}
|
|
4289
|
+
match = /^([0-9]+)\.([0-9]+)$/.exec(args[0]);
|
|
4290
|
+
if (match === null) {
|
|
4291
|
+
throwError(state, "ill-formed argument of the YAML directive");
|
|
4292
|
+
}
|
|
4293
|
+
major = parseInt(match[1], 10);
|
|
4294
|
+
minor = parseInt(match[2], 10);
|
|
4295
|
+
if (major !== 1) {
|
|
4296
|
+
throwError(state, "unacceptable YAML version of the document");
|
|
4297
|
+
}
|
|
4298
|
+
state.version = args[0];
|
|
4299
|
+
state.checkLineBreaks = minor < 2;
|
|
4300
|
+
if (minor !== 1 && minor !== 2) {
|
|
4301
|
+
throwWarning(state, "unsupported YAML version of the document");
|
|
4302
|
+
}
|
|
4303
|
+
},
|
|
4304
|
+
TAG: function handleTagDirective(state, name, args) {
|
|
4305
|
+
var handle, prefix;
|
|
4306
|
+
if (args.length !== 2) {
|
|
4307
|
+
throwError(state, "TAG directive accepts exactly two arguments");
|
|
4308
|
+
}
|
|
4309
|
+
handle = args[0];
|
|
4310
|
+
prefix = args[1];
|
|
4311
|
+
if (!PATTERN_TAG_HANDLE.test(handle)) {
|
|
4312
|
+
throwError(state, "ill-formed tag handle (first argument) of the TAG directive");
|
|
4313
|
+
}
|
|
4314
|
+
if (_hasOwnProperty$1.call(state.tagMap, handle)) {
|
|
4315
|
+
throwError(state, 'there is a previously declared suffix for "' + handle + '" tag handle');
|
|
4316
|
+
}
|
|
4317
|
+
if (!PATTERN_TAG_URI.test(prefix)) {
|
|
4318
|
+
throwError(state, "ill-formed tag prefix (second argument) of the TAG directive");
|
|
4319
|
+
}
|
|
4320
|
+
try {
|
|
4321
|
+
prefix = decodeURIComponent(prefix);
|
|
4322
|
+
} catch (err) {
|
|
4323
|
+
throwError(state, "tag prefix is malformed: " + prefix);
|
|
4324
|
+
}
|
|
4325
|
+
state.tagMap[handle] = prefix;
|
|
4326
|
+
}
|
|
4327
|
+
};
|
|
4328
|
+
loadAll_1 = loadAll$1;
|
|
4329
|
+
load_1 = load$1;
|
|
4330
|
+
loader = {
|
|
4331
|
+
loadAll: loadAll_1,
|
|
4332
|
+
load: load_1
|
|
4333
|
+
};
|
|
4334
|
+
_toString = Object.prototype.toString;
|
|
4335
|
+
_hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
4336
|
+
ESCAPE_SEQUENCES = {};
|
|
4337
|
+
ESCAPE_SEQUENCES[0] = "\\0";
|
|
4338
|
+
ESCAPE_SEQUENCES[7] = "\\a";
|
|
4339
|
+
ESCAPE_SEQUENCES[8] = "\\b";
|
|
4340
|
+
ESCAPE_SEQUENCES[9] = "\\t";
|
|
4341
|
+
ESCAPE_SEQUENCES[10] = "\\n";
|
|
4342
|
+
ESCAPE_SEQUENCES[11] = "\\v";
|
|
4343
|
+
ESCAPE_SEQUENCES[12] = "\\f";
|
|
4344
|
+
ESCAPE_SEQUENCES[13] = "\\r";
|
|
4345
|
+
ESCAPE_SEQUENCES[27] = "\\e";
|
|
4346
|
+
ESCAPE_SEQUENCES[34] = "\\\"";
|
|
4347
|
+
ESCAPE_SEQUENCES[92] = "\\\\";
|
|
4348
|
+
ESCAPE_SEQUENCES[133] = "\\N";
|
|
4349
|
+
ESCAPE_SEQUENCES[160] = "\\_";
|
|
4350
|
+
ESCAPE_SEQUENCES[8232] = "\\L";
|
|
4351
|
+
ESCAPE_SEQUENCES[8233] = "\\P";
|
|
4352
|
+
DEPRECATED_BOOLEANS_SYNTAX = [
|
|
4353
|
+
"y",
|
|
4354
|
+
"Y",
|
|
4355
|
+
"yes",
|
|
4356
|
+
"Yes",
|
|
4357
|
+
"YES",
|
|
4358
|
+
"on",
|
|
4359
|
+
"On",
|
|
4360
|
+
"ON",
|
|
4361
|
+
"n",
|
|
4362
|
+
"N",
|
|
4363
|
+
"no",
|
|
4364
|
+
"No",
|
|
4365
|
+
"NO",
|
|
4366
|
+
"off",
|
|
4367
|
+
"Off",
|
|
4368
|
+
"OFF"
|
|
4369
|
+
];
|
|
4370
|
+
DEPRECATED_BASE60_SYNTAX = /^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;
|
|
4371
|
+
dump_1 = dump$1;
|
|
4372
|
+
dumper = {
|
|
4373
|
+
dump: dump_1
|
|
4374
|
+
};
|
|
4375
|
+
load = loader.load;
|
|
4376
|
+
loadAll = loader.loadAll;
|
|
4377
|
+
dump = dumper.dump;
|
|
4378
|
+
safeLoad = renamed("safeLoad", "load");
|
|
4379
|
+
safeLoadAll = renamed("safeLoadAll", "loadAll");
|
|
4380
|
+
safeDump = renamed("safeDump", "dump");
|
|
4381
|
+
});
|
|
1748
4382
|
|
|
1749
4383
|
// ../skills/src/bundled-data.generated.ts
|
|
1750
4384
|
var exports_bundled_data_generated = {};
|
|
@@ -4711,7 +7345,6 @@ Esta skill se activa cuando el usuario necesita:
|
|
|
4711
7345
|
// ../skills/src/loader.ts
|
|
4712
7346
|
import * as fs from "fs";
|
|
4713
7347
|
import * as path5 from "path";
|
|
4714
|
-
import * as yaml from "js-yaml";
|
|
4715
7348
|
function createLogger() {
|
|
4716
7349
|
return {
|
|
4717
7350
|
debug: (msg, ...args) => console.debug(`[skills] ${msg}`, ...args),
|
|
@@ -4726,7 +7359,7 @@ function parseFrontmatter(content) {
|
|
|
4726
7359
|
return { frontmatter: {}, body: content };
|
|
4727
7360
|
}
|
|
4728
7361
|
try {
|
|
4729
|
-
const frontmatter =
|
|
7362
|
+
const frontmatter = load(match[1]);
|
|
4730
7363
|
const body = match[2];
|
|
4731
7364
|
return { frontmatter, body };
|
|
4732
7365
|
} catch {
|
|
@@ -4936,6 +7569,7 @@ function createSkillLoader(config) {
|
|
|
4936
7569
|
}
|
|
4937
7570
|
var __dirname = "/home/johnpaez/Documentos/Agents/Hive/hive/packages/skills/src", STATIC_BUNDLED_DATA;
|
|
4938
7571
|
var init_loader2 = __esm(() => {
|
|
7572
|
+
init_js_yaml();
|
|
4939
7573
|
STATIC_BUNDLED_DATA = [];
|
|
4940
7574
|
try {
|
|
4941
7575
|
STATIC_BUNDLED_DATA = (init_bundled_data_generated(), __toCommonJS(exports_bundled_data_generated)).BUNDLED_SKILLS_DATA ?? [];
|
|
@@ -5706,6 +8340,1023 @@ var init_onboarding = __esm(() => {
|
|
|
5706
8340
|
log2 = logger.child("onboarding");
|
|
5707
8341
|
});
|
|
5708
8342
|
|
|
8343
|
+
// ../../node_modules/.bun/qrcode-terminal@0.12.0/node_modules/qrcode-terminal/vendor/QRCode/QRMode.js
|
|
8344
|
+
var require_QRMode = __commonJS((exports, module) => {
|
|
8345
|
+
module.exports = {
|
|
8346
|
+
MODE_NUMBER: 1 << 0,
|
|
8347
|
+
MODE_ALPHA_NUM: 1 << 1,
|
|
8348
|
+
MODE_8BIT_BYTE: 1 << 2,
|
|
8349
|
+
MODE_KANJI: 1 << 3
|
|
8350
|
+
};
|
|
8351
|
+
});
|
|
8352
|
+
|
|
8353
|
+
// ../../node_modules/.bun/qrcode-terminal@0.12.0/node_modules/qrcode-terminal/vendor/QRCode/QR8bitByte.js
|
|
8354
|
+
var require_QR8bitByte = __commonJS((exports, module) => {
|
|
8355
|
+
var QRMode = require_QRMode();
|
|
8356
|
+
function QR8bitByte(data) {
|
|
8357
|
+
this.mode = QRMode.MODE_8BIT_BYTE;
|
|
8358
|
+
this.data = data;
|
|
8359
|
+
}
|
|
8360
|
+
QR8bitByte.prototype = {
|
|
8361
|
+
getLength: function() {
|
|
8362
|
+
return this.data.length;
|
|
8363
|
+
},
|
|
8364
|
+
write: function(buffer) {
|
|
8365
|
+
for (var i2 = 0;i2 < this.data.length; i2++) {
|
|
8366
|
+
buffer.put(this.data.charCodeAt(i2), 8);
|
|
8367
|
+
}
|
|
8368
|
+
}
|
|
8369
|
+
};
|
|
8370
|
+
module.exports = QR8bitByte;
|
|
8371
|
+
});
|
|
8372
|
+
|
|
8373
|
+
// ../../node_modules/.bun/qrcode-terminal@0.12.0/node_modules/qrcode-terminal/vendor/QRCode/QRMath.js
|
|
8374
|
+
var require_QRMath = __commonJS((exports, module) => {
|
|
8375
|
+
var QRMath = {
|
|
8376
|
+
glog: function(n) {
|
|
8377
|
+
if (n < 1) {
|
|
8378
|
+
throw new Error("glog(" + n + ")");
|
|
8379
|
+
}
|
|
8380
|
+
return QRMath.LOG_TABLE[n];
|
|
8381
|
+
},
|
|
8382
|
+
gexp: function(n) {
|
|
8383
|
+
while (n < 0) {
|
|
8384
|
+
n += 255;
|
|
8385
|
+
}
|
|
8386
|
+
while (n >= 256) {
|
|
8387
|
+
n -= 255;
|
|
8388
|
+
}
|
|
8389
|
+
return QRMath.EXP_TABLE[n];
|
|
8390
|
+
},
|
|
8391
|
+
EXP_TABLE: new Array(256),
|
|
8392
|
+
LOG_TABLE: new Array(256)
|
|
8393
|
+
};
|
|
8394
|
+
for (i2 = 0;i2 < 8; i2++) {
|
|
8395
|
+
QRMath.EXP_TABLE[i2] = 1 << i2;
|
|
8396
|
+
}
|
|
8397
|
+
var i2;
|
|
8398
|
+
for (i2 = 8;i2 < 256; i2++) {
|
|
8399
|
+
QRMath.EXP_TABLE[i2] = QRMath.EXP_TABLE[i2 - 4] ^ QRMath.EXP_TABLE[i2 - 5] ^ QRMath.EXP_TABLE[i2 - 6] ^ QRMath.EXP_TABLE[i2 - 8];
|
|
8400
|
+
}
|
|
8401
|
+
var i2;
|
|
8402
|
+
for (i2 = 0;i2 < 255; i2++) {
|
|
8403
|
+
QRMath.LOG_TABLE[QRMath.EXP_TABLE[i2]] = i2;
|
|
8404
|
+
}
|
|
8405
|
+
var i2;
|
|
8406
|
+
module.exports = QRMath;
|
|
8407
|
+
});
|
|
8408
|
+
|
|
8409
|
+
// ../../node_modules/.bun/qrcode-terminal@0.12.0/node_modules/qrcode-terminal/vendor/QRCode/QRPolynomial.js
|
|
8410
|
+
var require_QRPolynomial = __commonJS((exports, module) => {
|
|
8411
|
+
var QRMath = require_QRMath();
|
|
8412
|
+
function QRPolynomial(num, shift) {
|
|
8413
|
+
if (num.length === undefined) {
|
|
8414
|
+
throw new Error(num.length + "/" + shift);
|
|
8415
|
+
}
|
|
8416
|
+
var offset = 0;
|
|
8417
|
+
while (offset < num.length && num[offset] === 0) {
|
|
8418
|
+
offset++;
|
|
8419
|
+
}
|
|
8420
|
+
this.num = new Array(num.length - offset + shift);
|
|
8421
|
+
for (var i2 = 0;i2 < num.length - offset; i2++) {
|
|
8422
|
+
this.num[i2] = num[i2 + offset];
|
|
8423
|
+
}
|
|
8424
|
+
}
|
|
8425
|
+
QRPolynomial.prototype = {
|
|
8426
|
+
get: function(index) {
|
|
8427
|
+
return this.num[index];
|
|
8428
|
+
},
|
|
8429
|
+
getLength: function() {
|
|
8430
|
+
return this.num.length;
|
|
8431
|
+
},
|
|
8432
|
+
multiply: function(e) {
|
|
8433
|
+
var num = new Array(this.getLength() + e.getLength() - 1);
|
|
8434
|
+
for (var i2 = 0;i2 < this.getLength(); i2++) {
|
|
8435
|
+
for (var j = 0;j < e.getLength(); j++) {
|
|
8436
|
+
num[i2 + j] ^= QRMath.gexp(QRMath.glog(this.get(i2)) + QRMath.glog(e.get(j)));
|
|
8437
|
+
}
|
|
8438
|
+
}
|
|
8439
|
+
return new QRPolynomial(num, 0);
|
|
8440
|
+
},
|
|
8441
|
+
mod: function(e) {
|
|
8442
|
+
if (this.getLength() - e.getLength() < 0) {
|
|
8443
|
+
return this;
|
|
8444
|
+
}
|
|
8445
|
+
var ratio = QRMath.glog(this.get(0)) - QRMath.glog(e.get(0));
|
|
8446
|
+
var num = new Array(this.getLength());
|
|
8447
|
+
for (var i2 = 0;i2 < this.getLength(); i2++) {
|
|
8448
|
+
num[i2] = this.get(i2);
|
|
8449
|
+
}
|
|
8450
|
+
for (var x = 0;x < e.getLength(); x++) {
|
|
8451
|
+
num[x] ^= QRMath.gexp(QRMath.glog(e.get(x)) + ratio);
|
|
8452
|
+
}
|
|
8453
|
+
return new QRPolynomial(num, 0).mod(e);
|
|
8454
|
+
}
|
|
8455
|
+
};
|
|
8456
|
+
module.exports = QRPolynomial;
|
|
8457
|
+
});
|
|
8458
|
+
|
|
8459
|
+
// ../../node_modules/.bun/qrcode-terminal@0.12.0/node_modules/qrcode-terminal/vendor/QRCode/QRMaskPattern.js
|
|
8460
|
+
var require_QRMaskPattern = __commonJS((exports, module) => {
|
|
8461
|
+
module.exports = {
|
|
8462
|
+
PATTERN000: 0,
|
|
8463
|
+
PATTERN001: 1,
|
|
8464
|
+
PATTERN010: 2,
|
|
8465
|
+
PATTERN011: 3,
|
|
8466
|
+
PATTERN100: 4,
|
|
8467
|
+
PATTERN101: 5,
|
|
8468
|
+
PATTERN110: 6,
|
|
8469
|
+
PATTERN111: 7
|
|
8470
|
+
};
|
|
8471
|
+
});
|
|
8472
|
+
|
|
8473
|
+
// ../../node_modules/.bun/qrcode-terminal@0.12.0/node_modules/qrcode-terminal/vendor/QRCode/QRUtil.js
|
|
8474
|
+
var require_QRUtil = __commonJS((exports, module) => {
|
|
8475
|
+
var QRMode = require_QRMode();
|
|
8476
|
+
var QRPolynomial = require_QRPolynomial();
|
|
8477
|
+
var QRMath = require_QRMath();
|
|
8478
|
+
var QRMaskPattern = require_QRMaskPattern();
|
|
8479
|
+
var QRUtil = {
|
|
8480
|
+
PATTERN_POSITION_TABLE: [
|
|
8481
|
+
[],
|
|
8482
|
+
[6, 18],
|
|
8483
|
+
[6, 22],
|
|
8484
|
+
[6, 26],
|
|
8485
|
+
[6, 30],
|
|
8486
|
+
[6, 34],
|
|
8487
|
+
[6, 22, 38],
|
|
8488
|
+
[6, 24, 42],
|
|
8489
|
+
[6, 26, 46],
|
|
8490
|
+
[6, 28, 50],
|
|
8491
|
+
[6, 30, 54],
|
|
8492
|
+
[6, 32, 58],
|
|
8493
|
+
[6, 34, 62],
|
|
8494
|
+
[6, 26, 46, 66],
|
|
8495
|
+
[6, 26, 48, 70],
|
|
8496
|
+
[6, 26, 50, 74],
|
|
8497
|
+
[6, 30, 54, 78],
|
|
8498
|
+
[6, 30, 56, 82],
|
|
8499
|
+
[6, 30, 58, 86],
|
|
8500
|
+
[6, 34, 62, 90],
|
|
8501
|
+
[6, 28, 50, 72, 94],
|
|
8502
|
+
[6, 26, 50, 74, 98],
|
|
8503
|
+
[6, 30, 54, 78, 102],
|
|
8504
|
+
[6, 28, 54, 80, 106],
|
|
8505
|
+
[6, 32, 58, 84, 110],
|
|
8506
|
+
[6, 30, 58, 86, 114],
|
|
8507
|
+
[6, 34, 62, 90, 118],
|
|
8508
|
+
[6, 26, 50, 74, 98, 122],
|
|
8509
|
+
[6, 30, 54, 78, 102, 126],
|
|
8510
|
+
[6, 26, 52, 78, 104, 130],
|
|
8511
|
+
[6, 30, 56, 82, 108, 134],
|
|
8512
|
+
[6, 34, 60, 86, 112, 138],
|
|
8513
|
+
[6, 30, 58, 86, 114, 142],
|
|
8514
|
+
[6, 34, 62, 90, 118, 146],
|
|
8515
|
+
[6, 30, 54, 78, 102, 126, 150],
|
|
8516
|
+
[6, 24, 50, 76, 102, 128, 154],
|
|
8517
|
+
[6, 28, 54, 80, 106, 132, 158],
|
|
8518
|
+
[6, 32, 58, 84, 110, 136, 162],
|
|
8519
|
+
[6, 26, 54, 82, 110, 138, 166],
|
|
8520
|
+
[6, 30, 58, 86, 114, 142, 170]
|
|
8521
|
+
],
|
|
8522
|
+
G15: 1 << 10 | 1 << 8 | 1 << 5 | 1 << 4 | 1 << 2 | 1 << 1 | 1 << 0,
|
|
8523
|
+
G18: 1 << 12 | 1 << 11 | 1 << 10 | 1 << 9 | 1 << 8 | 1 << 5 | 1 << 2 | 1 << 0,
|
|
8524
|
+
G15_MASK: 1 << 14 | 1 << 12 | 1 << 10 | 1 << 4 | 1 << 1,
|
|
8525
|
+
getBCHTypeInfo: function(data) {
|
|
8526
|
+
var d = data << 10;
|
|
8527
|
+
while (QRUtil.getBCHDigit(d) - QRUtil.getBCHDigit(QRUtil.G15) >= 0) {
|
|
8528
|
+
d ^= QRUtil.G15 << QRUtil.getBCHDigit(d) - QRUtil.getBCHDigit(QRUtil.G15);
|
|
8529
|
+
}
|
|
8530
|
+
return (data << 10 | d) ^ QRUtil.G15_MASK;
|
|
8531
|
+
},
|
|
8532
|
+
getBCHTypeNumber: function(data) {
|
|
8533
|
+
var d = data << 12;
|
|
8534
|
+
while (QRUtil.getBCHDigit(d) - QRUtil.getBCHDigit(QRUtil.G18) >= 0) {
|
|
8535
|
+
d ^= QRUtil.G18 << QRUtil.getBCHDigit(d) - QRUtil.getBCHDigit(QRUtil.G18);
|
|
8536
|
+
}
|
|
8537
|
+
return data << 12 | d;
|
|
8538
|
+
},
|
|
8539
|
+
getBCHDigit: function(data) {
|
|
8540
|
+
var digit = 0;
|
|
8541
|
+
while (data !== 0) {
|
|
8542
|
+
digit++;
|
|
8543
|
+
data >>>= 1;
|
|
8544
|
+
}
|
|
8545
|
+
return digit;
|
|
8546
|
+
},
|
|
8547
|
+
getPatternPosition: function(typeNumber) {
|
|
8548
|
+
return QRUtil.PATTERN_POSITION_TABLE[typeNumber - 1];
|
|
8549
|
+
},
|
|
8550
|
+
getMask: function(maskPattern, i2, j) {
|
|
8551
|
+
switch (maskPattern) {
|
|
8552
|
+
case QRMaskPattern.PATTERN000:
|
|
8553
|
+
return (i2 + j) % 2 === 0;
|
|
8554
|
+
case QRMaskPattern.PATTERN001:
|
|
8555
|
+
return i2 % 2 === 0;
|
|
8556
|
+
case QRMaskPattern.PATTERN010:
|
|
8557
|
+
return j % 3 === 0;
|
|
8558
|
+
case QRMaskPattern.PATTERN011:
|
|
8559
|
+
return (i2 + j) % 3 === 0;
|
|
8560
|
+
case QRMaskPattern.PATTERN100:
|
|
8561
|
+
return (Math.floor(i2 / 2) + Math.floor(j / 3)) % 2 === 0;
|
|
8562
|
+
case QRMaskPattern.PATTERN101:
|
|
8563
|
+
return i2 * j % 2 + i2 * j % 3 === 0;
|
|
8564
|
+
case QRMaskPattern.PATTERN110:
|
|
8565
|
+
return (i2 * j % 2 + i2 * j % 3) % 2 === 0;
|
|
8566
|
+
case QRMaskPattern.PATTERN111:
|
|
8567
|
+
return (i2 * j % 3 + (i2 + j) % 2) % 2 === 0;
|
|
8568
|
+
default:
|
|
8569
|
+
throw new Error("bad maskPattern:" + maskPattern);
|
|
8570
|
+
}
|
|
8571
|
+
},
|
|
8572
|
+
getErrorCorrectPolynomial: function(errorCorrectLength) {
|
|
8573
|
+
var a = new QRPolynomial([1], 0);
|
|
8574
|
+
for (var i2 = 0;i2 < errorCorrectLength; i2++) {
|
|
8575
|
+
a = a.multiply(new QRPolynomial([1, QRMath.gexp(i2)], 0));
|
|
8576
|
+
}
|
|
8577
|
+
return a;
|
|
8578
|
+
},
|
|
8579
|
+
getLengthInBits: function(mode, type2) {
|
|
8580
|
+
if (1 <= type2 && type2 < 10) {
|
|
8581
|
+
switch (mode) {
|
|
8582
|
+
case QRMode.MODE_NUMBER:
|
|
8583
|
+
return 10;
|
|
8584
|
+
case QRMode.MODE_ALPHA_NUM:
|
|
8585
|
+
return 9;
|
|
8586
|
+
case QRMode.MODE_8BIT_BYTE:
|
|
8587
|
+
return 8;
|
|
8588
|
+
case QRMode.MODE_KANJI:
|
|
8589
|
+
return 8;
|
|
8590
|
+
default:
|
|
8591
|
+
throw new Error("mode:" + mode);
|
|
8592
|
+
}
|
|
8593
|
+
} else if (type2 < 27) {
|
|
8594
|
+
switch (mode) {
|
|
8595
|
+
case QRMode.MODE_NUMBER:
|
|
8596
|
+
return 12;
|
|
8597
|
+
case QRMode.MODE_ALPHA_NUM:
|
|
8598
|
+
return 11;
|
|
8599
|
+
case QRMode.MODE_8BIT_BYTE:
|
|
8600
|
+
return 16;
|
|
8601
|
+
case QRMode.MODE_KANJI:
|
|
8602
|
+
return 10;
|
|
8603
|
+
default:
|
|
8604
|
+
throw new Error("mode:" + mode);
|
|
8605
|
+
}
|
|
8606
|
+
} else if (type2 < 41) {
|
|
8607
|
+
switch (mode) {
|
|
8608
|
+
case QRMode.MODE_NUMBER:
|
|
8609
|
+
return 14;
|
|
8610
|
+
case QRMode.MODE_ALPHA_NUM:
|
|
8611
|
+
return 13;
|
|
8612
|
+
case QRMode.MODE_8BIT_BYTE:
|
|
8613
|
+
return 16;
|
|
8614
|
+
case QRMode.MODE_KANJI:
|
|
8615
|
+
return 12;
|
|
8616
|
+
default:
|
|
8617
|
+
throw new Error("mode:" + mode);
|
|
8618
|
+
}
|
|
8619
|
+
} else {
|
|
8620
|
+
throw new Error("type:" + type2);
|
|
8621
|
+
}
|
|
8622
|
+
},
|
|
8623
|
+
getLostPoint: function(qrCode) {
|
|
8624
|
+
var moduleCount = qrCode.getModuleCount();
|
|
8625
|
+
var lostPoint = 0;
|
|
8626
|
+
var row = 0;
|
|
8627
|
+
var col = 0;
|
|
8628
|
+
for (row = 0;row < moduleCount; row++) {
|
|
8629
|
+
for (col = 0;col < moduleCount; col++) {
|
|
8630
|
+
var sameCount = 0;
|
|
8631
|
+
var dark = qrCode.isDark(row, col);
|
|
8632
|
+
for (var r = -1;r <= 1; r++) {
|
|
8633
|
+
if (row + r < 0 || moduleCount <= row + r) {
|
|
8634
|
+
continue;
|
|
8635
|
+
}
|
|
8636
|
+
for (var c = -1;c <= 1; c++) {
|
|
8637
|
+
if (col + c < 0 || moduleCount <= col + c) {
|
|
8638
|
+
continue;
|
|
8639
|
+
}
|
|
8640
|
+
if (r === 0 && c === 0) {
|
|
8641
|
+
continue;
|
|
8642
|
+
}
|
|
8643
|
+
if (dark === qrCode.isDark(row + r, col + c)) {
|
|
8644
|
+
sameCount++;
|
|
8645
|
+
}
|
|
8646
|
+
}
|
|
8647
|
+
}
|
|
8648
|
+
if (sameCount > 5) {
|
|
8649
|
+
lostPoint += 3 + sameCount - 5;
|
|
8650
|
+
}
|
|
8651
|
+
}
|
|
8652
|
+
}
|
|
8653
|
+
for (row = 0;row < moduleCount - 1; row++) {
|
|
8654
|
+
for (col = 0;col < moduleCount - 1; col++) {
|
|
8655
|
+
var count = 0;
|
|
8656
|
+
if (qrCode.isDark(row, col))
|
|
8657
|
+
count++;
|
|
8658
|
+
if (qrCode.isDark(row + 1, col))
|
|
8659
|
+
count++;
|
|
8660
|
+
if (qrCode.isDark(row, col + 1))
|
|
8661
|
+
count++;
|
|
8662
|
+
if (qrCode.isDark(row + 1, col + 1))
|
|
8663
|
+
count++;
|
|
8664
|
+
if (count === 0 || count === 4) {
|
|
8665
|
+
lostPoint += 3;
|
|
8666
|
+
}
|
|
8667
|
+
}
|
|
8668
|
+
}
|
|
8669
|
+
for (row = 0;row < moduleCount; row++) {
|
|
8670
|
+
for (col = 0;col < moduleCount - 6; col++) {
|
|
8671
|
+
if (qrCode.isDark(row, col) && !qrCode.isDark(row, col + 1) && qrCode.isDark(row, col + 2) && qrCode.isDark(row, col + 3) && qrCode.isDark(row, col + 4) && !qrCode.isDark(row, col + 5) && qrCode.isDark(row, col + 6)) {
|
|
8672
|
+
lostPoint += 40;
|
|
8673
|
+
}
|
|
8674
|
+
}
|
|
8675
|
+
}
|
|
8676
|
+
for (col = 0;col < moduleCount; col++) {
|
|
8677
|
+
for (row = 0;row < moduleCount - 6; row++) {
|
|
8678
|
+
if (qrCode.isDark(row, col) && !qrCode.isDark(row + 1, col) && qrCode.isDark(row + 2, col) && qrCode.isDark(row + 3, col) && qrCode.isDark(row + 4, col) && !qrCode.isDark(row + 5, col) && qrCode.isDark(row + 6, col)) {
|
|
8679
|
+
lostPoint += 40;
|
|
8680
|
+
}
|
|
8681
|
+
}
|
|
8682
|
+
}
|
|
8683
|
+
var darkCount = 0;
|
|
8684
|
+
for (col = 0;col < moduleCount; col++) {
|
|
8685
|
+
for (row = 0;row < moduleCount; row++) {
|
|
8686
|
+
if (qrCode.isDark(row, col)) {
|
|
8687
|
+
darkCount++;
|
|
8688
|
+
}
|
|
8689
|
+
}
|
|
8690
|
+
}
|
|
8691
|
+
var ratio = Math.abs(100 * darkCount / moduleCount / moduleCount - 50) / 5;
|
|
8692
|
+
lostPoint += ratio * 10;
|
|
8693
|
+
return lostPoint;
|
|
8694
|
+
}
|
|
8695
|
+
};
|
|
8696
|
+
module.exports = QRUtil;
|
|
8697
|
+
});
|
|
8698
|
+
|
|
8699
|
+
// ../../node_modules/.bun/qrcode-terminal@0.12.0/node_modules/qrcode-terminal/vendor/QRCode/QRErrorCorrectLevel.js
|
|
8700
|
+
var require_QRErrorCorrectLevel = __commonJS((exports, module) => {
|
|
8701
|
+
module.exports = {
|
|
8702
|
+
L: 1,
|
|
8703
|
+
M: 0,
|
|
8704
|
+
Q: 3,
|
|
8705
|
+
H: 2
|
|
8706
|
+
};
|
|
8707
|
+
});
|
|
8708
|
+
|
|
8709
|
+
// ../../node_modules/.bun/qrcode-terminal@0.12.0/node_modules/qrcode-terminal/vendor/QRCode/QRRSBlock.js
|
|
8710
|
+
var require_QRRSBlock = __commonJS((exports, module) => {
|
|
8711
|
+
var QRErrorCorrectLevel = require_QRErrorCorrectLevel();
|
|
8712
|
+
function QRRSBlock(totalCount, dataCount) {
|
|
8713
|
+
this.totalCount = totalCount;
|
|
8714
|
+
this.dataCount = dataCount;
|
|
8715
|
+
}
|
|
8716
|
+
QRRSBlock.RS_BLOCK_TABLE = [
|
|
8717
|
+
[1, 26, 19],
|
|
8718
|
+
[1, 26, 16],
|
|
8719
|
+
[1, 26, 13],
|
|
8720
|
+
[1, 26, 9],
|
|
8721
|
+
[1, 44, 34],
|
|
8722
|
+
[1, 44, 28],
|
|
8723
|
+
[1, 44, 22],
|
|
8724
|
+
[1, 44, 16],
|
|
8725
|
+
[1, 70, 55],
|
|
8726
|
+
[1, 70, 44],
|
|
8727
|
+
[2, 35, 17],
|
|
8728
|
+
[2, 35, 13],
|
|
8729
|
+
[1, 100, 80],
|
|
8730
|
+
[2, 50, 32],
|
|
8731
|
+
[2, 50, 24],
|
|
8732
|
+
[4, 25, 9],
|
|
8733
|
+
[1, 134, 108],
|
|
8734
|
+
[2, 67, 43],
|
|
8735
|
+
[2, 33, 15, 2, 34, 16],
|
|
8736
|
+
[2, 33, 11, 2, 34, 12],
|
|
8737
|
+
[2, 86, 68],
|
|
8738
|
+
[4, 43, 27],
|
|
8739
|
+
[4, 43, 19],
|
|
8740
|
+
[4, 43, 15],
|
|
8741
|
+
[2, 98, 78],
|
|
8742
|
+
[4, 49, 31],
|
|
8743
|
+
[2, 32, 14, 4, 33, 15],
|
|
8744
|
+
[4, 39, 13, 1, 40, 14],
|
|
8745
|
+
[2, 121, 97],
|
|
8746
|
+
[2, 60, 38, 2, 61, 39],
|
|
8747
|
+
[4, 40, 18, 2, 41, 19],
|
|
8748
|
+
[4, 40, 14, 2, 41, 15],
|
|
8749
|
+
[2, 146, 116],
|
|
8750
|
+
[3, 58, 36, 2, 59, 37],
|
|
8751
|
+
[4, 36, 16, 4, 37, 17],
|
|
8752
|
+
[4, 36, 12, 4, 37, 13],
|
|
8753
|
+
[2, 86, 68, 2, 87, 69],
|
|
8754
|
+
[4, 69, 43, 1, 70, 44],
|
|
8755
|
+
[6, 43, 19, 2, 44, 20],
|
|
8756
|
+
[6, 43, 15, 2, 44, 16],
|
|
8757
|
+
[4, 101, 81],
|
|
8758
|
+
[1, 80, 50, 4, 81, 51],
|
|
8759
|
+
[4, 50, 22, 4, 51, 23],
|
|
8760
|
+
[3, 36, 12, 8, 37, 13],
|
|
8761
|
+
[2, 116, 92, 2, 117, 93],
|
|
8762
|
+
[6, 58, 36, 2, 59, 37],
|
|
8763
|
+
[4, 46, 20, 6, 47, 21],
|
|
8764
|
+
[7, 42, 14, 4, 43, 15],
|
|
8765
|
+
[4, 133, 107],
|
|
8766
|
+
[8, 59, 37, 1, 60, 38],
|
|
8767
|
+
[8, 44, 20, 4, 45, 21],
|
|
8768
|
+
[12, 33, 11, 4, 34, 12],
|
|
8769
|
+
[3, 145, 115, 1, 146, 116],
|
|
8770
|
+
[4, 64, 40, 5, 65, 41],
|
|
8771
|
+
[11, 36, 16, 5, 37, 17],
|
|
8772
|
+
[11, 36, 12, 5, 37, 13],
|
|
8773
|
+
[5, 109, 87, 1, 110, 88],
|
|
8774
|
+
[5, 65, 41, 5, 66, 42],
|
|
8775
|
+
[5, 54, 24, 7, 55, 25],
|
|
8776
|
+
[11, 36, 12],
|
|
8777
|
+
[5, 122, 98, 1, 123, 99],
|
|
8778
|
+
[7, 73, 45, 3, 74, 46],
|
|
8779
|
+
[15, 43, 19, 2, 44, 20],
|
|
8780
|
+
[3, 45, 15, 13, 46, 16],
|
|
8781
|
+
[1, 135, 107, 5, 136, 108],
|
|
8782
|
+
[10, 74, 46, 1, 75, 47],
|
|
8783
|
+
[1, 50, 22, 15, 51, 23],
|
|
8784
|
+
[2, 42, 14, 17, 43, 15],
|
|
8785
|
+
[5, 150, 120, 1, 151, 121],
|
|
8786
|
+
[9, 69, 43, 4, 70, 44],
|
|
8787
|
+
[17, 50, 22, 1, 51, 23],
|
|
8788
|
+
[2, 42, 14, 19, 43, 15],
|
|
8789
|
+
[3, 141, 113, 4, 142, 114],
|
|
8790
|
+
[3, 70, 44, 11, 71, 45],
|
|
8791
|
+
[17, 47, 21, 4, 48, 22],
|
|
8792
|
+
[9, 39, 13, 16, 40, 14],
|
|
8793
|
+
[3, 135, 107, 5, 136, 108],
|
|
8794
|
+
[3, 67, 41, 13, 68, 42],
|
|
8795
|
+
[15, 54, 24, 5, 55, 25],
|
|
8796
|
+
[15, 43, 15, 10, 44, 16],
|
|
8797
|
+
[4, 144, 116, 4, 145, 117],
|
|
8798
|
+
[17, 68, 42],
|
|
8799
|
+
[17, 50, 22, 6, 51, 23],
|
|
8800
|
+
[19, 46, 16, 6, 47, 17],
|
|
8801
|
+
[2, 139, 111, 7, 140, 112],
|
|
8802
|
+
[17, 74, 46],
|
|
8803
|
+
[7, 54, 24, 16, 55, 25],
|
|
8804
|
+
[34, 37, 13],
|
|
8805
|
+
[4, 151, 121, 5, 152, 122],
|
|
8806
|
+
[4, 75, 47, 14, 76, 48],
|
|
8807
|
+
[11, 54, 24, 14, 55, 25],
|
|
8808
|
+
[16, 45, 15, 14, 46, 16],
|
|
8809
|
+
[6, 147, 117, 4, 148, 118],
|
|
8810
|
+
[6, 73, 45, 14, 74, 46],
|
|
8811
|
+
[11, 54, 24, 16, 55, 25],
|
|
8812
|
+
[30, 46, 16, 2, 47, 17],
|
|
8813
|
+
[8, 132, 106, 4, 133, 107],
|
|
8814
|
+
[8, 75, 47, 13, 76, 48],
|
|
8815
|
+
[7, 54, 24, 22, 55, 25],
|
|
8816
|
+
[22, 45, 15, 13, 46, 16],
|
|
8817
|
+
[10, 142, 114, 2, 143, 115],
|
|
8818
|
+
[19, 74, 46, 4, 75, 47],
|
|
8819
|
+
[28, 50, 22, 6, 51, 23],
|
|
8820
|
+
[33, 46, 16, 4, 47, 17],
|
|
8821
|
+
[8, 152, 122, 4, 153, 123],
|
|
8822
|
+
[22, 73, 45, 3, 74, 46],
|
|
8823
|
+
[8, 53, 23, 26, 54, 24],
|
|
8824
|
+
[12, 45, 15, 28, 46, 16],
|
|
8825
|
+
[3, 147, 117, 10, 148, 118],
|
|
8826
|
+
[3, 73, 45, 23, 74, 46],
|
|
8827
|
+
[4, 54, 24, 31, 55, 25],
|
|
8828
|
+
[11, 45, 15, 31, 46, 16],
|
|
8829
|
+
[7, 146, 116, 7, 147, 117],
|
|
8830
|
+
[21, 73, 45, 7, 74, 46],
|
|
8831
|
+
[1, 53, 23, 37, 54, 24],
|
|
8832
|
+
[19, 45, 15, 26, 46, 16],
|
|
8833
|
+
[5, 145, 115, 10, 146, 116],
|
|
8834
|
+
[19, 75, 47, 10, 76, 48],
|
|
8835
|
+
[15, 54, 24, 25, 55, 25],
|
|
8836
|
+
[23, 45, 15, 25, 46, 16],
|
|
8837
|
+
[13, 145, 115, 3, 146, 116],
|
|
8838
|
+
[2, 74, 46, 29, 75, 47],
|
|
8839
|
+
[42, 54, 24, 1, 55, 25],
|
|
8840
|
+
[23, 45, 15, 28, 46, 16],
|
|
8841
|
+
[17, 145, 115],
|
|
8842
|
+
[10, 74, 46, 23, 75, 47],
|
|
8843
|
+
[10, 54, 24, 35, 55, 25],
|
|
8844
|
+
[19, 45, 15, 35, 46, 16],
|
|
8845
|
+
[17, 145, 115, 1, 146, 116],
|
|
8846
|
+
[14, 74, 46, 21, 75, 47],
|
|
8847
|
+
[29, 54, 24, 19, 55, 25],
|
|
8848
|
+
[11, 45, 15, 46, 46, 16],
|
|
8849
|
+
[13, 145, 115, 6, 146, 116],
|
|
8850
|
+
[14, 74, 46, 23, 75, 47],
|
|
8851
|
+
[44, 54, 24, 7, 55, 25],
|
|
8852
|
+
[59, 46, 16, 1, 47, 17],
|
|
8853
|
+
[12, 151, 121, 7, 152, 122],
|
|
8854
|
+
[12, 75, 47, 26, 76, 48],
|
|
8855
|
+
[39, 54, 24, 14, 55, 25],
|
|
8856
|
+
[22, 45, 15, 41, 46, 16],
|
|
8857
|
+
[6, 151, 121, 14, 152, 122],
|
|
8858
|
+
[6, 75, 47, 34, 76, 48],
|
|
8859
|
+
[46, 54, 24, 10, 55, 25],
|
|
8860
|
+
[2, 45, 15, 64, 46, 16],
|
|
8861
|
+
[17, 152, 122, 4, 153, 123],
|
|
8862
|
+
[29, 74, 46, 14, 75, 47],
|
|
8863
|
+
[49, 54, 24, 10, 55, 25],
|
|
8864
|
+
[24, 45, 15, 46, 46, 16],
|
|
8865
|
+
[4, 152, 122, 18, 153, 123],
|
|
8866
|
+
[13, 74, 46, 32, 75, 47],
|
|
8867
|
+
[48, 54, 24, 14, 55, 25],
|
|
8868
|
+
[42, 45, 15, 32, 46, 16],
|
|
8869
|
+
[20, 147, 117, 4, 148, 118],
|
|
8870
|
+
[40, 75, 47, 7, 76, 48],
|
|
8871
|
+
[43, 54, 24, 22, 55, 25],
|
|
8872
|
+
[10, 45, 15, 67, 46, 16],
|
|
8873
|
+
[19, 148, 118, 6, 149, 119],
|
|
8874
|
+
[18, 75, 47, 31, 76, 48],
|
|
8875
|
+
[34, 54, 24, 34, 55, 25],
|
|
8876
|
+
[20, 45, 15, 61, 46, 16]
|
|
8877
|
+
];
|
|
8878
|
+
QRRSBlock.getRSBlocks = function(typeNumber, errorCorrectLevel) {
|
|
8879
|
+
var rsBlock = QRRSBlock.getRsBlockTable(typeNumber, errorCorrectLevel);
|
|
8880
|
+
if (rsBlock === undefined) {
|
|
8881
|
+
throw new Error("bad rs block @ typeNumber:" + typeNumber + "/errorCorrectLevel:" + errorCorrectLevel);
|
|
8882
|
+
}
|
|
8883
|
+
var length = rsBlock.length / 3;
|
|
8884
|
+
var list = [];
|
|
8885
|
+
for (var i2 = 0;i2 < length; i2++) {
|
|
8886
|
+
var count = rsBlock[i2 * 3 + 0];
|
|
8887
|
+
var totalCount = rsBlock[i2 * 3 + 1];
|
|
8888
|
+
var dataCount = rsBlock[i2 * 3 + 2];
|
|
8889
|
+
for (var j = 0;j < count; j++) {
|
|
8890
|
+
list.push(new QRRSBlock(totalCount, dataCount));
|
|
8891
|
+
}
|
|
8892
|
+
}
|
|
8893
|
+
return list;
|
|
8894
|
+
};
|
|
8895
|
+
QRRSBlock.getRsBlockTable = function(typeNumber, errorCorrectLevel) {
|
|
8896
|
+
switch (errorCorrectLevel) {
|
|
8897
|
+
case QRErrorCorrectLevel.L:
|
|
8898
|
+
return QRRSBlock.RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 0];
|
|
8899
|
+
case QRErrorCorrectLevel.M:
|
|
8900
|
+
return QRRSBlock.RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 1];
|
|
8901
|
+
case QRErrorCorrectLevel.Q:
|
|
8902
|
+
return QRRSBlock.RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 2];
|
|
8903
|
+
case QRErrorCorrectLevel.H:
|
|
8904
|
+
return QRRSBlock.RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 3];
|
|
8905
|
+
default:
|
|
8906
|
+
return;
|
|
8907
|
+
}
|
|
8908
|
+
};
|
|
8909
|
+
module.exports = QRRSBlock;
|
|
8910
|
+
});
|
|
8911
|
+
|
|
8912
|
+
// ../../node_modules/.bun/qrcode-terminal@0.12.0/node_modules/qrcode-terminal/vendor/QRCode/QRBitBuffer.js
|
|
8913
|
+
var require_QRBitBuffer = __commonJS((exports, module) => {
|
|
8914
|
+
function QRBitBuffer() {
|
|
8915
|
+
this.buffer = [];
|
|
8916
|
+
this.length = 0;
|
|
8917
|
+
}
|
|
8918
|
+
QRBitBuffer.prototype = {
|
|
8919
|
+
get: function(index) {
|
|
8920
|
+
var bufIndex = Math.floor(index / 8);
|
|
8921
|
+
return (this.buffer[bufIndex] >>> 7 - index % 8 & 1) == 1;
|
|
8922
|
+
},
|
|
8923
|
+
put: function(num, length) {
|
|
8924
|
+
for (var i2 = 0;i2 < length; i2++) {
|
|
8925
|
+
this.putBit((num >>> length - i2 - 1 & 1) == 1);
|
|
8926
|
+
}
|
|
8927
|
+
},
|
|
8928
|
+
getLengthInBits: function() {
|
|
8929
|
+
return this.length;
|
|
8930
|
+
},
|
|
8931
|
+
putBit: function(bit) {
|
|
8932
|
+
var bufIndex = Math.floor(this.length / 8);
|
|
8933
|
+
if (this.buffer.length <= bufIndex) {
|
|
8934
|
+
this.buffer.push(0);
|
|
8935
|
+
}
|
|
8936
|
+
if (bit) {
|
|
8937
|
+
this.buffer[bufIndex] |= 128 >>> this.length % 8;
|
|
8938
|
+
}
|
|
8939
|
+
this.length++;
|
|
8940
|
+
}
|
|
8941
|
+
};
|
|
8942
|
+
module.exports = QRBitBuffer;
|
|
8943
|
+
});
|
|
8944
|
+
|
|
8945
|
+
// ../../node_modules/.bun/qrcode-terminal@0.12.0/node_modules/qrcode-terminal/vendor/QRCode/index.js
|
|
8946
|
+
var require_QRCode = __commonJS((exports, module) => {
|
|
8947
|
+
var QR8bitByte = require_QR8bitByte();
|
|
8948
|
+
var QRUtil = require_QRUtil();
|
|
8949
|
+
var QRPolynomial = require_QRPolynomial();
|
|
8950
|
+
var QRRSBlock = require_QRRSBlock();
|
|
8951
|
+
var QRBitBuffer = require_QRBitBuffer();
|
|
8952
|
+
function QRCode(typeNumber, errorCorrectLevel) {
|
|
8953
|
+
this.typeNumber = typeNumber;
|
|
8954
|
+
this.errorCorrectLevel = errorCorrectLevel;
|
|
8955
|
+
this.modules = null;
|
|
8956
|
+
this.moduleCount = 0;
|
|
8957
|
+
this.dataCache = null;
|
|
8958
|
+
this.dataList = [];
|
|
8959
|
+
}
|
|
8960
|
+
QRCode.prototype = {
|
|
8961
|
+
addData: function(data) {
|
|
8962
|
+
var newData = new QR8bitByte(data);
|
|
8963
|
+
this.dataList.push(newData);
|
|
8964
|
+
this.dataCache = null;
|
|
8965
|
+
},
|
|
8966
|
+
isDark: function(row, col) {
|
|
8967
|
+
if (row < 0 || this.moduleCount <= row || col < 0 || this.moduleCount <= col) {
|
|
8968
|
+
throw new Error(row + "," + col);
|
|
8969
|
+
}
|
|
8970
|
+
return this.modules[row][col];
|
|
8971
|
+
},
|
|
8972
|
+
getModuleCount: function() {
|
|
8973
|
+
return this.moduleCount;
|
|
8974
|
+
},
|
|
8975
|
+
make: function() {
|
|
8976
|
+
if (this.typeNumber < 1) {
|
|
8977
|
+
var typeNumber = 1;
|
|
8978
|
+
for (typeNumber = 1;typeNumber < 40; typeNumber++) {
|
|
8979
|
+
var rsBlocks = QRRSBlock.getRSBlocks(typeNumber, this.errorCorrectLevel);
|
|
8980
|
+
var buffer = new QRBitBuffer;
|
|
8981
|
+
var totalDataCount = 0;
|
|
8982
|
+
for (var i2 = 0;i2 < rsBlocks.length; i2++) {
|
|
8983
|
+
totalDataCount += rsBlocks[i2].dataCount;
|
|
8984
|
+
}
|
|
8985
|
+
for (var x = 0;x < this.dataList.length; x++) {
|
|
8986
|
+
var data = this.dataList[x];
|
|
8987
|
+
buffer.put(data.mode, 4);
|
|
8988
|
+
buffer.put(data.getLength(), QRUtil.getLengthInBits(data.mode, typeNumber));
|
|
8989
|
+
data.write(buffer);
|
|
8990
|
+
}
|
|
8991
|
+
if (buffer.getLengthInBits() <= totalDataCount * 8)
|
|
8992
|
+
break;
|
|
8993
|
+
}
|
|
8994
|
+
this.typeNumber = typeNumber;
|
|
8995
|
+
}
|
|
8996
|
+
this.makeImpl(false, this.getBestMaskPattern());
|
|
8997
|
+
},
|
|
8998
|
+
makeImpl: function(test, maskPattern) {
|
|
8999
|
+
this.moduleCount = this.typeNumber * 4 + 17;
|
|
9000
|
+
this.modules = new Array(this.moduleCount);
|
|
9001
|
+
for (var row = 0;row < this.moduleCount; row++) {
|
|
9002
|
+
this.modules[row] = new Array(this.moduleCount);
|
|
9003
|
+
for (var col = 0;col < this.moduleCount; col++) {
|
|
9004
|
+
this.modules[row][col] = null;
|
|
9005
|
+
}
|
|
9006
|
+
}
|
|
9007
|
+
this.setupPositionProbePattern(0, 0);
|
|
9008
|
+
this.setupPositionProbePattern(this.moduleCount - 7, 0);
|
|
9009
|
+
this.setupPositionProbePattern(0, this.moduleCount - 7);
|
|
9010
|
+
this.setupPositionAdjustPattern();
|
|
9011
|
+
this.setupTimingPattern();
|
|
9012
|
+
this.setupTypeInfo(test, maskPattern);
|
|
9013
|
+
if (this.typeNumber >= 7) {
|
|
9014
|
+
this.setupTypeNumber(test);
|
|
9015
|
+
}
|
|
9016
|
+
if (this.dataCache === null) {
|
|
9017
|
+
this.dataCache = QRCode.createData(this.typeNumber, this.errorCorrectLevel, this.dataList);
|
|
9018
|
+
}
|
|
9019
|
+
this.mapData(this.dataCache, maskPattern);
|
|
9020
|
+
},
|
|
9021
|
+
setupPositionProbePattern: function(row, col) {
|
|
9022
|
+
for (var r = -1;r <= 7; r++) {
|
|
9023
|
+
if (row + r <= -1 || this.moduleCount <= row + r)
|
|
9024
|
+
continue;
|
|
9025
|
+
for (var c = -1;c <= 7; c++) {
|
|
9026
|
+
if (col + c <= -1 || this.moduleCount <= col + c)
|
|
9027
|
+
continue;
|
|
9028
|
+
if (0 <= r && r <= 6 && (c === 0 || c === 6) || 0 <= c && c <= 6 && (r === 0 || r === 6) || 2 <= r && r <= 4 && 2 <= c && c <= 4) {
|
|
9029
|
+
this.modules[row + r][col + c] = true;
|
|
9030
|
+
} else {
|
|
9031
|
+
this.modules[row + r][col + c] = false;
|
|
9032
|
+
}
|
|
9033
|
+
}
|
|
9034
|
+
}
|
|
9035
|
+
},
|
|
9036
|
+
getBestMaskPattern: function() {
|
|
9037
|
+
var minLostPoint = 0;
|
|
9038
|
+
var pattern = 0;
|
|
9039
|
+
for (var i2 = 0;i2 < 8; i2++) {
|
|
9040
|
+
this.makeImpl(true, i2);
|
|
9041
|
+
var lostPoint = QRUtil.getLostPoint(this);
|
|
9042
|
+
if (i2 === 0 || minLostPoint > lostPoint) {
|
|
9043
|
+
minLostPoint = lostPoint;
|
|
9044
|
+
pattern = i2;
|
|
9045
|
+
}
|
|
9046
|
+
}
|
|
9047
|
+
return pattern;
|
|
9048
|
+
},
|
|
9049
|
+
createMovieClip: function(target_mc, instance_name, depth) {
|
|
9050
|
+
var qr_mc = target_mc.createEmptyMovieClip(instance_name, depth);
|
|
9051
|
+
var cs = 1;
|
|
9052
|
+
this.make();
|
|
9053
|
+
for (var row = 0;row < this.modules.length; row++) {
|
|
9054
|
+
var y = row * cs;
|
|
9055
|
+
for (var col = 0;col < this.modules[row].length; col++) {
|
|
9056
|
+
var x = col * cs;
|
|
9057
|
+
var dark = this.modules[row][col];
|
|
9058
|
+
if (dark) {
|
|
9059
|
+
qr_mc.beginFill(0, 100);
|
|
9060
|
+
qr_mc.moveTo(x, y);
|
|
9061
|
+
qr_mc.lineTo(x + cs, y);
|
|
9062
|
+
qr_mc.lineTo(x + cs, y + cs);
|
|
9063
|
+
qr_mc.lineTo(x, y + cs);
|
|
9064
|
+
qr_mc.endFill();
|
|
9065
|
+
}
|
|
9066
|
+
}
|
|
9067
|
+
}
|
|
9068
|
+
return qr_mc;
|
|
9069
|
+
},
|
|
9070
|
+
setupTimingPattern: function() {
|
|
9071
|
+
for (var r = 8;r < this.moduleCount - 8; r++) {
|
|
9072
|
+
if (this.modules[r][6] !== null) {
|
|
9073
|
+
continue;
|
|
9074
|
+
}
|
|
9075
|
+
this.modules[r][6] = r % 2 === 0;
|
|
9076
|
+
}
|
|
9077
|
+
for (var c = 8;c < this.moduleCount - 8; c++) {
|
|
9078
|
+
if (this.modules[6][c] !== null) {
|
|
9079
|
+
continue;
|
|
9080
|
+
}
|
|
9081
|
+
this.modules[6][c] = c % 2 === 0;
|
|
9082
|
+
}
|
|
9083
|
+
},
|
|
9084
|
+
setupPositionAdjustPattern: function() {
|
|
9085
|
+
var pos = QRUtil.getPatternPosition(this.typeNumber);
|
|
9086
|
+
for (var i2 = 0;i2 < pos.length; i2++) {
|
|
9087
|
+
for (var j = 0;j < pos.length; j++) {
|
|
9088
|
+
var row = pos[i2];
|
|
9089
|
+
var col = pos[j];
|
|
9090
|
+
if (this.modules[row][col] !== null) {
|
|
9091
|
+
continue;
|
|
9092
|
+
}
|
|
9093
|
+
for (var r = -2;r <= 2; r++) {
|
|
9094
|
+
for (var c = -2;c <= 2; c++) {
|
|
9095
|
+
if (Math.abs(r) === 2 || Math.abs(c) === 2 || r === 0 && c === 0) {
|
|
9096
|
+
this.modules[row + r][col + c] = true;
|
|
9097
|
+
} else {
|
|
9098
|
+
this.modules[row + r][col + c] = false;
|
|
9099
|
+
}
|
|
9100
|
+
}
|
|
9101
|
+
}
|
|
9102
|
+
}
|
|
9103
|
+
}
|
|
9104
|
+
},
|
|
9105
|
+
setupTypeNumber: function(test) {
|
|
9106
|
+
var bits = QRUtil.getBCHTypeNumber(this.typeNumber);
|
|
9107
|
+
var mod;
|
|
9108
|
+
for (var i2 = 0;i2 < 18; i2++) {
|
|
9109
|
+
mod = !test && (bits >> i2 & 1) === 1;
|
|
9110
|
+
this.modules[Math.floor(i2 / 3)][i2 % 3 + this.moduleCount - 8 - 3] = mod;
|
|
9111
|
+
}
|
|
9112
|
+
for (var x = 0;x < 18; x++) {
|
|
9113
|
+
mod = !test && (bits >> x & 1) === 1;
|
|
9114
|
+
this.modules[x % 3 + this.moduleCount - 8 - 3][Math.floor(x / 3)] = mod;
|
|
9115
|
+
}
|
|
9116
|
+
},
|
|
9117
|
+
setupTypeInfo: function(test, maskPattern) {
|
|
9118
|
+
var data = this.errorCorrectLevel << 3 | maskPattern;
|
|
9119
|
+
var bits = QRUtil.getBCHTypeInfo(data);
|
|
9120
|
+
var mod;
|
|
9121
|
+
for (var v = 0;v < 15; v++) {
|
|
9122
|
+
mod = !test && (bits >> v & 1) === 1;
|
|
9123
|
+
if (v < 6) {
|
|
9124
|
+
this.modules[v][8] = mod;
|
|
9125
|
+
} else if (v < 8) {
|
|
9126
|
+
this.modules[v + 1][8] = mod;
|
|
9127
|
+
} else {
|
|
9128
|
+
this.modules[this.moduleCount - 15 + v][8] = mod;
|
|
9129
|
+
}
|
|
9130
|
+
}
|
|
9131
|
+
for (var h = 0;h < 15; h++) {
|
|
9132
|
+
mod = !test && (bits >> h & 1) === 1;
|
|
9133
|
+
if (h < 8) {
|
|
9134
|
+
this.modules[8][this.moduleCount - h - 1] = mod;
|
|
9135
|
+
} else if (h < 9) {
|
|
9136
|
+
this.modules[8][15 - h - 1 + 1] = mod;
|
|
9137
|
+
} else {
|
|
9138
|
+
this.modules[8][15 - h - 1] = mod;
|
|
9139
|
+
}
|
|
9140
|
+
}
|
|
9141
|
+
this.modules[this.moduleCount - 8][8] = !test;
|
|
9142
|
+
},
|
|
9143
|
+
mapData: function(data, maskPattern) {
|
|
9144
|
+
var inc = -1;
|
|
9145
|
+
var row = this.moduleCount - 1;
|
|
9146
|
+
var bitIndex = 7;
|
|
9147
|
+
var byteIndex = 0;
|
|
9148
|
+
for (var col = this.moduleCount - 1;col > 0; col -= 2) {
|
|
9149
|
+
if (col === 6)
|
|
9150
|
+
col--;
|
|
9151
|
+
while (true) {
|
|
9152
|
+
for (var c = 0;c < 2; c++) {
|
|
9153
|
+
if (this.modules[row][col - c] === null) {
|
|
9154
|
+
var dark = false;
|
|
9155
|
+
if (byteIndex < data.length) {
|
|
9156
|
+
dark = (data[byteIndex] >>> bitIndex & 1) === 1;
|
|
9157
|
+
}
|
|
9158
|
+
var mask = QRUtil.getMask(maskPattern, row, col - c);
|
|
9159
|
+
if (mask) {
|
|
9160
|
+
dark = !dark;
|
|
9161
|
+
}
|
|
9162
|
+
this.modules[row][col - c] = dark;
|
|
9163
|
+
bitIndex--;
|
|
9164
|
+
if (bitIndex === -1) {
|
|
9165
|
+
byteIndex++;
|
|
9166
|
+
bitIndex = 7;
|
|
9167
|
+
}
|
|
9168
|
+
}
|
|
9169
|
+
}
|
|
9170
|
+
row += inc;
|
|
9171
|
+
if (row < 0 || this.moduleCount <= row) {
|
|
9172
|
+
row -= inc;
|
|
9173
|
+
inc = -inc;
|
|
9174
|
+
break;
|
|
9175
|
+
}
|
|
9176
|
+
}
|
|
9177
|
+
}
|
|
9178
|
+
}
|
|
9179
|
+
};
|
|
9180
|
+
QRCode.PAD0 = 236;
|
|
9181
|
+
QRCode.PAD1 = 17;
|
|
9182
|
+
QRCode.createData = function(typeNumber, errorCorrectLevel, dataList) {
|
|
9183
|
+
var rsBlocks = QRRSBlock.getRSBlocks(typeNumber, errorCorrectLevel);
|
|
9184
|
+
var buffer = new QRBitBuffer;
|
|
9185
|
+
for (var i2 = 0;i2 < dataList.length; i2++) {
|
|
9186
|
+
var data = dataList[i2];
|
|
9187
|
+
buffer.put(data.mode, 4);
|
|
9188
|
+
buffer.put(data.getLength(), QRUtil.getLengthInBits(data.mode, typeNumber));
|
|
9189
|
+
data.write(buffer);
|
|
9190
|
+
}
|
|
9191
|
+
var totalDataCount = 0;
|
|
9192
|
+
for (var x = 0;x < rsBlocks.length; x++) {
|
|
9193
|
+
totalDataCount += rsBlocks[x].dataCount;
|
|
9194
|
+
}
|
|
9195
|
+
if (buffer.getLengthInBits() > totalDataCount * 8) {
|
|
9196
|
+
throw new Error("code length overflow. (" + buffer.getLengthInBits() + ">" + totalDataCount * 8 + ")");
|
|
9197
|
+
}
|
|
9198
|
+
if (buffer.getLengthInBits() + 4 <= totalDataCount * 8) {
|
|
9199
|
+
buffer.put(0, 4);
|
|
9200
|
+
}
|
|
9201
|
+
while (buffer.getLengthInBits() % 8 !== 0) {
|
|
9202
|
+
buffer.putBit(false);
|
|
9203
|
+
}
|
|
9204
|
+
while (true) {
|
|
9205
|
+
if (buffer.getLengthInBits() >= totalDataCount * 8) {
|
|
9206
|
+
break;
|
|
9207
|
+
}
|
|
9208
|
+
buffer.put(QRCode.PAD0, 8);
|
|
9209
|
+
if (buffer.getLengthInBits() >= totalDataCount * 8) {
|
|
9210
|
+
break;
|
|
9211
|
+
}
|
|
9212
|
+
buffer.put(QRCode.PAD1, 8);
|
|
9213
|
+
}
|
|
9214
|
+
return QRCode.createBytes(buffer, rsBlocks);
|
|
9215
|
+
};
|
|
9216
|
+
QRCode.createBytes = function(buffer, rsBlocks) {
|
|
9217
|
+
var offset = 0;
|
|
9218
|
+
var maxDcCount = 0;
|
|
9219
|
+
var maxEcCount = 0;
|
|
9220
|
+
var dcdata = new Array(rsBlocks.length);
|
|
9221
|
+
var ecdata = new Array(rsBlocks.length);
|
|
9222
|
+
for (var r = 0;r < rsBlocks.length; r++) {
|
|
9223
|
+
var dcCount = rsBlocks[r].dataCount;
|
|
9224
|
+
var ecCount = rsBlocks[r].totalCount - dcCount;
|
|
9225
|
+
maxDcCount = Math.max(maxDcCount, dcCount);
|
|
9226
|
+
maxEcCount = Math.max(maxEcCount, ecCount);
|
|
9227
|
+
dcdata[r] = new Array(dcCount);
|
|
9228
|
+
for (var i2 = 0;i2 < dcdata[r].length; i2++) {
|
|
9229
|
+
dcdata[r][i2] = 255 & buffer.buffer[i2 + offset];
|
|
9230
|
+
}
|
|
9231
|
+
offset += dcCount;
|
|
9232
|
+
var rsPoly = QRUtil.getErrorCorrectPolynomial(ecCount);
|
|
9233
|
+
var rawPoly = new QRPolynomial(dcdata[r], rsPoly.getLength() - 1);
|
|
9234
|
+
var modPoly = rawPoly.mod(rsPoly);
|
|
9235
|
+
ecdata[r] = new Array(rsPoly.getLength() - 1);
|
|
9236
|
+
for (var x = 0;x < ecdata[r].length; x++) {
|
|
9237
|
+
var modIndex = x + modPoly.getLength() - ecdata[r].length;
|
|
9238
|
+
ecdata[r][x] = modIndex >= 0 ? modPoly.get(modIndex) : 0;
|
|
9239
|
+
}
|
|
9240
|
+
}
|
|
9241
|
+
var totalCodeCount = 0;
|
|
9242
|
+
for (var y = 0;y < rsBlocks.length; y++) {
|
|
9243
|
+
totalCodeCount += rsBlocks[y].totalCount;
|
|
9244
|
+
}
|
|
9245
|
+
var data = new Array(totalCodeCount);
|
|
9246
|
+
var index = 0;
|
|
9247
|
+
for (var z2 = 0;z2 < maxDcCount; z2++) {
|
|
9248
|
+
for (var s = 0;s < rsBlocks.length; s++) {
|
|
9249
|
+
if (z2 < dcdata[s].length) {
|
|
9250
|
+
data[index++] = dcdata[s][z2];
|
|
9251
|
+
}
|
|
9252
|
+
}
|
|
9253
|
+
}
|
|
9254
|
+
for (var xx = 0;xx < maxEcCount; xx++) {
|
|
9255
|
+
for (var t = 0;t < rsBlocks.length; t++) {
|
|
9256
|
+
if (xx < ecdata[t].length) {
|
|
9257
|
+
data[index++] = ecdata[t][xx];
|
|
9258
|
+
}
|
|
9259
|
+
}
|
|
9260
|
+
}
|
|
9261
|
+
return data;
|
|
9262
|
+
};
|
|
9263
|
+
module.exports = QRCode;
|
|
9264
|
+
});
|
|
9265
|
+
|
|
9266
|
+
// ../../node_modules/.bun/qrcode-terminal@0.12.0/node_modules/qrcode-terminal/lib/main.js
|
|
9267
|
+
var require_main = __commonJS((exports, module) => {
|
|
9268
|
+
var QRCode = require_QRCode();
|
|
9269
|
+
var QRErrorCorrectLevel = require_QRErrorCorrectLevel();
|
|
9270
|
+
var black = "\x1B[40m \x1B[0m";
|
|
9271
|
+
var white = "\x1B[47m \x1B[0m";
|
|
9272
|
+
var toCell = function(isBlack) {
|
|
9273
|
+
return isBlack ? black : white;
|
|
9274
|
+
};
|
|
9275
|
+
var repeat2 = function(color) {
|
|
9276
|
+
return {
|
|
9277
|
+
times: function(count) {
|
|
9278
|
+
return new Array(count).join(color);
|
|
9279
|
+
}
|
|
9280
|
+
};
|
|
9281
|
+
};
|
|
9282
|
+
var fill = function(length, value) {
|
|
9283
|
+
var arr = new Array(length);
|
|
9284
|
+
for (var i2 = 0;i2 < length; i2++) {
|
|
9285
|
+
arr[i2] = value;
|
|
9286
|
+
}
|
|
9287
|
+
return arr;
|
|
9288
|
+
};
|
|
9289
|
+
module.exports = {
|
|
9290
|
+
error: QRErrorCorrectLevel.L,
|
|
9291
|
+
generate: function(input, opts, cb) {
|
|
9292
|
+
if (typeof opts === "function") {
|
|
9293
|
+
cb = opts;
|
|
9294
|
+
opts = {};
|
|
9295
|
+
}
|
|
9296
|
+
var qrcode = new QRCode(-1, this.error);
|
|
9297
|
+
qrcode.addData(input);
|
|
9298
|
+
qrcode.make();
|
|
9299
|
+
var output = "";
|
|
9300
|
+
if (opts && opts.small) {
|
|
9301
|
+
var BLACK = true, WHITE = false;
|
|
9302
|
+
var moduleCount = qrcode.getModuleCount();
|
|
9303
|
+
var moduleData = qrcode.modules.slice();
|
|
9304
|
+
var oddRow = moduleCount % 2 === 1;
|
|
9305
|
+
if (oddRow) {
|
|
9306
|
+
moduleData.push(fill(moduleCount, WHITE));
|
|
9307
|
+
}
|
|
9308
|
+
var platte = {
|
|
9309
|
+
WHITE_ALL: "\u2588",
|
|
9310
|
+
WHITE_BLACK: "\u2580",
|
|
9311
|
+
BLACK_WHITE: "\u2584",
|
|
9312
|
+
BLACK_ALL: " "
|
|
9313
|
+
};
|
|
9314
|
+
var borderTop = repeat2(platte.BLACK_WHITE).times(moduleCount + 3);
|
|
9315
|
+
var borderBottom = repeat2(platte.WHITE_BLACK).times(moduleCount + 3);
|
|
9316
|
+
output += borderTop + `
|
|
9317
|
+
`;
|
|
9318
|
+
for (var row = 0;row < moduleCount; row += 2) {
|
|
9319
|
+
output += platte.WHITE_ALL;
|
|
9320
|
+
for (var col = 0;col < moduleCount; col++) {
|
|
9321
|
+
if (moduleData[row][col] === WHITE && moduleData[row + 1][col] === WHITE) {
|
|
9322
|
+
output += platte.WHITE_ALL;
|
|
9323
|
+
} else if (moduleData[row][col] === WHITE && moduleData[row + 1][col] === BLACK) {
|
|
9324
|
+
output += platte.WHITE_BLACK;
|
|
9325
|
+
} else if (moduleData[row][col] === BLACK && moduleData[row + 1][col] === WHITE) {
|
|
9326
|
+
output += platte.BLACK_WHITE;
|
|
9327
|
+
} else {
|
|
9328
|
+
output += platte.BLACK_ALL;
|
|
9329
|
+
}
|
|
9330
|
+
}
|
|
9331
|
+
output += platte.WHITE_ALL + `
|
|
9332
|
+
`;
|
|
9333
|
+
}
|
|
9334
|
+
if (!oddRow) {
|
|
9335
|
+
output += borderBottom;
|
|
9336
|
+
}
|
|
9337
|
+
} else {
|
|
9338
|
+
var border = repeat2(white).times(qrcode.getModuleCount() + 3);
|
|
9339
|
+
output += border + `
|
|
9340
|
+
`;
|
|
9341
|
+
qrcode.modules.forEach(function(row2) {
|
|
9342
|
+
output += white;
|
|
9343
|
+
output += row2.map(toCell).join("");
|
|
9344
|
+
output += white + `
|
|
9345
|
+
`;
|
|
9346
|
+
});
|
|
9347
|
+
output += border;
|
|
9348
|
+
}
|
|
9349
|
+
if (cb)
|
|
9350
|
+
cb(output);
|
|
9351
|
+
else
|
|
9352
|
+
console.log(output);
|
|
9353
|
+
},
|
|
9354
|
+
setErrorLevel: function(error) {
|
|
9355
|
+
this.error = QRErrorCorrectLevel[error] || this.error;
|
|
9356
|
+
}
|
|
9357
|
+
};
|
|
9358
|
+
});
|
|
9359
|
+
|
|
5709
9360
|
// ../core/src/channels/manager.ts
|
|
5710
9361
|
init_logger();
|
|
5711
9362
|
|
|
@@ -6510,9 +10161,9 @@ import makeWASocket, {
|
|
|
6510
10161
|
} from "@whiskeysockets/baileys";
|
|
6511
10162
|
init_logger();
|
|
6512
10163
|
init_sqlite();
|
|
10164
|
+
var import_qrcode_terminal = __toESM(require_main(), 1);
|
|
6513
10165
|
import { existsSync as existsSync6, mkdirSync as mkdirSync5, rmSync } from "fs";
|
|
6514
10166
|
import * as path6 from "path";
|
|
6515
|
-
import qrcodeTerminal from "qrcode-terminal";
|
|
6516
10167
|
|
|
6517
10168
|
class WhatsAppChannel extends BaseChannel {
|
|
6518
10169
|
name = "whatsapp";
|
|
@@ -6643,7 +10294,7 @@ class WhatsAppChannel extends BaseChannel {
|
|
|
6643
10294
|
this.log.info(" WHATSAPP QR CODE - Scan with your phone");
|
|
6644
10295
|
this.log.info("=".repeat(50) + `
|
|
6645
10296
|
`);
|
|
6646
|
-
|
|
10297
|
+
import_qrcode_terminal.default.generate(qr, { small: false }, (qrString) => {
|
|
6647
10298
|
this.log.info(qrString);
|
|
6648
10299
|
});
|
|
6649
10300
|
this.log.info(`
|
|
@@ -7262,19 +10913,19 @@ class ChannelManager {
|
|
|
7262
10913
|
await channel.start();
|
|
7263
10914
|
this.log.info(`Started channel: ${key}`);
|
|
7264
10915
|
}
|
|
7265
|
-
async addChannel(
|
|
7266
|
-
await this.createChannel(
|
|
7267
|
-
const channel = this.channels.get(`${
|
|
10916
|
+
async addChannel(type2, accountId, config) {
|
|
10917
|
+
await this.createChannel(type2, accountId, config);
|
|
10918
|
+
const channel = this.channels.get(`${type2}:${accountId}`);
|
|
7268
10919
|
if (channel && !channel.isRunning()) {
|
|
7269
10920
|
await channel.start();
|
|
7270
10921
|
}
|
|
7271
10922
|
}
|
|
7272
|
-
getChannelStatus(
|
|
7273
|
-
const key = `${
|
|
10923
|
+
getChannelStatus(type2, accountId) {
|
|
10924
|
+
const key = `${type2}:${accountId}`;
|
|
7274
10925
|
const channel = this.channels.get(key);
|
|
7275
10926
|
if (!channel)
|
|
7276
10927
|
return { status: "not_found" };
|
|
7277
|
-
if (
|
|
10928
|
+
if (type2 === "whatsapp" && "getConnectionState" in channel) {
|
|
7278
10929
|
const state = channel.getConnectionState();
|
|
7279
10930
|
return { status: state.status, qrCode: state.qrCode };
|
|
7280
10931
|
}
|