UNPKG

mhtml-to-html

Version:

JavaScript library for parsing MHTML files and converting them into single HTML files

34 lines (32 loc) 198 kB
// dist/csstree.esm.js from https://github.com/csstree/csstree/tree/b3fe3e026ce131aa559427162451a60792589730 /* * Copyright (C) 2016-2024 by Roman Dvornov * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var Ra=Object.create;var or=Object.defineProperty;var Fa=Object.getOwnPropertyDescriptor;var Ma=Object.getOwnPropertyNames;var Ba=Object.getPrototypeOf,_a=Object.prototype.hasOwnProperty;var Me=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),f=(e,t)=>{for(var r in t)or(e,r,{get:t[r],enumerable:!0})},Wa=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Ma(t))!_a.call(e,i)&&i!==r&&or(e,i,{get:()=>t[i],enumerable:!(n=Fa(t,i))||n.enumerable});return e};var qa=(e,t,r)=>(r=e!=null?Ra(Ba(e)):{},Wa(t||!e||!e.__esModule?or(r,"default",{value:e,enumerable:!0}):r,e));var So=Me(fr=>{var vo="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");fr.encode=function(e){if(0<=e&&e<vo.length)return vo[e];throw new TypeError("Must be between 0 and 63: "+e)};fr.decode=function(e){var t=65,r=90,n=97,i=122,o=48,s=57,u=43,c=47,a=26,l=52;return t<=e&&e<=r?e-t:n<=e&&e<=i?e-n+a:o<=e&&e<=s?e-o+l:e==u?62:e==c?63:-1}});var Eo=Me(br=>{var Co=So(),gr=5,To=1<<gr,Ao=To-1,Lo=To;function Za(e){return e<0?(-e<<1)+1:(e<<1)+0}function Ja(e){var t=(e&1)===1,r=e>>1;return t?-r:r}br.encode=function(t){var r="",n,i=Za(t);do n=i&Ao,i>>>=gr,i>0&&(n|=Lo),r+=Co.encode(n);while(i>0);return r};br.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=Co.decode(t.charCodeAt(r++)),c===-1)throw new Error("Invalid base64 digit: "+t.charAt(r-1));u=!!(c&Lo),c&=Ao,o=o+(c<<s),s+=gr}while(u);n.value=Ja(o),n.rest=r}});var Rt=Me(W=>{function el(e,t,r){if(t in e)return e[t];if(arguments.length===3)return r;throw new Error('"'+t+'" is a required argument.')}W.getArg=el;var zo=/^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.-]*)(?::(\d+))?(.*)$/,tl=/^data:.+\,.+$/;function lt(e){var t=e.match(zo);return t?{scheme:t[1],auth:t[2],host:t[3],port:t[4],path:t[5]}:null}W.urlParse=lt;function Ge(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}W.urlGenerate=Ge;var rl=32;function nl(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>rl&&t.pop(),o}}var xr=nl(function(t){var r=t,n=lt(t);if(n){if(!n.path)return t;r=n.path}for(var i=W.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<r.length&&r[u]==="/";)u++;for(var c,a=0,u=o.length-1;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,Ge(n)):r});W.normalize=xr;function Po(e,t){e===""&&(e="."),t===""&&(t=".");var r=lt(t),n=lt(e);if(n&&(e=n.path||"/"),r&&!r.scheme)return n&&(r.scheme=n.scheme),Ge(r);if(r||t.match(tl))return t;if(n&&!n.host&&!n.path)return n.host=t,Ge(n);var i=t.charAt(0)==="/"?t:xr(e.replace(/\/+$/,"")+"/"+t);return n?(n.path=i,Ge(n)):i}W.join=Po;W.isAbsolute=function(e){return e.charAt(0)==="/"||zo.test(e)};function il(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)}W.relative=il;var Io=function(){var e=Object.create(null);return!("__proto__"in e)}();function Do(e){return e}function ol(e){return No(e)?"$"+e:e}W.toSetString=Io?Do:ol;function sl(e){return No(e)?e.slice(1):e}W.fromSetString=Io?Do:sl;function No(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 al(e,t,r){var n=ke(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:ke(e.name,t.name)}W.compareByOriginalPositions=al;function ll(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:ke(e.name,t.name)}W.compareByOriginalPositionsNoSource=ll;function cl(e,t,r){var n=e.generatedLine-t.generatedLine;return n!==0||(n=e.generatedColumn-t.generatedColumn,n!==0||r)||(n=ke(e.source,t.source),n!==0)||(n=e.originalLine-t.originalLine,n!==0)||(n=e.originalColumn-t.originalColumn,n!==0)?n:ke(e.name,t.name)}W.compareByGeneratedPositionsDeflated=cl;function ul(e,t,r){var n=e.generatedColumn-t.generatedColumn;return n!==0||r||(n=ke(e.source,t.source),n!==0)||(n=e.originalLine-t.originalLine,n!==0)||(n=e.originalColumn-t.originalColumn,n!==0)?n:ke(e.name,t.name)}W.compareByGeneratedPositionsDeflatedNoLine=ul;function ke(e,t){return e===t?0:e===null?1:t===null?-1:e>t?1:-1}function pl(e,t){var r=e.generatedLine-t.generatedLine;return r!==0||(r=e.generatedColumn-t.generatedColumn,r!==0)||(r=ke(e.source,t.source),r!==0)||(r=e.originalLine-t.originalLine,r!==0)||(r=e.originalColumn-t.originalColumn,r!==0)?r:ke(e.name,t.name)}W.compareByGeneratedPositionsInflated=pl;function hl(e){return JSON.parse(e.replace(/^\)]}'[^\n]*\n/,""))}W.parseSourceMapInput=hl;function ml(e,t,r){if(t=t||"",e&&(e[e.length-1]!=="/"&&t[0]!=="/"&&(e+="/"),t=e+t),r){var n=lt(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=Po(Ge(n),t)}return xr(t)}W.computeSourceURL=ml});var Ro=Me(Oo=>{var yr=Rt(),kr=Object.prototype.hasOwnProperty,Ne=typeof Map<"u";function we(){this._array=[],this._set=Ne?new Map:Object.create(null)}we.fromArray=function(t,r){for(var n=new we,i=0,o=t.length;i<o;i++)n.add(t[i],r);return n};we.prototype.size=function(){return Ne?this._set.size:Object.getOwnPropertyNames(this._set).length};we.prototype.add=function(t,r){var n=Ne?t:yr.toSetString(t),i=Ne?this.has(t):kr.call(this._set,n),o=this._array.length;(!i||r)&&this._array.push(t),i||(Ne?this._set.set(t,o):this._set[n]=o)};we.prototype.has=function(t){if(Ne)return this._set.has(t);var r=yr.toSetString(t);return kr.call(this._set,r)};we.prototype.indexOf=function(t){if(Ne){var r=this._set.get(t);if(r>=0)return r}else{var n=yr.toSetString(t);if(kr.call(this._set,n))return this._set[n]}throw new Error('"'+t+'" is not in the set.')};we.prototype.at=function(t){if(t>=0&&t<this._array.length)return this._array[t];throw new Error("No element indexed by "+t)};we.prototype.toArray=function(){return this._array.slice()};Oo.ArraySet=we});var Bo=Me(Mo=>{var Fo=Rt();function dl(e,t){var r=e.generatedLine,n=t.generatedLine,i=e.generatedColumn,o=t.generatedColumn;return n>r||n==r&&o>=i||Fo.compareByGeneratedPositionsInflated(e,t)<=0}function Ft(){this._array=[],this._sorted=!0,this._last={generatedLine:-1,generatedColumn:0}}Ft.prototype.unsortedForEach=function(t,r){this._array.forEach(t,r)};Ft.prototype.add=function(t){dl(this._last,t)?(this._last=t,this._array.push(t)):(this._sorted=!1,this._array.push(t))};Ft.prototype.toArray=function(){return this._sorted||(this._array.sort(Fo.compareByGeneratedPositionsInflated),this._sorted=!0),this._array};Mo.MappingList=Ft});var Wo=Me(_o=>{var ct=Eo(),F=Rt(),Mt=Ro().ArraySet,fl=Bo().MappingList;function ne(e){e||(e={}),this._file=F.getArg(e,"file",null),this._sourceRoot=F.getArg(e,"sourceRoot",null),this._skipValidation=F.getArg(e,"skipValidation",!1),this._sources=new Mt,this._names=new Mt,this._mappings=new fl,this._sourcesContents=null}ne.prototype._version=3;ne.fromSourceMap=function(t){var r=t.sourceRoot,n=new ne({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=F.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=F.relative(r,i)),n._sources.has(o)||n._sources.add(o);var s=t.sourceContentFor(i);s!=null&&n.setSourceContent(i,s)}),n};ne.prototype.addMapping=function(t){var r=F.getArg(t,"generated"),n=F.getArg(t,"original",null),i=F.getArg(t,"source",null),o=F.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})};ne.prototype.setSourceContent=function(t,r){var n=t;this._sourceRoot!=null&&(n=F.relative(this._sourceRoot,n)),r!=null?(this._sourcesContents||(this._sourcesContents=Object.create(null)),this._sourcesContents[F.toSetString(n)]=r):this._sourcesContents&&(delete this._sourcesContents[F.toSetString(n)],Object.keys(this._sourcesContents).length===0&&(this._sourcesContents=null))};ne.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=F.relative(o,i));var s=new Mt,u=new Mt;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=F.join(n,c.source)),o!=null&&(c.source=F.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 p=c.name;p!=null&&!u.has(p)&&u.add(p)},this),this._sources=s,this._names=u,t.sources.forEach(function(c){var a=t.sourceContentFor(c);a!=null&&(n!=null&&(c=F.join(n,c)),o!=null&&(c=F.relative(o,c)),this.setSourceContent(c,a))},this)};ne.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}))}};ne.prototype._serializeMappings=function(){for(var t=0,r=1,n=0,i=0,o=0,s=0,u="",c,a,l,p,h=this._mappings.toArray(),d=0,g=h.length;d<g;d++){if(a=h[d],c="",a.generatedLine!==r)for(t=0;a.generatedLine!==r;)c+=";",r++;else if(d>0){if(!F.compareByGeneratedPositionsInflated(a,h[d-1]))continue;c+=","}c+=ct.encode(a.generatedColumn-t),t=a.generatedColumn,a.source!=null&&(p=this._sources.indexOf(a.source),c+=ct.encode(p-s),s=p,c+=ct.encode(a.originalLine-1-i),i=a.originalLine-1,c+=ct.encode(a.originalColumn-n),n=a.originalColumn,a.name!=null&&(l=this._names.indexOf(a.name),c+=ct.encode(l-o),o=l)),u+=c}return u};ne.prototype._generateSourcesContent=function(t,r){return t.map(function(n){if(!this._sourcesContents)return null;r!=null&&(n=F.relative(r,n));var i=F.toSetString(n);return Object.prototype.hasOwnProperty.call(this._sourcesContents,i)?this._sourcesContents[i]:null},this)};ne.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};ne.prototype.toString=function(){return JSON.stringify(this.toJSON())};_o.SourceMapGenerator=ne});var sr={};f(sr,{AtKeyword:()=>D,BadString:()=>Be,BadUrl:()=>H,CDC:()=>G,CDO:()=>ze,Colon:()=>B,Comma:()=>Y,Comment:()=>N,Delim:()=>v,Dimension:()=>k,EOF:()=>be,Function:()=>y,Hash:()=>A,Ident:()=>m,LeftCurlyBracket:()=>R,LeftParenthesis:()=>S,LeftSquareBracket:()=>X,Number:()=>b,Percentage:()=>P,RightCurlyBracket:()=>$,RightParenthesis:()=>x,RightSquareBracket:()=>Z,Semicolon:()=>_,String:()=>te,Url:()=>M,WhiteSpace:()=>L});var be=0,m=1,y=2,D=3,A=4,te=5,Be=6,M=7,H=8,v=9,b=10,P=11,k=12,L=13,ze=14,G=15,B=16,_=17,Y=18,X=19,Z=20,S=21,x=22,R=23,$=24,N=25;function O(e){return e>=48&&e<=57}function J(e){return O(e)||e>=65&&e<=70||e>=97&&e<=102}function Lt(e){return e>=65&&e<=90}function ja(e){return e>=97&&e<=122}function Ua(e){return Lt(e)||ja(e)}function Ha(e){return e>=128}function At(e){return Ua(e)||Ha(e)||e===95}function _e(e){return At(e)||O(e)||e===45}function Ga(e){return e>=0&&e<=8||e===11||e>=14&&e<=31||e===127}function tt(e){return e===10||e===13||e===12}function me(e){return tt(e)||e===32||e===9}function K(e,t){return!(e!==92||tt(t)||t===0)}function We(e,t,r){return e===45?At(t)||t===45||K(t,r):At(e)?!0:e===92?K(e,t):!1}function Et(e,t,r){return e===43||e===45?O(t)?2:t===46&&O(r)?3:0:e===46?O(t)?2:0:O(e)?1:0}function zt(e){return e===65279||e===65534?1:0}var ar=new Array(128),Ya=128,rt=130,lr=131,Pt=132,cr=133;for(let e=0;e<ar.length;e++)ar[e]=me(e)&&rt||O(e)&&lr||At(e)&&Pt||Ga(e)&&cr||e||Ya;function It(e){return e<128?ar[e]:Pt}function qe(e,t){return t<e.length?e.charCodeAt(t):0}function Dt(e,t,r){return r===13&&qe(e,t+1)===10?2:1}function xe(e,t,r){let n=e.charCodeAt(t);return Lt(n)&&(n=n|32),n===r}function ye(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),s=e.charCodeAt(i);if(Lt(s)&&(s=s|32),s!==o)return!1}return!0}function lo(e,t){for(;t>=0&&me(e.charCodeAt(t));t--);return t+1}function nt(e,t){for(;t<e.length&&me(e.charCodeAt(t));t++);return t}function ur(e,t){for(;t<e.length&&O(e.charCodeAt(t));t++);return t}function se(e,t){if(t+=2,J(qe(e,t-1))){for(let n=Math.min(e.length,t+5);t<n&&J(qe(e,t));t++);let r=qe(e,t);me(r)&&(t+=Dt(e,t,r))}return t}function it(e,t){for(;t<e.length;t++){let r=e.charCodeAt(t);if(!_e(r)){if(K(r,qe(e,t+1))){t=se(e,t)-1;continue}break}}return t}function Pe(e,t){let r=e.charCodeAt(t);if((r===43||r===45)&&(r=e.charCodeAt(t+=1)),O(r)&&(t=ur(e,t+1),r=e.charCodeAt(t)),r===46&&O(e.charCodeAt(t+1))&&(t+=2,t=ur(e,t)),xe(e,t,101)){let n=0;r=e.charCodeAt(t+1),(r===45||r===43)&&(n=1,r=e.charCodeAt(t+2)),O(r)&&(t=ur(e,t+1+n+1))}return t}function Nt(e,t){for(;t<e.length;t++){let r=e.charCodeAt(t);if(r===41){t++;break}K(r,qe(e,t+1))&&(t=se(e,t))}return t}function je(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 Ie=["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 Ue(e=null,t){return e===null||e.length<t?new Uint32Array(Math.max(t+1024,16384)):e}var co=10,Ka=12,uo=13;function po(e){let t=e.source,r=t.length,n=t.length>0?zt(t.charCodeAt(0)):0,i=Ue(e.lines,r),o=Ue(e.columns,r),s=e.startLine,u=e.startColumn;for(let c=n;c<r;c++){let a=t.charCodeAt(c);i[c]=s,o[c]=u++,(a===co||a===uo||a===Ka)&&(a===uo&&c+1<r&&t.charCodeAt(c+1)===co&&(c++,i[c]=s,o[c]=u),s++,u=1)}i[r]=s,o[r]=u,e.lines=i,e.columns=o,e.computed=!0}var ot=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||po(this),{source:r,offset:this.startOffset+t,line:this.lines[t],column:this.columns[t]}}getLocationRange(t,r,n){return this.computed||po(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 ae=16777215,le=24,at=1,Ot=2,Se=new Uint8Array(32);Se[2]=22;Se[21]=22;Se[19]=20;Se[23]=24;var ce=new Uint8Array(32);ce[2]=at;ce[21]=at;ce[19]=at;ce[23]=at;ce[22]=Ot;ce[20]=Ot;ce[24]=Ot;function ho(e,t,r){return e<t?t:e>r?r:e}var st=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=Ue(this.offsetAndType,t.length+1),o=Ue(this.balance,t.length+1),s=0,u=-1,c=0,a=t.length;this.offsetAndType=null,this.balance=null,o.fill(0),r(t,(l,p,h)=>{let d=s++;if(i[d]=l<<le|h,u===-1&&(u=p),o[d]=a,l===c){let g=o[a];o[a]=d,a=g,c=Se[i[g]>>le]}else this.isBlockOpenerTokenType(l)&&(a=d,c=Se[l])}),i[s]=0<<le|n,o[s]=s;for(let l=0;l<s;l++){let p=o[l];if(p<=l){let h=o[p];h!==l&&(o[l]=h)}else p>s&&(o[l]=s)}this.source=t,this.firstCharOffset=u===-1?0:u,this.tokenCount=s,this.offsetAndType=i,this.balance=o,this.reset(),this.next()}lookupType(t){return t+=this.tokenIndex,t<this.tokenCount?this.offsetAndType[t]>>le:0}lookupTypeNonSC(t){for(let r=this.tokenIndex;r<this.tokenCount;r++){let n=this.offsetAndType[r]>>le;if(n!==13&&n!==25&&t--===0)return n}return 0}lookupOffset(t){return t+=this.tokenIndex,t<this.tokenCount?this.offsetAndType[t-1]&ae:this.source.length}lookupOffsetNonSC(t){for(let r=this.tokenIndex;r<this.tokenCount;r++){let n=this.offsetAndType[r]>>le;if(n!==13&&n!==25&&t--===0)return r-this.tokenIndex}return 0}lookupValue(t,r){return t+=this.tokenIndex,t<this.tokenCount?ye(this.source,this.offsetAndType[t-1]&ae,this.offsetAndType[t]&ae,r):!1}getTokenStart(t){return t===this.tokenIndex?this.tokenStart:t>0?t<this.tokenCount?this.offsetAndType[t-1]&ae:this.offsetAndType[this.tokenCount]&ae:this.firstCharOffset}getTokenEnd(t){return t===this.tokenIndex?this.tokenEnd:this.offsetAndType[ho(t,0,this.tokenCount)]&ae}getTokenType(t){return t===this.tokenIndex?this.tokenType:this.offsetAndType[ho(t,0,this.tokenCount)]>>le}substrToCursor(t){return this.source.substring(t,this.tokenStart)}isBlockOpenerTokenType(t){return ce[t]===at}isBlockCloserTokenType(t){return ce[t]===Ot}getBlockTokenPairIndex(t){let r=this.getTokenType(t);if(ce[r]===1){let n=this.balance[t],i=this.getTokenType(n);return Se[r]===i?n:-1}else if(ce[r]===2){let n=this.balance[t],i=this.getTokenType(n);return Se[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]&ae,r=this.offsetAndType[r],this.tokenType=r>>le,this.tokenEnd=r&ae):(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>>le,this.tokenEnd=t&ae):(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;e:for(;n<this.tokenCount;n++){if(i=this.balance[n],i<t)break e;switch(o=n>0?this.offsetAndType[n-1]&ae:this.firstCharOffset,r(this.source.charCodeAt(o))){case 1:break e;case 2:n++;break e;default:this.isBlockOpenerTokenType(this.offsetAndType[n]>>le)&&(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],s=o&ae,u=o>>le;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:Ie[r],chunk:this.source.substring(n,i),balance:this.balance[o]}}),t}};function Ce(e,t){function r(p){return p<u?e.charCodeAt(p):0}function n(){if(a=Pe(e,a),We(r(a),r(a+1),r(a+2))){l=12,a=it(e,a);return}if(r(a)===37){l=11,a++;return}l=10}function i(){let p=a;if(a=it(e,a),ye(e,p,a,"url")&&r(a)===40){if(a=nt(e,a+1),r(a)===34||r(a)===39){l=2,a=p+4;return}s();return}if(r(a)===40){l=2,a++;return}l=1}function o(p){for(p||(p=r(a++)),l=5;a<e.length;a++){let h=e.charCodeAt(a);switch(It(h)){case p:a++;return;case rt:if(tt(h)){a+=Dt(e,a,h),l=6;return}break;case 92:if(a===e.length-1)break;let d=r(a+1);tt(d)?a+=Dt(e,a+1,d):K(h,d)&&(a=se(e,a)-1);break}}}function s(){for(l=7,a=nt(e,a);a<e.length;a++){let p=e.charCodeAt(a);switch(It(p)){case 41:a++;return;case rt:if(a=nt(e,a),r(a)===41||a>=e.length){a<e.length&&a++;return}a=Nt(e,a),l=8;return;case 34:case 39:case 40:case cr:a=Nt(e,a),l=8;return;case 92:if(K(p,r(a+1))){a=se(e,a)-1;break}a=Nt(e,a),l=8;return}}}e=String(e||"");let u=e.length,c=zt(r(0)),a=c,l;for(;a<u;){let p=e.charCodeAt(a);switch(It(p)){case rt:l=13,a=nt(e,a+1);break;case 34:o();break;case 35:_e(r(a+1))||K(r(a+1),r(a+2))?(l=4,a=it(e,a+1)):(l=9,a++);break;case 39:o();break;case 40:l=21,a++;break;case 41:l=22,a++;break;case 43:Et(p,r(a+1),r(a+2))?n():(l=9,a++);break;case 44:l=18,a++;break;case 45:Et(p,r(a+1),r(a+2))?n():r(a+1)===45&&r(a+2)===62?(l=15,a=a+3):We(p,r(a+1),r(a+2))?i():(l=9,a++);break;case 46:Et(p,r(a+1),r(a+2))?n():(l=9,a++);break;case 47:r(a+1)===42?(l=25,a=e.indexOf("*/",a+2),a=a===-1?e.length:a+2):(l=9,a++);break;case 58:l=16,a++;break;case 59:l=17,a++;break;case 60:r(a+1)===33&&r(a+2)===45&&r(a+3)===45?(l=14,a=a+4):(l=9,a++);break;case 64:We(r(a+1),r(a+2),r(a+3))?(l=3,a=it(e,a+1)):(l=9,a++);break;case 91:l=19,a++;break;case 92:K(p,r(a+1))?i():(l=9,a++);break;case 93:l=20,a++;break;case 123:l=23,a++;break;case 125:l=24,a++;break;case lr:n();break;case Pt:i();break;default:l=9,a++}t(l,c,c=a)}}var He=null,V=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 He!==null?(n=He,He=He.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=He,He=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,s;for(;i.next!==null;)s=i.next,i.next=s.next,o=t.call(n,o,s.data,s,this);return this.releaseCursor(),o}reduceRight(t,r,n=this){let i=this.allocateCursor(this.tail,null),o=r,s;for(;i.prev!==null;)s=i.prev,i.prev=s.prev,o=t.call(n,o,s.data,s,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 De(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 pr=100,mo=60,fo=" ";function go({source:e,line:t,column:r,baseLine:n,baseColumn:i},o){function s(g,ee){return a.slice(g,ee).map((j,w)=>String(g+w+1).padStart(h)+" |"+j).join(` `)}let u=` `.repeat(Math.max(n-1,0)),c=" ".repeat(Math.max(i-1,0)),a=(u+c+e).split(/\r\n?|\n|\f/),l=Math.max(1,t-o)-1,p=Math.min(t+o,a.length+1),h=Math.max(4,String(p).length)+1,d=0;r+=(fo.length-1)*(a[t-1].substr(0,r-1).match(/\t/g)||[]).length,r>pr&&(d=r-mo+3,r=mo-2);for(let g=l;g<=p;g++)g>=0&&g<a.length&&(a[g]=a[g].replace(/\t/g,fo),a[g]=(d>0&&a[g].length>d?"\u2026":"")+a[g].substr(d,pr-2)+(a[g].length>d+pr-1?"\u2026":""));return[s(l,t),new Array(r+h+2).join("-")+"^",s(t,p)].filter(Boolean).join(` `).replace(/^(\s+\d+\s+\|\n)+/,"").replace(/\n(\s+\d+\s+\|)+$/,"")}function hr(e,t,r,n,i,o=1,s=1){return Object.assign(De("SyntaxError",e),{source:t,offset:r,line:n,column:i,sourceFragment(c){return go({source:t,line:n,column:i,baseLine:o,baseColumn:s},isNaN(c)?0:c)},get formattedMessage(){return`Parse error: ${e} `+go({source:t,line:n,column:i,baseLine:o,baseColumn:s},2)}})}function bo(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 xo=()=>{},Va=33,Qa=35,mr=59,yo=123,ko=0;function Xa(e){return function(){return this[e]()}}function dr(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 $a(e){let t={context:Object.create(null),features:Object.assign(Object.create(null),e.features),scope:Object.assign(Object.create(null),e.scope),atrule:dr(e.atrule),pseudo:dr(e.pseudo),node:dr(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]=Xa(n);break}return{config:t,...t,...t.node}}function wo(e){let t="",r="<unknown>",n=!1,i=xo,o=!1,s=new ot,u=Object.assign(new st,$a(e||{}),{parseAtrulePrelude:!0,parseRulePrelude:!0,parseValue:!0,parseCustomProperty:!1,readSequence:bo,consumeUntilBalanceEnd:()=>0,consumeUntilLeftCurlyBracket(l){return l===yo?1:0},consumeUntilLeftCurlyBracketOrSemicolon(l){return l===yo||l===mr?1:0},consumeUntilExclamationMarkOrSemicolon(l){return l===Va||l===mr?1:0},consumeUntilSemicolonIncluded(l){return l===mr?2:0},createList(){return new V},createSingleNodeList(l){return new V().appendData(l)},getFirstListNode(l){return l&&l.first},getLastListNode(l){return l&&l.last},parseWithFallback(l,p){let h=this.tokenIndex;try{return l.call(this)}catch(d){if(o)throw d;this.skip(h-this.tokenIndex);let g=p.call(this);return o=!0,i(d,g),o=!1,g}},lookupNonWSType(l){let p;do if(p=this.lookupType(l++),p!==13&&p!==25)return p;while(p!==ko);return ko},charCodeAt(l){return l>=0&&l<t.length?t.charCodeAt(l):0},substring(l,p){return t.substring(l,p)},substrToCursor(l){return this.source.substring(l,this.tokenStart)},cmpChar(l,p){return xe(t,l,p)},cmpStr(l,p,h){return ye(t,l,p,h)},consume(l){let p=this.tokenStart;return this.eat(l),this.substrToCursor(p)},consumeFunctionName(){let l=t.substring(this.tokenStart,this.tokenEnd-1);return this.eat(2),l},consumeNumber(l){let p=t.substring(this.tokenStart,Pe(t,this.tokenStart));return this.eat(l),p},eat(l){if(this.tokenType!==l){let p=Ie[l].slice(0,-6).replace(/-/g," ").replace(/^./,g=>g.toUpperCase()),h=`${/[[\](){}]/.test(p)?`"${p}"`:p} is expected`,d=this.tokenStart;switch(l){case 1:this.tokenType===2||this.tokenType===7?(d=this.tokenEnd-1,h="Identifier is expected but function found"):h="Identifier is expected";break;case 4:this.isDelim(Qa)&&(this.next(),d++,h="Name is expected");break;case 11:this.tokenType===10&&(d=this.tokenEnd,h="Percent sign is expected");break}this.error(h,d)}this.next()},eatIdent(l){(this.tokenType!==1||this.lookupValue(0,l)===!1)&&this.error(`Identifier "${l}" is expected`),this.next()},eatDelim(l){this.isDelim(l)||this.error(`Delim "${String.fromCharCode(l)}" is expected`),this.next()},getLocation(l,p){return n?s.getLocationRange(l,p,r):null},getLocationFromList(l){if(n){let p=this.getFirstListNode(l),h=this.getLastListNode(l);return s.getLocationRange(p!==null?p.loc.start.offset-s.startOffset:this.tokenStart,h!==null?h.loc.end.offset-s.startOffset:this.tokenStart,r)}return null},error(l,p){let h=typeof p<"u"&&p<t.length?s.getLocation(p):this.eof?s.getLocation(lo(t,t.length-1)):s.getLocation(this.tokenStart);throw new hr(l||"Unexpected input",t,h.offset,h.line,h.column,s.startLine,s.startColumn)}}),c=()=>({filename:r,source:t,tokenCount:u.tokenCount,getTokenType:l=>u.getTokenType(l),getTokenTypeName:l=>Ie[u.getTokenType(l)],getTokenStart:l=>u.getTokenStart(l),getTokenEnd:l=>u.getTokenEnd(l),getTokenValue:l=>u.source.substring(u.getTokenStart(l),u.getTokenEnd(l)),substring:(l,p)=>u.source.substring(l,p),balance:u.balance.subarray(0,u.tokenCount+1),isBlockOpenerTokenType:u.isBlockOpenerTokenType,isBlockCloserTokenType:u.isBlockCloserTokenType,getBlockTokenPairIndex:l=>u.getBlockTokenPairIndex(l),getLocation:l=>s.getLocation(l,r),getRangeLocation:(l,p)=>s.getLocationRange(l,p,r)});return Object.assign(function(l,p){t=l,p=p||{},u.setSource(t,Ce),s.setSource(t,p.offset,p.line,p.column),r=p.filename||"<unknown>",n=!!p.positions,i=typeof p.onParseError=="function"?p.onParseError:xo,o=!1,u.parseAtrulePrelude="parseAtrulePrelude"in p?!!p.parseAtrulePrelude:!0,u.parseRulePrelude="parseRulePrelude"in p?!!p.parseRulePrelude:!0,u.parseValue="parseValue"in p?!!p.parseValue:!0,u.parseCustomProperty="parseCustomProperty"in p?!!p.parseCustomProperty:!1;let{context:h="default",onComment:d,onToken:g}=p;if(!(h in u.context))throw new Error("Unknown context `"+h+"`");Array.isArray(g)?u.forEachToken((j,w,T)=>{g.push({type:j,start:w,end:T})}):typeof g=="function"&&u.forEachToken(g.bind(c())),typeof d=="function"&&u.forEachToken((j,w,T)=>{if(j===25){let he=u.getLocation(w,T),z=ye(t,T-2,T,"*/")?t.slice(w+2,T-2):t.slice(w+2,T);d(z,he)}});let ee=u.context[h].call(u,p);return u.eof||u.error(),ee},{SyntaxError:hr,config:u.config})}var jo=qa(Wo(),1),qo=new Set(["Atrule","Selector","Declaration"]);function Uo(e){let t=new jo.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(h){if(h.loc&&h.loc.start&&qo.has(h.type)){let d=h.loc.start.line,g=h.loc.start.column-1;(n.line!==d||n.column!==g)&&(n.line=d,n.column=g,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:h.loc.source,original:n,generated:r}))}a.call(this,h),c&&qo.has(h.type)&&(i.line=s,i.column=u)};let l=e.emit;e.emit=function(h,d,g){for(let ee=0;ee<h.length;ee++)h.charCodeAt(ee)===10?(s++,u=0):u++;l(h,d,g)};let p=e.result;return e.result=function(){return c&&t.addMapping(o),{css:p(),map:t}},e}var Bt={};f(Bt,{safe:()=>vr,spec:()=>yl});var gl=43,bl=45,wr=(e,t)=>{if(e===9&&(e=t),typeof e=="string"){let r=e.charCodeAt(0);return r>127?32768:r<<8}return e},Ho=[[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],["/","*"]],xl=Ho.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 Go(e){let t=new Set(e.map(([r,n])=>wr(r)<<16|wr(n)));return function(r,n,i){let o=wr(n,i),s=i.charCodeAt(0);return(s===bl&&n!==1&&n!==2&&n!==15||s===gl?t.has(r<<16|s<<8):t.has(r<<16|o))&&this.emit(" ",13,!0),o}}var yl=Go(Ho),vr=Go(xl);var kl=92;function wl(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 vl(e){Ce(e,(t,r,n)=>{this.token(t,e.slice(r,n))})}function Yo(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,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:vr,token(c,a){o=this.tokenBefore(o,c,a),this.emit(a,c,!1),c===9&&a.charCodeAt(0)===kl&&this.emit(` `,13,!0)},emit(c){i+=c},result(){return i}};n&&(typeof n.decorator=="function"&&(s=n.decorator(s)),n.sourceMap&&(s=Uo(s)),n.mode in Bt&&(s.tokenBefore=Bt[n.mode]));let u={node:c=>s.node(c),children:wl,token:(c,a)=>s.token(c,a),tokenize:vl};return s.node(r),s.result()}}function Ko(e){return{fromPlainObject(t){return e(t,{enter(r){r.children&&!(r.children instanceof V)&&(r.children=new V().fromArray(r.children))}}),t},toPlainObject(t){return e(t,{leave(r){r.children&&r.children instanceof V&&(r.children=r.children.toArray())}}),t}}}var{hasOwnProperty:Sr}=Object.prototype,ut=function(){};function Vo(e){return typeof e=="function"?e:ut}function Qo(e,t){return function(r,n,i){r.type===t&&e.call(this,r,n,i)}}function Sl(e,t){let r=t.structure,n=[];for(let i in r){if(Sr.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 Cl(e){let t={};for(let r in e.node)if(Sr.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]=Sl(r,n)}return t}function Xo(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 p=o[l.name];if(!l.nullable||p){if(l.type==="list"){if(t?p.reduceRight(c,!1):p.reduce(c,!1))return!0}else if(u(p))return!0}}i&&(s[n]=a)}}function $o({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 Zo(e){let t=Cl(e),r={},n={},i=Symbol("break-walk"),o=Symbol("skip-node");for(let a in t)Sr.call(t,a)&&t[a]!==null&&(r[a]=Xo(t[a],!1),n[a]=Xo(t[a],!0));let s=$o(r),u=$o(n),c=function(a,l){function p(w,T,he){let z=h.call(j,w,T,he);return z===i?!0:z===o?!1:!!(g.hasOwnProperty(w.type)&&g[w.type](w,j,p,ee)||d.call(j,w,T,he)===i)}let h=ut,d=ut,g=r,ee=(w,T,he,z)=>w||p(T,he,z),j={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")h=l;else if(l&&(h=Vo(l.enter),d=Vo(l.leave),l.reverse&&(g=n),l.visit)){if(s.hasOwnProperty(l.visit))g=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(", ")+")");h=Qo(h,l.visit),d=Qo(d,l.visit)}if(h===ut&&d===ut)throw new Error("Neither `enter` nor `leave` walker handler is set or both aren't a function");p(a)};return c.break=i,c.skip=o,c.find=function(a,l){let p=null;return c(a,function(h,d,g){if(l.call(this,h,d,g))return p=h,i}),p},c.findLast=function(a,l){let p=null;return c(a,{reverse:!0,enter(h,d,g){if(l.call(this,h,d,g))return p=h,i}}),p},c.findAll=function(a,l){let p=[];return c(a,function(h,d,g){l.call(this,h,d,g)&&p.push(h)}),p},c}function Tl(e){return e}function Al(e){let{min:t,max:r,comma:n}=e;return t===0&&r===0?n?"#?":"*":t===0&&r===1?"?":t===1&&r===0?n?"#":"+":t===1&&r===1?"":(n?"#":"")+(t===r?"{"+t+"}":"{"+t+","+(r!==0?r:"")+"}")}function Ll(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 El(e,t,r,n){let i=e.combinator===" "||n?e.combinator:" "+e.combinator+" ",o=e.terms.map(s=>_t(s,t,r,n)).join(i);return e.explicit||r?(n||o[0]===","?"[":"[ ")+o+(n?"]":" ]"):o}function _t(e,t,r,n){let i;switch(e.type){case"Group":i=El(e,t,r,n)+(e.disallowEmpty?"!":"");break;case"Multiplier":return _t(e.term,t,r,n)+t(Al(e),e);case"Boolean":i="<boolean-expr["+_t(e.term,t,r,n)+"]>";break;case"Type":i="<"+e.name+(e.opts?t(Ll(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 Oe(e,t){let r=Tl,n=!1,i=!1;return typeof t=="function"?r=t:t&&(n=!!t.forceBraces,i=!!t.compact,typeof t.decorate=="function"&&(r=t.decorate)),_t(e,r,n,i)}var Jo={offset:0,line:1,column:1};function zl(e,t){let r=e.tokens,n=e.longestMatch,i=n<r.length&&r[n].node||null,o=i!==t?i:null,s=0,u=0,c=0,a="",l,p;for(let h=0;h<r.length;h++){let d=r[h].value;h===n&&(u=d.length,s=a.length),o!==null&&r[h].node===o&&(h<=n?c++:c=0),a+=d}return n===r.length||c>1?(l=Wt(o||t,"end")||pt(Jo,a),p=pt(l)):(l=Wt(o,"start")||pt(Wt(t,"start")||Jo,a.slice(0,s)),p=Wt(o,"end")||pt(l,a.substr(s,u))),{css:a,mismatchOffset:s,mismatchLength:u,start:l,end:p}}function Wt(e,t){let r=e&&e.loc&&e.loc[t];return r?"line"in r?pt(r):r:null}function pt({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 Ye=function(e,t){let r=De("SyntaxReferenceError",e+(t?" `"+t+"`":""));return r.reference=t,r},es=function(e,t,r,n){let i=De("SyntaxMatchError",e),{css:o,mismatchOffset:s,mismatchLength:u,start:c,end:a}=zl(n,r);return i.rawMessage=e,i.syntax=t?Oe(t):"<generic>",i.css=o,i.mismatchOffset=s,i.mismatchLength=u,i.message=e+` syntax: `+i.syntax+` value: `+(o||"<empty string>")+` --------`+new Array(i.mismatchOffset+1).join("-")+"^",Object.assign(i,c),i.loc={source:r&&r.loc&&r.loc.source||"<unknown>",start:c,end:a},i};var qt=new Map,Ke=new Map,jt=45,Ut=Pl,Cr=Il,Xd=Tr;function Ht(e,t){return t=t||0,e.length-t>=2&&e.charCodeAt(t)===jt&&e.charCodeAt(t+1)===jt}function Tr(e,t){if(t=t||0,e.length-t>=3&&e.charCodeAt(t)===jt&&e.charCodeAt(t+1)!==jt){let r=e.indexOf("-",t+2);if(r!==-1)return e.substring(t,r+1)}return""}function Pl(e){if(qt.has(e))return qt.get(e);let t=e.toLowerCase(),r=qt.get(t);if(r===void 0){let n=Ht(t,0),i=n?"":Tr(t,0);r=Object.freeze({basename:t.substr(i.length),name:t,prefix:i,vendor:i,custom:n})}return qt.set(e,r),r}function Il(e){if(Ke.has(e))return Ke.get(e);let t=e,r=e[0];r==="/"?r=e[1]==="/"?"//":"/":r!=="_"&&r!=="*"&&r!=="$"&&r!=="#"&&r!=="+"&&r!=="&"&&(r="");let n=Ht(t,r.length);if(!n&&(t=t.toLowerCase(),Ke.has(t))){let u=Ke.get(t);return Ke.set(e,u),u}let i=n?"":Tr(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 Ke.set(e,s),s}var Ve=["initial","inherit","unset","revert","revert-layer"];var mt=43,de=45,Ar=110,Qe=!0,Nl=!1;function Er(e,t){return e!==null&&e.type===9&&e.value.charCodeAt(0)===t}function ht(e,t,r){for(;e!==null&&(e.type===13||e.type===25);)e=r(++t);return t}function Te(e,t,r,n){if(!e)return 0;let i=e.value.charCodeAt(t);if(i===mt||i===de){if(r)return 0;t++}for(;t<e.value.length;t++)if(!O(e.value.charCodeAt(t)))return 0;return n+1}function Lr(e,t,r){let n=!1,i=ht(e,t,r);if(e=r(i),e===null)return t;if(e.type!==10)if(Er(e,mt)||Er(e,de)){if(n=!0,i=ht(r(++i),i,r),e=r(i),e===null||e.type!==10)return 0}else return t;if(!n){let o=e.value.charCodeAt(0);if(o!==mt&&o!==de)return 0}return Te(e,n?0:1,n,i)}function zr(e,t){let r=0;if(!e)return 0;if(e.type===10)return Te(e,0,Nl,r);if(e.type===1&&e.value.charCodeAt(0)===de){if(!xe(e.value,1,Ar))return 0;switch(e.value.length){case 2:return Lr(t(++r),r,t);case 3:return e.value.charCodeAt(2)!==de?0:(r=ht(t(++r),r,t),e=t(r),Te(e,0,Qe,r));default:return e.value.charCodeAt(2)!==de?0:Te(e,3,Qe,r)}}else if(e.type===1||Er(e,mt)&&t(r+1).type===1){if(e.type!==1&&(e=t(++r)),e===null||!xe(e.value,0,Ar))return 0;switch(e.value.length){case 1:return Lr(t(++r),r,t);case 2:return e.value.charCodeAt(1)!==de?0:(r=ht(t(++r),r,t),e=t(r),Te(e,0,Qe,r));default:return e.value.charCodeAt(1)!==de?0:Te(e,2,Qe,r)}}else if(e.type===12){let n=e.value.charCodeAt(0),i=n===mt||n===de?1:0,o=i;for(;o<e.value.length&&O(e.value.charCodeAt(o));o++);return o===i||!xe(e.value,o,Ar)?0:o+1===e.value.length?Lr(t(++r),r,t):e.value.charCodeAt(o+1)!==de?0:o+2===e.value.length?(r=ht(t(++r),r,t),e=t(r),Te(e,0,Qe,r)):Te(e,o+2,Qe,r)}return 0}var Ol=43,ts=45,rs=63,Rl=117;function Pr(e,t){return e!==null&&e.type===9&&e.value.charCodeAt(0)===t}function Fl(e,t){return e.value.charCodeAt(0)===t}function dt(e,t,r){let n=0;for(let i=t;i<e.value.length;i++){let o=e.value.charCodeAt(i);if(o===ts&&r&&n!==0)return dt(e,t+n+1,!1),6;if(!J(o)||++n>6)return 0}return n}function Gt(e,t,r){if(!e)return 0;for(;Pr(r(t),rs);){if(++e>6)return 0;t++}return t}function Ir(e,t){let r=0;if(e===null||e.type!==1||!xe(e.value,0,Rl)||(e=t(++r),e===null))return 0;if(Pr(e,Ol))return e=t(++r),e===null?0:e.type===1?Gt(dt(e,0,!0),++r,t):Pr(e,rs)?Gt(1,++r,t):0;if(e.type===10){let n=dt(e,1,!0);return n===0?0:(e=t(++r),e===null?r:e.type===12||e.type===10?!Fl(e,ts)||!dt(e,1,!1)?0:r+1:Gt(n,r,t))}return e.type===12?Gt(dt(e,1,!0),++r,t):0}var Ml=["calc(","-moz-calc(","-webkit-calc("],Dr=new Map([[2,22],[21,22],[19,20],[23,24]]);function ue(e,t){return t<e.length?e.charCodeAt(t):0}function ns(e,t){return ye(e,0,e.length,t)}function is(e,t){for(let r=0;r<t.length;r++)if(ns(e,t[r]))return!0;return!1}function os(e,t){return t!==e.length-2?!1:ue(e,t)===92&&O(ue(e,t+1))}function Yt(e,t,r){if(e&&e.type==="Range"){let n=Number(r!==void 0&&r!==t.length?t.substr(0,r):t);if(isNaN(n)||e.min!==null&&n<e.min&&typeof e.min!="string"||e.max!==null&&n>e.max&&typeof e.max!="string")return!0}return!1}function Bl(e,t){let r=0,n=[],i=0;e:do{switch(e.type){case 24:case 22:case 20:if(e.type!==r)break e;if(r=n.pop(),n.length===0){i++;break e}break;case 2:case 21:case 19:case 23:n.push(r),r=Dr.get(e.type);break}i++}while(e=t(i));return i}function ie(e){return function(t,r,n){return t===null?0:t.type===2&&is(t.value,Ml)?Bl(t,r):e(t,r,n)}}function I(e){return function(t){return t===null||t.type!==e?0:1}}function _l(e){if(e===null||e.type!==1)return 0;let t=e.value.toLowerCase();return is(t,Ve)||ns(t,"default")?0:1}function ss(e){return e===null||e.type!==1||ue(e.value,0)!==45||ue(e.value,1)!==45?0:1}function Wl(e){return!ss(e)||e.value==="--"?0:1}function ql(e){if(e===null||e.type!==4)return 0;let t=e.value.length;if(t!==4&&t!==5&&t!==7&&t!==9)return 0;for(let r=1;r<t;r++)if(!J(ue(e.value,r)))return 0;return 1}function jl(e){return e===null||e.type!==4||!We(ue(e.value,1),ue(e.value,2),ue(e.value,3))?0:1}function Ul(e,t){if(!e)return 0;let r=0,n=[],i=0;e:do{switch(e.type){case 6:case 8:break e;case 24:case 22:case 20:if(e.type!==r)break e;r=n.pop();break;case 17:if(r===0)break e;break;case 9:if(r===0&&e.value==="!")break e;break;case 2:case 21:case 19:case 23:n.push(r),r=Dr.get(e.type);break}i++}while(e=t(i));return i}function Hl(e,t){if(!e)return 0;let r=0,n=[],i=0;e:do{switch(e.type){case 6:case 8:break e;case 24:case 22:case 20:if(e.type!==r)break e;r=n.pop();break;case 2:case 21:case 19:case 23:n.push(r),r=Dr.get(e.type);break}i++}while(e=t(i));return i}function ve(e){return e&&(e=new Set(e)),function(t,r,n){if(t===null||t.type!==12)return 0;let i=Pe(t.value,0);if(e!==null){let o=t.value.indexOf("\\",i),s=o===-1||!os(t.value,o)?t.value.substr(i):t.value.substring(i,o);if(e.has(s.toLowerCase())===!1)return 0}return Yt(n,t.value,i)?0:1}}function Gl(e,t,r){return e===null||e.type!==11||Yt(r,e.value,e.value.length-1)?0:1}function as(e){return typeof e!="function"&&(e=function(){return 0}),function(t,r,n){return t!==null&&t.type===10&&Number(t.value)===0?1:e(t,r,n)}}function Yl(e,t,r){if(e===null)return 0;let n=Pe(e.value,0);return!(n===e.value.length)&&!os(e.value,n)||Yt(r,e.value,n)?0:1}function Kl(e,t,r){if(e===null||e.type!==10)return 0;let n=ue(e.value,0)===43||ue(e.value,0)===45?1:0;for(;n<e.value.length;n++)if(!O(ue(e.value,n)))return 0;return Yt(r,e.value,n)?0:1}var Vl={"ident-token":I(1),"function-token":I(2),"at-keyword-token":I(3),"hash-token":I(4),"string-token":I(5),"bad-string-token":I(6),"url-token":I(7),"bad-url-token":I(8),"delim-token":I(9),"number-token":I(10),"percentage-token":I(11),"dimension-token":I(12),"whitespace-token":I(13),"CDO-token":I(14),"CDC-token":I(15),"colon-token":I(16),"semicolon-token":I(17),"comma-token":I(18),"[-token":I(19),"]-token":I(20),"(-token":I(21),")-token":I(22),"{-token":I(23),"}-token":I(24)},Ql={string:I(5),ident:I(1),percentage:ie(Gl),zero:as(),number:ie(Yl),integer:ie(Kl),"custom-ident":_l,"dashed-ident":ss,"custom-property-name":Wl,"hex-color":ql,"id-selector":jl,"an-plus-b":zr,urange:Ir,"declaration-value":Ul,"any-value":Hl};function Xl(e){let{angle:t,decibel:r,frequency:n,flex:i,length:o,resolution:s,semitones:u,time:c}=e||{};return{dimension:ie(ve(null)),angle:ie(ve(t)),decibel:ie(ve(r)),frequency:ie(ve(n)),flex:ie(ve(i)),length:ie(as(ve(o))),resolution:ie(ve(s)),semitones:ie(ve(u)),time:ie(ve(c))}}function ls(e){return{...Vl,...Ql,...Xl(e)}}var Kt={};f(Kt,{angle:()=>Zl,decibel:()=>nc,flex:()=>rc,frequency:()=>ec,length:()=>$l,resolution:()=>tc,semitones:()=>ic,time:()=>Jl});var $l=["cm","mm","q","in","pt","pc","px","em","rem","ex","rex","cap","rcap","ch","rch","ic","ric","lh","rlh","vw","svw","lvw","dvw","vh","svh","lvh","dvh","vi","svi","lvi","dvi","vb","svb","lvb","dvb","vmin","svmin","lvmin","dvmin","vmax","svmax","lvmax","dvmax","cqw","cqh","cqi","cqb","cqmin","cqmax"],Zl=["deg","grad","rad","turn"],Jl=["s","ms"],ec=["hz","khz"],tc=["dpi","dpcm","dppx","x"],rc=["fr"],nc=["db"],ic=["st"];var ws={};f(ws,{SyntaxError:()=>Vt,generate:()=>Oe,parse:()=>Xe,walk:()=>Zt});function Vt(e,t,r){return Object.assign(De("SyntaxError",e),{input:t,offset:r,rawMe