import n from"../../../../_virtual/picocolors.mjs";import e from"../utils/pluralize.mjs";import t from"./stringFormatter.mjs";import o from"./terminalLink.mjs";const{underline:r,red:s,yellow:i,dim:l,green:f}=n;function c(n,o){let c=t(n,o);""===c&&(c="\n");const g=n.filter(n=>n.ignored).length,m=g?`${n.length-g} of ${n.length}`:n.length;c+=r(`${m} ${e("source",n.length)} checked\n`);for(const e of n){let n=f;e.errored?n=s:e.warnings.length?n=i:e.ignored&&(n=l);let t=a(e.source);e.ignored&&(t+=" (ignored)"),c+=n(`  ${t}\n`)}const $=n.flatMap(n=>n.warnings);if(0===$.length)c+="\n0 problems found\n";else{const n=u($,n=>n.severity),t=t=>{const s=n[t];if(void 0===s)return;c+="\n",c+=r(`${s.length} ${e(t,s.length)} found\n`);const i=u(s,n=>n.rule),f=o.ruleMetadata;for(const[n,e]of Object.entries(i)){const t=f[n]||{};let o=[t.fixable?"maybe fixable":"",t.deprecated?"deprecated":""].filter(Boolean).join(", ");o=o?` (${o})`:"",c+=l(`  ${d(n,t)}: ${e.length}${o}\n`)}};t("error"),t("warning")}const p=function(n){const e=new Map;for(const{_postcssResult:t}of n){if(!t)continue;const{stylelint:{fixersData:n}}=t,o=Object.entries(n);for(const[n,t]of o)t&&e.set(n,t)}return e}(n);if(p.size){let n="\n",t=0;for(const[e,r]of p){const s=o.ruleMetadata[e];n+=l(`  ${d(e,s)}: ${r}\n`),t+=r}c+="\n",c+=r(`${t} ${e("problem",t)} fixed`),c+=n}return`${c}\n`}function u(n,e){const t={};for(const o of n){const n=e(o);let r=t[n];void 0===r&&(t[n]=r=[]),r.push(o)}return t}function a(n){return!n||n.startsWith("<")?`${n}`:o(n,`file://${n}`)}function d(n,e){return e&&e.url?o(n,e.url):n}export{c as default};