"use strict";
var __webpack_require__ = {};
(()=>{
    __webpack_require__.d = (exports1, definition)=>{
        for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
            enumerable: true,
            get: definition[key]
        });
    };
})();
(()=>{
    __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
})();
(()=>{
    __webpack_require__.r = (exports1)=>{
        if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
            value: 'Module'
        });
        Object.defineProperty(exports1, '__esModule', {
            value: true
        });
    };
})();
var __webpack_exports__ = {};
__webpack_require__.r(__webpack_exports__);
__webpack_require__.d(__webpack_exports__, {
    makeDefinedConditions: ()=>makeDefinedConditions,
    makeMatchConditions: ()=>makeMatchConditions
});
const set_cjs_namespaceObject = require("../../../utils/set.cjs");
function makeMatchConditions(mustMatch, mustNotMatch, helpers) {
    const conditions = [];
    for(const field in mustMatch){
        if (mustNotMatch[field]) {
            const mustNotMatchValues = new Set(mustNotMatch[field]);
            const mustMatchValues = new Set(mustMatch[field]);
            const commonValues = (0, set_cjs_namespaceObject.intersection)(mustNotMatchValues, mustMatchValues);
            if (commonValues.size > 0) {
                console.error(`Conflicting match conditions for field ${field}, the template will be ignored.`, commonValues);
                return [
                    ()=>false
                ];
            }
        }
        conditions.push(helpers.fieldMustMatch(field, mustMatch[field]));
    }
    for(const field in mustNotMatch)conditions.push(helpers.fieldMustNotMatch(field, mustNotMatch[field]));
    return conditions;
}
function makeDefinedConditions(ifDefined, ifNotDefined, helpers) {
    const conditions = [];
    if (ifDefined) {
        const fieldNames = ifDefined.split(',');
        conditions.push(helpers.fieldsMustBeDefined(fieldNames));
    }
    if (ifNotDefined) {
        const fieldNames = ifNotDefined.split(',');
        conditions.push(helpers.fieldsMustNotBeDefined(fieldNames));
    }
    return conditions;
}
exports.makeDefinedConditions = __webpack_exports__.makeDefinedConditions;
exports.makeMatchConditions = __webpack_exports__.makeMatchConditions;
for(var __rspack_i in __webpack_exports__)if (-1 === [
    "makeDefinedConditions",
    "makeMatchConditions"
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
Object.defineProperty(exports, '__esModule', {
    value: true
});
