UAT/node_modules/@bramus/specificity/dist/index.js

9 lines
54 KiB
JavaScript

var Jn=Object.create;var te=Object.defineProperty;var Zn=Object.getOwnPropertyDescriptor;var ti=Object.getOwnPropertyNames;var ei=Object.getPrototypeOf,ri=Object.prototype.hasOwnProperty;var rt=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}},ee=(e,t)=>{for(var r in t)te(e,r,{get:t[r],enumerable:!0})},ni=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of ti(t))!ri.call(e,i)&&i!==r&&te(e,i,{get:()=>t[i],enumerable:!(n=Zn(t,i))||n.enumerable});return e};var ii=(e,t,r)=>(r=e!=null?Jn(ei(e)):{},ni(t||!e||!e.__esModule?te(r,"default",{value:e,enumerable:!0}):r,e));var Ge=rt(he=>{var Ve="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");he.encode=function(e){if(0<=e&&e<Ve.length)return Ve[e];throw new TypeError("Must be between 0 and 63: "+e)};he.decode=function(e){var t=65,r=90,n=97,i=122,o=48,c=57,l=43,u=47,s=26,a=52;return t<=e&&e<=r?e-t:n<=e&&e<=i?e-n+s:o<=e&&e<=c?e-o+a:e==l?62:e==u?63:-1}});var Ke=rt(pe=>{var He=Ge(),fe=5,je=1<<fe,Ye=je-1,qe=je;function fi(e){return e<0?(-e<<1)+1:(e<<1)+0}function pi(e){var t=(e&1)===1,r=e>>1;return t?-r:r}pe.encode=function(t){var r="",n,i=fi(t);do n=i&Ye,i>>>=fe,i>0&&(n|=qe),r+=He.encode(n);while(i>0);return r};pe.decode=function(t,r,n){var i=t.length,o=0,c=0,l,u;do{if(r>=i)throw new Error("Expected more digits in base 64 VLQ value.");if(u=He.decode(t.charCodeAt(r++)),u===-1)throw new Error("Invalid base64 digit: "+t.charAt(r-1));l=!!(u&qe),u&=Ye,o=o+(u<<c),c+=fe}while(l);n.value=pi(o),n.rest=r}});var Ht=rt(L=>{function mi(e,t,r){if(t in e)return e[t];if(arguments.length===3)return r;throw new Error('"'+t+'" is a required argument.')}L.getArg=mi;var ze=/^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.-]*)(?::(\d+))?(.*)$/,di=/^data:.+\,.+$/;function gt(e){var t=e.match(ze);return t?{scheme:t[1],auth:t[2],host:t[3],port:t[4],path:t[5]}:null}L.urlParse=gt;function ot(e){var t="";return e.scheme&&(t+=e.scheme+":"),t+="//",e.auth&&(t+=e.auth+"@"),e.host&&(t+=e.host),e.port&&(t+=":"+e.port),e.path&&(t+=e.path),t}L.urlGenerate=ot;var ki=32;function xi(e){var t=[];return function(r){for(var n=0;n<t.length;n++)if(t[n].input===r){var i=t[0];return t[0]=t[n],t[n]=i,t[0].result}var o=e(r);return t.unshift({input:r,result:o}),t.length>ki&&t.pop(),o}}var me=xi(function(t){var r=t,n=gt(t);if(n){if(!n.path)return t;r=n.path}for(var i=L.isAbsolute(r),o=[],c=0,l=0;;)if(c=l,l=r.indexOf("/",c),l===-1){o.push(r.slice(c));break}else for(o.push(r.slice(c,l));l<r.length&&r[l]==="/";)l++;for(var u,s=0,l=o.length-1;l>=0;l--)u=o[l],u==="."?o.splice(l,1):u===".."?s++:s>0&&(u===""?(o.splice(l+1,s),s=0):(o.splice(l,2),s--));return r=o.join("/"),r===""&&(r=i?"/":"."),n?(n.path=r,ot(n)):r});L.normalize=me;function Qe(e,t){e===""&&(e="."),t===""&&(t=".");var r=gt(t),n=gt(e);if(n&&(e=n.path||"/"),r&&!r.scheme)return n&&(r.scheme=n.scheme),ot(r);if(r||t.match(di))return t;if(n&&!n.host&&!n.path)return n.host=t,ot(n);var i=t.charAt(0)==="/"?t:me(e.replace(/\/+$/,"")+"/"+t);return n?(n.path=i,ot(n)):i}L.join=Qe;L.isAbsolute=function(e){return e.charAt(0)==="/"||ze.test(e)};function Si(e,t){e===""&&(e="."),e=e.replace(/\/$/,"");for(var r=0;t.indexOf(e+"/")!==0;){var n=e.lastIndexOf("/");if(n<0||(e=e.slice(0,n),e.match(/^([^\/]+:\/)?\/*$/)))return t;++r}return Array(r+1).join("../")+t.substr(e.length+1)}L.relative=Si;var $e=(function(){var e=Object.create(null);return!("__proto__"in e)})();function Xe(e){return e}function gi(e){return Je(e)?"$"+e:e}L.toSetString=$e?Xe:gi;function Ci(e){return Je(e)?e.slice(1):e}L.fromSetString=$e?Xe:Ci;function Je(e){if(!e)return!1;var t=e.length;if(t<9||e.charCodeAt(t-1)!==95||e.charCodeAt(t-2)!==95||e.charCodeAt(t-3)!==111||e.charCodeAt(t-4)!==116||e.charCodeAt(t-5)!==111||e.charCodeAt(t-6)!==114||e.charCodeAt(t-7)!==112||e.charCodeAt(t-8)!==95||e.charCodeAt(t-9)!==95)return!1;for(var r=t-10;r>=0;r--)if(e.charCodeAt(r)!==36)return!1;return!0}function yi(e,t,r){var n=G(e.source,t.source);return n!==0||(n=e.originalLine-t.originalLine,n!==0)||(n=e.originalColumn-t.originalColumn,n!==0||r)||(n=e.generatedColumn-t.generatedColumn,n!==0)||(n=e.generatedLine-t.generatedLine,n!==0)?n:G(e.name,t.name)}L.compareByOriginalPositions=yi;function bi(e,t,r){var n;return n=e.originalLine-t.originalLine,n!==0||(n=e.originalColumn-t.originalColumn,n!==0||r)||(n=e.generatedColumn-t.generatedColumn,n!==0)||(n=e.generatedLine-t.generatedLine,n!==0)?n:G(e.name,t.name)}L.compareByOriginalPositionsNoSource=bi;function Ti(e,t,r){var n=e.generatedLine-t.generatedLine;return n!==0||(n=e.generatedColumn-t.generatedColumn,n!==0||r)||(n=G(e.source,t.source),n!==0)||(n=e.originalLine-t.originalLine,n!==0)||(n=e.originalColumn-t.originalColumn,n!==0)?n:G(e.name,t.name)}L.compareByGeneratedPositionsDeflated=Ti;function Li(e,t,r){var n=e.generatedColumn-t.generatedColumn;return n!==0||r||(n=G(e.source,t.source),n!==0)||(n=e.originalLine-t.originalLine,n!==0)||(n=e.originalColumn-t.originalColumn,n!==0)?n:G(e.name,t.name)}L.compareByGeneratedPositionsDeflatedNoLine=Li;function G(e,t){return e===t?0:e===null?1:t===null?-1:e>t?1:-1}function Ei(e,t){var r=e.generatedLine-t.generatedLine;return r!==0||(r=e.generatedColumn-t.generatedColumn,r!==0)||(r=G(e.source,t.source),r!==0)||(r=e.originalLine-t.originalLine,r!==0)||(r=e.originalColumn-t.originalColumn,r!==0)?r:G(e.name,t.name)}L.compareByGeneratedPositionsInflated=Ei;function vi(e){return JSON.parse(e.replace(/^\)]}'[^\n]*\n/,""))}L.parseSourceMapInput=vi;function wi(e,t,r){if(t=t||"",e&&(e[e.length-1]!=="/"&&t[0]!=="/"&&(e+="/"),t=e+t),r){var n=gt(r);if(!n)throw new Error("sourceMapURL could not be parsed");if(n.path){var i=n.path.lastIndexOf("/");i>=0&&(n.path=n.path.substring(0,i+1))}t=Qe(ot(n),t)}return me(t)}L.computeSourceURL=wi});var tr=rt(Ze=>{var de=Ht(),ke=Object.prototype.hasOwnProperty,X=typeof Map<"u";function H(){this._array=[],this._set=X?new Map:Object.create(null)}H.fromArray=function(t,r){for(var n=new H,i=0,o=t.length;i<o;i++)n.add(t[i],r);return n};H.prototype.size=function(){return X?this._set.size:Object.getOwnPropertyNames(this._set).length};H.prototype.add=function(t,r){var n=X?t:de.toSetString(t),i=X?this.has(t):ke.call(this._set,n),o=this._array.length;(!i||r)&&this._array.push(t),i||(X?this._set.set(t,o):this._set[n]=o)};H.prototype.has=function(t){if(X)return this._set.has(t);var r=de.toSetString(t);return ke.call(this._set,r)};H.prototype.indexOf=function(t){if(X){var r=this._set.get(t);if(r>=0)return r}else{var n=de.toSetString(t);if(ke.call(this._set,n))return this._set[n]}throw new Error('"'+t+'" is not in the set.')};H.prototype.at=function(t){if(t>=0&&t<this._array.length)return this._array[t];throw new Error("No element indexed by "+t)};H.prototype.toArray=function(){return this._array.slice()};Ze.ArraySet=H});var nr=rt(rr=>{var er=Ht();function Ai(e,t){var r=e.generatedLine,n=t.generatedLine,i=e.generatedColumn,o=t.generatedColumn;return n>r||n==r&&o>=i||er.compareByGeneratedPositionsInflated(e,t)<=0}function jt(){this._array=[],this._sorted=!0,this._last={generatedLine:-1,generatedColumn:0}}jt.prototype.unsortedForEach=function(t,r){this._array.forEach(t,r)};jt.prototype.add=function(t){Ai(this._last,t)?(this._last=t,this._array.push(t)):(this._sorted=!1,this._array.push(t))};jt.prototype.toArray=function(){return this._sorted||(this._array.sort(er.compareByGeneratedPositionsInflated),this._sorted=!0),this._array};rr.MappingList=jt});var sr=rt(ir=>{var Ct=Ke(),y=Ht(),Yt=tr().ArraySet,Ii=nr().MappingList;function P(e){e||(e={}),this._file=y.getArg(e,"file",null),this._sourceRoot=y.getArg(e,"sourceRoot",null),this._skipValidation=y.getArg(e,"skipValidation",!1),this._ignoreInvalidMapping=y.getArg(e,"ignoreInvalidMapping",!1),this._sources=new Yt,this._names=new Yt,this._mappings=new Ii,this._sourcesContents=null}P.prototype._version=3;P.fromSourceMap=function(t,r){var n=t.sourceRoot,i=new P(Object.assign(r||{},{file:t.file,sourceRoot:n}));return t.eachMapping(function(o){var c={generated:{line:o.generatedLine,column:o.generatedColumn}};o.source!=null&&(c.source=o.source,n!=null&&(c.source=y.relative(n,c.source)),c.original={line:o.originalLine,column:o.originalColumn},o.name!=null&&(c.name=o.name)),i.addMapping(c)}),t.sources.forEach(function(o){var c=o;n!==null&&(c=y.relative(n,o)),i._sources.has(c)||i._sources.add(c);var l=t.sourceContentFor(o);l!=null&&i.setSourceContent(o,l)}),i};P.prototype.addMapping=function(t){var r=y.getArg(t,"generated"),n=y.getArg(t,"original",null),i=y.getArg(t,"source",null),o=y.getArg(t,"name",null);!this._skipValidation&&this._validateMapping(r,n,i,o)===!1||(i!=null&&(i=String(i),this._sources.has(i)||this._sources.add(i)),o!=null&&(o=String(o),this._names.has(o)||this._names.add(o)),this._mappings.add({generatedLine:r.line,generatedColumn:r.column,originalLine:n!=null&&n.line,originalColumn:n!=null&&n.column,source:i,name:o}))};P.prototype.setSourceContent=function(t,r){var n=t;this._sourceRoot!=null&&(n=y.relative(this._sourceRoot,n)),r!=null?(this._sourcesContents||(this._sourcesContents=Object.create(null)),this._sourcesContents[y.toSetString(n)]=r):this._sourcesContents&&(delete this._sourcesContents[y.toSetString(n)],Object.keys(this._sourcesContents).length===0&&(this._sourcesContents=null))};P.prototype.applySourceMap=function(t,r,n){var i=r;if(r==null){if(t.file==null)throw new Error(`SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, or the source map's "file" property. Both were omitted.`);i=t.file}var o=this._sourceRoot;o!=null&&(i=y.relative(o,i));var c=new Yt,l=new Yt;this._mappings.unsortedForEach(function(u){if(u.source===i&&u.originalLine!=null){var s=t.originalPositionFor({line:u.originalLine,column:u.originalColumn});s.source!=null&&(u.source=s.source,n!=null&&(u.source=y.join(n,u.source)),o!=null&&(u.source=y.relative(o,u.source)),u.originalLine=s.line,u.originalColumn=s.column,s.name!=null&&(u.name=s.name))}var a=u.source;a!=null&&!c.has(a)&&c.add(a);var h=u.name;h!=null&&!l.has(h)&&l.add(h)},this),this._sources=c,this._names=l,t.sources.forEach(function(u){var s=t.sourceContentFor(u);s!=null&&(n!=null&&(u=y.join(n,u)),o!=null&&(u=y.relative(o,u)),this.setSourceContent(u,s))},this)};P.prototype._validateMapping=function(t,r,n,i){if(r&&typeof r.line!="number"&&typeof r.column!="number"){var o="original.line and original.column are not numbers -- you probably meant to omit the original mapping entirely and only map the generated position. If so, pass null for the original mapping instead of an object with empty or null values.";if(this._ignoreInvalidMapping)return typeof console<"u"&&console.warn&&console.warn(o),!1;throw new Error(o)}if(!(t&&"line"in t&&"column"in t&&t.line>0&&t.column>=0&&!r&&!n&&!i)){if(t&&"line"in t&&"column"in t&&r&&"line"in r&&"column"in r&&t.line>0&&t.column>=0&&r.line>0&&r.column>=0&&n)return;var o="Invalid mapping: "+JSON.stringify({generated:t,source:n,original:r,name:i});if(this._ignoreInvalidMapping)return typeof console<"u"&&console.warn&&console.warn(o),!1;throw new Error(o)}};P.prototype._serializeMappings=function(){for(var t=0,r=1,n=0,i=0,o=0,c=0,l="",u,s,a,h,p=this._mappings.toArray(),m=0,k=p.length;m<k;m++){if(s=p[m],u="",s.generatedLine!==r){t=0;var w=s.generatedLine-r;u+=w===1?";":";".repeat(w),r=s.generatedLine}else if(m>0){if(!y.compareByGeneratedPositionsInflated(s,p[m-1]))continue;u+=","}u+=Ct.encode(s.generatedColumn-t),t=s.generatedColumn,s.source!=null&&(h=this._sources.indexOf(s.source),u+=Ct.encode(h-c),c=h,u+=Ct.encode(s.originalLine-1-i),i=s.originalLine-1,u+=Ct.encode(s.originalColumn-n),n=s.originalColumn,s.name!=null&&(a=this._names.indexOf(s.name),u+=Ct.encode(a-o),o=a)),l+=u}return l};P.prototype._generateSourcesContent=function(t,r){return t.map(function(n){if(!this._sourcesContents)return null;r!=null&&(n=y.relative(r,n));var i=y.toSetString(n);return Object.prototype.hasOwnProperty.call(this._sourcesContents,i)?this._sourcesContents[i]:null},this)};P.prototype.toJSON=function(){var t={version:this._version,sources:this._sources.toArray(),names:this._names.toArray(),mappings:this._serializeMappings()};return this._file!=null&&(t.file=this._file),this._sourceRoot!=null&&(t.sourceRoot=this._sourceRoot),this._sourcesContents&&(t.sourcesContent=this._generateSourcesContent(t.sources,t.sourceRoot)),t};P.prototype.toString=function(){return JSON.stringify(this.toJSON())};ir.SourceMapGenerator=P});function E(e){return e>=48&&e<=57}function j(e){return E(e)||e>=65&&e<=70||e>=97&&e<=102}function vt(e){return e>=65&&e<=90}function si(e){return e>=97&&e<=122}function oi(e){return vt(e)||si(e)}function ai(e){return e>=128}function Et(e){return oi(e)||ai(e)||e===95}function wt(e){return Et(e)||E(e)||e===45}function ci(e){return e>=0&&e<=8||e===11||e>=14&&e<=31||e===127}function ft(e){return e===10||e===13||e===12}function Y(e){return ft(e)||e===32||e===9}function A(e,t){return!(e!==92||ft(t)||t===0)}function At(e,t,r){return e===45?Et(t)||t===45||A(t,r):Et(e)?!0:e===92?A(e,t):!1}function It(e,t,r){return e===43||e===45?E(t)?2:t===46&&E(r)?3:0:e===46?E(t)?2:0:E(e)?1:0}function Nt(e){return e===65279||e===65534?1:0}var re=new Array(128),li=128,pt=130,ne=131,Dt=132,ie=133;for(let e=0;e<re.length;e++)re[e]=Y(e)&&pt||E(e)&&ne||Et(e)&&Dt||ci(e)&&ie||e||li;function Pt(e){return e<128?re[e]:Dt}function nt(e,t){return t<e.length?e.charCodeAt(t):0}function Ft(e,t,r){return r===13&&nt(e,t+1)===10?2:1}function oe(e,t,r){let n=e.charCodeAt(t);return vt(n)&&(n=n|32),n===r}function $(e,t,r,n){if(r-t!==n.length||t<0||r>e.length)return!1;for(let i=t;i<r;i++){let o=n.charCodeAt(i-t),c=e.charCodeAt(i);if(vt(c)&&(c=c|32),c!==o)return!1}return!0}function _e(e,t){for(;t>=0&&Y(e.charCodeAt(t));t--);return t+1}function mt(e,t){for(;t<e.length&&Y(e.charCodeAt(t));t++);return t}function se(e,t){for(;t<e.length&&E(e.charCodeAt(t));t++);return t}function q(e,t){if(t+=2,j(nt(e,t-1))){for(let n=Math.min(e.length,t+5);t<n&&j(nt(e,t));t++);let r=nt(e,t);Y(r)&&(t+=Ft(e,t,r))}return t}function dt(e,t){for(;t<e.length;t++){let r=e.charCodeAt(t);if(!wt(r)){if(A(r,nt(e,t+1))){t=q(e,t)-1;continue}break}}return t}function Ot(e,t){let r=e.charCodeAt(t);if((r===43||r===45)&&(r=e.charCodeAt(t+=1)),E(r)&&(t=se(e,t+1),r=e.charCodeAt(t)),r===46&&E(e.charCodeAt(t+1))&&(t+=2,t=se(e,t)),oe(e,t,101)){let n=0;r=e.charCodeAt(t+1),(r===45||r===43)&&(n=1,r=e.charCodeAt(t+2)),E(r)&&(t=se(e,t+1+n+1))}return t}function Rt(e,t){for(;t<e.length;t++){let r=e.charCodeAt(t);if(r===41){t++;break}A(r,nt(e,t+1))&&(t=q(e,t))}return t}function ae(e){if(e.length===1&&!j(e.charCodeAt(0)))return e[0];let t=parseInt(e,16);return(t===0||t>=55296&&t<=57343||t>1114111)&&(t=65533),String.fromCodePoint(t)}var it=["EOF-token","ident-token","function-token","at-keyword-token","hash-token","string-token","bad-string-token","url-token","bad-url-token","delim-token","number-token","percentage-token","dimension-token","whitespace-token","CDO-token","CDC-token","colon-token","semicolon-token","comma-token","[-token","]-token","(-token",")-token","{-token","}-token","comment-token"];function st(e=null,t){return e===null||e.length<t?new Uint32Array(Math.max(t+1024,16384)):e}var Be=10,ui=12,Me=13;function Ue(e){let t=e.source,r=t.length,n=t.length>0?Nt(t.charCodeAt(0)):0,i=st(e.lines,r),o=st(e.columns,r),c=e.startLine,l=e.startColumn;for(let u=n;u<r;u++){let s=t.charCodeAt(u);i[u]=c,o[u]=l++,(s===Be||s===Me||s===ui)&&(s===Me&&u+1<r&&t.charCodeAt(u+1)===Be&&(u++,i[u]=c,o[u]=l),c++,l=1)}i[r]=c,o[r]=l,e.lines=i,e.columns=o,e.computed=!0}var _t=class{constructor(t,r,n,i){this.setSource(t,r,n,i),this.lines=null,this.columns=null}setSource(t="",r=0,n=1,i=1){this.source=t,this.startOffset=r,this.startLine=n,this.startColumn=i,this.computed=!1}getLocation(t,r){return this.computed||Ue(this),{source:r,offset:this.startOffset+t,line:this.lines[t],column:this.columns[t]}}getLocationRange(t,r,n){return this.computed||Ue(this),{source:n,start:{offset:this.startOffset+t,line:this.lines[t],column:this.columns[t]},end:{offset:this.startOffset+r,line:this.lines[r],column:this.columns[r]}}}};var F=16777215,O=24,kt=1,Vt=2,K=new Uint8Array(32);K[2]=22;K[21]=22;K[19]=20;K[23]=24;var R=new Uint8Array(32);R[2]=kt;R[21]=kt;R[19]=kt;R[23]=kt;R[22]=Vt;R[20]=Vt;R[24]=Vt;function We(e,t,r){return e<t?t:e>r?r:e}var Mt=class{constructor(t,r){this.setSource(t,r)}reset(){this.eof=!1,this.tokenIndex=-1,this.tokenType=0,this.tokenStart=this.firstCharOffset,this.tokenEnd=this.firstCharOffset}setSource(t="",r=()=>{}){t=String(t||"");let n=t.length,i=st(this.offsetAndType,t.length+1),o=st(this.balance,t.length+1),c=0,l=-1,u=0,s=t.length;this.offsetAndType=null,this.balance=null,o.fill(0),r(t,(a,h,p)=>{let m=c++;if(i[m]=a<<O|p,l===-1&&(l=h),o[m]=s,a===u){let k=o[s];o[s]=m,s=k,u=K[i[k]>>O]}else this.isBlockOpenerTokenType(a)&&(s=m,u=K[a])}),i[c]=0<<O|n,o[c]=c;for(let a=0;a<c;a++){let h=o[a];if(h<=a){let p=o[h];p!==a&&(o[a]=p)}else h>c&&(o[a]=c)}this.source=t,this.firstCharOffset=l===-1?0:l,this.tokenCount=c,this.offsetAndType=i,this.balance=o,this.reset(),this.next()}lookupType(t){return t+=this.tokenIndex,t<this.tokenCount?this.offsetAndType[t]>>O:0}lookupTypeNonSC(t){for(let r=this.tokenIndex;r<this.tokenCount;r++){let n=this.offsetAndType[r]>>O;if(n!==13&&n!==25&&t--===0)return n}return 0}lookupOffset(t){return t+=this.tokenIndex,t<this.tokenCount?this.offsetAndType[t-1]&F:this.source.length}lookupOffsetNonSC(t){for(let r=this.tokenIndex;r<this.tokenCount;r++){let n=this.offsetAndType[r]>>O;if(n!==13&&n!==25&&t--===0)return r-this.tokenIndex}return 0}lookupValue(t,r){return t+=this.tokenIndex,t<this.tokenCount?$(this.source,this.offsetAndType[t-1]&F,this.offsetAndType[t]&F,r):!1}getTokenStart(t){return t===this.tokenIndex?this.tokenStart:t>0?t<this.tokenCount?this.offsetAndType[t-1]&F:this.offsetAndType[this.tokenCount]&F:this.firstCharOffset}getTokenEnd(t){return t===this.tokenIndex?this.tokenEnd:this.offsetAndType[We(t,0,this.tokenCount)]&F}getTokenType(t){return t===this.tokenIndex?this.tokenType:this.offsetAndType[We(t,0,this.tokenCount)]>>O}substrToCursor(t){return this.source.substring(t,this.tokenStart)}isBlockOpenerTokenType(t){return R[t]===kt}isBlockCloserTokenType(t){return R[t]===Vt}getBlockTokenPairIndex(t){let r=this.getTokenType(t);if(R[r]===1){let n=this.balance[t],i=this.getTokenType(n);return K[r]===i?n:-1}else if(R[r]===2){let n=this.balance[t],i=this.getTokenType(n);return K[i]===r?n:-1}return-1}isBalanceEdge(t){return this.balance[this.tokenIndex]<t}isDelim(t,r){return r?this.lookupType(r)===9&&this.source.charCodeAt(this.lookupOffset(r))===t:this.tokenType===9&&this.source.charCodeAt(this.tokenStart)===t}skip(t){let r=this.tokenIndex+t;r<this.tokenCount?(this.tokenIndex=r,this.tokenStart=this.offsetAndType[r-1]&F,r=this.offsetAndType[r],this.tokenType=r>>O,this.tokenEnd=r&F):(this.tokenIndex=this.tokenCount,this.next())}next(){let t=this.tokenIndex+1;t<this.tokenCount?(this.tokenIndex=t,this.tokenStart=this.tokenEnd,t=this.offsetAndType[t],this.tokenType=t>>O,this.tokenEnd=t&F):(this.eof=!0,this.tokenIndex=this.tokenCount,this.tokenType=0,this.tokenStart=this.tokenEnd=this.source.length)}skipSC(){for(;this.tokenType===13||this.tokenType===25;)this.next()}skipUntilBalanced(t,r){let n=t,i=0,o=0;t:for(;n<this.tokenCount;n++){if(i=this.balance[n],i<t)break t;switch(o=n>0?this.offsetAndType[n-1]&F:this.firstCharOffset,r(this.source.charCodeAt(o))){case 1:break t;case 2:n++;break t;default:this.isBlockOpenerTokenType(this.offsetAndType[n]>>O)&&(n=i)}}this.skip(n-this.tokenIndex)}forEachToken(t){for(let r=0,n=this.firstCharOffset;r<this.tokenCount;r++){let i=n,o=this.offsetAndType[r],c=o&F,l=o>>O;n=c,t(l,i,c,r)}}dump(){let t=new Array(this.tokenCount);return this.forEachToken((r,n,i,o)=>{t[o]={idx:o,type:it[r],chunk:this.source.substring(n,i),balance:this.balance[o]}}),t}};function Gt(e,t){function r(h){return h<l?e.charCodeAt(h):0}function n(){if(s=Ot(e,s),At(r(s),r(s+1),r(s+2))){a=12,s=dt(e,s);return}if(r(s)===37){a=11,s++;return}a=10}function i(){let h=s;if(s=dt(e,s),$(e,h,s,"url")&&r(s)===40){if(s=mt(e,s+1),r(s)===34||r(s)===39){a=2,s=h+4;return}c();return}if(r(s)===40){a=2,s++;return}a=1}function o(h){for(h||(h=r(s++)),a=5;s<e.length;s++){let p=e.charCodeAt(s);switch(Pt(p)){case h:s++;return;case pt:if(ft(p)){s+=Ft(e,s,p),a=6;return}break;case 92:if(s===e.length-1)break;let m=r(s+1);ft(m)?s+=Ft(e,s+1,m):A(p,m)&&(s=q(e,s)-1);break}}}function c(){for(a=7,s=mt(e,s);s<e.length;s++){let h=e.charCodeAt(s);switch(Pt(h)){case 41:s++;return;case pt:if(s=mt(e,s),r(s)===41||s>=e.length){s<e.length&&s++;return}s=Rt(e,s),a=8;return;case 34:case 39:case 40:case ie:s=Rt(e,s),a=8;return;case 92:if(A(h,r(s+1))){s=q(e,s)-1;break}s=Rt(e,s),a=8;return}}}e=String(e||"");let l=e.length,u=Nt(r(0)),s=u,a;for(;s<l;){let h=e.charCodeAt(s);switch(Pt(h)){case pt:a=13,s=mt(e,s+1);break;case 34:o();break;case 35:wt(r(s+1))||A(r(s+1),r(s+2))?(a=4,s=dt(e,s+1)):(a=9,s++);break;case 39:o();break;case 40:a=21,s++;break;case 41:a=22,s++;break;case 43:It(h,r(s+1),r(s+2))?n():(a=9,s++);break;case 44:a=18,s++;break;case 45:It(h,r(s+1),r(s+2))?n():r(s+1)===45&&r(s+2)===62?(a=15,s=s+3):At(h,r(s+1),r(s+2))?i():(a=9,s++);break;case 46:It(h,r(s+1),r(s+2))?n():(a=9,s++);break;case 47:r(s+1)===42?(a=25,s=e.indexOf("*/",s+2),s=s===-1?e.length:s+2):(a=9,s++);break;case 58:a=16,s++;break;case 59:a=17,s++;break;case 60:r(s+1)===33&&r(s+2)===45&&r(s+3)===45?(a=14,s=s+4):(a=9,s++);break;case 64:At(r(s+1),r(s+2),r(s+3))?(a=3,s=dt(e,s+1)):(a=9,s++);break;case 91:a=19,s++;break;case 92:A(h,r(s+1))?i():(a=9,s++);break;case 93:a=20,s++;break;case 123:a=23,s++;break;case 125:a=24,s++;break;case ne:n();break;case Dt:i();break;default:a=9,s++}t(a,u,u=s)}}var ar=ii(sr(),1),or=new Set(["Atrule","Selector","Declaration"]);function cr(e){let t=new ar.SourceMapGenerator,r={line:1,column:0},n={line:0,column:0},i={line:1,column:0},o={generated:i},c=1,l=0,u=!1,s=e.node;e.node=function(p){if(p.loc&&p.loc.start&&or.has(p.type)){let m=p.loc.start.line,k=p.loc.start.column-1;(n.line!==m||n.column!==k)&&(n.line=m,n.column=k,r.line=c,r.column=l,u&&(u=!1,(r.line!==i.line||r.column!==i.column)&&t.addMapping(o)),u=!0,t.addMapping({source:p.loc.source,original:n,generated:r}))}s.call(this,p),u&&or.has(p.type)&&(i.line=c,i.column=l)};let a=e.emit;e.emit=function(p,m,k){for(let w=0;w<p.length;w++)p.charCodeAt(w)===10?(c++,l=0):l++;a(p,m,k)};let h=e.result;return e.result=function(){return u&&t.addMapping(o),{css:h(),map:t}},e}var qt={};ee(qt,{safe:()=>Se,spec:()=>Fi});var Ni=43,Di=45,xe=(e,t)=>(e===9&&(e=t),typeof e=="string"&&(e=Math.min(e.charCodeAt(0),128)<<6),e<<1),lr=[[1,1],[1,2],[1,7],[1,8],[1,"-"],[1,10],[1,11],[1,12],[1,15],[1,21],[3,1],[3,2],[3,7],[3,8],[3,"-"],[3,10],[3,11],[3,12],[3,15],[4,1],[4,2],[4,7],[4,8],[4,"-"],[4,10],[4,11],[4,12],[4,15],[12,1],[12,2],[12,7],[12,8],[12,"-"],[12,10],[12,11],[12,12],[12,15],["#",1],["#",2],["#",7],["#",8],["#","-"],["#",10],["#",11],["#",12],["#",15],["-",1],["-",2],["-",7],["-",8],["-","-"],["-",10],["-",11],["-",12],["-",15],[10,1],[10,2],[10,7],[10,8],[10,10],[10,11],[10,12],[10,"%"],[10,15],["@",1],["@",2],["@",7],["@",8],["@","-"],["@",15],[".",10],[".",11],[".",12],["+",10],["+",11],["+",12],["/","*"]],Pi=lr.concat([[1,4],[12,4],[4,4],[3,21],[3,5],[3,16],[11,11],[11,12],[11,2],[11,"-"],[22,1],[22,2],[22,11],[22,12],[22,4],[22,"-"]]);function ur(e){let t=new Set(e.map(([r,n])=>xe(r)<<16|xe(n)));return function(r,n,i){let o=xe(n,i),c=i.charCodeAt(0),l=c===Di&&n!==1&&n!==2&&n!==15||c===Ni?t.has((r&65534)<<16|c<<7):t.has((r&65534)<<16|o);return o|l}}var Fi=ur(lr),Se=ur(Pi);var Oi=92;function Ri(e,t){if(typeof t=="function"){let r=null;e.children.forEach(n=>{r!==null&&t.call(this,r),this.node(n),r=n});return}e.children.forEach(this.node,this)}function hr(e){let t=new Map;for(let[r,n]of Object.entries(e.node))typeof(n.generate||n)=="function"&&t.set(r,n.generate||n);return function(r,n){let i="",o=0,c={node(u){if(t.has(u.type))t.get(u.type).call(l,u);else throw new Error("Unknown node type: "+u.type)},tokenBefore:Se,token(u,s,a){o=this.tokenBefore(o,u,s),!a&&o&1&&this.emit(" ",13,!0),this.emit(s,u,!1),u===9&&s.charCodeAt(0)===Oi&&this.emit(`
`,13,!0)},emit(u){i+=u},result(){return i}};n&&(typeof n.decorator=="function"&&(c=n.decorator(c)),n.sourceMap&&(c=cr(c)),n.mode in qt&&(c.tokenBefore=qt[n.mode]));let l={node:u=>c.node(u),children:Ri,token:(u,s)=>c.token(u,s),tokenize:u=>Gt(u,(s,a,h)=>{c.token(s,u.slice(a,h),a!==0)})};return c.node(r),c.result()}}var Te={};ee(Te,{AnPlusB:()=>pr,Atrule:()=>mr,AtrulePrelude:()=>dr,AttributeSelector:()=>Sr,Block:()=>gr,Brackets:()=>Cr,CDC:()=>yr,CDO:()=>br,ClassSelector:()=>Lr,Combinator:()=>wr,Comment:()=>Ar,Condition:()=>Ir,Declaration:()=>Nr,DeclarationList:()=>Dr,Dimension:()=>Pr,Feature:()=>Fr,FeatureFunction:()=>Or,FeatureRange:()=>Rr,Function:()=>_r,GeneralEnclosed:()=>Br,Hash:()=>Mr,IdSelector:()=>Gr,Identifier:()=>Wr,Layer:()=>Hr,LayerList:()=>jr,MediaQuery:()=>Yr,MediaQueryList:()=>qr,NestingSelector:()=>zr,Nth:()=>$r,Number:()=>Xr,Operator:()=>Zr,Parentheses:()=>tn,Percentage:()=>rn,PseudoClassSelector:()=>sn,PseudoElementSelector:()=>an,Ratio:()=>cn,Raw:()=>un,Rule:()=>hn,Scope:()=>fn,Selector:()=>mn,SelectorList:()=>kn,String:()=>bn,StyleSheet:()=>Tn,SupportsDeclaration:()=>Ln,TypeSelector:()=>wn,UnicodeRange:()=>An,Url:()=>Nn,Value:()=>Dn,WhiteSpace:()=>Pn});var V=43,N=45,Kt=110,J=!0,_i=!1;function zt(e,t){let r=this.tokenStart+e,n=this.charCodeAt(r);for((n===V||n===N)&&(t&&this.error("Number sign is not allowed"),r++);r<this.tokenEnd;r++)E(this.charCodeAt(r))||this.error("Integer is expected",r)}function at(e){return zt.call(this,0,e)}function z(e,t){if(!this.cmpChar(this.tokenStart+e,t)){let r="";switch(t){case Kt:r="N is expected";break;case N:r="HyphenMinus is expected";break}this.error(r,this.tokenStart+e)}}function ge(){let e=0,t=0,r=this.tokenType;for(;r===13||r===25;)r=this.lookupType(++e);if(r!==10)if(this.isDelim(V,e)||this.isDelim(N,e)){t=this.isDelim(V,e)?V:N;do r=this.lookupType(++e);while(r===13||r===25);r!==10&&(this.skip(e),at.call(this,J))}else return null;return e>0&&this.skip(e),t===0&&(r=this.charCodeAt(this.tokenStart),r!==V&&r!==N&&this.error("Number sign is expected")),at.call(this,t!==0),t===N?"-"+this.consume(10):this.consume(10)}function fr(){let e=this.tokenStart,t=null,r=null;if(this.tokenType===10)at.call(this,_i),r=this.consume(10);else if(this.tokenType===1&&this.cmpChar(this.tokenStart,N))switch(t="-1",z.call(this,1,Kt),this.tokenEnd-this.tokenStart){case 2:this.next(),r=ge.call(this);break;case 3:z.call(this,2,N),this.next(),this.skipSC(),at.call(this,J),r="-"+this.consume(10);break;default:z.call(this,2,N),zt.call(this,3,J),this.next(),r=this.substrToCursor(e+2)}else if(this.tokenType===1||this.isDelim(V)&&this.lookupType(1)===1){let n=0;switch(t="1",this.isDelim(V)&&(n=1,this.next()),z.call(this,0,Kt),this.tokenEnd-this.tokenStart){case 1:this.next(),r=ge.call(this);break;case 2:z.call(this,1,N),this.next(),this.skipSC(),at.call(this,J),r="-"+this.consume(10);break;default:z.call(this,1,N),zt.call(this,2,J),this.next(),r=this.substrToCursor(e+n+1)}}else if(this.tokenType===12){let n=this.charCodeAt(this.tokenStart),i=n===V||n===N,o=this.tokenStart+i;for(;o<this.tokenEnd&&E(this.charCodeAt(o));o++);o===this.tokenStart+i&&this.error("Integer is expected",this.tokenStart+i),z.call(this,o-this.tokenStart,Kt),t=this.substring(e,o),o+1===this.tokenEnd?(this.next(),r=ge.call(this)):(z.call(this,o-this.tokenStart+1,N),o+2===this.tokenEnd?(this.next(),this.skipSC(),at.call(this,J),r="-"+this.consume(10)):(zt.call(this,o-this.tokenStart+2,J),this.next(),r=this.substrToCursor(o+1)))}else this.error();return t!==null&&t.charCodeAt(0)===V&&(t=t.substr(1)),r!==null&&r.charCodeAt(0)===V&&(r=r.substr(1)),{type:"AnPlusB",loc:this.getLocation(e,this.tokenStart),a:t,b:r}}function pr(e){if(e.a){let t=e.a==="+1"&&"n"||e.a==="1"&&"n"||e.a==="-1"&&"-n"||e.a+"n";if(e.b){let r=e.b[0]==="-"||e.b[0]==="+"?e.b:"+"+e.b;this.tokenize(t+r)}else this.tokenize(t)}else this.tokenize(e.b)}function mr(e){this.token(3,"@"+e.name),e.prelude!==null&&this.node(e.prelude),e.block?this.node(e.block):this.token(17,";")}function dr(e){this.children(e)}var Bi=36,kr=42,Qt=61,Mi=94,Ce=124,Ui=126;function Wi(){this.eof&&this.error("Unexpected end of input");let e=this.tokenStart,t=!1;return this.isDelim(kr)?(t=!0,this.next()):this.isDelim(Ce)||this.eat(1),this.isDelim(Ce)?this.charCodeAt(this.tokenStart+1)!==Qt?(this.next(),this.eat(1)):t&&this.error("Identifier is expected",this.tokenEnd):t&&this.error("Vertical line is expected"),{type:"Identifier",loc:this.getLocation(e,this.tokenStart),name:this.substrToCursor(e)}}function Vi(){let e=this.tokenStart,t=this.charCodeAt(e);return t!==Qt&&t!==Ui&&t!==Mi&&t!==Bi&&t!==kr&&t!==Ce&&this.error("Attribute selector (=, ~=, ^=, $=, *=, |=) is expected"),this.next(),t!==Qt&&(this.isDelim(Qt)||this.error("Equal sign is expected"),this.next()),this.substrToCursor(e)}function xr(){let e=this.tokenStart,t,r=null,n=null,i=null;return this.eat(19),this.skipSC(),t=Wi.call(this),this.skipSC(),this.tokenType!==20&&(this.tokenType!==1&&(r=Vi.call(this),this.skipSC(),n=this.tokenType===5?this.String():this.Identifier(),this.skipSC()),this.tokenType===1&&(i=this.consume(1),this.skipSC())),this.eat(20),{type:"AttributeSelector",loc:this.getLocation(e,this.tokenStart),name:t,matcher:r,value:n,flags:i}}function Sr(e){this.token(9,"["),this.node(e.name),e.matcher!==null&&(this.tokenize(e.matcher),this.node(e.value)),e.flags!==null&&this.token(1,e.flags),this.token(9,"]")}function gr(e){this.token(23,"{"),this.children(e,t=>{t.type==="Declaration"&&this.token(17,";")}),this.token(24,"}")}function Cr(e){this.token(9,"["),this.children(e),this.token(9,"]")}function yr(){this.token(15,"-->")}function br(){this.token(14,"<!--")}var Gi=46;function Tr(){return this.eatDelim(Gi),{type:"ClassSelector",loc:this.getLocation(this.tokenStart-1,this.tokenEnd),name:this.consume(1)}}function Lr(e){this.token(9,"."),this.token(1,e.name)}var Hi=43,Er=47,ji=62,Yi=126;function vr(){let e=this.tokenStart,t;switch(this.tokenType){case 13:t=" ";break;case 9:switch(this.charCodeAt(this.tokenStart)){case ji:case Hi:case Yi:this.next();break;case Er:this.next(),this.eatIdent("deep"),this.eatDelim(Er);break;default:this.error("Combinator is expected")}t=this.substrToCursor(e);break}return{type:"Combinator",loc:this.getLocation(e,this.tokenStart),name:t}}function wr(e){this.tokenize(e.name)}function Ar(e){this.token(25,"/*"+e.value+"*/")}function Ir(e){e.children.forEach(t=>{t.type==="Condition"?(this.token(21,"("),this.node(t),this.token(22,")")):this.node(t)})}function Nr(e){this.token(1,e.property),this.token(16,":"),this.node(e.value),e.important&&(this.token(9,"!"),this.token(1,e.important===!0?"important":e.important))}function Dr(e){this.children(e,t=>{t.type==="Declaration"&&this.token(17,";")})}function Pr(e){this.token(12,e.value+e.unit)}function Fr(e){this.token(21,"("),this.token(1,e.name),e.value!==null&&(this.token(16,":"),this.node(e.value)),this.token(22,")")}function Or(e){this.token(2,e.feature+"("),this.node(e.value),this.token(22,")")}function Rr(e){this.token(21,"("),this.node(e.left),this.tokenize(e.leftComparison),this.node(e.middle),e.right&&(this.tokenize(e.rightComparison),this.node(e.right)),this.token(22,")")}function _r(e){this.token(2,e.name+"("),this.children(e),this.token(22,")")}function Br(e){e.function?this.token(2,e.function+"("):this.token(21,"("),this.children(e),this.token(22,")")}function Mr(e){this.token(4,"#"+e.value)}function Ur(){return{type:"Identifier",loc:this.getLocation(this.tokenStart,this.tokenEnd),name:this.consume(1)}}function Wr(e){this.token(1,e.name)}function Vr(){let e=this.tokenStart;return this.eat(4),{type:"IdSelector",loc:this.getLocation(e,this.tokenStart),name:this.substrToCursor(e+1)}}function Gr(e){this.token(9,"#"+e.name)}function Hr(e){this.tokenize(e.name)}function jr(e){this.children(e,()=>this.token(18,","))}function Yr(e){e.mediaType?(e.modifier&&this.token(1,e.modifier),this.token(1,e.mediaType),e.condition&&(this.token(1,"and"),this.node(e.condition))):e.condition&&this.node(e.condition)}function qr(e){this.children(e,()=>this.token(18,","))}var qi=38;function Kr(){let e=this.tokenStart;return this.eatDelim(qi),{type:"NestingSelector",loc:this.getLocation(e,this.tokenStart)}}function zr(){this.token(9,"&")}function Qr(){this.skipSC();let e=this.tokenStart,t=e,r=null,n;return this.lookupValue(0,"odd")||this.lookupValue(0,"even")?n=this.Identifier():n=this.AnPlusB(),t=this.tokenStart,this.skipSC(),this.lookupValue(0,"of")&&(this.next(),r=this.SelectorList(),t=this.tokenStart),{type:"Nth",loc:this.getLocation(e,t),nth:n,selector:r}}function $r(e){this.node(e.nth),e.selector!==null&&(this.token(1,"of"),this.node(e.selector))}function Xr(e){this.token(10,e.value)}function Jr(){let e=this.tokenStart;return this.next(),{type:"Operator",loc:this.getLocation(e,this.tokenStart),value:this.substrToCursor(e)}}function Zr(e){this.tokenize(e.value)}function tn(e){this.token(21,"("),this.children(e),this.token(22,")")}function en(){return{type:"Percentage",loc:this.getLocation(this.tokenStart,this.tokenEnd),value:this.consumeNumber(11)}}function rn(e){this.token(11,e.value+"%")}function nn(){let e=this.tokenStart,t=null,r,n;return this.eat(16),this.tokenType===2?(r=this.consumeFunctionName(),n=r.toLowerCase(),this.lookupNonWSType(0)==22?t=this.createList():hasOwnProperty.call(this.pseudo,n)?(this.skipSC(),t=this.pseudo[n].call(this),this.skipSC()):(t=this.createList(),t.push(this.Raw(null,!1))),this.eat(22)):r=this.consume(1),{type:"PseudoClassSelector",loc:this.getLocation(e,this.tokenStart),name:r,children:t}}function sn(e){this.token(16,":"),e.children===null?this.token(1,e.name):(this.token(2,e.name+"("),this.children(e),this.token(22,")"))}function on(){let e=this.tokenStart,t=null,r,n;return this.eat(16),this.eat(16),this.tokenType===2?(r=this.consumeFunctionName(),n=r.toLowerCase(),this.lookupNonWSType(0)==22?t=this.createList():hasOwnProperty.call(this.pseudo,n)?(this.skipSC(),t=this.pseudo[n].call(this),this.skipSC()):(t=this.createList(),t.push(this.Raw(null,!1))),this.eat(22)):r=this.consume(1),{type:"PseudoElementSelector",loc:this.getLocation(e,this.tokenStart),name:r,children:t}}function an(e){this.token(16,":"),this.token(16,":"),e.children===null?this.token(1,e.name):(this.token(2,e.name+"("),this.children(e),this.token(22,")"))}function cn(e){this.node(e.left),this.token(9,"/"),e.right?this.node(e.right):this.node(10,1)}function Ki(){return this.tokenIndex>0&&this.lookupType(-1)===13?this.tokenIndex>1?this.getTokenStart(this.tokenIndex-1):this.firstCharOffset:this.tokenStart}function ln(e,t){let r=this.getTokenStart(this.tokenIndex),n;return this.skipUntilBalanced(this.tokenIndex,e||this.consumeUntilBalanceEnd),t&&this.tokenStart>r?n=Ki.call(this):n=this.tokenStart,{type:"Raw",loc:this.getLocation(r,n),value:this.substring(r,n)}}function un(e){this.tokenize(e.value)}function hn(e){this.node(e.prelude),this.node(e.block)}function fn(e){e.root&&(this.token(21,"("),this.node(e.root),this.token(22,")")),e.limit&&(this.token(1,"to"),this.token(21,"("),this.node(e.limit),this.token(22,")"))}function pn(){let e=this.readSequence(this.scope.Selector);return this.getFirstListNode(e)===null&&this.error("Selector is expected"),{type:"Selector",loc:this.getLocationFromList(e),children:e}}function mn(e){this.children(e)}function dn(){let e=this.createList();for(;!this.eof;){if(e.push(this.Selector()),this.tokenType===18){this.next();continue}break}return{type:"SelectorList",loc:this.getLocationFromList(e),children:e}}function kn(e){this.children(e,()=>this.token(18,","))}var ye=92,xn=34,Sn=39;function gn(e){let t=e.length,r=e.charCodeAt(0),n=r===xn||r===Sn?1:0,i=n===1&&t>1&&e.charCodeAt(t-1)===r?t-2:t-1,o="";for(let c=n;c<=i;c++){let l=e.charCodeAt(c);if(l===ye){if(c===i){c!==t-1&&(o=e.substr(c+1));break}if(l=e.charCodeAt(++c),A(ye,l)){let u=c-1,s=q(e,u);c=s-1,o+=ae(e.substring(u+1,s))}else l===13&&e.charCodeAt(c+1)===10&&c++}else o+=e[c]}return o}function Cn(e,t){let r=t?"'":'"',n=t?Sn:xn,i="",o=!1;for(let c=0;c<e.length;c++){let l=e.charCodeAt(c);if(l===0){i+="\uFFFD";continue}if(l<=31||l===127){i+="\\"+l.toString(16),o=!0;continue}l===n||l===ye?(i+="\\"+e.charAt(c),o=!1):(o&&(j(l)||Y(l))&&(i+=" "),i+=e.charAt(c),o=!1)}return r+i+r}function yn(){return{type:"String",loc:this.getLocation(this.tokenStart,this.tokenEnd),value:gn(this.consume(5))}}function bn(e){this.token(5,Cn(e.value))}function Tn(e){this.children(e)}function Ln(e){this.token(21,"("),this.node(e.declaration),this.token(22,")")}var zi=42,En=124;function be(){this.tokenType!==1&&this.isDelim(zi)===!1&&this.error("Identifier or asterisk is expected"),this.next()}function vn(){let e=this.tokenStart;return this.isDelim(En)?(this.next(),be.call(this)):(be.call(this),this.isDelim(En)&&(this.next(),be.call(this))),{type:"TypeSelector",loc:this.getLocation(e,this.tokenStart),name:this.substrToCursor(e)}}function wn(e){this.tokenize(e.name)}function An(e){this.tokenize(e.value)}var Qi=32,$i=92,Xi=34,Ji=39,Zi=40,ts=41;function In(e){let t="",r=!1;for(let n=0;n<e.length;n++){let i=e.charCodeAt(n);if(i===0){t+="\uFFFD";continue}if(i<=31||i===127){t+="\\"+i.toString(16),r=!0;continue}i===Qi||i===$i||i===Xi||i===Ji||i===Zi||i===ts?(t+="\\"+e.charAt(n),r=!1):(r&&j(i)&&(t+=" "),t+=e.charAt(n),r=!1)}return"url("+t+")"}function Nn(e){this.token(7,In(e.value))}function Dn(e){this.children(e)}var ra=Object.freeze({type:"WhiteSpace",loc:null,value:" "});function Pn(e){this.token(13,e.value)}var Fn={node:Te};var On=hr(Fn);var ct=null,yt=class e{static createItem(t){return{prev:null,next:null,data:t}}constructor(){this.head=null,this.tail=null,this.cursor=null}createItem(t){return e.createItem(t)}allocateCursor(t,r){let n;return ct!==null?(n=ct,ct=ct.cursor,n.prev=t,n.next=r,n.cursor=this.cursor):n={prev:t,next:r,cursor:this.cursor},this.cursor=n,n}releaseCursor(){let{cursor:t}=this;this.cursor=t.cursor,t.prev=null,t.next=null,t.cursor=ct,ct=t}updateCursors(t,r,n,i){let{cursor:o}=this;for(;o!==null;)o.prev===t&&(o.prev=r),o.next===n&&(o.next=i),o=o.cursor}*[Symbol.iterator](){for(let t=this.head;t!==null;t=t.next)yield t.data}get size(){let t=0;for(let r=this.head;r!==null;r=r.next)t++;return t}get isEmpty(){return this.head===null}get first(){return this.head&&this.head.data}get last(){return this.tail&&this.tail.data}fromArray(t){let r=null;this.head=null;for(let n of t){let i=e.createItem(n);r!==null?r.next=i:this.head=i,i.prev=r,r=i}return this.tail=r,this}toArray(){return[...this]}toJSON(){return[...this]}forEach(t,r=this){let n=this.allocateCursor(null,this.head);for(;n.next!==null;){let i=n.next;n.next=i.next,t.call(r,i.data,i,this)}this.releaseCursor()}forEachRight(t,r=this){let n=this.allocateCursor(this.tail,null);for(;n.prev!==null;){let i=n.prev;n.prev=i.prev,t.call(r,i.data,i,this)}this.releaseCursor()}reduce(t,r,n=this){let i=this.allocateCursor(null,this.head),o=r,c;for(;i.next!==null;)c=i.next,i.next=c.next,o=t.call(n,o,c.data,c,this);return this.releaseCursor(),o}reduceRight(t,r,n=this){let i=this.allocateCursor(this.tail,null),o=r,c;for(;i.prev!==null;)c=i.prev,i.prev=c.prev,o=t.call(n,o,c.data,c,this);return this.releaseCursor(),o}some(t,r=this){for(let n=this.head;n!==null;n=n.next)if(t.call(r,n.data,n,this))return!0;return!1}map(t,r=this){let n=new e;for(let i=this.head;i!==null;i=i.next)n.appendData(t.call(r,i.data,i,this));return n}filter(t,r=this){let n=new e;for(let i=this.head;i!==null;i=i.next)t.call(r,i.data,i,this)&&n.appendData(i.data);return n}nextUntil(t,r,n=this){if(t===null)return;let i=this.allocateCursor(null,t);for(;i.next!==null;){let o=i.next;if(i.next=o.next,r.call(n,o.data,o,this))break}this.releaseCursor()}prevUntil(t,r,n=this){if(t===null)return;let i=this.allocateCursor(t,null);for(;i.prev!==null;){let o=i.prev;if(i.prev=o.prev,r.call(n,o.data,o,this))break}this.releaseCursor()}clear(){this.head=null,this.tail=null}copy(){let t=new e;for(let r of this)t.appendData(r);return t}prepend(t){return this.updateCursors(null,t,this.head,t),this.head!==null?(this.head.prev=t,t.next=this.head):this.tail=t,this.head=t,this}prependData(t){return this.prepend(e.createItem(t))}append(t){return this.insert(t)}appendData(t){return this.insert(e.createItem(t))}insert(t,r=null){if(r!==null)if(this.updateCursors(r.prev,t,r,t),r.prev===null){if(this.head!==r)throw new Error("before doesn't belong to list");this.head=t,r.prev=t,t.next=r,this.updateCursors(null,t)}else r.prev.next=t,t.prev=r.prev,r.prev=t,t.next=r;else this.updateCursors(this.tail,t,null,t),this.tail!==null?(this.tail.next=t,t.prev=this.tail):this.head=t,this.tail=t;return this}insertData(t,r){return this.insert(e.createItem(t),r)}remove(t){if(this.updateCursors(t,t.prev,t,t.next),t.prev!==null)t.prev.next=t.next;else{if(this.head!==t)throw new Error("item doesn't belong to list");this.head=t.next}if(t.next!==null)t.next.prev=t.prev;else{if(this.tail!==t)throw new Error("item doesn't belong to list");this.tail=t.prev}return t.prev=null,t.next=null,t}push(t){this.insert(e.createItem(t))}pop(){return this.tail!==null?this.remove(this.tail):null}unshift(t){this.prepend(e.createItem(t))}shift(){return this.head!==null?this.remove(this.head):null}prependList(t){return this.insertList(t,this.head)}appendList(t){return this.insertList(t)}insertList(t,r){return t.head===null?this:(r!=null?(this.updateCursors(r.prev,t.tail,r,t.head),r.prev!==null?(r.prev.next=t.head,t.head.prev=r.prev):this.head=t.head,r.prev=t.tail,t.tail.next=r):(this.updateCursors(this.tail,t.tail,null,t.head),this.tail!==null?(this.tail.next=t.head,t.head.prev=this.tail):this.head=t.head,this.tail=t.tail),t.head=null,t.tail=null,this)}replace(t,r){"head"in r?this.insertList(r,t):this.insert(r,t),this.remove(t)}};function Rn(e,t){let r=Object.create(SyntaxError.prototype),n=new Error;return Object.assign(r,{name:e,message:t,get stack(){return(n.stack||"").replace(/^(.+\n){1,3}/,`${e}: ${t}
`)}})}var Le=100,_n=60,Bn=" ";function Mn({source:e,line:t,column:r,baseLine:n,baseColumn:i},o){function c(k,w){return s.slice(k,w).map((Zt,ut)=>String(k+ut+1).padStart(p)+" |"+Zt).join(`
`)}let l=`
`.repeat(Math.max(n-1,0)),u=" ".repeat(Math.max(i-1,0)),s=(l+u+e).split(/\r\n?|\n|\f/),a=Math.max(1,t-o)-1,h=Math.min(t+o,s.length+1),p=Math.max(4,String(h).length)+1,m=0;r+=(Bn.length-1)*(s[t-1].substr(0,r-1).match(/\t/g)||[]).length,r>Le&&(m=r-_n+3,r=_n-2);for(let k=a;k<=h;k++)k>=0&&k<s.length&&(s[k]=s[k].replace(/\t/g,Bn),s[k]=(m>0&&s[k].length>m?"\u2026":"")+s[k].substr(m,Le-2)+(s[k].length>m+Le-1?"\u2026":""));return[c(a,t),new Array(r+p+2).join("-")+"^",c(t,h)].filter(Boolean).join(`
`).replace(/^(\s+\d+\s+\|\n)+/,"").replace(/\n(\s+\d+\s+\|)+$/,"")}function Ee(e,t,r,n,i,o=1,c=1){return Object.assign(Rn("SyntaxError",e),{source:t,offset:r,line:n,column:i,sourceFragment(u){return Mn({source:t,line:n,column:i,baseLine:o,baseColumn:c},isNaN(u)?0:u)},get formattedMessage(){return`Parse error: ${e}
`+Mn({source:t,line:n,column:i,baseLine:o,baseColumn:c},2)}})}function Un(e){let t=this.createList(),r=!1,n={recognizer:e};for(;!this.eof;){switch(this.tokenType){case 25:this.next();continue;case 13:r=!0,this.next();continue}let i=e.getNode.call(this,n);if(i===void 0)break;r&&(e.onWhiteSpace&&e.onWhiteSpace.call(this,i,t,n),r=!1),t.push(i)}return r&&e.onWhiteSpace&&e.onWhiteSpace.call(this,null,t,n),t}var lt=()=>{},rs=33,ns=35,ve=59,Wn=123,Vn=0,is={createList(){return[]},createSingleNodeList(e){return[e]},getFirstListNode(e){return e&&e[0]||null},getLastListNode(e){return e&&e.length>0?e[e.length-1]:null}},ss={createList(){return new yt},createSingleNodeList(e){return new yt().appendData(e)},getFirstListNode(e){return e&&e.first},getLastListNode(e){return e&&e.last}};function os(e){return function(){return this[e]()}}function we(e){let t=Object.create(null);for(let r of Object.keys(e)){let n=e[r],i=n.parse||n;i&&(t[r]=i)}return t}function as(e){let t={context:Object.create(null),features:Object.assign(Object.create(null),e.features),scope:Object.assign(Object.create(null),e.scope),atrule:we(e.atrule),pseudo:we(e.pseudo),node:we(e.node)};for(let[r,n]of Object.entries(e.parseContext))switch(typeof n){case"function":t.context[r]=n;break;case"string":t.context[r]=os(n);break}return{config:t,...t,...t.node}}function Gn(e){let t="",r="<unknown>",n=!1,i=lt,o=!1,c=new _t,l=Object.assign(new Mt,as(e||{}),{parseAtrulePrelude:!0,parseRulePrelude:!0,parseValue:!0,parseCustomProperty:!1,readSequence:Un,consumeUntilBalanceEnd:()=>0,consumeUntilLeftCurlyBracket(a){return a===Wn?1:0},consumeUntilLeftCurlyBracketOrSemicolon(a){return a===Wn||a===ve?1:0},consumeUntilExclamationMarkOrSemicolon(a){return a===rs||a===ve?1:0},consumeUntilSemicolonIncluded(a){return a===ve?2:0},createList:lt,createSingleNodeList:lt,getFirstListNode:lt,getLastListNode:lt,parseWithFallback(a,h){let p=this.tokenIndex;try{return a.call(this)}catch(m){if(o)throw m;this.skip(p-this.tokenIndex);let k=h.call(this);return o=!0,i(m,k),o=!1,k}},lookupNonWSType(a){let h;do if(h=this.lookupType(a++),h!==13&&h!==25)return h;while(h!==Vn);return Vn},charCodeAt(a){return a>=0&&a<t.length?t.charCodeAt(a):0},substring(a,h){return t.substring(a,h)},substrToCursor(a){return this.source.substring(a,this.tokenStart)},cmpChar(a,h){return oe(t,a,h)},cmpStr(a,h,p){return $(t,a,h,p)},consume(a){let h=this.tokenStart;return this.eat(a),this.substrToCursor(h)},consumeFunctionName(){let a=t.substring(this.tokenStart,this.tokenEnd-1);return this.eat(2),a},consumeNumber(a){let h=t.substring(this.tokenStart,Ot(t,this.tokenStart));return this.eat(a),h},eat(a){if(this.tokenType!==a){let h=it[a].slice(0,-6).replace(/-/g," ").replace(/^./,k=>k.toUpperCase()),p=`${/[[\](){}]/.test(h)?`"${h}"`:h} is expected`,m=this.tokenStart;switch(a){case 1:this.tokenType===2||this.tokenType===7?(m=this.tokenEnd-1,p="Identifier is expected but function found"):p="Identifier is expected";break;case 4:this.isDelim(ns)&&(this.next(),m++,p="Name is expected");break;case 11:this.tokenType===10&&(m=this.tokenEnd,p="Percent sign is expected");break}this.error(p,m)}this.next()},eatIdent(a){(this.tokenType!==1||this.lookupValue(0,a)===!1)&&this.error(`Identifier "${a}" is expected`),this.next()},eatDelim(a){this.isDelim(a)||this.error(`Delim "${String.fromCharCode(a)}" is expected`),this.next()},getLocation(a,h){return n?c.getLocationRange(a,h,r):null},getLocationFromList(a){if(n){let h=this.getFirstListNode(a),p=this.getLastListNode(a);return c.getLocationRange(h!==null?h.loc.start.offset-c.startOffset:this.tokenStart,p!==null?p.loc.end.offset-c.startOffset:this.tokenStart,r)}return null},error(a,h){let p=typeof h<"u"&&h<t.length?c.getLocation(h):this.eof?c.getLocation(_e(t,t.length-1)):c.getLocation(this.tokenStart);throw new Ee(a||"Unexpected input",t,p.offset,p.line,p.column,c.startLine,c.startColumn)}}),u=()=>({filename:r,source:t,tokenCount:l.tokenCount,getTokenType:a=>l.getTokenType(a),getTokenTypeName:a=>it[l.getTokenType(a)],getTokenStart:a=>l.getTokenStart(a),getTokenEnd:a=>l.getTokenEnd(a),getTokenValue:a=>l.source.substring(l.getTokenStart(a),l.getTokenEnd(a)),substring:(a,h)=>l.source.substring(a,h),balance:l.balance.subarray(0,l.tokenCount+1),isBlockOpenerTokenType:l.isBlockOpenerTokenType,isBlockCloserTokenType:l.isBlockCloserTokenType,getBlockTokenPairIndex:a=>l.getBlockTokenPairIndex(a),getLocation:a=>c.getLocation(a,r),getRangeLocation:(a,h)=>c.getLocationRange(a,h,r)});return Object.assign(function(a,h){t=a,h=h||{},l.setSource(t,Gt),c.setSource(t,h.offset,h.line,h.column),r=h.filename||"<unknown>",n=!!h.positions,i=typeof h.onParseError=="function"?h.onParseError:lt,o=!1,l.parseAtrulePrelude="parseAtrulePrelude"in h?!!h.parseAtrulePrelude:!0,l.parseRulePrelude="parseRulePrelude"in h?!!h.parseRulePrelude:!0,l.parseValue="parseValue"in h?!!h.parseValue:!0,l.parseCustomProperty="parseCustomProperty"in h?!!h.parseCustomProperty:!1;let{context:p="default",list:m=!0,onComment:k,onToken:w}=h;if(!(p in l.context))throw new Error("Unknown context `"+p+"`");Object.assign(l,m?ss:is),Array.isArray(w)?l.forEachToken((ut,ht,Q)=>{w.push({type:ut,start:ht,end:Q})}):typeof w=="function"&&l.forEachToken(w.bind(u())),typeof k=="function"&&l.forEachToken((ut,ht,Q)=>{if(ut===25){let $n=l.getLocation(ht,Q),Xn=$(t,Q-2,Q,"*/")?t.slice(ht+2,Q-2):t.slice(ht+2,Q);k(Xn,$n)}});let Zt=l.context[p].call(l,h);return l.eof||l.error(),Zt},{SyntaxError:Ee,config:l.config})}var cs=35,ls=38,us=42,hs=43,fs=47,Hn=46,ps=62,ms=124,ds=126;function ks(e,t){t.last!==null&&t.last.type!=="Combinator"&&e!==null&&e.type!=="Combinator"&&t.push({type:"Combinator",loc:null,name:" "})}function xs(){switch(this.tokenType){case 19:return this.AttributeSelector();case 4:return this.IdSelector();case 16:return this.lookupType(1)===16?this.PseudoElementSelector():this.PseudoClassSelector();case 1:return this.TypeSelector();case 10:case 11:return this.Percentage();case 12:this.charCodeAt(this.tokenStart)===Hn&&this.error("Identifier is expected",this.tokenStart+1);break;case 9:{switch(this.charCodeAt(this.tokenStart)){case hs:case ps:case ds:case fs:return this.Combinator();case Hn:return this.ClassSelector();case us:case ms:return this.TypeSelector();case cs:return this.IdSelector();case ls:return this.NestingSelector()}break}}}var Ae={onWhiteSpace:ks,getNode:xs};function jn(){let e=this.createList();this.skipSC();t:for(;!this.eof;){switch(this.tokenType){case 1:e.push(this.Identifier());break;case 5:e.push(this.String());break;case 18:e.push(this.Operator());break;case 22:break t;default:this.error("Identifier, string or comma is expected")}this.skipSC()}return e}var Z={parse(){return this.createSingleNodeList(this.SelectorList())}},Ie={parse(){return this.createSingleNodeList(this.Selector())}},Ss={parse(){return this.createSingleNodeList(this.Identifier())}},gs={parse:jn},$t={parse(){return this.createSingleNodeList(this.Nth())}},Yn={dir:Ss,has:Z,lang:gs,matches:Z,is:Z,"-moz-any":Z,"-webkit-any":Z,where:Z,not:Z,"nth-child":$t,"nth-last-child":$t,"nth-last-of-type":$t,"nth-of-type":$t,slotted:Ie,host:Ie,"host-context":Ie};var Ne={};ee(Ne,{AnPlusB:()=>fr,AttributeSelector:()=>xr,ClassSelector:()=>Tr,Combinator:()=>vr,IdSelector:()=>Vr,Identifier:()=>Ur,NestingSelector:()=>Kr,Nth:()=>Qr,Operator:()=>Jr,Percentage:()=>en,PseudoClassSelector:()=>nn,PseudoElementSelector:()=>on,Raw:()=>ln,Selector:()=>pn,SelectorList:()=>dn,String:()=>yn,TypeSelector:()=>vn});var qn={parseContext:{default:"SelectorList",selectorList:"SelectorList",selector:"Selector"},scope:{Selector:Ae},atrule:{},pseudo:Yn,node:Ne};var De=Gn(qn);var tt=(e,t)=>e.a===t.a?e.b===t.b?e.c-t.c:e.b-t.b:e.a-t.a,Pe=(e,t)=>tt(e,t)===0,Fe=(e,t)=>tt(e,t)>0,Oe=(e,t)=>tt(e,t)<0;var Kn=(e,t="ASC")=>{let r=e.sort(tt);return t==="DESC"?r.reverse():r},Xt=(...e)=>Kn(e,"ASC"),Jt=(...e)=>Kn(e,"DESC");var bt=(...e)=>Jt(...e)[0],zn=(...e)=>Xt(...e)[0];var Tt=e=>{if(!e||e.type!=="Selector")throw new TypeError("Passed in source is not a Selector AST");let t=0,r=0,n=0;return e.children.forEach(i=>{switch(i.type){case"IdSelector":t+=1;break;case"AttributeSelector":case"ClassSelector":r+=1;break;case"PseudoClassSelector":switch(i.name.toLowerCase()){case"where":break;case"-webkit-any":case"any":i.children?.first&&(r+=1);break;case"-moz-any":case"is":case"matches":case"not":case"has":if(i.children?.first){let c=bt(...et(i.children.first));t+=c.a,r+=c.b,n+=c.c}break;case"nth-child":case"nth-last-child":if(r+=1,i.children?.first?.selector){let c=bt(...et(i.children.first.selector));t+=c.a,r+=c.b,n+=c.c}break;case"host-context":case"host":if(r+=1,i.children?.first?.children){let c={type:"Selector",children:[]},l=!1;i.children.first.children.forEach(s=>{if(l)return!1;if(s.type==="Combinator")return l=!0,!1;c.children.push(s)});let u=et(c)[0];t+=u.a,r+=u.b,n+=u.c}break;case"after":case"before":case"first-letter":case"first-line":n+=1;break;default:r+=1;break}break;case"PseudoElementSelector":switch(i.name){case"slotted":if(n+=1,i.children?.first?.children){let c={type:"Selector",children:[]},l=!1;i.children.first.children.forEach(s=>{if(l)return!1;if(s.type==="Combinator")return l=!0,!1;c.children.push(s)});let u=et(c)[0];t+=u.a,r+=u.b,n+=u.c}break;case"view-transition-group":case"view-transition-image-pair":case"view-transition-old":case"view-transition-new":if(i.children?.first?.value==="*")break;n+=1;break;case"highlight":if(i.children?.size>0){if(i.children.first?.value==="*")break;n+=1}break;default:n+=1;break}break;case"TypeSelector":let o=i.name;o.includes("|")&&(o=o.split("|")[1]),o!=="*"&&(n+=1);break;default:break}}),new Qn({a:t,b:r,c:n},e)},Cs=e=>{if(typeof e=="string"||e instanceof String)try{return De(e,{context:"selectorList"})}catch(t){throw new TypeError(`Could not convert passed in source '${e}' to SelectorList: ${t.message}`)}if(e instanceof Object){if(e.type&&["Selector","SelectorList"].includes(e.type))return e;if(e.type&&e.type==="Raw")try{return De(e.value,{context:"selectorList"})}catch(t){throw new TypeError(`Could not convert passed in source to SelectorList: ${t.message}`)}throw new TypeError("Passed in source is an Object but no AST / AST of the type Selector or SelectorList")}throw new TypeError("Passed in source is not a String nor an Object. I don't know what to do with it.")},et=e=>{if(!e)return[];let t=Cs(e);if(t.type==="Selector")return[Tt(e)];if(t.type==="SelectorList"){let r=[];return t.children.forEach(n=>{let i=Tt(n);r.push(i)}),r}};var Lt=class extends Error{constructor(){super("Manipulating a Specificity instance is not allowed. Instead, create a new Specificity()")}},Re=class{constructor(t,r=null){this.value=t,this.selector=r}get a(){return this.value.a}set a(t){throw new Lt}get b(){return this.value.b}set b(t){throw new Lt}get c(){return this.value.c}set c(t){throw new Lt}selectorString(){return typeof this.selector=="string"||this.selector instanceof String?this.selector:this.selector instanceof Object&&this.selector.type==="Selector"?On(this.selector):""}toObject(){return this.value}toArray(){return[this.value.a,this.value.b,this.value.c]}toString(){return`(${this.value.a},${this.value.b},${this.value.c})`}toJSON(){return{selector:this.selectorString(),asObject:this.toObject(),asArray:this.toArray(),asString:this.toString()}}isEqualTo(t){return Pe(this,t)}isGreaterThan(t){return Fe(this,t)}isLessThan(t){return Oe(this,t)}static calculate(t){return et(t)}static calculateForAST(t){return Tt(t)}static compare(t,r){return tt(t,r)}static equals(t,r){return Pe(t,r)}static lessThan(t,r){return Oe(t,r)}static greaterThan(t,r){return Fe(t,r)}static min(...t){return zn(...t)}static max(...t){return bt(...t)}static sortAsc(...t){return Xt(...t)}static sortDesc(...t){return Jt(...t)}},Qn=Re;export{Qn as default};
//# sourceMappingURL=index.js.map