'use strict';

const _commonjsHelpers = require('./_commonjsHelpers-5bbc2693.js');
const index$4 = require('./index-c277d1ea.js');

var Rule_1 = _commonjsHelpers.createCommonjsModule(function (module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.create = exports.setFallback = exports.add = exports.Rule = void 0;
class Rule {
    filter(value) {
        return value.filter(element => this.is(element));
    }
    stringify(precedence = 0) {
        let result = this.toString();
        if (this.precedence < precedence)
            result = "(" + result + ")";
        return result;
    }
}
exports.Rule = Rule;
const creators = [
    criteria => (criteria instanceof Rule ? criteria : undefined),
];
function add(create) {
    creators.push(create);
}
exports.add = add;
let always;
function setFallback(fallback) {
    always = fallback;
}
exports.setFallback = setFallback;
function create(criteria) {
    let result;
    for (const c of creators) {
        result = c(criteria);
        if (result)
            break;
    }
    return result || always;
}
exports.create = create;
//# sourceMappingURL=Rule.js.map
});

const Rule = /*@__PURE__*/_commonjsHelpers.getDefaultExportFromCjs(Rule_1);

var Always_1 = _commonjsHelpers.createCommonjsModule(function (module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Always = void 0;

class Always extends Rule_1.Rule {
    constructor() {
        super();
        this.precedence = Number.MAX_SAFE_INTEGER;
        this.class = "Always";
    }
    is(value) {
        return true;
    }
    toString() {
        return "";
    }
}
exports.Always = Always;
Rule_1.setFallback(new Always());
//# sourceMappingURL=Always.js.map
});

const Always = /*@__PURE__*/_commonjsHelpers.getDefaultExportFromCjs(Always_1);

var Any_1 = _commonjsHelpers.createCommonjsModule(function (module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.any = exports.Any = void 0;

class Any extends Rule_1.Rule {
    constructor(criteria) {
        super();
        this.criteria = criteria;
        this.precedence = 50;
        this.class = "Any";
    }
    is(value) {
        return (value &&
            typeof value == "object" &&
            Object.getOwnPropertyNames(value).some(property => this.criteria.is(value[property]) || this.is(value[property])));
    }
    toString() {
        return this.criteria.stringify(this.precedence);
    }
}
exports.Any = Any;
function any(criteria, value) {
    const result = new Any(Rule_1.create(criteria));
    return value ? result.is(value) : result;
}
exports.any = any;
//# sourceMappingURL=Any.js.map
});

const Any = /*@__PURE__*/_commonjsHelpers.getDefaultExportFromCjs(Any_1);

var Property_1 = _commonjsHelpers.createCommonjsModule(function (module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.property = exports.Property = void 0;


class Property extends Rule_1.Rule {
    constructor(name, criteria) {
        super();
        this.name = name;
        this.criteria = criteria;
        this.precedence = Property.precedence;
        this.class = "Property";
        this.symbol = ".";
    }
    is(value, object) {
        return typeof value == "object" && this.criteria.is(value[this.name], object !== null && object !== void 0 ? object : value);
    }
    toString() {
        var _a;
        return `${this.name}${(_a = this.criteria.symbol) !== null && _a !== void 0 ? _a : ":"}${this.criteria.stringify(this.precedence)}`;
    }
}
exports.Property = Property;
Property.precedence = 80;
function property(name, criteria, value) {
    const result = (Array.isArray(name) ? name : [name]).reduceRight((r, p) => new Property(p, r), Rule_1.create(criteria));
    return value ? result.is(value) : result;
}
exports.property = property;
Rule_1.add(criteria => typeof criteria == "object" && !(criteria instanceof Rule_1.Rule) && !Array.isArray(criteria)
    ? And_1.and(...Object.getOwnPropertyNames(criteria).map(p => property(p, criteria[p])))
    : undefined);
//# sourceMappingURL=Property.js.map
});

const Property$2 = /*@__PURE__*/_commonjsHelpers.getDefaultExportFromCjs(Property_1);

var And_1 = _commonjsHelpers.createCommonjsModule(function (module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.and = exports.And = void 0;



class And extends Rule_1.Rule {
    constructor(rules) {
        super();
        this.precedence = 40;
        this.class = "And";
        this.rules = rules.reduce((r, e) => (e instanceof And ? [...r, ...e.rules] : [...r, e]), []);
    }
    is(value) {
        return this.rules.every(c => c.is(value));
    }
    toString() {
        return this.rules.map(c => c.stringify(this.precedence)).join(" ");
    }
    generalize() {
        return new And(this.rules.map(r => (r instanceof Property_1.Property ? r : new Any_1.Any(r))));
    }
}
exports.And = And;
function and(...criterias) {
    return new And(criterias.map(Rule_1.create));
}
exports.and = and;
//# sourceMappingURL=And.js.map
});

const And = /*@__PURE__*/_commonjsHelpers.getDefaultExportFromCjs(And_1);

