import{__require as e}from"../../picocolors/picocolors.mjs";import{__require as t}from"./terminal-highlight.mjs";var i,s;function r(){if(s)return i;s=1;let r=e(),n=t();class l extends Error{constructor(e,t,i,s,r,n){super(e),this.name="CssSyntaxError",this.reason=e,r&&(this.file=r),s&&(this.source=s),n&&(this.plugin=n),void 0!==t&&void 0!==i&&("number"==typeof t?(this.line=t,this.column=i):(this.line=t.line,this.column=t.column,this.endLine=i.line,this.endColumn=i.column)),this.setMessage(),Error.captureStackTrace&&Error.captureStackTrace(this,l)}setMessage(){this.message=this.plugin?this.plugin+": ":"",this.message+=this.file?this.file:"<css input>",void 0!==this.line&&(this.message+=":"+this.line+":"+this.column),this.message+=": "+this.reason}showSourceCode(e){if(!this.source)return"";let t=this.source;null==e&&(e=r.isColorSupported);let i=e=>e,s=e=>e,l=e=>e;if(e){let{bold:e,gray:t,red:o}=r.createColors(!0);s=t=>e(o(t)),i=e=>t(e),n&&(l=e=>n(e))}let o=t.split(/\r?\n/),h=Math.max(this.line-3,0),a=Math.min(this.line+2,o.length),u=String(a).length;return o.slice(h,a).map((e,t)=>{let r=h+1+t,n=" "+(" "+r).slice(-u)+" | ";if(r===this.line){if(e.length>160){let t=20,r=Math.max(0,this.column-t),o=Math.max(this.column+t,this.endColumn+t),h=e.slice(r,o),a=i(n.replace(/\d/g," "))+e.slice(0,Math.min(this.column-1,t-1)).replace(/[^\t]/g," ");return s(">")+i(n)+l(h)+"\n "+a+s("^")}let t=i(n.replace(/\d/g," "))+e.slice(0,this.column-1).replace(/[^\t]/g," ");return s(">")+i(n)+l(e)+"\n "+t+s("^")}return" "+i(n)+l(e)}).join("\n")}toString(){let e=this.showSourceCode();return e&&(e="\n\n"+e+"\n"),this.name+": "+this.message+e}}return i=l,l.default=l,i}export{r as __require};