"use strict";const c=require("../../../../../../_virtual/___vite-browser-external.js"),x=require("../../../../../../_virtual/index29.js"),C=require("./css-syntax-error.js"),y=require("./previous-map.js");let{SourceMapConsumer:F,SourceMapGenerator:O}=c,{fileURLToPath:S,pathToFileURL:h}=c,{resolve:g,isAbsolute:v}=c,{nanoid:_}=x,p=c,w=C,j=y,d=Symbol("fromOffsetCache"),L=Boolean(F&&O),b=Boolean(g&&v);class m{constructor(i,e={}){if(i===null||typeof i>"u"||typeof i=="object"&&!i.toString)throw new Error(`PostCSS received ${i} instead of CSS string`);if(this.css=i.toString(),this.css[0]==="\uFEFF"||this.css[0]==="\uFFFE"?(this.hasBOM=!0,this.css=this.css.slice(1)):this.hasBOM=!1,e.from&&(!b||/^\w+:\/\//.test(e.from)||v(e.from)?this.file=e.from:this.file=g(e.from)),b&&L){let t=new j(this.css,e);if(t.text){this.map=t;let o=t.consumer().file;!this.file&&o&&(this.file=this.mapResolve(o))}}this.file||(this.id="<input css "+_(6)+">"),this.map&&(this.map.file=this.from)}fromOffset(i){let e,t;if(this[d])t=this[d];else{let l=this.css.split(`
`);t=new Array(l.length);let s=0;for(let n=0,r=l.length;n<r;n++)t[n]=s,s+=l[n].length+1;this[d]=t}e=t[t.length-1];let o=0;if(i>=e)o=t.length-1;else{let l=t.length-2,s;for(;o<l;)if(s=o+(l-o>>1),i<t[s])l=s-1;else if(i>=t[s+1])o=s+1;else{o=s;break}}return{line:o+1,col:i-t[o]+1}}error(i,e,t,o={}){let l,s,n;if(e&&typeof e=="object"){let f=e,u=t;if(typeof e.offset=="number"){let a=this.fromOffset(f.offset);e=a.line,t=a.col}else e=f.line,t=f.column;if(typeof u.offset=="number"){let a=this.fromOffset(u.offset);s=a.line,n=a.col}else s=u.line,n=u.column}else if(!t){let f=this.fromOffset(e);e=f.line,t=f.col}let r=this.origin(e,t,s,n);return r?l=new w(i,r.endLine===void 0?r.line:{line:r.line,column:r.column},r.endLine===void 0?r.column:{line:r.endLine,column:r.endColumn},r.source,r.file,o.plugin):l=new w(i,s===void 0?e:{line:e,column:t},s===void 0?t:{line:s,column:n},this.css,this.file,o.plugin),l.input={line:e,column:t,endLine:s,endColumn:n,source:this.css},this.file&&(h&&(l.input.url=h(this.file).toString()),l.input.file=this.file),l}origin(i,e,t,o){if(!this.map)return!1;let l=this.map.consumer(),s=l.originalPositionFor({line:i,column:e});if(!s.source)return!1;let n;typeof t=="number"&&(n=l.originalPositionFor({line:t,column:o}));let r;v(s.source)?r=h(s.source):r=new URL(s.source,this.map.consumer().sourceRoot||h(this.map.mapFile));let f={url:r.toString(),line:s.line,column:s.column,endLine:n&&n.line,endColumn:n&&n.column};if(r.protocol==="file:")if(S)f.file=S(r);else throw new Error("file: protocol is not available in this PostCSS build");let u=l.sourceContentFor(s.source);return u&&(f.source=u),f}mapResolve(i){return/^\w+:\/\//.test(i)?i:g(this.map.consumer().sourceRoot||this.map.root||".",i)}get from(){return this.file||this.id}toJSON(){let i={};for(let e of["hasBOM","css","file","id"])this[e]!=null&&(i[e]=this[e]);return this.map&&(i.map={...this.map},i.map.consumerCache&&(i.map.consumerCache=void 0)),i}}var M=m;m.default=m;p&&p.registerInput&&p.registerInput(m);module.exports=M;
//# sourceMappingURL=input.js.map