var Source_1$1 = _commonjsHelpers.createCommonjsModule(function (module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Source = void 0;

class Source extends index$4.build.IO.BufferedReader {
    constructor(reader, errorHandler) {
        super(typeof reader == "string" ? index$4.build.IO.StringReader.create(reader) : reader);
        this.errorHandler = errorHandler;
    }
    raise(message, level, type = "lexical", region) {
        if (!(message instanceof index$4.build.Error.Message)) {
            if (!level)
                level = index$4.build.Error.Level.Critical;
            if (!region)
                region = this.region;
            message = new index$4.build.Error.Message(message, level, type, region);
        }
        if (this.errorHandler)
            this.errorHandler.raise(message);
    }
    requirePrefix(prefix) {
        return new Source(new index$4.build.IO.PrefixReader(this, prefix), this.errorHandler);
    }
    till(endMark) {
        return new Source(index$4.build.IO.TillReader.create(this, endMark), this.errorHandler);
    }
    until(endMark) {
        return new Source(index$4.build.IO.UntilReader.create(this, endMark), this.errorHandler);
    }
    peekIsSymbol(symbols) {
        var _a, _b;
        return ((_b = (_a = this.peekIs(symbols !== null && symbols !== void 0 ? symbols : ["!", "(", ")", "[", "]", "|", "*", ":", ".", "<=", ">=", "<", ">", " * ", " + ", " - ", " / "])) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : false);
    }
    peekIsWhitespace() {
        return !!this.peekIs([" ", "\n", "\t"]);
    }
}
exports.Source = Source;
//# sourceMappingURL=Source.js.map
});

const Source$1 = /*@__PURE__*/_commonjsHelpers.getDefaultExportFromCjs(Source_1$1);

var lexer = _commonjsHelpers.createCommonjsModule(function (module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.tokenize = exports.Source = void 0;


Object.defineProperty(exports, "Source", { enumerable: true, get: function () { return Source_1$1.Source; } });
function tokenize(reader, errorHandler, symbols) {
    const source = new Source_1$1.Source(reader, errorHandler);
    return new index$4.build.Utilities.Enumerator(() => {
        let result;
        let peekSymbolLength = 1;
        if (!source.isEmpty) {
            while (source.peekIsWhitespace() && !source.peekIsSymbol(symbols))
                source.read();
            if ((peekSymbolLength = source.peekIsSymbol(symbols)))
                result = { value: source.read(peekSymbolLength) || "", region: source.mark() };
            else {
                let value = "";
                while (!source.isEmpty && !source.peekIsWhitespace() && !source.peekIsSymbol(symbols))
                    value += source.read();
                if (value)
                    result = { value, region: source.mark() };
            }
        }
        return result;
    });
}
exports.tokenize = tokenize;
//# sourceMappingURL=index.js.map
});

const index$3 = /*@__PURE__*/_commonjsHelpers.getDefaultExportFromCjs(lexer);

var Base_1 = _commonjsHelpers.createCommonjsModule(function (module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Base = void 0;

class Base {
    tokenize(input) {
        return lexer.tokenize(input, undefined, [
            "!",
            "(",
            ")",
            "[",
            "]",
            "|",
            " | ",
            "*",
            ":",
            ".",
            "<=",
            ">=",
            "<",
            ">",
            " * ",
            " + ",
            "+",
            " - ",
            "-",
            " / ",
        ])
            .map(t => ({ value: t.value }))
            .toArray();
    }
}
exports.Base = Base;
//# sourceMappingURL=Base.js.map
});

const Base = /*@__PURE__*/_commonjsHelpers.getDefaultExportFromCjs(Base_1);

var _Array = _commonjsHelpers.createCommonjsModule(function (module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Array = void 0;

class Array extends Base_1.Base {
    constructor(input) {
        super();
        this.class = "array";
        this.array = input;
    }
    complete(input, baseObject, type) {
        const tokens = typeof input == "string" ? this.tokenize(input) : input;
        return Array.completor
            .map(p => p(tokens, this, baseObject))
            .reduce((result, element) => result.concat(element), [])
            .reduce((result, element) => result.some(p => p.value == element.value && p.cursor == element.cursor) ? result : [...result, element], []);
    }
    isType(value) {
        return _commonjsHelpers.commonjsGlobal.Array.isArray(value);
    }
    static add(...pattern) {
        this.completor.push(...pattern);
    }
    static is(value) {
        return value instanceof Array;
    }
}
exports.Array = Array;
Array.completor = [];
//# sourceMappingURL=Array.js.map
});

const _Array$1 = /*@__PURE__*/_commonjsHelpers.getDefaultExportFromCjs(_Array);

var _Boolean = _commonjsHelpers.createCommonjsModule(function (module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Boolean = void 0;

class Boolean extends Base_1.Base {
    constructor() {
        super();
        this.class = "boolean";
    }
    complete(input) {
        const tokens = typeof input == "string" ? this.tokenize(input) : input;
        return Boolean.completor
            .map(p => p(tokens, this))
            .reduce((result, element) => result.concat(element), [])
            .reduce((result, element) => result.some(p => p.value == element.value && p.cursor == element.cursor) ? result : [...result, element], []);
    }
    isType(value) {
        return typeof value == "boolean";
    }
    static add(...pattern) {
        this.completor.push(...pattern);
    }
}
exports.Boolean = Boolean;
Boolean.completor = [];
//# sourceMappingURL=Boolean.js.map
});

const _Boolean$1 = /*@__PURE__*/_commonjsHelpers.getDefaultExportFromCjs(_Boolean);

var Cursor_1 = _commonjsHelpers.createCommonjsModule(function (module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Cursor = void 0;
var Cursor;
(function (Cursor) {
    function is(value) {
        return typeof value == "object" && typeof value.start == "number" && typeof value.end == "number";
    }
    Cursor.is = is;
})(Cursor = exports.Cursor || (exports.Cursor = {}));
//# sourceMappingURL=Cursor.js.map
});

const Cursor = /*@__PURE__*/_commonjsHelpers.getDefaultExportFromCjs(Cursor_1);

var Completion_1 = _commonjsHelpers.createCommonjsModule(function (module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Completion = void 0;

var Completion;
(function (Completion) {
    function stringify(completions) {
        return completions.map(c => typeof c.cursor == "number"
            ? c.value.slice(0, c.cursor) + "_" + c.value.slice(c.cursor, c.value.length)
            : c.value + "_");
    }
    Completion.stringify = stringify;
    function prepend(prefix, completion, suffix) {
        return Array.isArray(completion)
            ? completion.map(c => prepend(prefix, c, suffix))
            : {
                value: prefix + completion.value + (suffix !== null && suffix !== void 0 ? suffix : ""),
                cursor: typeof (completion === null || completion === void 0 ? void 0 : completion.cursor) == "number"
                    ? (completion === null || completion === void 0 ? void 0 : completion.cursor) + prefix.length
                    : Cursor_1.Cursor.is(completion.cursor)
                        ? { start: completion.cursor.start + prefix.length, end: completion.cursor.end + prefix.length }
                        : completion.value.length + prefix.length,
                suggestion: completion.suggestion,
            };
    }
    Completion.prepend = prepend;
})(Completion = exports.Completion || (exports.Completion = {}));
//# sourceMappingURL=Completion.js.map
});

const Completion = /*@__PURE__*/_commonjsHelpers.getDefaultExportFromCjs(Completion_1);

var Completor_1 = _commonjsHelpers.createCommonjsModule(function (module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Completor = void 0;

var Completor;
(function (Completor) {
    function functions(tokens, argument, completion) {
        var _a, _b, _c, _d;
        return tokens.length == 0
            ? [{ value: ":", suggestion: { value: ":" } }]
            : tokens.length <= 3 &&
                tokens[0].value == ":" &&
                completion.value.startsWith((_b = (_a = tokens[1]) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : "") &&
                ((_d = (_c = tokens[2]) === null || _c === void 0 ? void 0 : _c.value) !== null && _d !== void 0 ? _d : "(") == "("
                ? Completion_1.Completion.prepend(":", [completion])
                : tokens.length <= 4 &&
                    tokens.slice(0, 4).reduce((string, token) => string + token.value, "") == ":" + completion.value
                    ? Completion_1.Completion.prepend(":" + completion.value.substring(0, completion.value.length - 1), argument(), ")")
                    : tokens.length == 5 &&
                        tokens.slice(0, 3).reduce((string, token) => string + token.value, "") + tokens[4].value ==
                            ":" + completion.value
                        ? Completion_1.Completion.prepend(":" + completion.value.substring(0, completion.value.length - 1), argument(tokens.slice(3, tokens.length - 1)), ")")
                        : tokens.length > 5 &&
                            tokens.slice(0, 3).reduce((string, token) => string + token.value, "") + tokens[tokens.length - 1].value ==
                                ":" + completion.value
                            ? Completion_1.Completion.prepend(":" + completion.value.substring(0, completion.value.length - 1), argument(tokens.slice(3, tokens.length - 1)), ")")
                            : [];
    }
    Completor.functions = functions;
    function expressions(tokens, argument, completion) {
        return tokens.length == 0
            ? [{ value: ":", suggestion: { value: ":" } }]
            : tokens[0].value != ":"
                ? []
                : tokens.length == 1
                    ? Completion_1.Completion.prepend(":", [completion])
                    : Completion_1.Completion.prepend(":", argument(tokens.slice(1)));
    }
    Completor.expressions = expressions;
    function operators(tokens, argument, completion) {
        return tokens.length >= 1 && tokens[0].value == completion.value
            ? Completion_1.Completion.prepend(completion.value, argument(tokens.slice(1)))
            : tokens.length == 0 ||
                (tokens.length == 1 && completion.value.startsWith(tokens[0].value)) ||
                tokens[0].value == completion.value.replace(/ /g, "")
                ? [completion]
                : [];
    }
    Completor.operators = operators;
})(Completor = exports.Completor || (exports.Completor = {}));
//# sourceMappingURL=Completor.js.map
});

const Completor = /*@__PURE__*/_commonjsHelpers.getDefaultExportFromCjs(Completor_1);

var _Number = _commonjsHelpers.createCommonjsModule(function (module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Number = void 0;


class Number extends Base_1.Base {
    constructor(input) {
        super();
        this.input = input;
        this.class = "number";
        if (input)
            this.value = input;
    }
    complete(input, baseObject, type) {
        const tokens = typeof input == "string" ? this.tokenize(input) : input;
        return [
            ...(tokens.length > 0 && tokens[0].value == ":" && baseObject
                ? Completion_1.Completion.prepend(":", baseObject.complete(tokens.slice(1), undefined, this))
                : baseObject && tokens.length >= 0 && type
                    ? Completion_1.Completion.prepend(" ", baseObject === null || baseObject === void 0 ? void 0 : baseObject.complete(tokens, undefined, undefined))
                    : []),
            ...(type ? Number.completorArgument : Number.completor)
                .map(p => p(tokens, this, baseObject))
                .reduce((result, element) => result.concat(element), [])
                .reduce((result, element) => result.some(p => p.value == element.value && p.cursor == element.cursor) ? result : [...result, element], []),
        ];
    }
    isType(value) {
        return isNaN(+value) ? false : true;
    }
    static add(...pattern) {
        this.completor.push(...pattern);
    }
    static addArgument(...pattern) {
        this.completorArgument.push(...pattern);
    }
    static is(value) {
        return value instanceof Number || !_commonjsHelpers.commonjsGlobal.Number.isNaN(value);
    }
}
exports.Number = Number;
Number.completor = [];
Number.completorArgument = [];
//# sourceMappingURL=Number.js.map
});

const _Number$1 = /*@__PURE__*/_commonjsHelpers.getDefaultExportFromCjs(_Number);

var _Object = _commonjsHelpers.createCommonjsModule(function (module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.TObject = void 0;


class TObject extends Base_1.Base {
    constructor(properties) {
        super();
        this.properties = properties;
        this.class = "object";
        this.completions = Object.keys(this.properties).map(p => ({ value: p, suggestion: { value: p } }));
    }
    complete(input, baseObject, type) {
        const tokens = typeof input == "string" ? this.tokenize(input) : input;
        let result;
        const filtered = this.filterByType(type);
        if (!baseObject) {
            const matched = tokens.length > 0 ? this.match(tokens[0], filtered) : undefined;
            if (matched)
                result =
                    tokens.length == 1
                        ? [
                            { value: matched.value + ".", suggestion: { value: "." } },
                            ...Completion_1.Completion.prepend(matched.value, this.complete(tokens.slice(1), this, type)),
                        ]
                        : tokens.length > 1
                            ? Completion_1.Completion.prepend(matched.value, this.properties[matched.value].complete(tokens.slice(1), this, type))
                            : [];
            else if (type && tokens.length > 2 && type.isType(tokens[0].value + tokens[1].value + tokens[2].value))
                result = Completion_1.Completion.prepend(tokens[0].value + tokens[1].value + tokens[2].value, type.complete(tokens.slice(3), this, type));
            else if (type && tokens.length > 0 && type.isType(tokens[0].value))
                result = Completion_1.Completion.prepend(tokens[0].value, type.complete(tokens.slice(1), this, type));
            else {
                let found;
                result =
                    tokens.length == 0
                        ? [...this.addDot(filtered, type), ...((type === null || type === void 0 ? void 0 : type.class) == "number" ? [] : TObject.wildcard)]
                        : tokens.length == 1 && (found = TObject.wildcard.find(w => w.value == tokens[0].value))
                            ? Completion_1.Completion.prepend(found.value, this.completions, type ? "." : "")
                            : tokens.length >= 1 && (found = TObject.wildcard.find(w => w.value == tokens[0].value))
                                ? Completion_1.Completion.prepend(found.value, this.complete(tokens.slice(1)))
                                : this.addDot(this.partial(tokens[0], filtered), type);
            }
        }
        else
            result =
                tokens.length == 0 || tokens[0].value != "."
                    ? []
                    : tokens.length == 1
                        ? Completion_1.Completion.prepend(".", this.addDot(filtered, type))
                        : this.properties[tokens[1].value]
                            ? Completion_1.Completion.prepend("." + tokens[1].value, this.properties[tokens[1].value].complete(tokens.slice(2), baseObject, type))
                            : Completion_1.Completion.prepend(".", this.addDot(this.partial(tokens[1], filtered), type));
        return [
            ...result.reduce((result, element) => result.some(p => p.value == element.value && p.cursor == element.cursor) ? result : [...result, element], []),
            ...TObject.completor
                .map(p => p(tokens, this, baseObject))
                .reduce((r, element) => r.concat(element), []),
        ];
    }
    filterByType(type) {
        return type
            ? this.completions.filter(c => this.properties[c.value].class == type.class ||
                (this.properties[c.value].class == "object"
                    ? this.properties[c.value].filterByType(type).length > 0
                    : false))
            : this.completions;
    }
    addDot(completions, type) {
        return !completions
            ? []
            : type
                ? completions.map(c => {
                    var _a;
                    return this.properties[c.value].class == "object"
                        ? { value: c.value + ".", suggestion: { value: ((_a = c.suggestion) === null || _a === void 0 ? void 0 : _a.value) + "." } }
                        : c;
                })
                : completions;
    }
    partial(token, completions) {
        const result = completions.filter(c => c.value.startsWith(token.value));
        return result && result.length > 0 ? result : undefined;
    }
    match(token, completions) {
        const result = completions.filter(c => c.value == token.value);
        return result && result.length > 0 ? result[0] : undefined;
    }
    isType(value) {
        return false;
    }
    static add(...completor) {
        this.completor.push(...completor);
    }
}
exports.TObject = TObject;
TObject.wildcard = [
    { value: "!", cursor: 1, suggestion: { value: "!", description: "not" } },
];
TObject.completor = [];
//# sourceMappingURL=Object.js.map
});

const _Object$1 = /*@__PURE__*/_commonjsHelpers.getDefaultExportFromCjs(_Object);

var _String = _commonjsHelpers.createCommonjsModule(function (module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.String = void 0;

class String extends Base_1.Base {
    constructor(input) {
        super();
        this.class = "string";
        if (input)
            this.value = input;
    }
    complete(input, baseObject) {
        const tokens = typeof input == "string" ? this.tokenize(input) : input;
        return String.completor
            .map(p => p(tokens, this, baseObject))
            .reduce((result, element) => result.concat(element), [])
            .reduce((result, element) => result.some(p => p.value == element.value && p.cursor == element.cursor) ? result : [...result, element], []);
    }
    isType(value) {
        return false;
    }
    static add(...pattern) {
        this.completor.push(...pattern);
    }
    static is(value) {
        return value instanceof String;
    }
}
exports.String = String;
String.completor = [];
//# sourceMappingURL=String.js.map
});

const _String$1 = /*@__PURE__*/_commonjsHelpers.getDefaultExportFromCjs(_String);

var Union_1 = _commonjsHelpers.createCommonjsModule(function (module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Union = void 0;

class Union extends Base_1.Base {
    constructor(type) {
        super();
        this.type = type;
        this.class = "union";
    }
    complete(input, baseObject, type) {
        var _a;
        const tokens = typeof input == "string" ? this.tokenize(input) : input;
        return this.type
            ? (_a = this.type) === null || _a === void 0 ? void 0 : _a.map(t => { var _a; return (_a = t === null || t === void 0 ? void 0 : t.complete(tokens, baseObject, type)) !== null && _a !== void 0 ? _a : []; }).reduce((result, element) => result.concat(element), []) : [];
    }
    isType(value) {
        return value instanceof Union;
    }
    static is(value) {
        return value instanceof Union;
    }
}
exports.Union = Union;
//# sourceMappingURL=Union.js.map
});

const Union = /*@__PURE__*/_commonjsHelpers.getDefaultExportFromCjs(Union_1);

var Type_1 = _commonjsHelpers.createCommonjsModule(function (module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Type = void 0;








var Type;
(function (Type) {
    function complete(template, input) {
        const completions = template.complete(input);
        return completions
            .filter(c => { var _a; return !input.includes(c.value) && ((_a = c.suggestion) === null || _a === void 0 ? void 0 : _a.value); })
            .map(c => {
            var _a, _b, _c;
            return ({
                full: c.value,
                cursor: (_a = c === null || c === void 0 ? void 0 : c.cursor) !== null && _a !== void 0 ? _a : c.value.length,
                addon: (_b = c === null || c === void 0 ? void 0 : c.suggestion) === null || _b === void 0 ? void 0 : _b.value,
                description: (_c = c === null || c === void 0 ? void 0 : c.suggestion) === null || _c === void 0 ? void 0 : _c.description,
            });
        });
    }
    Type.complete = complete;
    function convert(value) {
        let result;
        switch (typeof value) {
            case "object":
                result = _commonjsHelpers.commonjsGlobal.Array.isArray(value)
                    ? new _Array.Array(value.map(e => convert(e)))
                    : new _Object.TObject(_commonjsHelpers.commonjsGlobal.Object.entries(value).reduce((r, c) => {
                        return Object.assign(Object.assign({}, r), { [c[0]]: convert(c[1]) });
                    }, {}));
                break;
            case "string":
                result = new _String.String(value);
                break;
            default:
                result = new _Number.Number(value);
                break;
        }
        return result;
    }
    Type.convert = convert;
    Type.Array = _Array.Array;
    Type.Boolean = _Boolean.Boolean;
    Type.Completion = Completion_1.Completion;
    Type.Object = _Object.TObject;
    Type.String = _String.String;
    Type.Number = _Number.Number;
    Type.Union = Union_1.Union;
    Type.Completor = Completor_1.Completor;
})(Type = exports.Type || (exports.Type = {}));
//# sourceMappingURL=index.js.map
});

const index$2 = /*@__PURE__*/_commonjsHelpers.getDefaultExportFromCjs(Type_1);

var EndsWith_1 = _commonjsHelpers.createCommonjsModule(function (module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.endsWith = exports.EndsWith = void 0;



class EndsWith extends Rule_1.Rule {
    constructor(needle) {
        super();
        this.needle = needle;
        this.precedence = Number.MAX_SAFE_INTEGER;
        this.class = "EndsWith";
    }
    is(value) {
        return typeof value == "string" && value.endsWith(this.needle);
    }
    toString() {
        return `*${this.needle}`;
    }
}
exports.EndsWith = EndsWith;
function endsWith(needle, value) {
    const result = new EndsWith(needle);
    return value ? result.is(value) : result;
}
exports.endsWith = endsWith;
function complete(tokens, string) {
    return Completor_1.Completor.expressions(tokens, (tokens) => {
        var _a, _b, _c, _d;
        return !tokens || (tokens[0].value == "*" && string.value && string.value.endsWith((_b = (_a = tokens[1]) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : ""))
            ? [Type_1.Type.Completion.prepend("*", { value: (_c = string === null || string === void 0 ? void 0 : string.value) !== null && _c !== void 0 ? _c : "", suggestion: { value: (_d = string === null || string === void 0 ? void 0 : string.value) !== null && _d !== void 0 ? _d : "" } })]
            : [];
    }, { value: "*", suggestion: { value: "*", description: "endswith" } });
}
Type_1.Type.String.add(complete);
//# sourceMappingURL=EndsWith.js.map
});

const EndsWith$2 = /*@__PURE__*/_commonjsHelpers.getDefaultExportFromCjs(EndsWith_1);

var Every_1 = _commonjsHelpers.createCommonjsModule(function (module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.every = exports.Every = void 0;



class Every extends Rule_1.Rule {
    constructor(criteria) {
        super();
        this.criteria = criteria;
        this.precedence = 100;
        this.class = "Every";
    }
    is(value) {
        return Array.isArray(value) && value.every(v => this.criteria.is(v));
    }
    toString() {
        return `every(${this.criteria.toString()})`;
    }
}
exports.Every = Every;
function every(criteria, value) {
    const result = new Every(Rule_1.create(criteria));
    return value ? result.is(value) : result;
}
exports.every = every;
function complete(tokens, type) {
    const arrayArgumentor = (tokens) => type.array.some(Type_1.Type.String.is) && tokens
        ? type.array
            .filter(Type_1.Type.String.is)
            .map(p => p.complete([{ value: ":" }, ...tokens]))
            .reduce((result, element) => Array.isArray(element) ? result.concat(element) : element ? [...result, element] : result, [])
        : !tokens && type.array.some(Type_1.Type.String.is)
            ? type.array.filter(Type_1.Type.String.is).map(e => { var _a; return ({ value: (_a = e === null || e === void 0 ? void 0 : e.value) !== null && _a !== void 0 ? _a : "" }); })
            : type.array.some(Type_1.Type.Number.is) && tokens
                ? type.array
                    .filter(Type_1.Type.Number.is)
                    .map(e => e.complete(tokens))
                    .reduce((result, element) => Array.isArray(element) ? result.concat(element) : element ? [...result, element] : result, [])
                : !tokens && type.array.some(Type_1.Type.Number.is)
                    ? type.array.filter(Type_1.Type.Number.is).map(e => { var _a; return ({ value: ((_a = e === null || e === void 0 ? void 0 : e.value) !== null && _a !== void 0 ? _a : "").toString() }); })
                    : [];
    return Completor_1.Completor.functions(tokens, arrayArgumentor, {
        value: "every()",
        cursor: 6,
        suggestion: { value: "every()" },
    });
}
Type_1.Type.Array.add(complete);
//# sourceMappingURL=Every.js.map
});

const Every$2 = /*@__PURE__*/_commonjsHelpers.getDefaultExportFromCjs(Every_1);

var GreaterThan_1 = _commonjsHelpers.createCommonjsModule(function (module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.greaterThan = exports.GreaterThan = void 0;


class GreaterThan extends Rule_1.Rule {
    constructor(value) {
        super();
        this.value = value;
        this.precedence = 85;
        this.class = "GreaterThan";
        this.symbol = ">";
    }
    is(value, object) {
        return (isNaN(+value) ? value : +value) > (typeof this.value == "object" ? this.value.evaluate(object) : this.value);
    }
    toString() {
        return this.value.toString();
    }
}
exports.GreaterThan = GreaterThan;
function greaterThan(criteria, value) {
    const result = new GreaterThan(criteria);
    return value ? result.is(value) : result;
}
exports.greaterThan = greaterThan;
function complete(tokens, type, baseObject) {
    return Type_1.Type.Completor.operators(tokens, (tokens) => (tokens && baseObject ? baseObject === null || baseObject === void 0 ? void 0 : baseObject.complete(tokens, undefined, type) : []), {
        value: ">",
        suggestion: { value: ">" },
    });
}
Type_1.Type.Number.add(complete);
Type_1.Type.String.add(complete);
//# sourceMappingURL=GreaterThan.js.map
});

const GreaterThan$2 = /*@__PURE__*/_commonjsHelpers.getDefaultExportFromCjs(GreaterThan_1);

var GreaterThanOrEqual_1 = _commonjsHelpers.createCommonjsModule(function (module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.greaterThanOrEqual = exports.GreaterThanOrEqual = void 0;


class GreaterThanOrEqual extends Rule_1.Rule {
    constructor(value) {
        super();
        this.value = value;
        this.precedence = 85;
        this.class = "GreaterThanOrEqual";
        this.symbol = ">=";
    }
    is(value, object) {
        return ((isNaN(+value) ? value : +value) >= (typeof this.value == "object" ? this.value.evaluate(object) : this.value));
    }
    toString() {
        return this.value.toString();
    }
}
exports.GreaterThanOrEqual = GreaterThanOrEqual;
function greaterThanOrEqual(criteria, value) {
    const result = new GreaterThanOrEqual(criteria);
    return value ? result.is(value) : result;
}
exports.greaterThanOrEqual = greaterThanOrEqual;
function complete(tokens, type, baseObject) {
    return Type_1.Type.Completor.operators(tokens, (tokens) => (tokens && baseObject ? baseObject === null || baseObject === void 0 ? void 0 : baseObject.complete(tokens, undefined, type) : []), {
        value: ">=",
        suggestion: { value: ">=" },
    });
}
Type_1.Type.Number.add(complete);
Type_1.Type.String.add(complete);
//# sourceMappingURL=GreaterThanOrEqual.js.map
});

const GreaterThanOrEqual$2 = /*@__PURE__*/_commonjsHelpers.getDefaultExportFromCjs(GreaterThanOrEqual_1);

var Has_1 = _commonjsHelpers.createCommonjsModule(function (module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.has = exports.Has = void 0;



class Has extends Rule_1.Rule {
    constructor(property) {
        super();
        this.property = property;
        this.precedence = 85;
        this.class = "Has";
    }
    is(value, property) {
        return Array.isArray(value)
            ? value.some(e => this.is(e, property))
            : typeof value == "object"
                ? Object.entries(value).some(e => {
                    property = property !== null && property !== void 0 ? property : this.property;
                    return e[0] == property
                        ? true
                        : typeof e[1] == "object"
                            ? this.is(e[1], property.includes(".") && property.split(".")[0] == e[0] ? property.split(".")[1] : undefined)
                            : false;
                })
                : false;
    }
    toString() {
        return `has(${this.property})`;
    }
}
exports.Has = Has;
function has(criteria, value) {
    const result = new Has(criteria);
    return value ? result.is(value) : result;
}
exports.has = has;
function complete(tokens, type, baseObject) {
    return baseObject && (type === null || type === void 0 ? void 0 : type.class) == "object"
        ? Completor_1.Completor.functions(tokens, (tokens) => type.completions.filter(c => c.value.startsWith(tokens ? tokens[0].value : "")), {
            value: "has()",
            cursor: 4,
            suggestion: { value: "has()" },
        })
        : [];
}
Type_1.Type.Object.add(complete);
//# sourceMappingURL=Has.js.map
});

const Has$2 = /*@__PURE__*/_commonjsHelpers.getDefaultExportFromCjs(Has_1);

var Includes_1 = _commonjsHelpers.createCommonjsModule(function (module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.includes = exports.Includes = void 0;



class Includes extends Rule_1.Rule {
    constructor(needle) {
        super();
        this.needle = needle;
        this.precedence = Number.MAX_SAFE_INTEGER;
        this.class = "Includes";
    }
    is(value) {
        return typeof value == "string" && value.includes(this.needle);
    }
    toString() {
        return `*${this.needle}*`;
    }
}
exports.Includes = Includes;
function includes(needle, value) {
    const result = new Includes(needle);
    return value ? result.is(value) : result;
}
exports.includes = includes;
function complete(tokens, string) {
    return Completor_1.Completor.expressions(tokens, (tokens) => {
        var _a, _b, _c;
        return !tokens ||
            (tokens.length == 3 && ((_a = string.value) === null || _a === void 0 ? void 0 : _a.includes(tokens[1].value)) && string.value != tokens[1].value) ||
            (tokens.length == 2 && tokens[0].value + tokens[1].value == "**")
            ? [
                Type_1.Type.Completion.prepend("*", { value: (_b = string === null || string === void 0 ? void 0 : string.value) !== null && _b !== void 0 ? _b : "", suggestion: { value: (_c = string === null || string === void 0 ? void 0 : string.value) !== null && _c !== void 0 ? _c : "" } }, "*"),
            ]
            : tokens.length == 1 && tokens[0].value == "*"
                ? [{ value: "**", suggestion: { value: "**", description: "includes" } }]
                : [];
    }, { value: "**", cursor: 1, suggestion: { value: "**", description: "includes" } });
}
Type_1.Type.String.add(complete);
//# sourceMappingURL=Includes.js.map
});

const Includes$2 = /*@__PURE__*/_commonjsHelpers.getDefaultExportFromCjs(Includes_1);

var Criteria = _commonjsHelpers.createCommonjsModule(function (module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isCriteria = void 0;

function isCriteria(value) {
    return typeof value == "number" || typeof value == "string" || value.class instanceof Rule_1.Rule;
}
exports.isCriteria = isCriteria;
//# sourceMappingURL=Criteria.js.map
});

const Criteria$1 = /*@__PURE__*/_commonjsHelpers.getDefaultExportFromCjs(Criteria);

var Some_1 = _commonjsHelpers.createCommonjsModule(function (module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.some = exports.Some = void 0;


class Some extends Rule_1.Rule {
    constructor(criteria) {
        super();
        this.criteria = criteria;
        this.precedence = 100;
        this.class = "Some";
    }
    is(value) {
        return Array.isArray(value) && value.some(v => this.criteria.is(v));
    }
    toString() {
        return `some(${this.criteria.toString()})`;
    }
}
exports.Some = Some;
function some(criteria, value) {
    const result = new Some(Rule_1.create(criteria));
    return value ? result.is(value) : result;
}
exports.some = some;
function complete(tokens, type, baseObject) {
    return tokens.length == 0
        ? [{ value: ":", suggestion: { value: ":" } }]
        : tokens[0].value != ":"
            ? []
            : tokens.length == 1 && tokens[0].value == ":"
                ? Type_1.Type.Completion.prepend(":", type.array
                    .filter(Type_1.Type.String.is)
                    .filter(e => e.value && e.value != "string")
                    .map(e => { var _a, _b; return ({ value: (_a = e === null || e === void 0 ? void 0 : e.value) !== null && _a !== void 0 ? _a : "", suggestion: { value: (_b = e === null || e === void 0 ? void 0 : e.value) !== null && _b !== void 0 ? _b : "" } }); }))
                : tokens.length == 2 && tokens[0].value == ":"
                    ? Type_1.Type.Completion.prepend(":", type.array
                        .filter(Type_1.Type.String.is)
                        .filter(e => e.value && e.value != "string" && e.value.startsWith(tokens[1].value))
                        .map(e => { var _a, _b; return ({ value: (_a = e === null || e === void 0 ? void 0 : e.value) !== null && _a !== void 0 ? _a : "", suggestion: { value: (_b = e === null || e === void 0 ? void 0 : e.value) !== null && _b !== void 0 ? _b : "" } }); }))
                    : [];
}
Type_1.Type.Array.add(complete);
//# sourceMappingURL=Some.js.map
});

const Some$2 = /*@__PURE__*/_commonjsHelpers.getDefaultExportFromCjs(Some_1);

var Is_1 = _commonjsHelpers.createCommonjsModule(function (module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.is = exports.Is = void 0;




class Is extends Rule_1.Rule {
    constructor(value) {
        super();
        this.value = value;
        this.precedence = Number.MAX_SAFE_INTEGER;
        this.class = "Is";
        this.symbol = ":";
    }
    is(value, object) {
        return Array.isArray(value) && Criteria.isCriteria(this.value)
            ? Some_1.some(this.value, value)
            : (isNaN(+value) ? value : +value) == (typeof this.value == "object" ? this.value.evaluate(object) : this.value);
    }
    toString() {
        return this.value.toString();
    }
}
exports.Is = Is;
function is(criteria, value) {
    const result = new Is(criteria);
    return value ? result.is(value) : result;
}
exports.is = is;
Rule_1.add(criteria => typeof criteria == "bigint" ||
    typeof criteria == "boolean" ||
    typeof criteria == "number" ||
    typeof criteria == "string"
    ? new Is(criteria)
    : undefined);
function complete(tokens, type, baseObject) {
    var _a;
    return !type.value
        ? []
        : tokens.length == 0
            ? [{ value: ":", suggestion: { value: ":" } }]
            : tokens[0].value != ":"
                ? []
                : (tokens.length == 1 && tokens[0].value == ":") ||
                    (tokens.length == 2 && tokens[0].value == ":" && ((_a = type === null || type === void 0 ? void 0 : type.value) === null || _a === void 0 ? void 0 : _a.startsWith(tokens[1].value)))
                    ? Type_1.Type.Completion.prepend(":", { value: type.value, suggestion: { value: type.value } })
                    : [];
}
Type_1.Type.String.add(complete);
//# sourceMappingURL=Is.js.map
});

const Is$2 = /*@__PURE__*/_commonjsHelpers.getDefaultExportFromCjs(Is_1);

var LesserThan_1 = _commonjsHelpers.createCommonjsModule(function (module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.lesserThan = exports.LesserThan = void 0;


class LesserThan extends Rule_1.Rule {
    constructor(value) {
        super();
        this.value = value;
        this.precedence = 85;
        this.class = "LesserThan";
        this.symbol = "<";
    }
    is(value, object) {
        return (isNaN(+value) ? value : +value) < (typeof this.value == "object" ? this.value.evaluate(object) : this.value);
    }
    toString() {
        return this.value.toString();
    }
}
exports.LesserThan = LesserThan;
function lesserThan(criteria, value) {
    const result = new LesserThan(criteria);
    return value ? result.is(value) : result;
}
exports.lesserThan = lesserThan;
function complete(tokens, type, baseObject) {
    return Type_1.Type.Completor.operators(tokens, (tokens) => (tokens && baseObject ? baseObject === null || baseObject === void 0 ? void 0 : baseObject.complete(tokens, undefined, type) : []), {
        value: "<",
        suggestion: { value: "<" },
    });
}
Type_1.Type.Number.add(complete);
Type_1.Type.String.add(complete);
//# sourceMappingURL=LesserThan.js.map
});

const LesserThan$2 = /*@__PURE__*/_commonjsHelpers.getDefaultExportFromCjs(LesserThan_1);

var LesserThanOrEqual_1 = _commonjsHelpers.createCommonjsModule(function (module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.lesserThanOrEqual = exports.LesserThanOrEqual = void 0;


class LesserThanOrEqual extends Rule_1.Rule {
    constructor(value) {
        super();
        this.value = value;
        this.precedence = 85;
        this.class = "LesserThanOrEqual";
        this.symbol = "<=";
    }
    is(value, object) {
        return ((isNaN(+value) ? value : +value) <= (typeof this.value == "object" ? this.value.evaluate(object) : this.value));
    }
    toString() {
        return this.value.toString();
    }
}
exports.LesserThanOrEqual = LesserThanOrEqual;
function lesserThanOrEqual(criteria, value) {
    const result = new LesserThanOrEqual(criteria);
    return value ? result.is(value) : result;
}
exports.lesserThanOrEqual = lesserThanOrEqual;
function complete(tokens, type, baseObject) {
    return Type_1.Type.Completor.operators(tokens, (tokens) => (tokens && baseObject ? baseObject === null || baseObject === void 0 ? void 0 : baseObject.complete(tokens, undefined, type) : []), {
        value: "<=",
        suggestion: { value: "<=" },
    });
}
Type_1.Type.Number.add(complete);
Type_1.Type.String.add(complete);
//# sourceMappingURL=LesserThanOrEqual.js.map
});

const LesserThanOrEqual$2 = /*@__PURE__*/_commonjsHelpers.getDefaultExportFromCjs(LesserThanOrEqual_1);

var Match_1 = _commonjsHelpers.createCommonjsModule(function (module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.match = exports.Match = void 0;



class Match extends Rule_1.Rule {
    constructor(criteria) {
        super();
        this.criteria = criteria;
        this.precedence = Number.MAX_SAFE_INTEGER;
        this.class = "Match";
    }
    is(value) {
        return typeof value == "string" && this.criteria.test(value);
    }
    toString() {
        return `/${this.criteria}/`;
    }
}
exports.Match = Match;
function match(criteria) {
    return new Match(criteria);
}
exports.match = match;
function complete(tokens, string) {
    return Completor_1.Completor.expressions(tokens, (tokens) => {
        return tokens && (tokens === null || tokens === void 0 ? void 0 : tokens.length) == 1 && tokens[0].value == "/" ? [{ value: "//", cursor: 1 }] : [];
    }, { value: "//", cursor: 1, suggestion: { value: "//", description: "match" } });
}
Type_1.Type.String.add(complete);
//# sourceMappingURL=Match.js.map
});

const Match = /*@__PURE__*/_commonjsHelpers.getDefaultExportFromCjs(Match_1);

var Not_1 = _commonjsHelpers.createCommonjsModule(function (module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.not = exports.Not = void 0;



class Not extends Rule_1.Rule {
    constructor(criteria) {
        super();
        this.criteria = criteria;
        this.precedence = Not.precedence;
        this.class = "Not";
    }
    is(value) {
        return !this.criteria.is(value);
    }
    toString() {
        return `!${this.criteria.stringify(this.precedence)}`;
    }
}
exports.Not = Not;
Not.precedence = 90;
function not(criteria, value) {
    const result = new Not(Rule_1.create(criteria));
    return value ? result.is(value) : result;
}
exports.not = not;
function complete(tokens, type, baseObject) {
    return type && type.class != "object" && baseObject
        ? Completor_1.Completor.expressions(tokens, (tokens) => {
            return tokens[0].value != "!"
                ? []
                : Type_1.Type.Completion.prepend("!", type.complete([{ value: "." }, ...(tokens.length > 1 ? tokens : [])]));
        }, { value: "!", cursor: 1, suggestion: { value: "!", description: "not" } })
        : [];
}
Type_1.Type.String.add(complete);
Type_1.Type.Number.add(complete);
Type_1.Type.Boolean.add(complete);
Type_1.Type.Object.add(complete);
//# sourceMappingURL=Not.js.map
});

const Not$2 = /*@__PURE__*/_commonjsHelpers.getDefaultExportFromCjs(Not_1);

var Or_1 = _commonjsHelpers.createCommonjsModule(function (module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.or = exports.Or = void 0;


class Or extends Rule_1.Rule {
    constructor(criterias) {
        super();
        this.precedence = Or.precedence;
        this.class = "Or";
        this.criteria = criterias.reduce((r, c) => (c instanceof Or ? [...r, ...c.criteria] : [...r, c]), []);
    }
    is(value) {
        return this.criteria.some(c => c.is(value));
    }
    toString() {
        return this.criteria.map(c => c.stringify(this.precedence)).join(" | ");
    }
}
exports.Or = Or;
Or.precedence = 30;
function or(...criterias) {
    return new Or(criterias.map(Rule_1.create));
}
exports.or = or;
function complete(tokens, type, baseObject) {
    return Type_1.Type.Completor.operators(tokens, (tokens) => (tokens && baseObject ? baseObject === null || baseObject === void 0 ? void 0 : baseObject.complete(tokens, undefined, undefined) : []), {
        value: " | ",
        suggestion: { value: "|", description: "or" },
    });
}
Type_1.Type.Number.addArgument(complete);
//# sourceMappingURL=Or.js.map
});

const Or$2 = /*@__PURE__*/_commonjsHelpers.getDefaultExportFromCjs(Or_1);

var Source_1 = _commonjsHelpers.createCommonjsModule(function (module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Source = void 0;

class Source extends index$4.build.Utilities.BufferedEnumerator {
    constructor(tokens, errorHandler) {
        super(Array.isArray(tokens) ? new index$4.build.Utilities.ArrayEnumerator(tokens) : tokens);
        this.errorHandler = errorHandler;
    }
    clone(start = "(", end = ")") {
        let nestingCount = 0;
        return new Source(new index$4.build.Utilities.Enumerator(() => {
            let result;
            if (this.peekIs(start))
                nestingCount++;
            else if (this.peekIs(end))
                nestingCount--;
            if (nestingCount >= 0)
                result = this.fetch();
            return result;
        }), this);
    }
    peekIs(...needles) {
        return needles.every((needle, index) => {
            const peeked = this.peek(index);
            return peeked && peeked.value && Source.is(needle, peeked.value);
        });
    }
    fetchIf(...needles) {
        const result = [];
        if (this.peekIs(...needles))
            needles.forEach(_ => result.push(this.fetch()));
        return needles.length == 1
            ? result.length == 1
                ? result[0]
                : undefined
            : needles.length == result.length
                ? result
                : undefined;
    }
    mark() {
        return index$4.build.Utilities.Enumerable.from(index$4.build.Utilities.Enumerable.empty);
    }
    raise(message, level = index$4.build.Error.Level.Critical, type = "grammatical", region) {
        if (typeof message == "string") {
            if (!region && this.last)
                region = this.last.region;
            message = new index$4.build.Error.Message(message, level, type, region);
        }
        this.errorHandler.raise(message);
    }
    static is(needle, value) {
        return Array.isArray(needle)
            ? needle.some(n => Source.is(n, value))
            : typeof needle != "string"
                ? needle.test(value)
                : needle.startsWith("!") && needle != "!"
                    ? !Source.is(needle.substring(1), value)
                    : needle == "any"
                        ? Source.symbol.every(s => s != value)
                        : needle == "symbol"
                            ? Source.symbol.some(s => s == value)
                            : needle == "identifier"
                                ? /[A-Za-z][A-Za-z0-9_]*/.test(value)
                                : needle == value;
    }
}
exports.Source = Source;
Source.wildcard = ["*", "?"];
Source.separator = ["(", ")", "."];
Source.operator = ["!", "|"];
Source.comparator = ["<", "<=", ">", ">=", ":"];
Source.binaryOperator = [" * ", " + ", " - "];
Source.symbol = [...Source.wildcard, ...Source.separator, ...Source.operator, ...Source.comparator];
//# sourceMappingURL=Source.js.map
});

const Source = /*@__PURE__*/_commonjsHelpers.getDefaultExportFromCjs(Source_1);

var parse_1 = _commonjsHelpers.createCommonjsModule(function (module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.add = exports.parseNext = exports.parse = void 0;





function parse(source, handler) {
    if (typeof source == "string") {
        handler = handler || new index$4.build.Error.ConsoleHandler();
        const tokens = lexer.tokenize(source, handler).toArray();
        source = new Source_1.Source(tokens, handler);
    }
    handler = handler instanceof Rule_1.Rule ? handler : undefined;
    const result = [];
    while (source.peek())
        result.push(parseNext(0, source));
    return result.length == 1 ? result[0] : new And_1.And(result);
}
exports.parse = parse;
function parseNext(previous, source) {
    let result;
    const precedenceTest = typeof previous == "number" ? p => previous < p : p => previous.precedence > p;
    const left = typeof previous == "number" ? undefined : previous;
    for (const parser of parsers)
        if (precedenceTest(parser[1] || Number.MAX_SAFE_INTEGER)) {
            const r = parser[0](source, left);
            if (r) {
                result = parseNext(r, source);
                break;
            }
        }
    return result || left || new And_1.And([]);
}
exports.parseNext = parseNext;
const parsers = [];
function add(parser, precedence) {
    parsers.push([parser, precedence]);
}
exports.add = add;
//# sourceMappingURL=parse.js.map
});

const parse$1 = /*@__PURE__*/_commonjsHelpers.getDefaultExportFromCjs(parse_1);

var Expression_1 = _commonjsHelpers.createCommonjsModule(function (module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Expression = void 0;
class Expression {
    stringify(precedence = 0) {
        let result = this.toString();
        if (this.precedence < precedence)
            result = "(" + result + ")";
        return result;
    }
}
exports.Expression = Expression;
//# sourceMappingURL=Expression.js.map
});

const Expression$2 = /*@__PURE__*/_commonjsHelpers.getDefaultExportFromCjs(Expression_1);

var Value_1 = _commonjsHelpers.createCommonjsModule(function (module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Value = void 0;

class Value extends Expression_1.Expression {
    constructor(value, name) {
        super();
        this.name = name;
        this.precedence = Value.precedence;
        this.class = "Value";
        if (typeof value == "string")
            this.value = isNaN(+value.replace(",", ".")) ? value : +value.replace(",", ".");
        else
            this.value = value;
    }
    toString() {
        var _a;
        return this.name ? `${(_a = this.name) === null || _a === void 0 ? void 0 : _a.toString()}.` + this.value.toString() : this.value.toString();
    }
    evaluate(variable) {
        return variable ? this.get(variable) : +this.value;
    }
    get(variable) {
        return typeof this.value == "string"
            ? +variable[this.value]
            : this.name && typeof this.value == "object"
                ? this.value.get(variable[this.name])
                : +this.value;
    }
    static create(value, name) {
        return new Value(value, name);
    }
}
exports.Value = Value;
Value.precedence = 19;
//# sourceMappingURL=Value.js.map
});

const Value$2 = /*@__PURE__*/_commonjsHelpers.getDefaultExportFromCjs(Value_1);

var Expression = _commonjsHelpers.createCommonjsModule(function (module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.addExpression = exports.parseNextExpression = exports.parseExpression = void 0;





function parseExpression(source, handler) {
    if (typeof source == "string") {
        handler = handler || new index$4.build.Error.ConsoleHandler();
        const tokens = lexer.tokenize(source, handler).toArray();
        source = new Source_1.Source(tokens, handler);
    }
    handler = handler instanceof Expression_1.Expression ? handler : undefined;
    let result;
    let algebra = false;
    let comparator = false;
    while (!result != algebra && !comparator && source.peek()) {
        let i = 1;
        algebra = false;
        comparator = false;
        while (!algebra && !comparator && source.peek(i)) {
            algebra = Source_1.Source.binaryOperator.some(c => { var _a; return ((_a = source.peek(i)) === null || _a === void 0 ? void 0 : _a.value) == c; });
            comparator = Source_1.Source.comparator.some(c => { var _a; return ((_a = source.peek(i)) === null || _a === void 0 ? void 0 : _a.value) == c; });
            i++;
        }
        result = parseNextExpression(result !== null && result !== void 0 ? result : Number.MAX_SAFE_INTEGER, source);
    }
    if (!result)
        source.raise("Missing Expression");
    return result !== null && result !== void 0 ? result : new Value_1.Value(NaN);
}
exports.parseExpression = parseExpression;
function parseNextExpression(previous, source) {
    let result;
    const left = typeof previous == "number" ? undefined : previous;
    for (const expressionParser of expressionParsers) {
        const r = expressionParser[0](source, previous);
        if (r) {
            result = r;
            break;
        }
    }
    return result || left;
}
exports.parseNextExpression = parseNextExpression;
const expressionParsers = [];
function addExpression(expressionParser, precedence) {
    expressionParsers.push([expressionParser, precedence]);
}
exports.addExpression = addExpression;
//# sourceMappingURL=Expression.js.map
});

const Expression$1 = /*@__PURE__*/_commonjsHelpers.getDefaultExportFromCjs(Expression);

var Every = _commonjsHelpers.createCommonjsModule(function (module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });


parse_1.add(source => {
    const result = source.fetchIf(":", "every", "(") && new Every_1.Every(parse_1.parse(source.clone()));
    if (result && !source.fetchIf(")"))
        source.raise("Missing end of parenthesis.");
    return result;
});
//# sourceMappingURL=Every.js.map
});

const Every$1 = /*@__PURE__*/_commonjsHelpers.getDefaultExportFromCjs(Every);

var Some = _commonjsHelpers.createCommonjsModule(function (module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });


parse_1.add(source => {
    const result = source.fetchIf(":", "some", "(") && new Some_1.Some(parse_1.parse(source.clone()));
    if (result && !source.fetchIf(")"))
        source.raise("Missing end of parenthesis.");
    return result;
});
//# sourceMappingURL=Some.js.map
});

