From 2e6d67c6d7975431d89f7f02bb0ecfd6add36537 Mon Sep 17 00:00:00 2001 From: Sonny Piers Date: Thu, 3 Feb 2022 01:07:43 +0100 Subject: [PATCH 1/2] Use csstree to scope CSS --- src/csstree.js | 11 +++++++++++ src/window.js | 39 +++++++++++++++++++++++++++++++++++++-- src/window.ui | 7 ++++++- 3 files changed, 54 insertions(+), 3 deletions(-) create mode 100644 src/csstree.js diff --git a/src/csstree.js b/src/csstree.js new file mode 100644 index 000000000..57cf6a5e6 --- /dev/null +++ b/src/csstree.js @@ -0,0 +1,11 @@ +var da=Object.create;var gt=Object.defineProperty;var ga=Object.getOwnPropertyDescriptor;var ba=Object.getOwnPropertyNames;var xa=Object.getPrototypeOf,ya=Object.prototype.hasOwnProperty;var Qn=e=>gt(e,"__esModule",{value:!0});var Ie=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),b=(e,t)=>{Qn(e);for(var r in t)gt(e,r,{get:t[r],enumerable:!0})},ka=(e,t,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of ba(t))!ya.call(e,n)&&n!=="default"&>(e,n,{get:()=>t[n],enumerable:!(r=ga(t,n))||r.enumerable});return e},wa=e=>ka(Qn(gt(e!=null?da(xa(e)):{},"default",e&&e.__esModule&&"default"in e?{get:()=>e.default,enumerable:!0}:{value:e,enumerable:!0})),e);var ci=Ie(cr=>{var li="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");cr.encode=function(e){if(0<=e&&e{var ui=ci(),ur=5,hi=1<>1;return t?-r:r}hr.encode=function(t){var r="",n,i=Na(t);do n=i&pi,i>>>=ur,i>0&&(n|=mi),r+=ui.encode(n);while(i>0);return r};hr.decode=function(t,r,n){var i=t.length,o=0,s=0,u,c;do{if(r>=i)throw new Error("Expected more digits in base 64 VLQ value.");if(c=ui.decode(t.charCodeAt(r++)),c===-1)throw new Error("Invalid base64 digit: "+t.charAt(r-1));u=!!(c&mi),c&=pi,o=o+(c<{function Ra(e,t,r){if(t in e)return e[t];if(arguments.length===3)return r;throw new Error('"'+t+'" is a required argument.')}K.getArg=Ra;var di=/^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.-]*)(?::(\d+))?(.*)$/,Fa=/^data:.+\,.+$/;function Je(e){var t=e.match(di);return t?{scheme:t[1],auth:t[2],host:t[3],port:t[4],path:t[5]}:null}K.urlParse=Je;function _e(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}K.urlGenerate=_e;var Ba=32;function _a(e){var t=[];return function(r){for(var n=0;nBa&&t.pop(),o}}var pr=_a(function(t){var r=t,n=Je(t);if(n){if(!n.path)return t;r=n.path}for(var i=K.isAbsolute(r),o=[],s=0,u=0;;)if(s=u,u=r.indexOf("/",s),u===-1){o.push(r.slice(s));break}else for(o.push(r.slice(s,u));u=0;u--)c=o[u],c==="."?o.splice(u,1):c===".."?a++:a>0&&(c===""?(o.splice(u+1,a),a=0):(o.splice(u,2),a--));return r=o.join("/"),r===""&&(r=i?"/":"."),n?(n.path=r,_e(n)):r});K.normalize=pr;function gi(e,t){e===""&&(e="."),t===""&&(t=".");var r=Je(t),n=Je(e);if(n&&(e=n.path||"/"),r&&!r.scheme)return n&&(r.scheme=n.scheme),_e(r);if(r||t.match(Fa))return t;if(n&&!n.host&&!n.path)return n.host=t,_e(n);var i=t.charAt(0)==="/"?t:pr(e.replace(/\/+$/,"")+"/"+t);return n?(n.path=i,_e(n)):i}K.join=gi;K.isAbsolute=function(e){return e.charAt(0)==="/"||di.test(e)};function Ua(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)}K.relative=Ua;var bi=function(){var e=Object.create(null);return!("__proto__"in e)}();function xi(e){return e}function Ha(e){return yi(e)?"$"+e:e}K.toSetString=bi?xi:Ha;function Wa(e){return yi(e)?e.slice(1):e}K.fromSetString=bi?xi:Wa;function yi(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 qa(e,t,r){var n=be(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:be(e.name,t.name)}K.compareByOriginalPositions=qa;function Ya(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:be(e.name,t.name)}K.compareByOriginalPositionsNoSource=Ya;function Ga(e,t,r){var n=e.generatedLine-t.generatedLine;return n!==0||(n=e.generatedColumn-t.generatedColumn,n!==0||r)||(n=be(e.source,t.source),n!==0)||(n=e.originalLine-t.originalLine,n!==0)||(n=e.originalColumn-t.originalColumn,n!==0)?n:be(e.name,t.name)}K.compareByGeneratedPositionsDeflated=Ga;function Va(e,t,r){var n=e.generatedColumn-t.generatedColumn;return n!==0||r||(n=be(e.source,t.source),n!==0)||(n=e.originalLine-t.originalLine,n!==0)||(n=e.originalColumn-t.originalColumn,n!==0)?n:be(e.name,t.name)}K.compareByGeneratedPositionsDeflatedNoLine=Va;function be(e,t){return e===t?0:e===null?1:t===null?-1:e>t?1:-1}function Ka(e,t){var r=e.generatedLine-t.generatedLine;return r!==0||(r=e.generatedColumn-t.generatedColumn,r!==0)||(r=be(e.source,t.source),r!==0)||(r=e.originalLine-t.originalLine,r!==0)||(r=e.originalColumn-t.originalColumn,r!==0)?r:be(e.name,t.name)}K.compareByGeneratedPositionsInflated=Ka;function Qa(e){return JSON.parse(e.replace(/^\)]}'[^\n]*\n/,""))}K.parseSourceMapInput=Qa;function Xa(e,t,r){if(t=t||"",e&&(e[e.length-1]!=="/"&&t[0]!=="/"&&(e+="/"),t=e+t),r){var n=Je(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=gi(_e(n),t)}return pr(t)}K.computeSourceURL=Xa});var wi=Ie(ki=>{var mr=At(),fr=Object.prototype.hasOwnProperty,Le=typeof Map!="undefined";function xe(){this._array=[],this._set=Le?new Map:Object.create(null)}xe.fromArray=function(t,r){for(var n=new xe,i=0,o=t.length;i=0)return r}else{var n=mr.toSetString(t);if(fr.call(this._set,n))return this._set[n]}throw new Error('"'+t+'" is not in the set.')};xe.prototype.at=function(t){if(t>=0&&t{var vi=At();function $a(e,t){var r=e.generatedLine,n=t.generatedLine,i=e.generatedColumn,o=t.generatedColumn;return n>r||n==r&&o>=i||vi.compareByGeneratedPositionsInflated(e,t)<=0}function Et(){this._array=[],this._sorted=!0,this._last={generatedLine:-1,generatedColumn:0}}Et.prototype.unsortedForEach=function(t,r){this._array.forEach(t,r)};Et.prototype.add=function(t){$a(this._last,t)?(this._last=t,this._array.push(t)):(this._sorted=!1,this._array.push(t))};Et.prototype.toArray=function(){return this._sorted||(this._array.sort(vi.compareByGeneratedPositionsInflated),this._sorted=!0),this._array};Si.MappingList=Et});var Ai=Ie(Ti=>{var et=fi(),H=At(),Lt=wi().ArraySet,Za=Ci().MappingList;function ie(e){e||(e={}),this._file=H.getArg(e,"file",null),this._sourceRoot=H.getArg(e,"sourceRoot",null),this._skipValidation=H.getArg(e,"skipValidation",!1),this._sources=new Lt,this._names=new Lt,this._mappings=new Za,this._sourcesContents=null}ie.prototype._version=3;ie.fromSourceMap=function(t){var r=t.sourceRoot,n=new ie({file:t.file,sourceRoot:r});return t.eachMapping(function(i){var o={generated:{line:i.generatedLine,column:i.generatedColumn}};i.source!=null&&(o.source=i.source,r!=null&&(o.source=H.relative(r,o.source)),o.original={line:i.originalLine,column:i.originalColumn},i.name!=null&&(o.name=i.name)),n.addMapping(o)}),t.sources.forEach(function(i){var o=i;r!==null&&(o=H.relative(r,i)),n._sources.has(o)||n._sources.add(o);var s=t.sourceContentFor(i);s!=null&&n.setSourceContent(i,s)}),n};ie.prototype.addMapping=function(t){var r=H.getArg(t,"generated"),n=H.getArg(t,"original",null),i=H.getArg(t,"source",null),o=H.getArg(t,"name",null);this._skipValidation||this._validateMapping(r,n,i,o),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})};ie.prototype.setSourceContent=function(t,r){var n=t;this._sourceRoot!=null&&(n=H.relative(this._sourceRoot,n)),r!=null?(this._sourcesContents||(this._sourcesContents=Object.create(null)),this._sourcesContents[H.toSetString(n)]=r):this._sourcesContents&&(delete this._sourcesContents[H.toSetString(n)],Object.keys(this._sourcesContents).length===0&&(this._sourcesContents=null))};ie.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=H.relative(o,i));var s=new Lt,u=new Lt;this._mappings.unsortedForEach(function(c){if(c.source===i&&c.originalLine!=null){var a=t.originalPositionFor({line:c.originalLine,column:c.originalColumn});a.source!=null&&(c.source=a.source,n!=null&&(c.source=H.join(n,c.source)),o!=null&&(c.source=H.relative(o,c.source)),c.originalLine=a.line,c.originalColumn=a.column,a.name!=null&&(c.name=a.name))}var l=c.source;l!=null&&!s.has(l)&&s.add(l);var h=c.name;h!=null&&!u.has(h)&&u.add(h)},this),this._sources=s,this._names=u,t.sources.forEach(function(c){var a=t.sourceContentFor(c);a!=null&&(n!=null&&(c=H.join(n,c)),o!=null&&(c=H.relative(o,c)),this.setSourceContent(c,a))},this)};ie.prototype._validateMapping=function(t,r,n,i){if(r&&typeof r.line!="number"&&typeof r.column!="number")throw new Error("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(!(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;throw new Error("Invalid mapping: "+JSON.stringify({generated:t,source:n,original:r,name:i}))}};ie.prototype._serializeMappings=function(){for(var t=0,r=1,n=0,i=0,o=0,s=0,u="",c,a,l,h,m=this._mappings.toArray(),f=0,j=m.length;f0){if(!H.compareByGeneratedPositionsInflated(a,m[f-1]))continue;c+=","}c+=et.encode(a.generatedColumn-t),t=a.generatedColumn,a.source!=null&&(h=this._sources.indexOf(a.source),c+=et.encode(h-s),s=h,c+=et.encode(a.originalLine-1-i),i=a.originalLine-1,c+=et.encode(a.originalColumn-n),n=a.originalColumn,a.name!=null&&(l=this._names.indexOf(a.name),c+=et.encode(l-o),o=l)),u+=c}return u};ie.prototype._generateSourcesContent=function(t,r){return t.map(function(n){if(!this._sourcesContents)return null;r!=null&&(n=H.relative(r,n));var i=H.toSetString(n);return Object.prototype.hasOwnProperty.call(this._sourcesContents,i)?this._sourcesContents[i]:null},this)};ie.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};ie.prototype.toString=function(){return JSON.stringify(this.toJSON())};Ti.SourceMapGenerator=ie});var Ke={};b(Ke,{AtKeyword:()=>P,BadString:()=>Te,BadUrl:()=>Y,CDC:()=>U,CDO:()=>ue,Colon:()=>z,Comma:()=>G,Comment:()=>E,Delim:()=>g,Dimension:()=>y,EOF:()=>Ve,Function:()=>x,Hash:()=>v,Ident:()=>p,LeftCurlyBracket:()=>N,LeftParenthesis:()=>A,LeftSquareBracket:()=>_,Number:()=>d,Percentage:()=>T,RightCurlyBracket:()=>q,RightParenthesis:()=>w,RightSquareBracket:()=>V,Semicolon:()=>B,String:()=>W,Url:()=>R,WhiteSpace:()=>k});var Ve=0,p=1,x=2,P=3,v=4,W=5,Te=6,R=7,Y=8,g=9,d=10,T=11,y=12,k=13,ue=14,U=15,z=16,B=17,G=18,_=19,V=20,A=21,w=22,N=23,q=24,E=25;var va=0;function F(e){return e>=48&&e<=57}function ee(e){return F(e)||e>=65&&e<=70||e>=97&&e<=102}function bt(e){return e>=65&&e<=90}function Sa(e){return e>=97&&e<=122}function Ca(e){return bt(e)||Sa(e)}function Ta(e){return e>=128}function xt(e){return Ca(e)||Ta(e)||e===95}function De(e){return xt(e)||F(e)||e===45}function Aa(e){return e>=0&&e<=8||e===11||e>=14&&e<=31||e===127}function Qe(e){return e===10||e===13||e===12}function he(e){return Qe(e)||e===32||e===9}function $(e,t){return!(e!==92||Qe(t)||t===va)}function Oe(e,t,r){return e===45?xt(t)||t===45||$(t,r):xt(e)?!0:e===92?$(e,t):!1}function yt(e,t,r){return e===43||e===45?F(t)?2:t===46&&F(r)?3:0:e===46?F(t)?2:0:F(e)?1:0}function kt(e){return e===65279||e===65534?1:0}var er=new Array(128),Ea=128,Xe=130,tr=131,wt=132,rr=133;for(let e=0;ee.length)return!1;for(let i=t;i=0&&he(e.charCodeAt(t));t--);return t+1}function $e(e,t){for(;t=55296&&t<=57343||t>1114111)&&(t=65533),String.fromCodePoint(t)}var Re=["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"];var La=16*1024;function Fe(e=null,t){return e===null||e.length0?kt(t.charCodeAt(0)):0,i=Fe(e.lines,r),o=Fe(e.columns,r),s=e.startLine,u=e.startColumn;for(let c=n;c{}){t=String(t||"");let n=t.length,i=Fe(this.offsetAndType,t.length+1),o=Fe(this.balance,t.length+1),s=0,u=0,c=0,a=-1;for(this.offsetAndType=null,this.balance=null,r(t,(l,h,m)=>{switch(l){default:o[s]=n;break;case u:{let f=c≠for(c=o[f],u=c>>we,o[s]=f,o[f++]=s;f>we:Ve}lookupOffset(t){return t+=this.tokenIndex,t0?t>we,this.tokenEnd=r&ne):(this.tokenIndex=this.tokenCount,this.next())}next(){let t=this.tokenIndex+1;t>we,this.tokenEnd=t&ne):(this.eof=!0,this.tokenIndex=this.tokenCount,this.tokenType=Ve,this.tokenStart=this.tokenEnd=this.source.length)}skipSC(){for(;this.tokenType===k||this.tokenType===E;)this.next()}skipUntilBalanced(t,r){let n=t,i,o;e:for(;n0?this.offsetAndType[n-1]&ne:this.firstCharOffset,r(this.source.charCodeAt(o))){case 1:break e;case 2:n++;break e;default:this.balance[i]===n&&(n=i)}}this.skip(n-this.tokenIndex)}forEachToken(t){for(let r=0,n=this.firstCharOffset;r>we;n=s,t(u,i,s,r)}}dump(){let t=new Array(this.tokenCount);return this.forEachToken((r,n,i,o)=>{t[o]={idx:o,type:Re[r],chunk:this.source.substring(n,i),balance:this.balance[o]}}),t}};function ve(e,t){function r(h){return h=e.length){aString(l+f+1).padStart(c)+" |"+m).join(` +`)}let o=e.split(/\r\n?|\n|\f/),s=Math.max(1,t-n)-1,u=Math.min(t+n,o.length+1),c=Math.max(4,String(u).length)+1,a=0;r+=(ti.length-1)*(o[t-1].substr(0,r-1).match(/\t/g)||[]).length,r>or&&(a=r-ei+3,r=ei-2);for(let l=s;l<=u;l++)l>=0&&l0&&o[l].length>a?"\u2026":"")+o[l].substr(a,or-2)+(o[l].length>a+or-1?"\u2026":""));return[i(s,t),new Array(r+c+2).join("-")+"^",i(t,u)].filter(Boolean).join(` +`)}function ar(e,t,r,n,i){return Object.assign(Ee("SyntaxError",e),{source:t,offset:r,line:n,column:i,sourceFragment(s){return ri({source:t,line:n,column:i},isNaN(s)?0:s)},get formattedMessage(){return`Parse error: ${e} +`+ri({source:t,line:n,column:i},2)}})}function ni(e){let t=this.createList(),r=!1,n={recognizer:e};for(;!this.eof;){switch(this.tokenType){case E:this.next();continue;case k: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 ii=()=>{},za=33,Ia=35,sr=59,oi=123,ai=0;function Da(e){return function(){return this[e]()}}function lr(e){let t=Object.create(null);for(let r in e){let n=e[r];n.parse&&(t[r]=n.parse)}return t}function Oa(e){let t={context:Object.create(null),scope:Object.assign(Object.create(null),e.scope),atrule:lr(e.atrule),pseudo:lr(e.pseudo),node:lr(e.node)};for(let r in e.parseContext)switch(typeof e.parseContext[r]){case"function":t.context[r]=e.parseContext[r];break;case"string":t.context[r]=Da(e.parseContext[r]);break}return{config:t,...t,...t.node}}function si(e){let t="",r="",n=!1,i=ii,o=!1,s=new ir,u=Object.assign(new Tt,Oa(e||{}),{parseAtrulePrelude:!0,parseRulePrelude:!0,parseValue:!0,parseCustomProperty:!1,readSequence:ni,consumeUntilBalanceEnd:()=>0,consumeUntilLeftCurlyBracket(a){return a===oi?1:0},consumeUntilLeftCurlyBracketOrSemicolon(a){return a===oi||a===sr?1:0},consumeUntilExclamationMarkOrSemicolon(a){return a===za||a===sr?1:0},consumeUntilSemicolonIncluded(a){return a===sr?2:0},createList(){return new I},createSingleNodeList(a){return new I().appendData(a)},getFirstListNode(a){return a&&a.first},getLastListNode(a){return a&&a.last},parseWithFallback(a,l){let h=this.tokenIndex;try{return a.call(this)}catch(m){if(o)throw m;let f=l.call(this,h);return o=!0,i(m,f),o=!1,f}},lookupNonWSType(a){let l;do if(l=this.lookupType(a++),l!==k)return l;while(l!==ai);return ai},charCodeAt(a){return a>=0&&af.toUpperCase()),h=`${/[[\](){}]/.test(l)?`"${l}"`:l} is expected`,m=this.tokenStart;switch(a){case p:this.tokenType===x||this.tokenType===R?(m=this.tokenEnd-1,h="Identifier is expected but function found"):h="Identifier is expected";break;case v:this.isDelim(Ia)&&(this.next(),m++,h="Name is expected");break;case T:this.tokenType===d&&(m=this.tokenEnd,h="Percent sign is expected");break}this.error(h,m)}this.next()},eatIdent(a){(this.tokenType!==p||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,l){return n?s.getLocationRange(a,l,r):null},getLocationFromList(a){if(n){let l=this.getFirstListNode(a),h=this.getLastListNode(a);return s.getLocationRange(l!==null?l.loc.start.offset-s.startOffset:this.tokenStart,h!==null?h.loc.end.offset-s.startOffset:this.tokenStart,r)}return null},error(a,l){let h=typeof l!="undefined"&&l",n=Boolean(l.positions),i=typeof l.onParseError=="function"?l.onParseError:ii,o=!1,u.parseAtrulePrelude="parseAtrulePrelude"in l?Boolean(l.parseAtrulePrelude):!0,u.parseRulePrelude="parseRulePrelude"in l?Boolean(l.parseRulePrelude):!0,u.parseValue="parseValue"in l?Boolean(l.parseValue):!0,u.parseCustomProperty="parseCustomProperty"in l?Boolean(l.parseCustomProperty):!1;let{context:h="default",onComment:m}=l;if(!(h in u.context))throw new Error("Unknown context `"+h+"`");typeof m=="function"&&u.forEachToken((j,te,X)=>{if(j===E){let S=u.getLocation(te,X),M=ge(t,X-2,X,"*/")?t.slice(te+2,X-2):t.slice(te+2,X);m(M,S)}});let f=u.context[h].call(u,l);return u.eof||u.error(),f},{SyntaxError:ar,config:u.config})}var Ei=wa(Ai()),Li=new Set(["Atrule","Selector","Declaration"]);function ji(e){let t=new Ei.SourceMapGenerator,r={line:1,column:0},n={line:0,column:0},i={line:1,column:0},o={generated:i},s=1,u=0,c=!1,a=e.node;e.node=function(m){if(m.loc&&m.loc.start&&Li.has(m.type)){let f=m.loc.start.line,j=m.loc.start.column-1;(n.line!==f||n.column!==j)&&(n.line=f,n.column=j,r.line=s,r.column=u,c&&(c=!1,(r.line!==i.line||r.column!==i.column)&&t.addMapping(o)),c=!0,t.addMapping({source:m.loc.source,original:n,generated:r}))}a.call(this,m),c&&Li.has(m.type)&&(i.line=s,i.column=u)};let l=e.emit;e.emit=function(m,f,j){for(let te=0;tegr,spec:()=>rs});var Ja=43,es=45,dr=(e,t)=>{if(e===g&&(e=t),typeof e=="string"){let r=e.charCodeAt(0);return r>127?32768:r<<8}return e},Pi=[[p,p],[p,x],[p,R],[p,Y],[p,"-"],[p,d],[p,T],[p,y],[p,U],[p,A],[P,p],[P,x],[P,R],[P,Y],[P,"-"],[P,d],[P,T],[P,y],[P,U],[v,p],[v,x],[v,R],[v,Y],[v,"-"],[v,d],[v,T],[v,y],[v,U],[y,p],[y,x],[y,R],[y,Y],[y,"-"],[y,d],[y,T],[y,y],[y,U],["#",p],["#",x],["#",R],["#",Y],["#","-"],["#",d],["#",T],["#",y],["#",U],["-",p],["-",x],["-",R],["-",Y],["-","-"],["-",d],["-",T],["-",y],["-",U],[d,p],[d,x],[d,R],[d,Y],[d,d],[d,T],[d,y],[d,"%"],[d,U],["@",p],["@",x],["@",R],["@",Y],["@","-"],["@",U],[".",d],[".",T],[".",y],["+",d],["+",T],["+",y],["/","*"]],ts=Pi.concat([[p,v],[y,v],[v,v],[P,A],[P,W],[P,z],[T,T],[T,y],[T,x],[T,"-"],[w,p],[w,x],[w,T],[w,y],[w,v],[w,"-"]]);function zi(e){let t=new Set(e.map(([r,n])=>dr(r)<<16|dr(n)));return function(r,n,i){let o=dr(n,i),s=i.charCodeAt(0);return(s===es&&n!==p&&n!==x&&n!==U||s===Ja?t.has(r<<16|s<<8):t.has(r<<16|o))&&this.emit(" ",k,!0),o}}var rs=zi(Pi),gr=zi(ts);var ns=92;function is(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 os(e){ve(e,(t,r,n)=>{this.token(t,e.slice(r,n))})}function Ii(e){let t=new Map;for(let r in e.node)t.set(r,e.node[r].generate);return function(r,n){let i="",o=0,s={node(c){if(t.has(c.type))t.get(c.type).call(u,c);else throw new Error("Unknown node type: "+c.type)},tokenBefore:gr,token(c,a){o=this.tokenBefore(o,c,a),this.emit(a,c,!1),c===g&&a.charCodeAt(0)===ns&&this.emit(` +`,k,!0)},emit(c){i+=c},result(){return i}};n&&(typeof n.decorator=="function"&&(s=n.decorator(s)),n.sourceMap&&(s=ji(s)),n.mode in jt&&(s.tokenBefore=jt[n.mode]));let u={node:c=>s.node(c),children:is,token:(c,a)=>s.token(c,a),tokenize:os};return s.node(r),s.result()}}function Di(e){return{fromPlainObject:function(t){return e(t,{enter:function(r){r.children&&!(r.children instanceof I)&&(r.children=new I().fromArray(r.children))}}),t},toPlainObject:function(t){return e(t,{leave:function(r){r.children&&r.children instanceof I&&(r.children=r.children.toArray())}}),t}}}var{hasOwnProperty:br}=Object.prototype,tt=function(){};function Oi(e){return typeof e=="function"?e:tt}function Ni(e,t){return function(r,n,i){r.type===t&&e.call(this,r,n,i)}}function as(e,t){let r=t.structure,n=[];for(let i in r){if(br.call(r,i)===!1)continue;let o=r[i],s={name:i,type:!1,nullable:!1};Array.isArray(o)||(o=[o]);for(let u of o)u===null?s.nullable=!0:typeof u=="string"?s.type="node":Array.isArray(u)&&(s.type="list");s.type&&n.push(s)}return n.length?{context:t.walkContext,fields:n}:null}function ss(e){let t={};for(let r in e.node)if(br.call(e.node,r)){let n=e.node[r];if(!n.structure)throw new Error("Missed `structure` field in `"+r+"` node type definition");t[r]=as(r,n)}return t}function Mi(e,t){let r=e.fields.slice(),n=e.context,i=typeof n=="string";return t&&r.reverse(),function(o,s,u,c){let a;i&&(a=s[n],s[n]=o);for(let l of r){let h=o[l.name];if(!l.nullable||h){if(l.type==="list"){if(t?h.reduceRight(c,!1):h.reduce(c,!1))return!0}else if(u(h))return!0}}i&&(s[n]=a)}}function Ri({StyleSheet:e,Atrule:t,Rule:r,Block:n,DeclarationList:i}){return{Atrule:{StyleSheet:e,Atrule:t,Rule:r,Block:n},Rule:{StyleSheet:e,Atrule:t,Rule:r,Block:n},Declaration:{StyleSheet:e,Atrule:t,Rule:r,Block:n,DeclarationList:i}}}function Fi(e){let t=ss(e),r={},n={},i=Symbol("break-walk"),o=Symbol("skip-node");for(let a in t)br.call(t,a)&&t[a]!==null&&(r[a]=Mi(t[a],!1),n[a]=Mi(t[a],!0));let s=Ri(r),u=Ri(n),c=function(a,l){function h(S,M,ke){let O=m.call(X,S,M,ke);return O===i?!0:O===o?!1:!!(j.hasOwnProperty(S.type)&&j[S.type](S,X,h,te)||f.call(X,S,M,ke)===i)}let m=tt,f=tt,j=r,te=(S,M,ke,O)=>S||h(M,ke,O),X={break:i,skip:o,root:a,stylesheet:null,atrule:null,atrulePrelude:null,rule:null,selector:null,block:null,declaration:null,function:null};if(typeof l=="function")m=l;else if(l&&(m=Oi(l.enter),f=Oi(l.leave),l.reverse&&(j=n),l.visit)){if(s.hasOwnProperty(l.visit))j=l.reverse?u[l.visit]:s[l.visit];else if(!t.hasOwnProperty(l.visit))throw new Error("Bad value `"+l.visit+"` for `visit` option (should be: "+Object.keys(t).sort().join(", ")+")");m=Ni(m,l.visit),f=Ni(f,l.visit)}if(m===tt&&f===tt)throw new Error("Neither `enter` nor `leave` walker handler is set or both aren't a function");h(a)};return c.break=i,c.skip=o,c.find=function(a,l){let h=null;return c(a,function(m,f,j){if(l.call(this,m,f,j))return h=m,i}),h},c.findLast=function(a,l){let h=null;return c(a,{reverse:!0,enter:function(m,f,j){if(l.call(this,m,f,j))return h=m,i}}),h},c.findAll=function(a,l){let h=[];return c(a,function(m,f,j){l.call(this,m,f,j)&&h.push(m)}),h},c}function ls(e){return e}function cs(e){let{min:t,max:r,comma:n}=e;return t===0&&r===0?"*":t===0&&r===1?"?":t===1&&r===0?n?"#":"+":t===1&&r===1?"":(n?"#":"")+(t===r?"{"+t+"}":"{"+t+","+(r!==0?r:"")+"}")}function us(e){switch(e.type){case"Range":return" ["+(e.min===null?"-\u221E":e.min)+","+(e.max===null?"\u221E":e.max)+"]";default:throw new Error("Unknown node type `"+e.type+"`")}}function hs(e,t,r,n){let i=e.combinator===" "||n?e.combinator:" "+e.combinator+" ",o=e.terms.map(s=>xr(s,t,r,n)).join(i);return e.explicit||r?(n||o[0]===","?"[":"[ ")+o+(n?"]":" ]"):o}function xr(e,t,r,n){let i;switch(e.type){case"Group":i=hs(e,t,r,n)+(e.disallowEmpty?"!":"");break;case"Multiplier":return xr(e.term,t,r,n)+t(cs(e),e);case"Type":i="<"+e.name+(e.opts?t(us(e.opts),e.opts):"")+">";break;case"Property":i="<'"+e.name+"'>";break;case"Keyword":i=e.name;break;case"AtKeyword":i="@"+e.name;break;case"Function":i=e.name+"(";break;case"String":case"Token":i=e.value;break;case"Comma":i=",";break;default:throw new Error("Unknown node type `"+e.type+"`")}return t(i,e)}function je(e,t){let r=ls,n=!1,i=!1;return typeof t=="function"?r=t:t&&(n=Boolean(t.forceBraces),i=Boolean(t.compact),typeof t.decorate=="function"&&(r=t.decorate)),xr(e,r,n,i)}var Bi={offset:0,line:1,column:1};function ps(e,t){let r=e.tokens,n=e.longestMatch,i=n1?(l=Pt(o||t,"end")||rt(Bi,a),h=rt(l)):(l=Pt(o,"start")||rt(Pt(t,"start")||Bi,a.slice(0,s)),h=Pt(o,"end")||rt(l,a.substr(s,u))),{css:a,mismatchOffset:s,mismatchLength:u,start:l,end:h}}function Pt(e,t){let r=e&&e.loc&&e.loc[t];return r?"line"in r?rt(r):r:null}function rt({offset:e,line:t,column:r},n){let i={offset:e,line:t,column:r};if(n){let o=n.split(/\n|\r\n?|\f/);i.offset+=n.length,i.line+=o.length-1,i.column=o.length===1?i.column+n.length:o.pop().length+1}return i}var Ue=function(e,t){let r=Ee("SyntaxReferenceError",e+(t?" `"+t+"`":""));return r.reference=t,r},_i=function(e,t,r,n){let i=Ee("SyntaxMatchError",e),{css:o,mismatchOffset:s,mismatchLength:u,start:c,end:a}=ps(n,r);return i.rawMessage=e,i.syntax=t?je(t):"",i.css=o,i.mismatchOffset=s,i.mismatchLength=u,i.message=e+` + syntax: `+i.syntax+` + value: `+(o||"")+` + --------`+new Array(i.mismatchOffset+1).join("-")+"^",Object.assign(i,c),i.loc={source:r&&r.loc&&r.loc.source||"",start:c,end:a},i};var zt=new Map,He=new Map,It=45,Dt=ms,yr=fs,Wm=kr;function Ot(e,t){return t=t||0,e.length-t>=2&&e.charCodeAt(t)===It&&e.charCodeAt(t+1)===It}function kr(e,t){if(t=t||0,e.length-t>=3&&e.charCodeAt(t)===It&&e.charCodeAt(t+1)!==It){let r=e.indexOf("-",t+2);if(r!==-1)return e.substring(t,r+1)}return""}function ms(e){if(zt.has(e))return zt.get(e);let t=e.toLowerCase(),r=zt.get(t);if(r===void 0){let n=Ot(t,0),i=n?"":kr(t,0);r=Object.freeze({basename:t.substr(i.length),name:t,prefix:i,vendor:i,custom:n})}return zt.set(e,r),r}function fs(e){if(He.has(e))return He.get(e);let t=e,r=e[0];r==="/"?r=e[1]==="/"?"//":"/":r!=="_"&&r!=="*"&&r!=="$"&&r!=="#"&&r!=="+"&&r!=="&"&&(r="");let n=Ot(t,r.length);if(!n&&(t=t.toLowerCase(),He.has(t))){let u=He.get(t);return He.set(e,u),u}let i=n?"":kr(t,r.length),o=t.substr(0,r.length+i.length),s=Object.freeze({basename:t.substr(o.length),name:t.substr(r.length),hack:r,vendor:i,prefix:o,custom:n});return He.set(e,s),s}var nt=43,pe=45,wr=110,We=!0,gs=!1;function vr(e,t){return e!==null&&e.type===g&&e.value.charCodeAt(0)===t}function it(e,t,r){for(;e!==null&&(e.type===k||e.type===E);)e=r(++t);return t}function Se(e,t,r,n){if(!e)return 0;let i=e.value.charCodeAt(t);if(i===nt||i===pe){if(r)return 0;t++}for(;t6)return 0}return n}function Nt(e,t,r){if(!e)return 0;for(;Tr(r(t),Hi);){if(++e>6)return 0;t++}return t}function Ar(e,t){let r=0;if(e===null||e.type!==p||!de(e.value,0,xs)||(e=t(++r),e===null))return 0;if(Tr(e,bs))return e=t(++r),e===null?0:e.type===p?Nt(ot(e,0,!0),++r,t):Tr(e,Hi)?Nt(1,++r,t):0;if(e.type===d){let n=ot(e,1,!0);return n===0?0:(e=t(++r),e===null?r:e.type===y||e.type===d?!ys(e,Ui)||!ot(e,1,!1)?0:r+1:Nt(n,r,t))}return e.type===y?Nt(ot(e,1,!0),++r,t):0}var ks=["unset","initial","inherit"],ws=["calc(","-moz-calc(","-webkit-calc("],Er=new Map([[x,w],[A,w],[_,V],[N,q]]),vs=["px","mm","cm","in","pt","pc","q","em","ex","ch","rem","vh","vw","vmin","vmax","vm"],Ss=["deg","grad","rad","turn"],Cs=["s","ms"],Ts=["hz","khz"],As=["dpi","dpcm","dppx","x"],Es=["fr"],Ls=["db"],js=["st"];function le(e,t){return te.max)return!0}return!1}function Yi(e,t){let r=0,n=[],i=0;e:do{switch(e.type){case q:case w:case V:if(e.type!==r)break e;if(r=n.pop(),n.length===0){i++;break e}break;case x:case A:case _:case N:n.push(r),r=Er.get(e.type);break}i++}while(e=t(i));return i}function oe(e){return function(t,r,n){return t===null?0:t.type===x&&Wi(t.value,ws)?Yi(t,r):e(t,r,n)}}function D(e){return function(t){return t===null||t.type!==e?0:1}}function Ps(e){return e=e+"(",function(t,r){return t!==null&&Lr(t.value,e)?Yi(t,r):0}}function zs(e){if(e===null||e.type!==p)return 0;let t=e.value.toLowerCase();return Wi(t,ks)||Lr(t,"default")?0:1}function Is(e){return e===null||e.type!==p||le(e.value,0)!==45||le(e.value,1)!==45?0:1}function Ds(e){if(e===null||e.type!==v)return 0;let t=e.value.length;if(t!==4&&t!==5&&t!==7&&t!==9)return 0;for(let r=1;rFt,generate:()=>je,parse:()=>qe,walk:()=>Yt});function Ft(e,t,r){return Object.assign(Ee("SyntaxError",e),{input:t,offset:r,rawMessage:e,message:e+` + `+t+` +--`+new Array((r||t.length)+1).join("-")+"^"})}var _s=9,Us=10,Hs=12,Ws=13,qs=32,jr=class{constructor(t){this.str=t,this.pos=0}charCodeAt(t){return t/[a-zA-Z0-9\-]/.test(String.fromCharCode(t))?1:0),oo={" ":1,"&&":2,"||":3,"|":4};function Ht(e){return e.substringToPos(e.findWsEnd(e.pos))}function Wt(e){let t=e.pos;for(;t=128||Dr[r]===0)break}return e.pos===t&&e.error("Expect a keyword"),e.substringToPos(t)}function qt(e){let t=e.pos;for(;t57)break}return e.pos===t&&e.error("Expect a number"),e.substringToPos(t)}function Zs(e){let t=e.str.indexOf("'",e.pos+1);return t===-1&&(e.pos=e.str.length,e.error("Expect an apostrophe")),e.substringToPos(t+1)}function ao(e){let t=null,r=null;return e.eat(Ut),t=qt(e),e.charCode()===Pr?(e.pos++,e.charCode()!==no&&(r=qt(e))):r=t,e.eat(no),{min:Number(t),max:r?Number(r):0}}function Js(e){let t=null,r=!1;switch(e.charCode()){case $i:e.pos++,t={min:0,max:0};break;case Zi:e.pos++,t={min:1,max:0};break;case to:e.pos++,t={min:0,max:1};break;case Ki:e.pos++,r=!0,e.charCode()===Ut?t=ao(e):t={min:1,max:0};break;case Ut:t=ao(e);break;default:return null}return{type:"Multiplier",comma:r,min:t.min,max:t.max,term:null}}function at(e,t){let r=Js(e);return r!==null?(r.term=t,r):t}function Or(e){let t=e.peek();return t===""?null:{type:"Token",value:t}}function el(e){let t;return e.eat(zr),e.eat(Bt),t=Wt(e),e.eat(Bt),e.eat(eo),at(e,{type:"Property",name:t})}function tl(e){let t=null,r=null,n=1;return e.eat(_t),e.charCode()===Ji&&(e.peek(),n=-1),n==-1&&e.charCode()===io?e.peek():t=n*Number(qt(e)),Ht(e),e.eat(Pr),Ht(e),e.charCode()===io?e.peek():(n=1,e.charCode()===Ji&&(e.peek(),n=-1),r=n*Number(qt(e))),e.eat(Ir),t===null&&r===null?null:{type:"Range",min:t,max:r}}function rl(e){let t,r=null;return e.eat(zr),t=Wt(e),e.charCode()===Xi&&e.nextCharCode()===Xs&&(e.pos+=2,t+="()"),e.charCodeAt(e.findWsEnd(e.pos))===_t&&(Ht(e),r=tl(e)),e.eat(eo),at(e,{type:"Type",name:t,opts:r})}function nl(e){let t=Wt(e);return e.charCode()===Xi?(e.pos++,{type:"Function",name:t}):at(e,{type:"Keyword",name:t})}function il(e,t){function r(i,o){return{type:"Group",terms:i,combinator:o,disallowEmpty:!1,explicit:!1}}let n;for(t=Object.keys(t).sort((i,o)=>oo[i]-oo[o]);t.length>0;){n=t.shift();let i=0,o=0;for(;i1&&(e.splice(o,i-o,r(e.slice(o,i),n)),i=o+1),o=-1))}o!==-1&&t.length&&e.splice(o,i-o,r(e.slice(o,i),n))}return n}function so(e){let t=[],r={},n,i=null,o=e.pos;for(;n=al(e);)n.type!=="Spaces"&&(n.type==="Combinator"?((i===null||i.type==="Combinator")&&(e.pos=o,e.error("Unexpected combinator")),r[n.value]=!0):i!==null&&i.type!=="Combinator"&&(r[" "]=!0,t.push({type:"Combinator",value:" "})),t.push(n),i=n,o=e.pos);return i!==null&&i.type==="Combinator"&&(e.pos-=o,e.error("Unexpected combinator")),{type:"Group",terms:t,combinator:il(t,r)||" ",disallowEmpty:!1,explicit:!1}}function ol(e){let t;return e.eat(_t),t=so(e),e.eat(Ir),t.explicit=!0,e.charCode()===Vi&&(e.pos++,t.disallowEmpty=!0),t}function al(e){let t=e.charCode();if(t<128&&Dr[t]===1)return nl(e);switch(t){case Ir:break;case _t:return at(e,ol(e));case zr:return e.nextCharCode()===Bt?el(e):rl(e);case ro:return{type:"Combinator",value:e.substringToPos(e.pos+(e.nextCharCode()===ro?2:1))};case Qi:return e.pos++,e.eat(Qi),{type:"Combinator",value:"&&"};case Pr:return e.pos++,{type:"Comma"};case Bt:return at(e,{type:"String",value:Zs(e)});case Qs:case Ys:case Gs:case Ks:case Vs:return{type:"Spaces",value:Ht(e)};case $s:return t=e.nextCharCode(),t<128&&Dr[t]===1?(e.pos++,{type:"AtKeyword",name:Wt(e)}):Or(e);case $i:case Zi:case to:case Ki:case Vi:break;case Ut:if(t=e.nextCharCode(),t<48||t>57)return Or(e);break;default:return Or(e)}}function qe(e){let t=new jr(e),r=so(t);return t.pos!==e.length&&t.error("Unexpected input"),r.terms.length===1&&r.terms[0].type==="Group"?r.terms[0]:r}var st=function(){};function lo(e){return typeof e=="function"?e:st}function Yt(e,t,r){function n(s){switch(i.call(r,s),s.type){case"Group":s.terms.forEach(n);break;case"Multiplier":n(s.term);break;case"Type":case"Property":case"Keyword":case"AtKeyword":case"Function":case"String":case"Token":case"Comma":break;default:throw new Error("Unknown type: "+s.type)}o.call(r,s)}let i=st,o=st;if(typeof t=="function"?i=t:t&&(i=lo(t.enter),o=lo(t.leave)),i===st&&o===st)throw new Error("Neither `enter` nor `leave` walker handler is set or both aren't a function");n(e,r)}var sl={decorator:function(e){let t=[],r=null;return{...e,node(n){let i=r;r=n,e.node.call(this,n),r=i},emit(n,i,o){t.push({type:i,value:n,node:o?null:r})},result(){return t}}}};function ll(e){let t=[];return ve(e,(r,n,i)=>t.push({type:r,value:e.slice(n,i),node:null})),t}function uo(e,t){return typeof e=="string"?ll(e):t.generate(e,sl)}var C={type:"Match"},L={type:"Mismatch"},Gt={type:"DisallowEmpty"},cl=40,ul=41;function Z(e,t,r){return t===C&&r===L||e===C&&t===C&&r===C?e:(e.type==="If"&&e.else===L&&t===C&&(t=e.then,e=e.match),{type:"If",match:e,then:t,else:r})}function ho(e){return e.length>2&&e.charCodeAt(e.length-2)===cl&&e.charCodeAt(e.length-1)===ul}function po(e){return e.type==="Keyword"||e.type==="AtKeyword"||e.type==="Function"||e.type==="Type"&&ho(e.name)}function Nr(e,t,r){switch(e){case" ":{let n=C;for(let i=t.length-1;i>=0;i--){let o=t[i];n=Z(o,n,L)}return n}case"|":{let n=L,i=null;for(let o=t.length-1;o>=0;o--){let s=t[o];if(po(s)&&(i===null&&o>0&&po(t[o-1])&&(i=Object.create(null),n=Z({type:"Enum",map:i},C,n)),i!==null)){let u=(ho(s.name)?s.name.slice(0,-1):s.name).toLowerCase();if(!(u in i)){i[u]=s;continue}}i=null,n=Z(s,C,n)}return n}case"&&":{if(t.length>5)return{type:"MatchOnce",terms:t,all:!0};let n=L;for(let i=t.length-1;i>=0;i--){let o=t[i],s;t.length>1?s=Nr(e,t.filter(function(u){return u!==o}),!1):s=C,n=Z(o,s,n)}return n}case"||":{if(t.length>5)return{type:"MatchOnce",terms:t,all:!1};let n=r?C:L;for(let i=t.length-1;i>=0;i--){let o=t[i],s;t.length>1?s=Nr(e,t.filter(function(u){return u!==o}),!0):s=C,n=Z(o,s,n)}return n}}}function hl(e){let t=C,r=Mr(e.term);if(e.max===0)r=Z(r,Gt,L),t=Z(r,null,L),t.then=Z(C,C,t),e.comma&&(t.then.else=Z({type:"Comma",syntax:e},t,L));else for(let n=e.min||1;n<=e.max;n++)e.comma&&t!==C&&(t=Z({type:"Comma",syntax:e},t,L)),t=Z(r,Z(C,C,t),L);if(e.min===0)t=Z(C,C,t);else for(let n=0;n=65&&i<=90&&(i=i|32),i!==n)return!1}return!0}function xl(e){return e.type!==g?!1:e.value!=="?"}function xo(e){return e===null?!0:e.type===G||e.type===x||e.type===A||e.type===_||e.type===N||xl(e)}function yo(e){return e===null?!0:e.type===w||e.type===V||e.type===q||e.type===g}function yl(e,t,r){function n(){do M++,S=Mke&&(ke=M)}function a(){h={syntax:t.syntax,opts:t.syntax.opts||h!==null&&h.opts||null,prev:h},O={type:Rr,syntax:t.syntax,token:O.token,prev:O}}function l(){O.type===Rr?O=O.prev:O={type:fo,syntax:h.syntax,token:O.token,prev:O},h=h.prev}let h=null,m=null,f=null,j=null,te=0,X=null,S=null,M=-1,ke=0,O={type:pl,syntax:null,token:null,prev:null};for(n();X===null&&++tef.tokenIndex)&&(f=j,j=!1);else if(f===null){X=fl;break}t=f.nextState,m=f.thenStack,h=f.syntaxStack,O=f.matchStack,M=f.tokenIndex,S=MM){for(;M":"<'"+t.name+"'>"));if(j!==!1&&S!==null&&t.type==="Type"&&(t.name==="custom-ident"&&S.type===p||t.name==="length"&&S.value==="0")){j===null&&(j=o(t,f)),t=L;break}a(),t=J.match;break}case"Keyword":{let Q=t.name;if(S!==null){let J=S.value;if(J.indexOf("\\")!==-1&&(J=J.replace(/\\[09].*$/,"")),Fr(J,Q)){c(),t=C;break}}t=L;break}case"AtKeyword":case"Function":if(S!==null&&Fr(S.value,t.name)){c(),t=C;break}t=L;break;case"Token":if(S!==null&&S.value===t.value){c(),t=C;break}t=L;break;case"Comma":S!==null&&S.type===G?xo(O.token)?t=L:(c(),t=yo(S)?L:C):t=xo(O.token)||yo(S)?C:L;break;case"String":let ae="",fe=M;for(;feko,isKeyword:()=>vl,isProperty:()=>wl,isType:()=>kl});function ko(e){function t(i){return i===null?!1:i.type==="Type"||i.type==="Property"||i.type==="Keyword"}function r(i){if(Array.isArray(i.match)){for(let o=0;or.type==="Type"&&r.name===t)}function wl(e,t){return _r(this,e,r=>r.type==="Property"&&r.name===t)}function vl(e){return _r(this,e,t=>t.type==="Keyword")}function _r(e,t,r){let n=ko.call(e,t);return n===null?!1:n.some(r)}function wo(e){return"node"in e?e.node:wo(e.match[0])}function vo(e){return"node"in e?e.node:vo(e.match[e.match.length-1])}function Hr(e,t,r,n,i){function o(u){if(u.syntax!==null&&u.syntax.type===n&&u.syntax.name===i){let c=wo(u),a=vo(u);e.syntax.walk(t,function(l,h,m){if(l===c){let f=new I;do{if(f.appendData(h.data),h.data===a)break;h=h.next}while(h!==null);s.push({parent:m,nodes:f})}})}Array.isArray(u.match)&&u.match.forEach(o)}let s=[];return r.matched!==null&&o(r.matched),s}var{hasOwnProperty:ct}=Object.prototype;function Wr(e){return typeof e=="number"&&isFinite(e)&&Math.floor(e)===e&&e>=0}function So(e){return Boolean(e)&&Wr(e.offset)&&Wr(e.line)&&Wr(e.column)}function Sl(e,t){return function(n,i){if(!n||n.constructor!==Object)return i(n,"Type of node should be an Object");for(let o in n){let s=!0;if(ct.call(n,o)!==!1){if(o==="type")n.type!==e&&i(n,"Wrong node type `"+n.type+"`, expected `"+e+"`");else if(o==="loc"){if(n.loc===null)continue;if(n.loc&&n.loc.constructor===Object)if(typeof n.loc.source!="string")o+=".source";else if(!So(n.loc.start))o+=".start";else if(!So(n.loc.end))o+=".end";else continue;s=!1}else if(t.hasOwnProperty(o)){s=!1;for(let u=0;!s&&u");else if(Array.isArray(a))s.push("List");else throw new Error("Wrong value `"+a+"` in `"+e+"."+o+"` structure definition")}i[o]=s.join(" | ")}return{docs:i,check:Sl(e,n)}}function Co(e){let t={};if(e.node){for(let r in e.node)if(ct.call(e.node,r)){let n=e.node[r];if(n.structure)t[r]=Cl(r,n);else throw new Error("Missed `structure` field in `"+r+"` node type definition")}}return t}var Tl=lt("inherit | initial | unset"),Al=lt("inherit | initial | unset | <-ms-legacy-expression>");function qr(e,t,r){let n={};for(let i in e)e[i].syntax&&(n[i]=r?e[i].syntax:je(e[i].syntax,{compact:t}));return n}function El(e,t,r){let n={};for(let[i,o]of Object.entries(e))n[i]={prelude:o.prelude&&(r?o.prelude.syntax:je(o.prelude.syntax,{compact:t})),descriptors:o.descriptors&&qr(o.descriptors,t,r)};return n}function Ll(e){for(let t=0;t(n[i]=this.createDescriptor(r.descriptors[i],"AtruleDescriptor",i,t),n),Object.create(null)):null})}addProperty_(t,r){!r||(this.properties[t]=this.createDescriptor(r,"Property",t))}addType_(t,r){!r||(this.types[t]=this.createDescriptor(r,"Type",t),r===Rt["-ms-legacy-expression"]&&(this.valueCommonSyntax=Al))}checkAtruleName(t){if(!this.getAtrule(t))return new Ue("Unknown at-rule","@"+t)}checkAtrulePrelude(t,r){let n=this.checkAtruleName(t);if(n)return n;let i=this.getAtrule(t);if(!i.prelude&&r)return new SyntaxError("At-rule `@"+t+"` should not contain a prelude");if(i.prelude&&!r)return new SyntaxError("At-rule `@"+t+"` should contain a prelude")}checkAtruleDescriptorName(t,r){let n=this.checkAtruleName(t);if(n)return n;let i=this.getAtrule(t),o=Dt(r);if(!i.descriptors)return new SyntaxError("At-rule `@"+t+"` has no known descriptors");if(!i.descriptors[o.name]&&!i.descriptors[o.basename])return new Ue("Unknown at-rule descriptor",r)}checkPropertyName(t){if(!this.getProperty(t))return new Ue("Unknown property",t)}matchAtrulePrelude(t,r){let n=this.checkAtrulePrelude(t,r);return n?ce(null,n):r?ut(this,this.getAtrule(t).prelude,r,!1):ce(null,null)}matchAtruleDescriptor(t,r,n){let i=this.checkAtruleDescriptorName(t,r);if(i)return ce(null,i);let o=this.getAtrule(t),s=Dt(r);return ut(this,o.descriptors[s.name]||o.descriptors[s.basename],n,!1)}matchDeclaration(t){return t.type!=="Declaration"?ce(null,new Error("Not a Declaration node")):this.matchProperty(t.property,t.value)}matchProperty(t,r){if(yr(t).custom)return ce(null,new Error("Lexer matching doesn't applicable for custom properties"));let n=this.checkPropertyName(t);return n?ce(null,n):ut(this,this.getProperty(t),r,!0)}matchType(t,r){let n=this.getType(t);return n?ut(this,n,r,!1):ce(null,new Ue("Unknown type",t))}match(t,r){return typeof t!="string"&&(!t||!t.type)?ce(null,new Ue("Bad syntax")):((typeof t=="string"||!t.match)&&(t=this.createDescriptor(t,"Type","anonymous")),ut(this,t,r,!1))}findValueFragments(t,r,n,i){return Hr(this,r,this.matchProperty(t,r),n,i)}findDeclarationValueFragments(t,r,n){return Hr(this,t.value,this.matchDeclaration(t),r,n)}findAllFragments(t,r,n){let i=[];return this.syntax.walk(t,{visit:"Declaration",enter:o=>{i.push.apply(i,this.findDeclarationValueFragments(o,r,n))}}),i}getAtrule(t,r=!0){let n=Dt(t);return(n.vendor&&r?this.atrules[n.name]||this.atrules[n.basename]:this.atrules[n.name])||null}getAtrulePrelude(t,r=!0){let n=this.getAtrule(t,r);return n&&n.prelude||null}getAtruleDescriptor(t,r){return this.atrules.hasOwnProperty(t)&&this.atrules.declarators&&this.atrules[t].declarators[r]||null}getProperty(t,r=!0){let n=yr(t);return(n.vendor&&r?this.properties[n.name]||this.properties[n.basename]:this.properties[n.name])||null}getType(t){return hasOwnProperty.call(this.types,t)?this.types[t]:null}validate(){function t(i,o,s,u){if(s.has(o))return s.get(o);s.set(o,!1),u.syntax!==null&&Yt(u.syntax,function(c){if(c.type!=="Type"&&c.type!=="Property")return;let a=c.type==="Type"?i.types:i.properties,l=c.type==="Type"?r:n;(!hasOwnProperty.call(a,c.name)||t(i,c.name,l,a[c.name]))&&s.set(o,!0)},this)}let r=new Map,n=new Map;for(let i in this.types)t(this,i,r,this.types[i]);for(let i in this.properties)t(this,i,n,this.properties[i]);return r=[...r.keys()].filter(i=>r.get(i)),n=[...n.keys()].filter(i=>n.get(i)),r.length||n.length?{types:r,properties:n}:null}dump(t,r){return{generic:this.generic,types:qr(this.types,!r,t),properties:qr(this.properties,!r,t),atrules:El(this.atrules,!r,t)}}toString(){return JSON.stringify(this.dump())}};var{hasOwnProperty:Ye}=Object.prototype,jl={generic:!0,types:Gr,atrules:{prelude:Eo,descriptors:Eo},properties:Gr,parseContext:Pl,scope:To,atrule:["parse"],pseudo:["parse"],node:["name","structure","parse","generate","walkContext"]};function Vt(e){return e&&e.constructor===Object}function Yr(e){return Vt(e)?{...e}:e}function Pl(e,t){return Object.assign(e,t)}function To(e,t){for(let r in t)Ye.call(t,r)&&(Vt(e[r])?To(e[r],Yr(t[r])):e[r]=Yr(t[r]));return e}function Ao(e,t){return typeof t=="string"&&/^\s*\|/.test(t)?typeof e=="string"?e+t:t.replace(/^\s*\|\s*/,""):t||null}function Gr(e,t){if(typeof t=="string")return Ao(e,t);let r={...e};for(let n in t)Ye.call(t,n)&&(r[n]=Ao(Ye.call(e,n)?e[n]:void 0,t[n]));return r}function Eo(e,t){let r=Gr(e,t);return!Vt(r)||Object.keys(r).length?r:null}function pt(e,t,r){for(let n in r)if(Ye.call(r,n)!==!1){if(r[n]===!0)n in t&&Ye.call(t,n)&&(e[n]=Yr(t[n]));else if(r[n]){if(typeof r[n]=="function"){let i=r[n];e[n]=i({},e[n]),e[n]=i(e[n]||{},t[n])}else if(Vt(r[n])){let i={};for(let o in e[n])i[o]=pt({},e[n][o],r[n]);for(let o in t[n])i[o]=pt(i[o]||{},t[n][o],r[n]);e[n]=i}else if(Array.isArray(r[n])){let i={},o=r[n].reduce(function(s,u){return s[u]=!0,s},{});for(let[s,u]of Object.entries(e[n]||{}))i[s]={},u&&pt(i[s],u,o);for(let s in t[n])Ye.call(t[n],s)&&(i[s]||(i[s]={}),t[n]&&t[n][s]&&pt(i[s],t[n][s],o));e[n]=i}}}return e}var Kt=(e,t)=>pt(e,t,jl);function Lo(e){let t=si(e),r=Fi(e),n=Ii(e),{fromPlainObject:i,toPlainObject:o}=Di(r),s={lexer:null,createLexer:u=>new ht(u,s,s.lexer.structure),tokenize:ve,parse:t,generate:n,walk:r,find:r.find,findLast:r.findLast,findAll:r.findAll,fromPlainObject:i,toPlainObject:o,fork(u){let c=Kt({},e);return Lo(typeof u=="function"?u(c,Object.assign):Kt(c,u))}};return s.lexer=new ht({generic:!0,types:e.types,atrules:e.atrules,properties:e.properties,node:e.node},s),s}var Vr=e=>Lo(Kt({},e));var jo={generic:!0,types:{"absolute-size":"xx-small|x-small|small|medium|large|x-large|xx-large|xxx-large","alpha-value":"|","angle-percentage":"|","angular-color-hint":"","angular-color-stop":"&&?","angular-color-stop-list":"[ [, ]?]# , ","animateable-feature":"scroll-position|contents|",attachment:"scroll|fixed|local","attr()":"attr( ? [, ]? )","attr-matcher":"['~'|'|'|'^'|'$'|'*']? '='","attr-modifier":"i|s","attribute-selector":"'[' ']'|'[' [|] ? ']'","auto-repeat":"repeat( [auto-fill|auto-fit] , [? ]+ ? )","auto-track-list":"[? [|]]* ? [? [|]]* ?","baseline-position":"[first|last]? baseline","basic-shape":"||||","bg-image":"none|","bg-layer":"|| [/ ]?||||||||","bg-position":"[[left|center|right|top|bottom|]|[left|center|right|] [top|center|bottom|]|[center|[left|right] ?]&&[center|[top|bottom] ?]]","bg-size":"[|auto]{1,2}|cover|contain","blur()":"blur( )","blend-mode":"normal|multiply|screen|overlay|darken|lighten|color-dodge|color-burn|hard-light|soft-light|difference|exclusion|hue|saturation|color|luminosity",box:"border-box|padding-box|content-box","brightness()":"brightness( )","calc()":"calc( )","calc-sum":" [['+'|'-'] ]*","calc-product":" ['*' |'/' ]*","calc-value":"|||( )","cf-final-image":"|","cf-mixing-image":"?&&","circle()":"circle( []? [at ]? )","clamp()":"clamp( #{3} )","class-selector":"'.' ","clip-source":"",color:"||||||currentcolor|","color-stop":"|","color-stop-angle":"{1,2}","color-stop-length":"{1,2}","color-stop-list":"[ [, ]?]# , ",combinator:"'>'|'+'|'~'|['||']","common-lig-values":"[common-ligatures|no-common-ligatures]","compat-auto":"searchfield|textarea|push-button|slider-horizontal|checkbox|radio|square-button|menulist|listbox|meter|progress-bar|button","composite-style":"clear|copy|source-over|source-in|source-out|source-atop|destination-over|destination-in|destination-out|destination-atop|xor","compositing-operator":"add|subtract|intersect|exclude","compound-selector":"[? * [ *]*]!","compound-selector-list":"#","complex-selector":" [? ]*","complex-selector-list":"#","conic-gradient()":"conic-gradient( [from ]? [at ]? , )","contextual-alt-values":"[contextual|no-contextual]","content-distribution":"space-between|space-around|space-evenly|stretch","content-list":"[|contents|||||]+","content-position":"center|start|end|flex-start|flex-end","content-replacement":"","contrast()":"contrast( [] )","counter()":"counter( , ? )","counter-style":"|symbols( )","counter-style-name":"","counters()":"counters( , , ? )","cross-fade()":"cross-fade( , ? )","cubic-bezier-timing-function":"ease|ease-in|ease-out|ease-in-out|cubic-bezier( , , , )","deprecated-system-color":"ActiveBorder|ActiveCaption|AppWorkspace|Background|ButtonFace|ButtonHighlight|ButtonShadow|ButtonText|CaptionText|GrayText|Highlight|HighlightText|InactiveBorder|InactiveCaption|InactiveCaptionText|InfoBackground|InfoText|Menu|MenuText|Scrollbar|ThreeDDarkShadow|ThreeDFace|ThreeDHighlight|ThreeDLightShadow|ThreeDShadow|Window|WindowFrame|WindowText","discretionary-lig-values":"[discretionary-ligatures|no-discretionary-ligatures]","display-box":"contents|none","display-inside":"flow|flow-root|table|flex|grid|ruby","display-internal":"table-row-group|table-header-group|table-footer-group|table-row|table-cell|table-column-group|table-column|table-caption|ruby-base|ruby-text|ruby-base-container|ruby-text-container","display-legacy":"inline-block|inline-list-item|inline-table|inline-flex|inline-grid","display-listitem":"?&&[flow|flow-root]?&&list-item","display-outside":"block|inline|run-in","drop-shadow()":"drop-shadow( {2,3} ? )","east-asian-variant-values":"[jis78|jis83|jis90|jis04|simplified|traditional]","east-asian-width-values":"[full-width|proportional-width]","element()":"element( , [first|start|last|first-except]? )|element( )","ellipse()":"ellipse( [{2}]? [at ]? )","ending-shape":"circle|ellipse","env()":"env( , ? )","explicit-track-list":"[? ]+ ?","family-name":"|+","feature-tag-value":" [|on|off]?","feature-type":"@stylistic|@historical-forms|@styleset|@character-variant|@swash|@ornaments|@annotation","feature-value-block":" '{' '}'","feature-value-block-list":"+","feature-value-declaration":" : + ;","feature-value-declaration-list":"","feature-value-name":"","fill-rule":"nonzero|evenodd","filter-function":"|||||||||","filter-function-list":"[|]+","final-bg-layer":"<'background-color'>|||| [/ ]?||||||||","fit-content()":"fit-content( [|] )","fixed-breadth":"","fixed-repeat":"repeat( [] , [? ]+ ? )","fixed-size":"|minmax( , )|minmax( , )","font-stretch-absolute":"normal|ultra-condensed|extra-condensed|condensed|semi-condensed|semi-expanded|expanded|extra-expanded|ultra-expanded|","font-variant-css21":"[normal|small-caps]","font-weight-absolute":"normal|bold|","frequency-percentage":"|","general-enclosed":"[ )]|( )","generic-family":"serif|sans-serif|cursive|fantasy|monospace|-apple-system","generic-name":"serif|sans-serif|cursive|fantasy|monospace","geometry-box":"|fill-box|stroke-box|view-box",gradient:"|||||<-legacy-gradient>","grayscale()":"grayscale( )","grid-line":"auto||[&&?]|[span&&[||]]","historical-lig-values":"[historical-ligatures|no-historical-ligatures]","hsl()":"hsl( [/ ]? )|hsl( , , , ? )","hsla()":"hsla( [/ ]? )|hsla( , , , ? )",hue:"|","hue-rotate()":"hue-rotate( )",image:"||||||","image()":"image( ? [? , ?]! )","image-set()":"image-set( # )","image-set-option":"[|] [||type( )]","image-src":"|","image-tags":"ltr|rtl","inflexible-breadth":"||min-content|max-content|auto","inset()":"inset( {1,4} [round <'border-radius'>]? )","invert()":"invert( )","keyframes-name":"|","keyframe-block":"# { }","keyframe-block-list":"+","keyframe-selector":"from|to|","leader()":"leader( )","leader-type":"dotted|solid|space|","length-percentage":"|","line-names":"'[' * ']'","line-name-list":"[|]+","line-style":"none|hidden|dotted|dashed|solid|double|groove|ridge|inset|outset","line-width":"|thin|medium|thick","linear-color-hint":"","linear-color-stop":" ?","linear-gradient()":"linear-gradient( [|to ]? , )","mask-layer":"|| [/ ]?||||||[|no-clip]||||","mask-position":"[|left|center|right] [|top|center|bottom]?","mask-reference":"none||","mask-source":"","masking-mode":"alpha|luminance|match-source","matrix()":"matrix( #{6} )","matrix3d()":"matrix3d( #{16} )","max()":"max( # )","media-and":" [and ]+","media-condition":"|||","media-condition-without-or":"||","media-feature":"( [||] )","media-in-parens":"( )||","media-not":"not ","media-or":" [or ]+","media-query":"|[not|only]? [and ]?","media-query-list":"#","media-type":"","mf-boolean":"","mf-name":"","mf-plain":" : ","mf-range":" ['<'|'>']? '='? | ['<'|'>']? '='? | '<' '='? '<' '='? | '>' '='? '>' '='? ","mf-value":"|||","min()":"min( # )","minmax()":"minmax( [||min-content|max-content|auto] , [|||min-content|max-content|auto] )","named-color":"transparent|aliceblue|antiquewhite|aqua|aquamarine|azure|beige|bisque|black|blanchedalmond|blue|blueviolet|brown|burlywood|cadetblue|chartreuse|chocolate|coral|cornflowerblue|cornsilk|crimson|cyan|darkblue|darkcyan|darkgoldenrod|darkgray|darkgreen|darkgrey|darkkhaki|darkmagenta|darkolivegreen|darkorange|darkorchid|darkred|darksalmon|darkseagreen|darkslateblue|darkslategray|darkslategrey|darkturquoise|darkviolet|deeppink|deepskyblue|dimgray|dimgrey|dodgerblue|firebrick|floralwhite|forestgreen|fuchsia|gainsboro|ghostwhite|gold|goldenrod|gray|green|greenyellow|grey|honeydew|hotpink|indianred|indigo|ivory|khaki|lavender|lavenderblush|lawngreen|lemonchiffon|lightblue|lightcoral|lightcyan|lightgoldenrodyellow|lightgray|lightgreen|lightgrey|lightpink|lightsalmon|lightseagreen|lightskyblue|lightslategray|lightslategrey|lightsteelblue|lightyellow|lime|limegreen|linen|magenta|maroon|mediumaquamarine|mediumblue|mediumorchid|mediumpurple|mediumseagreen|mediumslateblue|mediumspringgreen|mediumturquoise|mediumvioletred|midnightblue|mintcream|mistyrose|moccasin|navajowhite|navy|oldlace|olive|olivedrab|orange|orangered|orchid|palegoldenrod|palegreen|paleturquoise|palevioletred|papayawhip|peachpuff|peru|pink|plum|powderblue|purple|rebeccapurple|red|rosybrown|royalblue|saddlebrown|salmon|sandybrown|seagreen|seashell|sienna|silver|skyblue|slateblue|slategray|slategrey|snow|springgreen|steelblue|tan|teal|thistle|tomato|turquoise|violet|wheat|white|whitesmoke|yellow|yellowgreen|<-non-standard-color>","namespace-prefix":"","ns-prefix":"[|'*']? '|'","number-percentage":"|","numeric-figure-values":"[lining-nums|oldstyle-nums]","numeric-fraction-values":"[diagonal-fractions|stacked-fractions]","numeric-spacing-values":"[proportional-nums|tabular-nums]",nth:"|even|odd","opacity()":"opacity( [] )","overflow-position":"unsafe|safe","outline-radius":"|","page-body":"? [; ]?| ","page-margin-box":" '{' '}'","page-margin-box-type":"@top-left-corner|@top-left|@top-center|@top-right|@top-right-corner|@bottom-left-corner|@bottom-left|@bottom-center|@bottom-right|@bottom-right-corner|@left-top|@left-middle|@left-bottom|@right-top|@right-middle|@right-bottom","page-selector-list":"[#]?","page-selector":"+| *","page-size":"A5|A4|A3|B5|B4|JIS-B5|JIS-B4|letter|legal|ledger","path()":"path( [ ,]? )","paint()":"paint( , ? )","perspective()":"perspective( )","polygon()":"polygon( ? , [ ]# )",position:"[[left|center|right]||[top|center|bottom]|[left|center|right|] [top|center|bottom|]?|[[left|right] ]&&[[top|bottom] ]]","pseudo-class-selector":"':' |':' ')'","pseudo-element-selector":"':' ","pseudo-page":": [left|right|first|blank]",quote:"open-quote|close-quote|no-open-quote|no-close-quote","radial-gradient()":"radial-gradient( [||]? [at ]? , )","relative-selector":"? ","relative-selector-list":"#","relative-size":"larger|smaller","repeat-style":"repeat-x|repeat-y|[repeat|space|round|no-repeat]{1,2}","repeating-linear-gradient()":"repeating-linear-gradient( [|to ]? , )","repeating-radial-gradient()":"repeating-radial-gradient( [||]? [at ]? , )","rgb()":"rgb( {3} [/ ]? )|rgb( {3} [/ ]? )|rgb( #{3} , ? )|rgb( #{3} , ? )","rgba()":"rgba( {3} [/ ]? )|rgba( {3} [/ ]? )|rgba( #{3} , ? )|rgba( #{3} , ? )","rotate()":"rotate( [|] )","rotate3d()":"rotate3d( , , , [|] )","rotateX()":"rotateX( [|] )","rotateY()":"rotateY( [|] )","rotateZ()":"rotateZ( [|] )","saturate()":"saturate( )","scale()":"scale( , ? )","scale3d()":"scale3d( , , )","scaleX()":"scaleX( )","scaleY()":"scaleY( )","scaleZ()":"scaleZ( )","self-position":"center|start|end|self-start|self-end|flex-start|flex-end","shape-radius":"|closest-side|farthest-side","skew()":"skew( [|] , [|]? )","skewX()":"skewX( [|] )","skewY()":"skewY( [|] )","sepia()":"sepia( )",shadow:"inset?&&{2,4}&&?","shadow-t":"[{2,3}&&?]",shape:"rect( , , , )|rect( )","shape-box":"|margin-box","side-or-corner":"[left|right]||[top|bottom]","single-animation":"