import e from"../../../../../_virtual/index13.mjs";import{__require as r}from"../../utils/isStandardSyntaxProperty.mjs";import{__require as t}from"../../utils/optionsHaveException.mjs";import{__require as o}from"../../utils/namespace.mjs";import{__require as s}from"../../utils/parseNestedPropRoot.mjs";import{__require as a}from"../../utils/ruleUrl.mjs";var n,p;function l(){if(p)return n;p=1;const{utils:l}=e,i=r(),u=t(),c=o(),d=s(),m=a(),f=Object.prototype.hasOwnProperty,y=c("declaration-nested-properties"),_=l.ruleMessages(y,{expected:e=>`Expected property "${e}" to be in a nested form`,rejected:e=>`Unexpected nested property "${e}"`}),j={url:m(y)};function v(e,r){return(t,o)=>{l.validateOptions(o,y,{actual:e,possible:["always","never"]},{actual:r,possible:{except:["only-of-namespace"]},optional:!0})&&("always"===e?t.walk(e=>{if("rule"!==e.type&&"atrule"!==e.type)return;const t={};e.each(e=>{const{prop:r,type:o,selector:s}=e;if("decl"===o){if(!i(r))return;const o=/^([a-zA-Z\d]+)-/.exec(r);if(o&&o[1]){const r=o[1];f.call(t,r)||(t[r]=[]),t[r].push({node:e})}}if("rule"===o||"decl"===o&&e.isNested){const r=d(s||e.toString());if(r&&void 0!==r.propName){const o=r.propName.value;f.call(t,o)||(t[o]=[]),t[o].push({node:e,nested:!0})}}}),Object.keys(t).forEach(e=>{const s=u(r,"only-of-namespace"),a=t[e].length>1;t[e].forEach(r=>{if(!0===r.nested)s&&!0===r.nested&&1===r.node.nodes.length&&l.report({message:_.rejected(e),node:r.node,result:o,ruleName:y});else{if(s&&!a)return;l.report({message:_.expected(r.node.prop),node:r.node,result:o,ruleName:y})}})})}):"never"===e&&t.walk(e=>{if("rule"===e.type){const r=d(e.selector);r&&void 0!==r.propName&&l.report({message:_.rejected(r.propName.value),result:o,ruleName:y,node:e})}}))}}return v.ruleName=y,v.messages=_,v.meta=j,n=v}export{l as __require};