const Some$1 = /*@__PURE__*/_commonjsHelpers.getDefaultExportFromCjs(Some);

var group = _commonjsHelpers.createCommonjsModule(function (module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });


parse_1.add(getAdder(parse_1.parse));
Expression.addExpression(getAdder(Expression.parseExpression));
function getAdder(parser) {
    return (source) => {
        const result = source.fetchIf("(") && parser(source.clone());
        if (result && !source.fetchIf(")"))
            source.raise("Missing end of parenthesis.");
        return result;
    };
}
//# sourceMappingURL=group.js.map
});

const group$1 = /*@__PURE__*/_commonjsHelpers.getDefaultExportFromCjs(group);

var GreaterThan = _commonjsHelpers.createCommonjsModule(function (module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });



parse_1.add(source => {
    return source.fetchIf(">") && new GreaterThan_1.GreaterThan(Expression.parseExpression(source));
});
//# sourceMappingURL=GreaterThan.js.map
});

const GreaterThan$1 = /*@__PURE__*/_commonjsHelpers.getDefaultExportFromCjs(GreaterThan);

var GreaterThanOrEqual = _commonjsHelpers.createCommonjsModule(function (module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });



parse_1.add(source => {
    return source.fetchIf(">=") && new GreaterThanOrEqual_1.GreaterThanOrEqual(Expression.parseExpression(source));
});
//# sourceMappingURL=GreaterThanOrEqual.js.map
});

