import e from"./arrayEqual.mjs";import{isPlainObject as o}from"./validateTypes.mjs";const t=new Set(["severity","message","url","reportDisables","disableFix"]),r=new Set(["reportDescriptionlessDisables","reportInvalidScopeDisables","reportNeedlessDisables","reportUnscopedDisables"]);function n(e,o,...t){const r=e.stylelint.config?.validate;if(!r)return!0;let n=!0;for(const e of t)i(e,o,l);function l(o){n=!1,e.warn(o,{stylelintType:"invalidOption"}),e.stylelint.stylelintError=!0}return n}function i({possible:n,actual:i,optional:f},a,u){if(!1===i&&!r.has(a))return u(`Invalid option value "false" for rule "${a}". Are you trying to disable this rule? If so use "null" instead`);if(null===i||e(i,[null]))return;const p=null==n||Array.isArray(n)&&0===n.length||o(n)&&0===Object.keys(n).length;if(!p||!0!==i)if(void 0!==i){if(p)return f?void u(`Incorrect configuration for rule "${a}". Rule should have "possible" values for options validation`):void u(`Unexpected option value ${s(i)} for rule "${a}"`);if("function"!=typeof n)if(Array.isArray(n))for(const e of[i].flat())l(n,e)||u(`Invalid option value ${s(e)} for rule "${a}"`);else if(o(i)&&"object"==typeof i&&null!==i)for(const[e,o]of Object.entries(i)){if(t.has(e))continue;const r=n&&n[e];if(r)for(const t of[o].flat())l(r,t)||u(`Invalid value ${s(t)} for option "${e}" of rule "${a}"`);else u(`Invalid option name "${e}" for rule "${a}"`)}else u(`Invalid option value ${s(i)} for rule "${a}": should be an object`);else n(i)||u(`Invalid option ${s(i)} for rule "${a}"`)}else{if(p||f)return;u(`Expected option value for rule "${a}"`)}}function l(e,o){for(const t of[e].flat()){if("function"==typeof t&&t(o))return!0;if(o===t)return!0}return!1}function s(e){return"string"==typeof e?`"${e}"`:`"${JSON.stringify(e)}"`}export{n as default};