import e from"../../../../../_virtual/index19.mjs";import{assert as t}from"../../utils/validateTypes.mjs";import{declarationValueIndex as n}from"../../utils/nodeFieldIndices.mjs";import i from"./utils/findNotContiguousOrRectangular.mjs";import s from"../../utils/isStandardSyntaxValue.mjs";import r from"../../utils/report.mjs";import o from"../../utils/ruleMessages.mjs";import d from"../../utils/validateOptions.mjs";const l="named-grid-areas-no-invalid",a=o(l,{expectedToken:()=>"Expected cell token within string",expectedSameNumber:()=>"Expected same number of cell tokens in each string",expectedRectangle:e=>`Expected single filled-in rectangle for "${e}"`}),m=o=>(m,u)=>{d(u,l,{actual:o})&&m.walkDecls(/^(?:grid|grid-template|grid-template-areas)$/i,o=>{const{value:d}=o;if(!s(d))return;if("none"===d.toLowerCase().trim())return;const m=[];let c=!1;if(e(d).walk(({sourceIndex:e,sourceEndIndex:t,type:n,value:i})=>{if("string"===n)return""===i?(x(a.expectedToken,[],e,t),void(c=!0)):void m.push({values:i.trim().split(" ").filter(Boolean),index:e,endIndex:t})}),c)return;const[p]=m;if(void 0===p)return;const f=m.find(e=>e.values.length!==p.values.length);if(void 0!==f)return void x(a.expectedSameNumber,[],f.index,f.endIndex);const g=i(m.map(e=>e.values));for(const e of g.sort()){const n=m.find(t=>t.values.includes(e));t(n),x(a.expectedRectangle,[e],n.index,n.endIndex)}function x(e,t,i,s){const d=n(o);r({message:e,messageArgs:t,node:o,index:d+i,endIndex:d+s,result:u,ruleName:l})}})};m.ruleName=l,m.messages=a,m.meta={url:"https://stylelint.io/user-guide/rules/named-grid-areas-no-invalid"};export{m as default};