const GreaterThanOrEqual$1 = /*@__PURE__*/_commonjsHelpers.getDefaultExportFromCjs(GreaterThanOrEqual);

var LesserThan = _commonjsHelpers.createCommonjsModule(function (module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });



parse_1.add(source => {
    return source.fetchIf("<") && new LesserThan_1.LesserThan(Expression.parseExpression(source));
});
//# sourceMappingURL=LesserThan.js.map
});

const LesserThan$1 = /*@__PURE__*/_commonjsHelpers.getDefaultExportFromCjs(LesserThan);

var LesserThanOrEqual = _commonjsHelpers.createCommonjsModule(function (module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });



parse_1.add(source => {
    return source.fetchIf("<=") && new LesserThanOrEqual_1.LesserThanOrEqual(Expression.parseExpression(source));
});
//# sourceMappingURL=LesserThanOrEqual.js.map
});

const LesserThanOrEqual$1 = /*@__PURE__*/_commonjsHelpers.getDefaultExportFromCjs(LesserThanOrEqual);

var Or = _commonjsHelpers.createCommonjsModule(function (module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });


parse_1.add((source, previous) => previous && source.fetchIf("|") && new Or_1.Or([previous, parse_1.parseNext(Or_1.Or.precedence, source)]), Or_1.Or.precedence);
//# sourceMappingURL=Or.js.map
});

