@stacksjs/ts-css 0.3.8 → 0.3.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin/cli.js +1 -1
- package/dist/bin/cssx.js +28 -28
- package/dist/engine/index.js +12 -12
- package/dist/engine/types.d.ts +1 -0
- package/package.json +1 -1
package/dist/bin/cli.js
CHANGED
|
@@ -29,5 +29,5 @@ Received ${n}, cleaning up...`),e)try{await e()}catch(r){console.error("Error du
|
|
|
29
29
|
`)),this.enableDidYouMean){let t=[];for(let r of this.commands){if(r.displayName)t.push(r.displayName);if(r.aliasNames)t.push(...r.aliasNames)}let n=qe(e,t);if(n.length>0)console.log(J.yellow("Did you mean one of these?")),n.forEach((r)=>console.log(` ${J.dim("\u2022")} ${this.name} ${r}`)),console.log("")}console.log(J.dim("Run"),`${this.name} --help`,J.dim("to see all available commands")),V.exit(1)}async parse(e=Ue,t={}){let{run:n=!0,exitOnError:r=!1}=t;if(r)try{return await this.parse(e,{run:n})}catch(o){throw this.handleUsageError(o),o}if(this.rawArgs=e,!this.name)this.name=e[1]?Tt(e[1]):"cli";let s=!0,i=e.slice(2),l=i[0];if(l&&!l.startsWith("-")){for(let o of this.commands)if(o.isMatched(l)){let c=this.mri(i,o);s=!1;let h={...c,args:c.args.slice(1)};this.setParsedInfo(h,o,l),this.emit(`command:${l}`,o);break}if(s){let o=i[1];if(o&&!o.startsWith("-")){let c=`${l}:${o}`;for(let h of this.commands)if(h.isMatched(c)){let u=this.mri(i,h);s=!1;let d={...u,args:u.args.slice(2)};this.setParsedInfo(d,h,c),this.emit(`command:${c}`,h);break}}}}if(s){for(let o of this.commands)if(o.name===""){s=!1;let c=this.mri(i,o);this.setParsedInfo(c,o),this.emit("command:!",o);break}}if(s){let o=this.mri(e.slice(2));this.setParsedInfo(o)}if(this.options.verbose)this.isVerbose=!0;if(this.options.quiet)this.isQuiet=!0;if(this.options.debug)this.isDebug=!0;if(this.options.noInteraction||this.options.interaction===!1)this.isNoInteraction=!0;if(this.options.env)this.environment=String(this.options.env);if(this.options.dryRun)this.isDryRun=!0;if(this.options.force)this.isForce=!0;if(this.options.noEmoji||this.options.emoji===!1)this.useEmoji=!1;if(this.options.theme)this.theme=String(this.options.theme);if(this.options.noCache||this.options.cache===!1)this.isNoCache=!0;if(this.options.help&&this.showHelpOnExit)this.outputHelp(),n=!1,this.unsetMatchedCommand();if(this.options.version&&this.showVersionOnExit&&this.matchedCommandName==null)this.outputVersion(),n=!1,this.unsetMatchedCommand();let a={args:this.args,options:this.options};if(n)await this.runMatchedCommand();if(!this.matchedCommand&&this.args[0]){if(this.emit("command:*"),!(this.listenerCount("command:*")>0))this.showCommandNotFound(this.args[0])}return a}mri(e,t){let n=[...this.globalCommand.options,...t?t.options:[]],r=xt(n),s=[],i=e.indexOf("--");if(i>-1)s=e.slice(i+1),e=e.slice(0,i);let l=Et(e,r),a={_:l._};for(let d of Object.keys(l))if(d!=="_")a[Z(d)]=l[d];let o=a._,c={"--":s},h=t&&t.config.ignoreOptionDefaultValue?t.config.ignoreOptionDefaultValue:this.globalCommand.config.ignoreOptionDefaultValue,u=Object.create(null);for(let d of n){if(!h&&d.config.default!==void 0)for(let b of d.names)c[b]=d.config.default;if(Array.isArray(d.config.type)){if(u[d.name]===void 0)u[d.name]={shouldTransform:!0,transformFunction:d.config.type[0]}}}for(let d of Object.keys(a))if(d!=="_"){let b=d.split(".");St(c,b,a[d]),kt(c,u)}for(let d of n){if(!d.variadic)continue;for(let b of d.names){let p=c[b];if(p===void 0||Array.isArray(p))continue;if(d.config.default!==void 0&&p===d.config.default)continue;c[b]=[p]}}return{args:o,options:c}}async run(e=Ue){return this.parse(e,{run:!0,exitOnError:!0})}handleUsageError(e){if(!At(e)||e.isUsageError===!1)return;let t=e.message||"command-line error",n=this.name?`${this.name}: `:"",r=/--help/.test(t)?"":e.usage?`
|
|
30
30
|
Usage: ${e.usage}`:`
|
|
31
31
|
Run \`${this.name??"cli"} --help\` for usage.`;V.stderr.write(`${n}${t}${r}
|
|
32
|
-
`),V.exit(e.exitCode??2)}async runMatchedCommand(){let{args:e,options:t,matchedCommand:n}=this;if(!n||!n.commandAction)return;n.checkUnknownOptions(),n.checkOptionValue(),n.checkRequiredArgs();let r=[];n.args.forEach((a,o)=>{if(a.variadic)r.push(e.slice(o));else r.push(e[o])}),r.push(t);let s={command:n,args:r,options:t};for(let a of n.beforeHooks)await a(s);let i,l=async()=>{let a=n.commandAction.apply(this,r);if(a instanceof Promise)i=await a;else i=a;return i};if(n.middleware.length>0){let a=0,o=async()=>{if(a<n.middleware.length){let c=n.middleware[a++];await c({...s,next:o})}else await l()};await o()}else await l();for(let a of n.afterHooks)await a(s);return i}removeSignalHandlers(){if(!this.signalHandlersSet)return this;return V.removeAllListeners("SIGINT"),V.removeAllListeners("SIGTERM"),this.signalHandlersSet=!1,this}destroy(){this.removeSignalHandlers(),this.commands=[],this.rawArgs=[],this.args=[],this.options={},this.matchedCommand=void 0,this.matchedCommandName=void 0,this.removeAllListeners()}}class Ke{cache;enabled;cleanupInterval=null;hits=0;misses=0;constructor(){this.cache=new Map,this.enabled=!0,this.startCleanupInterval()}startCleanupInterval(){if(this.cleanupInterval)return;this.cleanupInterval=setInterval(()=>{this.cleanup()},30000),this.cleanupInterval.unref()}stopCleanup(){if(this.cleanupInterval)clearInterval(this.cleanupInterval),this.cleanupInterval=null}isEnabled(){return this.enabled}get(e){if(!this.enabled){this.misses++;return}let t=this.cache.get(e);if(!t){this.misses++;return}if(Date.now()-t.timestamp>t.ttl){this.cache.delete(e),this.misses++;return}return this.hits++,t.value}set(e,t,n=5000){if(!this.enabled)return;this.cache.set(e,{value:t,timestamp:Date.now(),ttl:n})}has(e){if(!this.enabled)return!1;let t=this.cache.get(e);if(!t)return!1;if(Date.now()-t.timestamp>t.ttl)return this.cache.delete(e),!1;return!0}delete(e){this.cache.delete(e)}clear(){this.cache.clear()}disable(){this.enabled=!1,this.clear()}enable(){this.enabled=!0}stats(){return{size:this.cache.size,enabled:this.enabled,hits:this.hits,misses:this.misses}}resetStats(){this.hits=0,this.misses=0}keys(){return Array.from(this.cache.keys())}cleanup(){let e=Date.now();for(let[t,n]of this.cache.entries())if(e-n.timestamp>n.ttl)this.cache.delete(t)}destroy(){this.stopCleanup(),this.clear(),this.resetStats()}}var hr=new Ke;function Bt(){if("FORCE_COLOR"in X.env)return X.env.FORCE_COLOR!=="0";if("NO_COLOR"in X.env||X.env.TERM==="dumb")return!1;if(X.platform==="win32")return!0;return ze.isatty(1)&&ze.isatty(2)}var Ye=Bt();function v(e,t){if(!Ye)return(n)=>n;return(n)=>e+n+t}var Dt=v("\x1B[0m","\x1B[0m"),Mt=v("\x1B[31m","\x1B[39m"),Vt=v("\x1B[32m","\x1B[39m"),jt=v("\x1B[33m","\x1B[39m"),Wt=v("\x1B[34m","\x1B[39m"),Ft=v("\x1B[35m","\x1B[39m"),Ut=v("\x1B[36m","\x1B[39m"),zt=v("\x1B[37m","\x1B[39m"),Ht=v("\x1B[90m","\x1B[39m"),qt=v("\x1B[1m","\x1B[22m"),Gt=v("\x1B[3m","\x1B[23m"),Kt=v("\x1B[4m","\x1B[24m"),Yt=v("\x1B[2m","\x1B[22m"),Qt=v("\x1B[7m","\x1B[27m"),Jt=v("\x1B[8m","\x1B[28m"),Xt=v("\x1B[9m","\x1B[29m"),Zt=v("\x1B[41m","\x1B[49m"),en=v("\x1B[42m","\x1B[49m"),tn=v("\x1B[43m","\x1B[49m"),nn=v("\x1B[44m","\x1B[49m"),rn=v("\x1B[45m","\x1B[49m"),sn=v("\x1B[46m","\x1B[49m"),on=v("\x1B[47m","\x1B[49m"),an=Ye,ln={reset:Dt,red:Mt,green:Vt,yellow:jt,blue:Wt,magenta:Ft,cyan:Ut,white:zt,gray:Ht,bold:qt,italic:Gt,underline:Kt,dim:Yt,inverse:Qt,hidden:Jt,strikethrough:Xt,bgRed:Zt,bgGreen:en,bgYellow:tn,bgBlue:nn,bgMagenta:rn,bgCyan:sn,bgWhite:on,isColorSupported:an},cn=ln,hn=["up","down","left","right","space","enter","cancel"],yr={actions:new Set(hn),aliases:new Map([["k","up"],["j","down"],["h","left"],["l","right"],["\x03","cancel"],["escape","cancel"]]),messages:{cancel:"Canceled",error:"Something went wrong"}};var br=un.platform.startsWith("win"),Cr=Symbol("clapp:cancel");var dn=Nt();var C=(e,t)=>dn?e:t,vr=C("\u25C6","*"),wr=C("\u25A0","x"),$r=C("\u25B2","x"),xr=C("\u25C7","o"),Sr=C("\u250C","T"),mn=C("\u2502","|"),kr=C("\u2514","\u2014"),Tr=C("\u25CF",">"),Ar=C("\u25CB"," "),Nr=C("\u25FB","[\u2022]"),Ir=C("\u25FC","[+]"),Er=C("\u25FB","[ ]"),Or=C("\u25AA","\u2022"),Lr=C("\u2500","-"),Pr=C("\u256E","+"),Rr=C("\u251C","+"),_r=C("\u256F","+"),Br=C("\u25CF","\u2022"),Dr=C("\u25C6","*"),Mr=C("\u25B2","!"),Vr=C("\u25A0","x");var jr={light:C("\u2500","-"),heavy:C("\u2501","="),block:C("\u2588","#")};function fn(){return`${cn.gray(mn)} `}var Wr=fn();class Qe{configPath;config=null;events=[];retryCount=0;maxRetries=3;retryDelayMs=1000;constructor(){let e=He.homedir(),t=fe.join(e,".config","clapp");this.configPath=fe.join(t,"telemetry.json")}async isEnabled(){if(W.env.DO_NOT_TRACK==="1"||W.env.DO_NOT_TRACK==="true")return!1;if(W.env.NO_TELEMETRY==="1"||W.env.NO_TELEMETRY==="true")return!1;return(await this.loadConfig()).enabled}async enable(){let e=await this.loadConfig();if(e.enabled=!0,!e.userId)e.userId=this.generateUserId();await this.saveConfig(e)}async disable(){let e=await this.loadConfig();e.enabled=!1,await this.saveConfig(e)}async track(e,t){if(!await this.isEnabled())return;let r={event:e,...t,timestamp:Date.now(),platform:He.platform(),nodeVersion:W.version};if(this.events.push(r),this.events.length>=10)await this.send()}async trackCommand(e,t){await this.track("command",{command:e,duration:t})}async trackError(e,t){await this.track("error",{error:e,command:t})}async send(){if(!await this.isEnabled()||this.events.length===0)return!0;try{this.events=[],this.retryCount=0;let t=await this.loadConfig();return t.lastSent=Date.now(),await this.saveConfig(t),!0}catch{if(this.retryCount<this.maxRetries){this.retryCount++;let t=this.retryDelayMs*2**(this.retryCount-1);return await this.sleep(t),this.send()}return this.events=[],this.retryCount=0,!1}}async flush(){if(this.events.length===0)return!0;return this.send()}sleep(e){return new Promise((t)=>setTimeout(t,e))}async status(){let e=await this.loadConfig();return{enabled:e.enabled,doNotTrack:W.env.DO_NOT_TRACK==="1"||W.env.DO_NOT_TRACK==="true",eventsQueued:this.events.length,lastSent:e.lastSent}}async loadConfig(){if(this.config)return this.config;try{if(pn(this.configPath)){let e=await me.readFile(this.configPath,"utf-8");return this.config=JSON.parse(e),this.config}}catch{}return this.config={enabled:!1},this.config}async saveConfig(e){this.config=e;try{let t=fe.dirname(this.configPath);await me.mkdir(t,{recursive:!0}),await me.writeFile(this.configPath,JSON.stringify(e,null,2),"utf-8")}catch{}}generateUserId(){let e=Math.random().toString(36).substring(2,15),t=Date.now().toString(36);return`${e}-${t}`}}var Gr=new Qe;import{existsSync as er,readFileSync as tr}from"fs";function B(e){return{prev:null,next:null,data:e}}class L{head=null;tail=null;cursors=[];allocateCursor(e,t){let n={prev:e,next:t};return this.cursors.push(n),n}releaseCursor(){this.cursors.pop()}updateCursors(e,t,n,r){for(let s of this.cursors){if(s.prev===e)s.prev=t;if(s.next===n)s.next=r}}static createItem(e){return B(e)}createItem(e){return B(e)}get isEmpty(){return this.head===null}get first(){return this.head?.data??null}get last(){return this.tail?.data??null}*[Symbol.iterator](){for(let e=this.head;e!=null;e=e.next)yield e.data}fromArray(e){let t=null;this.head=null;for(let n of e){let r=B(n);if(r.prev=t,t)t.next=r;else this.head=r;t=r}return this.tail=t,this}toArray(){let e=[];for(let t=this.head;t!=null;t=t.next)e.push(t.data);return e}toJSON(){return this.toArray()}forEach(e,t){let n=this.allocateCursor(null,this.head);while(n.next!==null){let r=n.next;n.prev=r,n.next=r.next,e.call(t,r.data,r,this)}this.releaseCursor()}forEachRight(e,t){let n=this.allocateCursor(this.tail,null);while(n.prev!==null){let r=n.prev;n.next=r,n.prev=r.prev,e.call(t,r.data,r,this)}this.releaseCursor()}reduce(e,t){let n=t,r=0;for(let s=this.head;s!=null;s=s.next)n=e(n,s.data,r++,this);return n}some(e){let t=0;for(let n=this.head;n!=null;n=n.next)if(e(n.data,t++,this))return!0;return!1}map(e){let t=new L,n=null,r=0;for(let s=this.head;s!=null;s=s.next){let i=B(e(s.data,r++,this));if(i.prev=n,n)n.next=i;else t.head=i;n=i}return t.tail=n,t}filter(e){let t=new L,n=null,r=0;for(let s=this.head;s!=null;s=s.next)if(e(s.data,r++,this)){let i=B(s.data);if(i.prev=n,n)n.next=i;else t.head=i;n=i}return t.tail=n,t}clear(){let e=this.head;while(e){let t=e.next;e.prev=null,e.next=null,e=t}this.head=null,this.tail=null}copy(){let e=new L,t=null;for(let n=this.head;n!=null;n=n.next){let r=B(n.data);if(r.prev=t,t)t.next=r;else e.head=r;t=r}return e.tail=t,e}prepend(e){return this.insert(e,this.head)}prependData(e){return this.insert(B(e),this.head)}append(e){return this.insert(e,null)}appendData(e){return this.insert(B(e),null)}insert(e,t=null){if(t!=null)if(this.updateCursors(t.prev,e,t,e),t.prev===null){if(this.head!==t)throw Error("before doesn't belong to list");this.head=e,t.prev=e,e.next=t,this.updateCursors(null,e,null,null)}else t.prev.next=e,e.prev=t.prev,t.prev=e,e.next=t;else if(this.updateCursors(this.tail,e,null,e),this.tail!==null)this.tail.next=e,e.prev=this.tail,this.tail=e;else this.head=e,this.tail=e;return this}insertData(e,t=null){return this.insert(B(e),t)}remove(e){if(this.updateCursors(e,e.prev,e,e.next),e.prev!==null)e.prev.next=e.next;else if(this.head===e)this.head=e.next;else throw Error("item doesn't belong to list");if(e.next!==null)e.next.prev=e.prev;else if(this.tail===e)this.tail=e.prev;else throw Error("item doesn't belong to list");return e.prev=null,e.next=null,e}push(e){this.insert(B(e),null)}pop(){if(this.tail===null)return null;return this.remove(this.tail)}unshift(e){this.prependData(e)}shift(){if(this.head===null)return null;return this.remove(this.head)}prependList(e){return this.insertList(e,this.head)}appendList(e){return this.insertList(e,null)}insertList(e,t=null){if(e.head===null)return this;if(t!==null){if(this.updateCursors(t.prev,e.tail,t,e.head),t.prev!==null)t.prev.next=e.head,e.head.prev=t.prev;else this.head=e.head;t.prev=e.tail,e.tail.next=t}else{if(this.updateCursors(this.tail,e.tail,null,e.head),this.tail!==null)this.tail.next=e.head,e.head.prev=this.tail;else this.head=e.head;this.tail=e.tail}return e.head=null,e.tail=null,this}replace(e,t){if(t instanceof L)this.insertList(t,e),this.remove(e);else this.insert(t,e),this.remove(e)}}function k(e){switch(e.type){case"StyleSheet":return O(e.children,"");case"Rule":return`${k(e.prelude)}{${k(e.block)}}`;case"Block":return gn(e.children);case"Atrule":{let t=`@${e.name}`;if(e.prelude){let n=k(e.prelude);if(n)t+=` ${n}`}if(e.block)t+=`{${k(e.block)}}`;else t+=";";return t}case"AtrulePrelude":return O(e.children,"");case"SelectorList":return O(e.children,",");case"Selector":return O(e.children,"");case"TypeSelector":return e.name;case"IdSelector":return`#${e.name}`;case"ClassSelector":return`.${e.name}`;case"NestingSelector":return"&";case"AttributeSelector":{let t=`[${e.name.name}`;if(e.matcher&&e.value)if(t+=e.matcher,e.value.type==="String")t+=`"${ve(e.value.value)}"`;else t+=e.value.name;if(e.flags)t+=` ${e.flags}`;return t+="]",t}case"PseudoClassSelector":return e.children?`:${e.name}(${O(e.children,"")})`:`:${e.name}`;case"PseudoElementSelector":return e.children?`::${e.name}(${O(e.children,"")})`:`::${e.name}`;case"Combinator":return e.name===" "?" ":e.name;case"Declaration":return`${e.property}:${k(e.value)}${e.important?"!important":""}`;case"DeclarationList":return O(e.children,";");case"Value":return O(e.children,"");case"Identifier":return e.name;case"Number":return e.value;case"Percentage":return`${e.value}%`;case"Dimension":return e.value+e.unit;case"String":return`"${ve(e.value)}"`;case"Url":return/[\s"'()\\\u0000-\u001F\u007F]/.test(e.value)?`url("${ve(e.value)}")`:`url(${e.value})`;case"Hash":return`#${e.name}`;case"Operator":return e.value;case"Function":return`${e.name}(${O(e.children,"")})`;case"Parentheses":return`(${O(e.children,"")})`;case"Brackets":return`[${O(e.children,"")}]`;case"Raw":return e.value;case"Comment":return e.value.startsWith("!")?`/*${e.value}*/`:"";case"WhiteSpace":return" ";case"CDO":return"<!--";case"CDC":return"-->";case"AnPlusB":{let t=e.a??"",n=e.b??"";if(t&&n){let r=Number(n);return`${t==="1"?"":t==="-1"?"-":t}n${r>=0?`+${n}`:n}`}if(t)return`${t==="1"?"":t==="-1"?"-":t}n`;return n}case"Ratio":return`${e.left.value}/${e.right.value}`;case"UnicodeRange":return e.value;case"Nth":return e.selector?`${k(e.nth)} of ${k(e.selector)}`:k(e.nth);case"MediaQueryList":return O(e.children,",");case"MediaQuery":return O(e.children,"");case"MediaFeature":{let t=`(${e.name}`;if(e.value)t+=`:${k(e.value)}`;return t+=")",t}}return""}function O(e,t){let n="",r=!0,s=null,i=e.head;while(i!=null){let l=i.data;if(l.type==="WhiteSpace"){let o=i.next?i.next.data:null;if(Je(s)||Je(o)){i=i.next;continue}}let a=k(l);if(!a){i=i.next;continue}if(!r&&t&&!bn(s))n+=t;r=!1,n+=a,s=l,i=i.next}return n}function gn(e){let t="",n=null,r=e.head;while(r!=null){let s=r.data,i=k(s);if(!i){r=r.next;continue}if(n&&yn(n,s))t+=";";t+=i,n=s,r=r.next}return t}function yn(e,t){return e.type==="Declaration"&&t.type!=="Comment"}function Je(e){if(!e||e.type!=="Operator")return!1;let t=e.value;return t===":"||t===","||t==="/"}function bn(e){if(!e)return!1;return e.type==="Operator"||e.type==="Combinator"}function ve(e){let t="";for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);if(r===92)t+="\\\\";else if(r===34)t+="\\\"";else if(r<32||r===127){let s=r.toString(16),i=n+1<e.length?e.charCodeAt(n+1):-1,l=i===32||i===9||i===10||i===12||i===13||i>=48&&i<=57||i>=65&&i<=70||i>=97&&i<=102;t+=`\\${s}${l?" ":""}`}else t+=e[n]}return t}var U=(()=>{let e=new Uint8Array(128);for(let t=0;t<128;t++){let n=0;if(t===32||t===9||t===10||t===12||t===13)n|=1;if(t>=48&&t<=57)n|=2;if(t>=48&&t<=57||t>=65&&t<=70||t>=97&&t<=102)n|=4;if(t>=65&&t<=90||t>=97&&t<=122||t===95)n|=8;if(t===10||t===12||t===13)n|=16;e[t]=n}return e})();function P(e){return e<128&&(U[e]&2)!==0}function te(e){return e<128&&(U[e]&4)!==0}function Xe(e){return e>=128||e<128&&(U[e]&8)!==0}function Cn(e){return e===45||e>=128||e<128&&(U[e]&10)!==0}function vn(e){return e>=0&&e<=8||e===11||e>=14&&e<=31||e===127}function $e(e){return e<128&&(U[e]&16)!==0}function M(e){return e<128&&(U[e]&1)!==0}function F(e,t){if(e!==92)return!1;if($e(t))return!1;return!0}function we(e,t,n){if(e===45)return Xe(t)||t===45||F(t,n);if(Xe(e))return!0;if(e===92)return F(e,t);return!1}function wn(e,t,n){if(e===43||e===45){if(P(t))return!0;if(t===46&&P(n))return!0;return!1}if(e===46)return P(t);return P(e)}class ie{source;offset=0;types;starts;ends;count=0;_tokens=null;_lineStarts=null;constructor(e){this.source=e;let t=Math.max(64,Math.ceil(e.length/3));this.types=new Uint8Array(t),this.starts=new Uint32Array(t),this.ends=new Uint32Array(t),this.tokenize()}get lineStarts(){if(this._lineStarts==null)this._lineStarts=$n(this.source);return this._lineStarts}get tokens(){if(this._tokens!=null)return this._tokens;let e=Array.from({length:this.count});for(let t=0;t<this.count;t++)e[t]={type:this.types[t],start:this.starts[t],end:this.ends[t]};return this._tokens=e,e}addToken(e,t,n){if(this.count>=this.types.length)this.grow();this.types[this.count]=e,this.starts[this.count]=t,this.ends[this.count]=n,this.count++}grow(){let t=this.types.length*2,n=new Uint8Array(t);n.set(this.types),this.types=n;let r=new Uint32Array(t);r.set(this.starts),this.starts=r;let s=new Uint32Array(t);s.set(this.ends),this.ends=s}tokenize(){let e=this.source,t=0,n=e.length;while(t<n){let r=e.charCodeAt(t);if(r===47&&e.charCodeAt(t+1)===42){let l=t;t+=2;while(t<n&&!(e.charCodeAt(t)===42&&e.charCodeAt(t+1)===47))t++;t=t<n?t+2:n,this.addToken(25,l,t);continue}if(M(r)){let l=t;while(t<n&&M(e.charCodeAt(t)))t++;this.addToken(13,l,t);continue}if(r===34||r===39){t=this.consumeString(r,t);continue}if(r===35){if(t+1<n&&(Cn(e.charCodeAt(t+1))||F(e.charCodeAt(t+1),e.charCodeAt(t+2)))){let l=t;t++,t=this.consumeName(t),this.addToken(4,l,t);continue}this.addToken(9,t,t+1),t++;continue}switch(r){case 40:this.addToken(21,t,t+1),t++;continue;case 41:this.addToken(22,t,t+1),t++;continue;case 91:this.addToken(19,t,t+1),t++;continue;case 93:this.addToken(20,t,t+1),t++;continue;case 123:this.addToken(23,t,t+1),t++;continue;case 125:this.addToken(24,t,t+1),t++;continue;case 44:this.addToken(18,t,t+1),t++;continue;case 58:this.addToken(16,t,t+1),t++;continue;case 59:this.addToken(17,t,t+1),t++;continue}if(r===60&&e.startsWith("!--",t+1)){this.addToken(14,t,t+4),t+=4;continue}if(r===45&&e.startsWith("->",t+1)){this.addToken(15,t,t+3),t+=3;continue}if(r===64){let l=e.charCodeAt(t+1),a=e.charCodeAt(t+2),o=e.charCodeAt(t+3);if(we(l,a,o)){let c=t;t++,t=this.consumeName(t),this.addToken(3,c,t);continue}this.addToken(9,t,t+1),t++;continue}let s=e.charCodeAt(t+1),i=e.charCodeAt(t+2);if(wn(r,s,i)){t=this.consumeNumeric(t);continue}if(we(r,s,i)){t=this.consumeIdentLike(t);continue}if(r===92){if(F(r,s)){t=this.consumeIdentLike(t);continue}this.addToken(9,t,t+1),t++;continue}this.addToken(9,t,t+1),t++}this.addToken(0,n,n)}consumeString(e,t){let n=this.source,r=n.length,s=t+1;while(s<r){let i=n.charCodeAt(s);if(i===e)return s++,this.addToken(5,t,s),s;if($e(i))return this.addToken(6,t,s),s;if(i===92){let l=n.charCodeAt(s+1);if($e(l)){s+=2;continue}if(s+1<r){s=this.consumeEscapeSkip(s+1);continue}}s++}return this.addToken(5,t,s),s}consumeEscapeSkip(e){let t=this.source;if(e>=t.length)return e;let n=t.charCodeAt(e);if(te(n)){let r=1;e++;while(r<6&&e<t.length&&te(t.charCodeAt(e)))e++,r++;if(e<t.length&&M(t.charCodeAt(e)))e++;return e}return e+1}consumeName(e){let t=this.source,n=t.length,r=e;while(r<n){let s=t.charCodeAt(r);if(s<128&&(U[s]&10)!==0){r++;continue}if(s===45){r++;continue}if(s>=128){r++;continue}if(s===92&&F(s,t.charCodeAt(r+1))){r=this.consumeEscapeSkip(r+1);continue}break}return r}consumeNumber(e){let t=this.source,n=e;if(t.charCodeAt(n)===43||t.charCodeAt(n)===45)n++;while(n<t.length&&P(t.charCodeAt(n)))n++;if(t.charCodeAt(n)===46&&P(t.charCodeAt(n+1))){n+=2;while(n<t.length&&P(t.charCodeAt(n)))n++}let r=t.charCodeAt(n);if(r===69||r===101){let s=t.charCodeAt(n+1),i=t.charCodeAt(n+2);if(P(s)){n+=2;while(n<t.length&&P(t.charCodeAt(n)))n++}else if((s===43||s===45)&&P(i)){n+=3;while(n<t.length&&P(t.charCodeAt(n)))n++}}return n}consumeNumeric(e){let t=this.source,n=this.consumeNumber(e),r=t.charCodeAt(n),s=t.charCodeAt(n+1),i=t.charCodeAt(n+2);if(we(r,s,i)){let l=this.consumeName(n);return this.addToken(12,e,l),l}if(r===37)return this.addToken(11,e,n+1),n+1;return this.addToken(10,e,n),n}consumeIdentLike(e){let t=this.source,n=this.consumeName(e),r=t.charCodeAt(n);if(r===40&&n-e===3){let s=t.charCodeAt(e)|32,i=t.charCodeAt(e+1)|32,l=t.charCodeAt(e+2)|32;if(s===117&&i===114&&l===108){let a=n+1;while(a<t.length&&M(t.charCodeAt(a)))a++;let o=t.charCodeAt(a);if(o===34||o===39)return this.addToken(2,e,n+1),n+1;return this.consumeUrl(e,n)}}if(r===40)return this.addToken(2,e,n+1),n+1;return this.addToken(1,e,n),n}consumeUrl(e,t){let n=this.source,r=n.length,s=t+1;while(s<r&&M(n.charCodeAt(s)))s++;while(s<r){let i=n.charCodeAt(s);if(i===41)return s++,this.addToken(7,e,s),s;if(M(i)){let l=s;while(s<r&&M(n.charCodeAt(s)))s++;if(s>=r)return this.addToken(7,e,s),s;if(n.charCodeAt(s)===41)return s++,this.addToken(7,e,s),s;return this.consumeBadUrl(e,l)}if(i===34||i===39||i===40||vn(i))return this.consumeBadUrl(e,s);if(i===92){if(F(i,n.charCodeAt(s+1))){s=this.consumeEscapeSkip(s+1);continue}return this.consumeBadUrl(e,s)}s++}return this.addToken(7,e,s),s}consumeBadUrl(e,t){let n=this.source,r=t;while(r<n.length){let s=n.charCodeAt(r);if(s===41){r++;break}if(s===92&&F(s,n.charCodeAt(r+1))){r=this.consumeEscapeSkip(r+1);continue}r++}return this.addToken(8,e,r),r}locate(e){let t=this.lineStarts,n=0,r=t.length-1;while(n<r){let i=n+r+1>>1;if(t[i]<=e)n=i;else r=i-1}let s=t[n];return{line:n+1,column:e-s+1}}}function $n(e){let t=[0],n=e.length;for(let r=0;r<n;r++){let s=e.charCodeAt(r);if(s===10)t.push(r+1);else if(s===13){if(e.charCodeAt(r+1)!==10)t.push(r+1)}}return t}function xe(e,t,n){for(let r=t;r<n;r++)if(e.charCodeAt(r)===92)return xn(e,t,n,r);return e.slice(t,n)}function xn(e,t,n,r){let s=e.slice(t,r),i=r;while(i<n){if(e.charCodeAt(i)!==92){s+=e[i],i++;continue}if(i+1>=n){i++;continue}let a=e.charCodeAt(i+1);if(a===10){i+=2;continue}if(a===13){i+=e.charCodeAt(i+2)===10?3:2;continue}if(te(a)){let o=i+1,c="";while(c.length<6&&o<n&&te(e.charCodeAt(o)))c+=e[o],o++;let h=Number.parseInt(c,16);if(o<n&&M(e.charCodeAt(o)))o++;s+=h===0||h>=55296&&h<=57343||h>1114111?String.fromCodePoint(65533):String.fromCodePoint(h),i=o;continue}s+=e[i+1],i+=2}return s}function Se(e,t,n){for(let r=t;r<n;r++)if(e.charCodeAt(r)===92)return Sn(e,t,n,r);return e.slice(t,n)}function Sn(e,t,n,r){let s=e.slice(t,r),i=r;while(i<n){if(e.charCodeAt(i)!==92){s+=e[i],i++;continue}let a=i+1,o="";while(o.length<6&&a<n&&te(e.charCodeAt(a)))o+=e[a],a++;if(o.length>0){let c=Number.parseInt(o,16);if(a<n&&M(e.charCodeAt(a)))a++;s+=c===0||c>=55296&&c<=57343||c>1114111?String.fromCodePoint(65533):String.fromCodePoint(c),i=a;continue}if(a<n){s+=e[a],i=a+1;continue}s+=String.fromCodePoint(65533),i=a}return s}function it(e,t){let n=new ie(e);return{source:e,types:n.types,starts:n.starts,ends:n.ends,count:n.count,end:n.count,pos:0,positions:t.positions??!1,filename:t.filename,parseValue:t.parseValue??!0,parseAtrulePrelude:t.parseAtrulePrelude??!0,parseCustomProperty:t.parseCustomProperty??!1,parseRulePrelude:t.parseRulePrelude??!0,onParseError:t.onParseError,tokenizer:n}}function m(e){return e.pos<e.end?e.types[e.pos]:0}function f(e){let t=e.pos;if(t>=e.end)return{type:0,start:e.starts[t]??e.source.length,end:e.ends[t]??e.source.length};return{type:e.types[t],start:e.starts[t],end:e.ends[t]}}function g(e){let t=e.pos++;if(t>=e.end)return{type:0,start:e.starts[t]??e.source.length,end:e.ends[t]??e.source.length};return{type:e.types[t],start:e.starts[t],end:e.ends[t]}}function D(e,t){return e.source.slice(t.start,t.end)}function R(e){let{types:t,end:n}=e;while(e.pos<n){let r=t[e.pos];if(r===13||r===25)e.pos++;else break}}function Ze(e){let{types:t,end:n}=e;while(e.pos<n&&t[e.pos]===13)e.pos++}function y(e,t,n){if(!e.positions)return null;let r=e.tokenizer.locate(t.start),s=e.tokenizer.locate(n.end);return{source:e.filename??"<unknown>",start:{offset:t.start,line:r.line,column:r.column},end:{offset:n.end,line:s.line,column:s.column}}}function ot(e){if(!e.positions)return null;let t=f(e),n=e.tokenizer.locate(t.start);return{source:e.filename??"<unknown>",start:{offset:t.start,line:n.line,column:n.column},end:{offset:t.start,line:n.line,column:n.column}}}function oe(e,t,n,r){return{type:"Raw",value:e,loc:y(r,t,n)}}function N(){return new L}function ke(e,t,n,r){if(e.onParseError){let{line:s,column:i}=e.tokenizer.locate(n.start),l=SyntaxError(`${e.filename??"<input>"}:${s}:${i}: ${t}`);l.line=s,l.column=i,l.offset=n.start,e.onParseError(l,r)}return r}function z(e,t={}){let n=it(e,t);switch(t.context??"stylesheet"){case"stylesheet":return nt(n);case"atrule":return le(n)??et(n);case"atrulePrelude":return Nn(n);case"mediaQuery":case"mediaQueryList":return tt(n);case"rule":return Ae(n);case"selectorList":return Ee(n);case"selector":return ut(n);case"block":return Ne(n);case"declarationList":return On(n);case"declaration":return Ie(n)??et(n);case"value":return Ln(n);case"raw":return tt(n);default:return nt(n)}}function et(e){return{type:"StyleSheet",children:N(),loc:ot(e)}}function tt(e){let t=f(e),n=t;while(m(e)!==0)n=g(e);return{type:"Raw",value:e.source.slice(t.start,n.end),loc:y(e,t,n)}}function nt(e){let t=f(e),n=N(),{types:r,end:s}=e;while(e.pos<s){let a=r[e.pos];if(a===13){e.pos++;continue}if(a===25){let h={type:25,start:e.starts[e.pos],end:e.ends[e.pos]},u=Te(e,h);e.pos++,n.appendData(u);continue}if(a===0)break;if(a===14||a===15){e.pos++;continue}if(a===3){let h=le(e);if(h)n.appendData(h);continue}if(a===24){e.pos++;continue}let o=e.pos,c=Ae(e);if(n.appendData(c),e.pos===o)e.pos++}let i=e.end-1,l=i>=0?{type:e.types[i],start:e.starts[i],end:e.ends[i]}:{type:0,start:0,end:0};return{type:"StyleSheet",children:n,loc:y(e,t,l)}}function Te(e,t){return{type:"Comment",value:e.source.slice(t.start+2,t.end-2),loc:y(e,t,t)}}function le(e){let t=f(e);if(t.type!==3)return null;e.pos++;let n=ae(e.source,t.start+1,t.end);R(e);let r=e.pos,s=f(e),{types:i,end:l}=e,a=r,o=r;while(a<l){let u=i[a];if(u===0||u===17||u===23)break;if(u!==13&&u!==25)o=a+1;a++}let c=null;if(o>r){let u=e.starts[r],d=e.ends[o-1],b={type:i[o-1],start:e.starts[o-1],end:d},p=e.source.slice(u,d).trim();if(p.length>0)if(e.parseAtrulePrelude)try{let _=e.end;e.end=o,e.pos=r;let T=N();while(m(e)!==0){let K=H(e);if(K)T.appendData(K)}if(lt(T),e.end=_,e.pos=a,T.isEmpty)c=oe(p,s,b,e);else c={type:"AtrulePrelude",children:T,loc:null}}catch(_){let T=oe(p,s,b,e);ke(e,`Failed to parse @${n} prelude: ${_.message}`,s,T),c=T,e.pos=a}else c=oe(p,s,b,e),e.pos=a;else e.pos=a}else e.pos=a;let h=null;if(m(e)===17)g(e);else if(m(e)===23)h=Ne(e,An.has(n));return{type:"Atrule",name:n,prelude:c,block:h,loc:y(e,t,f(e))}}var Tn=new Set(["is","not","where","has","matches","-moz-any","-webkit-any"]),An=new Set(["media","supports","document","layer","container","scope","starting-style","-moz-document","keyframes","-webkit-keyframes","-moz-keyframes","-o-keyframes"]);function Nn(e){let t=f(e),n=N();while(m(e)!==0){if(f(e).type===13){e.pos++;continue}let s=H(e);if(s)n.appendData(s)}return{type:"AtrulePrelude",children:n,loc:y(e,t,f(e))}}function Ae(e){let t=f(e),n;if(e.parseRulePrelude)n=Ee(e);else{let s=f(e),i=s;while(m(e)!==0&&m(e)!==23)i=g(e);let l=e.source.slice(s.start,i.end).trim();n=oe(l,s,i,e)}let r=Ne(e,!0);return{type:"Rule",prelude:n,block:r,loc:y(e,t,f(e))}}function Ne(e,t=!1){let n=f(e);if(m(e)!==23)return{type:"Block",children:N(),loc:ot(e)};e.pos++;let r=N(),{types:s,end:i}=e;while(e.pos<i){let l=s[e.pos];if(l===24||l===0)break;if(l===13){e.pos++;continue}if(l===25){let o={type:25,start:e.starts[e.pos],end:e.ends[e.pos]};e.pos++,r.appendData(Te(e,o));continue}if(l===3){let o=le(e);if(o)r.appendData(o);continue}if(t&&In(e,En)){let o=Ae(e);r.appendData(o);continue}let a=Ie(e);if(a)r.appendData(a);if(e.pos<i&&s[e.pos]===17)e.pos++}if(m(e)===24)e.pos++;return{type:"Block",children:r,loc:y(e,n,f(e))}}function In(e,t){let n=e.pos,r=t(e);return e.pos=n,r}function En(e){let{types:t,end:n}=e;while(e.pos<n){let r=t[e.pos];if(r===23)return!0;if(r===17||r===24||r===0)return!1;e.pos++}return!1}function On(e){let t=f(e),n=N();while(m(e)!==0&&m(e)!==24){let r=f(e);if(r.type===13){e.pos++;continue}if(r.type===25){n.appendData(Te(e,g(e)));continue}if(r.type===17){e.pos++;continue}if(r.type===3){let i=le(e);if(i)n.appendData(i);continue}let s=Ie(e);if(s)n.appendData(s);if(m(e)===17)g(e)}return{type:"DeclarationList",children:n,loc:y(e,t,f(e))}}function Ie(e){R(e);let t=f(e);if(t.type!==1&&t.type!==4&&!(t.type===9&&e.source[t.start]==="*"&&e.source[t.start+1]===" "))if(t.type===9&&e.source[t.start]==="*")e.pos++;else{ke(e,"Expected property name",t,{type:"Raw",value:"",loc:null});let{types:I,end:E}=e;while(e.pos<E){let S=I[e.pos];if(S===0||S===17||S===24)break;e.pos++}return null}let n=e.starts[e.pos],r=e.ends[e.pos];e.pos++;let s=e.source.slice(n,r);if(Ze(e),m(e)!==16){ke(e,`Expected ':' after property "${s}"`,f(e),{type:"Raw",value:"",loc:null});let{types:I,end:E}=e;while(e.pos<E){let S=I[e.pos];if(S===0||S===17||S===24)break;e.pos++}return null}e.pos++,Ze(e);let{types:i,starts:l,end:a,pos:o}=e,c=o,h=o,u=-1,d=-1;while(c<a){let I=i[c];if(I===0||I===17||I===24)break;if(I===9&&e.source.charCodeAt(l[c])===33){let E=c+1;while(E<a&&i[E]===13)E++;if(E<a&&i[E]===1){let S=l[E];if(e.ends[E]-S===9&&(e.source.charCodeAt(S)|32)===105&&(e.source.charCodeAt(S+1)|32)===109&&(e.source.charCodeAt(S+2)|32)===112&&(e.source.charCodeAt(S+3)|32)===111&&(e.source.charCodeAt(S+4)|32)===114&&(e.source.charCodeAt(S+5)|32)===116&&(e.source.charCodeAt(S+6)|32)===97&&(e.source.charCodeAt(S+7)|32)===110&&(e.source.charCodeAt(S+8)|32)===116){d=c,u=E,c=E+1;continue}}}if(I!==13&&I!==25)h=c+1;c++}let b=h,p=u>=0?{type:1,start:l[u],end:e.ends[u]}:null,_=s.startsWith("--"),T,K=l[o],Me=b>o?e.ends[b-1]:K,he={type:i[o],start:K,end:e.ends[o]},Ve=b>o?{type:i[b-1],start:l[b-1],end:Me}:he;if(_&&!e.parseCustomProperty||!e.parseValue)T={type:"Raw",value:e.source.slice(K,Me).trim(),loc:y(e,he,Ve)};else if(b===o)T={type:"Value",children:N(),loc:y(e,he,Ve)};else{let I=e.end;e.end=b,e.pos=o,T=at(e),e.end=I}return e.pos=c,{type:"Declaration",property:s,important:p?!0:!1,value:T,loc:y(e,t,f(e))}}function Ln(e){return at(e)}function at(e){let t=f(e),n=N();while(m(e)!==0&&m(e)!==17&&m(e)!==24&&m(e)!==22&&m(e)!==20){let r=H(e);if(r)n.appendData(r)}return ct(n),{type:"Value",children:n,loc:y(e,t,f(e))}}function lt(e){for(let t of e)if("children"in t&&t.children instanceof L)lt(t.children);ct(e)}function ct(e){let t=e.head;while(t){if(t.data.type==="Number"){let n=t.next;while(n&&n.data.type==="WhiteSpace")n=n.next;if(n&&n.data.type==="Operator"&&n.data.value==="/"){let r=n.next;while(r&&r.data.type==="WhiteSpace")r=r.next;if(r&&r.data.type==="Number"){let s={type:"Ratio",left:t.data,right:r.data,loc:null},i=t.next;while(i&&i!==r.next){let l=i.next;e.remove(i),i=l}e.replace(t,e.createItem(s)),t=e.head;continue}}}t=t.next}}function H(e){let t=e.pos;if(t>=e.end)return null;let n=e.types[t],r=e.starts[t],s=e.ends[t],i=e.source;switch(n){case 13:return e.pos++,e.positions?{type:"WhiteSpace",value:" ",loc:A(e,r,s)}:{type:"WhiteSpace",value:" ",loc:null};case 25:return e.pos++,{type:"Comment",value:i.slice(r+2,s-2),loc:e.positions?A(e,r,s):null};case 10:return e.pos++,{type:"Number",value:i.slice(r,s),loc:e.positions?A(e,r,s):null};case 11:return e.pos++,{type:"Percentage",value:i.slice(r,s-1),loc:e.positions?A(e,r,s):null};case 12:{e.pos++;let l=r,a=i.charCodeAt(l);if(a===43||a===45)l++;let o=!1;while(l<s){let h=i.charCodeAt(l);if(h>=48&&h<=57){l++;continue}if(h===46&&!o){o=!0,l++;continue}break}let c=i.charCodeAt(l);if(c===69||c===101){let h=l+1,u=i.charCodeAt(h);if(u===43||u===45)h++;let d=!1;while(h<s){let b=i.charCodeAt(h);if(b>=48&&b<=57){h++,d=!0;continue}break}if(d)l=h}return{type:"Dimension",value:i.slice(r,l),unit:i.slice(l,s),loc:e.positions?A(e,r,s):null}}case 1:return e.pos++,{type:"Identifier",name:Se(i,r,s),loc:e.positions?A(e,r,s):null};case 5:{e.pos++;let l=r+1,o=s-r>=2&&i.charCodeAt(s-1)===i.charCodeAt(r)?s-1:s;return{type:"String",value:xe(i,l,o),loc:e.positions?A(e,r,s):null}}case 7:{e.pos++;let l=r+4;while(l<s&&rt(i.charCodeAt(l)))l++;let a=s;if(a>l&&i.charCodeAt(a-1)===41)a--;while(a>l&&rt(i.charCodeAt(a-1)))a--;let o;if(a-l>=2){let c=i.charCodeAt(l),h=i.charCodeAt(a-1);if((c===34||c===39)&&c===h)o=i.slice(l+1,a-1);else o=i.slice(l,a)}else o=i.slice(l,a);return{type:"Url",value:o,loc:e.positions?A(e,r,s):null}}case 4:return e.pos++,{type:"Hash",name:i.slice(r+1,s),loc:e.positions?A(e,r,s):null};case 2:return Rn(e);case 21:return _n(e);case 18:return e.pos++,{type:"Operator",value:",",loc:e.positions?A(e,r,s):null};case 16:return e.pos++,{type:"Operator",value:":",loc:e.positions?A(e,r,s):null};case 9:{e.pos++;let l=i.charCodeAt(r),a=i[r];if(Pn(l))return{type:"Operator",value:a,loc:e.positions?A(e,r,s):null};return{type:"Identifier",name:a,loc:e.positions?A(e,r,s):null}}case 19:{e.pos++;let l=N();while(m(e)!==0&&m(e)!==20){let o=H(e);if(o)l.appendData(o)}let a=e.pos<e.end?e.ends[e.pos]:s;if(m(e)===20)e.pos++;return{type:"Brackets",children:l,loc:e.positions?A(e,r,a):null}}case 3:case 23:case 24:case 22:case 20:case 17:case 0:case 14:case 15:case 6:case 8:return e.pos++,{type:"Raw",value:i.slice(r,s),loc:e.positions?A(e,r,s):null}}return e.pos++,null}function rt(e){return e===32||e===9||e===10||e===12||e===13}function Pn(e){return e===47||e===43||e===45||e===42||e===61||e===62||e===60||e===126||e===124||e===36||e===94||e===33||e===38}function ae(e,t,n){for(let r=t;r<n;r++){let s=e.charCodeAt(r);if(s>=65&&s<=90)return e.slice(t,n).toLowerCase()}return e.slice(t,n)}function A(e,t,n){let r=e.tokenizer.locate(t),s=e.tokenizer.locate(n);return{source:e.filename??"<unknown>",start:{offset:t,line:r.line,column:r.column},end:{offset:n,line:s.line,column:s.column}}}function Rn(e){let t=g(e),n=ae(e.source,t.start,t.end-1),r=N();while(m(e)!==0&&m(e)!==22){let s=H(e);if(s)r.appendData(s)}if(m(e)===22)g(e);if(n==="url"){for(let s=r.head;s!=null;s=s.next)if(s.data.type==="String")return{type:"Url",value:s.data.value,loc:y(e,t,f(e))}}return{type:"Function",name:n,children:r,loc:y(e,t,f(e))}}function _n(e){let t=g(e),n=N();while(m(e)!==0&&m(e)!==22){let r=H(e);if(r)n.appendData(r)}if(m(e)===22)g(e);return{type:"Parentheses",children:n,loc:y(e,t,f(e))}}function Ee(e){let t=f(e),n=N();while(m(e)!==0){if(R(e),m(e)===0||m(e)===23)break;let r=ut(e);if(r.children.head!==null)n.appendData(r);if(R(e),m(e)===18){g(e);continue}break}return{type:"SelectorList",children:n,loc:y(e,t,f(e))}}function ut(e){let t=f(e),n=N(),r=!0;while(m(e)!==0&&m(e)!==18&&m(e)!==23){let s=f(e);if(s.type===13){if(g(e),!r&&m(e)!==0&&m(e)!==18&&m(e)!==23&&!st(e)&&!Bn(e)){let l={type:"Combinator",name:" ",loc:y(e,s,s)};n.appendData(l),r=!0}continue}if(s.type===9&&e.source.charCodeAt(s.start)===124&&e.types[e.pos+1]===9&&e.source.charCodeAt(e.starts[e.pos+1])===124){let l=f(e);g(e);let a=g(e),o={type:"Combinator",name:"||",loc:y(e,l,a)};n.appendData(o),r=!0,R(e);continue}if(st(e)){let l=g(e),o={type:"Combinator",name:e.source[l.start],loc:y(e,l,l)};n.appendData(o),r=!0,R(e);continue}let i=Dn(e);if(!i)break;n.appendData(i),r=!1}while(n.tail&&n.tail.data.type==="Combinator")n.remove(n.tail);return{type:"Selector",children:n,loc:y(e,t,f(e))}}function st(e){let t=f(e);if(t.type!==9)return!1;let n=e.source[t.start];return n===">"||n==="+"||n==="~"}function Bn(e){if(e.types[e.pos]!==9)return!1;if(e.source.charCodeAt(e.starts[e.pos])!==124)return!1;if(e.types[e.pos+1]!==9)return!1;return e.source.charCodeAt(e.starts[e.pos+1])===124}function Dn(e){let t=f(e);switch(t.type){case 1:{if(g(e),m(e)===9&&e.source[f(e).start]==="|"&&e.source[f(e).start+1]!=="="&&!(e.types[e.pos+1]===9&&e.source.charCodeAt(e.starts[e.pos+1])===124)){if(g(e),m(e)===1){let r=g(e);return{type:"TypeSelector",name:`${D(e,t)}|${D(e,r)}`,loc:y(e,t,r)}}if(m(e)===9&&e.source[f(e).start]==="*"){let r=g(e);return{type:"TypeSelector",name:`${D(e,t)}|*`,loc:y(e,t,r)}}}return{type:"TypeSelector",name:D(e,t),loc:y(e,t,t)}}case 11:return g(e),{type:"TypeSelector",name:D(e,t),loc:y(e,t,t)};case 10:return g(e),{type:"TypeSelector",name:D(e,t),loc:y(e,t,t)};case 9:{let n=e.source[t.start];if(n==="*")return g(e),{type:"TypeSelector",name:"*",loc:y(e,t,t)};if(n==="."){if(g(e),m(e)===1){let r=g(e);return{type:"ClassSelector",name:D(e,r),loc:y(e,t,r)}}return null}if(n==="&")return g(e),{type:"NestingSelector",loc:y(e,t,t)};return g(e),null}case 4:return g(e),{type:"IdSelector",name:e.source.slice(t.start+1,t.end),loc:y(e,t,t)};case 16:{g(e);let n=m(e)===16;if(n)g(e);return Mn(e,n,t)}case 19:return Vn(e)}return null}function Mn(e,t,n){let r=f(e);if(r.type===1){g(e);let s=ae(e.source,r.start,r.end);return t?{type:"PseudoElementSelector",name:s,children:null,loc:y(e,n,r)}:{type:"PseudoClassSelector",name:s,children:null,loc:y(e,n,r)}}if(r.type===2){g(e);let s=ae(e.source,r.start,r.end-1),i=N();if(!t&&Tn.has(s)){let o=f(e),c=o,h=1;while(m(e)!==0&&h>0){if(m(e)===21||m(e)===2)h++;else if(m(e)===22){if(h--,h===0)break}c=g(e)}if(m(e)===22)g(e);let u=e.source.slice(o.start,c.end).trim();if(u.length>0){let d=it(u,{positions:!1}),b=Ee(d);i.appendData(b)}}else{while(m(e)!==0&&m(e)!==22){let o=H(e);if(o)i.appendData(o)}if(m(e)===22)g(e)}if(t)return{type:"PseudoElementSelector",name:s,children:i,loc:y(e,n,f(e))};return{type:"PseudoClassSelector",name:s,children:i,loc:y(e,n,f(e))}}return null}function Vn(e){let t=g(e);R(e);let n=f(e);if(n.type!==1)return null;g(e);let r={type:"Identifier",name:D(e,n),loc:y(e,n,n)};R(e);let s=null,i=null,l=null,a=f(e);if(a.type===9){let c=e.source[a.start],h=e.source[a.start+1];if(c==="=")s="=",g(e);else if((c==="~"||c==="|"||c==="^"||c==="$"||c==="*")&&h==="="){g(e);let b=f(e);if(b.type===9&&e.source[b.start]==="=")g(e),s=`${c}=`}R(e);let u=f(e);if(u.type===5){g(e);let b=u.end-u.start>=2&&e.source.charCodeAt(u.end-1)===e.source.charCodeAt(u.start);i={type:"String",value:xe(e.source,u.start+1,b?u.end-1:u.end),loc:y(e,u,u)}}else if(u.type===1)g(e),i={type:"Identifier",name:D(e,u),loc:y(e,u,u)};R(e);let d=f(e);if(d.type===1)g(e),l=D(e,d)}R(e);let o=f(e);if(m(e)===20)o=g(e);return{type:"AttributeSelector",name:r,matcher:s,value:i,flags:l,loc:y(e,t,o)}}var ht=Symbol("walkSkip"),x=Symbol("walkStop");function jn(e){return{root:e,stylesheet:null,atrule:null,atrulePrelude:null,rule:null,selector:null,block:null,declaration:null,function:null}}function Wn(e,t){let n=jn(e),r=typeof t==="function"?t:t.enter,s=typeof t==="function"?null:t.leave??null,i=typeof t==="function"?null:t.visit??null,l=typeof t==="function"?!1:t.reverse??!1;function a(o,c,h){let u=null,d;switch(o.type){case"StyleSheet":u="stylesheet",d=n.stylesheet,n.stylesheet=o;break;case"Atrule":u="atrule",d=n.atrule,n.atrule=o;break;case"AtrulePrelude":u="atrulePrelude",d=n.atrulePrelude,n.atrulePrelude=o;break;case"Rule":u="rule",d=n.rule,n.rule=o;break;case"Selector":u="selector",d=n.selector,n.selector=o;break;case"Block":u="block",d=n.block,n.block=o;break;case"Declaration":u="declaration",d=n.declaration,n.declaration=o;break;case"Function":u="function",d=n.function,n.function=o;break}let b;if((i===null||i===o.type)&&r){let p=r.call(n,o,c,h);if(p===ht){if(u)n[u]=d;return}if(p===x){if(u)n[u]=d;return x}}if(b=Fn(o,l,a),b===x){if(u)n[u]=d;return x}if((i===null||i===o.type)&&s){if(s.call(n,o,c,h)===x){if(u)n[u]=d;return x}}if(u)n[u]=d;return}return a(e,null,null)}var q=Object.assign(Wn,{skip:ht,stop:x});function Fn(e,t,n){if("children"in e&&e.children instanceof L)return Un(e.children,t,n);if(e.type==="Rule"){if(n(e.prelude,null,null)===x)return x;if(n(e.block,null,null)===x)return x;return}if(e.type==="Atrule"){if(e.prelude){if(n(e.prelude,null,null)===x)return x}if(e.block){if(n(e.block,null,null)===x)return x}return}if(e.type==="Declaration")return n(e.value,null,null);if(e.type==="AttributeSelector"){if(n(e.name,null,null)===x)return x;if(e.value)return n(e.value,null,null);return}return}function Un(e,t,n){let r;if(t)e.forEachRight((s,i,l)=>{if(r)return;if(n(s,i,l)===x)r=x});else e.forEach((s,i,l)=>{if(r)return;if(n(s,i,l)===x)r=x});return r}function Y(e,t={}){let n=t.exclamation??!1,r=!1;q(e,(s,i,l)=>{if(s.type!=="Comment")return;let a=s.value.startsWith("!");if(n===!0&&a)return;if(n==="first-exclamation"&&a&&!r){r=!0;return}if(i&&l)l.remove(i)})}function ce(e){q(e,(t)=>{if(t.type!=="Block"&&t.type!=="DeclarationList")return;if(!("children"in t)||!t.children)return;let n=t.children,r=n.head;if(r==null||r.next==null)return;let s=0;for(let a=r;a!=null;a=a.next)if(a.data.type==="Declaration"){if(s++,s>=2)break}if(s<2)return;let i=new Map,l=[];for(let a=r;a!=null;a=a.next){let o=a.data;if(o.type!=="Declaration")continue;let c=o.property,h=i.get(c);if(h){let u=!!h.decl.important,d=!!o.important;if(d||u===d)l.push(h.item),i.set(c,{item:a,decl:o});else l.push(a)}else i.set(c,{item:a,decl:o})}for(let a of l)n.remove(a)})}var zn={black:"#000",fuchsia:"#f0f",white:"#fff",red:"#f00",cyan:"#0ff",blue:"#00f",yellow:"#ff0",magenta:"#f0f",lime:"#0f0",silver:"#c0c0c0",gray:"#808080",maroon:"#800000",olive:"#808000",green:"#008000",purple:"#800080",teal:"#008080",navy:"#000080"},Hn={"#f00":"red","#ff0000":"red","#000080":"navy","#008080":"teal"};function Le(e){if(!e.startsWith("#"))return e;let t=e.slice(1);if(t.length===6){if(t[0]===t[1]&&t[2]===t[3]&&t[4]===t[5])return`#${t[0]}${t[2]}${t[4]}`}if(t.length===8){if(t[0]===t[1]&&t[2]===t[3]&&t[4]===t[5]&&t[6]===t[7])return`#${t[0]}${t[2]}${t[4]}${t[6]}`}return e}function dt(e){let t=e.toLowerCase();return zn[t]??null}function mt(e){let t=e.toLowerCase();return Hn[t]??null}function qn(e,t,n){let r=(e<<16|t<<8|n).toString(16).padStart(6,"0");return Le(`#${r}`)}var Gn=/^rgba?\(\s*([+-]?\d*\.?\d+%?)\s*[,\s]\s*([+-]?\d*\.?\d+%?)\s*[,\s]\s*([+-]?\d*\.?\d+%?)\s*(?:[,/]\s*([+-]?\d*\.?\d+%?)\s*)?\)$/;function ft(e){let t=Gn.exec(e.trim());if(!t)return e;let n=Oe(t[1]),r=Oe(t[2]),s=Oe(t[3]);if(t[4]!==void 0&&!Kn(t[4]))return e;return qn(n,r,s)}function Kn(e){if(e.endsWith("%"))return Number.parseFloat(e)>=100;return Number.parseFloat(e)>=1}function Oe(e){if(e.endsWith("%"))return Math.max(0,Math.min(255,Math.round(Number.parseFloat(e)*2.55)));return Math.max(0,Math.min(255,Math.round(Number.parseFloat(e))))}var Yn=new Set(["px","pt","pc","in","cm","mm","q","em","rem","ex","ch","cap","ic","lh","rlh","vw","vh","vi","vb","vmin","vmax","svw","svh","svi","svb","svmin","svmax","lvw","lvh","lvi","lvb","lvmin","lvmax","dvw","dvh","dvi","dvb","dvmin","dvmax","cqw","cqh","cqi","cqb","cqmin","cqmax"]);function ue(e){if(e.charCodeAt(0)===43)e=e.slice(1);if(e.includes(".")){let t=e.replace(/(\.\d*?)0+($|[eE])/,"$1$2");t=t.replace(/\.($|[eE])/,"$1"),e=t}if(e.startsWith("0.")&&e.length>2)e=e.slice(1);else if(e.startsWith("-0.")&&e.length>3)e=`-${e.slice(2)}`;if(e==="-0"||e==="-.0"||e==="-0.0")e="0";return e}function pt(e,t){let n=ue(e);if((n==="0"||n==="-0")&&Yn.has(t.toLowerCase()))return{value:"0",unit:""};return{value:n,unit:t}}function gt(e){return ue(e)}function yt(e,t){let n=Number.parseFloat(e);if(!Number.isFinite(n))return e;let r=t<0?0:t;return n.toFixed(r)}var bt=new Set(["color","background","background-color","border","border-color","border-top","border-top-color","border-right","border-right-color","border-bottom","border-bottom-color","border-left","border-left-color","border-block","border-block-color","border-block-start-color","border-block-end-color","border-inline","border-inline-color","border-inline-start-color","border-inline-end-color","outline","outline-color","caret-color","fill","stroke","flood-color","lighting-color","stop-color","column-rule","column-rule-color","text-decoration","text-decoration-color","text-emphasis","text-emphasis-color","text-shadow","box-shadow","accent-color","scrollbar-color"]);function Ct(e){if(!e||e.type!=="Operator")return!1;let t=e.value;return t===":"||t===","||t==="/"}function Qn(e){let t=e.children;if(!t)return;while(t.head&&t.head.data.type==="WhiteSpace")t.remove(t.head);while(t.tail&&t.tail.data.type==="WhiteSpace")t.remove(t.tail);let n=t.head;while(n){let r=n.next;if(n.data.type==="WhiteSpace"){let s=n.prev&&Ct(n.prev.data),i=r&&Ct(r.data);if(s||i)t.remove(n)}n=r}}function Pe(e,t={}){let n=t.floatPrecision??null,r=n===null?null:(s)=>yt(s,n);q(e,{enter(s,i,l){switch(s.type){case"Number":{let a=r?r(s.value):s.value;s.value=ue(a);return}case"Percentage":{let a=r?r(s.value):s.value;s.value=gt(a);return}case"Dimension":{let a=r?r(s.value):s.value,o=pt(a,s.unit);s.value=o.value,s.unit=o.unit;return}case"Hash":{let a=Le(`#${s.name}`).slice(1);if(s.name=a,i&&l&&this.declaration&&bt.has(this.declaration.property.toLowerCase())){let o=mt(`#${a}`);if(o&&o.length<a.length+1){let c={type:"Identifier",name:o,loc:s.loc};l.replace(i,l.createItem(c))}}return}case"Identifier":{if(!i||!l||!this.declaration)return;if(!bt.has(this.declaration.property.toLowerCase()))return;let a=dt(s.name);if(a&&a.length<s.name.length){let o={type:"Hash",name:a.slice(1),loc:s.loc};l.replace(i,l.createItem(o))}return}case"Url":return;case"Function":{let a=s.name.toLowerCase();if((a==="rgb"||a==="rgba")&&i&&l)s.__rgbReplaceCandidate=!0}}},leave(s,i,l){if(s.type==="Parentheses"||s.type==="Function"||s.type==="Value")Qn(s);if(s.type==="Function"&&s.__rgbReplaceCandidate&&i&&l){let a=k(s),o=ft(a);if(o!==a&&o.startsWith("#")){let c={type:"Hash",name:o.slice(1),loc:s.loc};l.replace(i,l.createItem(c))}}}})}function Re(e,t={}){let n=z(e,{context:"stylesheet"});return vt(n,t)}function _e(e,t={}){let n=z(e,{context:"declarationList"});return vt(n,t)}function vt(e,t){if(t.comments===!1)Y(e,{exclamation:!1});else if(t.comments==="first-exclamation")Y(e,{exclamation:"first-exclamation"});else Y(e,{exclamation:!0});return Pe(e,{floatPrecision:t.floatPrecision??null}),ce(e),{css:k(e),ast:e}}var Be="0.3.8";function De(e){if(!er(e))process.stderr.write(`ts-css: file not found: ${e}
|
|
32
|
+
`),V.exit(e.exitCode??2)}async runMatchedCommand(){let{args:e,options:t,matchedCommand:n}=this;if(!n||!n.commandAction)return;n.checkUnknownOptions(),n.checkOptionValue(),n.checkRequiredArgs();let r=[];n.args.forEach((a,o)=>{if(a.variadic)r.push(e.slice(o));else r.push(e[o])}),r.push(t);let s={command:n,args:r,options:t};for(let a of n.beforeHooks)await a(s);let i,l=async()=>{let a=n.commandAction.apply(this,r);if(a instanceof Promise)i=await a;else i=a;return i};if(n.middleware.length>0){let a=0,o=async()=>{if(a<n.middleware.length){let c=n.middleware[a++];await c({...s,next:o})}else await l()};await o()}else await l();for(let a of n.afterHooks)await a(s);return i}removeSignalHandlers(){if(!this.signalHandlersSet)return this;return V.removeAllListeners("SIGINT"),V.removeAllListeners("SIGTERM"),this.signalHandlersSet=!1,this}destroy(){this.removeSignalHandlers(),this.commands=[],this.rawArgs=[],this.args=[],this.options={},this.matchedCommand=void 0,this.matchedCommandName=void 0,this.removeAllListeners()}}class Ke{cache;enabled;cleanupInterval=null;hits=0;misses=0;constructor(){this.cache=new Map,this.enabled=!0,this.startCleanupInterval()}startCleanupInterval(){if(this.cleanupInterval)return;this.cleanupInterval=setInterval(()=>{this.cleanup()},30000),this.cleanupInterval.unref()}stopCleanup(){if(this.cleanupInterval)clearInterval(this.cleanupInterval),this.cleanupInterval=null}isEnabled(){return this.enabled}get(e){if(!this.enabled){this.misses++;return}let t=this.cache.get(e);if(!t){this.misses++;return}if(Date.now()-t.timestamp>t.ttl){this.cache.delete(e),this.misses++;return}return this.hits++,t.value}set(e,t,n=5000){if(!this.enabled)return;this.cache.set(e,{value:t,timestamp:Date.now(),ttl:n})}has(e){if(!this.enabled)return!1;let t=this.cache.get(e);if(!t)return!1;if(Date.now()-t.timestamp>t.ttl)return this.cache.delete(e),!1;return!0}delete(e){this.cache.delete(e)}clear(){this.cache.clear()}disable(){this.enabled=!1,this.clear()}enable(){this.enabled=!0}stats(){return{size:this.cache.size,enabled:this.enabled,hits:this.hits,misses:this.misses}}resetStats(){this.hits=0,this.misses=0}keys(){return Array.from(this.cache.keys())}cleanup(){let e=Date.now();for(let[t,n]of this.cache.entries())if(e-n.timestamp>n.ttl)this.cache.delete(t)}destroy(){this.stopCleanup(),this.clear(),this.resetStats()}}var hr=new Ke;function Bt(){if("FORCE_COLOR"in X.env)return X.env.FORCE_COLOR!=="0";if("NO_COLOR"in X.env||X.env.TERM==="dumb")return!1;if(X.platform==="win32")return!0;return ze.isatty(1)&&ze.isatty(2)}var Ye=Bt();function v(e,t){if(!Ye)return(n)=>n;return(n)=>e+n+t}var Dt=v("\x1B[0m","\x1B[0m"),Mt=v("\x1B[31m","\x1B[39m"),Vt=v("\x1B[32m","\x1B[39m"),jt=v("\x1B[33m","\x1B[39m"),Wt=v("\x1B[34m","\x1B[39m"),Ft=v("\x1B[35m","\x1B[39m"),Ut=v("\x1B[36m","\x1B[39m"),zt=v("\x1B[37m","\x1B[39m"),Ht=v("\x1B[90m","\x1B[39m"),qt=v("\x1B[1m","\x1B[22m"),Gt=v("\x1B[3m","\x1B[23m"),Kt=v("\x1B[4m","\x1B[24m"),Yt=v("\x1B[2m","\x1B[22m"),Qt=v("\x1B[7m","\x1B[27m"),Jt=v("\x1B[8m","\x1B[28m"),Xt=v("\x1B[9m","\x1B[29m"),Zt=v("\x1B[41m","\x1B[49m"),en=v("\x1B[42m","\x1B[49m"),tn=v("\x1B[43m","\x1B[49m"),nn=v("\x1B[44m","\x1B[49m"),rn=v("\x1B[45m","\x1B[49m"),sn=v("\x1B[46m","\x1B[49m"),on=v("\x1B[47m","\x1B[49m"),an=Ye,ln={reset:Dt,red:Mt,green:Vt,yellow:jt,blue:Wt,magenta:Ft,cyan:Ut,white:zt,gray:Ht,bold:qt,italic:Gt,underline:Kt,dim:Yt,inverse:Qt,hidden:Jt,strikethrough:Xt,bgRed:Zt,bgGreen:en,bgYellow:tn,bgBlue:nn,bgMagenta:rn,bgCyan:sn,bgWhite:on,isColorSupported:an},cn=ln,hn=["up","down","left","right","space","enter","cancel"],yr={actions:new Set(hn),aliases:new Map([["k","up"],["j","down"],["h","left"],["l","right"],["\x03","cancel"],["escape","cancel"]]),messages:{cancel:"Canceled",error:"Something went wrong"}};var br=un.platform.startsWith("win"),Cr=Symbol("clapp:cancel");var dn=Nt();var C=(e,t)=>dn?e:t,vr=C("\u25C6","*"),wr=C("\u25A0","x"),$r=C("\u25B2","x"),xr=C("\u25C7","o"),Sr=C("\u250C","T"),mn=C("\u2502","|"),kr=C("\u2514","\u2014"),Tr=C("\u25CF",">"),Ar=C("\u25CB"," "),Nr=C("\u25FB","[\u2022]"),Ir=C("\u25FC","[+]"),Er=C("\u25FB","[ ]"),Or=C("\u25AA","\u2022"),Lr=C("\u2500","-"),Pr=C("\u256E","+"),Rr=C("\u251C","+"),_r=C("\u256F","+"),Br=C("\u25CF","\u2022"),Dr=C("\u25C6","*"),Mr=C("\u25B2","!"),Vr=C("\u25A0","x");var jr={light:C("\u2500","-"),heavy:C("\u2501","="),block:C("\u2588","#")};function fn(){return`${cn.gray(mn)} `}var Wr=fn();class Qe{configPath;config=null;events=[];retryCount=0;maxRetries=3;retryDelayMs=1000;constructor(){let e=He.homedir(),t=fe.join(e,".config","clapp");this.configPath=fe.join(t,"telemetry.json")}async isEnabled(){if(W.env.DO_NOT_TRACK==="1"||W.env.DO_NOT_TRACK==="true")return!1;if(W.env.NO_TELEMETRY==="1"||W.env.NO_TELEMETRY==="true")return!1;return(await this.loadConfig()).enabled}async enable(){let e=await this.loadConfig();if(e.enabled=!0,!e.userId)e.userId=this.generateUserId();await this.saveConfig(e)}async disable(){let e=await this.loadConfig();e.enabled=!1,await this.saveConfig(e)}async track(e,t){if(!await this.isEnabled())return;let r={event:e,...t,timestamp:Date.now(),platform:He.platform(),nodeVersion:W.version};if(this.events.push(r),this.events.length>=10)await this.send()}async trackCommand(e,t){await this.track("command",{command:e,duration:t})}async trackError(e,t){await this.track("error",{error:e,command:t})}async send(){if(!await this.isEnabled()||this.events.length===0)return!0;try{this.events=[],this.retryCount=0;let t=await this.loadConfig();return t.lastSent=Date.now(),await this.saveConfig(t),!0}catch{if(this.retryCount<this.maxRetries){this.retryCount++;let t=this.retryDelayMs*2**(this.retryCount-1);return await this.sleep(t),this.send()}return this.events=[],this.retryCount=0,!1}}async flush(){if(this.events.length===0)return!0;return this.send()}sleep(e){return new Promise((t)=>setTimeout(t,e))}async status(){let e=await this.loadConfig();return{enabled:e.enabled,doNotTrack:W.env.DO_NOT_TRACK==="1"||W.env.DO_NOT_TRACK==="true",eventsQueued:this.events.length,lastSent:e.lastSent}}async loadConfig(){if(this.config)return this.config;try{if(pn(this.configPath)){let e=await me.readFile(this.configPath,"utf-8");return this.config=JSON.parse(e),this.config}}catch{}return this.config={enabled:!1},this.config}async saveConfig(e){this.config=e;try{let t=fe.dirname(this.configPath);await me.mkdir(t,{recursive:!0}),await me.writeFile(this.configPath,JSON.stringify(e,null,2),"utf-8")}catch{}}generateUserId(){let e=Math.random().toString(36).substring(2,15),t=Date.now().toString(36);return`${e}-${t}`}}var Gr=new Qe;import{existsSync as er,readFileSync as tr}from"fs";function B(e){return{prev:null,next:null,data:e}}class L{head=null;tail=null;cursors=[];allocateCursor(e,t){let n={prev:e,next:t};return this.cursors.push(n),n}releaseCursor(){this.cursors.pop()}updateCursors(e,t,n,r){for(let s of this.cursors){if(s.prev===e)s.prev=t;if(s.next===n)s.next=r}}static createItem(e){return B(e)}createItem(e){return B(e)}get isEmpty(){return this.head===null}get first(){return this.head?.data??null}get last(){return this.tail?.data??null}*[Symbol.iterator](){for(let e=this.head;e!=null;e=e.next)yield e.data}fromArray(e){let t=null;this.head=null;for(let n of e){let r=B(n);if(r.prev=t,t)t.next=r;else this.head=r;t=r}return this.tail=t,this}toArray(){let e=[];for(let t=this.head;t!=null;t=t.next)e.push(t.data);return e}toJSON(){return this.toArray()}forEach(e,t){let n=this.allocateCursor(null,this.head);while(n.next!==null){let r=n.next;n.prev=r,n.next=r.next,e.call(t,r.data,r,this)}this.releaseCursor()}forEachRight(e,t){let n=this.allocateCursor(this.tail,null);while(n.prev!==null){let r=n.prev;n.next=r,n.prev=r.prev,e.call(t,r.data,r,this)}this.releaseCursor()}reduce(e,t){let n=t,r=0;for(let s=this.head;s!=null;s=s.next)n=e(n,s.data,r++,this);return n}some(e){let t=0;for(let n=this.head;n!=null;n=n.next)if(e(n.data,t++,this))return!0;return!1}map(e){let t=new L,n=null,r=0;for(let s=this.head;s!=null;s=s.next){let i=B(e(s.data,r++,this));if(i.prev=n,n)n.next=i;else t.head=i;n=i}return t.tail=n,t}filter(e){let t=new L,n=null,r=0;for(let s=this.head;s!=null;s=s.next)if(e(s.data,r++,this)){let i=B(s.data);if(i.prev=n,n)n.next=i;else t.head=i;n=i}return t.tail=n,t}clear(){let e=this.head;while(e){let t=e.next;e.prev=null,e.next=null,e=t}this.head=null,this.tail=null}copy(){let e=new L,t=null;for(let n=this.head;n!=null;n=n.next){let r=B(n.data);if(r.prev=t,t)t.next=r;else e.head=r;t=r}return e.tail=t,e}prepend(e){return this.insert(e,this.head)}prependData(e){return this.insert(B(e),this.head)}append(e){return this.insert(e,null)}appendData(e){return this.insert(B(e),null)}insert(e,t=null){if(t!=null)if(this.updateCursors(t.prev,e,t,e),t.prev===null){if(this.head!==t)throw Error("before doesn't belong to list");this.head=e,t.prev=e,e.next=t,this.updateCursors(null,e,null,null)}else t.prev.next=e,e.prev=t.prev,t.prev=e,e.next=t;else if(this.updateCursors(this.tail,e,null,e),this.tail!==null)this.tail.next=e,e.prev=this.tail,this.tail=e;else this.head=e,this.tail=e;return this}insertData(e,t=null){return this.insert(B(e),t)}remove(e){if(this.updateCursors(e,e.prev,e,e.next),e.prev!==null)e.prev.next=e.next;else if(this.head===e)this.head=e.next;else throw Error("item doesn't belong to list");if(e.next!==null)e.next.prev=e.prev;else if(this.tail===e)this.tail=e.prev;else throw Error("item doesn't belong to list");return e.prev=null,e.next=null,e}push(e){this.insert(B(e),null)}pop(){if(this.tail===null)return null;return this.remove(this.tail)}unshift(e){this.prependData(e)}shift(){if(this.head===null)return null;return this.remove(this.head)}prependList(e){return this.insertList(e,this.head)}appendList(e){return this.insertList(e,null)}insertList(e,t=null){if(e.head===null)return this;if(t!==null){if(this.updateCursors(t.prev,e.tail,t,e.head),t.prev!==null)t.prev.next=e.head,e.head.prev=t.prev;else this.head=e.head;t.prev=e.tail,e.tail.next=t}else{if(this.updateCursors(this.tail,e.tail,null,e.head),this.tail!==null)this.tail.next=e.head,e.head.prev=this.tail;else this.head=e.head;this.tail=e.tail}return e.head=null,e.tail=null,this}replace(e,t){if(t instanceof L)this.insertList(t,e),this.remove(e);else this.insert(t,e),this.remove(e)}}function k(e){switch(e.type){case"StyleSheet":return O(e.children,"");case"Rule":return`${k(e.prelude)}{${k(e.block)}}`;case"Block":return gn(e.children);case"Atrule":{let t=`@${e.name}`;if(e.prelude){let n=k(e.prelude);if(n)t+=` ${n}`}if(e.block)t+=`{${k(e.block)}}`;else t+=";";return t}case"AtrulePrelude":return O(e.children,"");case"SelectorList":return O(e.children,",");case"Selector":return O(e.children,"");case"TypeSelector":return e.name;case"IdSelector":return`#${e.name}`;case"ClassSelector":return`.${e.name}`;case"NestingSelector":return"&";case"AttributeSelector":{let t=`[${e.name.name}`;if(e.matcher&&e.value)if(t+=e.matcher,e.value.type==="String")t+=`"${ve(e.value.value)}"`;else t+=e.value.name;if(e.flags)t+=` ${e.flags}`;return t+="]",t}case"PseudoClassSelector":return e.children?`:${e.name}(${O(e.children,"")})`:`:${e.name}`;case"PseudoElementSelector":return e.children?`::${e.name}(${O(e.children,"")})`:`::${e.name}`;case"Combinator":return e.name===" "?" ":e.name;case"Declaration":return`${e.property}:${k(e.value)}${e.important?"!important":""}`;case"DeclarationList":return O(e.children,";");case"Value":return O(e.children,"");case"Identifier":return e.name;case"Number":return e.value;case"Percentage":return`${e.value}%`;case"Dimension":return e.value+e.unit;case"String":return`"${ve(e.value)}"`;case"Url":return/[\s"'()\\\u0000-\u001F\u007F]/.test(e.value)?`url("${ve(e.value)}")`:`url(${e.value})`;case"Hash":return`#${e.name}`;case"Operator":return e.value;case"Function":return`${e.name}(${O(e.children,"")})`;case"Parentheses":return`(${O(e.children,"")})`;case"Brackets":return`[${O(e.children,"")}]`;case"Raw":return e.value;case"Comment":return e.value.startsWith("!")?`/*${e.value}*/`:"";case"WhiteSpace":return" ";case"CDO":return"<!--";case"CDC":return"-->";case"AnPlusB":{let t=e.a??"",n=e.b??"";if(t&&n){let r=Number(n);return`${t==="1"?"":t==="-1"?"-":t}n${r>=0?`+${n}`:n}`}if(t)return`${t==="1"?"":t==="-1"?"-":t}n`;return n}case"Ratio":return`${e.left.value}/${e.right.value}`;case"UnicodeRange":return e.value;case"Nth":return e.selector?`${k(e.nth)} of ${k(e.selector)}`:k(e.nth);case"MediaQueryList":return O(e.children,",");case"MediaQuery":return O(e.children,"");case"MediaFeature":{let t=`(${e.name}`;if(e.value)t+=`:${k(e.value)}`;return t+=")",t}}return""}function O(e,t){let n="",r=!0,s=null,i=e.head;while(i!=null){let l=i.data;if(l.type==="WhiteSpace"){let o=i.next?i.next.data:null;if(Je(s)||Je(o)){i=i.next;continue}}let a=k(l);if(!a){i=i.next;continue}if(!r&&t&&!bn(s))n+=t;r=!1,n+=a,s=l,i=i.next}return n}function gn(e){let t="",n=null,r=e.head;while(r!=null){let s=r.data,i=k(s);if(!i){r=r.next;continue}if(n&&yn(n,s))t+=";";t+=i,n=s,r=r.next}return t}function yn(e,t){return e.type==="Declaration"&&t.type!=="Comment"}function Je(e){if(!e||e.type!=="Operator")return!1;let t=e.value;return t===":"||t===","||t==="/"}function bn(e){if(!e)return!1;return e.type==="Operator"||e.type==="Combinator"}function ve(e){let t="";for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);if(r===92)t+="\\\\";else if(r===34)t+="\\\"";else if(r<32||r===127){let s=r.toString(16),i=n+1<e.length?e.charCodeAt(n+1):-1,l=i===32||i===9||i===10||i===12||i===13||i>=48&&i<=57||i>=65&&i<=70||i>=97&&i<=102;t+=`\\${s}${l?" ":""}`}else t+=e[n]}return t}var U=(()=>{let e=new Uint8Array(128);for(let t=0;t<128;t++){let n=0;if(t===32||t===9||t===10||t===12||t===13)n|=1;if(t>=48&&t<=57)n|=2;if(t>=48&&t<=57||t>=65&&t<=70||t>=97&&t<=102)n|=4;if(t>=65&&t<=90||t>=97&&t<=122||t===95)n|=8;if(t===10||t===12||t===13)n|=16;e[t]=n}return e})();function P(e){return e<128&&(U[e]&2)!==0}function te(e){return e<128&&(U[e]&4)!==0}function Xe(e){return e>=128||e<128&&(U[e]&8)!==0}function Cn(e){return e===45||e>=128||e<128&&(U[e]&10)!==0}function vn(e){return e>=0&&e<=8||e===11||e>=14&&e<=31||e===127}function $e(e){return e<128&&(U[e]&16)!==0}function M(e){return e<128&&(U[e]&1)!==0}function F(e,t){if(e!==92)return!1;if($e(t))return!1;return!0}function we(e,t,n){if(e===45)return Xe(t)||t===45||F(t,n);if(Xe(e))return!0;if(e===92)return F(e,t);return!1}function wn(e,t,n){if(e===43||e===45){if(P(t))return!0;if(t===46&&P(n))return!0;return!1}if(e===46)return P(t);return P(e)}class ie{source;offset=0;types;starts;ends;count=0;_tokens=null;_lineStarts=null;constructor(e){this.source=e;let t=Math.max(64,Math.ceil(e.length/3));this.types=new Uint8Array(t),this.starts=new Uint32Array(t),this.ends=new Uint32Array(t),this.tokenize()}get lineStarts(){if(this._lineStarts==null)this._lineStarts=$n(this.source);return this._lineStarts}get tokens(){if(this._tokens!=null)return this._tokens;let e=Array.from({length:this.count});for(let t=0;t<this.count;t++)e[t]={type:this.types[t],start:this.starts[t],end:this.ends[t]};return this._tokens=e,e}addToken(e,t,n){if(this.count>=this.types.length)this.grow();this.types[this.count]=e,this.starts[this.count]=t,this.ends[this.count]=n,this.count++}grow(){let t=this.types.length*2,n=new Uint8Array(t);n.set(this.types),this.types=n;let r=new Uint32Array(t);r.set(this.starts),this.starts=r;let s=new Uint32Array(t);s.set(this.ends),this.ends=s}tokenize(){let e=this.source,t=0,n=e.length;while(t<n){let r=e.charCodeAt(t);if(r===47&&e.charCodeAt(t+1)===42){let l=t;t+=2;while(t<n&&!(e.charCodeAt(t)===42&&e.charCodeAt(t+1)===47))t++;t=t<n?t+2:n,this.addToken(25,l,t);continue}if(M(r)){let l=t;while(t<n&&M(e.charCodeAt(t)))t++;this.addToken(13,l,t);continue}if(r===34||r===39){t=this.consumeString(r,t);continue}if(r===35){if(t+1<n&&(Cn(e.charCodeAt(t+1))||F(e.charCodeAt(t+1),e.charCodeAt(t+2)))){let l=t;t++,t=this.consumeName(t),this.addToken(4,l,t);continue}this.addToken(9,t,t+1),t++;continue}switch(r){case 40:this.addToken(21,t,t+1),t++;continue;case 41:this.addToken(22,t,t+1),t++;continue;case 91:this.addToken(19,t,t+1),t++;continue;case 93:this.addToken(20,t,t+1),t++;continue;case 123:this.addToken(23,t,t+1),t++;continue;case 125:this.addToken(24,t,t+1),t++;continue;case 44:this.addToken(18,t,t+1),t++;continue;case 58:this.addToken(16,t,t+1),t++;continue;case 59:this.addToken(17,t,t+1),t++;continue}if(r===60&&e.startsWith("!--",t+1)){this.addToken(14,t,t+4),t+=4;continue}if(r===45&&e.startsWith("->",t+1)){this.addToken(15,t,t+3),t+=3;continue}if(r===64){let l=e.charCodeAt(t+1),a=e.charCodeAt(t+2),o=e.charCodeAt(t+3);if(we(l,a,o)){let c=t;t++,t=this.consumeName(t),this.addToken(3,c,t);continue}this.addToken(9,t,t+1),t++;continue}let s=e.charCodeAt(t+1),i=e.charCodeAt(t+2);if(wn(r,s,i)){t=this.consumeNumeric(t);continue}if(we(r,s,i)){t=this.consumeIdentLike(t);continue}if(r===92){if(F(r,s)){t=this.consumeIdentLike(t);continue}this.addToken(9,t,t+1),t++;continue}this.addToken(9,t,t+1),t++}this.addToken(0,n,n)}consumeString(e,t){let n=this.source,r=n.length,s=t+1;while(s<r){let i=n.charCodeAt(s);if(i===e)return s++,this.addToken(5,t,s),s;if($e(i))return this.addToken(6,t,s),s;if(i===92){let l=n.charCodeAt(s+1);if($e(l)){s+=2;continue}if(s+1<r){s=this.consumeEscapeSkip(s+1);continue}}s++}return this.addToken(5,t,s),s}consumeEscapeSkip(e){let t=this.source;if(e>=t.length)return e;let n=t.charCodeAt(e);if(te(n)){let r=1;e++;while(r<6&&e<t.length&&te(t.charCodeAt(e)))e++,r++;if(e<t.length&&M(t.charCodeAt(e)))e++;return e}return e+1}consumeName(e){let t=this.source,n=t.length,r=e;while(r<n){let s=t.charCodeAt(r);if(s<128&&(U[s]&10)!==0){r++;continue}if(s===45){r++;continue}if(s>=128){r++;continue}if(s===92&&F(s,t.charCodeAt(r+1))){r=this.consumeEscapeSkip(r+1);continue}break}return r}consumeNumber(e){let t=this.source,n=e;if(t.charCodeAt(n)===43||t.charCodeAt(n)===45)n++;while(n<t.length&&P(t.charCodeAt(n)))n++;if(t.charCodeAt(n)===46&&P(t.charCodeAt(n+1))){n+=2;while(n<t.length&&P(t.charCodeAt(n)))n++}let r=t.charCodeAt(n);if(r===69||r===101){let s=t.charCodeAt(n+1),i=t.charCodeAt(n+2);if(P(s)){n+=2;while(n<t.length&&P(t.charCodeAt(n)))n++}else if((s===43||s===45)&&P(i)){n+=3;while(n<t.length&&P(t.charCodeAt(n)))n++}}return n}consumeNumeric(e){let t=this.source,n=this.consumeNumber(e),r=t.charCodeAt(n),s=t.charCodeAt(n+1),i=t.charCodeAt(n+2);if(we(r,s,i)){let l=this.consumeName(n);return this.addToken(12,e,l),l}if(r===37)return this.addToken(11,e,n+1),n+1;return this.addToken(10,e,n),n}consumeIdentLike(e){let t=this.source,n=this.consumeName(e),r=t.charCodeAt(n);if(r===40&&n-e===3){let s=t.charCodeAt(e)|32,i=t.charCodeAt(e+1)|32,l=t.charCodeAt(e+2)|32;if(s===117&&i===114&&l===108){let a=n+1;while(a<t.length&&M(t.charCodeAt(a)))a++;let o=t.charCodeAt(a);if(o===34||o===39)return this.addToken(2,e,n+1),n+1;return this.consumeUrl(e,n)}}if(r===40)return this.addToken(2,e,n+1),n+1;return this.addToken(1,e,n),n}consumeUrl(e,t){let n=this.source,r=n.length,s=t+1;while(s<r&&M(n.charCodeAt(s)))s++;while(s<r){let i=n.charCodeAt(s);if(i===41)return s++,this.addToken(7,e,s),s;if(M(i)){let l=s;while(s<r&&M(n.charCodeAt(s)))s++;if(s>=r)return this.addToken(7,e,s),s;if(n.charCodeAt(s)===41)return s++,this.addToken(7,e,s),s;return this.consumeBadUrl(e,l)}if(i===34||i===39||i===40||vn(i))return this.consumeBadUrl(e,s);if(i===92){if(F(i,n.charCodeAt(s+1))){s=this.consumeEscapeSkip(s+1);continue}return this.consumeBadUrl(e,s)}s++}return this.addToken(7,e,s),s}consumeBadUrl(e,t){let n=this.source,r=t;while(r<n.length){let s=n.charCodeAt(r);if(s===41){r++;break}if(s===92&&F(s,n.charCodeAt(r+1))){r=this.consumeEscapeSkip(r+1);continue}r++}return this.addToken(8,e,r),r}locate(e){let t=this.lineStarts,n=0,r=t.length-1;while(n<r){let i=n+r+1>>1;if(t[i]<=e)n=i;else r=i-1}let s=t[n];return{line:n+1,column:e-s+1}}}function $n(e){let t=[0],n=e.length;for(let r=0;r<n;r++){let s=e.charCodeAt(r);if(s===10)t.push(r+1);else if(s===13){if(e.charCodeAt(r+1)!==10)t.push(r+1)}}return t}function xe(e,t,n){for(let r=t;r<n;r++)if(e.charCodeAt(r)===92)return xn(e,t,n,r);return e.slice(t,n)}function xn(e,t,n,r){let s=e.slice(t,r),i=r;while(i<n){if(e.charCodeAt(i)!==92){s+=e[i],i++;continue}if(i+1>=n){i++;continue}let a=e.charCodeAt(i+1);if(a===10){i+=2;continue}if(a===13){i+=e.charCodeAt(i+2)===10?3:2;continue}if(te(a)){let o=i+1,c="";while(c.length<6&&o<n&&te(e.charCodeAt(o)))c+=e[o],o++;let h=Number.parseInt(c,16);if(o<n&&M(e.charCodeAt(o)))o++;s+=h===0||h>=55296&&h<=57343||h>1114111?String.fromCodePoint(65533):String.fromCodePoint(h),i=o;continue}s+=e[i+1],i+=2}return s}function Se(e,t,n){for(let r=t;r<n;r++)if(e.charCodeAt(r)===92)return Sn(e,t,n,r);return e.slice(t,n)}function Sn(e,t,n,r){let s=e.slice(t,r),i=r;while(i<n){if(e.charCodeAt(i)!==92){s+=e[i],i++;continue}let a=i+1,o="";while(o.length<6&&a<n&&te(e.charCodeAt(a)))o+=e[a],a++;if(o.length>0){let c=Number.parseInt(o,16);if(a<n&&M(e.charCodeAt(a)))a++;s+=c===0||c>=55296&&c<=57343||c>1114111?String.fromCodePoint(65533):String.fromCodePoint(c),i=a;continue}if(a<n){s+=e[a],i=a+1;continue}s+=String.fromCodePoint(65533),i=a}return s}function it(e,t){let n=new ie(e);return{source:e,types:n.types,starts:n.starts,ends:n.ends,count:n.count,end:n.count,pos:0,positions:t.positions??!1,filename:t.filename,parseValue:t.parseValue??!0,parseAtrulePrelude:t.parseAtrulePrelude??!0,parseCustomProperty:t.parseCustomProperty??!1,parseRulePrelude:t.parseRulePrelude??!0,onParseError:t.onParseError,tokenizer:n}}function m(e){return e.pos<e.end?e.types[e.pos]:0}function f(e){let t=e.pos;if(t>=e.end)return{type:0,start:e.starts[t]??e.source.length,end:e.ends[t]??e.source.length};return{type:e.types[t],start:e.starts[t],end:e.ends[t]}}function g(e){let t=e.pos++;if(t>=e.end)return{type:0,start:e.starts[t]??e.source.length,end:e.ends[t]??e.source.length};return{type:e.types[t],start:e.starts[t],end:e.ends[t]}}function D(e,t){return e.source.slice(t.start,t.end)}function R(e){let{types:t,end:n}=e;while(e.pos<n){let r=t[e.pos];if(r===13||r===25)e.pos++;else break}}function Ze(e){let{types:t,end:n}=e;while(e.pos<n&&t[e.pos]===13)e.pos++}function y(e,t,n){if(!e.positions)return null;let r=e.tokenizer.locate(t.start),s=e.tokenizer.locate(n.end);return{source:e.filename??"<unknown>",start:{offset:t.start,line:r.line,column:r.column},end:{offset:n.end,line:s.line,column:s.column}}}function ot(e){if(!e.positions)return null;let t=f(e),n=e.tokenizer.locate(t.start);return{source:e.filename??"<unknown>",start:{offset:t.start,line:n.line,column:n.column},end:{offset:t.start,line:n.line,column:n.column}}}function oe(e,t,n,r){return{type:"Raw",value:e,loc:y(r,t,n)}}function N(){return new L}function ke(e,t,n,r){if(e.onParseError){let{line:s,column:i}=e.tokenizer.locate(n.start),l=SyntaxError(`${e.filename??"<input>"}:${s}:${i}: ${t}`);l.line=s,l.column=i,l.offset=n.start,e.onParseError(l,r)}return r}function z(e,t={}){let n=it(e,t);switch(t.context??"stylesheet"){case"stylesheet":return nt(n);case"atrule":return le(n)??et(n);case"atrulePrelude":return Nn(n);case"mediaQuery":case"mediaQueryList":return tt(n);case"rule":return Ae(n);case"selectorList":return Ee(n);case"selector":return ut(n);case"block":return Ne(n);case"declarationList":return On(n);case"declaration":return Ie(n)??et(n);case"value":return Ln(n);case"raw":return tt(n);default:return nt(n)}}function et(e){return{type:"StyleSheet",children:N(),loc:ot(e)}}function tt(e){let t=f(e),n=t;while(m(e)!==0)n=g(e);return{type:"Raw",value:e.source.slice(t.start,n.end),loc:y(e,t,n)}}function nt(e){let t=f(e),n=N(),{types:r,end:s}=e;while(e.pos<s){let a=r[e.pos];if(a===13){e.pos++;continue}if(a===25){let h={type:25,start:e.starts[e.pos],end:e.ends[e.pos]},u=Te(e,h);e.pos++,n.appendData(u);continue}if(a===0)break;if(a===14||a===15){e.pos++;continue}if(a===3){let h=le(e);if(h)n.appendData(h);continue}if(a===24){e.pos++;continue}let o=e.pos,c=Ae(e);if(n.appendData(c),e.pos===o)e.pos++}let i=e.end-1,l=i>=0?{type:e.types[i],start:e.starts[i],end:e.ends[i]}:{type:0,start:0,end:0};return{type:"StyleSheet",children:n,loc:y(e,t,l)}}function Te(e,t){return{type:"Comment",value:e.source.slice(t.start+2,t.end-2),loc:y(e,t,t)}}function le(e){let t=f(e);if(t.type!==3)return null;e.pos++;let n=ae(e.source,t.start+1,t.end);R(e);let r=e.pos,s=f(e),{types:i,end:l}=e,a=r,o=r;while(a<l){let u=i[a];if(u===0||u===17||u===23)break;if(u!==13&&u!==25)o=a+1;a++}let c=null;if(o>r){let u=e.starts[r],d=e.ends[o-1],b={type:i[o-1],start:e.starts[o-1],end:d},p=e.source.slice(u,d).trim();if(p.length>0)if(e.parseAtrulePrelude)try{let _=e.end;e.end=o,e.pos=r;let T=N();while(m(e)!==0){let K=H(e);if(K)T.appendData(K)}if(lt(T),e.end=_,e.pos=a,T.isEmpty)c=oe(p,s,b,e);else c={type:"AtrulePrelude",children:T,loc:null}}catch(_){let T=oe(p,s,b,e);ke(e,`Failed to parse @${n} prelude: ${_.message}`,s,T),c=T,e.pos=a}else c=oe(p,s,b,e),e.pos=a;else e.pos=a}else e.pos=a;let h=null;if(m(e)===17)g(e);else if(m(e)===23)h=Ne(e,An.has(n));return{type:"Atrule",name:n,prelude:c,block:h,loc:y(e,t,f(e))}}var Tn=new Set(["is","not","where","has","matches","-moz-any","-webkit-any"]),An=new Set(["media","supports","document","layer","container","scope","starting-style","-moz-document","keyframes","-webkit-keyframes","-moz-keyframes","-o-keyframes"]);function Nn(e){let t=f(e),n=N();while(m(e)!==0){if(f(e).type===13){e.pos++;continue}let s=H(e);if(s)n.appendData(s)}return{type:"AtrulePrelude",children:n,loc:y(e,t,f(e))}}function Ae(e){let t=f(e),n;if(e.parseRulePrelude)n=Ee(e);else{let s=f(e),i=s;while(m(e)!==0&&m(e)!==23)i=g(e);let l=e.source.slice(s.start,i.end).trim();n=oe(l,s,i,e)}let r=Ne(e,!0);return{type:"Rule",prelude:n,block:r,loc:y(e,t,f(e))}}function Ne(e,t=!1){let n=f(e);if(m(e)!==23)return{type:"Block",children:N(),loc:ot(e)};e.pos++;let r=N(),{types:s,end:i}=e;while(e.pos<i){let l=s[e.pos];if(l===24||l===0)break;if(l===13){e.pos++;continue}if(l===25){let o={type:25,start:e.starts[e.pos],end:e.ends[e.pos]};e.pos++,r.appendData(Te(e,o));continue}if(l===3){let o=le(e);if(o)r.appendData(o);continue}if(t&&In(e,En)){let o=Ae(e);r.appendData(o);continue}let a=Ie(e);if(a)r.appendData(a);if(e.pos<i&&s[e.pos]===17)e.pos++}if(m(e)===24)e.pos++;return{type:"Block",children:r,loc:y(e,n,f(e))}}function In(e,t){let n=e.pos,r=t(e);return e.pos=n,r}function En(e){let{types:t,end:n}=e;while(e.pos<n){let r=t[e.pos];if(r===23)return!0;if(r===17||r===24||r===0)return!1;e.pos++}return!1}function On(e){let t=f(e),n=N();while(m(e)!==0&&m(e)!==24){let r=f(e);if(r.type===13){e.pos++;continue}if(r.type===25){n.appendData(Te(e,g(e)));continue}if(r.type===17){e.pos++;continue}if(r.type===3){let i=le(e);if(i)n.appendData(i);continue}let s=Ie(e);if(s)n.appendData(s);if(m(e)===17)g(e)}return{type:"DeclarationList",children:n,loc:y(e,t,f(e))}}function Ie(e){R(e);let t=f(e);if(t.type!==1&&t.type!==4&&!(t.type===9&&e.source[t.start]==="*"&&e.source[t.start+1]===" "))if(t.type===9&&e.source[t.start]==="*")e.pos++;else{ke(e,"Expected property name",t,{type:"Raw",value:"",loc:null});let{types:I,end:E}=e;while(e.pos<E){let S=I[e.pos];if(S===0||S===17||S===24)break;e.pos++}return null}let n=e.starts[e.pos],r=e.ends[e.pos];e.pos++;let s=e.source.slice(n,r);if(Ze(e),m(e)!==16){ke(e,`Expected ':' after property "${s}"`,f(e),{type:"Raw",value:"",loc:null});let{types:I,end:E}=e;while(e.pos<E){let S=I[e.pos];if(S===0||S===17||S===24)break;e.pos++}return null}e.pos++,Ze(e);let{types:i,starts:l,end:a,pos:o}=e,c=o,h=o,u=-1,d=-1;while(c<a){let I=i[c];if(I===0||I===17||I===24)break;if(I===9&&e.source.charCodeAt(l[c])===33){let E=c+1;while(E<a&&i[E]===13)E++;if(E<a&&i[E]===1){let S=l[E];if(e.ends[E]-S===9&&(e.source.charCodeAt(S)|32)===105&&(e.source.charCodeAt(S+1)|32)===109&&(e.source.charCodeAt(S+2)|32)===112&&(e.source.charCodeAt(S+3)|32)===111&&(e.source.charCodeAt(S+4)|32)===114&&(e.source.charCodeAt(S+5)|32)===116&&(e.source.charCodeAt(S+6)|32)===97&&(e.source.charCodeAt(S+7)|32)===110&&(e.source.charCodeAt(S+8)|32)===116){d=c,u=E,c=E+1;continue}}}if(I!==13&&I!==25)h=c+1;c++}let b=h,p=u>=0?{type:1,start:l[u],end:e.ends[u]}:null,_=s.startsWith("--"),T,K=l[o],Me=b>o?e.ends[b-1]:K,he={type:i[o],start:K,end:e.ends[o]},Ve=b>o?{type:i[b-1],start:l[b-1],end:Me}:he;if(_&&!e.parseCustomProperty||!e.parseValue)T={type:"Raw",value:e.source.slice(K,Me).trim(),loc:y(e,he,Ve)};else if(b===o)T={type:"Value",children:N(),loc:y(e,he,Ve)};else{let I=e.end;e.end=b,e.pos=o,T=at(e),e.end=I}return e.pos=c,{type:"Declaration",property:s,important:p?!0:!1,value:T,loc:y(e,t,f(e))}}function Ln(e){return at(e)}function at(e){let t=f(e),n=N();while(m(e)!==0&&m(e)!==17&&m(e)!==24&&m(e)!==22&&m(e)!==20){let r=H(e);if(r)n.appendData(r)}return ct(n),{type:"Value",children:n,loc:y(e,t,f(e))}}function lt(e){for(let t of e)if("children"in t&&t.children instanceof L)lt(t.children);ct(e)}function ct(e){let t=e.head;while(t){if(t.data.type==="Number"){let n=t.next;while(n&&n.data.type==="WhiteSpace")n=n.next;if(n&&n.data.type==="Operator"&&n.data.value==="/"){let r=n.next;while(r&&r.data.type==="WhiteSpace")r=r.next;if(r&&r.data.type==="Number"){let s={type:"Ratio",left:t.data,right:r.data,loc:null},i=t.next;while(i&&i!==r.next){let l=i.next;e.remove(i),i=l}e.replace(t,e.createItem(s)),t=e.head;continue}}}t=t.next}}function H(e){let t=e.pos;if(t>=e.end)return null;let n=e.types[t],r=e.starts[t],s=e.ends[t],i=e.source;switch(n){case 13:return e.pos++,e.positions?{type:"WhiteSpace",value:" ",loc:A(e,r,s)}:{type:"WhiteSpace",value:" ",loc:null};case 25:return e.pos++,{type:"Comment",value:i.slice(r+2,s-2),loc:e.positions?A(e,r,s):null};case 10:return e.pos++,{type:"Number",value:i.slice(r,s),loc:e.positions?A(e,r,s):null};case 11:return e.pos++,{type:"Percentage",value:i.slice(r,s-1),loc:e.positions?A(e,r,s):null};case 12:{e.pos++;let l=r,a=i.charCodeAt(l);if(a===43||a===45)l++;let o=!1;while(l<s){let h=i.charCodeAt(l);if(h>=48&&h<=57){l++;continue}if(h===46&&!o){o=!0,l++;continue}break}let c=i.charCodeAt(l);if(c===69||c===101){let h=l+1,u=i.charCodeAt(h);if(u===43||u===45)h++;let d=!1;while(h<s){let b=i.charCodeAt(h);if(b>=48&&b<=57){h++,d=!0;continue}break}if(d)l=h}return{type:"Dimension",value:i.slice(r,l),unit:i.slice(l,s),loc:e.positions?A(e,r,s):null}}case 1:return e.pos++,{type:"Identifier",name:Se(i,r,s),loc:e.positions?A(e,r,s):null};case 5:{e.pos++;let l=r+1,o=s-r>=2&&i.charCodeAt(s-1)===i.charCodeAt(r)?s-1:s;return{type:"String",value:xe(i,l,o),loc:e.positions?A(e,r,s):null}}case 7:{e.pos++;let l=r+4;while(l<s&&rt(i.charCodeAt(l)))l++;let a=s;if(a>l&&i.charCodeAt(a-1)===41)a--;while(a>l&&rt(i.charCodeAt(a-1)))a--;let o;if(a-l>=2){let c=i.charCodeAt(l),h=i.charCodeAt(a-1);if((c===34||c===39)&&c===h)o=i.slice(l+1,a-1);else o=i.slice(l,a)}else o=i.slice(l,a);return{type:"Url",value:o,loc:e.positions?A(e,r,s):null}}case 4:return e.pos++,{type:"Hash",name:i.slice(r+1,s),loc:e.positions?A(e,r,s):null};case 2:return Rn(e);case 21:return _n(e);case 18:return e.pos++,{type:"Operator",value:",",loc:e.positions?A(e,r,s):null};case 16:return e.pos++,{type:"Operator",value:":",loc:e.positions?A(e,r,s):null};case 9:{e.pos++;let l=i.charCodeAt(r),a=i[r];if(Pn(l))return{type:"Operator",value:a,loc:e.positions?A(e,r,s):null};return{type:"Identifier",name:a,loc:e.positions?A(e,r,s):null}}case 19:{e.pos++;let l=N();while(m(e)!==0&&m(e)!==20){let o=H(e);if(o)l.appendData(o)}let a=e.pos<e.end?e.ends[e.pos]:s;if(m(e)===20)e.pos++;return{type:"Brackets",children:l,loc:e.positions?A(e,r,a):null}}case 3:case 23:case 24:case 22:case 20:case 17:case 0:case 14:case 15:case 6:case 8:return e.pos++,{type:"Raw",value:i.slice(r,s),loc:e.positions?A(e,r,s):null}}return e.pos++,null}function rt(e){return e===32||e===9||e===10||e===12||e===13}function Pn(e){return e===47||e===43||e===45||e===42||e===61||e===62||e===60||e===126||e===124||e===36||e===94||e===33||e===38}function ae(e,t,n){for(let r=t;r<n;r++){let s=e.charCodeAt(r);if(s>=65&&s<=90)return e.slice(t,n).toLowerCase()}return e.slice(t,n)}function A(e,t,n){let r=e.tokenizer.locate(t),s=e.tokenizer.locate(n);return{source:e.filename??"<unknown>",start:{offset:t,line:r.line,column:r.column},end:{offset:n,line:s.line,column:s.column}}}function Rn(e){let t=g(e),n=ae(e.source,t.start,t.end-1),r=N();while(m(e)!==0&&m(e)!==22){let s=H(e);if(s)r.appendData(s)}if(m(e)===22)g(e);if(n==="url"){for(let s=r.head;s!=null;s=s.next)if(s.data.type==="String")return{type:"Url",value:s.data.value,loc:y(e,t,f(e))}}return{type:"Function",name:n,children:r,loc:y(e,t,f(e))}}function _n(e){let t=g(e),n=N();while(m(e)!==0&&m(e)!==22){let r=H(e);if(r)n.appendData(r)}if(m(e)===22)g(e);return{type:"Parentheses",children:n,loc:y(e,t,f(e))}}function Ee(e){let t=f(e),n=N();while(m(e)!==0){if(R(e),m(e)===0||m(e)===23)break;let r=ut(e);if(r.children.head!==null)n.appendData(r);if(R(e),m(e)===18){g(e);continue}break}return{type:"SelectorList",children:n,loc:y(e,t,f(e))}}function ut(e){let t=f(e),n=N(),r=!0;while(m(e)!==0&&m(e)!==18&&m(e)!==23){let s=f(e);if(s.type===13){if(g(e),!r&&m(e)!==0&&m(e)!==18&&m(e)!==23&&!st(e)&&!Bn(e)){let l={type:"Combinator",name:" ",loc:y(e,s,s)};n.appendData(l),r=!0}continue}if(s.type===9&&e.source.charCodeAt(s.start)===124&&e.types[e.pos+1]===9&&e.source.charCodeAt(e.starts[e.pos+1])===124){let l=f(e);g(e);let a=g(e),o={type:"Combinator",name:"||",loc:y(e,l,a)};n.appendData(o),r=!0,R(e);continue}if(st(e)){let l=g(e),o={type:"Combinator",name:e.source[l.start],loc:y(e,l,l)};n.appendData(o),r=!0,R(e);continue}let i=Dn(e);if(!i)break;n.appendData(i),r=!1}while(n.tail&&n.tail.data.type==="Combinator")n.remove(n.tail);return{type:"Selector",children:n,loc:y(e,t,f(e))}}function st(e){let t=f(e);if(t.type!==9)return!1;let n=e.source[t.start];return n===">"||n==="+"||n==="~"}function Bn(e){if(e.types[e.pos]!==9)return!1;if(e.source.charCodeAt(e.starts[e.pos])!==124)return!1;if(e.types[e.pos+1]!==9)return!1;return e.source.charCodeAt(e.starts[e.pos+1])===124}function Dn(e){let t=f(e);switch(t.type){case 1:{if(g(e),m(e)===9&&e.source[f(e).start]==="|"&&e.source[f(e).start+1]!=="="&&!(e.types[e.pos+1]===9&&e.source.charCodeAt(e.starts[e.pos+1])===124)){if(g(e),m(e)===1){let r=g(e);return{type:"TypeSelector",name:`${D(e,t)}|${D(e,r)}`,loc:y(e,t,r)}}if(m(e)===9&&e.source[f(e).start]==="*"){let r=g(e);return{type:"TypeSelector",name:`${D(e,t)}|*`,loc:y(e,t,r)}}}return{type:"TypeSelector",name:D(e,t),loc:y(e,t,t)}}case 11:return g(e),{type:"TypeSelector",name:D(e,t),loc:y(e,t,t)};case 10:return g(e),{type:"TypeSelector",name:D(e,t),loc:y(e,t,t)};case 9:{let n=e.source[t.start];if(n==="*")return g(e),{type:"TypeSelector",name:"*",loc:y(e,t,t)};if(n==="."){if(g(e),m(e)===1){let r=g(e);return{type:"ClassSelector",name:D(e,r),loc:y(e,t,r)}}return null}if(n==="&")return g(e),{type:"NestingSelector",loc:y(e,t,t)};return g(e),null}case 4:return g(e),{type:"IdSelector",name:e.source.slice(t.start+1,t.end),loc:y(e,t,t)};case 16:{g(e);let n=m(e)===16;if(n)g(e);return Mn(e,n,t)}case 19:return Vn(e)}return null}function Mn(e,t,n){let r=f(e);if(r.type===1){g(e);let s=ae(e.source,r.start,r.end);return t?{type:"PseudoElementSelector",name:s,children:null,loc:y(e,n,r)}:{type:"PseudoClassSelector",name:s,children:null,loc:y(e,n,r)}}if(r.type===2){g(e);let s=ae(e.source,r.start,r.end-1),i=N();if(!t&&Tn.has(s)){let o=f(e),c=o,h=1;while(m(e)!==0&&h>0){if(m(e)===21||m(e)===2)h++;else if(m(e)===22){if(h--,h===0)break}c=g(e)}if(m(e)===22)g(e);let u=e.source.slice(o.start,c.end).trim();if(u.length>0){let d=it(u,{positions:!1}),b=Ee(d);i.appendData(b)}}else{while(m(e)!==0&&m(e)!==22){let o=H(e);if(o)i.appendData(o)}if(m(e)===22)g(e)}if(t)return{type:"PseudoElementSelector",name:s,children:i,loc:y(e,n,f(e))};return{type:"PseudoClassSelector",name:s,children:i,loc:y(e,n,f(e))}}return null}function Vn(e){let t=g(e);R(e);let n=f(e);if(n.type!==1)return null;g(e);let r={type:"Identifier",name:D(e,n),loc:y(e,n,n)};R(e);let s=null,i=null,l=null,a=f(e);if(a.type===9){let c=e.source[a.start],h=e.source[a.start+1];if(c==="=")s="=",g(e);else if((c==="~"||c==="|"||c==="^"||c==="$"||c==="*")&&h==="="){g(e);let b=f(e);if(b.type===9&&e.source[b.start]==="=")g(e),s=`${c}=`}R(e);let u=f(e);if(u.type===5){g(e);let b=u.end-u.start>=2&&e.source.charCodeAt(u.end-1)===e.source.charCodeAt(u.start);i={type:"String",value:xe(e.source,u.start+1,b?u.end-1:u.end),loc:y(e,u,u)}}else if(u.type===1)g(e),i={type:"Identifier",name:D(e,u),loc:y(e,u,u)};R(e);let d=f(e);if(d.type===1)g(e),l=D(e,d)}R(e);let o=f(e);if(m(e)===20)o=g(e);return{type:"AttributeSelector",name:r,matcher:s,value:i,flags:l,loc:y(e,t,o)}}var ht=Symbol("walkSkip"),x=Symbol("walkStop");function jn(e){return{root:e,stylesheet:null,atrule:null,atrulePrelude:null,rule:null,selector:null,block:null,declaration:null,function:null}}function Wn(e,t){let n=jn(e),r=typeof t==="function"?t:t.enter,s=typeof t==="function"?null:t.leave??null,i=typeof t==="function"?null:t.visit??null,l=typeof t==="function"?!1:t.reverse??!1;function a(o,c,h){let u=null,d;switch(o.type){case"StyleSheet":u="stylesheet",d=n.stylesheet,n.stylesheet=o;break;case"Atrule":u="atrule",d=n.atrule,n.atrule=o;break;case"AtrulePrelude":u="atrulePrelude",d=n.atrulePrelude,n.atrulePrelude=o;break;case"Rule":u="rule",d=n.rule,n.rule=o;break;case"Selector":u="selector",d=n.selector,n.selector=o;break;case"Block":u="block",d=n.block,n.block=o;break;case"Declaration":u="declaration",d=n.declaration,n.declaration=o;break;case"Function":u="function",d=n.function,n.function=o;break}let b;if((i===null||i===o.type)&&r){let p=r.call(n,o,c,h);if(p===ht){if(u)n[u]=d;return}if(p===x){if(u)n[u]=d;return x}}if(b=Fn(o,l,a),b===x){if(u)n[u]=d;return x}if((i===null||i===o.type)&&s){if(s.call(n,o,c,h)===x){if(u)n[u]=d;return x}}if(u)n[u]=d;return}return a(e,null,null)}var q=Object.assign(Wn,{skip:ht,stop:x});function Fn(e,t,n){if("children"in e&&e.children instanceof L)return Un(e.children,t,n);if(e.type==="Rule"){if(n(e.prelude,null,null)===x)return x;if(n(e.block,null,null)===x)return x;return}if(e.type==="Atrule"){if(e.prelude){if(n(e.prelude,null,null)===x)return x}if(e.block){if(n(e.block,null,null)===x)return x}return}if(e.type==="Declaration")return n(e.value,null,null);if(e.type==="AttributeSelector"){if(n(e.name,null,null)===x)return x;if(e.value)return n(e.value,null,null);return}return}function Un(e,t,n){let r;if(t)e.forEachRight((s,i,l)=>{if(r)return;if(n(s,i,l)===x)r=x});else e.forEach((s,i,l)=>{if(r)return;if(n(s,i,l)===x)r=x});return r}function Y(e,t={}){let n=t.exclamation??!1,r=!1;q(e,(s,i,l)=>{if(s.type!=="Comment")return;let a=s.value.startsWith("!");if(n===!0&&a)return;if(n==="first-exclamation"&&a&&!r){r=!0;return}if(i&&l)l.remove(i)})}function ce(e){q(e,(t)=>{if(t.type!=="Block"&&t.type!=="DeclarationList")return;if(!("children"in t)||!t.children)return;let n=t.children,r=n.head;if(r==null||r.next==null)return;let s=0;for(let a=r;a!=null;a=a.next)if(a.data.type==="Declaration"){if(s++,s>=2)break}if(s<2)return;let i=new Map,l=[];for(let a=r;a!=null;a=a.next){let o=a.data;if(o.type!=="Declaration")continue;let c=o.property,h=i.get(c);if(h){let u=!!h.decl.important,d=!!o.important;if(d||u===d)l.push(h.item),i.set(c,{item:a,decl:o});else l.push(a)}else i.set(c,{item:a,decl:o})}for(let a of l)n.remove(a)})}var zn={black:"#000",fuchsia:"#f0f",white:"#fff",red:"#f00",cyan:"#0ff",blue:"#00f",yellow:"#ff0",magenta:"#f0f",lime:"#0f0",silver:"#c0c0c0",gray:"#808080",maroon:"#800000",olive:"#808000",green:"#008000",purple:"#800080",teal:"#008080",navy:"#000080"},Hn={"#f00":"red","#ff0000":"red","#000080":"navy","#008080":"teal"};function Le(e){if(!e.startsWith("#"))return e;let t=e.slice(1);if(t.length===6){if(t[0]===t[1]&&t[2]===t[3]&&t[4]===t[5])return`#${t[0]}${t[2]}${t[4]}`}if(t.length===8){if(t[0]===t[1]&&t[2]===t[3]&&t[4]===t[5]&&t[6]===t[7])return`#${t[0]}${t[2]}${t[4]}${t[6]}`}return e}function dt(e){let t=e.toLowerCase();return zn[t]??null}function mt(e){let t=e.toLowerCase();return Hn[t]??null}function qn(e,t,n){let r=(e<<16|t<<8|n).toString(16).padStart(6,"0");return Le(`#${r}`)}var Gn=/^rgba?\(\s*([+-]?\d*\.?\d+%?)\s*[,\s]\s*([+-]?\d*\.?\d+%?)\s*[,\s]\s*([+-]?\d*\.?\d+%?)\s*(?:[,/]\s*([+-]?\d*\.?\d+%?)\s*)?\)$/;function ft(e){let t=Gn.exec(e.trim());if(!t)return e;let n=Oe(t[1]),r=Oe(t[2]),s=Oe(t[3]);if(t[4]!==void 0&&!Kn(t[4]))return e;return qn(n,r,s)}function Kn(e){if(e.endsWith("%"))return Number.parseFloat(e)>=100;return Number.parseFloat(e)>=1}function Oe(e){if(e.endsWith("%"))return Math.max(0,Math.min(255,Math.round(Number.parseFloat(e)*2.55)));return Math.max(0,Math.min(255,Math.round(Number.parseFloat(e))))}var Yn=new Set(["px","pt","pc","in","cm","mm","q","em","rem","ex","ch","cap","ic","lh","rlh","vw","vh","vi","vb","vmin","vmax","svw","svh","svi","svb","svmin","svmax","lvw","lvh","lvi","lvb","lvmin","lvmax","dvw","dvh","dvi","dvb","dvmin","dvmax","cqw","cqh","cqi","cqb","cqmin","cqmax"]);function ue(e){if(e.charCodeAt(0)===43)e=e.slice(1);if(e.includes(".")){let t=e.replace(/(\.\d*?)0+($|[eE])/,"$1$2");t=t.replace(/\.($|[eE])/,"$1"),e=t}if(e.startsWith("0.")&&e.length>2)e=e.slice(1);else if(e.startsWith("-0.")&&e.length>3)e=`-${e.slice(2)}`;if(e==="-0"||e==="-.0"||e==="-0.0")e="0";return e}function pt(e,t){let n=ue(e);if((n==="0"||n==="-0")&&Yn.has(t.toLowerCase()))return{value:"0",unit:""};return{value:n,unit:t}}function gt(e){return ue(e)}function yt(e,t){let n=Number.parseFloat(e);if(!Number.isFinite(n))return e;let r=t<0?0:t;return n.toFixed(r)}var bt=new Set(["color","background","background-color","border","border-color","border-top","border-top-color","border-right","border-right-color","border-bottom","border-bottom-color","border-left","border-left-color","border-block","border-block-color","border-block-start-color","border-block-end-color","border-inline","border-inline-color","border-inline-start-color","border-inline-end-color","outline","outline-color","caret-color","fill","stroke","flood-color","lighting-color","stop-color","column-rule","column-rule-color","text-decoration","text-decoration-color","text-emphasis","text-emphasis-color","text-shadow","box-shadow","accent-color","scrollbar-color"]);function Ct(e){if(!e||e.type!=="Operator")return!1;let t=e.value;return t===":"||t===","||t==="/"}function Qn(e){let t=e.children;if(!t)return;while(t.head&&t.head.data.type==="WhiteSpace")t.remove(t.head);while(t.tail&&t.tail.data.type==="WhiteSpace")t.remove(t.tail);let n=t.head;while(n){let r=n.next;if(n.data.type==="WhiteSpace"){let s=n.prev&&Ct(n.prev.data),i=r&&Ct(r.data);if(s||i)t.remove(n)}n=r}}function Pe(e,t={}){let n=t.floatPrecision??null,r=n===null?null:(s)=>yt(s,n);q(e,{enter(s,i,l){switch(s.type){case"Number":{let a=r?r(s.value):s.value;s.value=ue(a);return}case"Percentage":{let a=r?r(s.value):s.value;s.value=gt(a);return}case"Dimension":{let a=r?r(s.value):s.value,o=pt(a,s.unit);s.value=o.value,s.unit=o.unit;return}case"Hash":{let a=Le(`#${s.name}`).slice(1);if(s.name=a,i&&l&&this.declaration&&bt.has(this.declaration.property.toLowerCase())){let o=mt(`#${a}`);if(o&&o.length<a.length+1){let c={type:"Identifier",name:o,loc:s.loc};l.replace(i,l.createItem(c))}}return}case"Identifier":{if(!i||!l||!this.declaration)return;if(!bt.has(this.declaration.property.toLowerCase()))return;let a=dt(s.name);if(a&&a.length<s.name.length){let o={type:"Hash",name:a.slice(1),loc:s.loc};l.replace(i,l.createItem(o))}return}case"Url":return;case"Function":{let a=s.name.toLowerCase();if((a==="rgb"||a==="rgba")&&i&&l)s.__rgbReplaceCandidate=!0}}},leave(s,i,l){if(s.type==="Parentheses"||s.type==="Function"||s.type==="Value")Qn(s);if(s.type==="Function"&&s.__rgbReplaceCandidate&&i&&l){let a=k(s),o=ft(a);if(o!==a&&o.startsWith("#")){let c={type:"Hash",name:o.slice(1),loc:s.loc};l.replace(i,l.createItem(c))}}}})}function Re(e,t={}){let n=z(e,{context:"stylesheet"});return vt(n,t)}function _e(e,t={}){let n=z(e,{context:"declarationList"});return vt(n,t)}function vt(e,t){if(t.comments===!1)Y(e,{exclamation:!1});else if(t.comments==="first-exclamation")Y(e,{exclamation:"first-exclamation"});else Y(e,{exclamation:!0});return Pe(e,{floatPrecision:t.floatPrecision??null}),ce(e),{css:k(e),ast:e}}var Be="0.3.10";function De(e){if(!er(e))process.stderr.write(`ts-css: file not found: ${e}
|
|
33
33
|
`),process.exit(1);return tr(e,"utf8")}var G=new Ce("ts-css");G.command("minify <file>","Minify a CSS file").option("--no-comments","Strip /*!*/ comments too").option("--block",'Treat input as a declarationList (style="\u2026" body)').action(async(e,t)=>{let n=De(e),r={comments:t.comments===!1?!1:"exclamation"},s=t.block?_e(n,r):Re(n,r);process.stdout.write(s.css)});G.command("parse <file>","Parse a CSS file and print its AST as JSON").option("--positions","Include source locations on every node").action(async(e,t)=>{let n=De(e),r=z(n,{positions:t.positions});process.stdout.write(JSON.stringify(r,null,2))});G.command("format <file>","Round-trip CSS through parser/generator (deterministic single-line output)").action(async(e)=>{let t=De(e),n=z(t);process.stdout.write(k(n))});G.command("version","Show the version of the CLI").action(()=>{console.log(Be)});G.version(Be);G.help();G.parse();
|