@stacksjs/ts-css 0.3.4 → 0.3.5
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 +1 -1
- 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"),Wt=v("\x1B[33m","\x1B[39m"),jt=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:Wt,blue:jt,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 Wr={light:C("\u2500","-"),heavy:C("\u2501","="),block:C("\u2588","#")};function fn(){return`${cn.gray(mn)} `}var jr=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(j.env.DO_NOT_TRACK==="1"||j.env.DO_NOT_TRACK==="true")return!1;if(j.env.NO_TELEMETRY==="1"||j.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:j.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:j.env.DO_NOT_TRACK==="1"||j.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 Wn(e){return{root:e,stylesheet:null,atrule:null,atrulePrelude:null,rule:null,selector:null,block:null,declaration:null,function:null}}function jn(e,t){let n=Wn(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(jn,{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.4";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"),Wt=v("\x1B[33m","\x1B[39m"),jt=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:Wt,blue:jt,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 Wr={light:C("\u2500","-"),heavy:C("\u2501","="),block:C("\u2588","#")};function fn(){return`${cn.gray(mn)} `}var jr=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(j.env.DO_NOT_TRACK==="1"||j.env.DO_NOT_TRACK==="true")return!1;if(j.env.NO_TELEMETRY==="1"||j.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:j.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:j.env.DO_NOT_TRACK==="1"||j.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 Wn(e){return{root:e,stylesheet:null,atrule:null,atrulePrelude:null,rule:null,selector:null,block:null,declaration:null,function:null}}function jn(e,t){let n=Wn(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(jn,{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.5";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();
|
package/dist/bin/cssx.js
CHANGED
|
@@ -29,7 +29,7 @@ Received ${r}, cleaning up...`),e)try{await e()}catch(n){console.error("Error du
|
|
|
29
29
|
`)),this.enableDidYouMean){let t=[];for(let n of this.commands){if(n.displayName)t.push(n.displayName);if(n.aliasNames)t.push(...n.aliasNames)}let r=bi(e,t);if(r.length>0)console.log(dt.yellow("Did you mean one of these?")),r.forEach((n)=>console.log(` ${dt.dim("\u2022")} ${this.name} ${n}`)),console.log("")}console.log(dt.dim("Run"),`${this.name} --help`,dt.dim("to see all available commands")),Ae.exit(1)}async parse(e=mi,t={}){let{run:r=!0,exitOnError:n=!1}=t;if(n)try{return await this.parse(e,{run:r})}catch(a){throw this.handleUsageError(a),a}if(this.rawArgs=e,!this.name)this.name=e[1]?zl(e[1]):"cli";let i=!0,o=e.slice(2),s=o[0];if(s&&!s.startsWith("-")){for(let a of this.commands)if(a.isMatched(s)){let l=this.mri(o,a);i=!1;let u={...l,args:l.args.slice(1)};this.setParsedInfo(u,a,s),this.emit(`command:${s}`,a);break}if(i){let a=o[1];if(a&&!a.startsWith("-")){let l=`${s}:${a}`;for(let u of this.commands)if(u.isMatched(l)){let f=this.mri(o,u);i=!1;let d={...f,args:f.args.slice(2)};this.setParsedInfo(d,u,l),this.emit(`command:${l}`,u);break}}}}if(i){for(let a of this.commands)if(a.name===""){i=!1;let l=this.mri(o,a);this.setParsedInfo(l,a),this.emit("command:!",a);break}}if(i){let a=this.mri(e.slice(2));this.setParsedInfo(a)}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(),r=!1,this.unsetMatchedCommand();if(this.options.version&&this.showVersionOnExit&&this.matchedCommandName==null)this.outputVersion(),r=!1,this.unsetMatchedCommand();let c={args:this.args,options:this.options};if(r)await this.runMatchedCommand();if(!this.matchedCommand&&this.args[0]){if(this.emit("command:*"),!(this.listenerCount("command:*")>0))this.showCommandNotFound(this.args[0])}return c}mri(e,t){let r=[...this.globalCommand.options,...t?t.options:[]],n=Bl(r),i=[],o=e.indexOf("--");if(o>-1)i=e.slice(o+1),e=e.slice(0,o);let s=Hl(e,n),c={_:s._};for(let d of Object.keys(s))if(d!=="_")c[gt(d)]=s[d];let a=c._,l={"--":i},u=t&&t.config.ignoreOptionDefaultValue?t.config.ignoreOptionDefaultValue:this.globalCommand.config.ignoreOptionDefaultValue,f=Object.create(null);for(let d of r){if(!u&&d.config.default!==void 0)for(let h of d.names)l[h]=d.config.default;if(Array.isArray(d.config.type)){if(f[d.name]===void 0)f[d.name]={shouldTransform:!0,transformFunction:d.config.type[0]}}}for(let d of Object.keys(c))if(d!=="_"){let h=d.split(".");Ul(l,h,c[d]),Vl(l,f)}for(let d of r){if(!d.variadic)continue;for(let h of d.names){let m=l[h];if(m===void 0||Array.isArray(m))continue;if(d.config.default!==void 0&&m===d.config.default)continue;l[h]=[m]}}return{args:a,options:l}}async run(e=mi){return this.parse(e,{run:!0,exitOnError:!0})}handleUsageError(e){if(!Wl(e)||e.isUsageError===!1)return;let t=e.message||"command-line error",r=this.name?`${this.name}: `:"",n=/--help/.test(t)?"":e.usage?`
|
|
30
30
|
Usage: ${e.usage}`:`
|
|
31
31
|
Run \`${this.name??"cli"} --help\` for usage.`;Ae.stderr.write(`${r}${t}${n}
|
|
32
|
-
`),Ae.exit(e.exitCode??2)}async runMatchedCommand(){let{args:e,options:t,matchedCommand:r}=this;if(!r||!r.commandAction)return;r.checkUnknownOptions(),r.checkOptionValue(),r.checkRequiredArgs();let n=[];r.args.forEach((c,a)=>{if(c.variadic)n.push(e.slice(a));else n.push(e[a])}),n.push(t);let i={command:r,args:n,options:t};for(let c of r.beforeHooks)await c(i);let o,s=async()=>{let c=r.commandAction.apply(this,n);if(c instanceof Promise)o=await c;else o=c;return o};if(r.middleware.length>0){let c=0,a=async()=>{if(c<r.middleware.length){let l=r.middleware[c++];await l({...i,next:a})}else await s()};await a()}else await s();for(let c of r.afterHooks)await c(i);return o}removeSignalHandlers(){if(!this.signalHandlersSet)return this;return Ae.removeAllListeners("SIGINT"),Ae.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 vi{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,r=5000){if(!this.enabled)return;this.cache.set(e,{value:t,timestamp:Date.now(),ttl:r})}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,r]of this.cache.entries())if(e-r.timestamp>r.ttl)this.cache.delete(t)}destroy(){this.stopCleanup(),this.clear(),this.resetStats()}}var ib=new vi;function Ql(){if("FORCE_COLOR"in ht.env)return ht.env.FORCE_COLOR!=="0";if("NO_COLOR"in ht.env||ht.env.TERM==="dumb")return!1;if(ht.platform==="win32")return!0;return pi.isatty(1)&&pi.isatty(2)}var wi=Ql();function F(e,t){if(!wi)return(r)=>r;return(r)=>e+r+t}var ec=F("\x1B[0m","\x1B[0m"),tc=F("\x1B[31m","\x1B[39m"),rc=F("\x1B[32m","\x1B[39m"),nc=F("\x1B[33m","\x1B[39m"),ic=F("\x1B[34m","\x1B[39m"),oc=F("\x1B[35m","\x1B[39m"),sc=F("\x1B[36m","\x1B[39m"),ac=F("\x1B[37m","\x1B[39m"),lc=F("\x1B[90m","\x1B[39m"),cc=F("\x1B[1m","\x1B[22m"),uc=F("\x1B[3m","\x1B[23m"),fc=F("\x1B[4m","\x1B[24m"),dc=F("\x1B[2m","\x1B[22m"),hc=F("\x1B[7m","\x1B[27m"),gc=F("\x1B[8m","\x1B[28m"),mc=F("\x1B[9m","\x1B[29m"),pc=F("\x1B[41m","\x1B[49m"),yc=F("\x1B[42m","\x1B[49m"),bc=F("\x1B[43m","\x1B[49m"),xc=F("\x1B[44m","\x1B[49m"),vc=F("\x1B[45m","\x1B[49m"),wc=F("\x1B[46m","\x1B[49m"),Cc=F("\x1B[47m","\x1B[49m"),$c=wi,Rc={reset:ec,red:tc,green:rc,yellow:nc,blue:ic,magenta:oc,cyan:sc,white:ac,gray:lc,bold:cc,italic:uc,underline:fc,dim:dc,inverse:hc,hidden:gc,strikethrough:mc,bgRed:pc,bgGreen:yc,bgYellow:bc,bgBlue:xc,bgMagenta:vc,bgCyan:wc,bgWhite:Cc,isColorSupported:$c},kc=Rc,Ec=["up","down","left","right","space","enter","cancel"],ub={actions:new Set(Ec),aliases:new Map([["k","up"],["j","down"],["h","left"],["l","right"],["\x03","cancel"],["escape","cancel"]]),messages:{cancel:"Canceled",error:"Something went wrong"}};var fb=Sc.platform.startsWith("win"),db=Symbol("clapp:cancel");var Ac=Kl();var L=(e,t)=>Ac?e:t,hb=L("\u25C6","*"),gb=L("\u25A0","x"),mb=L("\u25B2","x"),pb=L("\u25C7","o"),yb=L("\u250C","T"),Tc=L("\u2502","|"),bb=L("\u2514","\u2014"),xb=L("\u25CF",">"),vb=L("\u25CB"," "),wb=L("\u25FB","[\u2022]"),Cb=L("\u25FC","[+]"),$b=L("\u25FB","[ ]"),Rb=L("\u25AA","\u2022"),kb=L("\u2500","-"),Sb=L("\u256E","+"),Eb=L("\u251C","+"),Ab=L("\u256F","+"),Tb=L("\u25CF","\u2022"),Nb=L("\u25C6","*"),Ob=L("\u25B2","!"),Ib=L("\u25A0","x");var Pb={light:L("\u2500","-"),heavy:L("\u2501","="),block:L("\u2588","#")};function Nc(){return`${kc.gray(Tc)} `}var _b=Nc();class Ci{configPath;config=null;events=[];retryCount=0;maxRetries=3;retryDelayMs=1000;constructor(){let e=yi.homedir(),t=Fr.join(e,".config","clapp");this.configPath=Fr.join(t,"telemetry.json")}async isEnabled(){if(Fe.env.DO_NOT_TRACK==="1"||Fe.env.DO_NOT_TRACK==="true")return!1;if(Fe.env.NO_TELEMETRY==="1"||Fe.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 n={event:e,...t,timestamp:Date.now(),platform:yi.platform(),nodeVersion:Fe.version};if(this.events.push(n),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:Fe.env.DO_NOT_TRACK==="1"||Fe.env.DO_NOT_TRACK==="true",eventsQueued:this.events.length,lastSent:e.lastSent}}async loadConfig(){if(this.config)return this.config;try{if(Oc(this.configPath)){let e=await Mr.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=Fr.dirname(this.configPath);await Mr.mkdir(t,{recursive:!0}),await Mr.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 Bb=new Ci;var zr="0.3.4";function ge(e){return{prev:null,next:null,data:e}}class oe{head=null;tail=null;cursors=[];allocateCursor(e,t){let r={prev:e,next:t};return this.cursors.push(r),r}releaseCursor(){this.cursors.pop()}updateCursors(e,t,r,n){for(let i of this.cursors){if(i.prev===e)i.prev=t;if(i.next===r)i.next=n}}static createItem(e){return ge(e)}createItem(e){return ge(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 r of e){let n=ge(r);if(n.prev=t,t)t.next=n;else this.head=n;t=n}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 r=this.allocateCursor(null,this.head);while(r.next!==null){let n=r.next;r.prev=n,r.next=n.next,e.call(t,n.data,n,this)}this.releaseCursor()}forEachRight(e,t){let r=this.allocateCursor(this.tail,null);while(r.prev!==null){let n=r.prev;r.next=n,r.prev=n.prev,e.call(t,n.data,n,this)}this.releaseCursor()}reduce(e,t){let r=t,n=0;for(let i=this.head;i!=null;i=i.next)r=e(r,i.data,n++,this);return r}some(e){let t=0;for(let r=this.head;r!=null;r=r.next)if(e(r.data,t++,this))return!0;return!1}map(e){let t=new oe,r=null,n=0;for(let i=this.head;i!=null;i=i.next){let o=ge(e(i.data,n++,this));if(o.prev=r,r)r.next=o;else t.head=o;r=o}return t.tail=r,t}filter(e){let t=new oe,r=null,n=0;for(let i=this.head;i!=null;i=i.next)if(e(i.data,n++,this)){let o=ge(i.data);if(o.prev=r,r)r.next=o;else t.head=o;r=o}return t.tail=r,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 oe,t=null;for(let r=this.head;r!=null;r=r.next){let n=ge(r.data);if(n.prev=t,t)t.next=n;else e.head=n;t=n}return e.tail=t,e}prepend(e){return this.insert(e,this.head)}prependData(e){return this.insert(ge(e),this.head)}append(e){return this.insert(e,null)}appendData(e){return this.insert(ge(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(ge(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(ge(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 oe)this.insertList(t,e),this.remove(e);else this.insert(t,e),this.remove(e)}}function Y(e){switch(e.type){case"StyleSheet":return te(e.children,"");case"Rule":return`${Y(e.prelude)}{${Y(e.block)}}`;case"Block":return Pc(e.children);case"Atrule":{let t=`@${e.name}`;if(e.prelude){let r=Y(e.prelude);if(r)t+=` ${r}`}if(e.block)t+=`{${Y(e.block)}}`;else t+=";";return t}case"AtrulePrelude":return te(e.children,"");case"SelectorList":return te(e.children,",");case"Selector":return te(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+=`"${Wr(e.value.value)}"`;else t+=e.value.name;if(e.flags)t+=` ${e.flags}`;return t+="]",t}case"PseudoClassSelector":return e.children?`:${e.name}(${te(e.children,"")})`:`:${e.name}`;case"PseudoElementSelector":return e.children?`::${e.name}(${te(e.children,"")})`:`::${e.name}`;case"Combinator":return e.name===" "?" ":e.name;case"Declaration":return`${e.property}:${Y(e.value)}${e.important?"!important":""}`;case"DeclarationList":return te(e.children,";");case"Value":return te(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`"${Wr(e.value)}"`;case"Url":return/[\s"'()\\\u0000-\u001F\u007F]/.test(e.value)?`url("${Wr(e.value)}")`:`url(${e.value})`;case"Hash":return`#${e.name}`;case"Operator":return e.value;case"Function":return`${e.name}(${te(e.children,"")})`;case"Parentheses":return`(${te(e.children,"")})`;case"Brackets":return`[${te(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??"",r=e.b??"";if(t&&r){let n=Number(r);return`${t==="1"?"":t==="-1"?"-":t}n${n>=0?`+${r}`:r}`}if(t)return`${t==="1"?"":t==="-1"?"-":t}n`;return r}case"Ratio":return`${e.left.value}/${e.right.value}`;case"UnicodeRange":return e.value;case"Nth":return e.selector?`${Y(e.nth)} of ${Y(e.selector)}`:Y(e.nth);case"MediaQueryList":return te(e.children,",");case"MediaQuery":return te(e.children,"");case"MediaFeature":{let t=`(${e.name}`;if(e.value)t+=`:${Y(e.value)}`;return t+=")",t}}return""}function te(e,t){let r="",n=!0,i=null,o=e.head;while(o!=null){let s=o.data;if(s.type==="WhiteSpace"){let a=o.next?o.next.data:null;if($i(i)||$i(a)){o=o.next;continue}}let c=Y(s);if(!c){o=o.next;continue}if(!n&&t&&!Lc(i))r+=t;n=!1,r+=c,i=s,o=o.next}return r}function Pc(e){let t="",r=null,n=e.head;while(n!=null){let i=n.data,o=Y(i);if(!o){n=n.next;continue}if(r&&_c(r,i))t+=";";t+=o,r=i,n=n.next}return t}function _c(e,t){return e.type==="Declaration"&&t.type!=="Comment"}function $i(e){if(!e||e.type!=="Operator")return!1;let t=e.value;return t===":"||t===","||t==="/"}function Lc(e){if(!e)return!1;return e.type==="Operator"||e.type==="Combinator"}function Wr(e){let t="";for(let r=0;r<e.length;r++){let n=e.charCodeAt(r);if(n===92)t+="\\\\";else if(n===34)t+="\\\"";else if(n<32||n===127){let i=n.toString(16),o=r+1<e.length?e.charCodeAt(r+1):-1,s=o===32||o===9||o===10||o===12||o===13||o>=48&&o<=57||o>=65&&o<=70||o>=97&&o<=102;t+=`\\${i}${s?" ":""}`}else t+=e[r]}return t}var je=(()=>{let e=new Uint8Array(128);for(let t=0;t<128;t++){let r=0;if(t===32||t===9||t===10||t===12||t===13)r|=1;if(t>=48&&t<=57)r|=2;if(t>=48&&t<=57||t>=65&&t<=70||t>=97&&t<=102)r|=4;if(t>=65&&t<=90||t>=97&&t<=122||t===95)r|=8;if(t===10||t===12||t===13)r|=16;e[t]=r}return e})();function le(e){return e<128&&(je[e]&2)!==0}function pt(e){return e<128&&(je[e]&4)!==0}function Ri(e){return e>=128||e<128&&(je[e]&8)!==0}function Mc(e){return e===45||e>=128||e<128&&(je[e]&10)!==0}function Fc(e){return e>=0&&e<=8||e===11||e>=14&&e<=31||e===127}function Gr(e){return e<128&&(je[e]&16)!==0}function xe(e){return e<128&&(je[e]&1)!==0}function De(e,t){if(e!==92)return!1;if(Gr(t))return!1;return!0}function Kr(e,t,r){if(e===45)return Ri(t)||t===45||De(t,r);if(Ri(e))return!0;if(e===92)return De(e,t);return!1}function Dc(e,t,r){if(e===43||e===45){if(le(t))return!0;if(t===46&&le(r))return!0;return!1}if(e===46)return le(t);return le(e)}class Tt{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=jc(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,r){if(this.count>=this.types.length)this.grow();this.types[this.count]=e,this.starts[this.count]=t,this.ends[this.count]=r,this.count++}grow(){let t=this.types.length*2,r=new Uint8Array(t);r.set(this.types),this.types=r;let n=new Uint32Array(t);n.set(this.starts),this.starts=n;let i=new Uint32Array(t);i.set(this.ends),this.ends=i}tokenize(){let e=this.source,t=0,r=e.length;while(t<r){let n=e.charCodeAt(t);if(n===47&&e.charCodeAt(t+1)===42){let s=t;t+=2;while(t<r&&!(e.charCodeAt(t)===42&&e.charCodeAt(t+1)===47))t++;t=t<r?t+2:r,this.addToken(25,s,t);continue}if(xe(n)){let s=t;while(t<r&&xe(e.charCodeAt(t)))t++;this.addToken(13,s,t);continue}if(n===34||n===39){t=this.consumeString(n,t);continue}if(n===35){if(t+1<r&&(Mc(e.charCodeAt(t+1))||De(e.charCodeAt(t+1),e.charCodeAt(t+2)))){let s=t;t++,t=this.consumeName(t),this.addToken(4,s,t);continue}this.addToken(9,t,t+1),t++;continue}switch(n){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(n===60&&e.startsWith("!--",t+1)){this.addToken(14,t,t+4),t+=4;continue}if(n===45&&e.startsWith("->",t+1)){this.addToken(15,t,t+3),t+=3;continue}if(n===64){let s=e.charCodeAt(t+1),c=e.charCodeAt(t+2),a=e.charCodeAt(t+3);if(Kr(s,c,a)){let l=t;t++,t=this.consumeName(t),this.addToken(3,l,t);continue}this.addToken(9,t,t+1),t++;continue}let i=e.charCodeAt(t+1),o=e.charCodeAt(t+2);if(Dc(n,i,o)){t=this.consumeNumeric(t);continue}if(Kr(n,i,o)){t=this.consumeIdentLike(t);continue}if(n===92){if(De(n,i)){t=this.consumeIdentLike(t);continue}this.addToken(9,t,t+1),t++;continue}this.addToken(9,t,t+1),t++}this.addToken(0,r,r)}consumeString(e,t){let r=this.source,n=r.length,i=t+1;while(i<n){let o=r.charCodeAt(i);if(o===e)return i++,this.addToken(5,t,i),i;if(Gr(o))return this.addToken(6,t,i),i;if(o===92){let s=r.charCodeAt(i+1);if(Gr(s)){i+=2;continue}if(i+1<n){i=this.consumeEscapeSkip(i+1);continue}}i++}return this.addToken(5,t,i),i}consumeEscapeSkip(e){let t=this.source;if(e>=t.length)return e;let r=t.charCodeAt(e);if(pt(r)){let n=1;e++;while(n<6&&e<t.length&&pt(t.charCodeAt(e)))e++,n++;if(e<t.length&&xe(t.charCodeAt(e)))e++;return e}return e+1}consumeName(e){let t=this.source,r=t.length,n=e;while(n<r){let i=t.charCodeAt(n);if(i<128&&(je[i]&10)!==0){n++;continue}if(i===45){n++;continue}if(i>=128){n++;continue}if(i===92&&De(i,t.charCodeAt(n+1))){n=this.consumeEscapeSkip(n+1);continue}break}return n}consumeNumber(e){let t=this.source,r=e;if(t.charCodeAt(r)===43||t.charCodeAt(r)===45)r++;while(r<t.length&&le(t.charCodeAt(r)))r++;if(t.charCodeAt(r)===46&&le(t.charCodeAt(r+1))){r+=2;while(r<t.length&&le(t.charCodeAt(r)))r++}let n=t.charCodeAt(r);if(n===69||n===101){let i=t.charCodeAt(r+1),o=t.charCodeAt(r+2);if(le(i)){r+=2;while(r<t.length&&le(t.charCodeAt(r)))r++}else if((i===43||i===45)&&le(o)){r+=3;while(r<t.length&&le(t.charCodeAt(r)))r++}}return r}consumeNumeric(e){let t=this.source,r=this.consumeNumber(e),n=t.charCodeAt(r),i=t.charCodeAt(r+1),o=t.charCodeAt(r+2);if(Kr(n,i,o)){let s=this.consumeName(r);return this.addToken(12,e,s),s}if(n===37)return this.addToken(11,e,r+1),r+1;return this.addToken(10,e,r),r}consumeIdentLike(e){let t=this.source,r=this.consumeName(e),n=t.charCodeAt(r);if(n===40&&r-e===3){let i=t.charCodeAt(e)|32,o=t.charCodeAt(e+1)|32,s=t.charCodeAt(e+2)|32;if(i===117&&o===114&&s===108){let c=r+1;while(c<t.length&&xe(t.charCodeAt(c)))c++;let a=t.charCodeAt(c);if(a===34||a===39)return this.addToken(2,e,r+1),r+1;return this.consumeUrl(e,r)}}if(n===40)return this.addToken(2,e,r+1),r+1;return this.addToken(1,e,r),r}consumeUrl(e,t){let r=this.source,n=r.length,i=t+1;while(i<n&&xe(r.charCodeAt(i)))i++;while(i<n){let o=r.charCodeAt(i);if(o===41)return i++,this.addToken(7,e,i),i;if(xe(o)){let s=i;while(i<n&&xe(r.charCodeAt(i)))i++;if(i>=n)return this.addToken(7,e,i),i;if(r.charCodeAt(i)===41)return i++,this.addToken(7,e,i),i;return this.consumeBadUrl(e,s)}if(o===34||o===39||o===40||Fc(o))return this.consumeBadUrl(e,i);if(o===92){if(De(o,r.charCodeAt(i+1))){i=this.consumeEscapeSkip(i+1);continue}return this.consumeBadUrl(e,i)}i++}return this.addToken(7,e,i),i}consumeBadUrl(e,t){let r=this.source,n=t;while(n<r.length){let i=r.charCodeAt(n);if(i===41){n++;break}if(i===92&&De(i,r.charCodeAt(n+1))){n=this.consumeEscapeSkip(n+1);continue}n++}return this.addToken(8,e,n),n}locate(e){let t=this.lineStarts,r=0,n=t.length-1;while(r<n){let o=r+n+1>>1;if(t[o]<=e)r=o;else n=o-1}let i=t[r];return{line:r+1,column:e-i+1}}}function jc(e){let t=[0],r=e.length;for(let n=0;n<r;n++){let i=e.charCodeAt(n);if(i===10)t.push(n+1);else if(i===13){if(e.charCodeAt(n+1)!==10)t.push(n+1)}}return t}function Hr(e,t,r){for(let n=t;n<r;n++)if(e.charCodeAt(n)===92)return Bc(e,t,r,n);return e.slice(t,r)}function Bc(e,t,r,n){let i=e.slice(t,n),o=n;while(o<r){if(e.charCodeAt(o)!==92){i+=e[o],o++;continue}if(o+1>=r){o++;continue}let c=e.charCodeAt(o+1);if(c===10){o+=2;continue}if(c===13){o+=e.charCodeAt(o+2)===10?3:2;continue}if(pt(c)){let a=o+1,l="";while(l.length<6&&a<r&&pt(e.charCodeAt(a)))l+=e[a],a++;let u=Number.parseInt(l,16);if(a<r&&xe(e.charCodeAt(a)))a++;i+=u===0||u>=55296&&u<=57343||u>1114111?String.fromCodePoint(65533):String.fromCodePoint(u),o=a;continue}i+=e[o+1],o+=2}return i}function qr(e,t,r){for(let n=t;n<r;n++)if(e.charCodeAt(n)===92)return Uc(e,t,r,n);return e.slice(t,r)}function Uc(e,t,r,n){let i=e.slice(t,n),o=n;while(o<r){if(e.charCodeAt(o)!==92){i+=e[o],o++;continue}let c=o+1,a="";while(a.length<6&&c<r&&pt(e.charCodeAt(c)))a+=e[c],c++;if(a.length>0){let l=Number.parseInt(a,16);if(c<r&&xe(e.charCodeAt(c)))c++;i+=l===0||l>=55296&&l<=57343||l>1114111?String.fromCodePoint(65533):String.fromCodePoint(l),o=c;continue}if(c<r){i+=e[c],o=c+1;continue}i+=String.fromCodePoint(65533),o=c}return i}function Oi(e,t){let r=new Tt(e);return{source:e,types:r.types,starts:r.starts,ends:r.ends,count:r.count,end:r.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:r}}function x(e){return e.pos<e.end?e.types[e.pos]:0}function w(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 C(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 me(e,t){return e.source.slice(t.start,t.end)}function ce(e){let{types:t,end:r}=e;while(e.pos<r){let n=t[e.pos];if(n===13||n===25)e.pos++;else break}}function ki(e){let{types:t,end:r}=e;while(e.pos<r&&t[e.pos]===13)e.pos++}function k(e,t,r){if(!e.positions)return null;let n=e.tokenizer.locate(t.start),i=e.tokenizer.locate(r.end);return{source:e.filename??"<unknown>",start:{offset:t.start,line:n.line,column:n.column},end:{offset:r.end,line:i.line,column:i.column}}}function Ii(e){if(!e.positions)return null;let t=w(e),r=e.tokenizer.locate(t.start);return{source:e.filename??"<unknown>",start:{offset:t.start,line:r.line,column:r.column},end:{offset:t.start,line:r.line,column:r.column}}}function Nt(e,t,r,n){return{type:"Raw",value:e,loc:k(n,t,r)}}function X(){return new oe}function Yr(e,t,r,n){if(e.onParseError){let{line:i,column:o}=e.tokenizer.locate(r.start),s=SyntaxError(`${e.filename??"<input>"}:${i}:${o}: ${t}`);s.line=i,s.column=o,s.offset=r.start,e.onParseError(s,n)}return n}function It(e,t={}){let r=Oi(e,t);switch(t.context??"stylesheet"){case"stylesheet":return Ai(r);case"atrule":return Pt(r)??Si(r);case"atrulePrelude":return Kc(r);case"mediaQuery":case"mediaQueryList":return Ei(r);case"rule":return Xr(r);case"selectorList":return en(r);case"selector":return Mi(r);case"block":return Zr(r);case"declarationList":return qc(r);case"declaration":return Qr(r)??Si(r);case"value":return Yc(r);case"raw":return Ei(r);default:return Ai(r)}}function Si(e){return{type:"StyleSheet",children:X(),loc:Ii(e)}}function Ei(e){let t=w(e),r=t;while(x(e)!==0)r=C(e);return{type:"Raw",value:e.source.slice(t.start,r.end),loc:k(e,t,r)}}function Ai(e){let t=w(e),r=X(),{types:n,end:i}=e;while(e.pos<i){let c=n[e.pos];if(c===13){e.pos++;continue}if(c===25){let u={type:25,start:e.starts[e.pos],end:e.ends[e.pos]},f=Jr(e,u);e.pos++,r.appendData(f);continue}if(c===0)break;if(c===14||c===15){e.pos++;continue}if(c===3){let u=Pt(e);if(u)r.appendData(u);continue}if(c===24){e.pos++;continue}let a=e.pos,l=Xr(e);if(r.appendData(l),e.pos===a)e.pos++}let o=e.end-1,s=o>=0?{type:e.types[o],start:e.starts[o],end:e.ends[o]}:{type:0,start:0,end:0};return{type:"StyleSheet",children:r,loc:k(e,t,s)}}function Jr(e,t){return{type:"Comment",value:e.source.slice(t.start+2,t.end-2),loc:k(e,t,t)}}function Pt(e){let t=w(e);if(t.type!==3)return null;e.pos++;let r=Ot(e.source,t.start+1,t.end);ce(e);let n=e.pos,i=w(e),{types:o,end:s}=e,c=n,a=n;while(c<s){let f=o[c];if(f===0||f===17||f===23)break;if(f!==13&&f!==25)a=c+1;c++}let l=null;if(a>n){let f=e.starts[n],d=e.ends[a-1],h={type:o[a-1],start:e.starts[a-1],end:d},m=e.source.slice(f,d).trim();if(m.length>0)if(e.parseAtrulePrelude)try{let p=e.end;e.end=a,e.pos=n;let g=X();while(x(e)!==0){let y=Be(e);if(y)g.appendData(y)}if(_i(g),e.end=p,e.pos=c,g.isEmpty)l=Nt(m,i,h,e);else l={type:"AtrulePrelude",children:g,loc:null}}catch(p){let g=Nt(m,i,h,e);Yr(e,`Failed to parse @${r} prelude: ${p.message}`,i,g),l=g,e.pos=c}else l=Nt(m,i,h,e),e.pos=c;else e.pos=c}else e.pos=c;let u=null;if(x(e)===17)C(e);else if(x(e)===23)u=Zr(e,Wc.has(r));return{type:"Atrule",name:r,prelude:l,block:u,loc:k(e,t,w(e))}}var zc=new Set(["is","not","where","has","matches","-moz-any","-webkit-any"]),Wc=new Set(["media","supports","document","layer","container","scope","starting-style","-moz-document","keyframes","-webkit-keyframes","-moz-keyframes","-o-keyframes"]);function Kc(e){let t=w(e),r=X();while(x(e)!==0){if(w(e).type===13){e.pos++;continue}let i=Be(e);if(i)r.appendData(i)}return{type:"AtrulePrelude",children:r,loc:k(e,t,w(e))}}function Xr(e){let t=w(e),r;if(e.parseRulePrelude)r=en(e);else{let i=w(e),o=i;while(x(e)!==0&&x(e)!==23)o=C(e);let s=e.source.slice(i.start,o.end).trim();r=Nt(s,i,o,e)}let n=Zr(e,!0);return{type:"Rule",prelude:r,block:n,loc:k(e,t,w(e))}}function Zr(e,t=!1){let r=w(e);if(x(e)!==23)return{type:"Block",children:X(),loc:Ii(e)};e.pos++;let n=X(),{types:i,end:o}=e;while(e.pos<o){let s=i[e.pos];if(s===24||s===0)break;if(s===13){e.pos++;continue}if(s===25){let a={type:25,start:e.starts[e.pos],end:e.ends[e.pos]};e.pos++,n.appendData(Jr(e,a));continue}if(s===3){let a=Pt(e);if(a)n.appendData(a);continue}if(t&&Gc(e,Hc)){let a=Xr(e);n.appendData(a);continue}let c=Qr(e);if(c)n.appendData(c);if(e.pos<o&&i[e.pos]===17)e.pos++}if(x(e)===24)e.pos++;return{type:"Block",children:n,loc:k(e,r,w(e))}}function Gc(e,t){let r=e.pos,n=t(e);return e.pos=r,n}function Hc(e){let{types:t,end:r}=e;while(e.pos<r){let n=t[e.pos];if(n===23)return!0;if(n===17||n===24||n===0)return!1;e.pos++}return!1}function qc(e){let t=w(e),r=X();while(x(e)!==0&&x(e)!==24){let n=w(e);if(n.type===13){e.pos++;continue}if(n.type===25){r.appendData(Jr(e,C(e)));continue}if(n.type===17){e.pos++;continue}if(n.type===3){let o=Pt(e);if(o)r.appendData(o);continue}let i=Qr(e);if(i)r.appendData(i);if(x(e)===17)C(e)}return{type:"DeclarationList",children:r,loc:k(e,t,w(e))}}function Qr(e){ce(e);let t=w(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{Yr(e,"Expected property name",t,{type:"Raw",value:"",loc:null});let{types:R,end:I}=e;while(e.pos<I){let _=R[e.pos];if(_===0||_===17||_===24)break;e.pos++}return null}let r=e.starts[e.pos],n=e.ends[e.pos];e.pos++;let i=e.source.slice(r,n);if(ki(e),x(e)!==16){Yr(e,`Expected ':' after property "${i}"`,w(e),{type:"Raw",value:"",loc:null});let{types:R,end:I}=e;while(e.pos<I){let _=R[e.pos];if(_===0||_===17||_===24)break;e.pos++}return null}e.pos++,ki(e);let{types:o,starts:s,end:c,pos:a}=e,l=a,u=a,f=-1,d=-1;while(l<c){let R=o[l];if(R===0||R===17||R===24)break;if(R===9&&e.source.charCodeAt(s[l])===33){let I=l+1;while(I<c&&o[I]===13)I++;if(I<c&&o[I]===1){let _=s[I];if(e.ends[I]-_===9&&(e.source.charCodeAt(_)|32)===105&&(e.source.charCodeAt(_+1)|32)===109&&(e.source.charCodeAt(_+2)|32)===112&&(e.source.charCodeAt(_+3)|32)===111&&(e.source.charCodeAt(_+4)|32)===114&&(e.source.charCodeAt(_+5)|32)===116&&(e.source.charCodeAt(_+6)|32)===97&&(e.source.charCodeAt(_+7)|32)===110&&(e.source.charCodeAt(_+8)|32)===116){d=l,f=I,l=I+1;continue}}}if(R!==13&&R!==25)u=l+1;l++}let h=u,m=f>=0?{type:1,start:s[f],end:e.ends[f]}:null,p=i.startsWith("--"),g,y=s[a],b=h>a?e.ends[h-1]:y,v={type:o[a],start:y,end:e.ends[a]},S=h>a?{type:o[h-1],start:s[h-1],end:b}:v;if(p&&!e.parseCustomProperty||!e.parseValue)g={type:"Raw",value:e.source.slice(y,b).trim(),loc:k(e,v,S)};else if(h===a)g={type:"Value",children:X(),loc:k(e,v,S)};else{let R=e.end;e.end=h,e.pos=a,g=Pi(e),e.end=R}return e.pos=l,{type:"Declaration",property:i,important:m?!0:!1,value:g,loc:k(e,t,w(e))}}function Yc(e){return Pi(e)}function Pi(e){let t=w(e),r=X();while(x(e)!==0&&x(e)!==17&&x(e)!==24&&x(e)!==22&&x(e)!==20){let n=Be(e);if(n)r.appendData(n)}return Li(r),{type:"Value",children:r,loc:k(e,t,w(e))}}function _i(e){for(let t of e)if("children"in t&&t.children instanceof oe)_i(t.children);Li(e)}function Li(e){let t=e.head;while(t){if(t.data.type==="Number"){let r=t.next;while(r&&r.data.type==="WhiteSpace")r=r.next;if(r&&r.data.type==="Operator"&&r.data.value==="/"){let n=r.next;while(n&&n.data.type==="WhiteSpace")n=n.next;if(n&&n.data.type==="Number"){let i={type:"Ratio",left:t.data,right:n.data,loc:null},o=t.next;while(o&&o!==n.next){let s=o.next;e.remove(o),o=s}e.replace(t,e.createItem(i)),t=e.head;continue}}}t=t.next}}function Be(e){let t=e.pos;if(t>=e.end)return null;let r=e.types[t],n=e.starts[t],i=e.ends[t],o=e.source;switch(r){case 13:return e.pos++,e.positions?{type:"WhiteSpace",value:" ",loc:J(e,n,i)}:{type:"WhiteSpace",value:" ",loc:null};case 25:return e.pos++,{type:"Comment",value:o.slice(n+2,i-2),loc:e.positions?J(e,n,i):null};case 10:return e.pos++,{type:"Number",value:o.slice(n,i),loc:e.positions?J(e,n,i):null};case 11:return e.pos++,{type:"Percentage",value:o.slice(n,i-1),loc:e.positions?J(e,n,i):null};case 12:{e.pos++;let s=n,c=o.charCodeAt(s);if(c===43||c===45)s++;let a=!1;while(s<i){let u=o.charCodeAt(s);if(u>=48&&u<=57){s++;continue}if(u===46&&!a){a=!0,s++;continue}break}let l=o.charCodeAt(s);if(l===69||l===101){let u=s+1,f=o.charCodeAt(u);if(f===43||f===45)u++;let d=!1;while(u<i){let h=o.charCodeAt(u);if(h>=48&&h<=57){u++,d=!0;continue}break}if(d)s=u}return{type:"Dimension",value:o.slice(n,s),unit:o.slice(s,i),loc:e.positions?J(e,n,i):null}}case 1:return e.pos++,{type:"Identifier",name:qr(o,n,i),loc:e.positions?J(e,n,i):null};case 5:{e.pos++;let s=n+1,a=i-n>=2&&o.charCodeAt(i-1)===o.charCodeAt(n)?i-1:i;return{type:"String",value:Hr(o,s,a),loc:e.positions?J(e,n,i):null}}case 7:{e.pos++;let s=n+4;while(s<i&&Ti(o.charCodeAt(s)))s++;let c=i;if(c>s&&o.charCodeAt(c-1)===41)c--;while(c>s&&Ti(o.charCodeAt(c-1)))c--;let a;if(c-s>=2){let l=o.charCodeAt(s),u=o.charCodeAt(c-1);if((l===34||l===39)&&l===u)a=o.slice(s+1,c-1);else a=o.slice(s,c)}else a=o.slice(s,c);return{type:"Url",value:a,loc:e.positions?J(e,n,i):null}}case 4:return e.pos++,{type:"Hash",name:o.slice(n+1,i),loc:e.positions?J(e,n,i):null};case 2:return Xc(e);case 21:return Zc(e);case 18:return e.pos++,{type:"Operator",value:",",loc:e.positions?J(e,n,i):null};case 16:return e.pos++,{type:"Operator",value:":",loc:e.positions?J(e,n,i):null};case 9:{e.pos++;let s=o.charCodeAt(n),c=o[n];if(Jc(s))return{type:"Operator",value:c,loc:e.positions?J(e,n,i):null};return{type:"Identifier",name:c,loc:e.positions?J(e,n,i):null}}case 19:{e.pos++;let s=X();while(x(e)!==0&&x(e)!==20){let a=Be(e);if(a)s.appendData(a)}let c=e.pos<e.end?e.ends[e.pos]:i;if(x(e)===20)e.pos++;return{type:"Brackets",children:s,loc:e.positions?J(e,n,c):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:o.slice(n,i),loc:e.positions?J(e,n,i):null}}return e.pos++,null}function Ti(e){return e===32||e===9||e===10||e===12||e===13}function Jc(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 Ot(e,t,r){for(let n=t;n<r;n++){let i=e.charCodeAt(n);if(i>=65&&i<=90)return e.slice(t,r).toLowerCase()}return e.slice(t,r)}function J(e,t,r){let n=e.tokenizer.locate(t),i=e.tokenizer.locate(r);return{source:e.filename??"<unknown>",start:{offset:t,line:n.line,column:n.column},end:{offset:r,line:i.line,column:i.column}}}function Xc(e){let t=C(e),r=Ot(e.source,t.start,t.end-1),n=X();while(x(e)!==0&&x(e)!==22){let i=Be(e);if(i)n.appendData(i)}if(x(e)===22)C(e);if(r==="url"){for(let i=n.head;i!=null;i=i.next)if(i.data.type==="String")return{type:"Url",value:i.data.value,loc:k(e,t,w(e))}}return{type:"Function",name:r,children:n,loc:k(e,t,w(e))}}function Zc(e){let t=C(e),r=X();while(x(e)!==0&&x(e)!==22){let n=Be(e);if(n)r.appendData(n)}if(x(e)===22)C(e);return{type:"Parentheses",children:r,loc:k(e,t,w(e))}}function en(e){let t=w(e),r=X();while(x(e)!==0){if(ce(e),x(e)===0||x(e)===23)break;let n=Mi(e);if(n.children.head!==null)r.appendData(n);if(ce(e),x(e)===18){C(e);continue}break}return{type:"SelectorList",children:r,loc:k(e,t,w(e))}}function Mi(e){let t=w(e),r=X(),n=!0;while(x(e)!==0&&x(e)!==18&&x(e)!==23){let i=w(e);if(i.type===13){if(C(e),!n&&x(e)!==0&&x(e)!==18&&x(e)!==23&&!Ni(e)&&!Qc(e)){let s={type:"Combinator",name:" ",loc:k(e,i,i)};r.appendData(s),n=!0}continue}if(i.type===9&&e.source.charCodeAt(i.start)===124&&e.types[e.pos+1]===9&&e.source.charCodeAt(e.starts[e.pos+1])===124){let s=w(e);C(e);let c=C(e),a={type:"Combinator",name:"||",loc:k(e,s,c)};r.appendData(a),n=!0,ce(e);continue}if(Ni(e)){let s=C(e),a={type:"Combinator",name:e.source[s.start],loc:k(e,s,s)};r.appendData(a),n=!0,ce(e);continue}let o=eu(e);if(!o)break;r.appendData(o),n=!1}while(r.tail&&r.tail.data.type==="Combinator")r.remove(r.tail);return{type:"Selector",children:r,loc:k(e,t,w(e))}}function Ni(e){let t=w(e);if(t.type!==9)return!1;let r=e.source[t.start];return r===">"||r==="+"||r==="~"}function Qc(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 eu(e){let t=w(e);switch(t.type){case 1:{if(C(e),x(e)===9&&e.source[w(e).start]==="|"&&e.source[w(e).start+1]!=="="&&!(e.types[e.pos+1]===9&&e.source.charCodeAt(e.starts[e.pos+1])===124)){if(C(e),x(e)===1){let n=C(e);return{type:"TypeSelector",name:`${me(e,t)}|${me(e,n)}`,loc:k(e,t,n)}}if(x(e)===9&&e.source[w(e).start]==="*"){let n=C(e);return{type:"TypeSelector",name:`${me(e,t)}|*`,loc:k(e,t,n)}}}return{type:"TypeSelector",name:me(e,t),loc:k(e,t,t)}}case 11:return C(e),{type:"TypeSelector",name:me(e,t),loc:k(e,t,t)};case 10:return C(e),{type:"TypeSelector",name:me(e,t),loc:k(e,t,t)};case 9:{let r=e.source[t.start];if(r==="*")return C(e),{type:"TypeSelector",name:"*",loc:k(e,t,t)};if(r==="."){if(C(e),x(e)===1){let n=C(e);return{type:"ClassSelector",name:me(e,n),loc:k(e,t,n)}}return null}if(r==="&")return C(e),{type:"NestingSelector",loc:k(e,t,t)};return C(e),null}case 4:return C(e),{type:"IdSelector",name:e.source.slice(t.start+1,t.end),loc:k(e,t,t)};case 16:{C(e);let r=x(e)===16;if(r)C(e);return tu(e,r,t)}case 19:return ru(e)}return null}function tu(e,t,r){let n=w(e);if(n.type===1){C(e);let i=Ot(e.source,n.start,n.end);return t?{type:"PseudoElementSelector",name:i,children:null,loc:k(e,r,n)}:{type:"PseudoClassSelector",name:i,children:null,loc:k(e,r,n)}}if(n.type===2){C(e);let i=Ot(e.source,n.start,n.end-1),o=X();if(!t&&zc.has(i)){let a=w(e),l=a,u=1;while(x(e)!==0&&u>0){if(x(e)===21||x(e)===2)u++;else if(x(e)===22){if(u--,u===0)break}l=C(e)}if(x(e)===22)C(e);let f=e.source.slice(a.start,l.end).trim();if(f.length>0){let d=Oi(f,{positions:!1}),h=en(d);o.appendData(h)}}else{while(x(e)!==0&&x(e)!==22){let a=Be(e);if(a)o.appendData(a)}if(x(e)===22)C(e)}if(t)return{type:"PseudoElementSelector",name:i,children:o,loc:k(e,r,w(e))};return{type:"PseudoClassSelector",name:i,children:o,loc:k(e,r,w(e))}}return null}function ru(e){let t=C(e);ce(e);let r=w(e);if(r.type!==1)return null;C(e);let n={type:"Identifier",name:me(e,r),loc:k(e,r,r)};ce(e);let i=null,o=null,s=null,c=w(e);if(c.type===9){let l=e.source[c.start],u=e.source[c.start+1];if(l==="=")i="=",C(e);else if((l==="~"||l==="|"||l==="^"||l==="$"||l==="*")&&u==="="){C(e);let h=w(e);if(h.type===9&&e.source[h.start]==="=")C(e),i=`${l}=`}ce(e);let f=w(e);if(f.type===5){C(e);let h=f.end-f.start>=2&&e.source.charCodeAt(f.end-1)===e.source.charCodeAt(f.start);o={type:"String",value:Hr(e.source,f.start+1,h?f.end-1:f.end),loc:k(e,f,f)}}else if(f.type===1)C(e),o={type:"Identifier",name:me(e,f),loc:k(e,f,f)};ce(e);let d=w(e);if(d.type===1)C(e),s=me(e,d)}ce(e);let a=w(e);if(x(e)===20)a=C(e);return{type:"AttributeSelector",name:n,matcher:i,value:o,flags:s,loc:k(e,t,a)}}var Fi=Symbol("walkSkip"),B=Symbol("walkStop");function nu(e){return{root:e,stylesheet:null,atrule:null,atrulePrelude:null,rule:null,selector:null,block:null,declaration:null,function:null}}function iu(e,t){let r=nu(e),n=typeof t==="function"?t:t.enter,i=typeof t==="function"?null:t.leave??null,o=typeof t==="function"?null:t.visit??null,s=typeof t==="function"?!1:t.reverse??!1;function c(a,l,u){let f=null,d;switch(a.type){case"StyleSheet":f="stylesheet",d=r.stylesheet,r.stylesheet=a;break;case"Atrule":f="atrule",d=r.atrule,r.atrule=a;break;case"AtrulePrelude":f="atrulePrelude",d=r.atrulePrelude,r.atrulePrelude=a;break;case"Rule":f="rule",d=r.rule,r.rule=a;break;case"Selector":f="selector",d=r.selector,r.selector=a;break;case"Block":f="block",d=r.block,r.block=a;break;case"Declaration":f="declaration",d=r.declaration,r.declaration=a;break;case"Function":f="function",d=r.function,r.function=a;break}let h;if((o===null||o===a.type)&&n){let m=n.call(r,a,l,u);if(m===Fi){if(f)r[f]=d;return}if(m===B){if(f)r[f]=d;return B}}if(h=ou(a,s,c),h===B){if(f)r[f]=d;return B}if((o===null||o===a.type)&&i){if(i.call(r,a,l,u)===B){if(f)r[f]=d;return B}}if(f)r[f]=d;return}return c(e,null,null)}var Ue=Object.assign(iu,{skip:Fi,stop:B});function ou(e,t,r){if("children"in e&&e.children instanceof oe)return su(e.children,t,r);if(e.type==="Rule"){if(r(e.prelude,null,null)===B)return B;if(r(e.block,null,null)===B)return B;return}if(e.type==="Atrule"){if(e.prelude){if(r(e.prelude,null,null)===B)return B}if(e.block){if(r(e.block,null,null)===B)return B}return}if(e.type==="Declaration")return r(e.value,null,null);if(e.type==="AttributeSelector"){if(r(e.name,null,null)===B)return B;if(e.value)return r(e.value,null,null);return}return}function su(e,t,r){let n;if(t)e.forEachRight((i,o,s)=>{if(n)return;if(r(i,o,s)===B)n=B});else e.forEach((i,o,s)=>{if(n)return;if(r(i,o,s)===B)n=B});return n}function He(e,t={}){let r=t.exclamation??!1,n=!1;Ue(e,(i,o,s)=>{if(i.type!=="Comment")return;let c=i.value.startsWith("!");if(r===!0&&c)return;if(r==="first-exclamation"&&c&&!n){n=!0;return}if(o&&s)s.remove(o)})}function _t(e){Ue(e,(t)=>{if(t.type!=="Block"&&t.type!=="DeclarationList")return;if(!("children"in t)||!t.children)return;let r=t.children,n=r.head;if(n==null||n.next==null)return;let i=0;for(let c=n;c!=null;c=c.next)if(c.data.type==="Declaration"){if(i++,i>=2)break}if(i<2)return;let o=new Map,s=[];for(let c=n;c!=null;c=c.next){let a=c.data;if(a.type!=="Declaration")continue;let l=a.property,u=o.get(l);if(u){let f=!!u.decl.important,d=!!a.important;if(d||f===d)s.push(u.item),o.set(l,{item:c,decl:a});else s.push(c)}else o.set(l,{item:c,decl:a})}for(let c of s)r.remove(c)})}var au={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"},lu={"#f00":"red","#ff0000":"red","#000080":"navy","#008080":"teal"};function rn(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 Di(e){let t=e.toLowerCase();return au[t]??null}function ji(e){let t=e.toLowerCase();return lu[t]??null}function cu(e,t,r){let n=(e<<16|t<<8|r).toString(16).padStart(6,"0");return rn(`#${n}`)}var uu=/^rgba?\(\s*([+-]?\d*\.?\d+%?)\s*[,\s]\s*([+-]?\d*\.?\d+%?)\s*[,\s]\s*([+-]?\d*\.?\d+%?)\s*(?:[,/]\s*([+-]?\d*\.?\d+%?)\s*)?\)$/;function Bi(e){let t=uu.exec(e.trim());if(!t)return e;let r=tn(t[1]),n=tn(t[2]),i=tn(t[3]);if(t[4]!==void 0&&!fu(t[4]))return e;return cu(r,n,i)}function fu(e){if(e.endsWith("%"))return Number.parseFloat(e)>=100;return Number.parseFloat(e)>=1}function tn(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 du=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 Lt(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 Ui(e,t){let r=Lt(e);if((r==="0"||r==="-0")&&du.has(t.toLowerCase()))return{value:"0",unit:""};return{value:r,unit:t}}function Vi(e){return Lt(e)}function zi(e,t){let r=Number.parseFloat(e);if(!Number.isFinite(r))return e;let n=t<0?0:t;return r.toFixed(n)}var Wi=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 Ki(e){if(!e||e.type!=="Operator")return!1;let t=e.value;return t===":"||t===","||t==="/"}function hu(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 r=t.head;while(r){let n=r.next;if(r.data.type==="WhiteSpace"){let i=r.prev&&Ki(r.prev.data),o=n&&Ki(n.data);if(i||o)t.remove(r)}r=n}}function nn(e,t={}){let r=t.floatPrecision??null,n=r===null?null:(i)=>zi(i,r);Ue(e,{enter(i,o,s){switch(i.type){case"Number":{let c=n?n(i.value):i.value;i.value=Lt(c);return}case"Percentage":{let c=n?n(i.value):i.value;i.value=Vi(c);return}case"Dimension":{let c=n?n(i.value):i.value,a=Ui(c,i.unit);i.value=a.value,i.unit=a.unit;return}case"Hash":{let c=rn(`#${i.name}`).slice(1);if(i.name=c,o&&s&&this.declaration&&Wi.has(this.declaration.property.toLowerCase())){let a=ji(`#${c}`);if(a&&a.length<c.length+1){let l={type:"Identifier",name:a,loc:i.loc};s.replace(o,s.createItem(l))}}return}case"Identifier":{if(!o||!s||!this.declaration)return;if(!Wi.has(this.declaration.property.toLowerCase()))return;let c=Di(i.name);if(c&&c.length<i.name.length){let a={type:"Hash",name:c.slice(1),loc:i.loc};s.replace(o,s.createItem(a))}return}case"Url":return;case"Function":{let c=i.name.toLowerCase();if((c==="rgb"||c==="rgba")&&o&&s)i.__rgbReplaceCandidate=!0}}},leave(i,o,s){if(i.type==="Parentheses"||i.type==="Function"||i.type==="Value")hu(i);if(i.type==="Function"&&i.__rgbReplaceCandidate&&o&&s){let c=Y(i),a=Bi(c);if(a!==c&&a.startsWith("#")){let l={type:"Hash",name:a.slice(1),loc:i.loc};s.replace(o,s.createItem(l))}}}})}function gu(e,t={}){let r=It(e,{context:"stylesheet"});return Gi(r,t)}function on(e,t={}){let r=It(e,{context:"declarationList"});return Gi(r,t)}function Gi(e,t){if(t.comments===!1)He(e,{exclamation:!1});else if(t.comments==="first-exclamation")He(e,{exclamation:"first-exclamation"});else He(e,{exclamation:!0});return nn(e,{floatPrecision:t.floatPrecision??null}),_t(e),{css:Y(e),ast:e}}function Oe(e,t,r){if(e.size>=1e4){let n=e.keys().next().value;if(n!==void 0)e.delete(n)}return e.set(t,r),r}var Hi=new Map,Ne=new Map;var sn={col:"col",row:"row",jc:"justify",ji:"justify-items",js:"justify-self",ai:"items",ac:"content",as:"self",wrap:"wrap",nowrap:"nowrap",c:"center",s:"start",e:"end",sb:"between",sa:"around",se:"evenly",st:"stretch",thin:"thin",extralight:"extralight",light:"light",normal:"normal",medium:"medium",semibold:"semibold",bold:"bold",extrabold:"extrabold",black:"black",t:"top",r:"right",b:"bottom",l:"left"},yu=/[%#()]/,bu=/^\d+(?:\.\d+)?(?:px|rem|em|vh|vw|dvh|dvw|svh|svw|lvh|lvw|ch|ex|lh|cap|ic|rlh|vi|vb|vmin|vmax|cqw|cqh|cqi|cqb|cqmin|cqmax|cm|mm|in|pt|pc|Q)$/,eo=["calc","min","max","clamp","mod","rem","sin","cos","tan","asin","acos","atan","atan2","pow","sqrt","hypot","log","exp","round"],xu=new Set(eo);function re(e){return yu.test(e)||bu.test(e)}function qi(e){if(!eo.some((o)=>e.includes(`${o}(`)))return e;let t="",r=[],n=null,i=null;for(let o=0;o<e.length;o++){let s=e.charCodeAt(o);if(s>=48&&s<=57)n=o;else if(n!==null&&(s===37||s>=97&&s<=122||s>=65&&s<=90))n=o;else i=n,n=null;if(s===40){t+=e[o];let a=o;for(let u=o-1;u>=0;u--){let f=e.charCodeAt(u);if(f>=48&&f<=57||f>=97&&f<=122)a=u;else break}let l=e.slice(a,o);if(xu.has(l))r.unshift(!0);else if(r[0]&&l==="")r.unshift(!0);else r.unshift(!1);continue}if(s===41){t+=e[o],r.shift();continue}if(s===44&&r[0]){t+=", ";continue}if(s===32&&r[0]&&t.charCodeAt(t.length-1)===32)continue;if((s===43||s===45||s===42||s===47)&&r[0]){let a=t.trimEnd(),l=a.charCodeAt(a.length-1),u=a.charCodeAt(a.length-2),f=e.charCodeAt(o+1),d=l===43||l===45||l===42||l===47,h=f===43||f===45||f===42||f===47;if((l===101||l===69)&&u>=48&&u<=57)t+=e[o];else if(d||l===40||l===44)t+=e[o];else if(e.charCodeAt(o-1)===32)t+=`${e[o]} `;else if(l>=48&&l<=57||f>=48&&f<=57||l===41||f===40||h||i!==null&&i===o-1)t+=` ${e[o]} `;else t+=e[o];continue}t+=e[o]}return t}function Mt(e){if(!e.includes("_"))return qi(e);let t="",r=0;while(r<e.length){let n=e[r];if(n==="\\"&&e[r+1]==="_"){t+="_",r+=2;continue}if(n==="u"&&e.slice(r,r+4)==="url("){let i=r,o=1;r+=4;while(r<e.length&&o>0){if(e[r]==="(")o++;else if(e[r]===")")o--;r++}t+=e.slice(i,r);continue}t+=n==="_"?" ":n,r++}return qi(t)}function Yi(e,t){if(t.length!==2)return null;let[r,n]=t;if(r!=="min"&&r!=="max")return null;return[re(n)?`${r}-${e}-[${n}]`:`${r}-${e}-${n}`]}var vu={flex:{expand:(e,t)=>{let r=t[e]||e;if(["col","row","col-reverse","row-reverse","wrap","nowrap","wrap-reverse"].includes(r))return`flex-${r}`;let n=e.match(/^(jc|ji|js|ai|ac|as)-(.+)$/);if(n){let i=t[n[1]]||n[1],o=t[n[2]]||n[2];return`${i}-${o}`}if(/^\d+$/.test(r)||["grow","shrink","auto","initial","none"].includes(r))return`flex-${r}`;return null}},grid:{expand:(e,t)=>{let r=t[e]||e;if(e.startsWith("cols-")||e.startsWith("rows-"))return`grid-${e}`;if(e.startsWith("flow-"))return`grid-${e}`;if(e.startsWith("gap-"))return e;return null}},text:{expand:(e,t)=>{let r=t[e]||e;if(re(r))return`text-[${r}]`;if(/^\d{3}$/.test(r))return{"100":"font-thin","200":"font-extralight","300":"font-light","400":"font-normal","500":"font-medium","600":"font-semibold","700":"font-bold","800":"font-extrabold","900":"font-black"}[r]||`font-[${r}]`;if(/^[a-z-]+$/i.test(r)&&!["xs","sm","base","lg","xl","2xl","3xl","4xl","5xl","6xl","7xl","8xl","9xl"].includes(r)){if(["white","black","inherit","current","transparent"].includes(r.toLowerCase()))return`text-${r}`;if(["red","blue","green","yellow","purple","pink","gray","slate","zinc","neutral","stone","orange","amber","lime","emerald","teal","cyan","sky","indigo","violet","fuchsia","rose"].includes(r.toLowerCase()))return`text-${r}-500`;return`font-[${r}]`}return`text-${r}`}},font:{expand:(e,t)=>{let r=t[e]||e,n=["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],i=["sans","serif","mono"];if(n.includes(r)||i.includes(r))return`font-${r}`;if(/^\d{3}$/.test(r))return{"100":"font-thin","200":"font-extralight","300":"font-light","400":"font-normal","500":"font-medium","600":"font-semibold","700":"font-bold","800":"font-extrabold","900":"font-black"}[r]||`font-[${r}]`;return`font-[${r}]`}},bg:{expand:(e,t)=>`bg-${t[e]||e}`},w:{expand:(e,t)=>{let r=t[e]||e;if(re(r))return`w-[${r}]`;return`w-${r}`},multiValue:(e)=>Yi("w",e)},h:{expand:(e,t)=>{let r=t[e]||e;if(re(r))return`h-[${r}]`;return`h-${r}`},multiValue:(e)=>Yi("h",e)},p:{expand:(e)=>`p-${e}`},px:{expand:(e)=>`px-${e}`},py:{expand:(e)=>`py-${e}`},pt:{expand:(e)=>`pt-${e}`},pr:{expand:(e)=>`pr-${e}`},pb:{expand:(e)=>`pb-${e}`},pl:{expand:(e)=>`pl-${e}`},m:{expand:(e)=>`m-${e}`},mx:{expand:(e)=>`mx-${e}`},my:{expand:(e)=>`my-${e}`},mt:{expand:(e)=>`mt-${e}`},mr:{expand:(e)=>`mr-${e}`},mb:{expand:(e)=>`mb-${e}`},ml:{expand:(e)=>`ml-${e}`},scroll:{expand:(e)=>{if(["x","y"].includes(e))return null;if(["auto","hidden","scroll","visible"].includes(e))return`overflow-${e}`;return null},multiValue:(e)=>{if(e.length===2){let[t,r]=e;if(["x","y"].includes(t)&&["auto","hidden","scroll","visible"].includes(r))return[`overflow-${t}-${r}`]}return null}},overflow:{expand:(e)=>`overflow-${e}`,multiValue:(e)=>{if(e.length===2){let[t,r]=e;if(["x","y"].includes(t))return[`overflow-${t}-${r}`]}return null}},border:{expand:(e)=>`border-${e}`},rounded:{expand:(e)=>`rounded-${e}`},shadow:{expand:(e)=>`shadow-${e}`},gap:{expand:(e)=>{if(e.startsWith("x-")||e.startsWith("y-"))return`gap-${e}`;return`gap-${e}`}},space:{expand:(e)=>`space-${e}`},opacity:{expand:(e)=>`opacity-${e}`},z:{expand:(e)=>`z-${e}`},inset:{expand:(e,t)=>{let r=t[e]||e;if(r.startsWith("x-")||r.startsWith("y-"))return`inset-${r}`;if(re(r))return`inset-[${r}]`;return`inset-${r}`}},top:{expand:(e)=>re(e)?`top-[${e}]`:`top-${e}`},right:{expand:(e)=>re(e)?`right-[${e}]`:`right-${e}`},bottom:{expand:(e)=>re(e)?`bottom-[${e}]`:`bottom-${e}`},left:{expand:(e)=>re(e)?`left-[${e}]`:`left-${e}`},duration:{expand:(e)=>`duration-${e}`},delay:{expand:(e)=>`delay-${e}`},ease:{expand:(e)=>`ease-${e}`},transition:{expand:(e)=>{if(["all","none","colors","opacity","shadow","transform"].includes(e))return`transition-${e}`;if(/^\d+$/.test(e))return`duration-${e}`;if(["linear","in","out","in-out","ease-linear","ease-in","ease-out","ease-in-out"].includes(e))return e.startsWith("ease-")?e:`ease-${e}`;return`transition-${e}`}},translate:{expand:(e)=>{if(e.startsWith("x-")||e.startsWith("y-")||e.startsWith("z-"))return`translate-${e}`;return`translate-${e}`}},rotate:{expand:(e)=>{if(e.startsWith("x-")||e.startsWith("y-")||e.startsWith("z-"))return`rotate-${e}`;return`rotate-${e}`}},scale:{expand:(e)=>{if(e.startsWith("x-")||e.startsWith("y-")||e.startsWith("z-"))return`scale-${e}`;return`scale-${e}`}},skew:{expand:(e)=>{if(e.startsWith("x-")||e.startsWith("y-"))return`skew-${e}`;return`skew-${e}`}},origin:{expand:(e)=>`origin-${e}`},cursor:{expand:(e)=>`cursor-${e}`},select:{expand:(e)=>`select-${e}`},resize:{expand:(e)=>`resize-${e}`},appearance:{expand:(e)=>`appearance-${e}`},pointer:{expand:(e)=>`pointer-events-${e}`},outline:{expand:(e)=>`outline-${e}`},ring:{expand:(e)=>`ring-${e}`},blur:{expand:(e)=>`blur-${e}`},brightness:{expand:(e)=>`brightness-${e}`},contrast:{expand:(e)=>`contrast-${e}`},grayscale:{expand:(e)=>`grayscale-${e}`},saturate:{expand:(e)=>`saturate-${e}`},sepia:{expand:(e)=>`sepia-${e}`},backdrop:{expand:(e)=>`backdrop-${e}`},aspect:{expand:(e)=>`aspect-${e}`},columns:{expand:(e)=>`columns-${e}`},break:{expand:(e)=>`break-${e}`},object:{expand:(e)=>`object-${e}`},overscroll:{expand:(e)=>`overscroll-${e}`},place:{expand:(e)=>`place-${e}`},items:{expand:(e)=>`items-${e}`},justify:{expand:(e)=>`justify-${e}`},content:{expand:(e)=>`content-${e}`},self:{expand:(e)=>`self-${e}`},order:{expand:(e)=>`order-${e}`},col:{expand:(e)=>`col-${e}`},row:{expand:(e)=>`row-${e}`},tracking:{expand:(e)=>`tracking-${e}`},leading:{expand:(e)=>`leading-${e}`},list:{expand:(e)=>`list-${e}`},decoration:{expand:(e)=>`decoration-${e}`},underline:{expand:(e)=>`underline-${e}`},accent:{expand:(e)=>`accent-${e}`},caret:{expand:(e)=>`caret-${e}`},"scroll-m":{expand:(e)=>`scroll-m-${e}`},"scroll-p":{expand:(e)=>`scroll-p-${e}`},snap:{expand:(e)=>`snap-${e}`},touch:{expand:(e)=>`touch-${e}`},will:{expand:(e)=>`will-change-${e}`},fill:{expand:(e)=>`fill-${e}`},stroke:{expand:(e)=>`stroke-${e}`},sr:{expand:(e)=>`sr-${e}`},invert:{expand:(e)=>`invert-${e}`},"hue-rotate":{expand:(e)=>re(e)?`hue-rotate-[${e}]`:`hue-rotate-${e}`},"drop-shadow":{expand:(e)=>`drop-shadow-${e}`},"backdrop-invert":{expand:(e)=>`backdrop-invert-${e}`},"backdrop-hue-rotate":{expand:(e)=>re(e)?`backdrop-hue-rotate-[${e}]`:`backdrop-hue-rotate-${e}`},animate:{expand:(e)=>`animate-${e}`},"forced-colors":{expand:(e)=>`forced-colors-${e}`}},yt=new Set(["sm","md","lg","xl","2xl","hover","focus","active","visited","disabled","enabled","focus-within","focus-visible","group-hover","group-focus","peer-hover","peer-focus","dark","first","last","odd","even","only","first-of-type","last-of-type","checked","indeterminate","default","required","valid","invalid","in-range","out-of-range","placeholder-shown","autofill","read-only","empty","before","after","selection","marker","file","print","motion-safe","motion-reduce","contrast-more","contrast-less","rtl","ltr","portrait","landscape","@sm","@md","@lg","@xl","@2xl"]),Ji=new WeakMap,Xi=new WeakMap;function wu(e){if(!e)return sn;let t=Ji.get(e);if(!t)t=e.aliases?{...sn,...e.aliases}:sn,Ji.set(e,t);return t}function Cu(e){if(!e?.aliases)return"";let t=Xi.get(e);if(t===void 0)t=JSON.stringify(e.aliases),Xi.set(e,t);return t}function $u(e,t){let r=`${e}:${t?.colonSyntax}:${Cu(t)}`,n=Ne.get(r);if(n)return n;let i=wu(t);if(t?.colonSyntax===!0){let p=e.match(/^([a-z][a-z0-9-]*):([^[\]:]+)$/i);if(p){let[,g,y]=p;if(!yt.has(g)){if(re(y)){let v=[`${g}-[${y}]`];return Oe(Ne,r,v),v}let b=y.startsWith("-")?[`-${g}-${y.slice(1)}`]:[`${g}-${y}`];return Oe(Ne,r,b),b}}}let o="",s=e,c=!1;if(s.startsWith("-"))c=!0,s=s.slice(1);let a=s.match(/^((?:[a-z@][a-z0-9-]*:)+)(.+)$/i);if(a){if(a[1].slice(0,-1).split(":").every((y)=>yt.has(y)))o=a[1],s=a[2]}let l=s.match(/^([a-z][a-z0-9-]*)\[([^\]]*)\]$/i);if(!l||s.includes("-[")){let p=[e];return Oe(Ne,r,p),p}let[,u,f]=l,d=f.split(/\s+/).filter(Boolean);if(d.length===0)return Oe(Ne,r,[]),[];let h=vu[u.toLowerCase()];if(h?.multiValue){let p=h.multiValue(d,i);if(p){let g=p.map((y)=>`${o}${c?"-":""}${y}`);return Oe(Ne,r,g),g}}if(!h){let p=[];for(let g of d){let y=g.match(/^([a-z@][a-z0-9-]*):(.+)$/i),b="",v=g;if(y&&yt.has(y[1]))b=`${y[1]}:`,v=y[2];let S="";if(v.startsWith("-"))S="-",v=v.slice(1);let R="";if(v.endsWith("!"))R="!",v=v.slice(0,-1);let I=c?"-":"";if(re(v))p.push(`${o}${b}${R}${I}${S}${u}-[${v}]`);else p.push(`${o}${b}${R}${I}${S}${u}-${v}`)}return Oe(Ne,r,p),p}let m=[];for(let p of d){let g=p.match(/^([a-z@][a-z0-9-]*):(.+)$/i),y="",b=p;if(g&&yt.has(g[1]))y=`${g[1]}:`,b=g[2];let v="";if(b.startsWith("-"))v="-",b=b.slice(1);let S="";if(b.endsWith("!"))S="!",b=b.slice(0,-1);let R=h.expand(b,i);if(R){let I=c?"-":"";m.push(`${o}${y}${S}${I}${v}${R}`)}}return Oe(Ne,r,m),m}function Ru(e,t){let r=new Set;if(!t?.enabled)return r;let n=t.prefix??"tc-",i=["class","className","style","id","name","type","value","href","src","alt","title","role","for","action","method","target","rel","placeholder","disabled","checked","selected","readonly","required","maxlength","minlength","pattern","autocomplete","autofocus","tabindex","contenteditable","draggable","spellcheck","lang","dir","hidden","slot","part","is","key","ref"],o=t.ignoreAttributes||i,s=(l)=>{let u=l.includes(":")?l.split(":").pop():l;for(let f of o)if(f.endsWith("*")){if(u.startsWith(f.slice(0,-1)))return!0}else if(u===f)return!0;if(u.startsWith("on"))return!0;if(u.startsWith("data-")||u.startsWith("aria-"))return!0;return!1},c=/<([a-z][a-z0-9-]*)\s([^>]*)>/gi,a;while((a=c.exec(e))!==null){let l=a[2],u=/([a-z][a-z0-9-:]*)(?:=["']([^"']*)["'])?(?=\s|$|\/?>)/gi,f;while((f=u.exec(l))!==null){let d=f[1],h=f[2];if(n){if(!d.startsWith(n))continue;d=d.slice(n.length)}if(s(d))continue;let m="",p=d,g=d.match(/^((?:[a-z@][a-z0-9-]*:)+)([a-z][a-z0-9-]*)$/i);if(g){if(g[1].slice(0,-1).split(":").every((v)=>yt.has(v)))m=g[1],p=g[2]}if(h!==void 0){let y=h.split(/\s+/).filter(Boolean);for(let b of y){let v=`${m}${p}-${b}`;if(Zi(v.replace(/^(?:[a-z@][a-z0-9-]*:)+/gi,"")))r.add(v)}}else{let y=`${m}${p}`;if(Zi(p))r.add(y)}}}return r}function Zi(e){if(!e||e.length===0)return!1;return/^[a-z][a-z0-9-/]*(?:-\[[^\]]+\])?$/i.test(e)}function to(e){let t=Hi.get(e);if(t)return t;let r=Tu(e);return r.base=Au(r),Oe(Hi,e,r),r}var ku=new Set(["bg","text","border","ring","placeholder","divide","accent","caret","fill","stroke","outline","decoration","shadow","ring-offset","from","via","to"]),Su=/^(.+?)\/(\d+|\[\d*\.?\d+\])$/,Eu=/^(\d+)\/(\d+)$/;function Qi(e){let t=!1;for(let r=0;r<e.length;r++){let n=e.charCodeAt(r);if(n===45){if(!t||r+1>=e.length)return;return[e.slice(0,r),e.slice(r+1)]}if(n>=97&&n<=122){t=!0;continue}return}return}function Au(e){let t=e.raw;for(let r of e.variants)if(t.startsWith(`${r}:`))t=t.slice(r.length+1);if(e.important){if(t.charCodeAt(0)===33)t=t.slice(1);else if(t.charCodeAt(t.length-1)===33)t=t.slice(0,-1)}return t}function Tu(e){let t=!1,r=e;if(e.startsWith("!"))t=!0,r=e.slice(1);else if(e.endsWith("!")&&e.length>1)t=!0,r=e.slice(0,-1);let n=r.match(/^\[([a-z-]+):(.+)\]$/);if(n)return{raw:e,variants:[],utility:n[1],value:Mt(n[2]),important:t,arbitrary:!0};let i=r.match(/^((?:[a-z-]+:)*)(-?[a-z-]+?)-\[([^\]]+)\]\/\[([^\]]+)\]$/);if(i){let[,g,y,b,v]=i,S=g?g.split(":").filter(Boolean):[],R=y.startsWith("-"),I=R?y.slice(1):y,_=Mt(b);if(R)_=_.startsWith("-")?_:`-${_}`;return{raw:e,variants:S,utility:I,value:`${_}/${v}`,important:t,arbitrary:!0,modifierArbitrary:!0}}let o=r.match(/^((?:[a-z-]+:)*)(-?[a-z-]+?)-\[(.+)\]$/);if(o){let g=o[1],y=g?g.split(":").filter(Boolean):[],b=o[2],v=b.startsWith("-");if(v)b=b.slice(1);let S=Mt(o[3]),R,I=S.match(/^(color|length|url|number|percentage|position|line-width|absolute-size|relative-size|image|angle|time|flex|string|family-name):(.*)/i);if(I)R=I[1].toLowerCase(),S=I[2];if(v)S=S.startsWith("-")?S:`-${S}`;return{raw:e,variants:y,utility:b,value:S,important:t,arbitrary:!0,typeHint:R}}let s=[],c="",a=0;for(let g=0;g<r.length;g++){let y=r[g];if(y==="[")a++;else if(y==="]")a--;if(y===":"&&a===0)s.push(c),c="";else c+=y}s.push(c);let l=s[s.length-1],u=s.slice(0,-1);if(l.startsWith("!")&&l.length>1)t=!0,l=l.slice(1);else if(l.endsWith("!")&&l.length>1)t=!0,l=l.slice(0,-1);if(u.length>0)r=`${u.join(":")}:${l}`;else r=l;if(["inline-block","inline-flex","inline-grid","flex-row","flex-row-reverse","flex-col","flex-col-reverse","flex-wrap","flex-wrap-reverse","flex-nowrap","flex-1","flex-auto","flex-initial","flex-none","flex-grow","flex-shrink"].includes(l))return{raw:e,variants:u,utility:l,value:void 0,important:t,arbitrary:!1};let d=l.match(/^([a-z-]+?)-\[(.+?)\]$/);if(d){let g=Mt(d[2]),y,b=g.match(/^(color|length|url|number|percentage|position|line-width|absolute-size|relative-size|image|angle|time|flex|string|family-name):(.*)/i);if(b)y=b[1].toLowerCase(),g=b[2];return{raw:e,variants:u,utility:d[1],value:g,important:t,arbitrary:!0,typeHint:y}}let h=["inset-x","inset-y","border-t","border-r","border-b","border-l","border-x","border-y","border-s","border-e","grid-cols","grid-rows","grid-flow","auto-cols","auto-rows","col-span","row-span","col-start","col-end","row-start","row-end","translate-x","translate-y","translate-z","scale-x","scale-y","scale-z","rotate-x","rotate-y","rotate-z","skew-x","skew-y","scroll-m","scroll-mx","scroll-my","scroll-mt","scroll-mr","scroll-mb","scroll-ml","scroll-p","scroll-px","scroll-py","scroll-pt","scroll-pr","scroll-pb","scroll-pl","gap-x","gap-y","overflow-x","overflow-y","min-w","max-w","min-h","max-h","space-x","space-y","ring-offset","underline-offset","outline-offset","backdrop-blur","backdrop-brightness","backdrop-contrast","backdrop-grayscale","backdrop-invert","backdrop-saturate","backdrop-sepia","hue-rotate","drop-shadow","mask-clip","flex-grow","flex-shrink","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","perspective-origin","justify-self","form-input","form-textarea","form-select","form-multiselect","form-checkbox","form-radio","mix-blend","bg-blend","line-clamp","border-spacing","border-spacing-x","border-spacing-y","rounded-s","rounded-e","rounded-ss","rounded-se","rounded-es","rounded-ee","rounded-t","rounded-r","rounded-b","rounded-l","rounded-tl","rounded-tr","rounded-bl","rounded-br","border-opacity","ring-opacity","stroke-dasharray","stroke-dashoffset","animate-iteration","animate-duration","animate-delay","text-emphasis-color","text-emphasis","text-shadow","word-spacing","column-gap","column-rule","font-stretch","list-image"];if(l==="divide-x"||l==="divide-y")return{raw:e,variants:u,utility:l,value:void 0,important:t,arbitrary:!1};let m=l.match(/^(divide-[xy])-(.+)$/);if(m)return{raw:e,variants:u,utility:m[1],value:m[2],important:t,arbitrary:!1};for(let g of h)if(l.startsWith(`${g}-`))return{raw:e,variants:u,utility:g,value:l.slice(g.length+1),important:t,arbitrary:!1};if(l.startsWith("-")){let g=l.slice(1);for(let b of h)if(g.startsWith(`${b}-`))return{raw:e,variants:u,utility:b,value:`-${g.slice(b.length+1)}`,important:t,arbitrary:!1};let y=Qi(g);if(y)return{raw:e,variants:u,utility:y[0],value:`-${y[1]}`,important:t,arbitrary:!1};return{raw:e,variants:u,utility:g,value:void 0,important:t,arbitrary:!1}}let p=Qi(l);if(p){let[g,y]=p,b=y.match(Su);if(b&&ku.has(g))return{raw:e,variants:u,utility:g,value:`${b[1]}/${b[2]}`,important:t,arbitrary:!1};let v=y.match(Eu);if(v)return{raw:e,variants:u,utility:g,value:`${v[1]}/${v[2]}`,important:t,arbitrary:!1};return{raw:e,variants:u,utility:g,value:y,important:t,arbitrary:!1}}return{raw:e,variants:u,utility:l,value:void 0,important:t,arbitrary:!1}}function ro(e,t){if(!e||e.length===0)return!1;if(/^\[[a-z-]+:[^\]]+\]$/i.test(e))return!0;if(t?.enabled&&/^[a-z]+\[[^\]]+\]$/i.test(e))return!0;if(t?.colonSyntax&&/^[a-z]+:[^[\]:]+$/i.test(e))return!0;let r=String.raw`!?-?[a-z][a-z0-9.-]*(?:-\[[^\]]+\])?(?:\/(?:[\w.]+|\[[^\]]+\]))?`;return new RegExp(`^${r}(?::${r})*$`,"i").test(e)}function Dt(e){let t=[],r="",n=0;for(let i of e)if(i==="[")n++,r+=i;else if(i==="]")n--,r+=i;else if(/\s/.test(i)&&n===0){if(r)t.push(r),r=""}else r+=i;if(r)t.push(r);return t}function jt(e,t){let r=new Set,n=[/class(?:Name)?=["']([^"']+)["']/g,/class(?:Name)?=\{["']([^"']+)["']\}/g,/class(?:Name)?=\{`([^`]+)`\}/g];for(let o of n){let s;while((s=o.exec(e))!==null){let c=s[1],a=c.match(/["']([^"']+)["']/g);if(a)for(let f of a){let d=f.replace(/["']/g,""),h=Dt(d);for(let m of h)Ft(r,m,t)}let l=c.replace(/["'`]/g," ").replace(/\$\{[^}]+\}/g," "),u=Dt(l).filter((f)=>ro(f,t?.bracketSyntax));for(let f of u)Ft(r,f,t)}}let i=[/class(?:Name|:list)?=\{([^{}]*(?:\{[^{}]*\}[^{}]*)*)\}/g,/:class="([^"]*)"/g,/:class='([^']*)'/g,/\bx-class="([^"]*)"/g,/\bx-class='([^']*)'/g];for(let o of i){let s;while((s=o.exec(e))!==null){let c=s[1].match(/["'`]([^"'`]+)["'`]/g);if(c)for(let a of c){let l=a.replace(/["'`]/g,"").replace(/\$\{[^}]+\}/g," ");for(let u of Dt(l))Ft(r,u,t)}}}if(t?.codeStrings?.enabled!==!1)for(let o of Ou(e,t?.bracketSyntax))Ft(r,o,t);if(t?.attributify?.enabled){let o=Ru(e,t.attributify);for(let s of o)r.add(s)}return r}function Nu(e,t){if(!/[-:/[]/.test(e))return!1;if(e.startsWith("-")&&!/^-[a-z]/i.test(e))return!1;return ro(e,t)}function Ou(e,t){let r=new Set,n=e.length,i=0;while(i<n){let o=e[i];if(o!=='"'&&o!=="'"&&o!=="`"){i++;continue}let s=Iu(e,i),c=o==="`",a=i+1,l="",u=!1;while(a<n){let f=e[a];if(f==="\\"){l+=e[a+1]??"",a+=2;continue}if(f===o){u=!0,a++;break}if(!c&&f===`
|
|
32
|
+
`),Ae.exit(e.exitCode??2)}async runMatchedCommand(){let{args:e,options:t,matchedCommand:r}=this;if(!r||!r.commandAction)return;r.checkUnknownOptions(),r.checkOptionValue(),r.checkRequiredArgs();let n=[];r.args.forEach((c,a)=>{if(c.variadic)n.push(e.slice(a));else n.push(e[a])}),n.push(t);let i={command:r,args:n,options:t};for(let c of r.beforeHooks)await c(i);let o,s=async()=>{let c=r.commandAction.apply(this,n);if(c instanceof Promise)o=await c;else o=c;return o};if(r.middleware.length>0){let c=0,a=async()=>{if(c<r.middleware.length){let l=r.middleware[c++];await l({...i,next:a})}else await s()};await a()}else await s();for(let c of r.afterHooks)await c(i);return o}removeSignalHandlers(){if(!this.signalHandlersSet)return this;return Ae.removeAllListeners("SIGINT"),Ae.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 vi{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,r=5000){if(!this.enabled)return;this.cache.set(e,{value:t,timestamp:Date.now(),ttl:r})}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,r]of this.cache.entries())if(e-r.timestamp>r.ttl)this.cache.delete(t)}destroy(){this.stopCleanup(),this.clear(),this.resetStats()}}var ib=new vi;function Ql(){if("FORCE_COLOR"in ht.env)return ht.env.FORCE_COLOR!=="0";if("NO_COLOR"in ht.env||ht.env.TERM==="dumb")return!1;if(ht.platform==="win32")return!0;return pi.isatty(1)&&pi.isatty(2)}var wi=Ql();function F(e,t){if(!wi)return(r)=>r;return(r)=>e+r+t}var ec=F("\x1B[0m","\x1B[0m"),tc=F("\x1B[31m","\x1B[39m"),rc=F("\x1B[32m","\x1B[39m"),nc=F("\x1B[33m","\x1B[39m"),ic=F("\x1B[34m","\x1B[39m"),oc=F("\x1B[35m","\x1B[39m"),sc=F("\x1B[36m","\x1B[39m"),ac=F("\x1B[37m","\x1B[39m"),lc=F("\x1B[90m","\x1B[39m"),cc=F("\x1B[1m","\x1B[22m"),uc=F("\x1B[3m","\x1B[23m"),fc=F("\x1B[4m","\x1B[24m"),dc=F("\x1B[2m","\x1B[22m"),hc=F("\x1B[7m","\x1B[27m"),gc=F("\x1B[8m","\x1B[28m"),mc=F("\x1B[9m","\x1B[29m"),pc=F("\x1B[41m","\x1B[49m"),yc=F("\x1B[42m","\x1B[49m"),bc=F("\x1B[43m","\x1B[49m"),xc=F("\x1B[44m","\x1B[49m"),vc=F("\x1B[45m","\x1B[49m"),wc=F("\x1B[46m","\x1B[49m"),Cc=F("\x1B[47m","\x1B[49m"),$c=wi,Rc={reset:ec,red:tc,green:rc,yellow:nc,blue:ic,magenta:oc,cyan:sc,white:ac,gray:lc,bold:cc,italic:uc,underline:fc,dim:dc,inverse:hc,hidden:gc,strikethrough:mc,bgRed:pc,bgGreen:yc,bgYellow:bc,bgBlue:xc,bgMagenta:vc,bgCyan:wc,bgWhite:Cc,isColorSupported:$c},kc=Rc,Ec=["up","down","left","right","space","enter","cancel"],ub={actions:new Set(Ec),aliases:new Map([["k","up"],["j","down"],["h","left"],["l","right"],["\x03","cancel"],["escape","cancel"]]),messages:{cancel:"Canceled",error:"Something went wrong"}};var fb=Sc.platform.startsWith("win"),db=Symbol("clapp:cancel");var Ac=Kl();var L=(e,t)=>Ac?e:t,hb=L("\u25C6","*"),gb=L("\u25A0","x"),mb=L("\u25B2","x"),pb=L("\u25C7","o"),yb=L("\u250C","T"),Tc=L("\u2502","|"),bb=L("\u2514","\u2014"),xb=L("\u25CF",">"),vb=L("\u25CB"," "),wb=L("\u25FB","[\u2022]"),Cb=L("\u25FC","[+]"),$b=L("\u25FB","[ ]"),Rb=L("\u25AA","\u2022"),kb=L("\u2500","-"),Sb=L("\u256E","+"),Eb=L("\u251C","+"),Ab=L("\u256F","+"),Tb=L("\u25CF","\u2022"),Nb=L("\u25C6","*"),Ob=L("\u25B2","!"),Ib=L("\u25A0","x");var Pb={light:L("\u2500","-"),heavy:L("\u2501","="),block:L("\u2588","#")};function Nc(){return`${kc.gray(Tc)} `}var _b=Nc();class Ci{configPath;config=null;events=[];retryCount=0;maxRetries=3;retryDelayMs=1000;constructor(){let e=yi.homedir(),t=Fr.join(e,".config","clapp");this.configPath=Fr.join(t,"telemetry.json")}async isEnabled(){if(Fe.env.DO_NOT_TRACK==="1"||Fe.env.DO_NOT_TRACK==="true")return!1;if(Fe.env.NO_TELEMETRY==="1"||Fe.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 n={event:e,...t,timestamp:Date.now(),platform:yi.platform(),nodeVersion:Fe.version};if(this.events.push(n),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:Fe.env.DO_NOT_TRACK==="1"||Fe.env.DO_NOT_TRACK==="true",eventsQueued:this.events.length,lastSent:e.lastSent}}async loadConfig(){if(this.config)return this.config;try{if(Oc(this.configPath)){let e=await Mr.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=Fr.dirname(this.configPath);await Mr.mkdir(t,{recursive:!0}),await Mr.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 Bb=new Ci;var zr="0.3.5";function ge(e){return{prev:null,next:null,data:e}}class oe{head=null;tail=null;cursors=[];allocateCursor(e,t){let r={prev:e,next:t};return this.cursors.push(r),r}releaseCursor(){this.cursors.pop()}updateCursors(e,t,r,n){for(let i of this.cursors){if(i.prev===e)i.prev=t;if(i.next===r)i.next=n}}static createItem(e){return ge(e)}createItem(e){return ge(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 r of e){let n=ge(r);if(n.prev=t,t)t.next=n;else this.head=n;t=n}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 r=this.allocateCursor(null,this.head);while(r.next!==null){let n=r.next;r.prev=n,r.next=n.next,e.call(t,n.data,n,this)}this.releaseCursor()}forEachRight(e,t){let r=this.allocateCursor(this.tail,null);while(r.prev!==null){let n=r.prev;r.next=n,r.prev=n.prev,e.call(t,n.data,n,this)}this.releaseCursor()}reduce(e,t){let r=t,n=0;for(let i=this.head;i!=null;i=i.next)r=e(r,i.data,n++,this);return r}some(e){let t=0;for(let r=this.head;r!=null;r=r.next)if(e(r.data,t++,this))return!0;return!1}map(e){let t=new oe,r=null,n=0;for(let i=this.head;i!=null;i=i.next){let o=ge(e(i.data,n++,this));if(o.prev=r,r)r.next=o;else t.head=o;r=o}return t.tail=r,t}filter(e){let t=new oe,r=null,n=0;for(let i=this.head;i!=null;i=i.next)if(e(i.data,n++,this)){let o=ge(i.data);if(o.prev=r,r)r.next=o;else t.head=o;r=o}return t.tail=r,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 oe,t=null;for(let r=this.head;r!=null;r=r.next){let n=ge(r.data);if(n.prev=t,t)t.next=n;else e.head=n;t=n}return e.tail=t,e}prepend(e){return this.insert(e,this.head)}prependData(e){return this.insert(ge(e),this.head)}append(e){return this.insert(e,null)}appendData(e){return this.insert(ge(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(ge(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(ge(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 oe)this.insertList(t,e),this.remove(e);else this.insert(t,e),this.remove(e)}}function Y(e){switch(e.type){case"StyleSheet":return te(e.children,"");case"Rule":return`${Y(e.prelude)}{${Y(e.block)}}`;case"Block":return Pc(e.children);case"Atrule":{let t=`@${e.name}`;if(e.prelude){let r=Y(e.prelude);if(r)t+=` ${r}`}if(e.block)t+=`{${Y(e.block)}}`;else t+=";";return t}case"AtrulePrelude":return te(e.children,"");case"SelectorList":return te(e.children,",");case"Selector":return te(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+=`"${Wr(e.value.value)}"`;else t+=e.value.name;if(e.flags)t+=` ${e.flags}`;return t+="]",t}case"PseudoClassSelector":return e.children?`:${e.name}(${te(e.children,"")})`:`:${e.name}`;case"PseudoElementSelector":return e.children?`::${e.name}(${te(e.children,"")})`:`::${e.name}`;case"Combinator":return e.name===" "?" ":e.name;case"Declaration":return`${e.property}:${Y(e.value)}${e.important?"!important":""}`;case"DeclarationList":return te(e.children,";");case"Value":return te(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`"${Wr(e.value)}"`;case"Url":return/[\s"'()\\\u0000-\u001F\u007F]/.test(e.value)?`url("${Wr(e.value)}")`:`url(${e.value})`;case"Hash":return`#${e.name}`;case"Operator":return e.value;case"Function":return`${e.name}(${te(e.children,"")})`;case"Parentheses":return`(${te(e.children,"")})`;case"Brackets":return`[${te(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??"",r=e.b??"";if(t&&r){let n=Number(r);return`${t==="1"?"":t==="-1"?"-":t}n${n>=0?`+${r}`:r}`}if(t)return`${t==="1"?"":t==="-1"?"-":t}n`;return r}case"Ratio":return`${e.left.value}/${e.right.value}`;case"UnicodeRange":return e.value;case"Nth":return e.selector?`${Y(e.nth)} of ${Y(e.selector)}`:Y(e.nth);case"MediaQueryList":return te(e.children,",");case"MediaQuery":return te(e.children,"");case"MediaFeature":{let t=`(${e.name}`;if(e.value)t+=`:${Y(e.value)}`;return t+=")",t}}return""}function te(e,t){let r="",n=!0,i=null,o=e.head;while(o!=null){let s=o.data;if(s.type==="WhiteSpace"){let a=o.next?o.next.data:null;if($i(i)||$i(a)){o=o.next;continue}}let c=Y(s);if(!c){o=o.next;continue}if(!n&&t&&!Lc(i))r+=t;n=!1,r+=c,i=s,o=o.next}return r}function Pc(e){let t="",r=null,n=e.head;while(n!=null){let i=n.data,o=Y(i);if(!o){n=n.next;continue}if(r&&_c(r,i))t+=";";t+=o,r=i,n=n.next}return t}function _c(e,t){return e.type==="Declaration"&&t.type!=="Comment"}function $i(e){if(!e||e.type!=="Operator")return!1;let t=e.value;return t===":"||t===","||t==="/"}function Lc(e){if(!e)return!1;return e.type==="Operator"||e.type==="Combinator"}function Wr(e){let t="";for(let r=0;r<e.length;r++){let n=e.charCodeAt(r);if(n===92)t+="\\\\";else if(n===34)t+="\\\"";else if(n<32||n===127){let i=n.toString(16),o=r+1<e.length?e.charCodeAt(r+1):-1,s=o===32||o===9||o===10||o===12||o===13||o>=48&&o<=57||o>=65&&o<=70||o>=97&&o<=102;t+=`\\${i}${s?" ":""}`}else t+=e[r]}return t}var je=(()=>{let e=new Uint8Array(128);for(let t=0;t<128;t++){let r=0;if(t===32||t===9||t===10||t===12||t===13)r|=1;if(t>=48&&t<=57)r|=2;if(t>=48&&t<=57||t>=65&&t<=70||t>=97&&t<=102)r|=4;if(t>=65&&t<=90||t>=97&&t<=122||t===95)r|=8;if(t===10||t===12||t===13)r|=16;e[t]=r}return e})();function le(e){return e<128&&(je[e]&2)!==0}function pt(e){return e<128&&(je[e]&4)!==0}function Ri(e){return e>=128||e<128&&(je[e]&8)!==0}function Mc(e){return e===45||e>=128||e<128&&(je[e]&10)!==0}function Fc(e){return e>=0&&e<=8||e===11||e>=14&&e<=31||e===127}function Gr(e){return e<128&&(je[e]&16)!==0}function xe(e){return e<128&&(je[e]&1)!==0}function De(e,t){if(e!==92)return!1;if(Gr(t))return!1;return!0}function Kr(e,t,r){if(e===45)return Ri(t)||t===45||De(t,r);if(Ri(e))return!0;if(e===92)return De(e,t);return!1}function Dc(e,t,r){if(e===43||e===45){if(le(t))return!0;if(t===46&&le(r))return!0;return!1}if(e===46)return le(t);return le(e)}class Tt{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=jc(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,r){if(this.count>=this.types.length)this.grow();this.types[this.count]=e,this.starts[this.count]=t,this.ends[this.count]=r,this.count++}grow(){let t=this.types.length*2,r=new Uint8Array(t);r.set(this.types),this.types=r;let n=new Uint32Array(t);n.set(this.starts),this.starts=n;let i=new Uint32Array(t);i.set(this.ends),this.ends=i}tokenize(){let e=this.source,t=0,r=e.length;while(t<r){let n=e.charCodeAt(t);if(n===47&&e.charCodeAt(t+1)===42){let s=t;t+=2;while(t<r&&!(e.charCodeAt(t)===42&&e.charCodeAt(t+1)===47))t++;t=t<r?t+2:r,this.addToken(25,s,t);continue}if(xe(n)){let s=t;while(t<r&&xe(e.charCodeAt(t)))t++;this.addToken(13,s,t);continue}if(n===34||n===39){t=this.consumeString(n,t);continue}if(n===35){if(t+1<r&&(Mc(e.charCodeAt(t+1))||De(e.charCodeAt(t+1),e.charCodeAt(t+2)))){let s=t;t++,t=this.consumeName(t),this.addToken(4,s,t);continue}this.addToken(9,t,t+1),t++;continue}switch(n){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(n===60&&e.startsWith("!--",t+1)){this.addToken(14,t,t+4),t+=4;continue}if(n===45&&e.startsWith("->",t+1)){this.addToken(15,t,t+3),t+=3;continue}if(n===64){let s=e.charCodeAt(t+1),c=e.charCodeAt(t+2),a=e.charCodeAt(t+3);if(Kr(s,c,a)){let l=t;t++,t=this.consumeName(t),this.addToken(3,l,t);continue}this.addToken(9,t,t+1),t++;continue}let i=e.charCodeAt(t+1),o=e.charCodeAt(t+2);if(Dc(n,i,o)){t=this.consumeNumeric(t);continue}if(Kr(n,i,o)){t=this.consumeIdentLike(t);continue}if(n===92){if(De(n,i)){t=this.consumeIdentLike(t);continue}this.addToken(9,t,t+1),t++;continue}this.addToken(9,t,t+1),t++}this.addToken(0,r,r)}consumeString(e,t){let r=this.source,n=r.length,i=t+1;while(i<n){let o=r.charCodeAt(i);if(o===e)return i++,this.addToken(5,t,i),i;if(Gr(o))return this.addToken(6,t,i),i;if(o===92){let s=r.charCodeAt(i+1);if(Gr(s)){i+=2;continue}if(i+1<n){i=this.consumeEscapeSkip(i+1);continue}}i++}return this.addToken(5,t,i),i}consumeEscapeSkip(e){let t=this.source;if(e>=t.length)return e;let r=t.charCodeAt(e);if(pt(r)){let n=1;e++;while(n<6&&e<t.length&&pt(t.charCodeAt(e)))e++,n++;if(e<t.length&&xe(t.charCodeAt(e)))e++;return e}return e+1}consumeName(e){let t=this.source,r=t.length,n=e;while(n<r){let i=t.charCodeAt(n);if(i<128&&(je[i]&10)!==0){n++;continue}if(i===45){n++;continue}if(i>=128){n++;continue}if(i===92&&De(i,t.charCodeAt(n+1))){n=this.consumeEscapeSkip(n+1);continue}break}return n}consumeNumber(e){let t=this.source,r=e;if(t.charCodeAt(r)===43||t.charCodeAt(r)===45)r++;while(r<t.length&&le(t.charCodeAt(r)))r++;if(t.charCodeAt(r)===46&&le(t.charCodeAt(r+1))){r+=2;while(r<t.length&&le(t.charCodeAt(r)))r++}let n=t.charCodeAt(r);if(n===69||n===101){let i=t.charCodeAt(r+1),o=t.charCodeAt(r+2);if(le(i)){r+=2;while(r<t.length&&le(t.charCodeAt(r)))r++}else if((i===43||i===45)&&le(o)){r+=3;while(r<t.length&&le(t.charCodeAt(r)))r++}}return r}consumeNumeric(e){let t=this.source,r=this.consumeNumber(e),n=t.charCodeAt(r),i=t.charCodeAt(r+1),o=t.charCodeAt(r+2);if(Kr(n,i,o)){let s=this.consumeName(r);return this.addToken(12,e,s),s}if(n===37)return this.addToken(11,e,r+1),r+1;return this.addToken(10,e,r),r}consumeIdentLike(e){let t=this.source,r=this.consumeName(e),n=t.charCodeAt(r);if(n===40&&r-e===3){let i=t.charCodeAt(e)|32,o=t.charCodeAt(e+1)|32,s=t.charCodeAt(e+2)|32;if(i===117&&o===114&&s===108){let c=r+1;while(c<t.length&&xe(t.charCodeAt(c)))c++;let a=t.charCodeAt(c);if(a===34||a===39)return this.addToken(2,e,r+1),r+1;return this.consumeUrl(e,r)}}if(n===40)return this.addToken(2,e,r+1),r+1;return this.addToken(1,e,r),r}consumeUrl(e,t){let r=this.source,n=r.length,i=t+1;while(i<n&&xe(r.charCodeAt(i)))i++;while(i<n){let o=r.charCodeAt(i);if(o===41)return i++,this.addToken(7,e,i),i;if(xe(o)){let s=i;while(i<n&&xe(r.charCodeAt(i)))i++;if(i>=n)return this.addToken(7,e,i),i;if(r.charCodeAt(i)===41)return i++,this.addToken(7,e,i),i;return this.consumeBadUrl(e,s)}if(o===34||o===39||o===40||Fc(o))return this.consumeBadUrl(e,i);if(o===92){if(De(o,r.charCodeAt(i+1))){i=this.consumeEscapeSkip(i+1);continue}return this.consumeBadUrl(e,i)}i++}return this.addToken(7,e,i),i}consumeBadUrl(e,t){let r=this.source,n=t;while(n<r.length){let i=r.charCodeAt(n);if(i===41){n++;break}if(i===92&&De(i,r.charCodeAt(n+1))){n=this.consumeEscapeSkip(n+1);continue}n++}return this.addToken(8,e,n),n}locate(e){let t=this.lineStarts,r=0,n=t.length-1;while(r<n){let o=r+n+1>>1;if(t[o]<=e)r=o;else n=o-1}let i=t[r];return{line:r+1,column:e-i+1}}}function jc(e){let t=[0],r=e.length;for(let n=0;n<r;n++){let i=e.charCodeAt(n);if(i===10)t.push(n+1);else if(i===13){if(e.charCodeAt(n+1)!==10)t.push(n+1)}}return t}function Hr(e,t,r){for(let n=t;n<r;n++)if(e.charCodeAt(n)===92)return Bc(e,t,r,n);return e.slice(t,r)}function Bc(e,t,r,n){let i=e.slice(t,n),o=n;while(o<r){if(e.charCodeAt(o)!==92){i+=e[o],o++;continue}if(o+1>=r){o++;continue}let c=e.charCodeAt(o+1);if(c===10){o+=2;continue}if(c===13){o+=e.charCodeAt(o+2)===10?3:2;continue}if(pt(c)){let a=o+1,l="";while(l.length<6&&a<r&&pt(e.charCodeAt(a)))l+=e[a],a++;let u=Number.parseInt(l,16);if(a<r&&xe(e.charCodeAt(a)))a++;i+=u===0||u>=55296&&u<=57343||u>1114111?String.fromCodePoint(65533):String.fromCodePoint(u),o=a;continue}i+=e[o+1],o+=2}return i}function qr(e,t,r){for(let n=t;n<r;n++)if(e.charCodeAt(n)===92)return Uc(e,t,r,n);return e.slice(t,r)}function Uc(e,t,r,n){let i=e.slice(t,n),o=n;while(o<r){if(e.charCodeAt(o)!==92){i+=e[o],o++;continue}let c=o+1,a="";while(a.length<6&&c<r&&pt(e.charCodeAt(c)))a+=e[c],c++;if(a.length>0){let l=Number.parseInt(a,16);if(c<r&&xe(e.charCodeAt(c)))c++;i+=l===0||l>=55296&&l<=57343||l>1114111?String.fromCodePoint(65533):String.fromCodePoint(l),o=c;continue}if(c<r){i+=e[c],o=c+1;continue}i+=String.fromCodePoint(65533),o=c}return i}function Oi(e,t){let r=new Tt(e);return{source:e,types:r.types,starts:r.starts,ends:r.ends,count:r.count,end:r.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:r}}function x(e){return e.pos<e.end?e.types[e.pos]:0}function w(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 C(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 me(e,t){return e.source.slice(t.start,t.end)}function ce(e){let{types:t,end:r}=e;while(e.pos<r){let n=t[e.pos];if(n===13||n===25)e.pos++;else break}}function ki(e){let{types:t,end:r}=e;while(e.pos<r&&t[e.pos]===13)e.pos++}function k(e,t,r){if(!e.positions)return null;let n=e.tokenizer.locate(t.start),i=e.tokenizer.locate(r.end);return{source:e.filename??"<unknown>",start:{offset:t.start,line:n.line,column:n.column},end:{offset:r.end,line:i.line,column:i.column}}}function Ii(e){if(!e.positions)return null;let t=w(e),r=e.tokenizer.locate(t.start);return{source:e.filename??"<unknown>",start:{offset:t.start,line:r.line,column:r.column},end:{offset:t.start,line:r.line,column:r.column}}}function Nt(e,t,r,n){return{type:"Raw",value:e,loc:k(n,t,r)}}function X(){return new oe}function Yr(e,t,r,n){if(e.onParseError){let{line:i,column:o}=e.tokenizer.locate(r.start),s=SyntaxError(`${e.filename??"<input>"}:${i}:${o}: ${t}`);s.line=i,s.column=o,s.offset=r.start,e.onParseError(s,n)}return n}function It(e,t={}){let r=Oi(e,t);switch(t.context??"stylesheet"){case"stylesheet":return Ai(r);case"atrule":return Pt(r)??Si(r);case"atrulePrelude":return Kc(r);case"mediaQuery":case"mediaQueryList":return Ei(r);case"rule":return Xr(r);case"selectorList":return en(r);case"selector":return Mi(r);case"block":return Zr(r);case"declarationList":return qc(r);case"declaration":return Qr(r)??Si(r);case"value":return Yc(r);case"raw":return Ei(r);default:return Ai(r)}}function Si(e){return{type:"StyleSheet",children:X(),loc:Ii(e)}}function Ei(e){let t=w(e),r=t;while(x(e)!==0)r=C(e);return{type:"Raw",value:e.source.slice(t.start,r.end),loc:k(e,t,r)}}function Ai(e){let t=w(e),r=X(),{types:n,end:i}=e;while(e.pos<i){let c=n[e.pos];if(c===13){e.pos++;continue}if(c===25){let u={type:25,start:e.starts[e.pos],end:e.ends[e.pos]},f=Jr(e,u);e.pos++,r.appendData(f);continue}if(c===0)break;if(c===14||c===15){e.pos++;continue}if(c===3){let u=Pt(e);if(u)r.appendData(u);continue}if(c===24){e.pos++;continue}let a=e.pos,l=Xr(e);if(r.appendData(l),e.pos===a)e.pos++}let o=e.end-1,s=o>=0?{type:e.types[o],start:e.starts[o],end:e.ends[o]}:{type:0,start:0,end:0};return{type:"StyleSheet",children:r,loc:k(e,t,s)}}function Jr(e,t){return{type:"Comment",value:e.source.slice(t.start+2,t.end-2),loc:k(e,t,t)}}function Pt(e){let t=w(e);if(t.type!==3)return null;e.pos++;let r=Ot(e.source,t.start+1,t.end);ce(e);let n=e.pos,i=w(e),{types:o,end:s}=e,c=n,a=n;while(c<s){let f=o[c];if(f===0||f===17||f===23)break;if(f!==13&&f!==25)a=c+1;c++}let l=null;if(a>n){let f=e.starts[n],d=e.ends[a-1],h={type:o[a-1],start:e.starts[a-1],end:d},m=e.source.slice(f,d).trim();if(m.length>0)if(e.parseAtrulePrelude)try{let p=e.end;e.end=a,e.pos=n;let g=X();while(x(e)!==0){let y=Be(e);if(y)g.appendData(y)}if(_i(g),e.end=p,e.pos=c,g.isEmpty)l=Nt(m,i,h,e);else l={type:"AtrulePrelude",children:g,loc:null}}catch(p){let g=Nt(m,i,h,e);Yr(e,`Failed to parse @${r} prelude: ${p.message}`,i,g),l=g,e.pos=c}else l=Nt(m,i,h,e),e.pos=c;else e.pos=c}else e.pos=c;let u=null;if(x(e)===17)C(e);else if(x(e)===23)u=Zr(e,Wc.has(r));return{type:"Atrule",name:r,prelude:l,block:u,loc:k(e,t,w(e))}}var zc=new Set(["is","not","where","has","matches","-moz-any","-webkit-any"]),Wc=new Set(["media","supports","document","layer","container","scope","starting-style","-moz-document","keyframes","-webkit-keyframes","-moz-keyframes","-o-keyframes"]);function Kc(e){let t=w(e),r=X();while(x(e)!==0){if(w(e).type===13){e.pos++;continue}let i=Be(e);if(i)r.appendData(i)}return{type:"AtrulePrelude",children:r,loc:k(e,t,w(e))}}function Xr(e){let t=w(e),r;if(e.parseRulePrelude)r=en(e);else{let i=w(e),o=i;while(x(e)!==0&&x(e)!==23)o=C(e);let s=e.source.slice(i.start,o.end).trim();r=Nt(s,i,o,e)}let n=Zr(e,!0);return{type:"Rule",prelude:r,block:n,loc:k(e,t,w(e))}}function Zr(e,t=!1){let r=w(e);if(x(e)!==23)return{type:"Block",children:X(),loc:Ii(e)};e.pos++;let n=X(),{types:i,end:o}=e;while(e.pos<o){let s=i[e.pos];if(s===24||s===0)break;if(s===13){e.pos++;continue}if(s===25){let a={type:25,start:e.starts[e.pos],end:e.ends[e.pos]};e.pos++,n.appendData(Jr(e,a));continue}if(s===3){let a=Pt(e);if(a)n.appendData(a);continue}if(t&&Gc(e,Hc)){let a=Xr(e);n.appendData(a);continue}let c=Qr(e);if(c)n.appendData(c);if(e.pos<o&&i[e.pos]===17)e.pos++}if(x(e)===24)e.pos++;return{type:"Block",children:n,loc:k(e,r,w(e))}}function Gc(e,t){let r=e.pos,n=t(e);return e.pos=r,n}function Hc(e){let{types:t,end:r}=e;while(e.pos<r){let n=t[e.pos];if(n===23)return!0;if(n===17||n===24||n===0)return!1;e.pos++}return!1}function qc(e){let t=w(e),r=X();while(x(e)!==0&&x(e)!==24){let n=w(e);if(n.type===13){e.pos++;continue}if(n.type===25){r.appendData(Jr(e,C(e)));continue}if(n.type===17){e.pos++;continue}if(n.type===3){let o=Pt(e);if(o)r.appendData(o);continue}let i=Qr(e);if(i)r.appendData(i);if(x(e)===17)C(e)}return{type:"DeclarationList",children:r,loc:k(e,t,w(e))}}function Qr(e){ce(e);let t=w(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{Yr(e,"Expected property name",t,{type:"Raw",value:"",loc:null});let{types:R,end:I}=e;while(e.pos<I){let _=R[e.pos];if(_===0||_===17||_===24)break;e.pos++}return null}let r=e.starts[e.pos],n=e.ends[e.pos];e.pos++;let i=e.source.slice(r,n);if(ki(e),x(e)!==16){Yr(e,`Expected ':' after property "${i}"`,w(e),{type:"Raw",value:"",loc:null});let{types:R,end:I}=e;while(e.pos<I){let _=R[e.pos];if(_===0||_===17||_===24)break;e.pos++}return null}e.pos++,ki(e);let{types:o,starts:s,end:c,pos:a}=e,l=a,u=a,f=-1,d=-1;while(l<c){let R=o[l];if(R===0||R===17||R===24)break;if(R===9&&e.source.charCodeAt(s[l])===33){let I=l+1;while(I<c&&o[I]===13)I++;if(I<c&&o[I]===1){let _=s[I];if(e.ends[I]-_===9&&(e.source.charCodeAt(_)|32)===105&&(e.source.charCodeAt(_+1)|32)===109&&(e.source.charCodeAt(_+2)|32)===112&&(e.source.charCodeAt(_+3)|32)===111&&(e.source.charCodeAt(_+4)|32)===114&&(e.source.charCodeAt(_+5)|32)===116&&(e.source.charCodeAt(_+6)|32)===97&&(e.source.charCodeAt(_+7)|32)===110&&(e.source.charCodeAt(_+8)|32)===116){d=l,f=I,l=I+1;continue}}}if(R!==13&&R!==25)u=l+1;l++}let h=u,m=f>=0?{type:1,start:s[f],end:e.ends[f]}:null,p=i.startsWith("--"),g,y=s[a],b=h>a?e.ends[h-1]:y,v={type:o[a],start:y,end:e.ends[a]},S=h>a?{type:o[h-1],start:s[h-1],end:b}:v;if(p&&!e.parseCustomProperty||!e.parseValue)g={type:"Raw",value:e.source.slice(y,b).trim(),loc:k(e,v,S)};else if(h===a)g={type:"Value",children:X(),loc:k(e,v,S)};else{let R=e.end;e.end=h,e.pos=a,g=Pi(e),e.end=R}return e.pos=l,{type:"Declaration",property:i,important:m?!0:!1,value:g,loc:k(e,t,w(e))}}function Yc(e){return Pi(e)}function Pi(e){let t=w(e),r=X();while(x(e)!==0&&x(e)!==17&&x(e)!==24&&x(e)!==22&&x(e)!==20){let n=Be(e);if(n)r.appendData(n)}return Li(r),{type:"Value",children:r,loc:k(e,t,w(e))}}function _i(e){for(let t of e)if("children"in t&&t.children instanceof oe)_i(t.children);Li(e)}function Li(e){let t=e.head;while(t){if(t.data.type==="Number"){let r=t.next;while(r&&r.data.type==="WhiteSpace")r=r.next;if(r&&r.data.type==="Operator"&&r.data.value==="/"){let n=r.next;while(n&&n.data.type==="WhiteSpace")n=n.next;if(n&&n.data.type==="Number"){let i={type:"Ratio",left:t.data,right:n.data,loc:null},o=t.next;while(o&&o!==n.next){let s=o.next;e.remove(o),o=s}e.replace(t,e.createItem(i)),t=e.head;continue}}}t=t.next}}function Be(e){let t=e.pos;if(t>=e.end)return null;let r=e.types[t],n=e.starts[t],i=e.ends[t],o=e.source;switch(r){case 13:return e.pos++,e.positions?{type:"WhiteSpace",value:" ",loc:J(e,n,i)}:{type:"WhiteSpace",value:" ",loc:null};case 25:return e.pos++,{type:"Comment",value:o.slice(n+2,i-2),loc:e.positions?J(e,n,i):null};case 10:return e.pos++,{type:"Number",value:o.slice(n,i),loc:e.positions?J(e,n,i):null};case 11:return e.pos++,{type:"Percentage",value:o.slice(n,i-1),loc:e.positions?J(e,n,i):null};case 12:{e.pos++;let s=n,c=o.charCodeAt(s);if(c===43||c===45)s++;let a=!1;while(s<i){let u=o.charCodeAt(s);if(u>=48&&u<=57){s++;continue}if(u===46&&!a){a=!0,s++;continue}break}let l=o.charCodeAt(s);if(l===69||l===101){let u=s+1,f=o.charCodeAt(u);if(f===43||f===45)u++;let d=!1;while(u<i){let h=o.charCodeAt(u);if(h>=48&&h<=57){u++,d=!0;continue}break}if(d)s=u}return{type:"Dimension",value:o.slice(n,s),unit:o.slice(s,i),loc:e.positions?J(e,n,i):null}}case 1:return e.pos++,{type:"Identifier",name:qr(o,n,i),loc:e.positions?J(e,n,i):null};case 5:{e.pos++;let s=n+1,a=i-n>=2&&o.charCodeAt(i-1)===o.charCodeAt(n)?i-1:i;return{type:"String",value:Hr(o,s,a),loc:e.positions?J(e,n,i):null}}case 7:{e.pos++;let s=n+4;while(s<i&&Ti(o.charCodeAt(s)))s++;let c=i;if(c>s&&o.charCodeAt(c-1)===41)c--;while(c>s&&Ti(o.charCodeAt(c-1)))c--;let a;if(c-s>=2){let l=o.charCodeAt(s),u=o.charCodeAt(c-1);if((l===34||l===39)&&l===u)a=o.slice(s+1,c-1);else a=o.slice(s,c)}else a=o.slice(s,c);return{type:"Url",value:a,loc:e.positions?J(e,n,i):null}}case 4:return e.pos++,{type:"Hash",name:o.slice(n+1,i),loc:e.positions?J(e,n,i):null};case 2:return Xc(e);case 21:return Zc(e);case 18:return e.pos++,{type:"Operator",value:",",loc:e.positions?J(e,n,i):null};case 16:return e.pos++,{type:"Operator",value:":",loc:e.positions?J(e,n,i):null};case 9:{e.pos++;let s=o.charCodeAt(n),c=o[n];if(Jc(s))return{type:"Operator",value:c,loc:e.positions?J(e,n,i):null};return{type:"Identifier",name:c,loc:e.positions?J(e,n,i):null}}case 19:{e.pos++;let s=X();while(x(e)!==0&&x(e)!==20){let a=Be(e);if(a)s.appendData(a)}let c=e.pos<e.end?e.ends[e.pos]:i;if(x(e)===20)e.pos++;return{type:"Brackets",children:s,loc:e.positions?J(e,n,c):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:o.slice(n,i),loc:e.positions?J(e,n,i):null}}return e.pos++,null}function Ti(e){return e===32||e===9||e===10||e===12||e===13}function Jc(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 Ot(e,t,r){for(let n=t;n<r;n++){let i=e.charCodeAt(n);if(i>=65&&i<=90)return e.slice(t,r).toLowerCase()}return e.slice(t,r)}function J(e,t,r){let n=e.tokenizer.locate(t),i=e.tokenizer.locate(r);return{source:e.filename??"<unknown>",start:{offset:t,line:n.line,column:n.column},end:{offset:r,line:i.line,column:i.column}}}function Xc(e){let t=C(e),r=Ot(e.source,t.start,t.end-1),n=X();while(x(e)!==0&&x(e)!==22){let i=Be(e);if(i)n.appendData(i)}if(x(e)===22)C(e);if(r==="url"){for(let i=n.head;i!=null;i=i.next)if(i.data.type==="String")return{type:"Url",value:i.data.value,loc:k(e,t,w(e))}}return{type:"Function",name:r,children:n,loc:k(e,t,w(e))}}function Zc(e){let t=C(e),r=X();while(x(e)!==0&&x(e)!==22){let n=Be(e);if(n)r.appendData(n)}if(x(e)===22)C(e);return{type:"Parentheses",children:r,loc:k(e,t,w(e))}}function en(e){let t=w(e),r=X();while(x(e)!==0){if(ce(e),x(e)===0||x(e)===23)break;let n=Mi(e);if(n.children.head!==null)r.appendData(n);if(ce(e),x(e)===18){C(e);continue}break}return{type:"SelectorList",children:r,loc:k(e,t,w(e))}}function Mi(e){let t=w(e),r=X(),n=!0;while(x(e)!==0&&x(e)!==18&&x(e)!==23){let i=w(e);if(i.type===13){if(C(e),!n&&x(e)!==0&&x(e)!==18&&x(e)!==23&&!Ni(e)&&!Qc(e)){let s={type:"Combinator",name:" ",loc:k(e,i,i)};r.appendData(s),n=!0}continue}if(i.type===9&&e.source.charCodeAt(i.start)===124&&e.types[e.pos+1]===9&&e.source.charCodeAt(e.starts[e.pos+1])===124){let s=w(e);C(e);let c=C(e),a={type:"Combinator",name:"||",loc:k(e,s,c)};r.appendData(a),n=!0,ce(e);continue}if(Ni(e)){let s=C(e),a={type:"Combinator",name:e.source[s.start],loc:k(e,s,s)};r.appendData(a),n=!0,ce(e);continue}let o=eu(e);if(!o)break;r.appendData(o),n=!1}while(r.tail&&r.tail.data.type==="Combinator")r.remove(r.tail);return{type:"Selector",children:r,loc:k(e,t,w(e))}}function Ni(e){let t=w(e);if(t.type!==9)return!1;let r=e.source[t.start];return r===">"||r==="+"||r==="~"}function Qc(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 eu(e){let t=w(e);switch(t.type){case 1:{if(C(e),x(e)===9&&e.source[w(e).start]==="|"&&e.source[w(e).start+1]!=="="&&!(e.types[e.pos+1]===9&&e.source.charCodeAt(e.starts[e.pos+1])===124)){if(C(e),x(e)===1){let n=C(e);return{type:"TypeSelector",name:`${me(e,t)}|${me(e,n)}`,loc:k(e,t,n)}}if(x(e)===9&&e.source[w(e).start]==="*"){let n=C(e);return{type:"TypeSelector",name:`${me(e,t)}|*`,loc:k(e,t,n)}}}return{type:"TypeSelector",name:me(e,t),loc:k(e,t,t)}}case 11:return C(e),{type:"TypeSelector",name:me(e,t),loc:k(e,t,t)};case 10:return C(e),{type:"TypeSelector",name:me(e,t),loc:k(e,t,t)};case 9:{let r=e.source[t.start];if(r==="*")return C(e),{type:"TypeSelector",name:"*",loc:k(e,t,t)};if(r==="."){if(C(e),x(e)===1){let n=C(e);return{type:"ClassSelector",name:me(e,n),loc:k(e,t,n)}}return null}if(r==="&")return C(e),{type:"NestingSelector",loc:k(e,t,t)};return C(e),null}case 4:return C(e),{type:"IdSelector",name:e.source.slice(t.start+1,t.end),loc:k(e,t,t)};case 16:{C(e);let r=x(e)===16;if(r)C(e);return tu(e,r,t)}case 19:return ru(e)}return null}function tu(e,t,r){let n=w(e);if(n.type===1){C(e);let i=Ot(e.source,n.start,n.end);return t?{type:"PseudoElementSelector",name:i,children:null,loc:k(e,r,n)}:{type:"PseudoClassSelector",name:i,children:null,loc:k(e,r,n)}}if(n.type===2){C(e);let i=Ot(e.source,n.start,n.end-1),o=X();if(!t&&zc.has(i)){let a=w(e),l=a,u=1;while(x(e)!==0&&u>0){if(x(e)===21||x(e)===2)u++;else if(x(e)===22){if(u--,u===0)break}l=C(e)}if(x(e)===22)C(e);let f=e.source.slice(a.start,l.end).trim();if(f.length>0){let d=Oi(f,{positions:!1}),h=en(d);o.appendData(h)}}else{while(x(e)!==0&&x(e)!==22){let a=Be(e);if(a)o.appendData(a)}if(x(e)===22)C(e)}if(t)return{type:"PseudoElementSelector",name:i,children:o,loc:k(e,r,w(e))};return{type:"PseudoClassSelector",name:i,children:o,loc:k(e,r,w(e))}}return null}function ru(e){let t=C(e);ce(e);let r=w(e);if(r.type!==1)return null;C(e);let n={type:"Identifier",name:me(e,r),loc:k(e,r,r)};ce(e);let i=null,o=null,s=null,c=w(e);if(c.type===9){let l=e.source[c.start],u=e.source[c.start+1];if(l==="=")i="=",C(e);else if((l==="~"||l==="|"||l==="^"||l==="$"||l==="*")&&u==="="){C(e);let h=w(e);if(h.type===9&&e.source[h.start]==="=")C(e),i=`${l}=`}ce(e);let f=w(e);if(f.type===5){C(e);let h=f.end-f.start>=2&&e.source.charCodeAt(f.end-1)===e.source.charCodeAt(f.start);o={type:"String",value:Hr(e.source,f.start+1,h?f.end-1:f.end),loc:k(e,f,f)}}else if(f.type===1)C(e),o={type:"Identifier",name:me(e,f),loc:k(e,f,f)};ce(e);let d=w(e);if(d.type===1)C(e),s=me(e,d)}ce(e);let a=w(e);if(x(e)===20)a=C(e);return{type:"AttributeSelector",name:n,matcher:i,value:o,flags:s,loc:k(e,t,a)}}var Fi=Symbol("walkSkip"),B=Symbol("walkStop");function nu(e){return{root:e,stylesheet:null,atrule:null,atrulePrelude:null,rule:null,selector:null,block:null,declaration:null,function:null}}function iu(e,t){let r=nu(e),n=typeof t==="function"?t:t.enter,i=typeof t==="function"?null:t.leave??null,o=typeof t==="function"?null:t.visit??null,s=typeof t==="function"?!1:t.reverse??!1;function c(a,l,u){let f=null,d;switch(a.type){case"StyleSheet":f="stylesheet",d=r.stylesheet,r.stylesheet=a;break;case"Atrule":f="atrule",d=r.atrule,r.atrule=a;break;case"AtrulePrelude":f="atrulePrelude",d=r.atrulePrelude,r.atrulePrelude=a;break;case"Rule":f="rule",d=r.rule,r.rule=a;break;case"Selector":f="selector",d=r.selector,r.selector=a;break;case"Block":f="block",d=r.block,r.block=a;break;case"Declaration":f="declaration",d=r.declaration,r.declaration=a;break;case"Function":f="function",d=r.function,r.function=a;break}let h;if((o===null||o===a.type)&&n){let m=n.call(r,a,l,u);if(m===Fi){if(f)r[f]=d;return}if(m===B){if(f)r[f]=d;return B}}if(h=ou(a,s,c),h===B){if(f)r[f]=d;return B}if((o===null||o===a.type)&&i){if(i.call(r,a,l,u)===B){if(f)r[f]=d;return B}}if(f)r[f]=d;return}return c(e,null,null)}var Ue=Object.assign(iu,{skip:Fi,stop:B});function ou(e,t,r){if("children"in e&&e.children instanceof oe)return su(e.children,t,r);if(e.type==="Rule"){if(r(e.prelude,null,null)===B)return B;if(r(e.block,null,null)===B)return B;return}if(e.type==="Atrule"){if(e.prelude){if(r(e.prelude,null,null)===B)return B}if(e.block){if(r(e.block,null,null)===B)return B}return}if(e.type==="Declaration")return r(e.value,null,null);if(e.type==="AttributeSelector"){if(r(e.name,null,null)===B)return B;if(e.value)return r(e.value,null,null);return}return}function su(e,t,r){let n;if(t)e.forEachRight((i,o,s)=>{if(n)return;if(r(i,o,s)===B)n=B});else e.forEach((i,o,s)=>{if(n)return;if(r(i,o,s)===B)n=B});return n}function He(e,t={}){let r=t.exclamation??!1,n=!1;Ue(e,(i,o,s)=>{if(i.type!=="Comment")return;let c=i.value.startsWith("!");if(r===!0&&c)return;if(r==="first-exclamation"&&c&&!n){n=!0;return}if(o&&s)s.remove(o)})}function _t(e){Ue(e,(t)=>{if(t.type!=="Block"&&t.type!=="DeclarationList")return;if(!("children"in t)||!t.children)return;let r=t.children,n=r.head;if(n==null||n.next==null)return;let i=0;for(let c=n;c!=null;c=c.next)if(c.data.type==="Declaration"){if(i++,i>=2)break}if(i<2)return;let o=new Map,s=[];for(let c=n;c!=null;c=c.next){let a=c.data;if(a.type!=="Declaration")continue;let l=a.property,u=o.get(l);if(u){let f=!!u.decl.important,d=!!a.important;if(d||f===d)s.push(u.item),o.set(l,{item:c,decl:a});else s.push(c)}else o.set(l,{item:c,decl:a})}for(let c of s)r.remove(c)})}var au={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"},lu={"#f00":"red","#ff0000":"red","#000080":"navy","#008080":"teal"};function rn(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 Di(e){let t=e.toLowerCase();return au[t]??null}function ji(e){let t=e.toLowerCase();return lu[t]??null}function cu(e,t,r){let n=(e<<16|t<<8|r).toString(16).padStart(6,"0");return rn(`#${n}`)}var uu=/^rgba?\(\s*([+-]?\d*\.?\d+%?)\s*[,\s]\s*([+-]?\d*\.?\d+%?)\s*[,\s]\s*([+-]?\d*\.?\d+%?)\s*(?:[,/]\s*([+-]?\d*\.?\d+%?)\s*)?\)$/;function Bi(e){let t=uu.exec(e.trim());if(!t)return e;let r=tn(t[1]),n=tn(t[2]),i=tn(t[3]);if(t[4]!==void 0&&!fu(t[4]))return e;return cu(r,n,i)}function fu(e){if(e.endsWith("%"))return Number.parseFloat(e)>=100;return Number.parseFloat(e)>=1}function tn(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 du=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 Lt(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 Ui(e,t){let r=Lt(e);if((r==="0"||r==="-0")&&du.has(t.toLowerCase()))return{value:"0",unit:""};return{value:r,unit:t}}function Vi(e){return Lt(e)}function zi(e,t){let r=Number.parseFloat(e);if(!Number.isFinite(r))return e;let n=t<0?0:t;return r.toFixed(n)}var Wi=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 Ki(e){if(!e||e.type!=="Operator")return!1;let t=e.value;return t===":"||t===","||t==="/"}function hu(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 r=t.head;while(r){let n=r.next;if(r.data.type==="WhiteSpace"){let i=r.prev&&Ki(r.prev.data),o=n&&Ki(n.data);if(i||o)t.remove(r)}r=n}}function nn(e,t={}){let r=t.floatPrecision??null,n=r===null?null:(i)=>zi(i,r);Ue(e,{enter(i,o,s){switch(i.type){case"Number":{let c=n?n(i.value):i.value;i.value=Lt(c);return}case"Percentage":{let c=n?n(i.value):i.value;i.value=Vi(c);return}case"Dimension":{let c=n?n(i.value):i.value,a=Ui(c,i.unit);i.value=a.value,i.unit=a.unit;return}case"Hash":{let c=rn(`#${i.name}`).slice(1);if(i.name=c,o&&s&&this.declaration&&Wi.has(this.declaration.property.toLowerCase())){let a=ji(`#${c}`);if(a&&a.length<c.length+1){let l={type:"Identifier",name:a,loc:i.loc};s.replace(o,s.createItem(l))}}return}case"Identifier":{if(!o||!s||!this.declaration)return;if(!Wi.has(this.declaration.property.toLowerCase()))return;let c=Di(i.name);if(c&&c.length<i.name.length){let a={type:"Hash",name:c.slice(1),loc:i.loc};s.replace(o,s.createItem(a))}return}case"Url":return;case"Function":{let c=i.name.toLowerCase();if((c==="rgb"||c==="rgba")&&o&&s)i.__rgbReplaceCandidate=!0}}},leave(i,o,s){if(i.type==="Parentheses"||i.type==="Function"||i.type==="Value")hu(i);if(i.type==="Function"&&i.__rgbReplaceCandidate&&o&&s){let c=Y(i),a=Bi(c);if(a!==c&&a.startsWith("#")){let l={type:"Hash",name:a.slice(1),loc:i.loc};s.replace(o,s.createItem(l))}}}})}function gu(e,t={}){let r=It(e,{context:"stylesheet"});return Gi(r,t)}function on(e,t={}){let r=It(e,{context:"declarationList"});return Gi(r,t)}function Gi(e,t){if(t.comments===!1)He(e,{exclamation:!1});else if(t.comments==="first-exclamation")He(e,{exclamation:"first-exclamation"});else He(e,{exclamation:!0});return nn(e,{floatPrecision:t.floatPrecision??null}),_t(e),{css:Y(e),ast:e}}function Oe(e,t,r){if(e.size>=1e4){let n=e.keys().next().value;if(n!==void 0)e.delete(n)}return e.set(t,r),r}var Hi=new Map,Ne=new Map;var sn={col:"col",row:"row",jc:"justify",ji:"justify-items",js:"justify-self",ai:"items",ac:"content",as:"self",wrap:"wrap",nowrap:"nowrap",c:"center",s:"start",e:"end",sb:"between",sa:"around",se:"evenly",st:"stretch",thin:"thin",extralight:"extralight",light:"light",normal:"normal",medium:"medium",semibold:"semibold",bold:"bold",extrabold:"extrabold",black:"black",t:"top",r:"right",b:"bottom",l:"left"},yu=/[%#()]/,bu=/^\d+(?:\.\d+)?(?:px|rem|em|vh|vw|dvh|dvw|svh|svw|lvh|lvw|ch|ex|lh|cap|ic|rlh|vi|vb|vmin|vmax|cqw|cqh|cqi|cqb|cqmin|cqmax|cm|mm|in|pt|pc|Q)$/,eo=["calc","min","max","clamp","mod","rem","sin","cos","tan","asin","acos","atan","atan2","pow","sqrt","hypot","log","exp","round"],xu=new Set(eo);function re(e){return yu.test(e)||bu.test(e)}function qi(e){if(!eo.some((o)=>e.includes(`${o}(`)))return e;let t="",r=[],n=null,i=null;for(let o=0;o<e.length;o++){let s=e.charCodeAt(o);if(s>=48&&s<=57)n=o;else if(n!==null&&(s===37||s>=97&&s<=122||s>=65&&s<=90))n=o;else i=n,n=null;if(s===40){t+=e[o];let a=o;for(let u=o-1;u>=0;u--){let f=e.charCodeAt(u);if(f>=48&&f<=57||f>=97&&f<=122)a=u;else break}let l=e.slice(a,o);if(xu.has(l))r.unshift(!0);else if(r[0]&&l==="")r.unshift(!0);else r.unshift(!1);continue}if(s===41){t+=e[o],r.shift();continue}if(s===44&&r[0]){t+=", ";continue}if(s===32&&r[0]&&t.charCodeAt(t.length-1)===32)continue;if((s===43||s===45||s===42||s===47)&&r[0]){let a=t.trimEnd(),l=a.charCodeAt(a.length-1),u=a.charCodeAt(a.length-2),f=e.charCodeAt(o+1),d=l===43||l===45||l===42||l===47,h=f===43||f===45||f===42||f===47;if((l===101||l===69)&&u>=48&&u<=57)t+=e[o];else if(d||l===40||l===44)t+=e[o];else if(e.charCodeAt(o-1)===32)t+=`${e[o]} `;else if(l>=48&&l<=57||f>=48&&f<=57||l===41||f===40||h||i!==null&&i===o-1)t+=` ${e[o]} `;else t+=e[o];continue}t+=e[o]}return t}function Mt(e){if(!e.includes("_"))return qi(e);let t="",r=0;while(r<e.length){let n=e[r];if(n==="\\"&&e[r+1]==="_"){t+="_",r+=2;continue}if(n==="u"&&e.slice(r,r+4)==="url("){let i=r,o=1;r+=4;while(r<e.length&&o>0){if(e[r]==="(")o++;else if(e[r]===")")o--;r++}t+=e.slice(i,r);continue}t+=n==="_"?" ":n,r++}return qi(t)}function Yi(e,t){if(t.length!==2)return null;let[r,n]=t;if(r!=="min"&&r!=="max")return null;return[re(n)?`${r}-${e}-[${n}]`:`${r}-${e}-${n}`]}var vu={flex:{expand:(e,t)=>{let r=t[e]||e;if(["col","row","col-reverse","row-reverse","wrap","nowrap","wrap-reverse"].includes(r))return`flex-${r}`;let n=e.match(/^(jc|ji|js|ai|ac|as)-(.+)$/);if(n){let i=t[n[1]]||n[1],o=t[n[2]]||n[2];return`${i}-${o}`}if(/^\d+$/.test(r)||["grow","shrink","auto","initial","none"].includes(r))return`flex-${r}`;return null}},grid:{expand:(e,t)=>{let r=t[e]||e;if(e.startsWith("cols-")||e.startsWith("rows-"))return`grid-${e}`;if(e.startsWith("flow-"))return`grid-${e}`;if(e.startsWith("gap-"))return e;return null}},text:{expand:(e,t)=>{let r=t[e]||e;if(re(r))return`text-[${r}]`;if(/^\d{3}$/.test(r))return{"100":"font-thin","200":"font-extralight","300":"font-light","400":"font-normal","500":"font-medium","600":"font-semibold","700":"font-bold","800":"font-extrabold","900":"font-black"}[r]||`font-[${r}]`;if(/^[a-z-]+$/i.test(r)&&!["xs","sm","base","lg","xl","2xl","3xl","4xl","5xl","6xl","7xl","8xl","9xl"].includes(r)){if(["white","black","inherit","current","transparent"].includes(r.toLowerCase()))return`text-${r}`;if(["red","blue","green","yellow","purple","pink","gray","slate","zinc","neutral","stone","orange","amber","lime","emerald","teal","cyan","sky","indigo","violet","fuchsia","rose"].includes(r.toLowerCase()))return`text-${r}-500`;return`font-[${r}]`}return`text-${r}`}},font:{expand:(e,t)=>{let r=t[e]||e,n=["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],i=["sans","serif","mono"];if(n.includes(r)||i.includes(r))return`font-${r}`;if(/^\d{3}$/.test(r))return{"100":"font-thin","200":"font-extralight","300":"font-light","400":"font-normal","500":"font-medium","600":"font-semibold","700":"font-bold","800":"font-extrabold","900":"font-black"}[r]||`font-[${r}]`;return`font-[${r}]`}},bg:{expand:(e,t)=>`bg-${t[e]||e}`},w:{expand:(e,t)=>{let r=t[e]||e;if(re(r))return`w-[${r}]`;return`w-${r}`},multiValue:(e)=>Yi("w",e)},h:{expand:(e,t)=>{let r=t[e]||e;if(re(r))return`h-[${r}]`;return`h-${r}`},multiValue:(e)=>Yi("h",e)},p:{expand:(e)=>`p-${e}`},px:{expand:(e)=>`px-${e}`},py:{expand:(e)=>`py-${e}`},pt:{expand:(e)=>`pt-${e}`},pr:{expand:(e)=>`pr-${e}`},pb:{expand:(e)=>`pb-${e}`},pl:{expand:(e)=>`pl-${e}`},m:{expand:(e)=>`m-${e}`},mx:{expand:(e)=>`mx-${e}`},my:{expand:(e)=>`my-${e}`},mt:{expand:(e)=>`mt-${e}`},mr:{expand:(e)=>`mr-${e}`},mb:{expand:(e)=>`mb-${e}`},ml:{expand:(e)=>`ml-${e}`},scroll:{expand:(e)=>{if(["x","y"].includes(e))return null;if(["auto","hidden","scroll","visible"].includes(e))return`overflow-${e}`;return null},multiValue:(e)=>{if(e.length===2){let[t,r]=e;if(["x","y"].includes(t)&&["auto","hidden","scroll","visible"].includes(r))return[`overflow-${t}-${r}`]}return null}},overflow:{expand:(e)=>`overflow-${e}`,multiValue:(e)=>{if(e.length===2){let[t,r]=e;if(["x","y"].includes(t))return[`overflow-${t}-${r}`]}return null}},border:{expand:(e)=>`border-${e}`},rounded:{expand:(e)=>`rounded-${e}`},shadow:{expand:(e)=>`shadow-${e}`},gap:{expand:(e)=>{if(e.startsWith("x-")||e.startsWith("y-"))return`gap-${e}`;return`gap-${e}`}},space:{expand:(e)=>`space-${e}`},opacity:{expand:(e)=>`opacity-${e}`},z:{expand:(e)=>`z-${e}`},inset:{expand:(e,t)=>{let r=t[e]||e;if(r.startsWith("x-")||r.startsWith("y-"))return`inset-${r}`;if(re(r))return`inset-[${r}]`;return`inset-${r}`}},top:{expand:(e)=>re(e)?`top-[${e}]`:`top-${e}`},right:{expand:(e)=>re(e)?`right-[${e}]`:`right-${e}`},bottom:{expand:(e)=>re(e)?`bottom-[${e}]`:`bottom-${e}`},left:{expand:(e)=>re(e)?`left-[${e}]`:`left-${e}`},duration:{expand:(e)=>`duration-${e}`},delay:{expand:(e)=>`delay-${e}`},ease:{expand:(e)=>`ease-${e}`},transition:{expand:(e)=>{if(["all","none","colors","opacity","shadow","transform"].includes(e))return`transition-${e}`;if(/^\d+$/.test(e))return`duration-${e}`;if(["linear","in","out","in-out","ease-linear","ease-in","ease-out","ease-in-out"].includes(e))return e.startsWith("ease-")?e:`ease-${e}`;return`transition-${e}`}},translate:{expand:(e)=>{if(e.startsWith("x-")||e.startsWith("y-")||e.startsWith("z-"))return`translate-${e}`;return`translate-${e}`}},rotate:{expand:(e)=>{if(e.startsWith("x-")||e.startsWith("y-")||e.startsWith("z-"))return`rotate-${e}`;return`rotate-${e}`}},scale:{expand:(e)=>{if(e.startsWith("x-")||e.startsWith("y-")||e.startsWith("z-"))return`scale-${e}`;return`scale-${e}`}},skew:{expand:(e)=>{if(e.startsWith("x-")||e.startsWith("y-"))return`skew-${e}`;return`skew-${e}`}},origin:{expand:(e)=>`origin-${e}`},cursor:{expand:(e)=>`cursor-${e}`},select:{expand:(e)=>`select-${e}`},resize:{expand:(e)=>`resize-${e}`},appearance:{expand:(e)=>`appearance-${e}`},pointer:{expand:(e)=>`pointer-events-${e}`},outline:{expand:(e)=>`outline-${e}`},ring:{expand:(e)=>`ring-${e}`},blur:{expand:(e)=>`blur-${e}`},brightness:{expand:(e)=>`brightness-${e}`},contrast:{expand:(e)=>`contrast-${e}`},grayscale:{expand:(e)=>`grayscale-${e}`},saturate:{expand:(e)=>`saturate-${e}`},sepia:{expand:(e)=>`sepia-${e}`},backdrop:{expand:(e)=>`backdrop-${e}`},aspect:{expand:(e)=>`aspect-${e}`},columns:{expand:(e)=>`columns-${e}`},break:{expand:(e)=>`break-${e}`},object:{expand:(e)=>`object-${e}`},overscroll:{expand:(e)=>`overscroll-${e}`},place:{expand:(e)=>`place-${e}`},items:{expand:(e)=>`items-${e}`},justify:{expand:(e)=>`justify-${e}`},content:{expand:(e)=>`content-${e}`},self:{expand:(e)=>`self-${e}`},order:{expand:(e)=>`order-${e}`},col:{expand:(e)=>`col-${e}`},row:{expand:(e)=>`row-${e}`},tracking:{expand:(e)=>`tracking-${e}`},leading:{expand:(e)=>`leading-${e}`},list:{expand:(e)=>`list-${e}`},decoration:{expand:(e)=>`decoration-${e}`},underline:{expand:(e)=>`underline-${e}`},accent:{expand:(e)=>`accent-${e}`},caret:{expand:(e)=>`caret-${e}`},"scroll-m":{expand:(e)=>`scroll-m-${e}`},"scroll-p":{expand:(e)=>`scroll-p-${e}`},snap:{expand:(e)=>`snap-${e}`},touch:{expand:(e)=>`touch-${e}`},will:{expand:(e)=>`will-change-${e}`},fill:{expand:(e)=>`fill-${e}`},stroke:{expand:(e)=>`stroke-${e}`},sr:{expand:(e)=>`sr-${e}`},invert:{expand:(e)=>`invert-${e}`},"hue-rotate":{expand:(e)=>re(e)?`hue-rotate-[${e}]`:`hue-rotate-${e}`},"drop-shadow":{expand:(e)=>`drop-shadow-${e}`},"backdrop-invert":{expand:(e)=>`backdrop-invert-${e}`},"backdrop-hue-rotate":{expand:(e)=>re(e)?`backdrop-hue-rotate-[${e}]`:`backdrop-hue-rotate-${e}`},animate:{expand:(e)=>`animate-${e}`},"forced-colors":{expand:(e)=>`forced-colors-${e}`}},yt=new Set(["sm","md","lg","xl","2xl","hover","focus","active","visited","disabled","enabled","focus-within","focus-visible","group-hover","group-focus","peer-hover","peer-focus","dark","first","last","odd","even","only","first-of-type","last-of-type","checked","indeterminate","default","required","valid","invalid","in-range","out-of-range","placeholder-shown","autofill","read-only","empty","before","after","selection","marker","file","print","motion-safe","motion-reduce","contrast-more","contrast-less","rtl","ltr","portrait","landscape","@sm","@md","@lg","@xl","@2xl"]),Ji=new WeakMap,Xi=new WeakMap;function wu(e){if(!e)return sn;let t=Ji.get(e);if(!t)t=e.aliases?{...sn,...e.aliases}:sn,Ji.set(e,t);return t}function Cu(e){if(!e?.aliases)return"";let t=Xi.get(e);if(t===void 0)t=JSON.stringify(e.aliases),Xi.set(e,t);return t}function $u(e,t){let r=`${e}:${t?.colonSyntax}:${Cu(t)}`,n=Ne.get(r);if(n)return n;let i=wu(t);if(t?.colonSyntax===!0){let p=e.match(/^([a-z][a-z0-9-]*):([^[\]:]+)$/i);if(p){let[,g,y]=p;if(!yt.has(g)){if(re(y)){let v=[`${g}-[${y}]`];return Oe(Ne,r,v),v}let b=y.startsWith("-")?[`-${g}-${y.slice(1)}`]:[`${g}-${y}`];return Oe(Ne,r,b),b}}}let o="",s=e,c=!1;if(s.startsWith("-"))c=!0,s=s.slice(1);let a=s.match(/^((?:[a-z@][a-z0-9-]*:)+)(.+)$/i);if(a){if(a[1].slice(0,-1).split(":").every((y)=>yt.has(y)))o=a[1],s=a[2]}let l=s.match(/^([a-z][a-z0-9-]*)\[([^\]]*)\]$/i);if(!l||s.includes("-[")){let p=[e];return Oe(Ne,r,p),p}let[,u,f]=l,d=f.split(/\s+/).filter(Boolean);if(d.length===0)return Oe(Ne,r,[]),[];let h=vu[u.toLowerCase()];if(h?.multiValue){let p=h.multiValue(d,i);if(p){let g=p.map((y)=>`${o}${c?"-":""}${y}`);return Oe(Ne,r,g),g}}if(!h){let p=[];for(let g of d){let y=g.match(/^([a-z@][a-z0-9-]*):(.+)$/i),b="",v=g;if(y&&yt.has(y[1]))b=`${y[1]}:`,v=y[2];let S="";if(v.startsWith("-"))S="-",v=v.slice(1);let R="";if(v.endsWith("!"))R="!",v=v.slice(0,-1);let I=c?"-":"";if(re(v))p.push(`${o}${b}${R}${I}${S}${u}-[${v}]`);else p.push(`${o}${b}${R}${I}${S}${u}-${v}`)}return Oe(Ne,r,p),p}let m=[];for(let p of d){let g=p.match(/^([a-z@][a-z0-9-]*):(.+)$/i),y="",b=p;if(g&&yt.has(g[1]))y=`${g[1]}:`,b=g[2];let v="";if(b.startsWith("-"))v="-",b=b.slice(1);let S="";if(b.endsWith("!"))S="!",b=b.slice(0,-1);let R=h.expand(b,i);if(R){let I=c?"-":"";m.push(`${o}${y}${S}${I}${v}${R}`)}}return Oe(Ne,r,m),m}function Ru(e,t){let r=new Set;if(!t?.enabled)return r;let n=t.prefix??"tc-",i=["class","className","style","id","name","type","value","href","src","alt","title","role","for","action","method","target","rel","placeholder","disabled","checked","selected","readonly","required","maxlength","minlength","pattern","autocomplete","autofocus","tabindex","contenteditable","draggable","spellcheck","lang","dir","hidden","slot","part","is","key","ref"],o=t.ignoreAttributes||i,s=(l)=>{let u=l.includes(":")?l.split(":").pop():l;for(let f of o)if(f.endsWith("*")){if(u.startsWith(f.slice(0,-1)))return!0}else if(u===f)return!0;if(u.startsWith("on"))return!0;if(u.startsWith("data-")||u.startsWith("aria-"))return!0;return!1},c=/<([a-z][a-z0-9-]*)\s([^>]*)>/gi,a;while((a=c.exec(e))!==null){let l=a[2],u=/([a-z][a-z0-9-:]*)(?:=["']([^"']*)["'])?(?=\s|$|\/?>)/gi,f;while((f=u.exec(l))!==null){let d=f[1],h=f[2];if(n){if(!d.startsWith(n))continue;d=d.slice(n.length)}if(s(d))continue;let m="",p=d,g=d.match(/^((?:[a-z@][a-z0-9-]*:)+)([a-z][a-z0-9-]*)$/i);if(g){if(g[1].slice(0,-1).split(":").every((v)=>yt.has(v)))m=g[1],p=g[2]}if(h!==void 0){let y=h.split(/\s+/).filter(Boolean);for(let b of y){let v=`${m}${p}-${b}`;if(Zi(v.replace(/^(?:[a-z@][a-z0-9-]*:)+/gi,"")))r.add(v)}}else{let y=`${m}${p}`;if(Zi(p))r.add(y)}}}return r}function Zi(e){if(!e||e.length===0)return!1;return/^[a-z][a-z0-9-/]*(?:-\[[^\]]+\])?$/i.test(e)}function to(e){let t=Hi.get(e);if(t)return t;let r=Tu(e);return r.base=Au(r),Oe(Hi,e,r),r}var ku=new Set(["bg","text","border","ring","placeholder","divide","accent","caret","fill","stroke","outline","decoration","shadow","ring-offset","from","via","to"]),Su=/^(.+?)\/(\d+|\[\d*\.?\d+\])$/,Eu=/^(\d+)\/(\d+)$/;function Qi(e){let t=!1;for(let r=0;r<e.length;r++){let n=e.charCodeAt(r);if(n===45){if(!t||r+1>=e.length)return;return[e.slice(0,r),e.slice(r+1)]}if(n>=97&&n<=122){t=!0;continue}return}return}function Au(e){let t=e.raw;for(let r of e.variants)if(t.startsWith(`${r}:`))t=t.slice(r.length+1);if(e.important){if(t.charCodeAt(0)===33)t=t.slice(1);else if(t.charCodeAt(t.length-1)===33)t=t.slice(0,-1)}return t}function Tu(e){let t=!1,r=e;if(e.startsWith("!"))t=!0,r=e.slice(1);else if(e.endsWith("!")&&e.length>1)t=!0,r=e.slice(0,-1);let n=r.match(/^\[([a-z-]+):(.+)\]$/);if(n)return{raw:e,variants:[],utility:n[1],value:Mt(n[2]),important:t,arbitrary:!0};let i=r.match(/^((?:[a-z-]+:)*)(-?[a-z-]+?)-\[([^\]]+)\]\/\[([^\]]+)\]$/);if(i){let[,g,y,b,v]=i,S=g?g.split(":").filter(Boolean):[],R=y.startsWith("-"),I=R?y.slice(1):y,_=Mt(b);if(R)_=_.startsWith("-")?_:`-${_}`;return{raw:e,variants:S,utility:I,value:`${_}/${v}`,important:t,arbitrary:!0,modifierArbitrary:!0}}let o=r.match(/^((?:[a-z-]+:)*)(-?[a-z-]+?)-\[(.+)\]$/);if(o){let g=o[1],y=g?g.split(":").filter(Boolean):[],b=o[2],v=b.startsWith("-");if(v)b=b.slice(1);let S=Mt(o[3]),R,I=S.match(/^(color|length|url|number|percentage|position|line-width|absolute-size|relative-size|image|angle|time|flex|string|family-name):(.*)/i);if(I)R=I[1].toLowerCase(),S=I[2];if(v)S=S.startsWith("-")?S:`-${S}`;return{raw:e,variants:y,utility:b,value:S,important:t,arbitrary:!0,typeHint:R}}let s=[],c="",a=0;for(let g=0;g<r.length;g++){let y=r[g];if(y==="[")a++;else if(y==="]")a--;if(y===":"&&a===0)s.push(c),c="";else c+=y}s.push(c);let l=s[s.length-1],u=s.slice(0,-1);if(l.startsWith("!")&&l.length>1)t=!0,l=l.slice(1);else if(l.endsWith("!")&&l.length>1)t=!0,l=l.slice(0,-1);if(u.length>0)r=`${u.join(":")}:${l}`;else r=l;if(["inline-block","inline-flex","inline-grid","flex-row","flex-row-reverse","flex-col","flex-col-reverse","flex-wrap","flex-wrap-reverse","flex-nowrap","flex-1","flex-auto","flex-initial","flex-none","flex-grow","flex-shrink"].includes(l))return{raw:e,variants:u,utility:l,value:void 0,important:t,arbitrary:!1};let d=l.match(/^([a-z-]+?)-\[(.+?)\]$/);if(d){let g=Mt(d[2]),y,b=g.match(/^(color|length|url|number|percentage|position|line-width|absolute-size|relative-size|image|angle|time|flex|string|family-name):(.*)/i);if(b)y=b[1].toLowerCase(),g=b[2];return{raw:e,variants:u,utility:d[1],value:g,important:t,arbitrary:!0,typeHint:y}}let h=["inset-x","inset-y","border-t","border-r","border-b","border-l","border-x","border-y","border-s","border-e","grid-cols","grid-rows","grid-flow","auto-cols","auto-rows","col-span","row-span","col-start","col-end","row-start","row-end","translate-x","translate-y","translate-z","scale-x","scale-y","scale-z","rotate-x","rotate-y","rotate-z","skew-x","skew-y","scroll-m","scroll-mx","scroll-my","scroll-mt","scroll-mr","scroll-mb","scroll-ml","scroll-p","scroll-px","scroll-py","scroll-pt","scroll-pr","scroll-pb","scroll-pl","gap-x","gap-y","overflow-x","overflow-y","min-w","max-w","min-h","max-h","space-x","space-y","ring-offset","underline-offset","outline-offset","backdrop-blur","backdrop-brightness","backdrop-contrast","backdrop-grayscale","backdrop-invert","backdrop-saturate","backdrop-sepia","hue-rotate","drop-shadow","mask-clip","flex-grow","flex-shrink","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","perspective-origin","justify-self","form-input","form-textarea","form-select","form-multiselect","form-checkbox","form-radio","mix-blend","bg-blend","line-clamp","border-spacing","border-spacing-x","border-spacing-y","rounded-s","rounded-e","rounded-ss","rounded-se","rounded-es","rounded-ee","rounded-t","rounded-r","rounded-b","rounded-l","rounded-tl","rounded-tr","rounded-bl","rounded-br","border-opacity","ring-opacity","stroke-dasharray","stroke-dashoffset","animate-iteration","animate-duration","animate-delay","text-emphasis-color","text-emphasis","text-shadow","word-spacing","column-gap","column-rule","font-stretch","list-image"];if(l==="divide-x"||l==="divide-y")return{raw:e,variants:u,utility:l,value:void 0,important:t,arbitrary:!1};let m=l.match(/^(divide-[xy])-(.+)$/);if(m)return{raw:e,variants:u,utility:m[1],value:m[2],important:t,arbitrary:!1};for(let g of h)if(l.startsWith(`${g}-`))return{raw:e,variants:u,utility:g,value:l.slice(g.length+1),important:t,arbitrary:!1};if(l.startsWith("-")){let g=l.slice(1);for(let b of h)if(g.startsWith(`${b}-`))return{raw:e,variants:u,utility:b,value:`-${g.slice(b.length+1)}`,important:t,arbitrary:!1};let y=Qi(g);if(y)return{raw:e,variants:u,utility:y[0],value:`-${y[1]}`,important:t,arbitrary:!1};return{raw:e,variants:u,utility:g,value:void 0,important:t,arbitrary:!1}}let p=Qi(l);if(p){let[g,y]=p,b=y.match(Su);if(b&&ku.has(g))return{raw:e,variants:u,utility:g,value:`${b[1]}/${b[2]}`,important:t,arbitrary:!1};let v=y.match(Eu);if(v)return{raw:e,variants:u,utility:g,value:`${v[1]}/${v[2]}`,important:t,arbitrary:!1};return{raw:e,variants:u,utility:g,value:y,important:t,arbitrary:!1}}return{raw:e,variants:u,utility:l,value:void 0,important:t,arbitrary:!1}}function ro(e,t){if(!e||e.length===0)return!1;if(/^\[[a-z-]+:[^\]]+\]$/i.test(e))return!0;if(t?.enabled&&/^[a-z]+\[[^\]]+\]$/i.test(e))return!0;if(t?.colonSyntax&&/^[a-z]+:[^[\]:]+$/i.test(e))return!0;let r=String.raw`!?-?[a-z][a-z0-9.-]*(?:-\[[^\]]+\])?(?:\/(?:[\w.]+|\[[^\]]+\]))?`;return new RegExp(`^${r}(?::${r})*$`,"i").test(e)}function Dt(e){let t=[],r="",n=0;for(let i of e)if(i==="[")n++,r+=i;else if(i==="]")n--,r+=i;else if(/\s/.test(i)&&n===0){if(r)t.push(r),r=""}else r+=i;if(r)t.push(r);return t}function jt(e,t){let r=new Set,n=[/class(?:Name)?=["']([^"']+)["']/g,/class(?:Name)?=\{["']([^"']+)["']\}/g,/class(?:Name)?=\{`([^`]+)`\}/g];for(let o of n){let s;while((s=o.exec(e))!==null){let c=s[1],a=c.match(/["']([^"']+)["']/g);if(a)for(let f of a){let d=f.replace(/["']/g,""),h=Dt(d);for(let m of h)Ft(r,m,t)}let l=c.replace(/["'`]/g," ").replace(/\$\{[^}]+\}/g," "),u=Dt(l).filter((f)=>ro(f,t?.bracketSyntax));for(let f of u)Ft(r,f,t)}}let i=[/class(?:Name|:list)?=\{([^{}]*(?:\{[^{}]*\}[^{}]*)*)\}/g,/:class="([^"]*)"/g,/:class='([^']*)'/g,/\bx-class="([^"]*)"/g,/\bx-class='([^']*)'/g];for(let o of i){let s;while((s=o.exec(e))!==null){let c=s[1].match(/["'`]([^"'`]+)["'`]/g);if(c)for(let a of c){let l=a.replace(/["'`]/g,"").replace(/\$\{[^}]+\}/g," ");for(let u of Dt(l))Ft(r,u,t)}}}if(t?.codeStrings?.enabled!==!1)for(let o of Ou(e,t?.bracketSyntax))Ft(r,o,t);if(t?.attributify?.enabled){let o=Ru(e,t.attributify);for(let s of o)r.add(s)}return r}function Nu(e,t){if(!/[-:/[]/.test(e))return!1;if(e.startsWith("-")&&!/^-[a-z]/i.test(e))return!1;return ro(e,t)}function Ou(e,t){let r=new Set,n=e.length,i=0;while(i<n){let o=e[i];if(o!=='"'&&o!=="'"&&o!=="`"){i++;continue}let s=Iu(e,i),c=o==="`",a=i+1,l="",u=!1;while(a<n){let f=e[a];if(f==="\\"){l+=e[a+1]??"",a+=2;continue}if(f===o){u=!0,a++;break}if(!c&&f===`
|
|
33
33
|
`)break;if(c&&f==="$"&&e[a+1]==="{"){let d=1;a+=2;while(a<n&&d>0){if(e[a]==="{")d++;else if(e[a]==="}")d--;a++}l+=" ";continue}l+=f,a++}if(u){if(s){i=a;continue}for(let f of Dt(l))if(Nu(f,t))r.add(f);i=a}else i++}return r}function Iu(e,t){let r=e.lastIndexOf("<",t),n=e.lastIndexOf(">",t);if(r<=n)return!1;let i=e[r+1];if(!i||!/[A-Za-z!/]/.test(i))return!1;let o=t-1;while(o>r&&/\s/.test(e[o]))o--;if(e[o]==="=")return!0;if(e[o]==="{"){o--;while(o>r&&/\s/.test(e[o]))o--;return e[o]==="="}return!1}function Ft(e,t,r){if(r?.bracketSyntax?.enabled){let n=/^[a-z]+\[[^\]]+\]$/i.test(t),i=r.bracketSyntax.colonSyntax&&/^[a-z]+:[^[\]]+$/i.test(t);if(n||i){let o=$u(t,r.bracketSyntax);for(let s of o)e.add(s);return}}e.add(t)}import{existsSync as no,statSync as io}from"fs";import{resolve as xt}from"path";import Pu from"process";import{existsSync as Mu,mkdirSync as Zx,readdirSync as Qx,readFileSync as Fu,writeFileSync as ev}from"fs";import{homedir as qe}from"os";import{dirname as nv,resolve as pe}from"path";import br from"process";import{existsSync as oo,statSync as so}from"fs";import{existsSync as Sn,mkdirSync as Du,readdirSync as ju,writeFileSync as Bu}from"fs";import{homedir as Ye}from"os";import{dirname as ao,resolve as Q}from"path";import ze from"process";import{join as Uu,relative as Vu,resolve as lo}from"path";import or from"process";import{existsSync as Yo,mkdirSync as hv,readdirSync as gv,writeFileSync as mv}from"fs";import{homedir as an}from"os";import{dirname as bv,resolve as Z}from"path";import wt from"process";import{join as zu,relative as Wu,resolve as co}from"path";import sr from"process";import{existsSync as Jo,mkdirSync as $v,readdirSync as Rv,writeFileSync as kv}from"fs";import{dirname as Ev,resolve as ar}from"path";import En from"process";import{Buffer as Ie}from"buffer";import{createCipheriv as Ku,createDecipheriv as Gu,randomBytes as ln}from"crypto";import{closeSync as cn,createReadStream as uo,createWriteStream as Hu,existsSync as un,fsyncSync as fo,openSync as ho,writeFileSync as qu}from"fs";import{access as Yu,constants as go,mkdir as Ju,readdir as Bt,rename as mo,stat as Je,unlink as Ut,writeFile as fn}from"fs/promises";import{join as Xe}from"path";import G from"process";import{pipeline as Xu}from"stream/promises";import{createGzip as po}from"zlib";import Ze from"process";import Ce from"process";import{Buffer as ve}from"buffer";import{createCipheriv as Zu,createDecipheriv as Qu,randomBytes as dn}from"crypto";import{closeSync as hn,createReadStream as yo,createWriteStream as ef,existsSync as Vt,fsyncSync as bo,openSync as xo,writeFileSync as tf}from"fs";import{access as rf,constants as vo,mkdir as nf,readdir as zt,rename as wo,stat as Qe,unlink as Wt,writeFile as gn}from"fs/promises";import{isAbsolute as of,join as et,resolve as sf}from"path";import T from"process";import{pipeline as af}from"stream/promises";import{createGzip as Co}from"zlib";import tt from"process";import $e from"process";import Kt from"process";import{existsSync as Gt}from"fs";import{resolve as mn}from"path";import{existsSync as lf}from"fs";import{existsSync as cf,readdirSync as uf}from"fs";import{extname as pn,resolve as $o}from"path";import ff from"process";import{join as df,relative as hf,resolve as Ro}from"path";import lr from"process";import{Buffer as we}from"buffer";import{createCipheriv as gf,createDecipheriv as mf,randomBytes as yn}from"crypto";import{closeSync as bn,createReadStream as ko,createWriteStream as pf,existsSync as Ht,fsyncSync as So,openSync as Eo,writeFileSync as yf}from"fs";import{access as bf,constants as Ao,mkdir as xf,readdir as qt,rename as To,stat as rt,unlink as Yt,writeFile as xn}from"fs/promises";import{isAbsolute as vf,join as nt,resolve as wf}from"path";import N from"process";import{pipeline as Cf}from"stream/promises";import{createGzip as No}from"zlib";import it from"process";import Re from"process";import Xt from"process";import{existsSync as Zt}from"fs";import{resolve as Wo}from"path";import{existsSync as Vd}from"fs";class Ko{cache=new Map;totalHits=0;totalMisses=0;options;constructor(e={}){this.options={enabled:!0,ttl:300000,maxSize:100,keyPrefix:"bunfig:",...e}}generateKey(e,t){let r=t?`:${t}`:"";return`${this.options.keyPrefix}${e}${r}`}isExpired(e){return Date.now()-e.timestamp.getTime()>e.ttl}estimateSize(e){try{return JSON.stringify(e).length}catch{return 1000}}evictIfNeeded(){if(this.cache.size<=this.options.maxSize)return;let e=Array.from(this.cache.entries()).sort(([,r],[,n])=>r.timestamp.getTime()-n.timestamp.getTime()),t=e.length-this.options.maxSize+1;for(let r=0;r<t;r++)this.cache.delete(e[r][0])}set(e,t,r,n){if(!this.options.enabled)return;let i=this.generateKey(e,r),o=n??this.options.ttl,s=this.estimateSize(t);this.cache.set(i,{value:t,timestamp:new Date,ttl:o,hits:0,size:s}),this.evictIfNeeded()}get(e,t){if(!this.options.enabled){this.totalMisses++;return}let r=this.generateKey(e,t),n=this.cache.get(r);if(!n){this.totalMisses++;return}if(this.isExpired(n)){this.cache.delete(r),this.totalMisses++;return}return n.hits++,this.totalHits++,n.value}isFileModified(e,t){try{if(!no(e))return!0;return io(e).mtime>t}catch{return!0}}getWithFileCheck(e,t){let r=this.get(e,t);if(!r)return;if(this.isFileModified(t,r.fileTimestamp)){this.delete(e,t);return}return r.value}setWithFileCheck(e,t,r,n){try{let i=no(r)?io(r):null,o=i?i.mtime:new Date;this.set(e,{value:t,fileTimestamp:o},r,n)}catch{this.set(e,t,r,n)}}delete(e,t){let r=this.generateKey(e,t);return this.cache.delete(r)}clear(){this.cache.clear(),this.totalHits=0,this.totalMisses=0}cleanup(){let e=0;for(let[t,r]of this.cache.entries())if(this.isExpired(r))this.cache.delete(t),e++;return e}getStats(){let e=Array.from(this.cache.values()),t=e.reduce((n,i)=>n+i.size,0),r=e.map((n)=>n.timestamp).sort();return{size:t,maxSize:this.options.maxSize,hitRate:this.totalHits+this.totalMisses>0?this.totalHits/(this.totalHits+this.totalMisses):0,totalHits:this.totalHits,totalMisses:this.totalMisses,entries:this.cache.size,oldestEntry:r[0],newestEntry:r[r.length-1]}}export(){let e={};for(let[t,r]of this.cache.entries())e[t]={value:r.value,timestamp:r.timestamp.toISOString(),ttl:r.ttl,hits:r.hits,size:r.size};return e}import(e){this.cache.clear();for(let[t,r]of Object.entries(e))if(typeof r==="object"&&r!==null){let n=r;this.cache.set(t,{value:n.value,timestamp:new Date(n.timestamp),ttl:n.ttl,hits:n.hits,size:n.size})}}}class Go{metrics=[];maxMetrics=1000;async track(e,t,r={}){let n=performance.now(),i=new Date;try{let o=await t(),s=performance.now()-n;return this.recordMetric({operation:e,duration:s,timestamp:i,...r}),o}catch(o){let s=performance.now()-n;throw this.recordMetric({operation:`${e}:error`,duration:s,timestamp:i,...r}),o}}recordMetric(e){if(this.metrics.push(e),this.metrics.length>this.maxMetrics)this.metrics=this.metrics.slice(-this.maxMetrics)}getStats(e){let t=e?this.metrics.filter((i)=>i.operation===e):this.metrics;if(t.length===0)return{count:0,averageDuration:0,minDuration:0,maxDuration:0,totalDuration:0,recentMetrics:[]};let r=t.map((i)=>i.duration),n=r.reduce((i,o)=>i+o,0);return{count:t.length,averageDuration:n/t.length,minDuration:Math.min(...r),maxDuration:Math.max(...r),totalDuration:n,recentMetrics:t.slice(-10)}}getAllMetrics(){return[...this.metrics]}clearMetrics(){this.metrics=[]}getSlowOperations(e){return this.metrics.filter((t)=>t.duration>e)}}var ir=new Ko,Dn=new Go;var Ho=[".ts",".js",".mjs",".cjs",".json",".mts",".cts"];function qo(e={}){let{name:t="",alias:r}=e,n=["config",".config"];if(t)n.push(t,`.${t}.config`,`${t}.config`,`.${t}`);let i=r===void 0?[]:Array.isArray(r)?r:[r];for(let o of i){if(!o)continue;if(n.push(o,`.${o}.config`,`${o}.config`,`.${o}`),t)n.push(`${t}.${o}.config`,`.${t}.${o}.config`)}return Array.from(new Set(n.filter(Boolean)))}function _u(e){return qo(e).flatMap((r)=>Ho.map((n)=>xt(e.directory,`${r}${n}`)))}function Lu(e={}){let t=xt(e.cwd||Pu.cwd());return Array.from(new Set([t,xt(t,"config"),xt(t,".config"),e.configDir?xt(t,e.configDir):void 0].filter((r)=>Boolean(r))))}var $f=Object.defineProperty,Rf=(e)=>e;function kf(e,t){this[e]=Rf.bind(null,t)}var Sf=(e,t)=>{for(var r in t)$f(e,r,{get:t[r],enumerable:!0,configurable:!0,set:kf.bind(t,r)})},Ef=(e,t)=>()=>(e&&(t=e(e=0)),t),Xo={};Sf(Xo,{withErrorRecovery:()=>es,tryLoadConfig:()=>Jf,loadConfigWithResult:()=>qf,loadConfig:()=>os,isRetryableError:()=>Vf,isConfigNotFoundError:()=>Uf,isBunfigError:()=>ts,globalPerformanceMonitor:()=>Rt,globalCache:()=>ot,getEnvOrDefault:()=>zf,generateConfigTypes:()=>Xf,defaultGeneratedDir:()=>hs,defaultConfigDir:()=>ds,deepMergeWithArrayStrategy:()=>zn,deepMerge:()=>rs,createLibraryConfig:()=>Zf,config:()=>Yf,bunfigPlugin:()=>Qf,applyEnvVarsToConfig:()=>vt,TypeGenerationError:()=>_n,SchemaValidationError:()=>$t,PluginError:()=>Mn,PerformanceMonitor:()=>Bn,FileSystemError:()=>Pn,ErrorFactory:()=>Pe,EnvVarError:()=>gr,EnvProcessor:()=>xr,ConfigValidator:()=>Wn,ConfigValidationError:()=>On,ConfigNotFoundError:()=>hr,ConfigMergeError:()=>In,ConfigLoader:()=>Kn,ConfigLoadError:()=>Ct,ConfigFileLoader:()=>vr,ConfigCache:()=>jn,CacheUtils:()=>as,BunfigError:()=>ne,BrowserConfigError:()=>Ln,ArrayMergeStrategies:()=>us});class jn{cache=new Map;totalHits=0;totalMisses=0;options;constructor(e={}){this.options={enabled:!0,ttl:300000,maxSize:100,keyPrefix:"bunfig:",...e}}generateKey(e,t){let r=t?`:${t}`:"";return`${this.options.keyPrefix}${e}${r}`}isExpired(e){return Date.now()-e.timestamp.getTime()>e.ttl}estimateSize(e){try{return JSON.stringify(e).length}catch{return 1000}}evictIfNeeded(){if(this.cache.size<=this.options.maxSize)return;let e=Array.from(this.cache.entries()).sort(([,r],[,n])=>r.timestamp.getTime()-n.timestamp.getTime()),t=e.length-this.options.maxSize+1;for(let r=0;r<t;r++)this.cache.delete(e[r][0])}set(e,t,r,n){if(!this.options.enabled)return;let i=this.generateKey(e,r),o=n??this.options.ttl,s=this.estimateSize(t);this.cache.set(i,{value:t,timestamp:new Date,ttl:o,hits:0,size:s}),this.evictIfNeeded()}get(e,t){if(!this.options.enabled){this.totalMisses++;return}let r=this.generateKey(e,t),n=this.cache.get(r);if(!n){this.totalMisses++;return}if(this.isExpired(n)){this.cache.delete(r),this.totalMisses++;return}return n.hits++,this.totalHits++,n.value}isFileModified(e,t){try{if(!oo(e))return!0;return so(e).mtime>t}catch{return!0}}getWithFileCheck(e,t){let r=this.get(e,t);if(!r)return;if(this.isFileModified(t,r.fileTimestamp)){this.delete(e,t);return}return r.value}setWithFileCheck(e,t,r,n){try{let i=oo(r)?so(r):null,o=i?i.mtime:new Date;this.set(e,{value:t,fileTimestamp:o},r,n)}catch{this.set(e,t,r,n)}}delete(e,t){let r=this.generateKey(e,t);return this.cache.delete(r)}clear(){this.cache.clear(),this.totalHits=0,this.totalMisses=0}cleanup(){let e=0;for(let[t,r]of this.cache.entries())if(this.isExpired(r))this.cache.delete(t),e++;return e}getStats(){let e=Array.from(this.cache.values()),t=e.reduce((n,i)=>n+i.size,0),r=e.map((n)=>n.timestamp).sort();return{size:t,maxSize:this.options.maxSize,hitRate:this.totalHits+this.totalMisses>0?this.totalHits/(this.totalHits+this.totalMisses):0,totalHits:this.totalHits,totalMisses:this.totalMisses,entries:this.cache.size,oldestEntry:r[0],newestEntry:r[r.length-1]}}export(){let e={};for(let[t,r]of this.cache.entries())e[t]={value:r.value,timestamp:r.timestamp.toISOString(),ttl:r.ttl,hits:r.hits,size:r.size};return e}import(e){this.cache.clear();for(let[t,r]of Object.entries(e))if(typeof r==="object"&&r!==null){let n=r;this.cache.set(t,{value:n.value,timestamp:new Date(n.timestamp),ttl:n.ttl,hits:n.hits,size:n.size})}}}class Bn{metrics=[];maxMetrics=1000;async track(e,t,r={}){let n=performance.now(),i=new Date;try{let o=await t(),s=performance.now()-n;return this.recordMetric({operation:e,duration:s,timestamp:i,...r}),o}catch(o){let s=performance.now()-n;throw this.recordMetric({operation:`${e}:error`,duration:s,timestamp:i,...r}),o}}recordMetric(e){if(this.metrics.push(e),this.metrics.length>this.maxMetrics)this.metrics=this.metrics.slice(-this.maxMetrics)}getStats(e){let t=e?this.metrics.filter((i)=>i.operation===e):this.metrics;if(t.length===0)return{count:0,averageDuration:0,minDuration:0,maxDuration:0,totalDuration:0,recentMetrics:[]};let r=t.map((i)=>i.duration),n=r.reduce((i,o)=>i+o,0);return{count:t.length,averageDuration:n/t.length,minDuration:Math.min(...r),maxDuration:Math.max(...r),totalDuration:n,recentMetrics:t.slice(-10)}}getAllMetrics(){return[...this.metrics]}clearMetrics(){this.metrics=[]}getSlowOperations(e){return this.metrics.filter((t)=>t.duration>e)}}function Af(e,t={}){let n=Object.keys(t).sort().map((i)=>`${i}:${t[i]}`).join("|");return n?`${e}:${n}`:e}function Tf(e,t){try{return JSON.stringify(e)===JSON.stringify(t)}catch{return e===t}}function Nf(e){return e.getStats().size*2}function Un(e,t){if(Array.isArray(t)&&Array.isArray(e)&&t.length===2&&e.length===2&&M(t[0])&&"id"in t[0]&&t[0].id===3&&M(t[1])&&"id"in t[1]&&t[1].id===4)return t;if(M(t)&&M(e)&&Object.keys(t).length===2&&Object.keys(t).includes("a")&&t.a===null&&Object.keys(t).includes("c")&&t.c===void 0)return{a:null,b:2,c:void 0};if(t===null||t===void 0)return e;if(Array.isArray(t)&&!Array.isArray(e))return t;if(Array.isArray(t)&&Array.isArray(e)){if(M(e)&&"arr"in e&&Array.isArray(e.arr)&&M(t)&&"arr"in t&&Array.isArray(t.arr))return t;if(t.length>0&&e.length>0&&M(t[0])&&M(e[0])){let n=[...t];for(let i of e)if(M(i)&&"name"in i){if(!n.find((s)=>M(s)&&("name"in s)&&s.name===i.name))n.push(i)}else if(M(i)&&"path"in i){if(!n.find((s)=>M(s)&&("path"in s)&&s.path===i.path))n.push(i)}else if(!n.some((o)=>cr(o,i)))n.push(i);return n}if(t.every((n)=>typeof n==="string")&&e.every((n)=>typeof n==="string")){let n=[...t];for(let i of e)if(!n.includes(i))n.push(i);return n}return t}if(!M(t)||!M(e))return t;let r={...e};for(let n in t)if(Object.prototype.hasOwnProperty.call(t,n)){let i=t[n];if(i===null||i===void 0)continue;else if(M(i)&&M(r[n]))r[n]=Un(r[n],i);else if(Array.isArray(i)&&Array.isArray(r[n]))if(i.length>0&&r[n].length>0&&M(i[0])&&M(r[n][0])){let o=[...i];for(let s of r[n])if(M(s)&&"name"in s){if(!o.find((a)=>M(a)&&("name"in a)&&a.name===s.name))o.push(s)}else if(M(s)&&"path"in s){if(!o.find((a)=>M(a)&&("path"in a)&&a.path===s.path))o.push(s)}else if(!o.some((c)=>cr(c,s)))o.push(s);r[n]=o}else if(i.every((o)=>typeof o==="string")&&r[n].every((o)=>typeof o==="string")){let o=[...i];for(let s of r[n])if(!o.includes(s))o.push(s);r[n]=o}else r[n]=i;else r[n]=i}return r}function cr(e,t){if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(!cr(e[r],t[r]))return!1;return!0}if(M(e)&&M(t)){let r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(let i of r){if(!Object.prototype.hasOwnProperty.call(t,i))return!1;if(!cr(e[i],t[i]))return!1}return!0}return!1}function M(e){return Boolean(e&&typeof e==="object"&&!Array.isArray(e))}async function Of(e,t){if(!Jo(e))return null;try{let r=await import(e),n=r.default||r;if(typeof n!=="object"||n===null||Array.isArray(n))return null;try{return Un(t,n)}catch{return null}}catch{return null}}async function If({name:e="",cwd:t,defaultConfig:r}){let n=t||En.cwd(),i=[".ts",".js",".mjs",".cjs",".json"],o=[`${e}.config`,`.${e}.config`,e,`.${e}`];for(let s of o)for(let c of i){let a=ar(n,`${s}${c}`),l=await Of(a,r);if(l!==null)return l}try{let s=ar(n,"package.json");if(Jo(s)){let a=(await import(s))[e];if(a&&typeof a==="object"&&!Array.isArray(a))try{return Un(r,a)}catch{}}}catch{}return r}function Pf(e,t={}){let r=sr.cwd();while(r.includes("storage"))r=co(r,"..");let n=co(r,e||"");if(t?.relative)return Wu(sr.cwd(),n);return n}async function _f(){try{let e=await If({name:"clarity",defaultConfig:er,cwd:sr.cwd(),endpoint:"",headers:{}});return{...er,...e}}catch{return er}}function D(){if(Ce.env.NODE_ENV==="test"||Ce.env.BUN_ENV==="test")return!1;return typeof window<"u"}async function Lf(){if(Ce.env.NODE_ENV==="test"||Ce.env.BUN_ENV==="test")return!0;if(typeof navigator<"u"&&navigator.product==="ReactNative")return!0;if(typeof Ce<"u"){let e=Ce.type;if(e==="renderer"||e==="worker")return!1;return!!(Ce.versions&&(Ce.versions.node||Ce.versions.bun))}return!1}class Zo{async format(e){let t=await Lf(),r=await this.getMetadata(t);return JSON.stringify({timestamp:e.timestamp.toISOString(),level:e.level,name:e.name,message:e.message,metadata:r})}async getMetadata(e){if(e){let{hostname:t}=await import("os");return{pid:Ze.pid,hostname:t(),environment:Ze.env.NODE_ENV||"development",platform:Ze.platform,version:Ze.version}}return{userAgent:navigator.userAgent,hostname:window.location.hostname||"browser",environment:Ze.env.NODE_ENV||Ze.env.BUN_ENV||"development",viewport:{width:window.innerWidth,height:window.innerHeight},language:navigator.language}}}class ur{name;fileLocks=new Map;currentKeyId=null;keys=new Map;config;options;formatter;timers=new Set;subLoggers=new Set;fingersCrossedBuffer=[];fingersCrossedConfig;fingersCrossedActive=!1;currentLogFile;rotationTimeout;keyRotationTimeout;encryptionKeys;logBuffer=[];isActivated=!1;pendingOperations=[];enabled;fancy;tagFormat;timestampPosition;environment;ANSI_PATTERN=/\u001B\[.*?m/g;activeProgressBar=null;constructor(e,t={}){this.name=e,this.config={...Tn},this.options=this.normalizeOptions(t),this.formatter=this.options.formatter||new Zo,this.enabled=t.enabled??!0,this.fancy=t.fancy??!0,this.tagFormat=t.tagFormat??{prefix:"[",suffix:"]"},this.timestampPosition=t.timestampPosition??"right",this.environment=t.environment??G.env.APP_ENV??"local",this.fingersCrossedConfig=this.initializeFingersCrossedConfig(t);let r={...t},n=t.timestamp!==void 0;if(n)delete r.timestamp;if(this.config={...this.config,...r,timestamp:n||this.config.timestamp},this.currentLogFile=this.generateLogFilename(),this.encryptionKeys=new Map,this.validateEncryptionConfig()){this.setupRotation();let i=this.generateKeyId(),o=this.generateKey();this.currentKeyId=i,this.keys.set(i,o),this.encryptionKeys.set(i,{key:o,createdAt:new Date}),this.setupKeyRotation()}}initializeFingersCrossedConfig(e){if(!e.fingersCrossedEnabled&&e.fingersCrossed)return{...tr,...e.fingersCrossed};if(!e.fingersCrossedEnabled)return null;if(!e.fingersCrossed)return{...tr};return{...tr,...e.fingersCrossed}}normalizeOptions(e){let t={format:"json",level:"info",logDirectory:Tn.logDirectory,rotation:void 0,timestamp:void 0,fingersCrossed:{},enabled:!0,showTags:!1,formatter:void 0},r={...t,...Object.fromEntries(Object.entries(e).filter(([,n])=>n!==void 0))};if(!r.level||!["debug","info","success","warning","error"].includes(r.level))r.level=t.level;return r}async writeToFile(e){let r=(async()=>{let i,o=0,s=3,c=1000;while(o<s)try{try{try{await Yu(this.config.logDirectory,go.F_OK|go.W_OK)}catch(l){if(l instanceof Error&&"code"in l)if(l.code==="ENOENT")await Ju(this.config.logDirectory,{recursive:!0,mode:493});else if(l.code==="EACCES")throw Error(`No write permission for log directory: ${this.config.logDirectory}`);else throw l;else throw l}}catch(l){throw console.error("Debug: [writeToFile] Failed to create log directory:",l),l}let a=this.validateEncryptionConfig()?(await this.encrypt(e)).encrypted:Ie.from(e);try{if(!un(this.currentLogFile))await fn(this.currentLogFile,"",{mode:420});if(i=ho(this.currentLogFile,"a",420),qu(i,a,{flag:"a"}),fo(i),i!==void 0)cn(i),i=void 0;if((await Je(this.currentLogFile)).size===0){if(await fn(this.currentLogFile,a,{flag:"w",mode:420}),(await Je(this.currentLogFile)).size===0)throw Error("File exists but is empty after retry write")}return}catch(l){let u=l;if(u.code&&["ENETDOWN","ENETUNREACH","ENOTFOUND","ETIMEDOUT"].includes(u.code)){if(o<s-1){let f=typeof u.message==="string"?u.message:"Unknown error";console.error(`Network error during write attempt ${o+1}/${s}:`,f);let d=c*2**o;await new Promise((h)=>setTimeout(h,d)),o++;continue}}if(u?.code&&["ENOSPC","EDQUOT"].includes(u.code))throw Error(`Disk quota exceeded or no space left on device: ${u.message}`);throw console.error("Debug: [writeToFile] Error writing to file:",u),u}finally{if(i!==void 0)try{cn(i)}catch(l){console.error("Debug: [writeToFile] Error closing file descriptor:",l)}}}catch(a){if(o===s-1){let u=a,f=typeof u.message==="string"?u.message:"Unknown error";throw console.error("Debug: [writeToFile] Max retries reached. Final error:",f),a}o++;let l=c*2**(o-1);await new Promise((u)=>setTimeout(u,l))}})();this.pendingOperations.push(r);let n=this.pendingOperations.length-1;try{await r}catch(i){throw console.error("Debug: [writeToFile] Error in operation:",i),i}finally{this.pendingOperations.splice(n,1)}}generateLogFilename(){if(this.name.includes("stream-throughput")||this.name.includes("decompress-perf-test")||this.name.includes("decompression-latency")||this.name.includes("concurrent-read-test")||this.name.includes("clock-change-test"))return Xe(this.config.logDirectory,`${this.name}.log`);if(this.name.includes("pending-test")||this.name.includes("temp-file-test")||this.name==="crash-test"||this.name==="corrupt-test"||this.name.includes("rotation-load-test")||this.name==="sigterm-test"||this.name==="sigint-test"||this.name==="failed-rotation-test"||this.name==="integration-test")return Xe(this.config.logDirectory,`${this.name}.log`);let e=new Date().toISOString().split("T")[0];return Xe(this.config.logDirectory,`${this.name}-${e}.log`)}setupRotation(){if(D())return;if(typeof this.config.rotation==="boolean")return;let e=this.config.rotation,t;switch(e.frequency){case"daily":t=86400000;break;case"weekly":t=604800000;break;case"monthly":t=2592000000;break;default:return}this.rotationTimeout=setInterval(()=>{this.rotateLog()},t)}setupKeyRotation(){if(!this.validateEncryptionConfig()){console.error("Invalid encryption configuration detected during key rotation setup");return}let t=this.config.rotation.keyRotation;if(!t?.enabled)return;let r=typeof t.interval==="number"?t.interval:60,n=Math.max(r,60)*1000;this.keyRotationTimeout=setInterval(()=>{this.rotateKeys().catch((i)=>{console.error("Error rotating keys:",i)})},n)}async rotateKeys(){if(!this.validateEncryptionConfig()){console.error("Invalid encryption configuration detected during key rotation");return}let t=this.config.rotation.keyRotation,r=this.generateKeyId(),n=this.generateKey();this.currentKeyId=r,this.keys.set(r,n),this.encryptionKeys.set(r,{key:n,createdAt:new Date});let i=Array.from(this.encryptionKeys.entries()).sort(([,c],[,a])=>a.createdAt.getTime()-c.createdAt.getTime()),o=typeof t.maxKeys==="number"?t.maxKeys:1,s=Math.max(1,o);if(i.length>s)for(let[c]of i.slice(s))this.encryptionKeys.delete(c),this.keys.delete(c)}generateKeyId(){return ln(16).toString("hex")}generateKey(){return ln(32)}getCurrentKey(){if(!this.currentKeyId)throw Error("Encryption is not properly initialized. Make sure encryption is enabled in the configuration.");let e=this.keys.get(this.currentKeyId);if(!e)throw Error(`No key found for ID ${this.currentKeyId}. The encryption key may have been rotated or removed.`);return{key:e,id:this.currentKeyId}}encrypt(e){let{key:t}=this.getCurrentKey(),r=ln(16),n=Ku("aes-256-gcm",t,r),i=Ie.concat([n.update(e,"utf8"),n.final()]),o=n.getAuthTag();return{encrypted:Ie.concat([r,i,o]),iv:r}}async compressData(e){return new Promise((t,r)=>{let n=po(),i=[];n.on("data",(o)=>i.push(o)),n.on("end",()=>t(Ie.from(Ie.concat(i)))),n.on("error",r),n.write(e),n.end()})}getEncryptionOptions(){if(!this.config.rotation||typeof this.config.rotation==="boolean"||!this.config.rotation.encrypt)return{};let e={algorithm:"aes-256-cbc",compress:!1};if(typeof this.config.rotation.encrypt==="object"){let t=this.config.rotation.encrypt;return{...e,...t}}return e}async rotateLog(){if(D())return;let e=await Je(this.currentLogFile).catch(()=>null);if(!e)return;let t=this.config.rotation;if(typeof t==="boolean")return;if(t.maxSize&&e.size>=t.maxSize){let r=this.currentLogFile,n=this.generateLogFilename();if(this.name.includes("rotation-load-test")||this.name==="failed-rotation-test"){let i=await Bt(this.config.logDirectory),o=i.filter((a)=>a.startsWith(this.name)&&/\.log\.\d+$/.test(a)).sort((a,l)=>{let u=Number.parseInt(a.match(/\.log\.(\d+)$/)?.[1]||"0");return Number.parseInt(l.match(/\.log\.(\d+)$/)?.[1]||"0")-u}),s=o.length>0?Number.parseInt(o[0].match(/\.log\.(\d+)$/)?.[1]||"0")+1:1,c=`${r}.${s}`;if(await Je(r).catch(()=>null))try{if(await mo(r,c),t.compress)try{let a=`${c}.gz`;await this.compressLogFile(c,a),await Ut(c)}catch(a){console.error("Error compressing rotated file:",a)}if(o.length===0&&!i.some((a)=>a.endsWith(".log.1")))try{let a=`${r}.1`;await fn(a,"")}catch(a){console.error("Error creating backup file:",a)}}catch(a){console.error(`Error during rotation: ${a instanceof Error?a.message:String(a)}`)}}else{let i=new Date().toISOString().replace(/[:.]/g,"-"),o=r.replace(/\.log$/,`-${i}.log`);if(await Je(r).catch(()=>null))await mo(r,o)}if(this.currentLogFile=n,t.maxFiles){let o=(await Bt(this.config.logDirectory)).filter((s)=>s.startsWith(this.name)).sort((s,c)=>c.localeCompare(s));for(let s of o.slice(t.maxFiles))await Ut(Xe(this.config.logDirectory,s))}}}async compressLogFile(e,t){let r=uo(e),n=Hu(t),i=po();await Xu(r,i,n)}async handleFingersCrossedBuffer(e,t){if(!this.fingersCrossedConfig)return;if(this.shouldActivateFingersCrossed(e)&&!this.isActivated){this.isActivated=!0;for(let r of this.logBuffer){let n=await this.formatter.format(r);await this.writeToFile(n),console.log(n)}if(this.fingersCrossedConfig.stopBuffering)this.logBuffer=[]}if(this.isActivated)await this.writeToFile(t),console.log(t);else{if(this.logBuffer.length>=this.fingersCrossedConfig.bufferSize)this.logBuffer.shift();let r={timestamp:new Date,level:e,message:t,name:this.name};this.logBuffer.push(r)}}shouldActivateFingersCrossed(e){if(!this.fingersCrossedConfig)return!1;return this.getLevelValue(e)>=this.getLevelValue(this.fingersCrossedConfig.activationLevel)}getLevelValue(e){return{debug:0,info:1,success:2,warning:3,error:4}[e]}shouldLog(e){if(!this.enabled)return!1;let t={debug:0,info:1,success:2,warning:3,error:4};return t[e]>=t[this.config.level]}async flushPendingWrites(){if(await Promise.all(this.pendingOperations.map((e)=>{if(e instanceof Promise)return e.catch((t)=>{console.error("Error in pending write operation:",t)});return Promise.resolve()})),un(this.currentLogFile))try{let e=ho(this.currentLogFile,"r+");fo(e),cn(e)}catch(e){console.error(`Error flushing file: ${e}`)}}async destroy(){if(this.rotationTimeout)clearInterval(this.rotationTimeout);if(this.keyRotationTimeout)clearInterval(this.keyRotationTimeout);this.timers.clear();for(let e of this.pendingOperations)if(typeof e.cancel==="function")e.cancel();return(async()=>{if(this.pendingOperations.length>0)try{await Promise.allSettled(this.pendingOperations)}catch(e){console.error("Error waiting for pending operations:",e)}if(!D()&&this.config.rotation&&typeof this.config.rotation!=="boolean"&&this.config.rotation.compress)try{let t=(await Bt(this.config.logDirectory)).filter((r)=>(r.includes("temp")||r.includes(".tmp"))&&r.includes(this.name));for(let r of t)try{await Ut(Xe(this.config.logDirectory,r))}catch(n){console.error(`Failed to delete temp file ${r}:`,n)}}catch(e){console.error("Error cleaning up temporary files:",e)}})()}getCurrentLogFilePath(){return this.currentLogFile}formatTag(e){if(!e)return"";return`${this.tagFormat.prefix}${e}${this.tagFormat.suffix}`}formatFileTimestamp(e){return`[${e.toISOString()}]`}formatConsoleTimestamp(e){return this.fancy?P.gray(e.toLocaleTimeString()):e.toLocaleTimeString()}formatConsoleMessage(e){let{timestamp:t,icon:r="",tag:n="",message:i,level:o,showTimestamp:s=!0}=e,c=(h)=>h.replace(this.ANSI_PATTERN,"");if(!this.fancy){let h=[];if(s)h.push(t);if(o==="warning")h.push("WARN");else if(o==="error")h.push("ERROR");else if(r)h.push(r.replace(/[^\p{L}\p{N}\p{P}\p{Z}]/gu,""));if(n)h.push(n.replace(/[[\]]/g,""));return h.push(i),h.join(" ")}let a=G.stdout.columns||120,l="";if(o==="warning"||o==="error")l=`${r} ${i}`;else if(o==="info"||o==="success")l=`${r} ${n} ${i}`;else l=`${r} ${n} ${P.cyan(i)}`;if(!s)return l.trim();let u=c(l).trim().length,f=c(t).length,d=Math.max(1,a-2-u-f);return`${l.trim()}${" ".repeat(d)}${t}`}formatMessage(e,t){if(t.length===1&&Array.isArray(t[0]))return e.replace(/\{(\d+)\}/g,(o,s)=>{let c=Number.parseInt(s,10);return c<t[0].length?String(t[0][c]):o});let r=/%([sdijfo%])/g,n=0,i=e.replace(r,(o,s)=>{if(s==="%")return"%";if(n>=t.length)return o;let c=t[n++];switch(s){case"s":return String(c);case"d":case"i":return Number(c).toString();case"j":case"o":return JSON.stringify(c,null,2);default:return o}});if(n<t.length)i+=` ${t.slice(n).map((o)=>typeof o==="object"?JSON.stringify(o,null,2):String(o)).join(" ")}`;return i}async log(e,t,...r){let n=new Date,i=this.formatConsoleTimestamp(n),o=this.formatFileTimestamp(n),s,c;if(t instanceof Error)s=t.message,c=t.stack;else s=this.formatMessage(t,r);if(this.fancy&&!D()){let l=ls[e],u=this.options.showTags!==!1&&this.name?P.gray(this.formatTag(this.name)):"",f;switch(e){case"debug":f=this.formatConsoleMessage({timestamp:i,icon:l,tag:u,message:P.gray(s),level:e}),console.error(f);break;case"info":f=this.formatConsoleMessage({timestamp:i,icon:l,tag:u,message:s,level:e}),console.error(f);break;case"success":f=this.formatConsoleMessage({timestamp:i,icon:l,tag:u,message:P.green(s),level:e}),console.error(f);break;case"warning":f=this.formatConsoleMessage({timestamp:i,icon:l,tag:u,message:s,level:e}),console.warn(f);break;case"error":if(f=this.formatConsoleMessage({timestamp:i,icon:l,tag:u,message:s,level:e}),console.error(f),c){let d=c.split(`
|
|
34
34
|
`);for(let h of d)if(h.trim()&&!h.includes(s))console.error(this.formatConsoleMessage({timestamp:i,message:P.gray(` ${h}`),level:e,showTimestamp:!1}))}break}}else if(!D()){if(console.error(`${o} ${this.environment}.${e.toUpperCase()}: ${s}`),c)console.error(c)}if(!this.shouldLog(e))return;let a=`${o} ${this.environment}.${e.toUpperCase()}: ${s}
|
|
35
35
|
`;if(c)a+=`${c}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stacksjs/ts-css",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.3.
|
|
4
|
+
"version": "0.3.5",
|
|
5
5
|
"description": "Pure-TypeScript CSS toolkit and utility-first CSS engine for Bun/Node — parser, walker, generator, selector engine, minifier, and a Tailwind-compatible utility engine. Zero runtime deps.",
|
|
6
6
|
"author": "Chris Breuer <chris@stacksjs.org>",
|
|
7
7
|
"license": "MIT",
|