const Or$1 = /*@__PURE__*/_commonjsHelpers.getDefaultExportFromCjs(Or);

var Not = _commonjsHelpers.createCommonjsModule(function (module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });


parse_1.add(source => source.fetchIf("!") && new Not_1.Not(parse_1.parseNext(Not_1.Not.precedence, source)));
//# sourceMappingURL=Not.js.map
});

const Not$1 = /*@__PURE__*/_commonjsHelpers.getDefaultExportFromCjs(Not);

var Property = _commonjsHelpers.createCommonjsModule(function (module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });



parse_1.add(source => {
    const result = [];
    let fetched;
    while ((fetched = source.fetchIf("identifier", ".")))
        result.push(fetched[0].value);
    if (source.peekIs("identifier", Source_1.Source.comparator) && (fetched = source.fetchIf("identifier")))
        result.push(fetched.value);
    return result.length > 0
        ? result.reduceRight((r, name) => new Property_1.Property(name, r), parse_1.parseNext(Property_1.Property.precedence, source))
        : undefined;
});
//# sourceMappingURL=Property.js.map
});

const Property$1 = /*@__PURE__*/_commonjsHelpers.getDefaultExportFromCjs(Property);

var Includes = _commonjsHelpers.createCommonjsModule(function (module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });


parse_1.add(source => {
    const fetched = source.fetchIf("*", "any", "*");
    return fetched && new Includes_1.Includes(fetched[1].value);
});
//# sourceMappingURL=Includes.js.map
});

