abyss-ai
Version:
Autonomous AI coding agent - enhanced OpenCode with autonomous capabilities
1,613 lines (1,581 loc) • 4.24 MB
JavaScript
// @bun
var __create = Object.create;
var __getProtoOf = Object.getPrototypeOf;
var __defProp = Object.defineProperty;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __toESM = (mod, isNodeMode, target) => {
target = mod != null ? __create(__getProtoOf(mod)) : {};
const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
for (let key of __getOwnPropNames(mod))
if (!__hasOwnProp.call(to, key))
__defProp(to, key, {
get: () => mod[key],
enumerable: true
});
return to;
};
var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, {
get: all[name],
enumerable: true,
configurable: true,
set: (newValue) => all[name] = () => newValue
});
};
var __require = import.meta.require;
var __using = (stack, value, async) => {
if (value != null) {
if (typeof value !== "object" && typeof value !== "function")
throw TypeError('Object expected to be assigned to "using" declaration');
let dispose;
if (async)
dispose = value[Symbol.asyncDispose];
if (dispose === undefined)
dispose = value[Symbol.dispose];
if (typeof dispose !== "function")
throw TypeError("Object not disposable");
stack.push([async, dispose, value]);
} else if (async) {
stack.push([async]);
}
return value;
};
var __callDispose = (stack, error, hasError) => {
let fail = (e) => error = hasError ? new SuppressedError(e, error, "An error was suppressed during disposal") : (hasError = true, e), next = (it) => {
while (it = stack.pop()) {
try {
var result = it[1] && it[1].call(it[2]);
if (it[0])
return Promise.resolve(result).then(next, (e) => (fail(e), next()));
} catch (e) {
fail(e);
}
}
if (hasError)
throw error;
};
return next();
};
// ../../node_modules/get-caller-file/index.js
var require_get_caller_file = __commonJS((exports, module) => {
module.exports = function getCallerFile(position) {
if (position === undefined) {
position = 2;
}
if (position >= Error.stackTraceLimit) {
throw new TypeError("getCallerFile(position) requires position be less then Error.stackTraceLimit but position was: `" + position + "` and Error.stackTraceLimit was: `" + Error.stackTraceLimit + "`");
}
var oldPrepareStackTrace = Error.prepareStackTrace;
Error.prepareStackTrace = function(_, stack2) {
return stack2;
};
var stack = new Error().stack;
Error.prepareStackTrace = oldPrepareStackTrace;
if (stack !== null && typeof stack === "object") {
return stack[position] ? stack[position].getFileName() : undefined;
}
};
});
// ../../node_modules/kind-of/index.js
var require_kind_of = __commonJS((exports, module) => {
var toString = Object.prototype.toString;
module.exports = function kindOf(val) {
if (val === undefined)
return "undefined";
if (val === null)
return "null";
var type = typeof val;
if (type === "boolean")
return "boolean";
if (type === "string")
return "string";
if (type === "number")
return "number";
if (type === "symbol")
return "symbol";
if (type === "function") {
return isGeneratorFn(val) ? "generatorfunction" : "function";
}
if (isArray(val))
return "array";
if (isBuffer(val))
return "buffer";
if (isArguments(val))
return "arguments";
if (isDate(val))
return "date";
if (isError(val))
return "error";
if (isRegexp(val))
return "regexp";
switch (ctorName(val)) {
case "Symbol":
return "symbol";
case "Promise":
return "promise";
case "WeakMap":
return "weakmap";
case "WeakSet":
return "weakset";
case "Map":
return "map";
case "Set":
return "set";
case "Int8Array":
return "int8array";
case "Uint8Array":
return "uint8array";
case "Uint8ClampedArray":
return "uint8clampedarray";
case "Int16Array":
return "int16array";
case "Uint16Array":
return "uint16array";
case "Int32Array":
return "int32array";
case "Uint32Array":
return "uint32array";
case "Float32Array":
return "float32array";
case "Float64Array":
return "float64array";
}
if (isGeneratorObj(val)) {
return "generator";
}
type = toString.call(val);
switch (type) {
case "[object Object]":
return "object";
case "[object Map Iterator]":
return "mapiterator";
case "[object Set Iterator]":
return "setiterator";
case "[object String Iterator]":
return "stringiterator";
case "[object Array Iterator]":
return "arrayiterator";
}
return type.slice(8, -1).toLowerCase().replace(/\s/g, "");
};
function ctorName(val) {
return typeof val.constructor === "function" ? val.constructor.name : null;
}
function isArray(val) {
if (Array.isArray)
return Array.isArray(val);
return val instanceof Array;
}
function isError(val) {
return val instanceof Error || typeof val.message === "string" && val.constructor && typeof val.constructor.stackTraceLimit === "number";
}
function isDate(val) {
if (val instanceof Date)
return true;
return typeof val.toDateString === "function" && typeof val.getDate === "function" && typeof val.setDate === "function";
}
function isRegexp(val) {
if (val instanceof RegExp)
return true;
return typeof val.flags === "string" && typeof val.ignoreCase === "boolean" && typeof val.multiline === "boolean" && typeof val.global === "boolean";
}
function isGeneratorFn(name, val) {
return ctorName(name) === "GeneratorFunction";
}
function isGeneratorObj(val) {
return typeof val.throw === "function" && typeof val.return === "function" && typeof val.next === "function";
}
function isArguments(val) {
try {
if (typeof val.length === "number" && typeof val.callee === "function") {
return true;
}
} catch (err) {
if (err.message.indexOf("callee") !== -1) {
return true;
}
}
return false;
}
function isBuffer(val) {
if (val.constructor && typeof val.constructor.isBuffer === "function") {
return val.constructor.isBuffer(val);
}
return false;
}
});
// ../../node_modules/is-extendable/index.js
var require_is_extendable = __commonJS((exports, module) => {
/*!
* is-extendable <https://github.com/jonschlinkert/is-extendable>
*
* Copyright (c) 2015, Jon Schlinkert.
* Licensed under the MIT License.
*/
module.exports = function isExtendable(val) {
return typeof val !== "undefined" && val !== null && (typeof val === "object" || typeof val === "function");
};
});
// ../../node_modules/extend-shallow/index.js
var require_extend_shallow = __commonJS((exports, module) => {
var isObject = require_is_extendable();
module.exports = function extend(o4) {
if (!isObject(o4)) {
o4 = {};
}
var len = arguments.length;
for (var i4 = 1;i4 < len; i4++) {
var obj = arguments[i4];
if (isObject(obj)) {
assign(o4, obj);
}
}
return o4;
};
function assign(a3, b) {
for (var key in b) {
if (hasOwn(b, key)) {
a3[key] = b[key];
}
}
}
function hasOwn(obj, key) {
return Object.prototype.hasOwnProperty.call(obj, key);
}
});
// ../../node_modules/section-matter/index.js
var require_section_matter = __commonJS((exports, module) => {
var typeOf = require_kind_of();
var extend = require_extend_shallow();
module.exports = function(input, options2) {
if (typeof options2 === "function") {
options2 = { parse: options2 };
}
var file = toObject(input);
var defaults = { section_delimiter: "---", parse: identity };
var opts = extend({}, defaults, options2);
var delim = opts.section_delimiter;
var lines = file.content.split(/\r?\n/);
var sections = null;
var section = createSection();
var content = [];
var stack = [];
function initSections(val) {
file.content = val;
sections = [];
content = [];
}
function closeSection(val) {
if (stack.length) {
section.key = getKey(stack[0], delim);
section.content = val;
opts.parse(section, sections);
sections.push(section);
section = createSection();
content = [];
stack = [];
}
}
for (var i4 = 0;i4 < lines.length; i4++) {
var line = lines[i4];
var len = stack.length;
var ln = line.trim();
if (isDelimiter(ln, delim)) {
if (ln.length === 3 && i4 !== 0) {
if (len === 0 || len === 2) {
content.push(line);
continue;
}
stack.push(ln);
section.data = content.join(`
`);
content = [];
continue;
}
if (sections === null) {
initSections(content.join(`
`));
}
if (len === 2) {
closeSection(content.join(`
`));
}
stack.push(ln);
continue;
}
content.push(line);
}
if (sections === null) {
initSections(content.join(`
`));
} else {
closeSection(content.join(`
`));
}
file.sections = sections;
return file;
};
function isDelimiter(line, delim) {
if (line.slice(0, delim.length) !== delim) {
return false;
}
if (line.charAt(delim.length + 1) === delim.slice(-1)) {
return false;
}
return true;
}
function toObject(input) {
if (typeOf(input) !== "object") {
input = { content: input };
}
if (typeof input.content !== "string" && !isBuffer(input.content)) {
throw new TypeError("expected a buffer or string");
}
input.content = input.content.toString();
input.sections = [];
return input;
}
function getKey(val, delim) {
return val ? val.slice(delim.length).trim() : "";
}
function createSection() {
return { key: "", data: "", content: "" };
}
function identity(val) {
return val;
}
function isBuffer(val) {
if (val && val.constructor && typeof val.constructor.isBuffer === "function") {
return val.constructor.isBuffer(val);
}
return false;
}
});
// ../../node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/common.js
var require_common = __commonJS((exports, module) => {
function isNothing(subject) {
return typeof subject === "undefined" || subject === null;
}
function isObject(subject) {
return typeof subject === "object" && subject !== null;
}
function toArray(sequence) {
if (Array.isArray(sequence))
return sequence;
else if (isNothing(sequence))
return [];
return [sequence];
}
function extend(target, source) {
var index, length, key, sourceKeys;
if (source) {
sourceKeys = Object.keys(source);
for (index = 0, length = sourceKeys.length;index < length; index += 1) {
key = sourceKeys[index];
target[key] = source[key];
}
}
return target;
}
function repeat(string, count) {
var result = "", cycle;
for (cycle = 0;cycle < count; cycle += 1) {
result += string;
}
return result;
}
function isNegativeZero(number) {
return number === 0 && Number.NEGATIVE_INFINITY === 1 / number;
}
exports.isNothing = isNothing;
exports.isObject = isObject;
exports.toArray = toArray;
exports.repeat = repeat;
exports.isNegativeZero = isNegativeZero;
exports.extend = extend;
});
// ../../node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/exception.js
var require_exception = __commonJS((exports, module) => {
function YAMLException(reason, mark) {
Error.call(this);
this.name = "YAMLException";
this.reason = reason;
this.mark = mark;
this.message = (this.reason || "(unknown reason)") + (this.mark ? " " + this.mark.toString() : "");
if (Error.captureStackTrace) {
Error.captureStackTrace(this, this.constructor);
} else {
this.stack = new Error().stack || "";
}
}
YAMLException.prototype = Object.create(Error.prototype);
YAMLException.prototype.constructor = YAMLException;
YAMLException.prototype.toString = function toString(compact) {
var result = this.name + ": ";
result += this.reason || "(unknown reason)";
if (!compact && this.mark) {
result += " " + this.mark.toString();
}
return result;
};
module.exports = YAMLException;
});
// ../../node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/mark.js
var require_mark = __commonJS((exports, module) => {
var common = require_common();
function Mark(name, buffer, position, line, column) {
this.name = name;
this.buffer = buffer;
this.position = position;
this.line = line;
this.column = column;
}
Mark.prototype.getSnippet = function getSnippet(indent, maxLength) {
var head, start, tail, end, snippet;
if (!this.buffer)
return null;
indent = indent || 4;
maxLength = maxLength || 75;
head = "";
start = this.position;
while (start > 0 && `\x00\r
\x85\u2028\u2029`.indexOf(this.buffer.charAt(start - 1)) === -1) {
start -= 1;
if (this.position - start > maxLength / 2 - 1) {
head = " ... ";
start += 5;
break;
}
}
tail = "";
end = this.position;
while (end < this.buffer.length && `\x00\r
\x85\u2028\u2029`.indexOf(this.buffer.charAt(end)) === -1) {
end += 1;
if (end - this.position > maxLength / 2 - 1) {
tail = " ... ";
end -= 5;
break;
}
}
snippet = this.buffer.slice(start, end);
return common.repeat(" ", indent) + head + snippet + tail + `
` + common.repeat(" ", indent + this.position - start + head.length) + "^";
};
Mark.prototype.toString = function toString(compact) {
var snippet, where = "";
if (this.name) {
where += 'in "' + this.name + '" ';
}
where += "at line " + (this.line + 1) + ", column " + (this.column + 1);
if (!compact) {
snippet = this.getSnippet();
if (snippet) {
where += `:
` + snippet;
}
}
return where;
};
module.exports = Mark;
});
// ../../node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type.js
var require_type = __commonJS((exports, module) => {
var YAMLException = require_exception();
var TYPE_CONSTRUCTOR_OPTIONS = [
"kind",
"resolve",
"construct",
"instanceOf",
"predicate",
"represent",
"defaultStyle",
"styleAliases"
];
var YAML_NODE_KINDS = [
"scalar",
"sequence",
"mapping"
];
function compileStyleAliases(map) {
var result = {};
if (map !== null) {
Object.keys(map).forEach(function(style) {
map[style].forEach(function(alias) {
result[String(alias)] = style;
});
});
}
return result;
}
function Type(tag, options2) {
options2 = options2 || {};
Object.keys(options2).forEach(function(name) {
if (TYPE_CONSTRUCTOR_OPTIONS.indexOf(name) === -1) {
throw new YAMLException('Unknown option "' + name + '" is met in definition of "' + tag + '" YAML type.');
}
});
this.tag = tag;
this.kind = options2["kind"] || null;
this.resolve = options2["resolve"] || function() {
return true;
};
this.construct = options2["construct"] || function(data2) {
return data2;
};
this.instanceOf = options2["instanceOf"] || null;
this.predicate = options2["predicate"] || null;
this.represent = options2["represent"] || null;
this.defaultStyle = options2["defaultStyle"] || null;
this.styleAliases = compileStyleAliases(options2["styleAliases"] || null);
if (YAML_NODE_KINDS.indexOf(this.kind) === -1) {
throw new YAMLException('Unknown kind "' + this.kind + '" is specified for "' + tag + '" YAML type.');
}
}
module.exports = Type;
});
// ../../node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/schema.js
var require_schema = __commonJS((exports, module) => {
var common = require_common();
var YAMLException = require_exception();
var Type = require_type();
function compileList(schema, name, result) {
var exclude = [];
schema.include.forEach(function(includedSchema) {
result = compileList(includedSchema, name, result);
});
schema[name].forEach(function(currentType) {
result.forEach(function(previousType, previousIndex) {
if (previousType.tag === currentType.tag && previousType.kind === currentType.kind) {
exclude.push(previousIndex);
}
});
result.push(currentType);
});
return result.filter(function(type, index) {
return exclude.indexOf(index) === -1;
});
}
function compileMap() {
var result = {
scalar: {},
sequence: {},
mapping: {},
fallback: {}
}, index, length;
function collectType(type) {
result[type.kind][type.tag] = result["fallback"][type.tag] = type;
}
for (index = 0, length = arguments.length;index < length; index += 1) {
arguments[index].forEach(collectType);
}
return result;
}
function Schema(definition) {
this.include = definition.include || [];
this.implicit = definition.implicit || [];
this.explicit = definition.explicit || [];
this.implicit.forEach(function(type) {
if (type.loadKind && type.loadKind !== "scalar") {
throw new YAMLException("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");
}
});
this.compiledImplicit = compileList(this, "implicit", []);
this.compiledExplicit = compileList(this, "explicit", []);
this.compiledTypeMap = compileMap(this.compiledImplicit, this.compiledExplicit);
}
Schema.DEFAULT = null;
Schema.create = function createSchema() {
var schemas, types2;
switch (arguments.length) {
case 1:
schemas = Schema.DEFAULT;
types2 = arguments[0];
break;
case 2:
schemas = arguments[0];
types2 = arguments[1];
break;
default:
throw new YAMLException("Wrong number of arguments for Schema.create function");
}
schemas = common.toArray(schemas);
types2 = common.toArray(types2);
if (!schemas.every(function(schema) {
return schema instanceof Schema;
})) {
throw new YAMLException("Specified list of super schemas (or a single Schema object) contains a non-Schema object.");
}
if (!types2.every(function(type) {
return type instanceof Type;
})) {
throw new YAMLException("Specified list of YAML types (or a single Type object) contains a non-Type object.");
}
return new Schema({
include: schemas,
explicit: types2
});
};
module.exports = Schema;
});
// ../../node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/str.js
var require_str = __commonJS((exports, module) => {
var Type = require_type();
module.exports = new Type("tag:yaml.org,2002:str", {
kind: "scalar",
construct: function(data2) {
return data2 !== null ? data2 : "";
}
});
});
// ../../node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/seq.js
var require_seq = __commonJS((exports, module) => {
var Type = require_type();
module.exports = new Type("tag:yaml.org,2002:seq", {
kind: "sequence",
construct: function(data2) {
return data2 !== null ? data2 : [];
}
});
});
// ../../node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/map.js
var require_map = __commonJS((exports, module) => {
var Type = require_type();
module.exports = new Type("tag:yaml.org,2002:map", {
kind: "mapping",
construct: function(data2) {
return data2 !== null ? data2 : {};
}
});
});
// ../../node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/schema/failsafe.js
var require_failsafe = __commonJS((exports, module) => {
var Schema = require_schema();
module.exports = new Schema({
explicit: [
require_str(),
require_seq(),
require_map()
]
});
});
// ../../node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/null.js
var require_null = __commonJS((exports, module) => {
var Type = require_type();
function resolveYamlNull(data2) {
if (data2 === null)
return true;
var max = data2.length;
return max === 1 && data2 === "~" || max === 4 && (data2 === "null" || data2 === "Null" || data2 === "NULL");
}
function constructYamlNull() {
return null;
}
function isNull(object) {
return object === null;
}
module.exports = new Type("tag:yaml.org,2002:null", {
kind: "scalar",
resolve: resolveYamlNull,
construct: constructYamlNull,
predicate: isNull,
represent: {
canonical: function() {
return "~";
},
lowercase: function() {
return "null";
},
uppercase: function() {
return "NULL";
},
camelcase: function() {
return "Null";
}
},
defaultStyle: "lowercase"
});
});
// ../../node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/bool.js
var require_bool = __commonJS((exports, module) => {
var Type = require_type();
function resolveYamlBoolean(data2) {
if (data2 === null)
return false;
var max = data2.length;
return max === 4 && (data2 === "true" || data2 === "True" || data2 === "TRUE") || max === 5 && (data2 === "false" || data2 === "False" || data2 === "FALSE");
}
function constructYamlBoolean(data2) {
return data2 === "true" || data2 === "True" || data2 === "TRUE";
}
function isBoolean2(object) {
return Object.prototype.toString.call(object) === "[object Boolean]";
}
module.exports = new Type("tag:yaml.org,2002:bool", {
kind: "scalar",
resolve: resolveYamlBoolean,
construct: constructYamlBoolean,
predicate: isBoolean2,
represent: {
lowercase: function(object) {
return object ? "true" : "false";
},
uppercase: function(object) {
return object ? "TRUE" : "FALSE";
},
camelcase: function(object) {
return object ? "True" : "False";
}
},
defaultStyle: "lowercase"
});
});
// ../../node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/int.js
var require_int = __commonJS((exports, module) => {
var common = require_common();
var Type = require_type();
function isHexCode(c) {
return 48 <= c && c <= 57 || 65 <= c && c <= 70 || 97 <= c && c <= 102;
}
function isOctCode(c) {
return 48 <= c && c <= 55;
}
function isDecCode(c) {
return 48 <= c && c <= 57;
}
function resolveYamlInteger(data2) {
if (data2 === null)
return false;
var max = data2.length, index = 0, hasDigits = false, ch;
if (!max)
return false;
ch = data2[index];
if (ch === "-" || ch === "+") {
ch = data2[++index];
}
if (ch === "0") {
if (index + 1 === max)
return true;
ch = data2[++index];
if (ch === "b") {
index++;
for (;index < max; index++) {
ch = data2[index];
if (ch === "_")
continue;
if (ch !== "0" && ch !== "1")
return false;
hasDigits = true;
}
return hasDigits && ch !== "_";
}
if (ch === "x") {
index++;
for (;index < max; index++) {
ch = data2[index];
if (ch === "_")
continue;
if (!isHexCode(data2.charCodeAt(index)))
return false;
hasDigits = true;
}
return hasDigits && ch !== "_";
}
for (;index < max; index++) {
ch = data2[index];
if (ch === "_")
continue;
if (!isOctCode(data2.charCodeAt(index)))
return false;
hasDigits = true;
}
return hasDigits && ch !== "_";
}
if (ch === "_")
return false;
for (;index < max; index++) {
ch = data2[index];
if (ch === "_")
continue;
if (ch === ":")
break;
if (!isDecCode(data2.charCodeAt(index))) {
return false;
}
hasDigits = true;
}
if (!hasDigits || ch === "_")
return false;
if (ch !== ":")
return true;
return /^(:[0-5]?[0-9])+$/.test(data2.slice(index));
}
function constructYamlInteger(data2) {
var value = data2, sign = 1, ch, base, digits = [];
if (value.indexOf("_") !== -1) {
value = value.replace(/_/g, "");
}
ch = value[0];
if (ch === "-" || ch === "+") {
if (ch === "-")
sign = -1;
value = value.slice(1);
ch = value[0];
}
if (value === "0")
return 0;
if (ch === "0") {
if (value[1] === "b")
return sign * parseInt(value.slice(2), 2);
if (value[1] === "x")
return sign * parseInt(value, 16);
return sign * parseInt(value, 8);
}
if (value.indexOf(":") !== -1) {
value.split(":").forEach(function(v) {
digits.unshift(parseInt(v, 10));
});
value = 0;
base = 1;
digits.forEach(function(d2) {
value += d2 * base;
base *= 60;
});
return sign * value;
}
return sign * parseInt(value, 10);
}
function isInteger(object) {
return Object.prototype.toString.call(object) === "[object Number]" && (object % 1 === 0 && !common.isNegativeZero(object));
}
module.exports = new Type("tag:yaml.org,2002:int", {
kind: "scalar",
resolve: resolveYamlInteger,
construct: constructYamlInteger,
predicate: isInteger,
represent: {
binary: function(obj) {
return obj >= 0 ? "0b" + obj.toString(2) : "-0b" + obj.toString(2).slice(1);
},
octal: function(obj) {
return obj >= 0 ? "0" + obj.toString(8) : "-0" + obj.toString(8).slice(1);
},
decimal: function(obj) {
return obj.toString(10);
},
hexadecimal: function(obj) {
return obj >= 0 ? "0x" + obj.toString(16).toUpperCase() : "-0x" + obj.toString(16).toUpperCase().slice(1);
}
},
defaultStyle: "decimal",
styleAliases: {
binary: [2, "bin"],
octal: [8, "oct"],
decimal: [10, "dec"],
hexadecimal: [16, "hex"]
}
});
});
// ../../node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/float.js
var require_float = __commonJS((exports, module) => {
var common = require_common();
var Type = require_type();
var YAML_FLOAT_PATTERN = new RegExp("^(?:[-+]?(?:0|[1-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?" + "|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?" + "|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*" + "|[-+]?\\.(?:inf|Inf|INF)" + "|\\.(?:nan|NaN|NAN))$");
function resolveYamlFloat(data2) {
if (data2 === null)
return false;
if (!YAML_FLOAT_PATTERN.test(data2) || data2[data2.length - 1] === "_") {
return false;
}
return true;
}
function constructYamlFloat(data2) {
var value, sign, base, digits;
value = data2.replace(/_/g, "").toLowerCase();
sign = value[0] === "-" ? -1 : 1;
digits = [];
if ("+-".indexOf(value[0]) >= 0) {
value = value.slice(1);
}
if (value === ".inf") {
return sign === 1 ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY;
} else if (value === ".nan") {
return NaN;
} else if (value.indexOf(":") >= 0) {
value.split(":").forEach(function(v) {
digits.unshift(parseFloat(v, 10));
});
value = 0;
base = 1;
digits.forEach(function(d2) {
value += d2 * base;
base *= 60;
});
return sign * value;
}
return sign * parseFloat(value, 10);
}
var SCIENTIFIC_WITHOUT_DOT = /^[-+]?[0-9]+e/;
function representYamlFloat(object, style) {
var res;
if (isNaN(object)) {
switch (style) {
case "lowercase":
return ".nan";
case "uppercase":
return ".NAN";
case "camelcase":
return ".NaN";
}
} else if (Number.POSITIVE_INFINITY === object) {
switch (style) {
case "lowercase":
return ".inf";
case "uppercase":
return ".INF";
case "camelcase":
return ".Inf";
}
} else if (Number.NEGATIVE_INFINITY === object) {
switch (style) {
case "lowercase":
return "-.inf";
case "uppercase":
return "-.INF";
case "camelcase":
return "-.Inf";
}
} else if (common.isNegativeZero(object)) {
return "-0.0";
}
res = object.toString(10);
return SCIENTIFIC_WITHOUT_DOT.test(res) ? res.replace("e", ".e") : res;
}
function isFloat(object) {
return Object.prototype.toString.call(object) === "[object Number]" && (object % 1 !== 0 || common.isNegativeZero(object));
}
module.exports = new Type("tag:yaml.org,2002:float", {
kind: "scalar",
resolve: resolveYamlFloat,
construct: constructYamlFloat,
predicate: isFloat,
represent: representYamlFloat,
defaultStyle: "lowercase"
});
});
// ../../node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/schema/json.js
var require_json = __commonJS((exports, module) => {
var Schema = require_schema();
module.exports = new Schema({
include: [
require_failsafe()
],
implicit: [
require_null(),
require_bool(),
require_int(),
require_float()
]
});
});
// ../../node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/schema/core.js
var require_core = __commonJS((exports, module) => {
var Schema = require_schema();
module.exports = new Schema({
include: [
require_json()
]
});
});
// ../../node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/timestamp.js
var require_timestamp = __commonJS((exports, module) => {
var Type = require_type();
var YAML_DATE_REGEXP = new RegExp("^([0-9][0-9][0-9][0-9])" + "-([0-9][0-9])" + "-([0-9][0-9])$");
var 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]))?))?$");
function resolveYamlTimestamp(data2) {
if (data2 === null)
return false;
if (YAML_DATE_REGEXP.exec(data2) !== null)
return true;
if (YAML_TIMESTAMP_REGEXP.exec(data2) !== null)
return true;
return false;
}
function constructYamlTimestamp(data2) {
var match, year, month, day, hour, minute, second, fraction = 0, delta = null, tz_hour, tz_minute, date;
match = YAML_DATE_REGEXP.exec(data2);
if (match === null)
match = YAML_TIMESTAMP_REGEXP.exec(data2);
if (match === null)
throw new Error("Date resolve error");
year = +match[1];
month = +match[2] - 1;
day = +match[3];
if (!match[4]) {
return new Date(Date.UTC(year, month, day));
}
hour = +match[4];
minute = +match[5];
second = +match[6];
if (match[7]) {
fraction = match[7].slice(0, 3);
while (fraction.length < 3) {
fraction += "0";
}
fraction = +fraction;
}
if (match[9]) {
tz_hour = +match[10];
tz_minute = +(match[11] || 0);
delta = (tz_hour * 60 + tz_minute) * 60000;
if (match[9] === "-")
delta = -delta;
}
date = new Date(Date.UTC(year, month, day, hour, minute, second, fraction));
if (delta)
date.setTime(date.getTime() - delta);
return date;
}
function representYamlTimestamp(object) {
return object.toISOString();
}
module.exports = new Type("tag:yaml.org,2002:timestamp", {
kind: "scalar",
resolve: resolveYamlTimestamp,
construct: constructYamlTimestamp,
instanceOf: Date,
represent: representYamlTimestamp
});
});
// ../../node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/merge.js
var require_merge = __commonJS((exports, module) => {
var Type = require_type();
function resolveYamlMerge(data2) {
return data2 === "<<" || data2 === null;
}
module.exports = new Type("tag:yaml.org,2002:merge", {
kind: "scalar",
resolve: resolveYamlMerge
});
});
// ../../node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/binary.js
var require_binary = __commonJS((exports, module) => {
var NodeBuffer;
try {
_require = __require;
NodeBuffer = _require("buffer").Buffer;
} catch (__) {}
var _require;
var Type = require_type();
var BASE64_MAP = `ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=
\r`;
function resolveYamlBinary(data2) {
if (data2 === null)
return false;
var code, idx, bitlen = 0, max = data2.length, map = BASE64_MAP;
for (idx = 0;idx < max; idx++) {
code = map.indexOf(data2.charAt(idx));
if (code > 64)
continue;
if (code < 0)
return false;
bitlen += 6;
}
return bitlen % 8 === 0;
}
function constructYamlBinary(data2) {
var idx, tailbits, input = data2.replace(/[\r\n=]/g, ""), max = input.length, map = BASE64_MAP, bits = 0, result = [];
for (idx = 0;idx < max; idx++) {
if (idx % 4 === 0 && idx) {
result.push(bits >> 16 & 255);
result.push(bits >> 8 & 255);
result.push(bits & 255);
}
bits = bits << 6 | map.indexOf(input.charAt(idx));
}
tailbits = max % 4 * 6;
if (tailbits === 0) {
result.push(bits >> 16 & 255);
result.push(bits >> 8 & 255);
result.push(bits & 255);
} else if (tailbits === 18) {
result.push(bits >> 10 & 255);
result.push(bits >> 2 & 255);
} else if (tailbits === 12) {
result.push(bits >> 4 & 255);
}
if (NodeBuffer) {
return NodeBuffer.from ? NodeBuffer.from(result) : new NodeBuffer(result);
}
return result;
}
function representYamlBinary(object) {
var result = "", bits = 0, idx, tail, max = object.length, map = BASE64_MAP;
for (idx = 0;idx < max; idx++) {
if (idx % 3 === 0 && idx) {
result += map[bits >> 18 & 63];
result += map[bits >> 12 & 63];
result += map[bits >> 6 & 63];
result += map[bits & 63];
}
bits = (bits << 8) + object[idx];
}
tail = max % 3;
if (tail === 0) {
result += map[bits >> 18 & 63];
result += map[bits >> 12 & 63];
result += map[bits >> 6 & 63];
result += map[bits & 63];
} else if (tail === 2) {
result += map[bits >> 10 & 63];
result += map[bits >> 4 & 63];
result += map[bits << 2 & 63];
result += map[64];
} else if (tail === 1) {
result += map[bits >> 2 & 63];
result += map[bits << 4 & 63];
result += map[64];
result += map[64];
}
return result;
}
function isBinary(object) {
return NodeBuffer && NodeBuffer.isBuffer(object);
}
module.exports = new Type("tag:yaml.org,2002:binary", {
kind: "scalar",
resolve: resolveYamlBinary,
construct: constructYamlBinary,
predicate: isBinary,
represent: representYamlBinary
});
});
// ../../node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/omap.js
var require_omap = __commonJS((exports, module) => {
var Type = require_type();
var _hasOwnProperty = Object.prototype.hasOwnProperty;
var _toString = Object.prototype.toString;
function resolveYamlOmap(data2) {
if (data2 === null)
return true;
var objectKeys2 = [], index, length, pair, pairKey, pairHasKey, object = data2;
for (index = 0, length = object.length;index < length; index += 1) {
pair = object[index];
pairHasKey = false;
if (_toString.call(pair) !== "[object Object]")
return false;
for (pairKey in pair) {
if (_hasOwnProperty.call(pair, pairKey)) {
if (!pairHasKey)
pairHasKey = true;
else
return false;
}
}
if (!pairHasKey)
return false;
if (objectKeys2.indexOf(pairKey) === -1)
objectKeys2.push(pairKey);
else
return false;
}
return true;
}
function constructYamlOmap(data2) {
return data2 !== null ? data2 : [];
}
module.exports = new Type("tag:yaml.org,2002:omap", {
kind: "sequence",
resolve: resolveYamlOmap,
construct: constructYamlOmap
});
});
// ../../node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/pairs.js
var require_pairs = __commonJS((exports, module) => {
var Type = require_type();
var _toString = Object.prototype.toString;
function resolveYamlPairs(data2) {
if (data2 === null)
return true;
var index, length, pair, keys, result, object = data2;
result = new Array(object.length);
for (index = 0, length = object.length;index < length; index += 1) {
pair = object[index];
if (_toString.call(pair) !== "[object Object]")
return false;
keys = Object.keys(pair);
if (keys.length !== 1)
return false;
result[index] = [keys[0], pair[keys[0]]];
}
return true;
}
function constructYamlPairs(data2) {
if (data2 === null)
return [];
var index, length, pair, keys, result, object = data2;
result = new Array(object.length);
for (index = 0, length = object.length;index < length; index += 1) {
pair = object[index];
keys = Object.keys(pair);
result[index] = [keys[0], pair[keys[0]]];
}
return result;
}
module.exports = new Type("tag:yaml.org,2002:pairs", {
kind: "sequence",
resolve: resolveYamlPairs,
construct: constructYamlPairs
});
});
// ../../node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/set.js
var require_set = __commonJS((exports, module) => {
var Type = require_type();
var _hasOwnProperty = Object.prototype.hasOwnProperty;
function resolveYamlSet(data2) {
if (data2 === null)
return true;
var key, object = data2;
for (key in object) {
if (_hasOwnProperty.call(object, key)) {
if (object[key] !== null)
return false;
}
}
return true;
}
function constructYamlSet(data2) {
return data2 !== null ? data2 : {};
}
module.exports = new Type("tag:yaml.org,2002:set", {
kind: "mapping",
resolve: resolveYamlSet,
construct: constructYamlSet
});
});
// ../../node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/schema/default_safe.js
var require_default_safe = __commonJS((exports, module) => {
var Schema = require_schema();
module.exports = new Schema({
include: [
require_core()
],
implicit: [
require_timestamp(),
require_merge()
],
explicit: [
require_binary(),
require_omap(),
require_pairs(),
require_set()
]
});
});
// ../../node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/js/undefined.js
var require_undefined = __commonJS((exports, module) => {
var Type = require_type();
function resolveJavascriptUndefined() {
return true;
}
function constructJavascriptUndefined() {
return;
}
function representJavascriptUndefined() {
return "";
}
function isUndefined(object) {
return typeof object === "undefined";
}
module.exports = new Type("tag:yaml.org,2002:js/undefined", {
kind: "scalar",
resolve: resolveJavascriptUndefined,
construct: constructJavascriptUndefined,
predicate: isUndefined,
represent: representJavascriptUndefined
});
});
// ../../node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/js/regexp.js
var require_regexp = __commonJS((exports, module) => {
var Type = require_type();
function resolveJavascriptRegExp(data2) {
if (data2 === null)
return false;
if (data2.length === 0)
return false;
var regexp = data2, tail = /\/([gim]*)$/.exec(data2), modifiers = "";
if (regexp[0] === "/") {
if (tail)
modifiers = tail[1];
if (modifiers.length > 3)
return false;
if (regexp[regexp.length - modifiers.length - 1] !== "/")
return false;
}
return true;
}
function constructJavascriptRegExp(data2) {
var regexp = data2, tail = /\/([gim]*)$/.exec(data2), modifiers = "";
if (regexp[0] === "/") {
if (tail)
modifiers = tail[1];
regexp = regexp.slice(1, regexp.length - modifiers.length - 1);
}
return new RegExp(regexp, modifiers);
}
function representJavascriptRegExp(object) {
var result = "/" + object.source + "/";
if (object.global)
result += "g";
if (object.multiline)
result += "m";
if (object.ignoreCase)
result += "i";
return result;
}
function isRegExp(object) {
return Object.prototype.toString.call(object) === "[object RegExp]";
}
module.exports = new Type("tag:yaml.org,2002:js/regexp", {
kind: "scalar",
resolve: resolveJavascriptRegExp,
construct: constructJavascriptRegExp,
predicate: isRegExp,
represent: representJavascriptRegExp
});
});
// ../../node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/js/function.js
var require_function = __commonJS((exports, module) => {
var esprima;
try {
_require = __require;
esprima = _require("esprima");
} catch (_) {
if (typeof window !== "undefined")
esprima = window.esprima;
}
var _require;
var Type = require_type();
function resolveJavascriptFunction(data2) {
if (data2 === null)
return false;
try {
var source = "(" + data2 + ")", ast = esprima.parse(source, { range: true });
if (ast.type !== "Program" || ast.body.length !== 1 || ast.body[0].type !== "ExpressionStatement" || ast.body[0].expression.type !== "ArrowFunctionExpression" && ast.body[0].expression.type !== "FunctionExpression") {
return false;
}
return true;
} catch (err) {
return false;
}
}
function constructJavascriptFunction(data2) {
var source = "(" + data2 + ")", ast = esprima.parse(source, { range: true }), params = [], body;
if (ast.type !== "Program" || ast.body.length !== 1 || ast.body[0].type !== "ExpressionStatement" || ast.body[0].expression.type !== "ArrowFunctionExpression" && ast.body[0].expression.type !== "FunctionExpression") {
throw new Error("Failed to resolve function");
}
ast.body[0].expression.params.forEach(function(param) {
params.push(param.name);
});
body = ast.body[0].expression.body.range;
if (ast.body[0].expression.body.type === "BlockStatement") {
return new Function(params, source.slice(body[0] + 1, body[1] - 1));
}
return new Function(params, "return " + source.slice(body[0], body[1]));
}
function representJavascriptFunction(object) {
return object.toString();
}
function isFunction2(object) {
return Object.prototype.toString.call(object) === "[object Function]";
}
module.exports = new Type("tag:yaml.org,2002:js/function", {
kind: "scalar",
resolve: resolveJavascriptFunction,
construct: constructJavascriptFunction,
predicate: isFunction2,
represent: representJavascriptFunction
});
});
// ../../node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/schema/default_full.js
var require_default_full = __commonJS((exports, module) => {
var Schema = require_schema();
module.exports = Schema.DEFAULT = new Schema({
include: [
require_default_safe()
],
explicit: [
require_undefined(),
require_regexp(),
require_function()
]
});
});
// ../../node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/loader.js
var require_loader = __commonJS((exports, module) => {
var common = require_common();
var YAMLException = require_exception();
var Mark = require_mark();
var DEFAULT_SAFE_SCHEMA = require_default_safe();
var DEFAULT_FULL_SCHEMA = require_default_full();
var _hasOwnProperty = Object.prototype.hasOwnProperty;
var CONTEXT_FLOW_IN = 1;
var CONTEXT_FLOW_OUT = 2;
var CONTEXT_BLOCK_IN = 3;
var CONTEXT_BLOCK_OUT = 4;
var CHOMPING_CLIP = 1;
var CHOMPING_STRIP = 2;
var CHOMPING_KEEP = 3;
var PATTERN_NON_PRINTABLE = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/;
var PATTERN_NON_ASCII_LINE_BREAKS = /[\x85\u2028\u2029]/;
var PATTERN_FLOW_INDICATORS = /[,\[\]\{\}]/;
var PATTERN_TAG_HANDLE = /^(?:!|!!|![a-z\-]+!)$/i;
var PATTERN_TAG_URI = /^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;
function _class(obj) {
return Object.prototype.toString.call(obj);
}
function is_EOL(c) {
return c === 10 || c === 13;
}
function is_WHITE_SPACE(c) {
return c === 9 || c === 32;
}
function is_WS_OR_EOL(c) {
return c === 9 || c === 32 || c === 10 || c === 13;
}
function is_FLOW_INDICATOR(c) {
return c === 44 || c === 91 || c === 93 || c === 123 || c === 125;
}
function fromHexCode(c) {
var lc;
if (48 <= c && c <= 57) {
return c - 48;
}
lc = c | 32;
if (97 <= lc && lc <= 102) {
return lc - 97 + 10;
}
return -1;
}
function escapedHexLen(c) {
if (c === 120) {
return 2;
}
if (c === 117) {
return 4;
}
if (c === 85) {
return 8;
}
return 0;
}
function fromDecimalCode(c) {
if (48 <= c && c <= 57) {
return c - 48;
}
return -1;
}
function simpleEscapeSequence(c) {
return c === 48 ? "\x00" : c === 97 ? "\x07" : c === 98 ? "\b" : c === 116 ? "\t" : c === 9 ? "\t" : c === 110 ? `
` : 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" : "";
}
function charFromCodepoint(c) {
if (c <= 65535) {
return String.fromCharCode(c);
}
return String.fromCharCode((c - 65536 >> 10) + 55296, (c - 65536 & 1023) + 56320);
}
var simpleEscapeCheck = new Array(256);
var simpleEscapeMap = new Array(256);
for (i4 = 0;i4 < 256; i4++) {
simpleEscapeCheck[i4] = simpleEscapeSequence(i4) ? 1 : 0;
simpleEscapeMap[i4] = simpleEscapeSequence(i4);
}
var i4;
function State(input, options2) {
this.input = input;
this.filename = options2["filename"] || null;
this.schema = options2["schema"] || DEFAULT_FULL_SCHEMA;
this.onWarning = options2["onWarning"] || null;
this.legacy = options2["legacy"] || false;
this.json = options2["json"] || false;
this.listener = options2["listener"] || null;
this.implicitTypes = this.schema.compiledImplicit;
this.typeMap = this.schema.compiledTypeMap;
this.length = input.length;
this.position = 0;
this.line = 0;
this.lineStart = 0;
this.lineIndent = 0;
this.documents = [];
}
function generateError(state2, message) {
return new YAMLException(message, new Mark(state2.filename, state2.input, state2.position, state2.line, state2.position - state2.lineStart));
}
function throwError(state2, message) {
throw generateError(state2, message);
}
function throwWarning(state2, message) {
if (state2.onWarning) {
state2.onWarning.call(null, generateError(state2, message));
}
}
var directiveHandlers = {
YAML: function handleYamlDirective(state2, name, args) {
var match, major, minor;
if (state2.version !== null) {
throwError(state2, "duplication of %YAML directive");
}
if (args.length !== 1) {
throwError(state2, "YAML directive accepts exactly one argument");
}
match = /^([0-9]+)\.([0-9]+)$/.exec(args[0]);
if (match === null) {
throwError(state2, "ill-formed argument of the YAML directive");
}
major = parseInt(match[1], 10);
minor = parseInt(match[2], 10);
if (major !== 1) {
throwError(state2, "unacceptable YAML version of the document");
}
state2.version = args[0];
state2.checkLineBreaks = minor < 2;
if (minor !== 1 && minor !== 2) {
throwWarning(state2, "unsupported YAML version of the document");
}
},
TAG: function handleTagDirective(state2, name, args) {
var handle, prefix;
if (args.length !== 2) {
throwError(state2, "TAG directive accepts exactly two arguments");
}
handle = args[0];
prefix = args[1];
if (!PATTERN_TAG_HANDLE.test(handle)) {
throwError(state2, "ill-formed tag handle (first argument) of the TAG directive");
}
if (_hasOwnProperty.call(state2.tagMap, handle)) {
throwError(state2, 'there is a previously declared suffix for "' + handle + '" tag handle');
}
if (!PATTERN_TAG_URI.test(prefix)) {
throwError(state2, "ill-formed tag prefix (second argument) of the TAG directive");
}
state2.tagMap[handle] = prefix;
}
};
function captureSegment(state2, start, end, checkJson) {
var _position, _length, _character, _result;
if (start < end) {
_result = state2.input.slice(start, end);
if (checkJson) {
for (_position = 0, _length = _result.length;_position < _length; _position += 1) {
_character = _result.charCodeAt(_position);
if (!(_character === 9 || 32 <= _character && _character <= 1114111)) {
throwError(state2, "expected valid JSON character");
}
}
} else if (PATTERN_NON_PRINTABLE.test(_result)) {
throwError(sta