import e from"../../../../../_virtual/index20.mjs";import r from"../../../../../_virtual/index19.mjs";import{atRuleAfterNameIndex as t,atRuleParamIndex as s,atRuleBetweenIndex as n,atRuleAfterIndex as i,ruleBetweenIndex as a,ruleAfterIndex as o,declarationBetweenIndex as u,declarationValueIndex as l}from"../../utils/nodeFieldIndices.mjs";import m from"../../utils/getAtRuleParams.mjs";import f from"../../utils/getDeclarationValue.mjs";import p from"../../utils/getRuleSelector.mjs";import c from"../../utils/report.mjs";import g from"../../utils/ruleMessages.mjs";import w from"../../utils/validateOptions.mjs";const{isAttribute:d,isComment:j}=e,x="no-irregular-whitespace",h=g(x,{rejected:"Unexpected irregular whitespace"}),v=["\v","\f"," ",""," ","᠎","\ufeff"," "," "," "," "," "," "," "," "," "," "," ","​","\u2028","\u2029"," "," ","　"].join(""),b=new RegExp(`[${v}]`),R=new RegExp(`[${v}]+`,"g"),y=new RegExp(`^(?:${["grid","grid-template","grid-template-areas"].join("|")})$`,"i"),A=r=>(g,v)=>{if(!w(v,x,{actual:r}))return;const y=(e,r,t)=>{if(!r)return;const s=(n=r,Array.from(n.matchAll(R)).map(e=>({index:e.index,length:e[0].length})));var n;if(!s.length)return;const i=t(e);s.forEach(({index:r,length:t})=>{c({ruleName:x,result:v,message:h.rejected,messageArgs:[],node:e,index:i+r,endIndex:i+r+t})})};g.walkAtRules(e=>{y(e,e.raws.before,k),y(e,e.name,E),y(e,e.raws.afterName,t),y(e,N(m(e),e=>"string"===e.type),s),y(e,e.raws.between,n),y(e,e.raws.after,i)}),g.walkRules(r=>{y(r,r.raws.before,k),y(r,function(r){if(!b.test(r))return r;return e(e=>{e.walk(e=>{e.value&&(d(e)||j(e))&&(e.value=$(e.value))})}).processSync(r)}(p(r)),k),y(r,r.raws.between,a),y(r,r.raws.after,o)}),g.walkDecls(e=>{y(e,e.raws.before,k),y(e,S(e.prop),k),y(e,S(e.raws.between),u),y(e,S(f(e),e.prop),l)})};function k(){return 0}function E(){return 1}function $(e){return e.replace(R," ")}function N(e,t){if(!b.test(e))return e;const s=r(e);return s.walk(e=>{t(e)&&(e.value=$(e.value))}),s.toString()}function S(e,r){if(!e)return;const t=!!r&&y.test(r.toLowerCase());return N(e,e=>"string"===e.type&&!t||"comment"===e.type)}A.ruleName=x,A.messages=h,A.meta={url:"https://stylelint.io/user-guide/rules/no-irregular-whitespace"};export{A as default};