const Includes$1 = /*@__PURE__*/_commonjsHelpers.getDefaultExportFromCjs(Includes);

var StartsWith_1 = _commonjsHelpers.createCommonjsModule(function (module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.startsWith = exports.StartsWith = void 0;



class StartsWith extends Rule_1.Rule {
    constructor(needle) {
        super();
        this.needle = needle;
        this.precedence = Number.MAX_SAFE_INTEGER;
        this.class = "StartsWith";
    }
    is(value) {
        return typeof value == "string" && value.startsWith(this.needle);
    }
    toString() {
        return `${this.needle}*`;
    }
}
exports.StartsWith = StartsWith;
function startsWith(needle, value) {
    const result = new StartsWith(needle);
    return value ? result.is(value) : result;
}
exports.startsWith = startsWith;
function complete(tokens, string) {
    return Completor_1.Completor.expressions(tokens, (tokens) => {
        var _a, _b, _c, _d;
        return !tokens ||
            (tokens.length == 1 && tokens[0].value == "*") ||
            (tokens.length == 2 &&
                tokens[1].value == "*" &&
                string.value &&
                string.value.startsWith((_b = (_a = tokens[0]) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : ""))
            ? [Type_1.Type.Completion.prepend("", { value: (_c = string === null || string === void 0 ? void 0 : string.value) !== null && _c !== void 0 ? _c : "", suggestion: { value: (_d = string === null || string === void 0 ? void 0 : string.value) !== null && _d !== void 0 ? _d : "" } }, "*")]
            : [];
    }, { value: "*", cursor: 0, suggestion: { value: "*", description: "startswith" } });
}
Type_1.Type.String.add(complete);
//# sourceMappingURL=StartsWith.js.map
});

const StartsWith$2 = /*@__PURE__*/_commonjsHelpers.getDefaultExportFromCjs(StartsWith_1);

var StartsWith = _commonjsHelpers.createCommonjsModule(function (module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });


parse_1.add(source => {
    const fetched = source.fetchIf(":", "any", "*") || source.fetchIf("any", "*");
    return fetched && new StartsWith_1.StartsWith((fetched === null || fetched === void 0 ? void 0 : fetched.length) == 3 ? fetched[1].value : fetched[0].value);
});
//# sourceMappingURL=StartsWith.js.map
});

const StartsWith$1 = /*@__PURE__*/_commonjsHelpers.getDefaultExportFromCjs(StartsWith);

var EndsWith = _commonjsHelpers.createCommonjsModule(function (module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });


parse_1.add(source => {
    const fetched = source.fetchIf(":", "*", "any") || source.fetchIf("*", "any");
    return fetched && new EndsWith_1.EndsWith((fetched === null || fetched === void 0 ? void 0 : fetched.length) == 3 ? fetched[2].value : fetched[1].value);
});
//# sourceMappingURL=EndsWith.js.map
});

const EndsWith$1 = /*@__PURE__*/_commonjsHelpers.getDefaultExportFromCjs(EndsWith);

var Has = _commonjsHelpers.createCommonjsModule(function (module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });


parse_1.add(source => {
    const fetched = source.fetchIf("has", "(", "any", ")");
    return fetched && new Has_1.Has(fetched[2].value);
});
//# sourceMappingURL=Has.js.map
});

const Has$1 = /*@__PURE__*/_commonjsHelpers.getDefaultExportFromCjs(Has);

var InfixOperator_1 = _commonjsHelpers.createCommonjsModule(function (module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.InfixOperator = void 0;


class InfixOperator extends Expression_1.Expression {
    constructor(symbol, precedence, left, right) {
        super();
        this.precedence = precedence;
        this.left = left;
        this.right = right;
        this.class = "InfixOperator";
        this.symbol = symbol.replace(/ /g, "");
    }
    toString() {
        const symbol = this.symbol;
        return (this.left.stringify(InfixOperator.getPrecedence(symbol)) +
            ` ${symbol} ` +
            this.right.stringify(InfixOperator.getPrecedence(symbol)));
    }
    evaluate(criteria) {
        let result;
        switch (this.getSymbol()) {
            case "+":
                result = this.left.evaluate(criteria) + this.right.evaluate(criteria);
                break;
            case "-":
                result = this.left.evaluate(criteria) - this.right.evaluate(criteria);
                break;
            case "*":
                result = this.left.evaluate(criteria) * this.right.evaluate(criteria);
                break;
            default:
                result = NaN;
                break;
        }
        return result;
    }
    getSymbol() {
        return this.symbol;
    }
    stringify(precedence = 0) {
        let result = this.toString();
        if (this.precedence < precedence)
            result = "(" + result + ")";
        return result;
    }
    static getPrecedence(symbol) {
        let result;
        symbol = symbol === null || symbol === void 0 ? void 0 : symbol.replace(/ /g, "");
        switch (symbol) {
            case "+":
                result = 14;
                break;
            case "-":
                result = 15;
                break;
            case "*":
                result = 16;
                break;
            default:
                result = undefined;
                break;
        }
        return result;
    }
    static create(symbol, left, right) {
        let result;
        const fallback = new InfixOperator("+", 14, left, right);
        const precedence = InfixOperator.getPrecedence(symbol);
        if (precedence)
            result = new InfixOperator(symbol, precedence, left, right);
        return result || fallback;
    }
}
exports.InfixOperator = InfixOperator;
function complete(tokens, type, baseObject) {
    return [" + ", " - ", " * "]
        .map(s => ({ value: s, suggestion: { value: s } }))
        .map(c => Type_1.Type.Completor.operators(tokens, (tokens) => (tokens ? baseObject.complete(tokens, undefined, type) : []), c))
        .reduce((result, element) => result.concat(element), []);
}
Type_1.Type.Number.addArgument(complete);
//# sourceMappingURL=InfixOperator.js.map
});

const InfixOperator$2 = /*@__PURE__*/_commonjsHelpers.getDefaultExportFromCjs(InfixOperator_1);

var InfixOperator = _commonjsHelpers.createCommonjsModule(function (module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });



Expression.addExpression((source, previous) => {
    var _a, _b;
    let result;
    const symbol = source.peekIs(Source_1.Source.binaryOperator) && source.fetch().value;
    let precedence;
    if (symbol && typeof previous == "object") {
        let right;
        let nextPrecedence;
        let i = 0;
        precedence = InfixOperator_1.InfixOperator.getPrecedence(symbol);
        while (!nextPrecedence && source.peek(i)) {
            nextPrecedence =
                ((_a = source.peek(i)) === null || _a === void 0 ? void 0 : _a.value) == "(" ? Number.MAX_SAFE_INTEGER : InfixOperator_1.InfixOperator.getPrecedence((_b = source.peek(i)) === null || _b === void 0 ? void 0 : _b.value);
            i++;
        }
        if (nextPrecedence && precedence < nextPrecedence) {
            right = Expression.parseNextExpression(precedence, source);
            if (!right) {
                source.raise("Missing right hand side of " + symbol);
            }
        }
        else
            right = Expression.parseNextExpression(NaN, source);
        if ((nextPrecedence && precedence == nextPrecedence) || nextPrecedence == Number.MAX_SAFE_INTEGER) {
            result = Expression.parseNextExpression(new InfixOperator_1.InfixOperator(symbol, precedence, previous, right), source);
        }
        else
            result = new InfixOperator_1.InfixOperator(symbol, precedence, previous, right);
    }
    return result;
});
//# sourceMappingURL=InfixOperator.js.map
});

const InfixOperator$1 = /*@__PURE__*/_commonjsHelpers.getDefaultExportFromCjs(InfixOperator);

var Value = _commonjsHelpers.createCommonjsModule(function (module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });


Expression.addExpression((source, previous) => {
    const fetchedArray = [];
    let fetched;
    while ((fetched = source.fetchIf("identifier", ".")))
        fetchedArray.push(fetched[0].value);
    let result;
    if (fetchedArray.length == 0) {
        fetched = source.fetchIf("any", ".", "any") || source.fetchIf("any");
        result =
            fetched && (Array.isArray(fetched) ? new Value_1.Value(+fetched.map(t => t.value).join("")) : new Value_1.Value(fetched.value));
    }
    else {
        fetched = source.fetchIf("identifier");
        const fetchedValue = new Value_1.Value(fetched ? fetched.value : 0);
        result =
            fetchedArray.length > 0
                ? fetchedArray.reduceRight((r, name) => new Value_1.Value(isNaN(+r) ? r : +r, name), fetchedValue)
                : undefined;
    }
    if (result && typeof previous == "number" && !isNaN(previous) && previous != Number.MAX_SAFE_INTEGER)
        result = Expression.parseNextExpression(result, source);
    return result;
});
//# sourceMappingURL=Value.js.map
});

const Value$1 = /*@__PURE__*/_commonjsHelpers.getDefaultExportFromCjs(Value);

var Is = _commonjsHelpers.createCommonjsModule(function (module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });




parse_1.add(source => {
    let expression;
    if (source.fetchIf(":")) {
        let algebra = false;
        let comparator = false;
        let i = 1;
        while (!algebra && !comparator && source.peek(i)) {
            algebra = Source_1.Source.binaryOperator.some(c => { var _a; return ((_a = source.peek(i)) === null || _a === void 0 ? void 0 : _a.value) == c; });
            comparator = Source_1.Source.comparator.some(c => { var _a; return ((_a = source.peek(i)) === null || _a === void 0 ? void 0 : _a.value) == c; });
            i++;
        }
        if (algebra)
            expression = Expression.parseExpression(source);
    }
    const fetched = source.fetchIf("any");
    return expression ? new Is_1.Is(expression) : fetched && new Is_1.Is(fetched.value);
});
//# sourceMappingURL=Is.js.map
});

const Is$1 = /*@__PURE__*/_commonjsHelpers.getDefaultExportFromCjs(Is);

var ignore = _commonjsHelpers.createCommonjsModule(function (module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

parse_1.add(source => {
    source.raise(`Ignoring unknown token "${source.fetch()}"`);
    return undefined;
});
//# sourceMappingURL=ignore.js.map
});

const ignore$1 = /*@__PURE__*/_commonjsHelpers.getDefaultExportFromCjs(ignore);

var parse = _commonjsHelpers.createCommonjsModule(function (module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

Object.defineProperty(exports, "parse", { enumerable: true, get: function () { return parse_1.parse; } });

Object.defineProperty(exports, "parseExpression", { enumerable: true, get: function () { return Expression.parseExpression; } });


















//# sourceMappingURL=index.js.map
});

const index$1 = /*@__PURE__*/_commonjsHelpers.getDefaultExportFromCjs(parse);

var Tuple_1 = _commonjsHelpers.createCommonjsModule(function (module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Tuple = void 0;

class Tuple extends Rule_1.Rule {
    constructor(criteria) {
        super();
        this.criteria = criteria;
        this.precedence = Number.MAX_SAFE_INTEGER;
        this.class = "Tuple";
    }
    is(value) {
        return this.criteria.length == value.length && this.criteria.every((c, index) => c.is(value[index]));
    }
    toString() {
        return `[${this.criteria.map(c => c.toString()).join(", ")}]`;
    }
}
exports.Tuple = Tuple;
Rule_1.add(criteria => (Array.isArray(criteria) ? new Tuple(criteria.map(Rule_1.create)) : undefined));
//# sourceMappingURL=Tuple.js.map
});

const Tuple = /*@__PURE__*/_commonjsHelpers.getDefaultExportFromCjs(Tuple_1);

var dist = _commonjsHelpers.createCommonjsModule(function (module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.startsWith = exports.some = exports.property = exports.parseExpression = exports.parse = exports.or = exports.not = exports.match = exports.is = exports.includes = exports.lesserThanOrEqual = exports.lesserThan = exports.greaterThanOrEqual = exports.greaterThan = exports.filter = exports.has = exports.every = exports.endsWith = exports.create = exports.and = exports.any = exports.Value = exports.Type = exports.Tuple = exports.StartsWith = exports.Some = exports.Rule = exports.Property = exports.Or = exports.Not = exports.Match = exports.Is = exports.Includes = exports.LesserThanOrEqual = exports.LesserThan = exports.GreaterThanOrEqual = exports.GreaterThan = exports.Has = exports.Every = exports.EndsWith = exports.Any = exports.And = void 0;


Object.defineProperty(exports, "And", { enumerable: true, get: function () { return And_1.And; } });
Object.defineProperty(exports, "and", { enumerable: true, get: function () { return And_1.and; } });

Object.defineProperty(exports, "Any", { enumerable: true, get: function () { return Any_1.Any; } });
Object.defineProperty(exports, "any", { enumerable: true, get: function () { return Any_1.any; } });

Object.defineProperty(exports, "EndsWith", { enumerable: true, get: function () { return EndsWith_1.EndsWith; } });
Object.defineProperty(exports, "endsWith", { enumerable: true, get: function () { return EndsWith_1.endsWith; } });

Object.defineProperty(exports, "Every", { enumerable: true, get: function () { return Every_1.Every; } });
Object.defineProperty(exports, "every", { enumerable: true, get: function () { return Every_1.every; } });

Object.defineProperty(exports, "GreaterThan", { enumerable: true, get: function () { return GreaterThan_1.GreaterThan; } });
Object.defineProperty(exports, "greaterThan", { enumerable: true, get: function () { return GreaterThan_1.greaterThan; } });

Object.defineProperty(exports, "GreaterThanOrEqual", { enumerable: true, get: function () { return GreaterThanOrEqual_1.GreaterThanOrEqual; } });
Object.defineProperty(exports, "greaterThanOrEqual", { enumerable: true, get: function () { return GreaterThanOrEqual_1.greaterThanOrEqual; } });

Object.defineProperty(exports, "Has", { enumerable: true, get: function () { return Has_1.Has; } });
Object.defineProperty(exports, "has", { enumerable: true, get: function () { return Has_1.has; } });

Object.defineProperty(exports, "Includes", { enumerable: true, get: function () { return Includes_1.Includes; } });
Object.defineProperty(exports, "includes", { enumerable: true, get: function () { return Includes_1.includes; } });

Object.defineProperty(exports, "Is", { enumerable: true, get: function () { return Is_1.Is; } });

Object.defineProperty(exports, "LesserThan", { enumerable: true, get: function () { return LesserThan_1.LesserThan; } });
Object.defineProperty(exports, "lesserThan", { enumerable: true, get: function () { return LesserThan_1.lesserThan; } });

Object.defineProperty(exports, "LesserThanOrEqual", { enumerable: true, get: function () { return LesserThanOrEqual_1.LesserThanOrEqual; } });
Object.defineProperty(exports, "lesserThanOrEqual", { enumerable: true, get: function () { return LesserThanOrEqual_1.lesserThanOrEqual; } });

Object.defineProperty(exports, "Match", { enumerable: true, get: function () { return Match_1.Match; } });
Object.defineProperty(exports, "match", { enumerable: true, get: function () { return Match_1.match; } });

Object.defineProperty(exports, "Not", { enumerable: true, get: function () { return Not_1.Not; } });
Object.defineProperty(exports, "not", { enumerable: true, get: function () { return Not_1.not; } });

Object.defineProperty(exports, "Or", { enumerable: true, get: function () { return Or_1.Or; } });
Object.defineProperty(exports, "or", { enumerable: true, get: function () { return Or_1.or; } });

Object.defineProperty(exports, "parse", { enumerable: true, get: function () { return parse.parse; } });
Object.defineProperty(exports, "parseExpression", { enumerable: true, get: function () { return parse.parseExpression; } });

Object.defineProperty(exports, "Property", { enumerable: true, get: function () { return Property_1.Property; } });
Object.defineProperty(exports, "property", { enumerable: true, get: function () { return Property_1.property; } });

Object.defineProperty(exports, "create", { enumerable: true, get: function () { return Rule_1.create; } });
Object.defineProperty(exports, "Rule", { enumerable: true, get: function () { return Rule_1.Rule; } });

Object.defineProperty(exports, "Some", { enumerable: true, get: function () { return Some_1.Some; } });
Object.defineProperty(exports, "some", { enumerable: true, get: function () { return Some_1.some; } });

Object.defineProperty(exports, "StartsWith", { enumerable: true, get: function () { return StartsWith_1.StartsWith; } });
Object.defineProperty(exports, "startsWith", { enumerable: true, get: function () { return StartsWith_1.startsWith; } });

Object.defineProperty(exports, "Tuple", { enumerable: true, get: function () { return Tuple_1.Tuple; } });

Object.defineProperty(exports, "Type", { enumerable: true, get: function () { return Type_1.Type; } });

Object.defineProperty(exports, "Value", { enumerable: true, get: function () { return Value_1.Value; } });
function is(criteria, value) {
    const result = Rule_1.create(criteria);
    return value ? result.is(value) : result;
}
exports.is = is;
function filter(criteria, value) {
    const c = Rule_1.create(criteria);
    return c.filter(value);
}
exports.filter = filter;
//# sourceMappingURL=index.js.map
});

const index = /*@__PURE__*/_commonjsHelpers.getDefaultExportFromCjs(dist);

exports.dist = dist;
