@stacksjs/ts-css 0.3.21 → 0.3.23
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 +40 -40
- package/dist/{chunk-k6ta54hd.js → chunk-aj9hxvcm.js} +2 -2
- package/dist/{chunk-zn8gy7w7.js → chunk-pmshwcfp.js} +1 -1
- package/dist/engine/index.js +21 -21
- package/dist/index.js +1 -1
- package/dist/optimize/index.js +1 -1
- package/dist/select/index.js +1 -1
- package/package.json +1 -1
package/dist/bin/cssx.js
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
2
|
// @bun
|
|
3
|
-
var yc=(e,t,r)=>()=>{if(e)try{t=e(e=0)}catch(n){r=[n]}if(r)throw r[0];return t};import{existsSync as So,statSync as Ao}from"fs";import{resolve as At}from"path";import vf from"process";import{existsSync as $f,mkdirSync as mw,readdirSync as pw,readFileSync as Rf,writeFileSync as yw}from"fs";import{homedir as et}from"os";import{dirname as vw,resolve as ve}from"path";import Er from"process";import{existsSync as Eo,statSync as To}from"fs";import{existsSync as Bn,mkdirSync as kf,readdirSync as Sf,writeFileSync as Af}from"fs";import{homedir as tt}from"os";import{dirname as No,resolve as ne}from"path";import Ge from"process";import{join as Ef,relative as Tf,resolve as Oo}from"path";import mr from"process";import{existsSync as ys,mkdirSync as Nw,readdirSync as Ow,writeFileSync as Iw}from"fs";import{homedir as wn}from"os";import{dirname as Lw,resolve as re}from"path";import Tt from"process";import{join as Nf,relative as Of,resolve as Io}from"path";import pr from"process";import{existsSync as bs,mkdirSync as Bw,readdirSync as Vw,writeFileSync as Uw}from"fs";import{dirname as zw,resolve as yr}from"path";import Vn from"process";import{Buffer as Me}from"buffer";import{createCipheriv as If,createDecipheriv as Pf,randomBytes as Cn}from"crypto";import{closeSync as $n,createReadStream as Po,createWriteStream as _f,existsSync as Rn,fsyncSync as _o,openSync as Lo,writeFileSync as Lf}from"fs";import{access as Mf,constants as Mo,mkdir as Ff,readdir as Jt,rename as Fo,stat as rt,unlink as Xt,writeFile as kn}from"fs/promises";import{join as nt}from"path";import J from"process";import{pipeline as Df}from"stream/promises";import{createGzip as Do}from"zlib";import it from"process";import Ae from"process";import{Buffer as ke}from"buffer";import{createCipheriv as jf,createDecipheriv as Bf,randomBytes as Sn}from"crypto";import{closeSync as An,createReadStream as jo,createWriteStream as Vf,existsSync as Zt,fsyncSync as Bo,openSync as Vo,writeFileSync as Uf}from"fs";import{access as Wf,constants as Uo,mkdir as zf,readdir as Qt,rename as Wo,stat as ot,unlink as er,writeFile as En}from"fs/promises";import{isAbsolute as Kf,join as st,resolve as Hf}from"path";import N from"process";import{pipeline as Gf}from"stream/promises";import{createGzip as zo}from"zlib";import at from"process";import Ee from"process";import tr from"process";import{existsSync as rr}from"fs";import{resolve as Tn}from"path";import{existsSync as qf}from"fs";import{existsSync as Yf,readdirSync as Jf}from"fs";import{extname as Nn,resolve as Ko}from"path";import Xf from"process";import{join as Zf,relative as Qf,resolve as Ho}from"path";import br from"process";import{Buffer as Se}from"buffer";import{createCipheriv as ed,createDecipheriv as td,randomBytes as On}from"crypto";import{closeSync as In,createReadStream as Go,createWriteStream as rd,existsSync as nr,fsyncSync as qo,openSync as Yo,writeFileSync as nd}from"fs";import{access as id,constants as Jo,mkdir as od,readdir as ir,rename as Xo,stat as lt,unlink as or,writeFile as Pn}from"fs/promises";import{isAbsolute as sd,join as ct,resolve as ad}from"path";import O from"process";import{pipeline as ld}from"stream/promises";import{createGzip as Zo}from"zlib";import ut from"process";import Te from"process";import ar from"process";import{existsSync as lr}from"fs";import{resolve as ds}from"path";import{existsSync as Eh}from"fs";class hs{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(!So(e))return!0;return Ao(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=So(r)?Ao(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 gs{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 ps(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 wf(e){return ps(e).flatMap((r)=>ms.map((n)=>At(e.directory,`${r}${n}`)))}function Cf(e={}){let t=At(e.cwd||vf.cwd());return Array.from(new Set([t,At(t,"config"),At(t,".config"),e.configDir?At(t,e.configDir):void 0].filter((r)=>Boolean(r))))}function fd(e,t){this[e]=ud.bind(null,t)}class Qn{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(!Eo(e))return!0;return To(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=Eo(r)?To(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 ei{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 gd(e,t={}){let n=Object.keys(t).sort().map((i)=>`${i}:${t[i]}`).join("|");return n?`${e}:${n}`:e}function md(e,t){try{return JSON.stringify(e)===JSON.stringify(t)}catch{return e===t}}function pd(e){return e.getStats().size*2}function ti(e,t){if(Array.isArray(t)&&Array.isArray(e)&&t.length===2&&e.length===2&&L(t[0])&&"id"in t[0]&&t[0].id===3&&L(t[1])&&"id"in t[1]&&t[1].id===4)return t;if(L(t)&&L(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(L(e)&&"arr"in e&&Array.isArray(e.arr)&&L(t)&&"arr"in t&&Array.isArray(t.arr))return t;if(t.length>0&&e.length>0&&L(t[0])&&L(e[0])){let n=[...t];for(let i of e)if(L(i)&&"name"in i){if(!n.find((s)=>L(s)&&("name"in s)&&s.name===i.name))n.push(i)}else if(L(i)&&"path"in i){if(!n.find((s)=>L(s)&&("path"in s)&&s.path===i.path))n.push(i)}else if(!n.some((o)=>xr(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(!L(t)||!L(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(L(i)&&L(r[n]))r[n]=ti(r[n],i);else if(Array.isArray(i)&&Array.isArray(r[n]))if(i.length>0&&r[n].length>0&&L(i[0])&&L(r[n][0])){let o=[...i];for(let s of r[n])if(L(s)&&"name"in s){if(!o.find((a)=>L(a)&&("name"in a)&&a.name===s.name))o.push(s)}else if(L(s)&&"path"in s){if(!o.find((a)=>L(a)&&("path"in a)&&a.path===s.path))o.push(s)}else if(!o.some((c)=>xr(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 xr(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(!xr(e[r],t[r]))return!1;return!0}if(L(e)&&L(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(!xr(e[i],t[i]))return!1}return!0}return!1}function L(e){return Boolean(e&&typeof e==="object"&&!Array.isArray(e))}async function yd(e,t){if(!bs(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 ti(t,n)}catch{return null}}catch{return null}}async function bd({name:e="",cwd:t,defaultConfig:r}){let n=t||Vn.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=yr(n,`${s}${c}`),l=await yd(a,r);if(l!==null)return l}try{let s=yr(n,"package.json");if(bs(s)){let a=(await import(s))[e];if(a&&typeof a==="object"&&!Array.isArray(a))try{return ti(r,a)}catch{}}}catch{}return r}function xd(e,t={}){let r=pr.cwd();while(r.includes("storage"))r=Io(r,"..");let n=Io(r,e||"");if(t?.relative)return Of(pr.cwd(),n);return n}async function vd(){try{let e=await bd({name:"clarity",defaultConfig:ur,cwd:pr.cwd(),endpoint:"",headers:{}});return{...ur,...e}}catch{return ur}}function D(){if(Ae.env.NODE_ENV==="test"||Ae.env.BUN_ENV==="test")return!1;return typeof window<"u"}async function wd(){if(Ae.env.NODE_ENV==="test"||Ae.env.BUN_ENV==="test")return!0;if(typeof navigator<"u"&&navigator.product==="ReactNative")return!0;if(typeof Ae<"u"){let e=Ae.type;if(e==="renderer"||e==="worker")return!1;return!!(Ae.versions&&(Ae.versions.node||Ae.versions.bun))}return!1}class vs{async format(e){let t=await wd(),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:it.pid,hostname:t(),environment:it.env.NODE_ENV||"development",platform:it.platform,version:it.version}}return{userAgent:navigator.userAgent,hostname:window.location.hostname||"browser",environment:it.env.NODE_ENV||it.env.BUN_ENV||"development",viewport:{width:window.innerWidth,height:window.innerHeight},language:navigator.language}}}class vr{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={...Wn},this.options=this.normalizeOptions(t),this.formatter=this.options.formatter||new vs,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??J.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{...fr,...e.fingersCrossed};if(!e.fingersCrossedEnabled)return null;if(!e.fingersCrossed)return{...fr};return{...fr,...e.fingersCrossed}}normalizeOptions(e){let t={format:"json",level:"info",logDirectory:Wn.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 Mf(this.config.logDirectory,Mo.F_OK|Mo.W_OK)}catch(l){if(l instanceof Error&&"code"in l)if(l.code==="ENOENT")await Ff(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:Me.from(e);try{if(!Rn(this.currentLogFile))await kn(this.currentLogFile,"",{mode:420});if(i=Lo(this.currentLogFile,"a",420),Lf(i,a,{flag:"a"}),_o(i),i!==void 0)$n(i),i=void 0;if((await rt(this.currentLogFile)).size===0){if(await kn(this.currentLogFile,a,{flag:"w",mode:420}),(await rt(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{$n(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 nt(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 nt(this.config.logDirectory,`${this.name}.log`);let e=new Date().toISOString().split("T")[0];return nt(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 Cn(16).toString("hex")}generateKey(){return Cn(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=Cn(16),n=If("aes-256-gcm",t,r),i=Me.concat([n.update(e,"utf8"),n.final()]),o=n.getAuthTag();return{encrypted:Me.concat([r,i,o]),iv:r}}async compressData(e){return new Promise((t,r)=>{let n=Do(),i=[];n.on("data",(o)=>i.push(o)),n.on("end",()=>t(Me.from(Me.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 rt(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 Jt(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 rt(r).catch(()=>null))try{if(await Fo(r,c),t.compress)try{let a=`${c}.gz`;await this.compressLogFile(c,a),await Xt(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 kn(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 rt(r).catch(()=>null))await Fo(r,o)}if(this.currentLogFile=n,t.maxFiles){let o=(await Jt(this.config.logDirectory)).filter((s)=>s.startsWith(this.name)).sort((s,c)=>c.localeCompare(s));for(let s of o.slice(t.maxFiles))await Xt(nt(this.config.logDirectory,s))}}}async compressLogFile(e,t){let r=Po(e),n=_f(t),i=Do();await Df(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()})),Rn(this.currentLogFile))try{let e=Lo(this.currentLogFile,"r+");_o(e),$n(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 Jt(this.config.logDirectory)).filter((r)=>(r.includes("temp")||r.includes(".tmp"))&&r.includes(this.name));for(let r of t)try{await Xt(nt(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=J.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=Ns[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(`
|
|
3
|
+
var vc=(e,t,r)=>()=>{if(e)try{t=e(e=0)}catch(n){r=[n]}if(r)throw r[0];return t};import{existsSync as To,statSync as No}from"fs";import{resolve as Et}from"path";import Cf from"process";import{existsSync as Sf,mkdirSync as ww,readdirSync as $w,readFileSync as Af,writeFileSync as Cw}from"fs";import{homedir as tt}from"os";import{dirname as Sw,resolve as ve}from"path";import Nr from"process";import{existsSync as Oo,statSync as Io}from"fs";import{existsSync as Wn,mkdirSync as Ef,readdirSync as Tf,writeFileSync as Nf}from"fs";import{homedir as rt}from"os";import{dirname as Po,resolve as ne}from"path";import Ge from"process";import{join as Of,relative as If,resolve as _o}from"path";import yr from"process";import{existsSync as vs,mkdirSync as Mw,readdirSync as Fw,writeFileSync as Dw}from"fs";import{homedir as Rn}from"os";import{dirname as Uw,resolve as re}from"path";import Nt from"process";import{join as Pf,relative as _f,resolve as Lo}from"path";import br from"process";import{existsSync as ws,mkdirSync as Hw,readdirSync as Gw,writeFileSync as qw}from"fs";import{dirname as Jw,resolve as xr}from"path";import zn from"process";import{Buffer as Me}from"buffer";import{createCipheriv as Lf,createDecipheriv as Mf,randomBytes as kn}from"crypto";import{closeSync as Sn,createReadStream as Mo,createWriteStream as Ff,existsSync as An,fsyncSync as Fo,openSync as Do,writeFileSync as Df}from"fs";import{access as jf,constants as jo,mkdir as Bf,readdir as Zt,rename as Bo,stat as nt,unlink as Qt,writeFile as En}from"fs/promises";import{join as it}from"path";import J from"process";import{pipeline as Uf}from"stream/promises";import{createGzip as Uo}from"zlib";import ot from"process";import Ae from"process";import{Buffer as ke}from"buffer";import{createCipheriv as Vf,createDecipheriv as Wf,randomBytes as Tn}from"crypto";import{closeSync as Nn,createReadStream as Vo,createWriteStream as zf,existsSync as er,fsyncSync as Wo,openSync as zo,writeFileSync as Kf}from"fs";import{access as Hf,constants as Ko,mkdir as Gf,readdir as tr,rename as Ho,stat as st,unlink as rr,writeFile as On}from"fs/promises";import{isAbsolute as qf,join as at,resolve as Yf}from"path";import N from"process";import{pipeline as Jf}from"stream/promises";import{createGzip as Go}from"zlib";import lt from"process";import Ee from"process";import nr from"process";import{existsSync as ir}from"fs";import{resolve as In}from"path";import{existsSync as Xf}from"fs";import{existsSync as Zf,readdirSync as Qf}from"fs";import{extname as Pn,resolve as qo}from"path";import ed from"process";import{join as td,relative as rd,resolve as Yo}from"path";import vr from"process";import{Buffer as Se}from"buffer";import{createCipheriv as nd,createDecipheriv as id,randomBytes as _n}from"crypto";import{closeSync as Ln,createReadStream as Jo,createWriteStream as od,existsSync as or,fsyncSync as Xo,openSync as Zo,writeFileSync as sd}from"fs";import{access as ad,constants as Qo,mkdir as ld,readdir as sr,rename as es,stat as ct,unlink as ar,writeFile as Mn}from"fs/promises";import{isAbsolute as cd,join as ut,resolve as ud}from"path";import O from"process";import{pipeline as fd}from"stream/promises";import{createGzip as ts}from"zlib";import ft from"process";import Te from"process";import cr from"process";import{existsSync as ur}from"fs";import{resolve as ms}from"path";import{existsSync as Oh}from"fs";class ps{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(!To(e))return!0;return No(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=To(r)?No(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 ys{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 xs(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 Rf(e){return xs(e).flatMap((r)=>bs.map((n)=>Et(e.directory,`${r}${n}`)))}function kf(e={}){let t=Et(e.cwd||Cf.cwd());return Array.from(new Set([t,Et(t,"config"),Et(t,".config"),e.configDir?Et(t,e.configDir):void 0].filter((r)=>Boolean(r))))}function gd(e,t){this[e]=hd.bind(null,t)}class ri{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 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=Oo(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 ni{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 yd(e,t={}){let n=Object.keys(t).sort().map((i)=>`${i}:${t[i]}`).join("|");return n?`${e}:${n}`:e}function bd(e,t){try{return JSON.stringify(e)===JSON.stringify(t)}catch{return e===t}}function xd(e){return e.getStats().size*2}function ii(e,t){if(Array.isArray(t)&&Array.isArray(e)&&t.length===2&&e.length===2&&L(t[0])&&"id"in t[0]&&t[0].id===3&&L(t[1])&&"id"in t[1]&&t[1].id===4)return t;if(L(t)&&L(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(L(e)&&"arr"in e&&Array.isArray(e.arr)&&L(t)&&"arr"in t&&Array.isArray(t.arr))return t;if(t.length>0&&e.length>0&&L(t[0])&&L(e[0])){let n=[...t];for(let i of e)if(L(i)&&"name"in i){if(!n.find((s)=>L(s)&&("name"in s)&&s.name===i.name))n.push(i)}else if(L(i)&&"path"in i){if(!n.find((s)=>L(s)&&("path"in s)&&s.path===i.path))n.push(i)}else if(!n.some((o)=>wr(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(!L(t)||!L(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(L(i)&&L(r[n]))r[n]=ii(r[n],i);else if(Array.isArray(i)&&Array.isArray(r[n]))if(i.length>0&&r[n].length>0&&L(i[0])&&L(r[n][0])){let o=[...i];for(let s of r[n])if(L(s)&&"name"in s){if(!o.find((a)=>L(a)&&("name"in a)&&a.name===s.name))o.push(s)}else if(L(s)&&"path"in s){if(!o.find((a)=>L(a)&&("path"in a)&&a.path===s.path))o.push(s)}else if(!o.some((c)=>wr(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 wr(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(!wr(e[r],t[r]))return!1;return!0}if(L(e)&&L(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(!wr(e[i],t[i]))return!1}return!0}return!1}function L(e){return Boolean(e&&typeof e==="object"&&!Array.isArray(e))}async function vd(e,t){if(!ws(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 ii(t,n)}catch{return null}}catch{return null}}async function wd({name:e="",cwd:t,defaultConfig:r}){let n=t||zn.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=xr(n,`${s}${c}`),l=await vd(a,r);if(l!==null)return l}try{let s=xr(n,"package.json");if(ws(s)){let a=(await import(s))[e];if(a&&typeof a==="object"&&!Array.isArray(a))try{return ii(r,a)}catch{}}}catch{}return r}function $d(e,t={}){let r=br.cwd();while(r.includes("storage"))r=Lo(r,"..");let n=Lo(r,e||"");if(t?.relative)return _f(br.cwd(),n);return n}async function Cd(){try{let e=await wd({name:"clarity",defaultConfig:dr,cwd:br.cwd(),endpoint:"",headers:{}});return{...dr,...e}}catch{return dr}}function D(){if(Ae.env.NODE_ENV==="test"||Ae.env.BUN_ENV==="test")return!1;return typeof window<"u"}async function Rd(){if(Ae.env.NODE_ENV==="test"||Ae.env.BUN_ENV==="test")return!0;if(typeof navigator<"u"&&navigator.product==="ReactNative")return!0;if(typeof Ae<"u"){let e=Ae.type;if(e==="renderer"||e==="worker")return!1;return!!(Ae.versions&&(Ae.versions.node||Ae.versions.bun))}return!1}class Cs{async format(e){let t=await Rd(),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:ot.pid,hostname:t(),environment:ot.env.NODE_ENV||"development",platform:ot.platform,version:ot.version}}return{userAgent:navigator.userAgent,hostname:window.location.hostname||"browser",environment:ot.env.NODE_ENV||ot.env.BUN_ENV||"development",viewport:{width:window.innerWidth,height:window.innerHeight},language:navigator.language}}}class $r{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={...Hn},this.options=this.normalizeOptions(t),this.formatter=this.options.formatter||new Cs,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??J.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{...hr,...e.fingersCrossed};if(!e.fingersCrossedEnabled)return null;if(!e.fingersCrossed)return{...hr};return{...hr,...e.fingersCrossed}}normalizeOptions(e){let t={format:"json",level:"info",logDirectory:Hn.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 jf(this.config.logDirectory,jo.F_OK|jo.W_OK)}catch(l){if(l instanceof Error&&"code"in l)if(l.code==="ENOENT")await Bf(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:Me.from(e);try{if(!An(this.currentLogFile))await En(this.currentLogFile,"",{mode:420});if(i=Do(this.currentLogFile,"a",420),Df(i,a,{flag:"a"}),Fo(i),i!==void 0)Sn(i),i=void 0;if((await nt(this.currentLogFile)).size===0){if(await En(this.currentLogFile,a,{flag:"w",mode:420}),(await nt(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{Sn(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 it(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 it(this.config.logDirectory,`${this.name}.log`);let e=new Date().toISOString().split("T")[0];return it(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 kn(16).toString("hex")}generateKey(){return kn(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=kn(16),n=Lf("aes-256-gcm",t,r),i=Me.concat([n.update(e,"utf8"),n.final()]),o=n.getAuthTag();return{encrypted:Me.concat([r,i,o]),iv:r}}async compressData(e){return new Promise((t,r)=>{let n=Uo(),i=[];n.on("data",(o)=>i.push(o)),n.on("end",()=>t(Me.from(Me.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 nt(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 Zt(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 nt(r).catch(()=>null))try{if(await Bo(r,c),t.compress)try{let a=`${c}.gz`;await this.compressLogFile(c,a),await Qt(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 En(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 nt(r).catch(()=>null))await Bo(r,o)}if(this.currentLogFile=n,t.maxFiles){let o=(await Zt(this.config.logDirectory)).filter((s)=>s.startsWith(this.name)).sort((s,c)=>c.localeCompare(s));for(let s of o.slice(t.maxFiles))await Qt(it(this.config.logDirectory,s))}}}async compressLogFile(e,t){let r=Mo(e),n=Ff(t),i=Uo();await Uf(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()})),An(this.currentLogFile))try{let e=Do(this.currentLogFile,"r+");Fo(e),Sn(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 Zt(this.config.logDirectory)).filter((r)=>(r.includes("temp")||r.includes(".tmp"))&&r.includes(this.name));for(let r of t)try{await Qt(it(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=J.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=Ps[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(`
|
|
4
4
|
`);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}
|
|
5
5
|
`;if(c)a+=`${c}
|
|
6
6
|
`;a=a.replace(this.ANSI_PATTERN,""),await this.writeToFile(a)}time(e){let t=performance.now();if(this.fancy&&!D()){let r=this.options.showTags!==!1&&this.name?P.gray(this.formatTag(this.name)):"",n=this.formatConsoleTimestamp(new Date);console.error(this.formatConsoleMessage({timestamp:n,icon:P.blue("\u25D0"),tag:r,message:`${P.cyan(e)}...`}))}return async(r)=>{if(!this.enabled)return;let n=performance.now(),i=Math.round(n-t),o=`${e} completed in ${i}ms`,s=new Date,c=this.formatConsoleTimestamp(s),l=`${this.formatFileTimestamp(s)} ${this.environment}.INFO: ${o}`;if(r)l+=` ${JSON.stringify(r)}`;if(l+=`
|
|
7
|
-
`,l=l.replace(this.ANSI_PATTERN,""),this.fancy&&!D()){let u=this.options.showTags!==!1&&this.name?P.gray(this.formatTag(this.name)):"";console.error(this.formatConsoleMessage({timestamp:c,icon:P.green("\u2713"),tag:u,message:`${o}${r?` ${JSON.stringify(r)}`:""}`}))}else if(!D())console.error(l.trim());await this.writeToFile(l)}}async debug(e,...t){await this.log("debug",e,...t)}async info(e,...t){await this.log("info",e,...t)}async success(e,...t){await this.log("success",e,...t)}async warn(e,...t){await this.log("warning",e,...t)}async error(e,...t){await this.log("error",e,...t)}validateEncryptionConfig(){if(!this.config.rotation)return!1;if(typeof this.config.rotation==="boolean")return!1;let e=this.config.rotation,{encrypt:t}=e;return!!t}async only(e){if(!this.enabled)return;return await e()}isEnabled(){return this.enabled}setEnabled(e){this.enabled=e}extend(e){let t=`${this.name}:${e}`,r=new
|
|
7
|
+
`,l=l.replace(this.ANSI_PATTERN,""),this.fancy&&!D()){let u=this.options.showTags!==!1&&this.name?P.gray(this.formatTag(this.name)):"";console.error(this.formatConsoleMessage({timestamp:c,icon:P.green("\u2713"),tag:u,message:`${o}${r?` ${JSON.stringify(r)}`:""}`}))}else if(!D())console.error(l.trim());await this.writeToFile(l)}}async debug(e,...t){await this.log("debug",e,...t)}async info(e,...t){await this.log("info",e,...t)}async success(e,...t){await this.log("success",e,...t)}async warn(e,...t){await this.log("warning",e,...t)}async error(e,...t){await this.log("error",e,...t)}validateEncryptionConfig(){if(!this.config.rotation)return!1;if(typeof this.config.rotation==="boolean")return!1;let e=this.config.rotation,{encrypt:t}=e;return!!t}async only(e){if(!this.enabled)return;return await e()}isEnabled(){return this.enabled}setEnabled(e){this.enabled=e}extend(e){let t=`${this.name}:${e}`,r=new $r(t,{...this.options,logDirectory:this.config.logDirectory,level:this.config.level,format:this.config.format,rotation:typeof this.config.rotation==="boolean"?void 0:this.config.rotation,timestamp:typeof this.config.timestamp==="boolean"?void 0:this.config.timestamp});return this.subLoggers.add(r),r}createReadStream(){if(D())throw Error("createReadStream is not supported in browser environments");if(!An(this.currentLogFile))throw Error(`Log file does not exist: ${this.currentLogFile}`);return Mo(this.currentLogFile,{encoding:"utf8"})}async decrypt(e){if(!this.validateEncryptionConfig())throw Error("Encryption is not configured");let t=this.config.rotation;if(!t.encrypt||typeof t.encrypt==="boolean")throw Error("Invalid encryption configuration");if(!this.currentKeyId||!this.keys.has(this.currentKeyId))throw Error("No valid encryption key available");let r=this.keys.get(this.currentKeyId);try{let n=Me.isBuffer(e)?e:Me.from(e,"base64"),i=n.slice(0,16),o=n.slice(-16),s=n.slice(16,-16),c=Mf("aes-256-gcm",r,i);return c.setAuthTag(o),Me.concat([c.update(s),c.final()]).toString("utf8")}catch(n){throw Error(`Decryption failed: ${n instanceof Error?n.message:String(n)}`)}}getLevel(){return this.config.level}getLogDirectory(){return this.config.logDirectory}getFormat(){return this.config.format}getRotationConfig(){return this.config.rotation}isBrowserMode(){return D()}isServerMode(){return!D()}setTestEncryptionKey(e,t){this.currentKeyId=e,this.keys.set(e,t)}getTestCurrentKey(){if(!this.currentKeyId||!this.keys.has(this.currentKeyId))return null;return{id:this.currentKeyId,key:this.keys.get(this.currentKeyId)}}getConfig(){return this.config}async box(e){if(!this.enabled)return;let t=new Date,r=this.formatConsoleTimestamp(t),n=this.formatFileTimestamp(t);if(this.fancy&&!D()){let o=e.split(`
|
|
8
8
|
`),s=Math.max(...o.map((u)=>u.length))+2,c=`\u250C${"\u2500".repeat(s)}\u2510`,a=`\u2514${"\u2500".repeat(s)}\u2518`,l=o.map((u)=>{let f=" ".repeat(s-u.length-2);return`\u2502 ${u}${f} \u2502`});if(this.options.showTags!==!1&&this.name)console.error(this.formatConsoleMessage({timestamp:r,message:P.gray(this.formatTag(this.name)),showTimestamp:!1}));console.error(this.formatConsoleMessage({timestamp:r,message:P.cyan(c)})),l.forEach((u)=>console.error(this.formatConsoleMessage({timestamp:r,message:P.cyan(u),showTimestamp:!1}))),console.error(this.formatConsoleMessage({timestamp:r,message:P.cyan(a),showTimestamp:!1}))}else if(!D())console.error(`${n} ${this.environment}.INFO: [BOX] ${e}`);let i=`${n} ${this.environment}.INFO: [BOX] ${e}
|
|
9
9
|
`.replace(this.ANSI_PATTERN,"");await this.writeToFile(i)}async prompt(e){if(D())return Promise.resolve(!0);return new Promise((t)=>{console.error(`${P.cyan("?")} ${e} (y/n) `);let r=(n)=>{let i=n.toString().trim().toLowerCase();J.stdin.removeListener("data",r);try{if(typeof J.stdin.setRawMode==="function")J.stdin.setRawMode(!1)}catch{}J.stdin.pause(),console.error(""),t(i==="y"||i==="yes")};try{if(typeof J.stdin.setRawMode==="function")J.stdin.setRawMode(!0)}catch{}J.stdin.resume(),J.stdin.once("data",r)})}setFancy(e){this.fancy=e}isFancy(){return this.fancy}pause(){this.enabled=!1}resume(){this.enabled=!0}async start(e,...t){if(!this.enabled)return;let r=e;if(t&&t.length>0){let s=/%([sdijfo%])/g,c=0;if(r=e.replace(s,(a,l)=>{if(l==="%")return"%";if(c>=t.length)return a;let u=t[c++];switch(l){case"s":return String(u);case"d":case"i":return Number(u).toString();case"j":case"o":return JSON.stringify(u,null,2);default:return a}}),c<t.length)r+=` ${t.slice(c).map((a)=>typeof a==="object"?JSON.stringify(a,null,2):String(a)).join(" ")}`}if(this.fancy&&!D()){let s=this.options.showTags!==!1&&this.name?P.gray(this.formatTag(this.name)):"",c=P.blue("\u25D0");console.error(`${c} ${s} ${P.cyan(r)}`)}let o=`[${new Date().toISOString()}] ${this.environment}.INFO: [START] ${r}
|
|
10
10
|
`.replace(this.ANSI_PATTERN,"");await this.writeToFile(o)}progress(e,t=""){if(!this.enabled||!this.fancy||D()||e<=0)return{update:()=>{},finish:()=>{},interrupt:()=>{}};if(this.activeProgressBar)console.warn("Warning: Another progress bar is already active. Finishing the previous one."),this.finishProgressBar(this.activeProgressBar,"[Auto-finished]");let r=20;return this.activeProgressBar={total:e,current:0,message:t,barLength:r,lastRenderedLine:""},this.renderProgressBar(this.activeProgressBar),{update:(s,c)=>{if(!this.activeProgressBar||!this.enabled||!this.fancy||D())return;if(this.activeProgressBar.current=Math.max(0,Math.min(e,s)),c!==void 0)this.activeProgressBar.message=c;let a=this.activeProgressBar.current===this.activeProgressBar.total;this.renderProgressBar(this.activeProgressBar,a)},finish:(s)=>{if(!this.activeProgressBar||!this.enabled||!this.fancy||D())return;if(this.activeProgressBar.current=this.activeProgressBar.total,s!==void 0)this.activeProgressBar.message=s;this.renderProgressBar(this.activeProgressBar,!0),this.finishProgressBar(this.activeProgressBar)},interrupt:(s,c="info")=>{if(!this.activeProgressBar||!this.enabled||!this.fancy||D())return;J.stdout.write(`${"\r".padEnd(J.stdout.columns||80)}\r`),this.log(c,s),setTimeout(()=>{if(this.activeProgressBar)this.renderProgressBar(this.activeProgressBar)},50)}}}renderProgressBar(e,t=!1){if(!this.enabled||!this.fancy||D()||!J.stdout.isTTY)return;let r=Math.min(100,Math.max(0,Math.round(e.current/e.total*100))),n=Math.round(e.barLength*r/100),i=e.barLength-n,o=P.green("\u2501".repeat(n)),s=P.gray("\u2501".repeat(i)),c=`[${o}${s}]`,a=`${r}%`.padStart(4),l=e.message?` ${e.message}`:"",u=t||r===100?P.green("\u2713"):P.blue("\u25B6"),f=this.options.showTags!==!1&&this.name?` ${P.gray(this.formatTag(this.name))}`:"",d=`\r${u}${f} ${c} ${a}${l}`,h=J.stdout.columns||80,m=" ".repeat(Math.max(0,h-d.replace(this.ANSI_PATTERN,"").length));if(e.lastRenderedLine=`${d}${m}`,J.stdout.write(e.lastRenderedLine),t)J.stdout.write(`
|
|
11
|
-
`)}finishProgressBar(e,t){if(!this.enabled||!this.fancy||D()||!J.stdout.isTTY){this.activeProgressBar=null;return}if(e.current<e.total)e.current=e.total;if(t)e.message=t;this.renderProgressBar(e,!0),this.activeProgressBar=null}async clear(e={}){if(D()){console.warn("Log clearing is not supported in browser environments.");return}try{console.warn("Clearing logs...",this.config.logDirectory);let t=await Jt(this.config.logDirectory),r=[];for(let n of t){if(!(e.name?new RegExp(e.name.replace("*",".*")).test(n):n.startsWith(this.name))||!n.endsWith(".log"))continue;let o=nt(this.config.logDirectory,n);if(e.before)try{if((await rt(o)).mtime>=e.before)continue}catch(s){console.error(`Failed to get stats for file ${o}:`,s);continue}r.push(o)}if(r.length===0){console.warn("No log files matched the criteria for clearing.");return}console.warn(`Preparing to delete ${r.length} log file(s)...`);for(let n of r)try{await Xt(n),console.warn(`Deleted log file: ${n}`)}catch(i){console.error(`Failed to delete log file ${n}:`,i)}console.warn("Log clearing process finished.")}catch(t){console.error("Error during log clearing process:",t)}}}function cr(e,t){if(Array.isArray(t)&&Array.isArray(e)&&t.length===2&&e.length===2&&I(t[0])&&"id"in t[0]&&t[0].id===3&&I(t[1])&&"id"in t[1]&&t[1].id===4)return t;if(I(t)&&I(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(I(e)&&"arr"in e&&Array.isArray(e.arr)&&I(t)&&"arr"in t&&Array.isArray(t.arr))return t;if(t.length>0&&e.length>0&&I(t[0])&&I(e[0])){let n=[...t];for(let i of e)if(I(i)&&"name"in i){if(!n.find((s)=>I(s)&&("name"in s)&&s.name===i.name))n.push(i)}else if(I(i)&&"path"in i){if(!n.find((s)=>I(s)&&("path"in s)&&s.path===i.path))n.push(i)}else if(!n.some((o)=>wr(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(!I(t)||!I(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(I(i)&&I(r[n]))r[n]=cr(r[n],i);else if(Array.isArray(i)&&Array.isArray(r[n]))if(i.length>0&&r[n].length>0&&I(i[0])&&I(r[n][0])){let o=[...i];for(let s of r[n])if(I(s)&&"name"in s){if(!o.find((a)=>I(a)&&("name"in a)&&a.name===s.name))o.push(s)}else if(I(s)&&"path"in s){if(!o.find((a)=>I(a)&&("path"in a)&&a.path===s.path))o.push(s)}else if(!o.some((c)=>wr(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 ri(e,t,r="replace"){if(t===null||t===void 0)return e;if(Array.isArray(t))return r==="replace"?t:cr(e,t);if(Array.isArray(e))return r==="replace"?t:cr(e,t);if(!I(t)||!I(e))return t;let n={...e};for(let i of Object.keys(t)){if(!Object.prototype.hasOwnProperty.call(t,i))continue;let o=t[i],s=n[i];if(o===null||o===void 0)continue;if(Array.isArray(o)||Array.isArray(s))if(r==="replace")n[i]=o;else n[i]=cr(s,o);else if(I(o)&&I(s))n[i]=ri(s,o,r);else n[i]=o}return n}function wr(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(!wr(e[r],t[r]))return!1;return!0}if(I(e)&&I(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(!wr(e[i],t[i]))return!1}return!0}return!1}function I(e){return Boolean(e&&typeof e==="object"&&!Array.isArray(e))}async function sr(e,t,r="replace"){if(!ys(e))return null;try{let n=await import(e),i=n.default||n;if(typeof i!=="object"||i===null||Array.isArray(i))return null;try{return ri(t,i,r)}catch{return null}}catch{return null}}function Cd(e,t,r=!1){if(!e)return t;let n=e.toUpperCase().replace(/-/g,"_"),i={...t};function o(s,c=[]){let a={...s};for(let[l,u]of Object.entries(s)){let f=[...c,l],d=(g)=>g.replace(/([A-Z])/g,"_$1").toUpperCase(),h=`${n}_${f.map(d).join("_")}`,m=`${n}_${f.map((g)=>g.toUpperCase()).join("_")}`;if(r)Z.info(`Checking environment variable ${h} for config ${e}.${f.join(".")}`);if(typeof u==="object"&&u!==null&&!Array.isArray(u))a[l]=o(u,f);else{let g=Tt.env[h]||Tt.env[m];if(g!==void 0){if(r)Z.info(`Using environment variable ${g?h:m} for config ${e}.${f.join(".")}`);if(typeof u==="number")a[l]=Number(g);else if(typeof u==="boolean")a[l]=g.toLowerCase()==="true";else if(Array.isArray(u))try{let p=JSON.parse(g);if(Array.isArray(p))a[l]=p;else a[l]=g.split(",").map((y)=>y.trim())}catch{a[l]=g.split(",").map((p)=>p.trim())}else a[l]=g}}}return a}return o(i)}async function $d({name:e="",alias:t,cwd:r,configDir:n,defaultConfig:i,verbose:o=!1,checkEnv:s=!0,arrayStrategy:c="replace"}){let a=s&&typeof i==="object"&&i!==null&&!Array.isArray(i)?Cd(e,i,o):i,l=r||Tt.cwd(),u=[".ts",".js",".mjs",".cjs",".json"];if(o)Z.info(`Loading configuration for "${e}"${t?` (alias: "${t}")`:""} from ${l}`);let f=[e,`.${e}`].filter(Boolean),d=[`${e}.config`,`.${e}.config`].filter(Boolean),h=t?[t,`.${t}`]:[],m=t?[`${t}.config`,`.${t}.config`]:[],g=Array.from(new Set([l,re(l,"config"),re(l,".config"),n?re(l,n):void 0].filter(Boolean)));for(let p of g){if(o)Z.info(`Searching for configuration in: ${p}`);let x=[re(l,"config"),re(l,".config")].concat(n?[re(l,n)]:[]).includes(p)?[...f,...d,...h,...m]:[...d,...f,...m,...h];for(let w of x)for(let T of u){let S=re(p,`${w}${T}`),j=await sr(S,a,c);if(j!==null){if(o)Z.success(`Configuration loaded from: ${S}`);return j}}}if(e){let p=re(wn(),".config",e),y=["config",`${e}.config`];if(t)y.push(`${t}.config`);if(o)Z.info(`Checking user config directory: ${p}`);for(let x of y)for(let w of u){let T=re(p,`${x}${w}`),S=await sr(T,a,c);if(S!==null){if(o)Z.success(`Configuration loaded from user config directory: ${T}`);return S}}}if(e){let p=re(wn(),".config"),y=[`.${e}.config`];if(t)y.push(`.${t}.config`);if(o)Z.info(`Checking user config directory for dotfile configs: ${p}`);for(let x of y)for(let w of u){let T=re(p,`${x}${w}`),S=await sr(T,a,c);if(S!==null){if(o)Z.success(`Configuration loaded from user config directory dotfile: ${T}`);return S}}}if(e){let p=wn(),y=[`.${e}.config`,`.${e}`];if(t)y.push(`.${t}.config`),y.push(`.${t}`);if(o)Z.info(`Checking user home directory for dotfile configs: ${p}`);for(let x of y)for(let w of u){let T=re(p,`${x}${w}`),S=await sr(T,a,c);if(S!==null){if(o)Z.success(`Configuration loaded from user home directory: ${T}`);return S}}}try{let p=re(l,"package.json");if(ys(p)){let y=await import(p),x=y[e];if(!x&&t){if(x=y[t],x&&o)Z.success(`Using alias "${t}" configuration from package.json`)}if(x&&typeof x==="object"&&!Array.isArray(x))try{if(o)Z.success(`Configuration loaded from package.json: ${x===y[e]?e:t}`);return ri(a,x,c)}catch(w){if(o)Z.warn("Failed to merge package.json config:",w)}}}catch(p){if(o)Z.warn("Failed to load package.json:",p)}if(o)Z.info(`No configuration found for "${e}"${t?` or alias "${t}"`:""}, using default configuration with environment variables`);return a}function Rd(e,t={}){let r=mr.cwd();while(r.includes("storage"))r=Oo(r,"..");let n=Oo(r,e||"");if(t?.relative)return Tf(mr.cwd(),n);return n}async function kd(){try{let e=await $d({name:"clarity",alias:"logging",defaultConfig:dr,cwd:mr.cwd()});return{...dr,...e||{}}}catch{return dr}}function K(){if(Ee.env.NODE_ENV==="test"||Ee.env.BUN_ENV==="test")return!1;return typeof window<"u"}async function Sd(){if(Ee.env.NODE_ENV==="test"||Ee.env.BUN_ENV==="test")return!0;if(typeof navigator<"u"&&navigator.product==="ReactNative")return!0;if(typeof Ee<"u"){let e=Ee.type;if(e==="renderer"||e==="worker")return!1;return!!(Ee.versions&&(Ee.versions.node||Ee.versions.bun))}return!1}class ws{async format(e){let t=await Sd(),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:at.pid,hostname:t(),environment:at.env.NODE_ENV||"development",platform:at.platform,version:at.version}}return{userAgent:navigator.userAgent,hostname:window.location.hostname||"browser",environment:at.env.NODE_ENV||at.env.BUN_ENV||"development",viewport:{width:window.innerWidth,height:window.innerHeight},language:navigator.language}}}class Cr{name;fileLocks=new Map;currentKeyId=null;keys=new Map;fingersCrossedConfig;fingersCrossedActive=!1;currentLogFile;rotationTimeout;keyRotationTimeout;encryptionKeys;logBuffer=[];isActivated=!1;pendingOperations=[];enabled;fancy;tagFormat;timestampPosition;environment;config;options;formatter;timers=new Set;subLoggers=new Set;fingersCrossedBuffer=[];ANSI_PATTERN=/\u001B\[.*?m/g;activeProgressBar=null;constructor(e,t={}){this.name=e,this.config={...zn},this.options=this.normalizeOptions(t),this.formatter=this.options.formatter||new ws,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??N.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()}}shouldActivateFingersCrossed(e){if(!this.fingersCrossedConfig)return!1;let t={debug:0,info:1,success:2,warning:3,error:4},r=this.fingersCrossedConfig.activationLevel??"error";return t[e]>=t[r]}initializeFingersCrossedConfig(e){if(!e.fingersCrossedEnabled&&e.fingersCrossed)return{...hr,...e.fingersCrossed};if(!e.fingersCrossedEnabled)return null;if(!e.fingersCrossed)return{...hr};return{...hr,...e.fingersCrossed}}normalizeOptions(e){let t={format:"json",level:"info",logDirectory:zn.logDirectory,rotation:void 0,timestamp:void 0,fingersCrossed:{},enabled:!0,showTags:!1,showIcons:!0,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}shouldWriteToFile(){return!K()&&this.config.writeToFile===!0}async writeToFile(e){let r=(async()=>{let i,o=0,s=3,c=1000;while(o<s)try{try{try{await Wf(this.config.logDirectory,Uo.F_OK|Uo.W_OK)}catch(l){if(l instanceof Error&&"code"in l)if(l.code==="ENOENT")await zf(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:ke.from(e);try{if(!Zt(this.currentLogFile))await En(this.currentLogFile,"",{mode:420});if(i=Vo(this.currentLogFile,"a",420),Uf(i,a,{flag:"a"}),Bo(i),i!==void 0)An(i),i=void 0;if((await ot(this.currentLogFile)).size===0){if(await En(this.currentLogFile,a,{flag:"w",mode:420}),(await ot(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{An(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 st(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 st(this.config.logDirectory,`${this.name}.log`);let e=new Date().toISOString().split("T")[0];return st(this.config.logDirectory,`${this.name}-${e}.log`)}setupRotation(){if(K())return;if(!this.shouldWriteToFile())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 Sn(16).toString("hex")}generateKey(){return Sn(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=Sn(16),n=jf("aes-256-gcm",t,r),i=ke.isBuffer(e)?e:ke.from(e,"utf8"),o=n.update(i),s=n.final(),c=o.length+s.length,a=n.getAuthTag(),l=ke.allocUnsafe(16+c+16);return r.copy(l,0),o.copy(l,16),s.copy(l,16+o.length),a.copy(l,16+c),{encrypted:l,iv:r}}async compressData(e){return new Promise((t,r)=>{let n=zo(),i=[];n.on("data",(o)=>i.push(o)),n.on("end",()=>t(ke.from(ke.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(K())return;if(!this.shouldWriteToFile())return;let e=await ot(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 Qt(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 ot(r).catch(()=>null))try{if(await Wo(r,c),t.compress)try{let a=`${c}.gz`;await this.compressLogFile(c,a),await er(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 En(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 ot(r).catch(()=>null))await Wo(r,o)}if(this.currentLogFile=n,t.maxFiles){let o=(await Qt(this.config.logDirectory)).filter((s)=>s.startsWith(this.name)).sort((s,c)=>c.localeCompare(s));for(let s of o.slice(t.maxFiles))await er(st(this.config.logDirectory,s))}}}async compressLogFile(e,t){let r=jo(e),n=Vf(t),i=zo();await Gf(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);if(this.shouldWriteToFile())await this.writeToFile(n);console.log(n)}if(this.fingersCrossedConfig.stopBuffering)this.logBuffer=[]}if(this.isActivated){if(this.shouldWriteToFile())await this.writeToFile(t);console.log(t)}}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()})),Zt(this.currentLogFile))try{let e=Vo(this.currentLogFile,"r+");Bo(e),An(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(!K()&&this.config.rotation&&typeof this.config.rotation!=="boolean"&&this.config.rotation.compress)try{let t=(await Qt(this.config.logDirectory)).filter((r)=>(r.includes("temp")||r.includes(".tmp"))&&r.includes(this.name));for(let r of t)try{await er(st(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.shouldStyleConsole()?A.gray(e.toLocaleTimeString()):e.toLocaleTimeString()}shouldStyleConsole(){if(!this.fancy||K())return!1;let e=typeof N.env.NO_COLOR<"u",t=N.env.FORCE_COLOR==="0";if(e||t)return!1;return!!(typeof N.stderr<"u"&&N.stderr.isTTY||typeof N.stdout<"u"&&N.stdout.isTTY)}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=N.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} ${A.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}formatMarkdown(e){if(!e)return e;let t=e;return t=t.replace(/\[([^\]]+)\]\(([^)]+)\)/g,(r,n,i)=>{let o=A.underline(A.blue(n)),s=this.toAbsoluteFilePath(i);if(s&&this.shouldStyleConsole()&&this.supportsHyperlinks()){let c=`file://${encodeURI(s)}`,a="\x1B]8;;",l="\x1B\\";return`\x1B]8;;${c}\x1B\\${o}\x1B]8;;\x1B\\`}if(this.shouldStyleConsole()&&this.supportsHyperlinks())return`\x1B]8;;${i}\x1B\\${o}\x1B]8;;\x1B\\`;return o}),t=t.replace(/`([^`]+)`/g,(r,n)=>A.bgGray(n)),t=t.replace(/\*\*([^*]+)\*\*/g,(r,n)=>A.bold(n)),t=t.replace(/(?<!\*)\*([^*]+)\*(?!\*)/g,(r,n)=>A.italic(n)),t=t.replace(/(?<!_)_([^_]+)_(?!_)/g,(r,n)=>A.italic(n)),t=t.replace(/~([^~]+)~/g,(r,n)=>A.strikethrough(n)),t}supportsHyperlinks(){if(K())return!1;let e=N.env;if(!e)return!1;if(e.TERM_PROGRAM==="iTerm.app"||e.TERM_PROGRAM==="vscode"||e.TERM_PROGRAM==="WezTerm")return!0;if(e.WT_SESSION)return!0;if(e.TERM==="xterm-kitty")return!0;let t=e.VTE_VERSION?Number.parseInt(e.VTE_VERSION,10):0;if(!Number.isNaN(t)&&t>=5000)return!0;return!1}toAbsoluteFilePath(e){try{let t=e;if(t.startsWith("file://"))t=t.replace(/^file:\/\//,"");if(t.startsWith("~")){let r=N.env.HOME||"";if(r)t=t.replace(/^~(?=$|\/)/,r)}if(Kf(t)||t.startsWith("./")||t.startsWith("../"))t=Hf(t);else return null;return Zt(t)?t:null}catch{return null}}buildOutputTexts(e){let t=this.shouldStyleConsole()?this.formatMarkdown(e):e,r=e.replace(this.ANSI_PATTERN,"");return{consoleText:t,fileText:r}}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);let{consoleText:a,fileText:l}=this.buildOutputTexts(s);if(this.shouldStyleConsole()){let f=this.options.showIcons===!1?"":Os[e],d=this.options.showTags!==!1&&this.name?A.gray(this.formatTag(this.name)):"",h;switch(e){case"debug":h=this.formatConsoleMessage({timestamp:i,icon:f,tag:d,message:A.gray(a),level:e}),console.error(h);break;case"info":h=this.formatConsoleMessage({timestamp:i,icon:f,tag:d,message:a,level:e}),console.warn(h);break;case"success":h=this.formatConsoleMessage({timestamp:i,icon:f,tag:d,message:A.green(a),level:e}),console.error(h);break;case"warning":h=this.formatConsoleMessage({timestamp:i,icon:f,tag:d,message:a,level:e}),console.warn(h);break;case"error":if(h=this.formatConsoleMessage({timestamp:i,icon:f,tag:d,message:a,level:e}),console.error(h),c){let m=c.split(`
|
|
11
|
+
`)}finishProgressBar(e,t){if(!this.enabled||!this.fancy||D()||!J.stdout.isTTY){this.activeProgressBar=null;return}if(e.current<e.total)e.current=e.total;if(t)e.message=t;this.renderProgressBar(e,!0),this.activeProgressBar=null}async clear(e={}){if(D()){console.warn("Log clearing is not supported in browser environments.");return}try{console.warn("Clearing logs...",this.config.logDirectory);let t=await Zt(this.config.logDirectory),r=[];for(let n of t){if(!(e.name?new RegExp(e.name.replace("*",".*")).test(n):n.startsWith(this.name))||!n.endsWith(".log"))continue;let o=it(this.config.logDirectory,n);if(e.before)try{if((await nt(o)).mtime>=e.before)continue}catch(s){console.error(`Failed to get stats for file ${o}:`,s);continue}r.push(o)}if(r.length===0){console.warn("No log files matched the criteria for clearing.");return}console.warn(`Preparing to delete ${r.length} log file(s)...`);for(let n of r)try{await Qt(n),console.warn(`Deleted log file: ${n}`)}catch(i){console.error(`Failed to delete log file ${n}:`,i)}console.warn("Log clearing process finished.")}catch(t){console.error("Error during log clearing process:",t)}}}function fr(e,t){if(Array.isArray(t)&&Array.isArray(e)&&t.length===2&&e.length===2&&I(t[0])&&"id"in t[0]&&t[0].id===3&&I(t[1])&&"id"in t[1]&&t[1].id===4)return t;if(I(t)&&I(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(I(e)&&"arr"in e&&Array.isArray(e.arr)&&I(t)&&"arr"in t&&Array.isArray(t.arr))return t;if(t.length>0&&e.length>0&&I(t[0])&&I(e[0])){let n=[...t];for(let i of e)if(I(i)&&"name"in i){if(!n.find((s)=>I(s)&&("name"in s)&&s.name===i.name))n.push(i)}else if(I(i)&&"path"in i){if(!n.find((s)=>I(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(!I(t)||!I(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(I(i)&&I(r[n]))r[n]=fr(r[n],i);else if(Array.isArray(i)&&Array.isArray(r[n]))if(i.length>0&&r[n].length>0&&I(i[0])&&I(r[n][0])){let o=[...i];for(let s of r[n])if(I(s)&&"name"in s){if(!o.find((a)=>I(a)&&("name"in a)&&a.name===s.name))o.push(s)}else if(I(s)&&"path"in s){if(!o.find((a)=>I(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 oi(e,t,r="replace"){if(t===null||t===void 0)return e;if(Array.isArray(t))return r==="replace"?t:fr(e,t);if(Array.isArray(e))return r==="replace"?t:fr(e,t);if(!I(t)||!I(e))return t;let n={...e};for(let i of Object.keys(t)){if(!Object.prototype.hasOwnProperty.call(t,i))continue;let o=t[i],s=n[i];if(o===null||o===void 0)continue;if(Array.isArray(o)||Array.isArray(s))if(r==="replace")n[i]=o;else n[i]=fr(s,o);else if(I(o)&&I(s))n[i]=oi(s,o,r);else n[i]=o}return n}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(I(e)&&I(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 I(e){return Boolean(e&&typeof e==="object"&&!Array.isArray(e))}async function lr(e,t,r="replace"){if(!vs(e))return null;try{let n=await import(e),i=n.default||n;if(typeof i!=="object"||i===null||Array.isArray(i))return null;try{return oi(t,i,r)}catch{return null}}catch{return null}}function kd(e,t,r=!1){if(!e)return t;let n=e.toUpperCase().replace(/-/g,"_"),i={...t};function o(s,c=[]){let a={...s};for(let[l,u]of Object.entries(s)){let f=[...c,l],d=(g)=>g.replace(/([A-Z])/g,"_$1").toUpperCase(),h=`${n}_${f.map(d).join("_")}`,m=`${n}_${f.map((g)=>g.toUpperCase()).join("_")}`;if(r)Z.info(`Checking environment variable ${h} for config ${e}.${f.join(".")}`);if(typeof u==="object"&&u!==null&&!Array.isArray(u))a[l]=o(u,f);else{let g=Nt.env[h]||Nt.env[m];if(g!==void 0){if(r)Z.info(`Using environment variable ${g?h:m} for config ${e}.${f.join(".")}`);if(typeof u==="number")a[l]=Number(g);else if(typeof u==="boolean")a[l]=g.toLowerCase()==="true";else if(Array.isArray(u))try{let p=JSON.parse(g);if(Array.isArray(p))a[l]=p;else a[l]=g.split(",").map((y)=>y.trim())}catch{a[l]=g.split(",").map((p)=>p.trim())}else a[l]=g}}}return a}return o(i)}async function Sd({name:e="",alias:t,cwd:r,configDir:n,defaultConfig:i,verbose:o=!1,checkEnv:s=!0,arrayStrategy:c="replace"}){let a=s&&typeof i==="object"&&i!==null&&!Array.isArray(i)?kd(e,i,o):i,l=r||Nt.cwd(),u=[".ts",".js",".mjs",".cjs",".json"];if(o)Z.info(`Loading configuration for "${e}"${t?` (alias: "${t}")`:""} from ${l}`);let f=[e,`.${e}`].filter(Boolean),d=[`${e}.config`,`.${e}.config`].filter(Boolean),h=t?[t,`.${t}`]:[],m=t?[`${t}.config`,`.${t}.config`]:[],g=Array.from(new Set([l,re(l,"config"),re(l,".config"),n?re(l,n):void 0].filter(Boolean)));for(let p of g){if(o)Z.info(`Searching for configuration in: ${p}`);let b=[re(l,"config"),re(l,".config")].concat(n?[re(l,n)]:[]).includes(p)?[...f,...d,...h,...m]:[...d,...f,...m,...h];for(let w of b)for(let T of u){let S=re(p,`${w}${T}`),j=await lr(S,a,c);if(j!==null){if(o)Z.success(`Configuration loaded from: ${S}`);return j}}}if(e){let p=re(Rn(),".config",e),y=["config",`${e}.config`];if(t)y.push(`${t}.config`);if(o)Z.info(`Checking user config directory: ${p}`);for(let b of y)for(let w of u){let T=re(p,`${b}${w}`),S=await lr(T,a,c);if(S!==null){if(o)Z.success(`Configuration loaded from user config directory: ${T}`);return S}}}if(e){let p=re(Rn(),".config"),y=[`.${e}.config`];if(t)y.push(`.${t}.config`);if(o)Z.info(`Checking user config directory for dotfile configs: ${p}`);for(let b of y)for(let w of u){let T=re(p,`${b}${w}`),S=await lr(T,a,c);if(S!==null){if(o)Z.success(`Configuration loaded from user config directory dotfile: ${T}`);return S}}}if(e){let p=Rn(),y=[`.${e}.config`,`.${e}`];if(t)y.push(`.${t}.config`),y.push(`.${t}`);if(o)Z.info(`Checking user home directory for dotfile configs: ${p}`);for(let b of y)for(let w of u){let T=re(p,`${b}${w}`),S=await lr(T,a,c);if(S!==null){if(o)Z.success(`Configuration loaded from user home directory: ${T}`);return S}}}try{let p=re(l,"package.json");if(vs(p)){let y=await import(p),b=y[e];if(!b&&t){if(b=y[t],b&&o)Z.success(`Using alias "${t}" configuration from package.json`)}if(b&&typeof b==="object"&&!Array.isArray(b))try{if(o)Z.success(`Configuration loaded from package.json: ${b===y[e]?e:t}`);return oi(a,b,c)}catch(w){if(o)Z.warn("Failed to merge package.json config:",w)}}}catch(p){if(o)Z.warn("Failed to load package.json:",p)}if(o)Z.info(`No configuration found for "${e}"${t?` or alias "${t}"`:""}, using default configuration with environment variables`);return a}function Ad(e,t={}){let r=yr.cwd();while(r.includes("storage"))r=_o(r,"..");let n=_o(r,e||"");if(t?.relative)return If(yr.cwd(),n);return n}async function Ed(){try{let e=await Sd({name:"clarity",alias:"logging",defaultConfig:gr,cwd:yr.cwd()});return{...gr,...e||{}}}catch{return gr}}function K(){if(Ee.env.NODE_ENV==="test"||Ee.env.BUN_ENV==="test")return!1;return typeof window<"u"}async function Td(){if(Ee.env.NODE_ENV==="test"||Ee.env.BUN_ENV==="test")return!0;if(typeof navigator<"u"&&navigator.product==="ReactNative")return!0;if(typeof Ee<"u"){let e=Ee.type;if(e==="renderer"||e==="worker")return!1;return!!(Ee.versions&&(Ee.versions.node||Ee.versions.bun))}return!1}class Rs{async format(e){let t=await Td(),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:lt.pid,hostname:t(),environment:lt.env.NODE_ENV||"development",platform:lt.platform,version:lt.version}}return{userAgent:navigator.userAgent,hostname:window.location.hostname||"browser",environment:lt.env.NODE_ENV||lt.env.BUN_ENV||"development",viewport:{width:window.innerWidth,height:window.innerHeight},language:navigator.language}}}class Rr{name;fileLocks=new Map;currentKeyId=null;keys=new Map;fingersCrossedConfig;fingersCrossedActive=!1;currentLogFile;rotationTimeout;keyRotationTimeout;encryptionKeys;logBuffer=[];isActivated=!1;pendingOperations=[];enabled;fancy;tagFormat;timestampPosition;environment;config;options;formatter;timers=new Set;subLoggers=new Set;fingersCrossedBuffer=[];ANSI_PATTERN=/\u001B\[.*?m/g;activeProgressBar=null;constructor(e,t={}){this.name=e,this.config={...Gn},this.options=this.normalizeOptions(t),this.formatter=this.options.formatter||new Rs,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??N.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()}}shouldActivateFingersCrossed(e){if(!this.fingersCrossedConfig)return!1;let t={debug:0,info:1,success:2,warning:3,error:4},r=this.fingersCrossedConfig.activationLevel??"error";return t[e]>=t[r]}initializeFingersCrossedConfig(e){if(!e.fingersCrossedEnabled&&e.fingersCrossed)return{...mr,...e.fingersCrossed};if(!e.fingersCrossedEnabled)return null;if(!e.fingersCrossed)return{...mr};return{...mr,...e.fingersCrossed}}normalizeOptions(e){let t={format:"json",level:"info",logDirectory:Gn.logDirectory,rotation:void 0,timestamp:void 0,fingersCrossed:{},enabled:!0,showTags:!1,showIcons:!0,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}shouldWriteToFile(){return!K()&&this.config.writeToFile===!0}async writeToFile(e){let r=(async()=>{let i,o=0,s=3,c=1000;while(o<s)try{try{try{await Hf(this.config.logDirectory,Ko.F_OK|Ko.W_OK)}catch(l){if(l instanceof Error&&"code"in l)if(l.code==="ENOENT")await Gf(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:ke.from(e);try{if(!er(this.currentLogFile))await On(this.currentLogFile,"",{mode:420});if(i=zo(this.currentLogFile,"a",420),Kf(i,a,{flag:"a"}),Wo(i),i!==void 0)Nn(i),i=void 0;if((await st(this.currentLogFile)).size===0){if(await On(this.currentLogFile,a,{flag:"w",mode:420}),(await st(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{Nn(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 at(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 at(this.config.logDirectory,`${this.name}.log`);let e=new Date().toISOString().split("T")[0];return at(this.config.logDirectory,`${this.name}-${e}.log`)}setupRotation(){if(K())return;if(!this.shouldWriteToFile())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 Tn(16).toString("hex")}generateKey(){return Tn(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=Tn(16),n=Vf("aes-256-gcm",t,r),i=ke.isBuffer(e)?e:ke.from(e,"utf8"),o=n.update(i),s=n.final(),c=o.length+s.length,a=n.getAuthTag(),l=ke.allocUnsafe(16+c+16);return r.copy(l,0),o.copy(l,16),s.copy(l,16+o.length),a.copy(l,16+c),{encrypted:l,iv:r}}async compressData(e){return new Promise((t,r)=>{let n=Go(),i=[];n.on("data",(o)=>i.push(o)),n.on("end",()=>t(ke.from(ke.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(K())return;if(!this.shouldWriteToFile())return;let e=await st(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 tr(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 st(r).catch(()=>null))try{if(await Ho(r,c),t.compress)try{let a=`${c}.gz`;await this.compressLogFile(c,a),await rr(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 On(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 st(r).catch(()=>null))await Ho(r,o)}if(this.currentLogFile=n,t.maxFiles){let o=(await tr(this.config.logDirectory)).filter((s)=>s.startsWith(this.name)).sort((s,c)=>c.localeCompare(s));for(let s of o.slice(t.maxFiles))await rr(at(this.config.logDirectory,s))}}}async compressLogFile(e,t){let r=Vo(e),n=zf(t),i=Go();await Jf(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);if(this.shouldWriteToFile())await this.writeToFile(n);console.log(n)}if(this.fingersCrossedConfig.stopBuffering)this.logBuffer=[]}if(this.isActivated){if(this.shouldWriteToFile())await this.writeToFile(t);console.log(t)}}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()})),er(this.currentLogFile))try{let e=zo(this.currentLogFile,"r+");Wo(e),Nn(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(!K()&&this.config.rotation&&typeof this.config.rotation!=="boolean"&&this.config.rotation.compress)try{let t=(await tr(this.config.logDirectory)).filter((r)=>(r.includes("temp")||r.includes(".tmp"))&&r.includes(this.name));for(let r of t)try{await rr(at(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.shouldStyleConsole()?A.gray(e.toLocaleTimeString()):e.toLocaleTimeString()}shouldStyleConsole(){if(!this.fancy||K())return!1;let e=typeof N.env.NO_COLOR<"u",t=N.env.FORCE_COLOR==="0";if(e||t)return!1;return!!(typeof N.stderr<"u"&&N.stderr.isTTY||typeof N.stdout<"u"&&N.stdout.isTTY)}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=N.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} ${A.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}formatMarkdown(e){if(!e)return e;let t=e;return t=t.replace(/\[([^\]]+)\]\(([^)]+)\)/g,(r,n,i)=>{let o=A.underline(A.blue(n)),s=this.toAbsoluteFilePath(i);if(s&&this.shouldStyleConsole()&&this.supportsHyperlinks()){let c=`file://${encodeURI(s)}`,a="\x1B]8;;",l="\x1B\\";return`\x1B]8;;${c}\x1B\\${o}\x1B]8;;\x1B\\`}if(this.shouldStyleConsole()&&this.supportsHyperlinks())return`\x1B]8;;${i}\x1B\\${o}\x1B]8;;\x1B\\`;return o}),t=t.replace(/`([^`]+)`/g,(r,n)=>A.bgGray(n)),t=t.replace(/\*\*([^*]+)\*\*/g,(r,n)=>A.bold(n)),t=t.replace(/(?<!\*)\*([^*]+)\*(?!\*)/g,(r,n)=>A.italic(n)),t=t.replace(/(?<!_)_([^_]+)_(?!_)/g,(r,n)=>A.italic(n)),t=t.replace(/~([^~]+)~/g,(r,n)=>A.strikethrough(n)),t}supportsHyperlinks(){if(K())return!1;let e=N.env;if(!e)return!1;if(e.TERM_PROGRAM==="iTerm.app"||e.TERM_PROGRAM==="vscode"||e.TERM_PROGRAM==="WezTerm")return!0;if(e.WT_SESSION)return!0;if(e.TERM==="xterm-kitty")return!0;let t=e.VTE_VERSION?Number.parseInt(e.VTE_VERSION,10):0;if(!Number.isNaN(t)&&t>=5000)return!0;return!1}toAbsoluteFilePath(e){try{let t=e;if(t.startsWith("file://"))t=t.replace(/^file:\/\//,"");if(t.startsWith("~")){let r=N.env.HOME||"";if(r)t=t.replace(/^~(?=$|\/)/,r)}if(qf(t)||t.startsWith("./")||t.startsWith("../"))t=Yf(t);else return null;return er(t)?t:null}catch{return null}}buildOutputTexts(e){let t=this.shouldStyleConsole()?this.formatMarkdown(e):e,r=e.replace(this.ANSI_PATTERN,"");return{consoleText:t,fileText:r}}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);let{consoleText:a,fileText:l}=this.buildOutputTexts(s);if(this.shouldStyleConsole()){let f=this.options.showIcons===!1?"":_s[e],d=this.options.showTags!==!1&&this.name?A.gray(this.formatTag(this.name)):"",h;switch(e){case"debug":h=this.formatConsoleMessage({timestamp:i,icon:f,tag:d,message:A.gray(a),level:e}),console.error(h);break;case"info":h=this.formatConsoleMessage({timestamp:i,icon:f,tag:d,message:a,level:e}),console.warn(h);break;case"success":h=this.formatConsoleMessage({timestamp:i,icon:f,tag:d,message:A.green(a),level:e}),console.error(h);break;case"warning":h=this.formatConsoleMessage({timestamp:i,icon:f,tag:d,message:a,level:e}),console.warn(h);break;case"error":if(h=this.formatConsoleMessage({timestamp:i,icon:f,tag:d,message:a,level:e}),console.error(h),c){let m=c.split(`
|
|
12
12
|
`);for(let g of m)if(g.trim()&&!g.includes(s))console.error(this.formatConsoleMessage({timestamp:i,message:A.gray(` ${g}`),level:e,showTimestamp:!1}))}break}}else if(!K()){if(console.error(`${o} ${this.environment}.${e.toUpperCase()}: ${s}`),c)console.error(c)}if(!this.shouldLog(e))return;let u=`${o} ${this.environment}.${e.toUpperCase()}: ${l}
|
|
13
13
|
`;if(c)u+=`${c}
|
|
14
14
|
`;if(u=u.replace(this.ANSI_PATTERN,""),this.shouldWriteToFile())await this.writeToFile(u)}progress(e,t=""){let r={update:(c,a)=>{},finish:(c)=>{},interrupt:(c,a)=>{}};if(!this.enabled)return r;let n=30;if(this.activeProgressBar={total:Math.max(1,e||1),current:0,message:t||"",barLength:n,lastRenderedLine:""},this.shouldStyleConsole()&&!K()&&N.stdout.isTTY)this.renderProgressBar(this.activeProgressBar);return{update:(c,a)=>{if(!this.enabled||!this.activeProgressBar)return;if(this.activeProgressBar.current=Math.min(Math.max(0,c),this.activeProgressBar.total),a!==void 0)this.activeProgressBar.message=a;if(this.shouldStyleConsole()&&!K()&&N.stdout.isTTY)this.renderProgressBar(this.activeProgressBar)},finish:(c)=>{if(!this.activeProgressBar)return;this.finishProgressBar(this.activeProgressBar,c)},interrupt:(c,a="info")=>{if(!K()&&N.stdout.isTTY)N.stdout.write(`
|
|
15
15
|
`);if(this[a==="warning"?"warn":a](c),this.activeProgressBar&&this.shouldStyleConsole()&&!K()&&N.stdout.isTTY)this.renderProgressBar(this.activeProgressBar)}}}time(e){let t=performance.now();if(this.shouldStyleConsole()){let r=this.options.showTags!==!1&&this.name?A.gray(this.formatTag(this.name)):"",n=this.formatConsoleTimestamp(new Date);console.error(this.formatConsoleMessage({timestamp:n,icon:this.options.showIcons===!1?"":A.blue("\u25D0"),tag:r,message:`${A.cyan(e)}...`}))}return async(r)=>{if(!this.enabled)return;let n=performance.now(),i=Math.round(n-t),o=`${e} completed in ${i}ms`,s=new Date,c=this.formatConsoleTimestamp(s),l=`${this.formatFileTimestamp(s)} ${this.environment}.INFO: ${o}`;if(r)l+=` ${JSON.stringify(r)}`;if(l+=`
|
|
16
|
-
`,l=l.replace(this.ANSI_PATTERN,""),this.shouldStyleConsole()){let u=this.options.showTags!==!1&&this.name?A.gray(this.formatTag(this.name)):"";console.error(this.formatConsoleMessage({timestamp:c,icon:this.options.showIcons===!1?"":A.green("\u2713"),tag:u,message:`${o}${r?` ${JSON.stringify(r)}`:""}`}))}else if(!K())console.error(l.trim());if(this.shouldWriteToFile())await this.writeToFile(l)}}async debug(e,...t){await this.log("debug",e,...t)}async info(e,...t){await this.log("info",e,...t)}async success(e,...t){await this.log("success",e,...t)}async warn(e,...t){await this.log("warning",e,...t)}async error(e,...t){await this.log("error",e,...t)}validateEncryptionConfig(){if(!this.config.rotation)return!1;if(typeof this.config.rotation==="boolean")return!1;let e=this.config.rotation,{encrypt:t}=e;return!!t}async only(e){if(!this.enabled)return;return await e()}isEnabled(){return this.enabled}setEnabled(e){this.enabled=e}extend(e){let t=`${this.name}:${e}`,r=new
|
|
16
|
+
`,l=l.replace(this.ANSI_PATTERN,""),this.shouldStyleConsole()){let u=this.options.showTags!==!1&&this.name?A.gray(this.formatTag(this.name)):"";console.error(this.formatConsoleMessage({timestamp:c,icon:this.options.showIcons===!1?"":A.green("\u2713"),tag:u,message:`${o}${r?` ${JSON.stringify(r)}`:""}`}))}else if(!K())console.error(l.trim());if(this.shouldWriteToFile())await this.writeToFile(l)}}async debug(e,...t){await this.log("debug",e,...t)}async info(e,...t){await this.log("info",e,...t)}async success(e,...t){await this.log("success",e,...t)}async warn(e,...t){await this.log("warning",e,...t)}async error(e,...t){await this.log("error",e,...t)}validateEncryptionConfig(){if(!this.config.rotation)return!1;if(typeof this.config.rotation==="boolean")return!1;let e=this.config.rotation,{encrypt:t}=e;return!!t}async only(e){if(!this.enabled)return;return await e()}isEnabled(){return this.enabled}setEnabled(e){this.enabled=e}extend(e){let t=`${this.name}:${e}`,r=new Rr(t,{...this.options,logDirectory:this.config.logDirectory,level:this.config.level,format:this.config.format,rotation:typeof this.config.rotation==="boolean"?void 0:this.config.rotation,timestamp:typeof this.config.timestamp==="boolean"?void 0:this.config.timestamp});return this.subLoggers.add(r),r}createReadStream(){if(K())throw Error("createReadStream is not supported in browser environments");if(!er(this.currentLogFile))throw Error(`Log file does not exist: ${this.currentLogFile}`);return Vo(this.currentLogFile,{encoding:"utf8"})}async decrypt(e){if(!this.validateEncryptionConfig())throw Error("Encryption is not configured");let t=this.config.rotation;if(!t.encrypt||typeof t.encrypt==="boolean")throw Error("Invalid encryption configuration");if(!this.currentKeyId||!this.keys.has(this.currentKeyId))throw Error("No valid encryption key available");let r=this.keys.get(this.currentKeyId);try{let n=ke.isBuffer(e)?e:ke.from(e,"base64"),i=n.subarray(0,16),o=n.subarray(n.length-16),s=n.subarray(16,n.length-16),c=Wf("aes-256-gcm",r,i);c.setAuthTag(o);let a=c.update(s),l=c.final(),u=a.length+l.length,f=ke.allocUnsafe(u);return a.copy(f,0),l.copy(f,a.length),f.toString("utf8")}catch(n){throw Error(`Decryption failed: ${n instanceof Error?n.message:String(n)}`)}}getLevel(){return this.config.level}getLogDirectory(){return this.config.logDirectory}getFormat(){return this.config.format}getRotationConfig(){return this.config.rotation}isBrowserMode(){return K()}isServerMode(){return!K()}setTestEncryptionKey(e,t){this.currentKeyId=e,this.keys.set(e,t)}getTestCurrentKey(){if(!this.currentKeyId||!this.keys.has(this.currentKeyId))return null;return{id:this.currentKeyId,key:this.keys.get(this.currentKeyId)}}getConfig(){return this.config}async box(e){if(!this.enabled)return;let t=new Date,r=this.formatConsoleTimestamp(t),n=this.formatFileTimestamp(t),{consoleText:i,fileText:o}=this.buildOutputTexts(e);if(this.shouldStyleConsole()){let c=i.split(`
|
|
17
17
|
`),a=Math.max(...c.map((d)=>d.length))+2,l=`\u250C${"\u2500".repeat(a)}\u2510`,u=`\u2514${"\u2500".repeat(a)}\u2518`,f=c.map((d)=>this.formatConsoleMessage({timestamp:r,message:A.cyan(d),showTimestamp:!1}));console.error(this.formatConsoleMessage({timestamp:r,message:A.cyan(l),showTimestamp:!1})),f.forEach((d)=>console.error(d)),console.error(this.formatConsoleMessage({timestamp:r,message:A.cyan(u),showTimestamp:!1}))}else if(!K())console.error(`${n} ${this.environment}.INFO: [BOX] ${o}`);let s=`${n} ${this.environment}.INFO: [BOX] ${o}
|
|
18
18
|
`.replace(this.ANSI_PATTERN,"");if(this.shouldWriteToFile())await this.writeToFile(s)}async prompt(e){if(K())return Promise.resolve(!0);return new Promise((t)=>{console.error(`${A.cyan("?")} ${e} (y/n) `);let r=(n)=>{let i=n.toString().trim().toLowerCase();N.stdin.removeListener("data",r);try{if(typeof N.stdin.setRawMode==="function")N.stdin.setRawMode(!1)}catch{}N.stdin.pause(),console.error(""),t(i==="y"||i==="yes")};try{if(typeof N.stdin.setRawMode==="function")N.stdin.setRawMode(!0)}catch{}N.stdin.resume(),N.stdin.once("data",r)})}setFancy(e){this.fancy=e}isFancy(){return this.fancy}pause(){this.enabled=!1}resume(){this.enabled=!0}async start(e,...t){if(!this.enabled)return;let r=e;if(t&&t.length>0){let a=/%([sdijfo%])/g,l=0;if(r=e.replace(a,(u,f)=>{if(f==="%")return"%";if(l>=t.length)return u;let d=t[l++];switch(f){case"s":return String(d);case"d":case"i":return Number(d).toString();case"j":case"o":return JSON.stringify(d,null,2);default:return u}}),l<t.length)r+=` ${t.slice(l).map((u)=>typeof u==="object"?JSON.stringify(u,null,2):String(u)).join(" ")}`}let{consoleText:n,fileText:i}=this.buildOutputTexts(r);if(this.shouldStyleConsole()){let a=this.options.showTags!==!1&&this.name?A.gray(this.formatTag(this.name)):"",l=this.options.showIcons===!1?"":`${A.blue("\u25D0")} `;console.error(`${l}${a} ${A.cyan(n)}`)}let c=`[${new Date().toISOString()}] ${this.environment}.INFO: [START] ${i}
|
|
19
19
|
`.replace(this.ANSI_PATTERN,"");if(this.shouldWriteToFile())await this.writeToFile(c)}renderProgressBar(e,t=!1){if(!this.enabled||!this.shouldStyleConsole()||!N.stdout.isTTY)return;let r=Math.min(100,Math.max(0,Math.round(e.current/e.total*100))),n=Math.round(e.barLength*r/100),i=e.barLength-n,o=A.green("\u2501".repeat(n)),s=A.gray("\u2501".repeat(i)),c=`[${o}${s}]`,a=`${r}%`.padStart(4),l=e.message?` ${e.message}`:"",u=this.options.showIcons===!1?"":t||r===100?A.green("\u2713"):A.blue("\u25B6"),f=this.options.showTags!==!1&&this.name?` ${A.gray(this.formatTag(this.name))}`:"",d=`\r${u}${f} ${c} ${a}${l}`,h=N.stdout.columns||80,m=" ".repeat(Math.max(0,h-d.replace(this.ANSI_PATTERN,"").length));if(e.lastRenderedLine=`${d}${m}`,N.stdout.write(e.lastRenderedLine),t)N.stdout.write(`
|
|
20
|
-
`)}finishProgressBar(e,t){if(!this.enabled||!this.fancy||K()||!N.stdout.isTTY){this.activeProgressBar=null;return}if(e.current<e.total)e.current=e.total;if(t)e.message=t;this.renderProgressBar(e,!0),this.activeProgressBar=null}async clear(e={}){if(K()){console.warn("Log clearing is not supported in browser environments.");return}try{console.warn("Clearing logs...",this.config.logDirectory);let t=await
|
|
20
|
+
`)}finishProgressBar(e,t){if(!this.enabled||!this.fancy||K()||!N.stdout.isTTY){this.activeProgressBar=null;return}if(e.current<e.total)e.current=e.total;if(t)e.message=t;this.renderProgressBar(e,!0),this.activeProgressBar=null}async clear(e={}){if(K()){console.warn("Log clearing is not supported in browser environments.");return}try{console.warn("Clearing logs...",this.config.logDirectory);let t=await tr(this.config.logDirectory),r=[];for(let n of t){if(!(e.name?new RegExp(e.name.replace("*",".*")).test(n):n.startsWith(this.name))||!n.endsWith(".log"))continue;let o=at(this.config.logDirectory,n);if(e.before)try{if((await st(o)).mtime>=e.before)continue}catch(s){console.error(`Failed to get stats for file ${o}:`,s);continue}r.push(o)}if(r.length===0){console.warn("No log files matched the criteria for clearing.");return}console.warn(`Preparing to delete ${r.length} log file(s)...`);for(let n of r)try{await rr(n),console.warn(`Deleted log file: ${n}`)}catch(i){console.error(`Failed to delete log file ${n}:`,i)}console.warn("Log clearing process finished.")}catch(t){console.error("Error during log clearing process:",t)}}}async function ks(e,t={}){let{maxRetries:r=3,retryDelay:n=1000,isRetryable:i=()=>!0,fallback:o}=t,s=Error("Unknown error occurred");for(let c=0;c<=r;c++)try{return await e()}catch(a){if(s=a instanceof Error?a:Error(String(a)),c===r||!i(s))break;if(n>0)await new Promise((l)=>setTimeout(l,n))}if(o!==void 0)return o;throw s instanceof Error?s:Error(`Unknown error: ${String(s)}`)}function Ss(e){return e instanceof ae}function Nd(e){return e instanceof kr}function Od(e){if(Ss(e))return e.code==="FILE_SYSTEM_ERROR"||e.code==="BROWSER_CONFIG_ERROR";return["ENOENT","EACCES","EMFILE","ENFILE","EBUSY","network","timeout","connection"].some((r)=>e.message.toLowerCase().includes(r.toLowerCase()))}class Or{defaultParsers;constructor(){this.defaultParsers=[{name:"boolean",canParse:(e,t)=>t==="boolean"||["true","false","1","0","yes","no"].includes(e.toLowerCase()),parse:(e)=>{let t=e.toLowerCase();return["true","1","yes"].includes(t)}},{name:"number",canParse:(e,t)=>t==="number"||!Number.isNaN(Number(e))&&!Number.isNaN(Number.parseFloat(e)),parse:(e)=>{let t=Number(e);if(Number.isNaN(t))throw TypeError(`Cannot parse "${e}" as number`);return t}},{name:"array",canParse:(e,t)=>t==="array"||e.startsWith("[")||e.includes(","),parse:(e)=>{try{let t=JSON.parse(e);if(Array.isArray(t))return t}catch{}return e.split(",").map((t)=>t.trim())}},{name:"json",canParse:(e,t)=>t==="object"||(e.startsWith("{")&&e.endsWith("}")||e.startsWith("[")&&e.endsWith("]")),parse:(e)=>{try{return JSON.parse(e)}catch(t){throw Error(`Cannot parse "${e}" as JSON: ${t}`)}}}]}async applyEnvironmentVariables(e,t,r={}){let{prefix:n,useCamelCase:i=!0,useBackwardCompatibility:o=!0,customParsers:s={},verbose:c=!1,trackPerformance:a=!0}=r,l=async()=>{if(!e)return{config:t,source:{type:"environment",priority:50,timestamp:new Date}};let u=n||this.generateEnvPrefix(e),f={...t};return this.processObject(f,[],u,{useCamelCase:i,useBackwardCompatibility:o,customParsers:s,verbose:c,configName:e}),{config:f,source:{type:"environment",priority:50,timestamp:new Date}}};if(a)return Pt.track("applyEnvironmentVariables",l,{configName:e});return l()}generateEnvPrefix(e){return e.toUpperCase().replace(/-/g,"_")}formatEnvKey(e,t){if(!t)return e.toUpperCase();return e.replace(/([A-Z])/g,"_$1").toUpperCase()}processObject(e,t,r,n){for(let[i,o]of Object.entries(e)){let s=[...t,i],c=s.map((u)=>this.formatEnvKey(u,n.useCamelCase)),a=`${r}_${c.join("_")}`,l=n.useBackwardCompatibility?`${r}_${s.map((u)=>u.toUpperCase()).join("_")}`:null;if(n.verbose);if(typeof o==="object"&&o!==null&&!Array.isArray(o))this.processObject(o,s,r,n);else{let u=nr.env[a]||(l?nr.env[l]:void 0);if(u!==void 0){if(n.verbose){let f=nr.env[a]?a:l}try{e[i]=this.parseEnvironmentValue(u,typeof o,a,n.customParsers,n.configName)}catch(f){if(f instanceof Sr)throw f;throw Fe.envVar(a,u,typeof o,n.configName)}}}}}parseEnvironmentValue(e,t,r,n,i){for(let[o,s]of Object.entries(n))try{return s(e)}catch{continue}for(let o of this.defaultParsers)if(o.canParse(e,t))try{return o.parse(e)}catch{throw Fe.envVar(r,e,`${t} (via ${o.name} parser)`,i)}return e}getEnvironmentVariables(e){let t={},r=e.toUpperCase();for(let[n,i]of Object.entries(nr.env))if(n.startsWith(r)&&i!==void 0)t[n]=i;return t}validateEnvironmentVariable(e,t,r){let n=[];if(!/^[A-Z_][A-Z0-9_]*$/.test(e))n.push(`Environment variable key "${e}" should only contain uppercase letters, numbers, and underscores`);if(r)try{this.parseEnvironmentValue(e,t,r,{})}catch(i){n.push(`Cannot parse value "${t}" as ${r}: ${i}`)}return{isValid:n.length===0,errors:n}}generateEnvVarDocs(e,t,r={}){let{prefix:n,format:i="text"}=r,o=n||this.generateEnvPrefix(e),s=[];switch(this.extractEnvVarInfo(t,[],o,s),i){case"markdown":return this.formatAsMarkdown(s,e);case"json":return JSON.stringify(s,null,2);default:return this.formatAsText(s,e)}}extractEnvVarInfo(e,t,r,n){for(let[i,o]of Object.entries(e)){let s=[...t,i],c=`${r}_${s.map((a)=>this.formatEnvKey(a,!0)).join("_")}`;if(typeof o==="object"&&o!==null&&!Array.isArray(o))this.extractEnvVarInfo(o,s,r,n);else n.push({key:c,type:Array.isArray(o)?"array":typeof o,description:`Configuration for ${s.join(".")}`,example:this.generateExample(o)})}}generateExample(e){if(Array.isArray(e))return JSON.stringify(e);if(typeof e==="object"&&e!==null)return JSON.stringify(e);return String(e)}formatAsText(e,t){let r=`Environment Variables for ${t}:
|
|
21
21
|
|
|
22
22
|
`;for(let n of e)r+=`${n.key}
|
|
23
23
|
`,r+=` Type: ${n.type}
|
|
@@ -29,25 +29,25 @@ var yc=(e,t,r)=>()=>{if(e)try{t=e(e=0)}catch(n){r=[n]}if(r)throw r[0];return t};
|
|
|
29
29
|
`;r+=`| Variable | Type | Description | Example |
|
|
30
30
|
`,r+=`|----------|------|-------------|----------|
|
|
31
31
|
`;for(let n of e)r+=`| \`${n.key}\` | ${n.type} | ${n.description} | \`${n.example}\` |
|
|
32
|
-
`;return r}}function Td(e,t){let r=Es("process");if(typeof r>"u"||!r.env)return t;let n=r.env[e];return n!==void 0?n:t}function Rs(e,t,r={}){return ks(e,t,r,new WeakMap)}function ks(e,t,r,n){let{arrayMergeMode:i="replace",skipNullish:o=!1,customMerger:s}=r;if(t===null||t===void 0)return o?e:t;if(s){let c=s(e,t);if(c!==void 0)return c}if(Array.isArray(t)||Array.isArray(e))return Ss(e,t,i,n);if(!ce(t)||!ce(e))return t;return Pd(e,t,r,n)}function Ss(e,t,r,n){if(Array.isArray(t)&&!Array.isArray(e))return t;if(Array.isArray(e)&&!Array.isArray(t))return t;if(Array.isArray(t)&&Array.isArray(e))switch(r){case"replace":return t;case"concat":return Nd(e,t);case"smart":return Od(e,t,n);default:return t}return t}function Nd(e,t){let r=[...t];for(let n of e)if(!r.some((i)=>Un(i,n)))r.push(n);return r}function Od(e,t,r){if(t.length===0)return e;if(e.length===0)return t;if(ce(t[0])&&ce(e[0]))return Id(e,t,r);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}function Id(e,t,r){let n=[...t];for(let i of e){if(!ce(i)){n.push(i);continue}let o=["id","name","key","path","type"],s=!1;for(let c of o)if(c in i){if(n.find((l)=>ce(l)&&(c in l)&&l[c]===i[c])){s=!0;break}}if(!s)n.push(i)}return n}function Pd(e,t,r,n){let i=t;if(ce(i)&&n.has(i))return n.get(i);let o={...e};if(ce(i))n.set(i,o);for(let s in i){if(!Object.prototype.hasOwnProperty.call(i,s))continue;let c=i[s],a=o[s];if(r.skipNullish&&(c===null||c===void 0))continue;if(c===null||c===void 0){o[s]=c;continue}if(ce(c)&&ce(a))o[s]=ks(a,c,r,n);else if(Array.isArray(c)||Array.isArray(a))o[s]=Ss(a,c,r.arrayMergeMode||"smart",n);else o[s]=c}return o}function ni(e,t,r="replace"){return Rs(e,t,{arrayMergeMode:r==="replace"?"replace":"smart",skipNullish:!0})}function Un(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(!Un(e[r],t[r]))return!1;return!0}if(ce(e)&&ce(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(!Un(e[i],t[i]))return!1}return!0}return!1}function ce(e){return Boolean(e&&typeof e==="object"&&!Array.isArray(e))}class Nr{extensions=[".ts",".js",".mjs",".cjs",".json",".mts",".cts"];async loadFromPath(e,t,r={}){let{arrayStrategy:n="replace",useCache:i=!0,cacheTtl:o,trackPerformance:s=!0,verbose:c=!1}=r;if(i){let l=ft.getWithFileCheck("file",e);if(l){if(c)console.log(`Configuration loaded from cache: ${e}`);return l}}let a=async()=>{if(!rr(e))return null;try{let l=`?t=${Date.now()}`,u=await import(e+l),f=u.default||u,d="default"in u,h=Object.keys(u).length>0;if(!d&&!h)throw new Nt(e,Error("Configuration file is empty and exports nothing"),"unknown");if(typeof f!=="object"||f===null||Array.isArray(f))throw new Nt(e,Error("Configuration must export a valid object"),"unknown");let p={config:ni(t,f,n),source:{type:"file",path:e,priority:100,timestamp:new Date}};if(i)ft.setWithFileCheck("file",p,e,o);return p}catch(l){throw l instanceof Error?Fe.configLoad(e,l):Fe.configLoad(e,Error(String(l)))}};if(s)return It.track("loadFromPath",a,{path:e});return a()}async tryLoadFromPaths(e,t,r={}){for(let n of e)try{let i=await this.loadFromPath(n,t,r);if(i)return i}catch(i){if(i instanceof Error&&i.name==="ConfigLoadError")throw i;if(r.verbose)console.warn(`Failed to load config from ${n}:`,i)}return null}generateConfigPaths(e,t,r){let n=this.generateNamePatterns(e,r),i=[];for(let o of n)for(let s of this.extensions)i.push(Tn(t,`${o}${s}`));return i}generateNamePatterns(e,t){let r=[];if(r.push("config",".config"),e)r.push(e,`.${e}.config`,`${e}.config`,`.${e}`);if(t){if(r.push(t,`.${t}.config`,`${t}.config`,`.${t}`),e)r.push(`${e}.${t}.config`,`.${e}.${t}.config`)}return r.filter(Boolean)}checkFileAccess(e){return Cs(async()=>rr(e),{maxRetries:2,retryDelay:100,fallback:!1})}async discoverConfigFiles(e,t,r){let n=[];if(!rr(e))return n;if(t||r){let i=this.generateNamePatterns(t||"",r);for(let o of i)for(let s of this.extensions){let c=Tn(e,`${o}${s}`);if(await this.checkFileAccess(c))n.push(c)}}else try{let{readdirSync:i}=await import("fs"),o=i(e);for(let s of o)if(this.looksLikeConfigFile(s)){let c=Tn(e,s);if(await this.checkFileAccess(c))n.push(c)}}catch{return[]}return n}looksLikeConfigFile(e){return[/\.config\.(ts|js|mjs|cjs|json|mts|cts)$/,/^\..*\.(ts|js|mjs|cjs|json|mts|cts)$/,/config\.(ts|js|mjs|cjs|json|mts|cts)$/].some((r)=>r.test(e))}async validateConfigFile(e){let t=[];try{if(!rr(e))return t.push("Configuration file does not exist"),t;let r=await import(e),n=r.default||r;if(n===void 0)t.push("Configuration file must export a default value or named exports");else if(typeof n!=="object"||n===null)t.push("Configuration must be an object");else if(Array.isArray(n))t.push("Configuration cannot be an array at the root level");if(e.endsWith(".json"))try{let{readFileSync:i}=await import("fs"),o=i(e,"utf8");JSON.parse(o)}catch(i){t.push(`Invalid JSON syntax: ${i}`)}}catch(r){t.push(`Failed to load configuration file: ${r}`)}return t}async getFileModificationTime(e){try{let{statSync:t}=await import("fs");return t(e).mtime}catch{return null}}async preloadConfigurations(e,t={}){let r=new Map;return await Promise.allSettled(e.map(async(n)=>{try{let i=await this.loadFromPath(n,{},t);if(i)r.set(n,i.config)}catch(i){if(t.verbose)console.warn(`Failed to preload ${n}:`,i)}})),r}}class ii{async validateConfiguration(e,t,r={}){let{stopOnFirstError:n=!1,validateRequired:i=!0,validateTypes:o=!0,customRules:s=[],trackPerformance:c=!0,verbose:a=!1}=r,l=async()=>{let u=[],f=[],d={stopOnFirstError:n,validateRequired:i,validateTypes:o,customRules:s,trackPerformance:c,verbose:a};try{if(typeof t==="string")return await this.validateWithSchemaFile(e,t,d);else if(Array.isArray(t))return this.validateWithRules(e,[...t,...s],d);else return this.validateWithJSONSchema(e,t,d)}catch(h){return u.push({path:"",message:`Validation failed: ${h}`,rule:"system"}),{isValid:!1,errors:u,warnings:f}}};if(c)return await It.track("validateConfiguration",l);return l()}async validateWithSchemaFile(e,t,r){try{if(!qf(t))throw new Ot(t,[{path:"",message:"Schema file does not exist"}]);let n=await import(t),i=n.default||n;if(Array.isArray(i))return this.validateWithRules(e,i,r);else return this.validateWithJSONSchema(e,i,r)}catch(n){throw new Ot(t,[{path:"",message:`Failed to load schema: ${n}`}])}}validateWithJSONSchema(e,t,r){let n=[],i=[];return this.validateObjectAgainstSchema(e,t,"",n,i,r),{isValid:n.length===0,errors:n,warnings:i}}validateObjectAgainstSchema(e,t,r,n,i,o){if(o.validateTypes&&t.type){let s=Array.isArray(e)?"array":typeof e,c=Array.isArray(t.type)?t.type:[t.type];if(!c.includes(s)){if(n.push({path:r,message:`Expected type ${c.join(" or ")}, got ${s}`,expected:c.join(" or "),actual:s,rule:"type"}),o.stopOnFirstError)return}}if(t.enum&&!t.enum.includes(e)){if(n.push({path:r,message:`Value must be one of: ${t.enum.join(", ")}`,expected:t.enum.join(", "),actual:e,rule:"enum"}),o.stopOnFirstError)return}if(typeof e==="string"){if(t.minLength!==void 0&&e.length<t.minLength)n.push({path:r,message:`String length must be at least ${t.minLength}`,expected:`>= ${t.minLength}`,actual:e.length,rule:"minLength"});if(t.maxLength!==void 0&&e.length>t.maxLength)n.push({path:r,message:`String length must not exceed ${t.maxLength}`,expected:`<= ${t.maxLength}`,actual:e.length,rule:"maxLength"});if(t.pattern){if(!new RegExp(t.pattern).test(e))n.push({path:r,message:`String does not match pattern ${t.pattern}`,expected:t.pattern,actual:e,rule:"pattern"})}}if(typeof e==="number"){if(t.minimum!==void 0&&e<t.minimum)n.push({path:r,message:`Value must be at least ${t.minimum}`,expected:`>= ${t.minimum}`,actual:e,rule:"minimum"});if(t.maximum!==void 0&&e>t.maximum)n.push({path:r,message:`Value must not exceed ${t.maximum}`,expected:`<= ${t.maximum}`,actual:e,rule:"maximum"})}if(Array.isArray(e)&&t.items)for(let s=0;s<e.length;s++){let c=r?`${r}[${s}]`:`[${s}]`;if(this.validateObjectAgainstSchema(e[s],t.items,c,n,i,o),o.stopOnFirstError&&n.length>0)return}if(e&&typeof e==="object"&&!Array.isArray(e)){let s=e;if(o.validateRequired&&t.required){for(let c of t.required)if(!(c in s)){if(n.push({path:r?`${r}.${c}`:c,message:`Missing required property '${c}'`,expected:"required",rule:"required"}),o.stopOnFirstError)return}}if(t.properties){for(let[c,a]of Object.entries(t.properties))if(c in s){let l=r?`${r}.${c}`:c;if(this.validateObjectAgainstSchema(s[c],a,l,n,i,o),o.stopOnFirstError&&n.length>0)return}}if(t.additionalProperties===!1){let c=new Set(Object.keys(t.properties||{}));for(let a of Object.keys(s))if(!c.has(a))i.push({path:r?`${r}.${a}`:a,message:`Additional property '${a}' is not allowed`,rule:"additionalProperties"})}}}validateWithRules(e,t,r){let n=[],i=[];for(let o of t)try{let s=this.getValueByPath(e,o.path),c=this.validateWithRule(s,o,o.path);if(n.push(...c),r.stopOnFirstError&&n.length>0)break}catch(s){n.push({path:o.path,message:`Rule validation failed: ${s}`,rule:"system"})}return{isValid:n.length===0,errors:n,warnings:i}}validateWithRule(e,t,r){let n=[];if(t.required&&(e===void 0||e===null))return n.push({path:r,message:t.message||`Property '${r}' is required`,expected:"required",rule:"required"}),n;if(e===void 0||e===null)return n;if(t.type){let i=Array.isArray(e)?"array":typeof e;if(i!==t.type)n.push({path:r,message:t.message||`Expected type ${t.type}, got ${i}`,expected:t.type,actual:i,rule:"type"})}if(t.min!==void 0){let i=Array.isArray(e)?e.length:typeof e==="string"?e.length:typeof e==="number"?e:0;if(i<t.min)n.push({path:r,message:t.message||`Value must be at least ${t.min}`,expected:`>= ${t.min}`,actual:i,rule:"min"})}if(t.max!==void 0){let i=Array.isArray(e)?e.length:typeof e==="string"?e.length:typeof e==="number"?e:0;if(i>t.max)n.push({path:r,message:t.message||`Value must not exceed ${t.max}`,expected:`<= ${t.max}`,actual:i,rule:"max"})}if(t.pattern&&typeof e==="string"){if(!t.pattern.test(e))n.push({path:r,message:t.message||`Value does not match pattern ${t.pattern}`,expected:t.pattern.toString(),actual:e,rule:"pattern"})}if(t.enum&&!t.enum.includes(e))n.push({path:r,message:t.message||`Value must be one of: ${t.enum.join(", ")}`,expected:t.enum.join(", "),actual:e,rule:"enum"});if(t.validator){let i=t.validator(e);if(i)n.push({path:r,message:t.message||i,rule:"custom"})}return n}getValueByPath(e,t){if(!t)return e;let r=t.split("."),n=e;for(let i of r)if(n&&typeof n==="object"&&i in n)n=n[i];else return;return n}generateRulesFromInterface(e){let t=[],r=e.matchAll(/(\w+)(\?)?:\s*(\w+)/g);for(let n of r){let[,i,o,s]=n;t.push({path:i,required:!o,type:this.mapTypeScriptType(s)})}return t}mapTypeScriptType(e){switch(e.toLowerCase()){case"string":return"string";case"number":return"number";case"boolean":return"boolean";case"array":return"array";case"object":return"object";default:return"object"}}static createCommonRules(){return{server:[{path:"port",required:!0,type:"number",min:1,max:65535},{path:"host",required:!0,type:"string",min:1},{path:"ssl",type:"boolean"}],database:[{path:"url",required:!0,type:"string",min:1},{path:"pool",type:"number",min:1,max:100},{path:"timeout",type:"number",min:0}],api:[{path:"baseUrl",required:!0,type:"string",pattern:Ps},{path:"timeout",type:"number",min:0},{path:"retries",type:"number",min:0,max:10}]}}}class oi{fileLoader=new Nr;envProcessor=new Tr;validator=new ii;async loadConfig(e){let t=Date.now(),{cache:r,performance:n,schema:i,validate:o,...s}=e;try{if(r?.enabled){let a=this.checkCache(s.name||"",s);if(a)return a}let c;try{c=await this.loadConfigurationStrategies(s,!0,r)}catch(a){let l=s.__strictErrorHandling;if(a instanceof Error&&a.name==="ConfigNotFoundError"){if(l)throw a;c={...await this.applyEnvironmentVariables(s.name||"",s.defaultConfig,s.checkEnv!==!1,s.verbose||!1),warnings:[`No configuration file found for "${s.name||"config"}", using defaults with environment variables`]}}else if(a instanceof Error&&a.name==="ConfigLoadError"){let u=a.message.includes("EACCES")||a.message.includes("EPERM")||a.message.includes("permission denied"),f=!u&&(a.message.includes("syntax")||a.message.includes("Expected")||a.message.includes("Unexpected")||a.message.includes("BuildMessage")||a.message.includes("errors building")),d=a.message.includes("Configuration must export a valid object")||a.message.includes("Configuration file is empty and exports nothing");if(l&&(d||u))throw a;if(f&&(!l||!d))c={...await this.applyEnvironmentVariables(s.name||"",s.defaultConfig,s.checkEnv!==!1,s.verbose||!1),warnings:["Configuration file has syntax errors, using defaults with environment variables"]};else if(!l)c={...await this.applyEnvironmentVariables(s.name||"",s.defaultConfig,s.checkEnv!==!1,s.verbose||!1),warnings:[`Configuration loading error, using defaults: ${a.message}`]};else throw a}else c={...await this.applyEnvironmentVariables(s.name||"",s.defaultConfig,s.checkEnv!==!1,s.verbose||!1),warnings:[`Configuration loading failed, using defaults: ${a instanceof Error?a.message:String(a)}`]}}if(i||o)await this.validateConfiguration(c.config,i,o,s.name);if(r?.enabled&&c)this.cacheResult(s.name||"",c,r,s);if(n?.enabled){let a={operation:"loadConfig",duration:Date.now()-t,configName:s.name,timestamp:new Date};if(n.onMetrics)n.onMetrics(a);if(n.slowThreshold&&a.duration>n.slowThreshold)ge.warn(`Slow configuration loading detected: ${a.duration}ms for ${s.name}`);c.metrics=a}return c}catch(c){let a=Date.now()-t;throw ge.error(`Configuration loading failed after ${a}ms:`,[c instanceof Error?c:Error(String(c))]),c}}async loadConfigurationStrategies(e,t=!1,r){let{name:n="",alias:i,cwd:o,configDir:s,defaultConfig:c,checkEnv:a=!0,arrayStrategy:l="replace",verbose:u=!1}=e,f=o||Ge.cwd(),d=[],h=await this.loadLocalConfiguration(n,i,f,s,c,l,u,a,r);if(h)return d.push(...this.getLocalSearchPaths(n,i,f,s)),this.finalizeResult(h,d,a,n,u);let m=await this.loadHomeConfiguration(n,i,c,l,u,a);if(m)return d.push(...this.getHomeSearchPaths(n,i)),this.finalizeResult(m,d,a,n,u);let g=await this.loadPackageJsonConfiguration(n,i,f,c,l,u,a);if(g)return d.push(ne(f,"package.json")),this.finalizeResult(g,d,a,n,u);if(d.push(...this.getAllSearchPaths(n,i,f,s)),t)throw Fe.configNotFound(n,d,i);return{...await this.applyEnvironmentVariables(n,c,a,u),warnings:[`No configuration file found for "${n}"${i?` or alias "${i}"`:""}, using defaults with environment variables`]}}async loadLocalConfiguration(e,t,r,n,i,o,s,c,a){let l=c?Et(e,i,s):i,u=this.getLocalDirectories(r,n);for(let f of u){if(s)ge.info(`Searching for configuration in: ${f}`);let d=this.fileLoader.generateConfigPaths(e,f,t),h=await this.fileLoader.tryLoadFromPaths(d,l,{arrayStrategy:o,verbose:s,cacheTtl:a?.ttl,useCache:!a?.ttl||a.ttl>100});if(h){if(s)ge.success(`Configuration loaded from: ${h.source.path}`);return h}}return null}async loadHomeConfiguration(e,t,r,n,i,o){if(!e)return null;let s=o?Et(e,r,i):r,c=[ne(tt(),".config",e),ne(tt(),".config"),tt()];for(let a of c){if(i)ge.info(`Checking home directory: ${a}`);let l=this.fileLoader.generateConfigPaths(e,a,t),u=await this.fileLoader.tryLoadFromPaths(l,s,{arrayStrategy:n,verbose:i});if(u){if(i)ge.success(`Configuration loaded from home directory: ${u.source.path}`);return u}}return null}async loadPackageJsonConfiguration(e,t,r,n,i,o,s){let c=s?Et(e,n,o):n;try{let a=ne(r,"package.json");if(!Bn(a))return null;let l=await import(a),u=l[e],f=e;if(!u&&t)u=l[t],f=t;if(u&&typeof u==="object"&&!Array.isArray(u)){if(o)ge.success(`Configuration loaded from package.json: ${f}`);return{config:ni(c,u,i),source:{type:"package.json",path:a,priority:30,timestamp:new Date}}}}catch(a){if(o)ge.warn("Failed to load package.json:",[a instanceof Error?a:Error(String(a))])}return null}async applyEnvironmentVariables(e,t,r,n){if(!r||!e||typeof t!=="object"||t===null||Array.isArray(t))return{config:t,source:{type:"default",priority:10,timestamp:new Date}};return{config:Et(e,t,n),source:{type:"environment",priority:20,timestamp:new Date}}}async finalizeResult(e,t,r,n,i){return{config:e.config,source:e.source,path:e.source.path}}async validateConfiguration(e,t,r,n){let i=[];if(r){let o=r(e);if(o)i.push(...o)}if(t){let o=await this.validator.validateConfiguration(e,t);if(!o.isValid)i.push(...o.errors.map((s)=>s.path?`${s.path}: ${s.message}`:s.message))}if(i.length>0)throw Fe.configValidation(n||"unknown",i,n)}checkCache(e,t){let r=this.generateCacheKey(e,t);return ft.get(r)||null}cacheResult(e,t,r,n){let i=this.generateCacheKey(e,n);ft.set(i,t,void 0,r.ttl)}generateCacheKey(e,t){let r=[e];if(t.alias)r.push(`alias:${t.alias}`);if(t.cwd)r.push(`cwd:${t.cwd}`);if(t.configDir)r.push(`configDir:${t.configDir}`);if("checkEnv"in t)r.push(`checkEnv:${t.checkEnv}`);return r.join("|")}getLocalDirectories(e,t){return Array.from(new Set([e,ne(e,"config"),ne(e,".config"),t?ne(e,t):void 0].filter(Boolean)))}getAllSearchPaths(e,t,r,n){let i=[];return i.push(...this.getLocalSearchPaths(e,t,r,n)),i.push(...this.getHomeSearchPaths(e,t)),i.push(ne(r,"package.json")),i}getLocalSearchPaths(e,t,r,n){let i=this.getLocalDirectories(r,n),o=[];for(let s of i)o.push(...this.fileLoader.generateConfigPaths(e,s,t));return o}getHomeSearchPaths(e,t){if(!e)return[];let r=[ne(tt(),".config",e),ne(tt(),".config"),tt()],n=[];for(let i of r)n.push(...this.fileLoader.generateConfigPaths(e,i,t));return n}async loadConfigWithResult(e){return this.loadConfig(e)}}function Qo(e){let r=!(e.message.includes("EACCES")||e.message.includes("EPERM")||e.message.includes("permission denied"))&&(e.message.includes("syntax")||e.message.includes("Expected")||e.message.includes("Unexpected")||e.message.includes("BuildMessage")),n=e.message.includes("Configuration must export a valid object")||e.message.includes("Configuration file is empty and exports nothing");return r||n}async function _d(e){return Ne.loadConfig({...e,__strictErrorHandling:!0})}async function As(e){let t="defaultConfig"in e&&e.defaultConfig!==void 0?e.defaultConfig:{},r="cache"in e||"performance"in e||"schema"in e||"validate"in e;try{let n;if(r)n=await Ne.loadConfig(e);else n=await Ne.loadConfig({...e,defaultConfig:t,cache:{enabled:!0},performance:{enabled:!1}});return n?.config??t}catch(n){let i=n instanceof Error?n.name:"UnknownError",o=n instanceof Error?n.message:String(n);if(!(i==="ConfigNotFoundError"||i==="ConfigLoadError"||i==="ConfigValidationError"||o.includes("config"))&&e.verbose)ge.warn("Unexpected error loading config, using defaults:",[n instanceof Error?n:Error(String(n))]);let c=r?{...e,defaultConfig:t}:{...e,defaultConfig:t,cache:{enabled:!0},performance:{enabled:!1}};if("checkEnv"in e?e.checkEnv!==!1:!0)return(await Ne.applyEnvironmentVariables(c.name||"",t,!0,c.verbose||!1))?.config??t;return t}}async function Ld(e={defaultConfig:{}}){if(typeof e==="string"){let{cwd:t}=await import("process");try{return(await Ne.loadConfig({name:e,cwd:t(),generatedDir:"./generated",configDir:"./config",defaultConfig:{},checkEnv:!0,arrayStrategy:"replace"})).config}catch(r){if(r instanceof Error&&(r.name==="ConfigNotFoundError"||r.name==="ConfigLoadError"&&Qo(r)))return(await Ne.applyEnvironmentVariables(e,{},!0,!1)).config;throw r}}try{return(await Ne.loadConfig({...e,cwd:e.cwd||Ge.cwd(),cache:{enabled:!0},performance:{enabled:!1}})).config}catch(t){if(t instanceof Error&&(t.name==="ConfigNotFoundError"||t.name==="ConfigLoadError"&&Qo(t)))return(await Ne.applyEnvironmentVariables(e.name||"",e.defaultConfig||{},e.checkEnv!==!1,e.verbose||!1)).config;throw t}}async function Md(e,t,r="replace"){let n=new Nr;try{let i=await n.loadFromPath(e,t,{arrayStrategy:r,useCache:!1,trackPerformance:!1});return i?i.config:null}catch{return null}}function Et(e,t,r=!1){let n=new Tr,i=e.toUpperCase().replace(/[^A-Z0-9]/g,"_");function o(s,c=[]){let a={...s};for(let[l,u]of Object.entries(s)){let f=[...c,l],d=[`${i}_${f.join("_").toUpperCase()}`,`${i}_${f.map((g)=>g.toUpperCase()).join("")}`,`${i}_${f.map((g)=>g.replace(/([A-Z])/g,"_$1").toUpperCase()).join("")}`],h,m;for(let g of d)if(h=Ge.env[g],h!==void 0){m=g;break}if(h!==void 0&&m)if(typeof u==="boolean")a[l]=["true","1","yes"].includes(h.toLowerCase());else if(typeof u==="number"){let g=Number(h);if(!Number.isNaN(g))a[l]=g}else if(Array.isArray(u))try{a[l]=JSON.parse(h)}catch{a[l]=h.split(",").map((g)=>g.trim())}else a[l]=h;else if(u&&typeof u==="object"&&!Array.isArray(u))a[l]=o(u,f)}return a}return o(t)}function Fd(e){let t=ne(Ge.cwd(),e.configDir),r=ne(Ge.cwd(),e.generatedDir),n=ne(r,"config-types.ts");if(!Bn(No(n)))kf(No(n),{recursive:!0,mode:511});let i=Bn(t)?Sf(t).map((s)=>s.replace(/\.(ts|js|mjs|cjs|mts|cts|json)$/,"")).sort():[],o=`// Generated by bunfig v${dh}
|
|
32
|
+
`;return r}}function Id(e,t){let r=Os("process");if(typeof r>"u"||!r.env)return t;let n=r.env[e];return n!==void 0?n:t}function As(e,t,r={}){return Es(e,t,r,new WeakMap)}function Es(e,t,r,n){let{arrayMergeMode:i="replace",skipNullish:o=!1,customMerger:s}=r;if(t===null||t===void 0)return o?e:t;if(s){let c=s(e,t);if(c!==void 0)return c}if(Array.isArray(t)||Array.isArray(e))return Ts(e,t,i,n);if(!ce(t)||!ce(e))return t;return Md(e,t,r,n)}function Ts(e,t,r,n){if(Array.isArray(t)&&!Array.isArray(e))return t;if(Array.isArray(e)&&!Array.isArray(t))return t;if(Array.isArray(t)&&Array.isArray(e))switch(r){case"replace":return t;case"concat":return Pd(e,t);case"smart":return _d(e,t,n);default:return t}return t}function Pd(e,t){let r=[...t];for(let n of e)if(!r.some((i)=>Kn(i,n)))r.push(n);return r}function _d(e,t,r){if(t.length===0)return e;if(e.length===0)return t;if(ce(t[0])&&ce(e[0]))return Ld(e,t,r);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}function Ld(e,t,r){let n=[...t];for(let i of e){if(!ce(i)){n.push(i);continue}let o=["id","name","key","path","type"],s=!1;for(let c of o)if(c in i){if(n.find((l)=>ce(l)&&(c in l)&&l[c]===i[c])){s=!0;break}}if(!s)n.push(i)}return n}function Md(e,t,r,n){let i=t;if(ce(i)&&n.has(i))return n.get(i);let o={...e};if(ce(i))n.set(i,o);for(let s in i){if(!Object.prototype.hasOwnProperty.call(i,s))continue;let c=i[s],a=o[s];if(r.skipNullish&&(c===null||c===void 0))continue;if(c===null||c===void 0){o[s]=c;continue}if(ce(c)&&ce(a))o[s]=Es(a,c,r,n);else if(Array.isArray(c)||Array.isArray(a))o[s]=Ts(a,c,r.arrayMergeMode||"smart",n);else o[s]=c}return o}function si(e,t,r="replace"){return As(e,t,{arrayMergeMode:r==="replace"?"replace":"smart",skipNullish:!0})}function Kn(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(!Kn(e[r],t[r]))return!1;return!0}if(ce(e)&&ce(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(!Kn(e[i],t[i]))return!1}return!0}return!1}function ce(e){return Boolean(e&&typeof e==="object"&&!Array.isArray(e))}class Ir{extensions=[".ts",".js",".mjs",".cjs",".json",".mts",".cts"];async loadFromPath(e,t,r={}){let{arrayStrategy:n="replace",useCache:i=!0,cacheTtl:o,trackPerformance:s=!0,verbose:c=!1}=r;if(i){let l=dt.getWithFileCheck("file",e);if(l){if(c)console.log(`Configuration loaded from cache: ${e}`);return l}}let a=async()=>{if(!ir(e))return null;try{let l=`?t=${Date.now()}`,u=await import(e+l),f=u.default||u,d="default"in u,h=Object.keys(u).length>0;if(!d&&!h)throw new Ot(e,Error("Configuration file is empty and exports nothing"),"unknown");if(typeof f!=="object"||f===null||Array.isArray(f))throw new Ot(e,Error("Configuration must export a valid object"),"unknown");let p={config:si(t,f,n),source:{type:"file",path:e,priority:100,timestamp:new Date}};if(i)dt.setWithFileCheck("file",p,e,o);return p}catch(l){throw l instanceof Error?Fe.configLoad(e,l):Fe.configLoad(e,Error(String(l)))}};if(s)return Pt.track("loadFromPath",a,{path:e});return a()}async tryLoadFromPaths(e,t,r={}){for(let n of e)try{let i=await this.loadFromPath(n,t,r);if(i)return i}catch(i){if(i instanceof Error&&i.name==="ConfigLoadError")throw i;if(r.verbose)console.warn(`Failed to load config from ${n}:`,i)}return null}generateConfigPaths(e,t,r){let n=this.generateNamePatterns(e,r),i=[];for(let o of n)for(let s of this.extensions)i.push(In(t,`${o}${s}`));return i}generateNamePatterns(e,t){let r=[];if(r.push("config",".config"),e)r.push(e,`.${e}.config`,`${e}.config`,`.${e}`);if(t){if(r.push(t,`.${t}.config`,`${t}.config`,`.${t}`),e)r.push(`${e}.${t}.config`,`.${e}.${t}.config`)}return r.filter(Boolean)}checkFileAccess(e){return ks(async()=>ir(e),{maxRetries:2,retryDelay:100,fallback:!1})}async discoverConfigFiles(e,t,r){let n=[];if(!ir(e))return n;if(t||r){let i=this.generateNamePatterns(t||"",r);for(let o of i)for(let s of this.extensions){let c=In(e,`${o}${s}`);if(await this.checkFileAccess(c))n.push(c)}}else try{let{readdirSync:i}=await import("fs"),o=i(e);for(let s of o)if(this.looksLikeConfigFile(s)){let c=In(e,s);if(await this.checkFileAccess(c))n.push(c)}}catch{return[]}return n}looksLikeConfigFile(e){return[/\.config\.(ts|js|mjs|cjs|json|mts|cts)$/,/^\..*\.(ts|js|mjs|cjs|json|mts|cts)$/,/config\.(ts|js|mjs|cjs|json|mts|cts)$/].some((r)=>r.test(e))}async validateConfigFile(e){let t=[];try{if(!ir(e))return t.push("Configuration file does not exist"),t;let r=await import(e),n=r.default||r;if(n===void 0)t.push("Configuration file must export a default value or named exports");else if(typeof n!=="object"||n===null)t.push("Configuration must be an object");else if(Array.isArray(n))t.push("Configuration cannot be an array at the root level");if(e.endsWith(".json"))try{let{readFileSync:i}=await import("fs"),o=i(e,"utf8");JSON.parse(o)}catch(i){t.push(`Invalid JSON syntax: ${i}`)}}catch(r){t.push(`Failed to load configuration file: ${r}`)}return t}async getFileModificationTime(e){try{let{statSync:t}=await import("fs");return t(e).mtime}catch{return null}}async preloadConfigurations(e,t={}){let r=new Map;return await Promise.allSettled(e.map(async(n)=>{try{let i=await this.loadFromPath(n,{},t);if(i)r.set(n,i.config)}catch(i){if(t.verbose)console.warn(`Failed to preload ${n}:`,i)}})),r}}class ai{async validateConfiguration(e,t,r={}){let{stopOnFirstError:n=!1,validateRequired:i=!0,validateTypes:o=!0,customRules:s=[],trackPerformance:c=!0,verbose:a=!1}=r,l=async()=>{let u=[],f=[],d={stopOnFirstError:n,validateRequired:i,validateTypes:o,customRules:s,trackPerformance:c,verbose:a};try{if(typeof t==="string")return await this.validateWithSchemaFile(e,t,d);else if(Array.isArray(t))return this.validateWithRules(e,[...t,...s],d);else return this.validateWithJSONSchema(e,t,d)}catch(h){return u.push({path:"",message:`Validation failed: ${h}`,rule:"system"}),{isValid:!1,errors:u,warnings:f}}};if(c)return await Pt.track("validateConfiguration",l);return l()}async validateWithSchemaFile(e,t,r){try{if(!Xf(t))throw new It(t,[{path:"",message:"Schema file does not exist"}]);let n=await import(t),i=n.default||n;if(Array.isArray(i))return this.validateWithRules(e,i,r);else return this.validateWithJSONSchema(e,i,r)}catch(n){throw new It(t,[{path:"",message:`Failed to load schema: ${n}`}])}}validateWithJSONSchema(e,t,r){let n=[],i=[];return this.validateObjectAgainstSchema(e,t,"",n,i,r),{isValid:n.length===0,errors:n,warnings:i}}validateObjectAgainstSchema(e,t,r,n,i,o){if(o.validateTypes&&t.type){let s=Array.isArray(e)?"array":typeof e,c=Array.isArray(t.type)?t.type:[t.type];if(!c.includes(s)){if(n.push({path:r,message:`Expected type ${c.join(" or ")}, got ${s}`,expected:c.join(" or "),actual:s,rule:"type"}),o.stopOnFirstError)return}}if(t.enum&&!t.enum.includes(e)){if(n.push({path:r,message:`Value must be one of: ${t.enum.join(", ")}`,expected:t.enum.join(", "),actual:e,rule:"enum"}),o.stopOnFirstError)return}if(typeof e==="string"){if(t.minLength!==void 0&&e.length<t.minLength)n.push({path:r,message:`String length must be at least ${t.minLength}`,expected:`>= ${t.minLength}`,actual:e.length,rule:"minLength"});if(t.maxLength!==void 0&&e.length>t.maxLength)n.push({path:r,message:`String length must not exceed ${t.maxLength}`,expected:`<= ${t.maxLength}`,actual:e.length,rule:"maxLength"});if(t.pattern){if(!new RegExp(t.pattern).test(e))n.push({path:r,message:`String does not match pattern ${t.pattern}`,expected:t.pattern,actual:e,rule:"pattern"})}}if(typeof e==="number"){if(t.minimum!==void 0&&e<t.minimum)n.push({path:r,message:`Value must be at least ${t.minimum}`,expected:`>= ${t.minimum}`,actual:e,rule:"minimum"});if(t.maximum!==void 0&&e>t.maximum)n.push({path:r,message:`Value must not exceed ${t.maximum}`,expected:`<= ${t.maximum}`,actual:e,rule:"maximum"})}if(Array.isArray(e)&&t.items)for(let s=0;s<e.length;s++){let c=r?`${r}[${s}]`:`[${s}]`;if(this.validateObjectAgainstSchema(e[s],t.items,c,n,i,o),o.stopOnFirstError&&n.length>0)return}if(e&&typeof e==="object"&&!Array.isArray(e)){let s=e;if(o.validateRequired&&t.required){for(let c of t.required)if(!(c in s)){if(n.push({path:r?`${r}.${c}`:c,message:`Missing required property '${c}'`,expected:"required",rule:"required"}),o.stopOnFirstError)return}}if(t.properties){for(let[c,a]of Object.entries(t.properties))if(c in s){let l=r?`${r}.${c}`:c;if(this.validateObjectAgainstSchema(s[c],a,l,n,i,o),o.stopOnFirstError&&n.length>0)return}}if(t.additionalProperties===!1){let c=new Set(Object.keys(t.properties||{}));for(let a of Object.keys(s))if(!c.has(a))i.push({path:r?`${r}.${a}`:a,message:`Additional property '${a}' is not allowed`,rule:"additionalProperties"})}}}validateWithRules(e,t,r){let n=[],i=[];for(let o of t)try{let s=this.getValueByPath(e,o.path),c=this.validateWithRule(s,o,o.path);if(n.push(...c),r.stopOnFirstError&&n.length>0)break}catch(s){n.push({path:o.path,message:`Rule validation failed: ${s}`,rule:"system"})}return{isValid:n.length===0,errors:n,warnings:i}}validateWithRule(e,t,r){let n=[];if(t.required&&(e===void 0||e===null))return n.push({path:r,message:t.message||`Property '${r}' is required`,expected:"required",rule:"required"}),n;if(e===void 0||e===null)return n;if(t.type){let i=Array.isArray(e)?"array":typeof e;if(i!==t.type)n.push({path:r,message:t.message||`Expected type ${t.type}, got ${i}`,expected:t.type,actual:i,rule:"type"})}if(t.min!==void 0){let i=Array.isArray(e)?e.length:typeof e==="string"?e.length:typeof e==="number"?e:0;if(i<t.min)n.push({path:r,message:t.message||`Value must be at least ${t.min}`,expected:`>= ${t.min}`,actual:i,rule:"min"})}if(t.max!==void 0){let i=Array.isArray(e)?e.length:typeof e==="string"?e.length:typeof e==="number"?e:0;if(i>t.max)n.push({path:r,message:t.message||`Value must not exceed ${t.max}`,expected:`<= ${t.max}`,actual:i,rule:"max"})}if(t.pattern&&typeof e==="string"){if(!t.pattern.test(e))n.push({path:r,message:t.message||`Value does not match pattern ${t.pattern}`,expected:t.pattern.toString(),actual:e,rule:"pattern"})}if(t.enum&&!t.enum.includes(e))n.push({path:r,message:t.message||`Value must be one of: ${t.enum.join(", ")}`,expected:t.enum.join(", "),actual:e,rule:"enum"});if(t.validator){let i=t.validator(e);if(i)n.push({path:r,message:t.message||i,rule:"custom"})}return n}getValueByPath(e,t){if(!t)return e;let r=t.split("."),n=e;for(let i of r)if(n&&typeof n==="object"&&i in n)n=n[i];else return;return n}generateRulesFromInterface(e){let t=[],r=e.matchAll(/(\w+)(\?)?:\s*(\w+)/g);for(let n of r){let[,i,o,s]=n;t.push({path:i,required:!o,type:this.mapTypeScriptType(s)})}return t}mapTypeScriptType(e){switch(e.toLowerCase()){case"string":return"string";case"number":return"number";case"boolean":return"boolean";case"array":return"array";case"object":return"object";default:return"object"}}static createCommonRules(){return{server:[{path:"port",required:!0,type:"number",min:1,max:65535},{path:"host",required:!0,type:"string",min:1},{path:"ssl",type:"boolean"}],database:[{path:"url",required:!0,type:"string",min:1},{path:"pool",type:"number",min:1,max:100},{path:"timeout",type:"number",min:0}],api:[{path:"baseUrl",required:!0,type:"string",pattern:Ms},{path:"timeout",type:"number",min:0},{path:"retries",type:"number",min:0,max:10}]}}}class li{fileLoader=new Ir;envProcessor=new Or;validator=new ai;async loadConfig(e){let t=Date.now(),{cache:r,performance:n,schema:i,validate:o,...s}=e;try{if(r?.enabled){let a=this.checkCache(s.name||"",s);if(a)return a}let c;try{c=await this.loadConfigurationStrategies(s,!0,r)}catch(a){let l=s.__strictErrorHandling;if(a instanceof Error&&a.name==="ConfigNotFoundError"){if(l)throw a;c={...await this.applyEnvironmentVariables(s.name||"",s.defaultConfig,s.checkEnv!==!1,s.verbose||!1),warnings:[`No configuration file found for "${s.name||"config"}", using defaults with environment variables`]}}else if(a instanceof Error&&a.name==="ConfigLoadError"){let u=a.message.includes("EACCES")||a.message.includes("EPERM")||a.message.includes("permission denied"),f=!u&&(a.message.includes("syntax")||a.message.includes("Expected")||a.message.includes("Unexpected")||a.message.includes("BuildMessage")||a.message.includes("errors building")),d=a.message.includes("Configuration must export a valid object")||a.message.includes("Configuration file is empty and exports nothing");if(l&&(d||u))throw a;if(f&&(!l||!d))c={...await this.applyEnvironmentVariables(s.name||"",s.defaultConfig,s.checkEnv!==!1,s.verbose||!1),warnings:["Configuration file has syntax errors, using defaults with environment variables"]};else if(!l)c={...await this.applyEnvironmentVariables(s.name||"",s.defaultConfig,s.checkEnv!==!1,s.verbose||!1),warnings:[`Configuration loading error, using defaults: ${a.message}`]};else throw a}else c={...await this.applyEnvironmentVariables(s.name||"",s.defaultConfig,s.checkEnv!==!1,s.verbose||!1),warnings:[`Configuration loading failed, using defaults: ${a instanceof Error?a.message:String(a)}`]}}if(i||o)await this.validateConfiguration(c.config,i,o,s.name);if(r?.enabled&&c)this.cacheResult(s.name||"",c,r,s);if(n?.enabled){let a={operation:"loadConfig",duration:Date.now()-t,configName:s.name,timestamp:new Date};if(n.onMetrics)n.onMetrics(a);if(n.slowThreshold&&a.duration>n.slowThreshold)ge.warn(`Slow configuration loading detected: ${a.duration}ms for ${s.name}`);c.metrics=a}return c}catch(c){let a=Date.now()-t;throw ge.error(`Configuration loading failed after ${a}ms:`,[c instanceof Error?c:Error(String(c))]),c}}async loadConfigurationStrategies(e,t=!1,r){let{name:n="",alias:i,cwd:o,configDir:s,defaultConfig:c,checkEnv:a=!0,arrayStrategy:l="replace",verbose:u=!1}=e,f=o||Ge.cwd(),d=[],h=await this.loadLocalConfiguration(n,i,f,s,c,l,u,a,r);if(h)return d.push(...this.getLocalSearchPaths(n,i,f,s)),this.finalizeResult(h,d,a,n,u);let m=await this.loadHomeConfiguration(n,i,c,l,u,a);if(m)return d.push(...this.getHomeSearchPaths(n,i)),this.finalizeResult(m,d,a,n,u);let g=await this.loadPackageJsonConfiguration(n,i,f,c,l,u,a);if(g)return d.push(ne(f,"package.json")),this.finalizeResult(g,d,a,n,u);if(d.push(...this.getAllSearchPaths(n,i,f,s)),t)throw Fe.configNotFound(n,d,i);return{...await this.applyEnvironmentVariables(n,c,a,u),warnings:[`No configuration file found for "${n}"${i?` or alias "${i}"`:""}, using defaults with environment variables`]}}async loadLocalConfiguration(e,t,r,n,i,o,s,c,a){let l=c?Tt(e,i,s):i,u=this.getLocalDirectories(r,n);for(let f of u){if(s)ge.info(`Searching for configuration in: ${f}`);let d=this.fileLoader.generateConfigPaths(e,f,t),h=await this.fileLoader.tryLoadFromPaths(d,l,{arrayStrategy:o,verbose:s,cacheTtl:a?.ttl,useCache:!a?.ttl||a.ttl>100});if(h){if(s)ge.success(`Configuration loaded from: ${h.source.path}`);return h}}return null}async loadHomeConfiguration(e,t,r,n,i,o){if(!e)return null;let s=o?Tt(e,r,i):r,c=[ne(rt(),".config",e),ne(rt(),".config"),rt()];for(let a of c){if(i)ge.info(`Checking home directory: ${a}`);let l=this.fileLoader.generateConfigPaths(e,a,t),u=await this.fileLoader.tryLoadFromPaths(l,s,{arrayStrategy:n,verbose:i});if(u){if(i)ge.success(`Configuration loaded from home directory: ${u.source.path}`);return u}}return null}async loadPackageJsonConfiguration(e,t,r,n,i,o,s){let c=s?Tt(e,n,o):n;try{let a=ne(r,"package.json");if(!Wn(a))return null;let l=await import(a),u=l[e],f=e;if(!u&&t)u=l[t],f=t;if(u&&typeof u==="object"&&!Array.isArray(u)){if(o)ge.success(`Configuration loaded from package.json: ${f}`);return{config:si(c,u,i),source:{type:"package.json",path:a,priority:30,timestamp:new Date}}}}catch(a){if(o)ge.warn("Failed to load package.json:",[a instanceof Error?a:Error(String(a))])}return null}async applyEnvironmentVariables(e,t,r,n){if(!r||!e||typeof t!=="object"||t===null||Array.isArray(t))return{config:t,source:{type:"default",priority:10,timestamp:new Date}};return{config:Tt(e,t,n),source:{type:"environment",priority:20,timestamp:new Date}}}async finalizeResult(e,t,r,n,i){return{config:e.config,source:e.source,path:e.source.path}}async validateConfiguration(e,t,r,n){let i=[];if(r){let o=r(e);if(o)i.push(...o)}if(t){let o=await this.validator.validateConfiguration(e,t);if(!o.isValid)i.push(...o.errors.map((s)=>s.path?`${s.path}: ${s.message}`:s.message))}if(i.length>0)throw Fe.configValidation(n||"unknown",i,n)}checkCache(e,t){let r=this.generateCacheKey(e,t);return dt.get(r)||null}cacheResult(e,t,r,n){let i=this.generateCacheKey(e,n);dt.set(i,t,void 0,r.ttl)}generateCacheKey(e,t){let r=[e];if(t.alias)r.push(`alias:${t.alias}`);if(t.cwd)r.push(`cwd:${t.cwd}`);if(t.configDir)r.push(`configDir:${t.configDir}`);if("checkEnv"in t)r.push(`checkEnv:${t.checkEnv}`);return r.join("|")}getLocalDirectories(e,t){return Array.from(new Set([e,ne(e,"config"),ne(e,".config"),t?ne(e,t):void 0].filter(Boolean)))}getAllSearchPaths(e,t,r,n){let i=[];return i.push(...this.getLocalSearchPaths(e,t,r,n)),i.push(...this.getHomeSearchPaths(e,t)),i.push(ne(r,"package.json")),i}getLocalSearchPaths(e,t,r,n){let i=this.getLocalDirectories(r,n),o=[];for(let s of i)o.push(...this.fileLoader.generateConfigPaths(e,s,t));return o}getHomeSearchPaths(e,t){if(!e)return[];let r=[ne(rt(),".config",e),ne(rt(),".config"),rt()],n=[];for(let i of r)n.push(...this.fileLoader.generateConfigPaths(e,i,t));return n}async loadConfigWithResult(e){return this.loadConfig(e)}}function rs(e){let r=!(e.message.includes("EACCES")||e.message.includes("EPERM")||e.message.includes("permission denied"))&&(e.message.includes("syntax")||e.message.includes("Expected")||e.message.includes("Unexpected")||e.message.includes("BuildMessage")),n=e.message.includes("Configuration must export a valid object")||e.message.includes("Configuration file is empty and exports nothing");return r||n}async function Fd(e){return Ne.loadConfig({...e,__strictErrorHandling:!0})}async function Ns(e){let t="defaultConfig"in e&&e.defaultConfig!==void 0?e.defaultConfig:{},r="cache"in e||"performance"in e||"schema"in e||"validate"in e;try{let n;if(r)n=await Ne.loadConfig(e);else n=await Ne.loadConfig({...e,defaultConfig:t,cache:{enabled:!0},performance:{enabled:!1}});return n?.config??t}catch(n){let i=n instanceof Error?n.name:"UnknownError",o=n instanceof Error?n.message:String(n);if(!(i==="ConfigNotFoundError"||i==="ConfigLoadError"||i==="ConfigValidationError"||o.includes("config"))&&e.verbose)ge.warn("Unexpected error loading config, using defaults:",[n instanceof Error?n:Error(String(n))]);let c=r?{...e,defaultConfig:t}:{...e,defaultConfig:t,cache:{enabled:!0},performance:{enabled:!1}};if("checkEnv"in e?e.checkEnv!==!1:!0)return(await Ne.applyEnvironmentVariables(c.name||"",t,!0,c.verbose||!1))?.config??t;return t}}async function Dd(e={defaultConfig:{}}){if(typeof e==="string"){let{cwd:t}=await import("process");try{return(await Ne.loadConfig({name:e,cwd:t(),generatedDir:"./generated",configDir:"./config",defaultConfig:{},checkEnv:!0,arrayStrategy:"replace"})).config}catch(r){if(r instanceof Error&&(r.name==="ConfigNotFoundError"||r.name==="ConfigLoadError"&&rs(r)))return(await Ne.applyEnvironmentVariables(e,{},!0,!1)).config;throw r}}try{return(await Ne.loadConfig({...e,cwd:e.cwd||Ge.cwd(),cache:{enabled:!0},performance:{enabled:!1}})).config}catch(t){if(t instanceof Error&&(t.name==="ConfigNotFoundError"||t.name==="ConfigLoadError"&&rs(t)))return(await Ne.applyEnvironmentVariables(e.name||"",e.defaultConfig||{},e.checkEnv!==!1,e.verbose||!1)).config;throw t}}async function jd(e,t,r="replace"){let n=new Ir;try{let i=await n.loadFromPath(e,t,{arrayStrategy:r,useCache:!1,trackPerformance:!1});return i?i.config:null}catch{return null}}function Tt(e,t,r=!1){let n=new Or,i=e.toUpperCase().replace(/[^A-Z0-9]/g,"_");function o(s,c=[]){let a={...s};for(let[l,u]of Object.entries(s)){let f=[...c,l],d=[`${i}_${f.join("_").toUpperCase()}`,`${i}_${f.map((g)=>g.toUpperCase()).join("")}`,`${i}_${f.map((g)=>g.replace(/([A-Z])/g,"_$1").toUpperCase()).join("")}`],h,m;for(let g of d)if(h=Ge.env[g],h!==void 0){m=g;break}if(h!==void 0&&m)if(typeof u==="boolean")a[l]=["true","1","yes"].includes(h.toLowerCase());else if(typeof u==="number"){let g=Number(h);if(!Number.isNaN(g))a[l]=g}else if(Array.isArray(u))try{a[l]=JSON.parse(h)}catch{a[l]=h.split(",").map((g)=>g.trim())}else a[l]=h;else if(u&&typeof u==="object"&&!Array.isArray(u))a[l]=o(u,f)}return a}return o(t)}function Bd(e){let t=ne(Ge.cwd(),e.configDir),r=ne(Ge.cwd(),e.generatedDir),n=ne(r,"config-types.ts");if(!Wn(Po(n)))Ef(Po(n),{recursive:!0,mode:511});let i=Wn(t)?Tf(t).map((s)=>s.replace(/\.(ts|js|mjs|cjs|mts|cts|json)$/,"")).sort():[],o=`// Generated by bunfig v${mh}
|
|
33
33
|
export type ConfigNames = ${i.length?`'${i.join("' | '")}'`:"string"}
|
|
34
|
-
`;
|
|
35
|
-
${i.map((l)=>{let u=
|
|
34
|
+
`;Nf(n,o,{mode:438})}function Ud(e){let t=null,r=null,n=()=>{if(!r)r=Ns(e).then((o)=>(t=o,o),(o)=>{let s="defaultConfig"in e?e.defaultConfig:{};if(t=s,"verbose"in e&&e.verbose)ge.warn("Config loading failed, using defaults:",[o instanceof Error?o:Error(String(o))]);return s});return r},i="defaultConfig"in e?e.defaultConfig:{};return t=i,n(),new Proxy({},{get(o,s){if(t)return t[s];let c=i[s];return n(),c},has(o,s){return s in(t||i)},ownKeys(){return Object.keys(t||i)},getOwnPropertyDescriptor(o,s){return Object.getOwnPropertyDescriptor(t||i,s)},set(o,s,c){if(!t)t={...i};return t[s]=c,!0}})}function Vd(e){let t=qo(ed.cwd(),e?.configDir||"./config");function r(){if(!Zf(t))return[];let i=new Set([".ts",".js",".mjs",".cjs",".mts",".cts",".json"]),o=[".ts",".mts",".cts",".js",".mjs",".cjs",".json"],s=Qf(t).filter((a)=>i.has(Pn(a))).map((a)=>({base:a.replace(/\.(?:ts|js|mjs|cjs|mts|cts|json)$/i,""),file:a})),c=new Map;for(let{base:a,file:l}of s){let u=Pn(l).toLowerCase(),f=c.get(a);if(!f){c.set(a,l);continue}let d=Pn(f).toLowerCase();if(o.indexOf(u)<o.indexOf(d))c.set(a,l)}return Array.from(c.entries()).map(([a,l])=>({base:a,file:l})).sort((a,l)=>a.base.localeCompare(l.base))}function n(){let i=r(),o=i.map((l)=>l.base),s=o.length?o.map((l)=>`'${l}'`).join(" | "):"string",c=i.length?`{
|
|
35
|
+
${i.map((l)=>{let u=qo(t,l.file).replace(/\\/g,"/");return` '${l.base}': typeof import('${u}').default`}).join(`,
|
|
36
36
|
`)}
|
|
37
37
|
}`:"Record<string, any>";return`export type ConfigNames = ${s}
|
|
38
38
|
export type ConfigByName = ${c}
|
|
39
39
|
export type Config<N extends ConfigNames> = N extends keyof ConfigByName ? ConfigByName[N] : unknown
|
|
40
40
|
export type ConfigOf = Config
|
|
41
|
-
`}return{name:"bunfig-plugin",setup(i){i.onResolve({filter:/^virtual:bunfig-types$/},(o)=>({path:o.path,namespace:"bunfig-virtual"})),i.onLoad({filter:/^virtual:bunfig-types$/,namespace:"bunfig-virtual"},()=>({contents:n(),loader:"ts"}))}}}function gh(e,t={}){let r=br.cwd();while(r.includes("storage"))r=Ho(r,"..");let n=Ho(r,e||"");if(t?.relative)return Qf(br.cwd(),n);return n}function G(){if(Te.env.NODE_ENV==="test"||Te.env.BUN_ENV==="test")return!1;return typeof window<"u"}async function ph(){if(Te.env.NODE_ENV==="test"||Te.env.BUN_ENV==="test")return!0;if(typeof navigator<"u"&&navigator.product==="ReactNative")return!0;if(typeof Te<"u"){let e=Te.type;if(e==="renderer"||e==="worker")return!1;return!!(Te.versions&&(Te.versions.node||Te.versions.bun))}return!1}class Fs{async format(e){let t=await ph(),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:ut.pid,hostname:t(),environment:ut.env.NODE_ENV||"development",platform:ut.platform,version:ut.version}}return{userAgent:navigator.userAgent,hostname:window.location.hostname||"browser",environment:ut.env.NODE_ENV||ut.env.BUN_ENV||"development",viewport:{width:window.innerWidth,height:window.innerHeight},language:navigator.language}}}class Or{name;fileLocks=new Map;currentKeyId=null;keys=new Map;fingersCrossedConfig;fingersCrossedActive=!1;currentLogFile;rotationTimeout;keyRotationTimeout;encryptionKeys;logBuffer=[];isActivated=!1;pendingOperations=[];enabled;fancy;tagFormat;timestampPosition;environment;config;options;formatter;timers=new Set;subLoggers=new Set;fingersCrossedBuffer=[];ANSI_PATTERN=/\u001B\[.*?m/g;activeProgressBar=null;constructor(e,t={}){this.name=e,this.config={...kr},this.options=this.normalizeOptions(t),this.formatter=this.options.formatter||new Fs,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??O.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,level:this.options.level??"info"},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()}}shouldActivateFingersCrossed(e){if(!this.fingersCrossedConfig)return!1;let t={debug:0,info:1,success:2,warning:3,error:4},r=this.fingersCrossedConfig.activationLevel??"error";return t[e]>=t[r]}initializeFingersCrossedConfig(e){if(!e.fingersCrossedEnabled&&e.fingersCrossed)return{...Dn,...e.fingersCrossed};if(!e.fingersCrossedEnabled)return null;if(!e.fingersCrossed)return{...Dn};return{...Dn,...e.fingersCrossed}}normalizeOptions(e){let t={format:"json",level:"info",logDirectory:kr.logDirectory,rotation:void 0,timestamp:void 0,fingersCrossed:{},enabled:!0,showTags:!1,showIcons:!0,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}shouldWriteToFile(){return!G()&&this.config.writeToFile===!0}async writeToFile(e){let r=(async()=>{let i,o=0,s=3,c=1000;while(o<s)try{try{try{await id(this.config.logDirectory,Jo.F_OK|Jo.W_OK)}catch(l){if(l instanceof Error&&"code"in l)if(l.code==="ENOENT")await od(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:Se.from(e);try{if(!nr(this.currentLogFile))await Pn(this.currentLogFile,"",{mode:420});if(i=Yo(this.currentLogFile,"a",420),nd(i,a,{flag:"a"}),qo(i),i!==void 0)In(i),i=void 0;if((await lt(this.currentLogFile)).size===0){if(await Pn(this.currentLogFile,a,{flag:"w",mode:420}),(await lt(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{In(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 ct(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 ct(this.config.logDirectory,`${this.name}.log`);let e=new Date().toISOString().split("T")[0];return ct(this.config.logDirectory,`${this.name}-${e}.log`)}setupRotation(){if(G())return;if(!this.shouldWriteToFile())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 On(16).toString("hex")}generateKey(){return On(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=On(16),n=ed("aes-256-gcm",t,r),i=Se.isBuffer(e)?e:Se.from(e,"utf8"),o=n.update(i),s=n.final(),c=o.length+s.length,a=n.getAuthTag(),l=Se.allocUnsafe(16+c+16);return r.copy(l,0),o.copy(l,16),s.copy(l,16+o.length),a.copy(l,16+c),{encrypted:l,iv:r}}async compressData(e){return new Promise((t,r)=>{let n=Zo(),i=[];n.on("data",(o)=>i.push(o)),n.on("end",()=>t(Se.from(Se.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(G())return;if(!this.shouldWriteToFile())return;let e=await lt(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 ir(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 lt(r).catch(()=>null))try{if(await Xo(r,c),t.compress)try{let a=`${c}.gz`;await this.compressLogFile(c,a),await or(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 Pn(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 lt(r).catch(()=>null))await Xo(r,o)}if(this.currentLogFile=n,t.maxFiles){let o=(await ir(this.config.logDirectory)).filter((s)=>s.startsWith(this.name)).sort((s,c)=>c.localeCompare(s));for(let s of o.slice(t.maxFiles))await or(ct(this.config.logDirectory,s))}}}async compressLogFile(e,t){let r=Go(e),n=rd(t),i=Zo();await ld(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);if(this.shouldWriteToFile())await this.writeToFile(n);console.log(n)}if(this.fingersCrossedConfig.stopBuffering)this.logBuffer=[]}if(this.isActivated){if(this.shouldWriteToFile())await this.writeToFile(t);console.log(t)}}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()})),nr(this.currentLogFile))try{let e=Yo(this.currentLogFile,"r+");qo(e),In(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(!G()&&this.config.rotation&&typeof this.config.rotation!=="boolean"&&this.config.rotation.compress)try{let t=(await ir(this.config.logDirectory)).filter((r)=>(r.includes("temp")||r.includes(".tmp"))&&r.includes(this.name));for(let r of t)try{await or(ct(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.shouldStyleConsole()?E.gray(e.toLocaleTimeString()):e.toLocaleTimeString()}shouldStyleConsole(){if(!this.fancy||G())return!1;let e=typeof O.env.NO_COLOR<"u",t=O.env.FORCE_COLOR==="0";if(e||t)return!1;return!!(typeof O.stderr<"u"&&O.stderr.isTTY||typeof O.stdout<"u"&&O.stdout.isTTY)}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=O.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} ${E.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}formatMarkdown(e){if(!e)return e;let t=e;return t=t.replace(/\[([^\]]+)\]\(([^)]+)\)/g,(r,n,i)=>{let o=E.underline(E.blue(n)),s=this.toAbsoluteFilePath(i);if(s&&this.shouldStyleConsole()&&this.supportsHyperlinks()){let c=`file://${encodeURI(s)}`,a="\x1B]8;;",l="\x1B\\";return`\x1B]8;;${c}\x1B\\${o}\x1B]8;;\x1B\\`}if(this.shouldStyleConsole()&&this.supportsHyperlinks())return`\x1B]8;;${i}\x1B\\${o}\x1B]8;;\x1B\\`;return o}),t=t.replace(/`([^`]+)`/g,(r,n)=>E.bgGray(n)),t=t.replace(/\*\*([^*]+)\*\*/g,(r,n)=>E.bold(n)),t=t.replace(/(?<!\*)\*([^*]+)\*(?!\*)/g,(r,n)=>E.italic(n)),t=t.replace(/(?<!_)_([^_]+)_(?!_)/g,(r,n)=>E.italic(n)),t=t.replace(/~([^~]+)~/g,(r,n)=>E.strikethrough(n)),t}supportsHyperlinks(){if(G())return!1;let e=O.env;if(!e)return!1;if(e.TERM_PROGRAM==="iTerm.app"||e.TERM_PROGRAM==="vscode"||e.TERM_PROGRAM==="WezTerm")return!0;if(e.WT_SESSION)return!0;if(e.TERM==="xterm-kitty")return!0;let t=e.VTE_VERSION?Number.parseInt(e.VTE_VERSION,10):0;if(!Number.isNaN(t)&&t>=5000)return!0;return!1}toAbsoluteFilePath(e){try{let t=e;if(t.startsWith("file://"))t=t.replace(/^file:\/\//,"");if(t.startsWith("~")){let r=O.env.HOME||"";if(r)t=t.replace(/^~(?=$|\/)/,r)}if(sd(t)||t.startsWith("./")||t.startsWith("../"))t=ad(t);else return null;return nr(t)?t:null}catch{return null}}buildOutputTexts(e){let t=this.shouldStyleConsole()?this.formatMarkdown(e):e,r=e.replace(this.ANSI_PATTERN,"");return{consoleText:t,fileText:r}}async log(e,t,...r){if(!this.shouldLog(e))return;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);let{consoleText:a,fileText:l}=this.buildOutputTexts(s);if(this.shouldStyleConsole()){let f=this.options.showIcons===!1?"":wh[e],d=this.options.showTags!==!1&&this.name?E.gray(this.formatTag(this.name)):"",h;switch(e){case"debug":h=this.formatConsoleMessage({timestamp:i,icon:f,tag:d,message:E.gray(a),level:e}),console.error(h);break;case"info":h=this.formatConsoleMessage({timestamp:i,icon:f,tag:d,message:a,level:e}),console.warn(h);break;case"success":h=this.formatConsoleMessage({timestamp:i,icon:f,tag:d,message:E.green(a),level:e}),console.error(h);break;case"warning":h=this.formatConsoleMessage({timestamp:i,icon:f,tag:d,message:a,level:e}),console.warn(h);break;case"error":if(h=this.formatConsoleMessage({timestamp:i,icon:f,tag:d,message:a,level:e}),console.error(h),c){let m=c.split(`
|
|
41
|
+
`}return{name:"bunfig-plugin",setup(i){i.onResolve({filter:/^virtual:bunfig-types$/},(o)=>({path:o.path,namespace:"bunfig-virtual"})),i.onLoad({filter:/^virtual:bunfig-types$/,namespace:"bunfig-virtual"},()=>({contents:n(),loader:"ts"}))}}}function yh(e,t={}){let r=vr.cwd();while(r.includes("storage"))r=Yo(r,"..");let n=Yo(r,e||"");if(t?.relative)return rd(vr.cwd(),n);return n}function G(){if(Te.env.NODE_ENV==="test"||Te.env.BUN_ENV==="test")return!1;return typeof window<"u"}async function xh(){if(Te.env.NODE_ENV==="test"||Te.env.BUN_ENV==="test")return!0;if(typeof navigator<"u"&&navigator.product==="ReactNative")return!0;if(typeof Te<"u"){let e=Te.type;if(e==="renderer"||e==="worker")return!1;return!!(Te.versions&&(Te.versions.node||Te.versions.bun))}return!1}class Bs{async format(e){let t=await xh(),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:ft.pid,hostname:t(),environment:ft.env.NODE_ENV||"development",platform:ft.platform,version:ft.version}}return{userAgent:navigator.userAgent,hostname:window.location.hostname||"browser",environment:ft.env.NODE_ENV||ft.env.BUN_ENV||"development",viewport:{width:window.innerWidth,height:window.innerHeight},language:navigator.language}}}class Pr{name;fileLocks=new Map;currentKeyId=null;keys=new Map;fingersCrossedConfig;fingersCrossedActive=!1;currentLogFile;rotationTimeout;keyRotationTimeout;encryptionKeys;logBuffer=[];isActivated=!1;pendingOperations=[];enabled;fancy;tagFormat;timestampPosition;environment;config;options;formatter;timers=new Set;subLoggers=new Set;fingersCrossedBuffer=[];ANSI_PATTERN=/\u001B\[.*?m/g;activeProgressBar=null;constructor(e,t={}){this.name=e,this.config={...Ar},this.options=this.normalizeOptions(t),this.formatter=this.options.formatter||new Bs,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??O.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,level:this.options.level??"info"},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()}}shouldActivateFingersCrossed(e){if(!this.fingersCrossedConfig)return!1;let t={debug:0,info:1,success:2,warning:3,error:4},r=this.fingersCrossedConfig.activationLevel??"error";return t[e]>=t[r]}initializeFingersCrossedConfig(e){if(!e.fingersCrossedEnabled&&e.fingersCrossed)return{...Un,...e.fingersCrossed};if(!e.fingersCrossedEnabled)return null;if(!e.fingersCrossed)return{...Un};return{...Un,...e.fingersCrossed}}normalizeOptions(e){let t={format:"json",level:"info",logDirectory:Ar.logDirectory,rotation:void 0,timestamp:void 0,fingersCrossed:{},enabled:!0,showTags:!1,showIcons:!0,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}shouldWriteToFile(){return!G()&&this.config.writeToFile===!0}async writeToFile(e){let r=(async()=>{let i,o=0,s=3,c=1000;while(o<s)try{try{try{await ad(this.config.logDirectory,Qo.F_OK|Qo.W_OK)}catch(l){if(l instanceof Error&&"code"in l)if(l.code==="ENOENT")await ld(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:Se.from(e);try{if(!or(this.currentLogFile))await Mn(this.currentLogFile,"",{mode:420});if(i=Zo(this.currentLogFile,"a",420),sd(i,a,{flag:"a"}),Xo(i),i!==void 0)Ln(i),i=void 0;if((await ct(this.currentLogFile)).size===0){if(await Mn(this.currentLogFile,a,{flag:"w",mode:420}),(await ct(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{Ln(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 ut(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 ut(this.config.logDirectory,`${this.name}.log`);let e=new Date().toISOString().split("T")[0];return ut(this.config.logDirectory,`${this.name}-${e}.log`)}setupRotation(){if(G())return;if(!this.shouldWriteToFile())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 _n(16).toString("hex")}generateKey(){return _n(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=_n(16),n=nd("aes-256-gcm",t,r),i=Se.isBuffer(e)?e:Se.from(e,"utf8"),o=n.update(i),s=n.final(),c=o.length+s.length,a=n.getAuthTag(),l=Se.allocUnsafe(16+c+16);return r.copy(l,0),o.copy(l,16),s.copy(l,16+o.length),a.copy(l,16+c),{encrypted:l,iv:r}}async compressData(e){return new Promise((t,r)=>{let n=ts(),i=[];n.on("data",(o)=>i.push(o)),n.on("end",()=>t(Se.from(Se.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(G())return;if(!this.shouldWriteToFile())return;let e=await ct(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 sr(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 ct(r).catch(()=>null))try{if(await es(r,c),t.compress)try{let a=`${c}.gz`;await this.compressLogFile(c,a),await ar(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 Mn(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 ct(r).catch(()=>null))await es(r,o)}if(this.currentLogFile=n,t.maxFiles){let o=(await sr(this.config.logDirectory)).filter((s)=>s.startsWith(this.name)).sort((s,c)=>c.localeCompare(s));for(let s of o.slice(t.maxFiles))await ar(ut(this.config.logDirectory,s))}}}async compressLogFile(e,t){let r=Jo(e),n=od(t),i=ts();await fd(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);if(this.shouldWriteToFile())await this.writeToFile(n);console.log(n)}if(this.fingersCrossedConfig.stopBuffering)this.logBuffer=[]}if(this.isActivated){if(this.shouldWriteToFile())await this.writeToFile(t);console.log(t)}}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()})),or(this.currentLogFile))try{let e=Zo(this.currentLogFile,"r+");Xo(e),Ln(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(!G()&&this.config.rotation&&typeof this.config.rotation!=="boolean"&&this.config.rotation.compress)try{let t=(await sr(this.config.logDirectory)).filter((r)=>(r.includes("temp")||r.includes(".tmp"))&&r.includes(this.name));for(let r of t)try{await ar(ut(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.shouldStyleConsole()?E.gray(e.toLocaleTimeString()):e.toLocaleTimeString()}shouldStyleConsole(){if(!this.fancy||G())return!1;let e=typeof O.env.NO_COLOR<"u",t=O.env.FORCE_COLOR==="0";if(e||t)return!1;return!!(typeof O.stderr<"u"&&O.stderr.isTTY||typeof O.stdout<"u"&&O.stdout.isTTY)}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=O.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} ${E.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}formatMarkdown(e){if(!e)return e;let t=e;return t=t.replace(/\[([^\]]+)\]\(([^)]+)\)/g,(r,n,i)=>{let o=E.underline(E.blue(n)),s=this.toAbsoluteFilePath(i);if(s&&this.shouldStyleConsole()&&this.supportsHyperlinks()){let c=`file://${encodeURI(s)}`,a="\x1B]8;;",l="\x1B\\";return`\x1B]8;;${c}\x1B\\${o}\x1B]8;;\x1B\\`}if(this.shouldStyleConsole()&&this.supportsHyperlinks())return`\x1B]8;;${i}\x1B\\${o}\x1B]8;;\x1B\\`;return o}),t=t.replace(/`([^`]+)`/g,(r,n)=>E.bgGray(n)),t=t.replace(/\*\*([^*]+)\*\*/g,(r,n)=>E.bold(n)),t=t.replace(/(?<!\*)\*([^*]+)\*(?!\*)/g,(r,n)=>E.italic(n)),t=t.replace(/(?<!_)_([^_]+)_(?!_)/g,(r,n)=>E.italic(n)),t=t.replace(/~([^~]+)~/g,(r,n)=>E.strikethrough(n)),t}supportsHyperlinks(){if(G())return!1;let e=O.env;if(!e)return!1;if(e.TERM_PROGRAM==="iTerm.app"||e.TERM_PROGRAM==="vscode"||e.TERM_PROGRAM==="WezTerm")return!0;if(e.WT_SESSION)return!0;if(e.TERM==="xterm-kitty")return!0;let t=e.VTE_VERSION?Number.parseInt(e.VTE_VERSION,10):0;if(!Number.isNaN(t)&&t>=5000)return!0;return!1}toAbsoluteFilePath(e){try{let t=e;if(t.startsWith("file://"))t=t.replace(/^file:\/\//,"");if(t.startsWith("~")){let r=O.env.HOME||"";if(r)t=t.replace(/^~(?=$|\/)/,r)}if(cd(t)||t.startsWith("./")||t.startsWith("../"))t=ud(t);else return null;return or(t)?t:null}catch{return null}}buildOutputTexts(e){let t=this.shouldStyleConsole()?this.formatMarkdown(e):e,r=e.replace(this.ANSI_PATTERN,"");return{consoleText:t,fileText:r}}async log(e,t,...r){if(!this.shouldLog(e))return;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);let{consoleText:a,fileText:l}=this.buildOutputTexts(s);if(this.shouldStyleConsole()){let f=this.options.showIcons===!1?"":Rh[e],d=this.options.showTags!==!1&&this.name?E.gray(this.formatTag(this.name)):"",h;switch(e){case"debug":h=this.formatConsoleMessage({timestamp:i,icon:f,tag:d,message:E.gray(a),level:e}),console.error(h);break;case"info":h=this.formatConsoleMessage({timestamp:i,icon:f,tag:d,message:a,level:e}),console.warn(h);break;case"success":h=this.formatConsoleMessage({timestamp:i,icon:f,tag:d,message:E.green(a),level:e}),console.error(h);break;case"warning":h=this.formatConsoleMessage({timestamp:i,icon:f,tag:d,message:a,level:e}),console.warn(h);break;case"error":if(h=this.formatConsoleMessage({timestamp:i,icon:f,tag:d,message:a,level:e}),console.error(h),c){let m=c.split(`
|
|
42
42
|
`);for(let g of m)if(g.trim()&&!g.includes(s))console.error(this.formatConsoleMessage({timestamp:i,message:E.gray(` ${g}`),level:e,showTimestamp:!1}))}break}}else if(!G()){if(console.error(`${o} ${this.environment}.${e.toUpperCase()}: ${s}`),c)console.error(c)}let u=`${o} ${this.environment}.${e.toUpperCase()}: ${l}
|
|
43
43
|
`;if(c)u+=`${c}
|
|
44
44
|
`;if(u=u.replace(this.ANSI_PATTERN,""),this.shouldWriteToFile())await this.writeToFile(u)}progress(e,t=""){let r={update:(c,a)=>{},finish:(c)=>{},interrupt:(c,a)=>{}};if(!this.enabled)return r;let n=30;if(this.activeProgressBar={total:Math.max(1,e||1),current:0,message:t||"",barLength:n,lastRenderedLine:""},this.shouldStyleConsole()&&!G()&&O.stdout.isTTY)this.renderProgressBar(this.activeProgressBar);return{update:(c,a)=>{if(!this.enabled||!this.activeProgressBar)return;if(this.activeProgressBar.current=Math.min(Math.max(0,c),this.activeProgressBar.total),a!==void 0)this.activeProgressBar.message=a;if(this.shouldStyleConsole()&&!G()&&O.stdout.isTTY)this.renderProgressBar(this.activeProgressBar)},finish:(c)=>{if(!this.activeProgressBar)return;this.finishProgressBar(this.activeProgressBar,c)},interrupt:(c,a="info")=>{if(!G()&&O.stdout.isTTY)O.stdout.write(`
|
|
45
45
|
`);if(this[a==="warning"?"warn":a](c),this.activeProgressBar&&this.shouldStyleConsole()&&!G()&&O.stdout.isTTY)this.renderProgressBar(this.activeProgressBar)}}}time(e){let t=performance.now();if(this.shouldStyleConsole()){let r=this.options.showTags!==!1&&this.name?E.gray(this.formatTag(this.name)):"",n=this.formatConsoleTimestamp(new Date);console.error(this.formatConsoleMessage({timestamp:n,icon:this.options.showIcons===!1?"":E.blue("\u25D0"),tag:r,message:`${E.cyan(e)}...`}))}return async(r)=>{if(!this.enabled)return;let n=performance.now(),i=Math.round(n-t),o=`${e} completed in ${i}ms`,s=new Date,c=this.formatConsoleTimestamp(s),l=`${this.formatFileTimestamp(s)} ${this.environment}.INFO: ${o}`;if(r)l+=` ${JSON.stringify(r)}`;if(l+=`
|
|
46
|
-
`,l=l.replace(this.ANSI_PATTERN,""),this.shouldStyleConsole()){let u=this.options.showTags!==!1&&this.name?E.gray(this.formatTag(this.name)):"";console.error(this.formatConsoleMessage({timestamp:c,icon:this.options.showIcons===!1?"":E.green("\u2713"),tag:u,message:`${o}${r?` ${JSON.stringify(r)}`:""}`}))}else if(!G())console.error(l.trim());if(this.shouldWriteToFile())await this.writeToFile(l)}}async debug(e,...t){await this.log("debug",e,...t)}async info(e,...t){await this.log("info",e,...t)}async success(e,...t){await this.log("success",e,...t)}async warn(e,...t){await this.log("warning",e,...t)}async error(e,...t){await this.log("error",e,...t)}validateEncryptionConfig(){if(!this.config.rotation)return!1;if(typeof this.config.rotation==="boolean")return!1;let e=this.config.rotation,{encrypt:t}=e;return!!t}async only(e){if(!this.enabled)return;return await e()}isEnabled(){return this.enabled}setEnabled(e){this.enabled=e}extend(e){let t=`${this.name}:${e}`,r=new
|
|
46
|
+
`,l=l.replace(this.ANSI_PATTERN,""),this.shouldStyleConsole()){let u=this.options.showTags!==!1&&this.name?E.gray(this.formatTag(this.name)):"";console.error(this.formatConsoleMessage({timestamp:c,icon:this.options.showIcons===!1?"":E.green("\u2713"),tag:u,message:`${o}${r?` ${JSON.stringify(r)}`:""}`}))}else if(!G())console.error(l.trim());if(this.shouldWriteToFile())await this.writeToFile(l)}}async debug(e,...t){await this.log("debug",e,...t)}async info(e,...t){await this.log("info",e,...t)}async success(e,...t){await this.log("success",e,...t)}async warn(e,...t){await this.log("warning",e,...t)}async error(e,...t){await this.log("error",e,...t)}validateEncryptionConfig(){if(!this.config.rotation)return!1;if(typeof this.config.rotation==="boolean")return!1;let e=this.config.rotation,{encrypt:t}=e;return!!t}async only(e){if(!this.enabled)return;return await e()}isEnabled(){return this.enabled}setEnabled(e){this.enabled=e}extend(e){let t=`${this.name}:${e}`,r=new Pr(t,{...this.options,logDirectory:this.config.logDirectory,level:this.config.level,format:this.config.format,rotation:typeof this.config.rotation==="boolean"?void 0:this.config.rotation,timestamp:typeof this.config.timestamp==="boolean"?void 0:this.config.timestamp});return this.subLoggers.add(r),r}createReadStream(){if(G())throw Error("createReadStream is not supported in browser environments");if(!or(this.currentLogFile))throw Error(`Log file does not exist: ${this.currentLogFile}`);return Jo(this.currentLogFile,{encoding:"utf8"})}async decrypt(e){if(!this.validateEncryptionConfig())throw Error("Encryption is not configured");let t=this.config.rotation;if(!t.encrypt||typeof t.encrypt==="boolean")throw Error("Invalid encryption configuration");if(!this.currentKeyId||!this.keys.has(this.currentKeyId))throw Error("No valid encryption key available");let r=this.keys.get(this.currentKeyId);try{let n=Se.isBuffer(e)?e:Se.from(e,"base64"),i=n.subarray(0,16),o=n.subarray(n.length-16),s=n.subarray(16,n.length-16),c=id("aes-256-gcm",r,i);c.setAuthTag(o);let a=c.update(s),l=c.final(),u=a.length+l.length,f=Se.allocUnsafe(u);return a.copy(f,0),l.copy(f,a.length),f.toString("utf8")}catch(n){throw Error(`Decryption failed: ${n instanceof Error?n.message:String(n)}`)}}getLevel(){return this.config.level}getLogDirectory(){return this.config.logDirectory}getFormat(){return this.config.format}getRotationConfig(){return this.config.rotation}isBrowserMode(){return G()}isServerMode(){return!G()}setTestEncryptionKey(e,t){this.currentKeyId=e,this.keys.set(e,t)}getTestCurrentKey(){if(!this.currentKeyId||!this.keys.has(this.currentKeyId))return null;return{id:this.currentKeyId,key:this.keys.get(this.currentKeyId)}}getConfig(){return this.config}async box(e){if(!this.enabled)return;let t=new Date,r=this.formatConsoleTimestamp(t),n=this.formatFileTimestamp(t),{consoleText:i,fileText:o}=this.buildOutputTexts(e);if(this.shouldStyleConsole()){let c=i.split(`
|
|
47
47
|
`),a=Math.max(...c.map((d)=>d.length))+2,l=`\u250C${"\u2500".repeat(a)}\u2510`,u=`\u2514${"\u2500".repeat(a)}\u2518`,f=c.map((d)=>this.formatConsoleMessage({timestamp:r,message:E.cyan(d),showTimestamp:!1}));console.error(this.formatConsoleMessage({timestamp:r,message:E.cyan(l),showTimestamp:!1})),f.forEach((d)=>console.error(d)),console.error(this.formatConsoleMessage({timestamp:r,message:E.cyan(u),showTimestamp:!1}))}else if(!G())console.error(`${n} ${this.environment}.INFO: [BOX] ${o}`);let s=`${n} ${this.environment}.INFO: [BOX] ${o}
|
|
48
48
|
`.replace(this.ANSI_PATTERN,"");if(this.shouldWriteToFile())await this.writeToFile(s)}async prompt(e){if(G())return Promise.resolve(!0);return new Promise((t)=>{console.error(`${E.cyan("?")} ${e} (y/n) `);let r=(n)=>{let i=n.toString().trim().toLowerCase();O.stdin.removeListener("data",r);try{if(typeof O.stdin.setRawMode==="function")O.stdin.setRawMode(!1)}catch{}O.stdin.pause(),console.error(""),t(i==="y"||i==="yes")};try{if(typeof O.stdin.setRawMode==="function")O.stdin.setRawMode(!0)}catch{}O.stdin.resume(),O.stdin.once("data",r)})}setFancy(e){this.fancy=e}isFancy(){return this.fancy}pause(){this.enabled=!1}resume(){this.enabled=!0}async start(e,...t){if(!this.enabled)return;let r=e;if(t&&t.length>0){let a=/%([sdijfo%])/g,l=0;if(r=e.replace(a,(u,f)=>{if(f==="%")return"%";if(l>=t.length)return u;let d=t[l++];switch(f){case"s":return String(d);case"d":case"i":return Number(d).toString();case"j":case"o":return JSON.stringify(d,null,2);default:return u}}),l<t.length)r+=` ${t.slice(l).map((u)=>typeof u==="object"?JSON.stringify(u,null,2):String(u)).join(" ")}`}let{consoleText:n,fileText:i}=this.buildOutputTexts(r);if(this.shouldStyleConsole()){let a=this.options.showTags!==!1&&this.name?E.gray(this.formatTag(this.name)):"",l=this.options.showIcons===!1?"":`${E.blue("\u25D0")} `;console.error(`${l}${a} ${E.cyan(n)}`)}let c=`[${new Date().toISOString()}] ${this.environment}.INFO: [START] ${i}
|
|
49
49
|
`.replace(this.ANSI_PATTERN,"");if(this.shouldWriteToFile())await this.writeToFile(c)}renderProgressBar(e,t=!1){if(!this.enabled||!this.shouldStyleConsole()||!O.stdout.isTTY)return;let r=Math.min(100,Math.max(0,Math.round(e.current/e.total*100))),n=Math.round(e.barLength*r/100),i=e.barLength-n,o=E.green("\u2501".repeat(n)),s=E.gray("\u2501".repeat(i)),c=`[${o}${s}]`,a=`${r}%`.padStart(4),l=e.message?` ${e.message}`:"",u=this.options.showIcons===!1?"":t||r===100?E.green("\u2713"):E.blue("\u25B6"),f=this.options.showTags!==!1&&this.name?` ${E.gray(this.formatTag(this.name))}`:"",d=`\r${u}${f} ${c} ${a}${l}`,h=O.stdout.columns||80,m=" ".repeat(Math.max(0,h-d.replace(this.ANSI_PATTERN,"").length));if(e.lastRenderedLine=`${d}${m}`,O.stdout.write(e.lastRenderedLine),t)O.stdout.write(`
|
|
50
|
-
`)}finishProgressBar(e,t){if(!this.enabled||!this.fancy||G()||!O.stdout.isTTY){this.activeProgressBar=null;return}if(e.current<e.total)e.current=e.total;if(t)e.message=t;this.renderProgressBar(e,!0),this.activeProgressBar=null}async clear(e={}){if(G()){console.warn("Log clearing is not supported in browser environments.");return}try{console.warn("Clearing logs...",this.config.logDirectory);let t=await
|
|
50
|
+
`)}finishProgressBar(e,t){if(!this.enabled||!this.fancy||G()||!O.stdout.isTTY){this.activeProgressBar=null;return}if(e.current<e.total)e.current=e.total;if(t)e.message=t;this.renderProgressBar(e,!0),this.activeProgressBar=null}async clear(e={}){if(G()){console.warn("Log clearing is not supported in browser environments.");return}try{console.warn("Clearing logs...",this.config.logDirectory);let t=await sr(this.config.logDirectory),r=[];for(let n of t){if(!(e.name?new RegExp(e.name.replace("*",".*")).test(n):n.startsWith(this.name))||!n.endsWith(".log"))continue;let o=ut(this.config.logDirectory,n);if(e.before)try{if((await ct(o)).mtime>=e.before)continue}catch(s){console.error(`Failed to get stats for file ${o}:`,s);continue}r.push(o)}if(r.length===0){console.warn("No log files matched the criteria for clearing.");return}console.warn(`Preparing to delete ${r.length} log file(s)...`);for(let n of r)try{await ar(n),console.warn(`Deleted log file: ${n}`)}catch(i){console.error(`Failed to delete log file ${n}:`,i)}console.warn("Log clearing process finished.")}catch(t){console.error("Error during log clearing process:",t)}}}async function kh(e,t={}){let{maxRetries:r=3,retryDelay:n=1000,isRetryable:i=()=>!0,fallback:o}=t,s=Error("Unknown error occurred");for(let c=0;c<=r;c++)try{return await e()}catch(a){if(s=a instanceof Error?a:Error(String(a)),c===r||!i(s))break;if(n>0)await new Promise((l)=>setTimeout(l,n))}if(o!==void 0)return o;throw s instanceof Error?s:Error(`Unknown error: ${String(s)}`)}class ui{defaultParsers;constructor(){this.defaultParsers=[{name:"boolean",canParse:(e,t)=>t==="boolean"||["true","false","1","0","yes","no"].includes(e.toLowerCase()),parse:(e)=>{let t=e.toLowerCase();return["true","1","yes"].includes(t)}},{name:"number",canParse:(e,t)=>t==="number"||!Number.isNaN(Number(e))&&!Number.isNaN(Number.parseFloat(e)),parse:(e)=>{let t=Number(e);if(Number.isNaN(t))throw TypeError(`Cannot parse "${e}" as number`);return t}},{name:"array",canParse:(e,t)=>t==="array"||e.startsWith("[")||e.includes(","),parse:(e)=>{try{let t=JSON.parse(e);if(Array.isArray(t))return t}catch{}return e.split(",").map((t)=>t.trim())}},{name:"json",canParse:(e,t)=>t==="object"||(e.startsWith("{")&&e.endsWith("}")||e.startsWith("[")&&e.endsWith("]")),parse:(e)=>{try{return JSON.parse(e)}catch(t){throw Error(`Cannot parse "${e}" as JSON: ${t}`)}}}]}async applyEnvironmentVariables(e,t,r={}){let{prefix:n,useCamelCase:i=!0,useBackwardCompatibility:o=!0,customParsers:s={},verbose:c=!1,trackPerformance:a=!0}=r,l=async()=>{if(!e)return{config:t,source:{type:"environment",priority:50,timestamp:new Date}};let u=n||this.generateEnvPrefix(e),f={...t};return this.processObject(f,[],u,{useCamelCase:i,useBackwardCompatibility:o,customParsers:s,verbose:c,configName:e}),{config:f,source:{type:"environment",priority:50,timestamp:new Date}}};if(a)return ti.track("applyEnvironmentVariables",l,{configName:e});return l()}generateEnvPrefix(e){return e.toUpperCase().replace(/-/g,"_")}formatEnvKey(e,t){if(!t)return e.toUpperCase();return e.replace(/([A-Z])/g,"_$1").toUpperCase()}processObject(e,t,r,n){for(let[i,o]of Object.entries(e)){let s=[...t,i],c=s.map((u)=>this.formatEnvKey(u,n.useCamelCase)),a=`${r}_${c.join("_")}`,l=n.useBackwardCompatibility?`${r}_${s.map((u)=>u.toUpperCase()).join("_")}`:null;if(n.verbose);if(typeof o==="object"&&o!==null&&!Array.isArray(o))this.processObject(o,s,r,n);else{let u=cr.env[a]||(l?cr.env[l]:void 0);if(u!==void 0){if(n.verbose){let f=cr.env[a]?a:l}try{e[i]=this.parseEnvironmentValue(u,typeof o,a,n.customParsers,n.configName)}catch(f){if(f instanceof ci)throw f;throw He.envVar(a,u,typeof o,n.configName)}}}}}parseEnvironmentValue(e,t,r,n,i){for(let[o,s]of Object.entries(n))try{return s(e)}catch{continue}for(let o of this.defaultParsers)if(o.canParse(e,t))try{return o.parse(e)}catch{throw He.envVar(r,e,`${t} (via ${o.name} parser)`,i)}return e}getEnvironmentVariables(e){let t={},r=e.toUpperCase();for(let[n,i]of Object.entries(cr.env))if(n.startsWith(r)&&i!==void 0)t[n]=i;return t}validateEnvironmentVariable(e,t,r){let n=[];if(!/^[A-Z_][A-Z0-9_]*$/.test(e))n.push(`Environment variable key "${e}" should only contain uppercase letters, numbers, and underscores`);if(r)try{this.parseEnvironmentValue(e,t,r,{})}catch(i){n.push(`Cannot parse value "${t}" as ${r}: ${i}`)}return{isValid:n.length===0,errors:n}}generateEnvVarDocs(e,t,r={}){let{prefix:n,format:i="text"}=r,o=n||this.generateEnvPrefix(e),s=[];switch(this.extractEnvVarInfo(t,[],o,s),i){case"markdown":return this.formatAsMarkdown(s,e);case"json":return JSON.stringify(s,null,2);default:return this.formatAsText(s,e)}}extractEnvVarInfo(e,t,r,n){for(let[i,o]of Object.entries(e)){let s=[...t,i],c=`${r}_${s.map((a)=>this.formatEnvKey(a,!0)).join("_")}`;if(typeof o==="object"&&o!==null&&!Array.isArray(o))this.extractEnvVarInfo(o,s,r,n);else n.push({key:c,type:Array.isArray(o)?"array":typeof o,description:`Configuration for ${s.join(".")}`,example:this.generateExample(o)})}}generateExample(e){if(Array.isArray(e))return JSON.stringify(e);if(typeof e==="object"&&e!==null)return JSON.stringify(e);return String(e)}formatAsText(e,t){let r=`Environment Variables for ${t}:
|
|
51
51
|
|
|
52
52
|
`;for(let n of e)r+=`${n.key}
|
|
53
53
|
`,r+=` Type: ${n.type}
|
|
@@ -59,39 +59,39 @@ export type ConfigOf = Config
|
|
|
59
59
|
`;r+=`| Variable | Type | Description | Example |
|
|
60
60
|
`,r+=`|----------|------|-------------|----------|
|
|
61
61
|
`;for(let n of e)r+=`| \`${n.key}\` | ${n.type} | ${n.description} | \`${n.example}\` |
|
|
62
|
-
`;return r}}function $h(e,t,r={}){return Ks(e,t,r,new WeakMap)}function Ks(e,t,r,n){let{arrayMergeMode:i="replace",skipNullish:o=!1,customMerger:s}=r;if(t===null||t===void 0)return o?e:t;if(s){let c=s(e,t);if(c!==void 0)return c}if(Array.isArray(t)||Array.isArray(e))return Hs(e,t,i,n);if(!ue(t)||!ue(e))return t;return Ah(e,t,r,n)}function Hs(e,t,r,n){if(Array.isArray(t)&&!Array.isArray(e))return t;if(Array.isArray(e)&&!Array.isArray(t))return t;if(Array.isArray(t)&&Array.isArray(e))switch(r){case"replace":return t;case"concat":return Rh(e,t);case"smart":return kh(e,t,n);default:return t}return t}function Rh(e,t){let r=[...t];for(let n of e)if(!r.some((i)=>Xn(i,n)))r.push(n);return r}function kh(e,t,r){if(t.length===0)return e;if(e.length===0)return t;if(ue(t[0])&&ue(e[0]))return Sh(e,t,r);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}function Sh(e,t,r){let n=[...t];for(let i of e){if(!ue(i)){n.push(i);continue}let o=["id","name","key","path","type"],s=!1;for(let c of o)if(c in i){if(n.find((l)=>ue(l)&&(c in l)&&l[c]===i[c])){s=!0;break}}if(!s)n.push(i)}return n}function Ah(e,t,r,n){let i=t;if(ue(i)&&n.has(i))return n.get(i);let o={...e};if(ue(i))n.set(i,o);for(let s in i){if(!Object.prototype.hasOwnProperty.call(i,s))continue;let c=i[s],a=o[s];if(r.skipNullish&&(c===null||c===void 0))continue;if(c===null||c===void 0){o[s]=c;continue}if(ue(c)&&ue(a))o[s]=Ks(a,c,r,n);else if(Array.isArray(c)||Array.isArray(a))o[s]=Hs(a,c,r.arrayMergeMode||"smart",n);else o[s]=c}return o}function Gs(e,t,r="replace"){return $h(e,t,{arrayMergeMode:r==="replace"?"replace":"smart",skipNullish:!0})}function Xn(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(!Xn(e[r],t[r]))return!1;return!0}if(ue(e)&&ue(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(!Xn(e[i],t[i]))return!1}return!0}return!1}function ue(e){return Boolean(e&&typeof e==="object"&&!Array.isArray(e))}class qs{extensions=ms;async loadFromPath(e,t,r={}){let{arrayStrategy:n="replace",useCache:i=!0,cacheTtl:o,trackPerformance:s=!0,verbose:c=!1}=r;if(i){let l=gr.getWithFileCheck("file",e);if(l){if(c)console.log(`Configuration loaded from cache: ${e}`);return l}}let a=async()=>{if(!lr(e))return null;try{let l=`?t=${Date.now()}`,u=await import(e+l),f=u.default||u,d="default"in u,h=Object.keys(u).length>0;if(!d&&!h)throw new Sr(e,Error("Configuration file is empty and exports nothing"),"unknown");if(typeof f!=="object"||f===null||Array.isArray(f))throw new Sr(e,Error("Configuration must export a valid object"),"unknown");let p={config:Gs(t,f,n),source:{type:"file",path:e,priority:100,timestamp:new Date}};if(i)gr.setWithFileCheck("file",p,e,o);return p}catch(l){throw l instanceof Error?He.configLoad(e,l):He.configLoad(e,Error(String(l)))}};if(s)return Zn.track("loadFromPath",a,{path:e});return a()}async tryLoadFromPaths(e,t,r={}){for(let n of e)try{let i=await this.loadFromPath(n,t,r);if(i)return i}catch(i){if(i instanceof Error&&i.name==="ConfigLoadError")throw i;if(r.verbose)console.warn(`Failed to load config from ${n}:`,i)}return null}generateConfigPaths(e,t,r){return wf({name:e,directory:t,alias:r})}generateNamePatterns(e,t){return ps({name:e,alias:t})}checkFileAccess(e){return Ch(async()=>lr(e),{maxRetries:2,retryDelay:100,fallback:!1})}async discoverConfigFiles(e,t,r){let n=[];if(!lr(e))return n;if(t||r){let i=this.generateNamePatterns(t||"",r);for(let o of i)for(let s of this.extensions){let c=ds(e,`${o}${s}`);if(await this.checkFileAccess(c))n.push(c)}}else try{let{readdirSync:i}=await import("fs"),o=i(e);for(let s of o)if(this.looksLikeConfigFile(s)){let c=ds(e,s);if(await this.checkFileAccess(c))n.push(c)}}catch{return[]}return n}looksLikeConfigFile(e){return[/\.config\.(ts|js|mjs|cjs|json|mts|cts)$/,/^\..*\.(ts|js|mjs|cjs|json|mts|cts)$/,/config\.(ts|js|mjs|cjs|json|mts|cts)$/].some((r)=>r.test(e))}async validateConfigFile(e){let t=[];try{if(!lr(e))return t.push("Configuration file does not exist"),t;let r=await import(e),n=r.default||r;if(n===void 0)t.push("Configuration file must export a default value or named exports");else if(typeof n!=="object"||n===null)t.push("Configuration must be an object");else if(Array.isArray(n))t.push("Configuration cannot be an array at the root level");if(e.endsWith(".json"))try{let{readFileSync:i}=await import("fs"),o=i(e,"utf8");JSON.parse(o)}catch(i){t.push(`Invalid JSON syntax: ${i}`)}}catch(r){t.push(`Failed to load configuration file: ${r}`)}return t}async getFileModificationTime(e){try{let{statSync:t}=await import("fs");return t(e).mtime}catch{return null}}async preloadConfigurations(e,t={}){let r=new Map;return await Promise.allSettled(e.map(async(n)=>{try{let i=await this.loadFromPath(n,{},t);if(i)r.set(n,i.config)}catch(i){if(t.verbose)console.warn(`Failed to preload ${n}:`,i)}})),r}}class Ys{async validateConfiguration(e,t,r={}){let{stopOnFirstError:n=!1,validateRequired:i=!0,validateTypes:o=!0,customRules:s=[],trackPerformance:c=!0,verbose:a=!1}=r,l=async()=>{let u=[],f=[],d={stopOnFirstError:n,validateRequired:i,validateTypes:o,customRules:s,trackPerformance:c,verbose:a};try{if(typeof t==="string")return await this.validateWithSchemaFile(e,t,d);else if(Array.isArray(t))return this.validateWithRules(e,[...t,...s],d);else return this.validateWithJSONSchema(e,t,d)}catch(h){return u.push({path:"",message:`Validation failed: ${h}`,rule:"system"}),{isValid:!1,errors:u,warnings:f}}};if(c)return await Zn.track("validateConfiguration",l);return l()}async validateWithSchemaFile(e,t,r){try{if(!Eh(t))throw new Ar(t,[{path:"",message:"Schema file does not exist"}]);let n=await import(t),i=n.default||n;if(Array.isArray(i))return this.validateWithRules(e,i,r);else return this.validateWithJSONSchema(e,i,r)}catch(n){throw new Ar(t,[{path:"",message:`Failed to load schema: ${n}`}])}}validateWithJSONSchema(e,t,r){let n=[],i=[];return this.validateObjectAgainstSchema(e,t,"",n,i,r),{isValid:n.length===0,errors:n,warnings:i}}validateObjectAgainstSchema(e,t,r,n,i,o){if(o.validateTypes&&t.type){let s=Array.isArray(e)?"array":typeof e,c=Array.isArray(t.type)?t.type:[t.type];if(!c.includes(s)){if(n.push({path:r,message:`Expected type ${c.join(" or ")}, got ${s}`,expected:c.join(" or "),actual:s,rule:"type"}),o.stopOnFirstError)return}}if(t.enum&&!t.enum.includes(e)){if(n.push({path:r,message:`Value must be one of: ${t.enum.join(", ")}`,expected:t.enum.join(", "),actual:e,rule:"enum"}),o.stopOnFirstError)return}if(typeof e==="string"){if(t.minLength!==void 0&&e.length<t.minLength)n.push({path:r,message:`String length must be at least ${t.minLength}`,expected:`>= ${t.minLength}`,actual:e.length,rule:"minLength"});if(t.maxLength!==void 0&&e.length>t.maxLength)n.push({path:r,message:`String length must not exceed ${t.maxLength}`,expected:`<= ${t.maxLength}`,actual:e.length,rule:"maxLength"});if(t.pattern){if(!new RegExp(t.pattern).test(e))n.push({path:r,message:`String does not match pattern ${t.pattern}`,expected:t.pattern,actual:e,rule:"pattern"})}}if(typeof e==="number"){if(t.minimum!==void 0&&e<t.minimum)n.push({path:r,message:`Value must be at least ${t.minimum}`,expected:`>= ${t.minimum}`,actual:e,rule:"minimum"});if(t.maximum!==void 0&&e>t.maximum)n.push({path:r,message:`Value must not exceed ${t.maximum}`,expected:`<= ${t.maximum}`,actual:e,rule:"maximum"})}if(Array.isArray(e)&&t.items)for(let s=0;s<e.length;s++){let c=r?`${r}[${s}]`:`[${s}]`;if(this.validateObjectAgainstSchema(e[s],t.items,c,n,i,o),o.stopOnFirstError&&n.length>0)return}if(e&&typeof e==="object"&&!Array.isArray(e)){let s=e;if(o.validateRequired&&t.required){for(let c of t.required)if(!(c in s)){if(n.push({path:r?`${r}.${c}`:c,message:`Missing required property '${c}'`,expected:"required",rule:"required"}),o.stopOnFirstError)return}}if(t.properties){for(let[c,a]of Object.entries(t.properties))if(c in s){let l=r?`${r}.${c}`:c;if(this.validateObjectAgainstSchema(s[c],a,l,n,i,o),o.stopOnFirstError&&n.length>0)return}}if(t.additionalProperties===!1){let c=new Set(Object.keys(t.properties||{}));for(let a of Object.keys(s))if(!c.has(a))i.push({path:r?`${r}.${a}`:a,message:`Additional property '${a}' is not allowed`,rule:"additionalProperties"})}}}validateWithRules(e,t,r){let n=[],i=[];for(let o of t)try{let s=this.getValueByPath(e,o.path),c=this.validateWithRule(s,o,o.path);if(n.push(...c),r.stopOnFirstError&&n.length>0)break}catch(s){n.push({path:o.path,message:`Rule validation failed: ${s}`,rule:"system"})}return{isValid:n.length===0,errors:n,warnings:i}}validateWithRule(e,t,r){let n=[];if(t.required&&(e===void 0||e===null))return n.push({path:r,message:t.message||`Property '${r}' is required`,expected:"required",rule:"required"}),n;if(e===void 0||e===null)return n;if(t.type){let i=Array.isArray(e)?"array":typeof e;if(i!==t.type)n.push({path:r,message:t.message||`Expected type ${t.type}, got ${i}`,expected:t.type,actual:i,rule:"type"})}if(t.min!==void 0){let i=Array.isArray(e)?e.length:typeof e==="string"?e.length:typeof e==="number"?e:0;if(i<t.min)n.push({path:r,message:t.message||`Value must be at least ${t.min}`,expected:`>= ${t.min}`,actual:i,rule:"min"})}if(t.max!==void 0){let i=Array.isArray(e)?e.length:typeof e==="string"?e.length:typeof e==="number"?e:0;if(i>t.max)n.push({path:r,message:t.message||`Value must not exceed ${t.max}`,expected:`<= ${t.max}`,actual:i,rule:"max"})}if(t.pattern&&typeof e==="string"){if(!t.pattern.test(e))n.push({path:r,message:t.message||`Value does not match pattern ${t.pattern}`,expected:t.pattern.toString(),actual:e,rule:"pattern"})}if(t.enum&&!t.enum.includes(e))n.push({path:r,message:t.message||`Value must be one of: ${t.enum.join(", ")}`,expected:t.enum.join(", "),actual:e,rule:"enum"});if(t.validator){let i=t.validator(e);if(i)n.push({path:r,message:t.message||i,rule:"custom"})}return n}getValueByPath(e,t){if(!t)return e;let r=t.split("."),n=e;for(let i of r)if(n&&typeof n==="object"&&i in n)n=n[i];else return;return n}generateRulesFromInterface(e){let t=[],r=e.matchAll(/(\w+)(\?)?:\s*(\w+)/g);for(let n of r){let[,i,o,s]=n;t.push({path:i,required:!o,type:this.mapTypeScriptType(s)})}return t}mapTypeScriptType(e){switch(e.toLowerCase()){case"string":return"string";case"number":return"number";case"boolean":return"boolean";case"array":return"array";case"object":return"object";default:return"object"}}static createCommonRules(){return{server:[{path:"port",required:!0,type:"number",min:1,max:65535},{path:"host",required:!0,type:"string",min:1},{path:"ssl",type:"boolean"}],database:[{path:"url",required:!0,type:"string",min:1},{path:"pool",type:"number",min:1,max:100},{path:"timeout",type:"number",min:0}],api:[{path:"baseUrl",required:!0,type:"string",pattern:Th},{path:"timeout",type:"number",min:0},{path:"retries",type:"number",min:0,max:10}]}}}function Nh(e){if(!e)return"";let t=Array.isArray(e)?e.filter(Boolean):[e];if(t.length===0)return"";if(t.length===1)return` or alias "${t[0]}"`;return` or aliases ${t.map((r)=>`"${r}"`).join(", ")}`}class Js{fileLoader=new qs;envProcessor=new ai;validator=new Ys;async loadConfig(e){let t=Date.now(),{cache:r,performance:n,schema:i,validate:o,...s}=e;try{if(r?.enabled){let a=this.checkCache(s.name||"",s);if(a)return a}let c;try{c=await this.loadConfigurationStrategies(s,!0,r)}catch(a){if(s.configFile)throw a;let l=s.__strictErrorHandling;if(a instanceof Error&&a.name==="ConfigNotFoundError"){if(l)throw a;c={...await this.applyEnvironmentVariables(s.name||"",s.defaultConfig,s.checkEnv!==!1,s.verbose||!1),warnings:[`No configuration file found for "${s.name||"config"}", using defaults with environment variables`]}}else if(a instanceof Error&&a.name==="ConfigLoadError"){let u=a.message.includes("EACCES")||a.message.includes("EPERM")||a.message.includes("permission denied"),f=!u&&(a.message.includes("syntax")||a.message.includes("Expected")||a.message.includes("Unexpected")||a.message.includes("BuildMessage")||a.message.includes("errors building")),d=a.message.includes("Configuration must export a valid object")||a.message.includes("Configuration file is empty and exports nothing");if(l&&(d||u))throw a;if(f&&(!l||!d))c={...await this.applyEnvironmentVariables(s.name||"",s.defaultConfig,s.checkEnv!==!1,s.verbose||!1),warnings:["Configuration file has syntax errors, using defaults with environment variables"]};else if(!l)c={...await this.applyEnvironmentVariables(s.name||"",s.defaultConfig,s.checkEnv!==!1,s.verbose||!1),warnings:[`Configuration loading error, using defaults: ${a.message}`]};else throw a}else c={...await this.applyEnvironmentVariables(s.name||"",s.defaultConfig,s.checkEnv!==!1,s.verbose||!1),warnings:[`Configuration loading failed, using defaults: ${a instanceof Error?a.message:String(a)}`]}}if(i||o)await this.validateConfiguration(c.config,i,o,s.name);if(r?.enabled&&c)this.cacheResult(s.name||"",c,r,s);if(n?.enabled){let a={operation:"loadConfig",duration:Date.now()-t,configName:s.name,timestamp:new Date};if(n.onMetrics)n.onMetrics(a);if(n.slowThreshold&&a.duration>n.slowThreshold)he.warn(`Slow configuration loading detected: ${a.duration}ms for ${s.name}`);c.metrics=a}return c}catch(c){if(c instanceof Error&&c.name==="ConfigNotFoundError")throw c;let a=Date.now()-t;throw he.error(`Configuration loading failed after ${a}ms:`,[c instanceof Error?c:Error(String(c))]),c}}async loadConfigurationStrategies(e,t=!1,r){let{name:n="",alias:i,configFile:o,cwd:s,configDir:c,defaultConfig:a,checkEnv:l=!0,arrayStrategy:u="replace",verbose:f=!1}=e,d=s||Er.cwd(),h=[];if(o){let x=ve(d,o);h.push(x);let w=l?St(n,a,f):a,T=await this.fileLoader.tryLoadFromPaths([x],w,{arrayStrategy:u,verbose:f,cacheTtl:r?.ttl,useCache:!r?.ttl||r.ttl>100});if(!T)throw He.configNotFound(n||o,h,i);if(f)he.success(`Configuration loaded from explicit path: ${x}`);return this.finalizeResult(T,h,l,n,f)}let m=await this.loadLocalConfiguration(n,i,d,c,a,u,f,l,r);if(m)return h.push(...this.getLocalSearchPaths(n,i,d,c)),this.finalizeResult(m,h,l,n,f);let g=await this.loadHomeConfiguration(n,i,a,u,f,l);if(g)return h.push(...this.getHomeSearchPaths(n,i)),this.finalizeResult(g,h,l,n,f);let p=await this.loadPackageJsonConfiguration(n,i,d,a,u,f,l);if(p)return h.push(ve(d,"package.json")),this.finalizeResult(p,h,l,n,f);if(h.push(...this.getAllSearchPaths(n,i,d,c)),t)throw He.configNotFound(n,h,i);return{...await this.applyEnvironmentVariables(n,a,l,f),warnings:[`No configuration file found for "${n}"${Nh(i)}, using defaults with environment variables`]}}async loadLocalConfiguration(e,t,r,n,i,o,s,c,a){let l=c?St(e,i,s):i,u=this.getLocalDirectories(r,n);for(let f of u){if(s)he.info(`Searching for configuration in: ${f}`);let d=this.fileLoader.generateConfigPaths(e,f,t),h=await this.fileLoader.tryLoadFromPaths(d,l,{arrayStrategy:o,verbose:s,cacheTtl:a?.ttl,useCache:!a?.ttl||a.ttl>100});if(h){if(s)he.success(`Configuration loaded from: ${h.source.path}`);return h}}return null}async loadHomeConfiguration(e,t,r,n,i,o){if(!e)return null;let s=o?St(e,r,i):r,c=[ve(et(),".config",e),ve(et(),".config"),et()];for(let a of c){if(i)he.info(`Checking home directory: ${a}`);let l=this.fileLoader.generateConfigPaths(e,a,t),u=await this.fileLoader.tryLoadFromPaths(l,s,{arrayStrategy:n,verbose:i});if(u){if(i)he.success(`Configuration loaded from home directory: ${u.source.path}`);return u}}return null}async loadPackageJsonConfiguration(e,t,r,n,i,o,s){let c=s?St(e,n,o):n;try{let a=ve(r,"package.json");if(!$f(a))return null;let l={};try{l=JSON.parse(Rf(a,"utf8"))}catch(d){if(o)he.warn("Failed to parse package.json:",[d instanceof Error?d:Error(String(d))]);return null}let u=l[e],f=e;if(!u&&t){let d=Array.isArray(t)?t:[t];for(let h of d){if(!h)continue;if(l[h]){u=l[h],f=h;break}}}if(u&&typeof u==="object"&&!Array.isArray(u)){if(o)he.success(`Configuration loaded from package.json: ${f}`);return{config:Gs(c,u,i),source:{type:"package.json",path:a,priority:30,timestamp:new Date}}}}catch(a){if(o)he.warn("Failed to load package.json:",[a instanceof Error?a:Error(String(a))])}return null}async applyEnvironmentVariables(e,t,r,n){if(!r||!e||typeof t!=="object"||t===null||Array.isArray(t))return{config:t,source:{type:"default",priority:10,timestamp:new Date}};return{config:St(e,t,n),source:{type:"environment",priority:20,timestamp:new Date}}}async finalizeResult(e,t,r,n,i){return{config:e.config,source:e.source,path:e.source.path}}async validateConfiguration(e,t,r,n){let i=[];if(r){let o=r(e);if(o)i.push(...o)}if(t){let o=await this.validator.validateConfiguration(e,t);if(!o.isValid)i.push(...o.errors.map((s)=>s.path?`${s.path}: ${s.message}`:s.message))}if(i.length>0)throw He.configValidation(n||"unknown",i,n)}checkCache(e,t){let r=this.generateCacheKey(e,t);return gr.get(r)||null}cacheResult(e,t,r,n){let i=this.generateCacheKey(e,n);gr.set(i,t,void 0,r.ttl)}generateCacheKey(e,t){let r=[e];if(t.alias){let n=Array.isArray(t.alias)?t.alias.join(","):t.alias;r.push(`alias:${n}`)}if(t.cwd)r.push(`cwd:${t.cwd}`);if(t.configFile)r.push(`configFile:${t.configFile}`);if(t.configDir)r.push(`configDir:${t.configDir}`);if("checkEnv"in t)r.push(`checkEnv:${t.checkEnv}`);return r.join("|")}getLocalDirectories(e,t){return Cf({cwd:e,configDir:t})}getAllSearchPaths(e,t,r,n){let i=[];return i.push(...this.getLocalSearchPaths(e,t,r,n)),i.push(...this.getHomeSearchPaths(e,t)),i.push(ve(r,"package.json")),i}getLocalSearchPaths(e,t,r,n){let i=this.getLocalDirectories(r,n),o=[];for(let s of i)o.push(...this.fileLoader.generateConfigPaths(e,s,t));return o}getHomeSearchPaths(e,t){if(!e)return[];let r=[ve(et(),".config",e),ve(et(),".config"),et()],n=[];for(let i of r)n.push(...this.fileLoader.generateConfigPaths(e,i,t));return n}async loadConfigWithResult(e){return this.loadConfig(e)}}async function Xs(e){let t="defaultConfig"in e&&e.defaultConfig!==void 0?e.defaultConfig:{},r="cache"in e||"performance"in e||"schema"in e||"validate"in e;try{let n;if(r)n=await jn.loadConfig(e);else n=await jn.loadConfig({...e,defaultConfig:t,cache:{enabled:!0},performance:{enabled:!1}});return n?.config??t}catch(n){if(e.configFile)throw n;let i=n instanceof Error?n.name:"UnknownError",o=n instanceof Error?n.message:String(n);if(!(i==="ConfigNotFoundError"||i==="ConfigLoadError"||i==="ConfigValidationError"||o.includes("config"))&&e.verbose)he.warn("Unexpected error loading config, using defaults:",[n instanceof Error?n:Error(String(n))]);let c=r?{...e,defaultConfig:t}:{...e,defaultConfig:t,cache:{enabled:!0},performance:{enabled:!1}};if("checkEnv"in e?e.checkEnv!==!1:!0)return(await jn.applyEnvironmentVariables(c.name||"",t,!0,c.verbose||!1))?.config??t;return t}}function St(e,t,r=!1){let n=new ai,i=e.toUpperCase().replace(/[^A-Z0-9]/g,"_");function o(s,c=[]){let a={...s};for(let[l,u]of Object.entries(s)){let f=[...c,l],d=[`${i}_${f.join("_").toUpperCase()}`,`${i}_${f.map((g)=>g.toUpperCase()).join("")}`,`${i}_${f.map((g)=>g.replace(/([A-Z])/g,"_$1").toUpperCase()).join("")}`],h,m;for(let g of d)if(h=Er.env[g],h!==void 0){m=g;break}if(h!==void 0&&m)if(typeof u==="boolean")a[l]=["true","1","yes"].includes(h.toLowerCase());else if(typeof u==="number"){let g=Number(h);if(!Number.isNaN(g))a[l]=g}else if(Array.isArray(u))try{a[l]=JSON.parse(h)}catch{a[l]=h.split(",").map((g)=>g.trim())}else a[l]=h;else if(u&&typeof u==="object"&&!Array.isArray(u))a[l]=o(u,f)}return a}return o(t)}var gr,Zn,ms,cd,ud=(e)=>e,dd=(e,t)=>{for(var r in t)cd(e,r,{get:t[r],enumerable:!0,configurable:!0,set:fd.bind(t,r)})},hd=(e,t)=>()=>(e&&(t=e(e=0)),t),xs,Es,ft,It,Ts,Bd,Vd,es,ur,Wn,X,P,Ud,ts,Wd,rs,zd,Kd,_n,Hd,ns,is,Ln,Gd,qd,Yd,Jd,fr,Ns,Xd,Z,Zd,Qd,os,dr,zn,H,A,eh,ss,th,as,rh,nh,Mn,ih,ls,cs,oh,Fn,sh,ah,lh,ch,uh,hr,Os,fh,dh="0.15.6",ae,$r,Nt,Kn,Hn,Rr,Gn,qn,Ot,Yn,Jn,Fe,Is,Ps,ge,Ne,_s,Ls,hh,mh,Ms,kr,O1,Y,E,I1,yh,P1,bh,_1,L1,us,M1,xh,vh,F1,fs,D1,j1,B1,V1,U1,Dn,wh,W1,me,Ds,Sr,js,Bs,si,Vs,Us,Ar,Ws,zs,He,Th,he,jn,q1,Y1;var Zs=yc(()=>{gr=new hs,Zn=new gs,ms=[".ts",".js",".mjs",".cjs",".json",".mts",".cts"];cd=Object.defineProperty;xs={};dd(xs,{withErrorRecovery:()=>Cs,tryLoadConfig:()=>Md,loadConfigWithResult:()=>_d,loadConfig:()=>As,isRetryableError:()=>Ed,isConfigNotFoundError:()=>Ad,isBunfigError:()=>$s,globalPerformanceMonitor:()=>It,globalCache:()=>ft,getEnvOrDefault:()=>Td,generateConfigTypes:()=>Fd,defaultGeneratedDir:()=>Ls,defaultConfigDir:()=>_s,deepMergeWithArrayStrategy:()=>ni,deepMerge:()=>Rs,createLibraryConfig:()=>Dd,config:()=>Ld,bunfigPlugin:()=>jd,applyEnvVarsToConfig:()=>Et,TypeGenerationError:()=>qn,SchemaValidationError:()=>Ot,PluginError:()=>Jn,PerformanceMonitor:()=>ei,FileSystemError:()=>Gn,ErrorFactory:()=>Fe,EnvVarError:()=>Rr,EnvProcessor:()=>Tr,ConfigValidator:()=>ii,ConfigValidationError:()=>Kn,ConfigNotFoundError:()=>$r,ConfigMergeError:()=>Hn,ConfigLoader:()=>oi,ConfigLoadError:()=>Nt,ConfigFileLoader:()=>Nr,ConfigCache:()=>Qn,CacheUtils:()=>Ts,BunfigError:()=>ae,BrowserConfigError:()=>Yn,ArrayMergeStrategies:()=>Is});hh=hd(async()=>{Es=import.meta.require,ft=new Qn,It=new ei,Ts={createKey:gd,isEquivalent:md,estimateMemoryUsage:pd},Bd=yr(Vn.cwd(),"config"),Vd=yr(Vn.cwd(),"src/generated"),es=pr.env.CLARITY_LOG_DIR||Nf(xd(),"logs"),ur={level:"info",defaultName:"clarity",timestamp:!0,colors:!0,format:"text",maxLogSize:10485760,logDatePattern:"YYYY-MM-DD",logDirectory:es,rotation:{frequency:"daily",maxSize:10485760,maxFiles:5,compress:!1,rotateHour:0,rotateMinute:0,rotateDayOfWeek:0,rotateDayOfMonth:1,encrypt:!1},verbose:!1},Wn=await vd(),X={red:(e)=>`\x1B[31m${e}\x1B[0m`,green:(e)=>`\x1B[32m${e}\x1B[0m`,yellow:(e)=>`\x1B[33m${e}\x1B[0m`,blue:(e)=>`\x1B[34m${e}\x1B[0m`,magenta:(e)=>`\x1B[35m${e}\x1B[0m`,cyan:(e)=>`\x1B[36m${e}\x1B[0m`,white:(e)=>`\x1B[37m${e}\x1B[0m`,gray:(e)=>`\x1B[90m${e}\x1B[0m`,bgRed:(e)=>`\x1B[41m${e}\x1B[0m`,bgYellow:(e)=>`\x1B[43m${e}\x1B[0m`,bold:(e)=>`\x1B[1m${e}\x1B[0m`,dim:(e)=>`\x1B[2m${e}\x1B[0m`,italic:(e)=>`\x1B[3m${e}\x1B[0m`,underline:(e)=>`\x1B[4m${e}\x1B[0m`,reset:"\x1B[0m"},P=X,Ud=X.red,ts=X.green,Wd=X.yellow,rs=X.blue,zd=X.magenta,Kd=X.cyan,_n=X.white,Hd=X.gray,ns=X.bgRed,is=X.bgYellow,Ln=X.bold,Gd=X.dim,qd=X.italic,Yd=X.underline,Jd=X.reset,fr={activationLevel:"error",bufferSize:50,flushOnDeactivation:!0,stopBuffering:!1},Ns={debug:"\uD83D\uDD0D",info:rs("\u2139"),success:ts("\u2713"),warning:is(_n(Ln(" WARN "))),error:ns(_n(Ln(" ERROR ")))},Xd=new vr("stacks"),Z=new vr("bunfig",{showTags:!0}),Zd=re(Tt.cwd(),"config"),Qd=re(Tt.cwd(),"src/generated"),os=mr.env.CLARITY_LOG_DIR||Ef(Rd(),"logs"),dr={level:"info",defaultName:"clarity",timestamp:!0,colors:!0,format:"text",maxLogSize:10485760,logDatePattern:"YYYY-MM-DD",logDirectory:os,rotation:{frequency:"daily",maxSize:10485760,maxFiles:5,compress:!1,rotateHour:0,rotateMinute:0,rotateDayOfWeek:0,rotateDayOfMonth:1,encrypt:!1},verbose:!1,writeToFile:!1},zn=await kd(),H={red:(e)=>`\x1B[31m${e}\x1B[0m`,green:(e)=>`\x1B[32m${e}\x1B[0m`,yellow:(e)=>`\x1B[33m${e}\x1B[0m`,blue:(e)=>`\x1B[34m${e}\x1B[0m`,magenta:(e)=>`\x1B[35m${e}\x1B[0m`,cyan:(e)=>`\x1B[36m${e}\x1B[0m`,white:(e)=>`\x1B[37m${e}\x1B[0m`,gray:(e)=>`\x1B[90m${e}\x1B[0m`,bgRed:(e)=>`\x1B[41m${e}\x1B[0m`,bgYellow:(e)=>`\x1B[43m${e}\x1B[0m`,bgGray:(e)=>`\x1B[100m${e}\x1B[0m`,bold:(e)=>`\x1B[1m${e}\x1B[0m`,dim:(e)=>`\x1B[2m${e}\x1B[0m`,italic:(e)=>`\x1B[3m${e}\x1B[0m`,underline:(e)=>`\x1B[4m${e}\x1B[0m`,strikethrough:(e)=>`\x1B[9m${e}\x1B[0m`,reset:"\x1B[0m"},A=H,eh=H.red,ss=H.green,th=H.yellow,as=H.blue,rh=H.magenta,nh=H.cyan,Mn=H.white,ih=H.gray,ls=H.bgRed,cs=H.bgYellow,oh=H.bgGray,Fn=H.bold,sh=H.dim,ah=H.italic,lh=H.underline,ch=H.strikethrough,uh=H.reset,hr={activationLevel:"error",bufferSize:50,flushOnDeactivation:!0,stopBuffering:!1},Os={debug:"\uD83D\uDD0D",info:as("\u2139"),success:ss("\u2713"),warning:cs(Mn(Fn(" WARN "))),error:ls(Mn(Fn(" ERROR ")))},fh=new Cr("stacks"),ae=class extends Error{timestamp;context;constructor(t,r={}){super(t);if(this.name=this.constructor.name,this.timestamp=new Date,this.context=r,Error.captureStackTrace)Error.captureStackTrace(this,this.constructor)}toJSON(){return{name:this.name,code:this.code,message:this.message,timestamp:this.timestamp.toISOString(),context:this.context,stack:this.stack}}toString(){let t=Object.keys(this.context).length>0?` (${Object.entries(this.context).map(([r,n])=>`${r}: ${n}`).join(", ")})`:"";return`${this.name} [${this.code}]: ${this.message}${t}`}},$r=class extends ae{code="CONFIG_NOT_FOUND";constructor(t,r,n){let i=n?` or alias "${n}"`:"";super(`Configuration "${t}"${i} not found`,{configName:t,alias:n,searchPaths:r,searchPathCount:r.length})}},Nt=class extends ae{code="CONFIG_LOAD_ERROR";constructor(t,r,n){super(`Failed to load configuration from "${t}": ${r.message}`,{configPath:t,configName:n,originalError:r.name,originalMessage:r.message});this.cause=r}},Kn=class extends ae{code="CONFIG_VALIDATION_ERROR";constructor(t,r,n){super(`Configuration validation failed for "${t}"`,{configPath:t,configName:n,validationErrors:r,errorCount:r.length})}},Hn=class extends ae{code="CONFIG_MERGE_ERROR";constructor(t,r,n,i){super(`Failed to merge configuration from "${t}" with "${r}": ${n.message}`,{sourcePath:t,targetPath:r,configName:i,originalError:n.name,originalMessage:n.message});this.cause=n}},Rr=class extends ae{code="ENV_VAR_ERROR";constructor(t,r,n,i){super(`Failed to parse environment variable "${t}" with value "${r}" as ${n}`,{envKey:t,envValue:r,expectedType:n,configName:i})}},Gn=class extends ae{code="FILE_SYSTEM_ERROR";constructor(t,r,n){super(`File system ${t} failed for "${r}": ${n.message}`,{operation:t,path:r,originalError:n.name,originalMessage:n.message});this.cause=n}},qn=class extends ae{code="TYPE_GENERATION_ERROR";constructor(t,r,n){super(`Failed to generate types from "${t}" to "${r}": ${n.message}`,{configDir:t,outputPath:r,originalError:n.name,originalMessage:n.message});this.cause=n}},Ot=class extends ae{code="SCHEMA_VALIDATION_ERROR";constructor(t,r,n){super(`Schema validation failed${n?` for config "${n}"`:""}`,{schemaPath:t,configName:n,validationErrors:r,errorCount:r.length})}},Yn=class extends ae{code="BROWSER_CONFIG_ERROR";constructor(t,r,n,i){super(`Failed to fetch configuration from "${t}": ${r} ${n}`,{endpoint:t,status:r,statusText:n,configName:i})}},Jn=class extends ae{code="PLUGIN_ERROR";constructor(t,r,n){super(`Plugin "${t}" failed during ${r}: ${n.message}`,{pluginName:t,operation:r,originalError:n.name,originalMessage:n.message});this.cause=n}},Fe={configNotFound(e,t,r){return new $r(e,t,r)},configLoad(e,t,r){return new Nt(e,t,r)},configValidation(e,t,r){return new Kn(e,t,r)},configMerge(e,t,r,n){return new Hn(e,t,r,n)},envVar(e,t,r,n){return new Rr(e,t,r,n)},fileSystem(e,t,r){return new Gn(e,t,r)},typeGeneration(e,t,r){return new qn(e,t,r)},schemaValidation(e,t,r){return new Ot(e,t,r)},browserConfig(e,t,r,n){return new Yn(e,t,r,n)},plugin(e,t,r){return new Jn(e,t,r)}},Is={replace:"replace",concat:"concat",smart:"smart"},Ps=/^https?:\/\//,ge=new Cr("bunfig",{showTags:!0}),Ne=new oi,_s=ne(Ge.cwd(),"config"),Ls=ne(Ge.cwd(),"src/generated")});mh=br.env.CLARITY_LOG_DIR||Zf(gh(),"logs"),Ms={level:"info",defaultName:"clarity",timestamp:!0,colors:!0,format:"text",maxLogSize:10485760,logDatePattern:"YYYY-MM-DD",logDirectory:mh,rotation:{frequency:"daily",maxSize:10485760,maxFiles:5,compress:!1,rotateHour:0,rotateMinute:0,rotateDayOfWeek:0,rotateDayOfMonth:1,encrypt:!1},verbose:!1,writeToFile:!1},kr={...Ms},O1=(async()=>{try{let{loadConfig:e}=await hh().then(()=>xs),t=await e({name:"clarity",alias:"logging",defaultConfig:Ms,cwd:br.cwd()});if(t)Object.assign(kr,t)}catch{}return kr})();Y={red:(e)=>`\x1B[31m${e}\x1B[0m`,green:(e)=>`\x1B[32m${e}\x1B[0m`,yellow:(e)=>`\x1B[33m${e}\x1B[0m`,blue:(e)=>`\x1B[34m${e}\x1B[0m`,magenta:(e)=>`\x1B[35m${e}\x1B[0m`,cyan:(e)=>`\x1B[36m${e}\x1B[0m`,white:(e)=>`\x1B[37m${e}\x1B[0m`,gray:(e)=>`\x1B[90m${e}\x1B[0m`,bgRed:(e)=>`\x1B[41m${e}\x1B[0m`,bgYellow:(e)=>`\x1B[43m${e}\x1B[0m`,bgGray:(e)=>`\x1B[100m${e}\x1B[0m`,bold:(e)=>`\x1B[1m${e}\x1B[0m`,dim:(e)=>`\x1B[2m${e}\x1B[0m`,italic:(e)=>`\x1B[3m${e}\x1B[0m`,underline:(e)=>`\x1B[4m${e}\x1B[0m`,strikethrough:(e)=>`\x1B[9m${e}\x1B[0m`,reset:"\x1B[0m"},E=Y,I1=Y.red,yh=Y.green,P1=Y.yellow,bh=Y.blue,_1=Y.magenta,L1=Y.cyan,us=Y.white,M1=Y.gray,xh=Y.bgRed,vh=Y.bgYellow,F1=Y.bgGray,fs=Y.bold,D1=Y.dim,j1=Y.italic,B1=Y.underline,V1=Y.strikethrough,U1=Y.reset,Dn={activationLevel:"error",bufferSize:50,flushOnDeactivation:!0,stopBuffering:!1},wh={debug:"\uD83D\uDD0D",info:bh("\u2139"),success:yh("\u2713"),warning:vh(us(fs(" WARN "))),error:xh(us(fs(" ERROR ")))};W1=new Or("stacks");me=class me extends Error{timestamp;context;constructor(e,t={}){super(e);if(this.name=this.constructor.name,this.timestamp=new Date,this.context=t,Error.captureStackTrace)Error.captureStackTrace(this,this.constructor)}toJSON(){return{name:this.name,code:this.code,message:this.message,timestamp:this.timestamp.toISOString(),context:this.context,stack:this.stack}}toString(){let e=Object.keys(this.context).length>0?` (${Object.entries(this.context).map(([t,r])=>`${t}: ${r}`).join(", ")})`:"";return`${this.name} [${this.code}]: ${this.message}${e}`}};Ds=class Ds extends me{code="CONFIG_NOT_FOUND";constructor(e,t,r){let n=r===void 0?[]:Array.isArray(r)?r.filter(Boolean):[r],i="";if(n.length===1)i=` or alias "${n[0]}"`;else if(n.length>1)i=` or aliases ${n.map((o)=>`"${o}"`).join(", ")}`;super(`Configuration "${e}"${i} not found`,{configName:e,alias:r,searchPaths:t,searchPathCount:t.length})}};Sr=class Sr extends me{code="CONFIG_LOAD_ERROR";constructor(e,t,r){super(`Failed to load configuration from "${e}": ${t.message}`,{configPath:e,configName:r,originalError:t.name,originalMessage:t.message});this.cause=t}};js=class js extends me{code="CONFIG_VALIDATION_ERROR";constructor(e,t,r){super(`Configuration validation failed for "${e}"`,{configPath:e,configName:r,validationErrors:t,errorCount:t.length})}};Bs=class Bs extends me{code="CONFIG_MERGE_ERROR";constructor(e,t,r,n){super(`Failed to merge configuration from "${e}" with "${t}": ${r.message}`,{sourcePath:e,targetPath:t,configName:n,originalError:r.name,originalMessage:r.message});this.cause=r}};si=class si extends me{code="ENV_VAR_ERROR";constructor(e,t,r,n){super(`Failed to parse environment variable "${e}" with value "${t}" as ${r}`,{envKey:e,envValue:t,expectedType:r,configName:n})}};Vs=class Vs extends me{code="FILE_SYSTEM_ERROR";constructor(e,t,r){super(`File system ${e} failed for "${t}": ${r.message}`,{operation:e,path:t,originalError:r.name,originalMessage:r.message});this.cause=r}};Us=class Us extends me{code="TYPE_GENERATION_ERROR";constructor(e,t,r){super(`Failed to generate types from "${e}" to "${t}": ${r.message}`,{configDir:e,outputPath:t,originalError:r.name,originalMessage:r.message});this.cause=r}};Ar=class Ar extends me{code="SCHEMA_VALIDATION_ERROR";constructor(e,t,r){super(`Schema validation failed${r?` for config "${r}"`:""}`,{schemaPath:e,configName:r,validationErrors:t,errorCount:t.length})}};Ws=class Ws extends me{code="BROWSER_CONFIG_ERROR";constructor(e,t,r,n){super(`Failed to fetch configuration from "${e}": ${t} ${r}`,{endpoint:e,status:t,statusText:r,configName:n})}};zs=class zs extends me{code="PLUGIN_ERROR";constructor(e,t,r){super(`Plugin "${e}" failed during ${t}: ${r.message}`,{pluginName:e,operation:t,originalError:r.name,originalMessage:r.message});this.cause=r}};He={configNotFound(e,t,r){return new Ds(e,t,r)},configLoad(e,t,r){return new Sr(e,t,r)},configValidation(e,t,r){return new js(e,t,r)},configMerge(e,t,r,n){return new Bs(e,t,r,n)},envVar(e,t,r,n){return new si(e,t,r,n)},fileSystem(e,t,r){return new Vs(e,t,r)},typeGeneration(e,t,r){return new Us(e,t,r)},schemaValidation(e,t,r){return new Ar(e,t,r)},browserConfig(e,t,r,n){return new Ws(e,t,r,n)},plugin(e,t,r){return new zs(e,t,r)}};Th=/^https?:\/\//;he=new Or("bunfig",{showTags:!0});jn=new Js;q1=ve(Er.cwd(),"config"),Y1=ve(Er.cwd(),"src/generated")});import{existsSync as Be,statSync as ox,watch as mc}from"fs";import{unlink as sx}from"fs/promises";import{dirname as ax,resolve as Ii}from"path";import ye from"process";var{Glob:lx}=globalThis.Bun;import{EventEmitter as bc}from"events";import Ie from"process";import _i from"process";import Zr from"process";import Mt from"process";import vt from"process";import Di from"tty";import su,{stdin as Rx,stdout as kx}from"process";import{existsSync as fu}from"fs";import Yr from"fs/promises";import ji from"os";import Jr from"path";import Ve from"process";function Xr(e){return e.replace(/[<[].+/,"").trim()}function xc(e){let t=/<([^>]+)>/g,r=/\[([^\]]+)\]/g,n=[],i=(c)=>{let a=!1,l=c[1];if(l.startsWith("..."))l=l.slice(3),a=!0;else if(l.endsWith("..."))l=l.slice(0,-3),a=!0;return{required:c[0].startsWith("<"),value:l.trim(),variadic:a}},o;while(o=t.exec(e))n.push(i(o));let s;while(s=r.exec(e))n.push(i(s));return n}function vc(e){let t={alias:{},boolean:[]};for(let[r,n]of e.entries()){if(n.names.length>1)t.alias[n.names[0]]=n.names.slice(1);if(n.isBoolean)if(n.negated){if(!e.some((o,s)=>s!==r&&o.names.some((c)=>n.names.includes(c))&&typeof o.required==="boolean"))t.boolean.push(n.names[0])}else t.boolean.push(n.names[0])}return t}function Li(e){return e.reduce((t,r)=>t.length>=r.length?t:r,"")}function qr(e,t){return e.length>=t?e:`${e}${" ".repeat(t-e.length)}`}function Lt(e){return e.replace(/([a-z])-([a-z])/g,(t,r,n)=>r+n.toUpperCase())}function wc(e,t,r){let n=0,i=t.length,o=e,s;for(;n<i;++n)s=o[t[n]],o=o[t[n]]=n===i-1?r:s!=null?s:!!~t[n+1].indexOf(".")||!(+t[n+1]>-1)?{}:[]}function Cc(e,t){for(let r of Object.keys(t)){let n=t[r];if(e[r]===void 0)continue;if(n.shouldTransform){if(e[r]=Array.prototype.concat.call([],e[r]),typeof n.transformFunction==="function")e[r]=e[r].map(n.transformFunction)}}}function $c(e){let t=/([^\\/]+)$/.exec(e);return t?t[1]:""}function wt(e){return e.split(".").map((t,r)=>r===0?Lt(t):t).join(".")}class Ct extends Error{exitCode=2;isUsageError=!0;usage;constructor(e,t){super(e);if(this.name=this.constructor.name,t!==void 0)this.usage=t;if(typeof Error.captureStackTrace==="function")Error.captureStackTrace(this,this.constructor);else this.stack=Error(e).stack}format(e=!1){if(e&&this.stack)return`${this.message}
|
|
62
|
+
`;return r}}function Sh(e,t,r={}){return qs(e,t,r,new WeakMap)}function qs(e,t,r,n){let{arrayMergeMode:i="replace",skipNullish:o=!1,customMerger:s}=r;if(t===null||t===void 0)return o?e:t;if(s){let c=s(e,t);if(c!==void 0)return c}if(Array.isArray(t)||Array.isArray(e))return Ys(e,t,i,n);if(!ue(t)||!ue(e))return t;return Nh(e,t,r,n)}function Ys(e,t,r,n){if(Array.isArray(t)&&!Array.isArray(e))return t;if(Array.isArray(e)&&!Array.isArray(t))return t;if(Array.isArray(t)&&Array.isArray(e))switch(r){case"replace":return t;case"concat":return Ah(e,t);case"smart":return Eh(e,t,n);default:return t}return t}function Ah(e,t){let r=[...t];for(let n of e)if(!r.some((i)=>ei(i,n)))r.push(n);return r}function Eh(e,t,r){if(t.length===0)return e;if(e.length===0)return t;if(ue(t[0])&&ue(e[0]))return Th(e,t,r);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}function Th(e,t,r){let n=[...t];for(let i of e){if(!ue(i)){n.push(i);continue}let o=["id","name","key","path","type"],s=!1;for(let c of o)if(c in i){if(n.find((l)=>ue(l)&&(c in l)&&l[c]===i[c])){s=!0;break}}if(!s)n.push(i)}return n}function Nh(e,t,r,n){let i=t;if(ue(i)&&n.has(i))return n.get(i);let o={...e};if(ue(i))n.set(i,o);for(let s in i){if(!Object.prototype.hasOwnProperty.call(i,s))continue;let c=i[s],a=o[s];if(r.skipNullish&&(c===null||c===void 0))continue;if(c===null||c===void 0){o[s]=c;continue}if(ue(c)&&ue(a))o[s]=qs(a,c,r,n);else if(Array.isArray(c)||Array.isArray(a))o[s]=Ys(a,c,r.arrayMergeMode||"smart",n);else o[s]=c}return o}function Js(e,t,r="replace"){return Sh(e,t,{arrayMergeMode:r==="replace"?"replace":"smart",skipNullish:!0})}function ei(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(!ei(e[r],t[r]))return!1;return!0}if(ue(e)&&ue(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(!ei(e[i],t[i]))return!1}return!0}return!1}function ue(e){return Boolean(e&&typeof e==="object"&&!Array.isArray(e))}class Xs{extensions=bs;async loadFromPath(e,t,r={}){let{arrayStrategy:n="replace",useCache:i=!0,cacheTtl:o,trackPerformance:s=!0,verbose:c=!1}=r;if(i){let l=pr.getWithFileCheck("file",e);if(l){if(c)console.log(`Configuration loaded from cache: ${e}`);return l}}let a=async()=>{if(!ur(e))return null;try{let l=`?t=${Date.now()}`,u=await import(e+l),f=u.default||u,d="default"in u,h=Object.keys(u).length>0;if(!d&&!h)throw new Er(e,Error("Configuration file is empty and exports nothing"),"unknown");if(typeof f!=="object"||f===null||Array.isArray(f))throw new Er(e,Error("Configuration must export a valid object"),"unknown");let p={config:Js(t,f,n),source:{type:"file",path:e,priority:100,timestamp:new Date}};if(i)pr.setWithFileCheck("file",p,e,o);return p}catch(l){throw l instanceof Error?He.configLoad(e,l):He.configLoad(e,Error(String(l)))}};if(s)return ti.track("loadFromPath",a,{path:e});return a()}async tryLoadFromPaths(e,t,r={}){for(let n of e)try{let i=await this.loadFromPath(n,t,r);if(i)return i}catch(i){if(i instanceof Error&&i.name==="ConfigLoadError")throw i;if(r.verbose)console.warn(`Failed to load config from ${n}:`,i)}return null}generateConfigPaths(e,t,r){return Rf({name:e,directory:t,alias:r})}generateNamePatterns(e,t){return xs({name:e,alias:t})}checkFileAccess(e){return kh(async()=>ur(e),{maxRetries:2,retryDelay:100,fallback:!1})}async discoverConfigFiles(e,t,r){let n=[];if(!ur(e))return n;if(t||r){let i=this.generateNamePatterns(t||"",r);for(let o of i)for(let s of this.extensions){let c=ms(e,`${o}${s}`);if(await this.checkFileAccess(c))n.push(c)}}else try{let{readdirSync:i}=await import("fs"),o=i(e);for(let s of o)if(this.looksLikeConfigFile(s)){let c=ms(e,s);if(await this.checkFileAccess(c))n.push(c)}}catch{return[]}return n}looksLikeConfigFile(e){return[/\.config\.(ts|js|mjs|cjs|json|mts|cts)$/,/^\..*\.(ts|js|mjs|cjs|json|mts|cts)$/,/config\.(ts|js|mjs|cjs|json|mts|cts)$/].some((r)=>r.test(e))}async validateConfigFile(e){let t=[];try{if(!ur(e))return t.push("Configuration file does not exist"),t;let r=await import(e),n=r.default||r;if(n===void 0)t.push("Configuration file must export a default value or named exports");else if(typeof n!=="object"||n===null)t.push("Configuration must be an object");else if(Array.isArray(n))t.push("Configuration cannot be an array at the root level");if(e.endsWith(".json"))try{let{readFileSync:i}=await import("fs"),o=i(e,"utf8");JSON.parse(o)}catch(i){t.push(`Invalid JSON syntax: ${i}`)}}catch(r){t.push(`Failed to load configuration file: ${r}`)}return t}async getFileModificationTime(e){try{let{statSync:t}=await import("fs");return t(e).mtime}catch{return null}}async preloadConfigurations(e,t={}){let r=new Map;return await Promise.allSettled(e.map(async(n)=>{try{let i=await this.loadFromPath(n,{},t);if(i)r.set(n,i.config)}catch(i){if(t.verbose)console.warn(`Failed to preload ${n}:`,i)}})),r}}class Zs{async validateConfiguration(e,t,r={}){let{stopOnFirstError:n=!1,validateRequired:i=!0,validateTypes:o=!0,customRules:s=[],trackPerformance:c=!0,verbose:a=!1}=r,l=async()=>{let u=[],f=[],d={stopOnFirstError:n,validateRequired:i,validateTypes:o,customRules:s,trackPerformance:c,verbose:a};try{if(typeof t==="string")return await this.validateWithSchemaFile(e,t,d);else if(Array.isArray(t))return this.validateWithRules(e,[...t,...s],d);else return this.validateWithJSONSchema(e,t,d)}catch(h){return u.push({path:"",message:`Validation failed: ${h}`,rule:"system"}),{isValid:!1,errors:u,warnings:f}}};if(c)return await ti.track("validateConfiguration",l);return l()}async validateWithSchemaFile(e,t,r){try{if(!Oh(t))throw new Tr(t,[{path:"",message:"Schema file does not exist"}]);let n=await import(t),i=n.default||n;if(Array.isArray(i))return this.validateWithRules(e,i,r);else return this.validateWithJSONSchema(e,i,r)}catch(n){throw new Tr(t,[{path:"",message:`Failed to load schema: ${n}`}])}}validateWithJSONSchema(e,t,r){let n=[],i=[];return this.validateObjectAgainstSchema(e,t,"",n,i,r),{isValid:n.length===0,errors:n,warnings:i}}validateObjectAgainstSchema(e,t,r,n,i,o){if(o.validateTypes&&t.type){let s=Array.isArray(e)?"array":typeof e,c=Array.isArray(t.type)?t.type:[t.type];if(!c.includes(s)){if(n.push({path:r,message:`Expected type ${c.join(" or ")}, got ${s}`,expected:c.join(" or "),actual:s,rule:"type"}),o.stopOnFirstError)return}}if(t.enum&&!t.enum.includes(e)){if(n.push({path:r,message:`Value must be one of: ${t.enum.join(", ")}`,expected:t.enum.join(", "),actual:e,rule:"enum"}),o.stopOnFirstError)return}if(typeof e==="string"){if(t.minLength!==void 0&&e.length<t.minLength)n.push({path:r,message:`String length must be at least ${t.minLength}`,expected:`>= ${t.minLength}`,actual:e.length,rule:"minLength"});if(t.maxLength!==void 0&&e.length>t.maxLength)n.push({path:r,message:`String length must not exceed ${t.maxLength}`,expected:`<= ${t.maxLength}`,actual:e.length,rule:"maxLength"});if(t.pattern){if(!new RegExp(t.pattern).test(e))n.push({path:r,message:`String does not match pattern ${t.pattern}`,expected:t.pattern,actual:e,rule:"pattern"})}}if(typeof e==="number"){if(t.minimum!==void 0&&e<t.minimum)n.push({path:r,message:`Value must be at least ${t.minimum}`,expected:`>= ${t.minimum}`,actual:e,rule:"minimum"});if(t.maximum!==void 0&&e>t.maximum)n.push({path:r,message:`Value must not exceed ${t.maximum}`,expected:`<= ${t.maximum}`,actual:e,rule:"maximum"})}if(Array.isArray(e)&&t.items)for(let s=0;s<e.length;s++){let c=r?`${r}[${s}]`:`[${s}]`;if(this.validateObjectAgainstSchema(e[s],t.items,c,n,i,o),o.stopOnFirstError&&n.length>0)return}if(e&&typeof e==="object"&&!Array.isArray(e)){let s=e;if(o.validateRequired&&t.required){for(let c of t.required)if(!(c in s)){if(n.push({path:r?`${r}.${c}`:c,message:`Missing required property '${c}'`,expected:"required",rule:"required"}),o.stopOnFirstError)return}}if(t.properties){for(let[c,a]of Object.entries(t.properties))if(c in s){let l=r?`${r}.${c}`:c;if(this.validateObjectAgainstSchema(s[c],a,l,n,i,o),o.stopOnFirstError&&n.length>0)return}}if(t.additionalProperties===!1){let c=new Set(Object.keys(t.properties||{}));for(let a of Object.keys(s))if(!c.has(a))i.push({path:r?`${r}.${a}`:a,message:`Additional property '${a}' is not allowed`,rule:"additionalProperties"})}}}validateWithRules(e,t,r){let n=[],i=[];for(let o of t)try{let s=this.getValueByPath(e,o.path),c=this.validateWithRule(s,o,o.path);if(n.push(...c),r.stopOnFirstError&&n.length>0)break}catch(s){n.push({path:o.path,message:`Rule validation failed: ${s}`,rule:"system"})}return{isValid:n.length===0,errors:n,warnings:i}}validateWithRule(e,t,r){let n=[];if(t.required&&(e===void 0||e===null))return n.push({path:r,message:t.message||`Property '${r}' is required`,expected:"required",rule:"required"}),n;if(e===void 0||e===null)return n;if(t.type){let i=Array.isArray(e)?"array":typeof e;if(i!==t.type)n.push({path:r,message:t.message||`Expected type ${t.type}, got ${i}`,expected:t.type,actual:i,rule:"type"})}if(t.min!==void 0){let i=Array.isArray(e)?e.length:typeof e==="string"?e.length:typeof e==="number"?e:0;if(i<t.min)n.push({path:r,message:t.message||`Value must be at least ${t.min}`,expected:`>= ${t.min}`,actual:i,rule:"min"})}if(t.max!==void 0){let i=Array.isArray(e)?e.length:typeof e==="string"?e.length:typeof e==="number"?e:0;if(i>t.max)n.push({path:r,message:t.message||`Value must not exceed ${t.max}`,expected:`<= ${t.max}`,actual:i,rule:"max"})}if(t.pattern&&typeof e==="string"){if(!t.pattern.test(e))n.push({path:r,message:t.message||`Value does not match pattern ${t.pattern}`,expected:t.pattern.toString(),actual:e,rule:"pattern"})}if(t.enum&&!t.enum.includes(e))n.push({path:r,message:t.message||`Value must be one of: ${t.enum.join(", ")}`,expected:t.enum.join(", "),actual:e,rule:"enum"});if(t.validator){let i=t.validator(e);if(i)n.push({path:r,message:t.message||i,rule:"custom"})}return n}getValueByPath(e,t){if(!t)return e;let r=t.split("."),n=e;for(let i of r)if(n&&typeof n==="object"&&i in n)n=n[i];else return;return n}generateRulesFromInterface(e){let t=[],r=e.matchAll(/(\w+)(\?)?:\s*(\w+)/g);for(let n of r){let[,i,o,s]=n;t.push({path:i,required:!o,type:this.mapTypeScriptType(s)})}return t}mapTypeScriptType(e){switch(e.toLowerCase()){case"string":return"string";case"number":return"number";case"boolean":return"boolean";case"array":return"array";case"object":return"object";default:return"object"}}static createCommonRules(){return{server:[{path:"port",required:!0,type:"number",min:1,max:65535},{path:"host",required:!0,type:"string",min:1},{path:"ssl",type:"boolean"}],database:[{path:"url",required:!0,type:"string",min:1},{path:"pool",type:"number",min:1,max:100},{path:"timeout",type:"number",min:0}],api:[{path:"baseUrl",required:!0,type:"string",pattern:Ih},{path:"timeout",type:"number",min:0},{path:"retries",type:"number",min:0,max:10}]}}}function Ph(e){if(!e)return"";let t=Array.isArray(e)?e.filter(Boolean):[e];if(t.length===0)return"";if(t.length===1)return` or alias "${t[0]}"`;return` or aliases ${t.map((r)=>`"${r}"`).join(", ")}`}class Qs{fileLoader=new Xs;envProcessor=new ui;validator=new Zs;async loadConfig(e){let t=Date.now(),{cache:r,performance:n,schema:i,validate:o,...s}=e;try{if(r?.enabled){let a=this.checkCache(s.name||"",s);if(a)return a}let c;try{c=await this.loadConfigurationStrategies(s,!0,r)}catch(a){if(s.configFile)throw a;let l=s.__strictErrorHandling;if(a instanceof Error&&a.name==="ConfigNotFoundError"){if(l)throw a;c={...await this.applyEnvironmentVariables(s.name||"",s.defaultConfig,s.checkEnv!==!1,s.verbose||!1),warnings:[`No configuration file found for "${s.name||"config"}", using defaults with environment variables`]}}else if(a instanceof Error&&a.name==="ConfigLoadError"){let u=a.message.includes("EACCES")||a.message.includes("EPERM")||a.message.includes("permission denied"),f=!u&&(a.message.includes("syntax")||a.message.includes("Expected")||a.message.includes("Unexpected")||a.message.includes("BuildMessage")||a.message.includes("errors building")),d=a.message.includes("Configuration must export a valid object")||a.message.includes("Configuration file is empty and exports nothing");if(l&&(d||u))throw a;if(f&&(!l||!d))c={...await this.applyEnvironmentVariables(s.name||"",s.defaultConfig,s.checkEnv!==!1,s.verbose||!1),warnings:["Configuration file has syntax errors, using defaults with environment variables"]};else if(!l)c={...await this.applyEnvironmentVariables(s.name||"",s.defaultConfig,s.checkEnv!==!1,s.verbose||!1),warnings:[`Configuration loading error, using defaults: ${a.message}`]};else throw a}else c={...await this.applyEnvironmentVariables(s.name||"",s.defaultConfig,s.checkEnv!==!1,s.verbose||!1),warnings:[`Configuration loading failed, using defaults: ${a instanceof Error?a.message:String(a)}`]}}if(i||o)await this.validateConfiguration(c.config,i,o,s.name);if(r?.enabled&&c)this.cacheResult(s.name||"",c,r,s);if(n?.enabled){let a={operation:"loadConfig",duration:Date.now()-t,configName:s.name,timestamp:new Date};if(n.onMetrics)n.onMetrics(a);if(n.slowThreshold&&a.duration>n.slowThreshold)he.warn(`Slow configuration loading detected: ${a.duration}ms for ${s.name}`);c.metrics=a}return c}catch(c){if(c instanceof Error&&c.name==="ConfigNotFoundError")throw c;let a=Date.now()-t;throw he.error(`Configuration loading failed after ${a}ms:`,[c instanceof Error?c:Error(String(c))]),c}}async loadConfigurationStrategies(e,t=!1,r){let{name:n="",alias:i,configFile:o,cwd:s,configDir:c,defaultConfig:a,checkEnv:l=!0,arrayStrategy:u="replace",verbose:f=!1}=e,d=s||Nr.cwd(),h=[];if(o){let b=ve(d,o);h.push(b);let w=l?At(n,a,f):a,T=await this.fileLoader.tryLoadFromPaths([b],w,{arrayStrategy:u,verbose:f,cacheTtl:r?.ttl,useCache:!r?.ttl||r.ttl>100});if(!T)throw He.configNotFound(n||o,h,i);if(f)he.success(`Configuration loaded from explicit path: ${b}`);return this.finalizeResult(T,h,l,n,f)}let m=await this.loadLocalConfiguration(n,i,d,c,a,u,f,l,r);if(m)return h.push(...this.getLocalSearchPaths(n,i,d,c)),this.finalizeResult(m,h,l,n,f);let g=await this.loadHomeConfiguration(n,i,a,u,f,l);if(g)return h.push(...this.getHomeSearchPaths(n,i)),this.finalizeResult(g,h,l,n,f);let p=await this.loadPackageJsonConfiguration(n,i,d,a,u,f,l);if(p)return h.push(ve(d,"package.json")),this.finalizeResult(p,h,l,n,f);if(h.push(...this.getAllSearchPaths(n,i,d,c)),t)throw He.configNotFound(n,h,i);return{...await this.applyEnvironmentVariables(n,a,l,f),warnings:[`No configuration file found for "${n}"${Ph(i)}, using defaults with environment variables`]}}async loadLocalConfiguration(e,t,r,n,i,o,s,c,a){let l=c?At(e,i,s):i,u=this.getLocalDirectories(r,n);for(let f of u){if(s)he.info(`Searching for configuration in: ${f}`);let d=this.fileLoader.generateConfigPaths(e,f,t),h=await this.fileLoader.tryLoadFromPaths(d,l,{arrayStrategy:o,verbose:s,cacheTtl:a?.ttl,useCache:!a?.ttl||a.ttl>100});if(h){if(s)he.success(`Configuration loaded from: ${h.source.path}`);return h}}return null}async loadHomeConfiguration(e,t,r,n,i,o){if(!e)return null;let s=o?At(e,r,i):r,c=[ve(tt(),".config",e),ve(tt(),".config"),tt()];for(let a of c){if(i)he.info(`Checking home directory: ${a}`);let l=this.fileLoader.generateConfigPaths(e,a,t),u=await this.fileLoader.tryLoadFromPaths(l,s,{arrayStrategy:n,verbose:i});if(u){if(i)he.success(`Configuration loaded from home directory: ${u.source.path}`);return u}}return null}async loadPackageJsonConfiguration(e,t,r,n,i,o,s){let c=s?At(e,n,o):n;try{let a=ve(r,"package.json");if(!Sf(a))return null;let l={};try{l=JSON.parse(Af(a,"utf8"))}catch(d){if(o)he.warn("Failed to parse package.json:",[d instanceof Error?d:Error(String(d))]);return null}let u=l[e],f=e;if(!u&&t){let d=Array.isArray(t)?t:[t];for(let h of d){if(!h)continue;if(l[h]){u=l[h],f=h;break}}}if(u&&typeof u==="object"&&!Array.isArray(u)){if(o)he.success(`Configuration loaded from package.json: ${f}`);return{config:Js(c,u,i),source:{type:"package.json",path:a,priority:30,timestamp:new Date}}}}catch(a){if(o)he.warn("Failed to load package.json:",[a instanceof Error?a:Error(String(a))])}return null}async applyEnvironmentVariables(e,t,r,n){if(!r||!e||typeof t!=="object"||t===null||Array.isArray(t))return{config:t,source:{type:"default",priority:10,timestamp:new Date}};return{config:At(e,t,n),source:{type:"environment",priority:20,timestamp:new Date}}}async finalizeResult(e,t,r,n,i){return{config:e.config,source:e.source,path:e.source.path}}async validateConfiguration(e,t,r,n){let i=[];if(r){let o=r(e);if(o)i.push(...o)}if(t){let o=await this.validator.validateConfiguration(e,t);if(!o.isValid)i.push(...o.errors.map((s)=>s.path?`${s.path}: ${s.message}`:s.message))}if(i.length>0)throw He.configValidation(n||"unknown",i,n)}checkCache(e,t){let r=this.generateCacheKey(e,t);return pr.get(r)||null}cacheResult(e,t,r,n){let i=this.generateCacheKey(e,n);pr.set(i,t,void 0,r.ttl)}generateCacheKey(e,t){let r=[e];if(t.alias){let n=Array.isArray(t.alias)?t.alias.join(","):t.alias;r.push(`alias:${n}`)}if(t.cwd)r.push(`cwd:${t.cwd}`);if(t.configFile)r.push(`configFile:${t.configFile}`);if(t.configDir)r.push(`configDir:${t.configDir}`);if("checkEnv"in t)r.push(`checkEnv:${t.checkEnv}`);return r.join("|")}getLocalDirectories(e,t){return kf({cwd:e,configDir:t})}getAllSearchPaths(e,t,r,n){let i=[];return i.push(...this.getLocalSearchPaths(e,t,r,n)),i.push(...this.getHomeSearchPaths(e,t)),i.push(ve(r,"package.json")),i}getLocalSearchPaths(e,t,r,n){let i=this.getLocalDirectories(r,n),o=[];for(let s of i)o.push(...this.fileLoader.generateConfigPaths(e,s,t));return o}getHomeSearchPaths(e,t){if(!e)return[];let r=[ve(tt(),".config",e),ve(tt(),".config"),tt()],n=[];for(let i of r)n.push(...this.fileLoader.generateConfigPaths(e,i,t));return n}async loadConfigWithResult(e){return this.loadConfig(e)}}async function ea(e){let t="defaultConfig"in e&&e.defaultConfig!==void 0?e.defaultConfig:{},r="cache"in e||"performance"in e||"schema"in e||"validate"in e;try{let n;if(r)n=await Vn.loadConfig(e);else n=await Vn.loadConfig({...e,defaultConfig:t,cache:{enabled:!0},performance:{enabled:!1}});return n?.config??t}catch(n){if(e.configFile)throw n;let i=n instanceof Error?n.name:"UnknownError",o=n instanceof Error?n.message:String(n);if(!(i==="ConfigNotFoundError"||i==="ConfigLoadError"||i==="ConfigValidationError"||o.includes("config"))&&e.verbose)he.warn("Unexpected error loading config, using defaults:",[n instanceof Error?n:Error(String(n))]);let c=r?{...e,defaultConfig:t}:{...e,defaultConfig:t,cache:{enabled:!0},performance:{enabled:!1}};if("checkEnv"in e?e.checkEnv!==!1:!0)return(await Vn.applyEnvironmentVariables(c.name||"",t,!0,c.verbose||!1))?.config??t;return t}}function At(e,t,r=!1){let n=new ui,i=e.toUpperCase().replace(/[^A-Z0-9]/g,"_");function o(s,c=[]){let a={...s};for(let[l,u]of Object.entries(s)){let f=[...c,l],d=[`${i}_${f.join("_").toUpperCase()}`,`${i}_${f.map((g)=>g.toUpperCase()).join("")}`,`${i}_${f.map((g)=>g.replace(/([A-Z])/g,"_$1").toUpperCase()).join("")}`],h,m;for(let g of d)if(h=Nr.env[g],h!==void 0){m=g;break}if(h!==void 0&&m)if(typeof u==="boolean")a[l]=["true","1","yes"].includes(h.toLowerCase());else if(typeof u==="number"){let g=Number(h);if(!Number.isNaN(g))a[l]=g}else if(Array.isArray(u))try{a[l]=JSON.parse(h)}catch{a[l]=h.split(",").map((g)=>g.trim())}else a[l]=h;else if(u&&typeof u==="object"&&!Array.isArray(u))a[l]=o(u,f)}return a}return o(t)}var pr,ti,bs,dd,hd=(e)=>e,md=(e,t)=>{for(var r in t)dd(e,r,{get:t[r],enumerable:!0,configurable:!0,set:gd.bind(t,r)})},pd=(e,t)=>()=>(e&&(t=e(e=0)),t),$s,Os,dt,Pt,Is,Wd,zd,ns,dr,Hn,X,P,Kd,is,Hd,os,Gd,qd,Fn,Yd,ss,as,Dn,Jd,Xd,Zd,Qd,hr,Ps,eh,Z,th,rh,ls,gr,Gn,H,A,nh,cs,ih,us,oh,sh,jn,ah,fs,ds,lh,Bn,ch,uh,fh,dh,hh,mr,_s,gh,mh="0.15.6",ae,kr,Ot,qn,Yn,Sr,Jn,Xn,It,Zn,Qn,Fe,Ls,Ms,ge,Ne,Fs,Ds,ph,bh,js,Ar,F1,Y,E,D1,vh,j1,wh,B1,U1,hs,V1,$h,Ch,W1,gs,z1,K1,H1,G1,q1,Un,Rh,Y1,me,Us,Er,Vs,Ws,ci,zs,Ks,Tr,Hs,Gs,He,Ih,he,Vn,e$,t$;var ta=vc(()=>{pr=new ps,ti=new ys,bs=[".ts",".js",".mjs",".cjs",".json",".mts",".cts"];dd=Object.defineProperty;$s={};md($s,{withErrorRecovery:()=>ks,tryLoadConfig:()=>jd,loadConfigWithResult:()=>Fd,loadConfig:()=>Ns,isRetryableError:()=>Od,isConfigNotFoundError:()=>Nd,isBunfigError:()=>Ss,globalPerformanceMonitor:()=>Pt,globalCache:()=>dt,getEnvOrDefault:()=>Id,generateConfigTypes:()=>Bd,defaultGeneratedDir:()=>Ds,defaultConfigDir:()=>Fs,deepMergeWithArrayStrategy:()=>si,deepMerge:()=>As,createLibraryConfig:()=>Ud,config:()=>Dd,bunfigPlugin:()=>Vd,applyEnvVarsToConfig:()=>Tt,TypeGenerationError:()=>Xn,SchemaValidationError:()=>It,PluginError:()=>Qn,PerformanceMonitor:()=>ni,FileSystemError:()=>Jn,ErrorFactory:()=>Fe,EnvVarError:()=>Sr,EnvProcessor:()=>Or,ConfigValidator:()=>ai,ConfigValidationError:()=>qn,ConfigNotFoundError:()=>kr,ConfigMergeError:()=>Yn,ConfigLoader:()=>li,ConfigLoadError:()=>Ot,ConfigFileLoader:()=>Ir,ConfigCache:()=>ri,CacheUtils:()=>Is,BunfigError:()=>ae,BrowserConfigError:()=>Zn,ArrayMergeStrategies:()=>Ls});ph=pd(async()=>{Os=import.meta.require,dt=new ri,Pt=new ni,Is={createKey:yd,isEquivalent:bd,estimateMemoryUsage:xd},Wd=xr(zn.cwd(),"config"),zd=xr(zn.cwd(),"src/generated"),ns=br.env.CLARITY_LOG_DIR||Pf($d(),"logs"),dr={level:"info",defaultName:"clarity",timestamp:!0,colors:!0,format:"text",maxLogSize:10485760,logDatePattern:"YYYY-MM-DD",logDirectory:ns,rotation:{frequency:"daily",maxSize:10485760,maxFiles:5,compress:!1,rotateHour:0,rotateMinute:0,rotateDayOfWeek:0,rotateDayOfMonth:1,encrypt:!1},verbose:!1},Hn=await Cd(),X={red:(e)=>`\x1B[31m${e}\x1B[0m`,green:(e)=>`\x1B[32m${e}\x1B[0m`,yellow:(e)=>`\x1B[33m${e}\x1B[0m`,blue:(e)=>`\x1B[34m${e}\x1B[0m`,magenta:(e)=>`\x1B[35m${e}\x1B[0m`,cyan:(e)=>`\x1B[36m${e}\x1B[0m`,white:(e)=>`\x1B[37m${e}\x1B[0m`,gray:(e)=>`\x1B[90m${e}\x1B[0m`,bgRed:(e)=>`\x1B[41m${e}\x1B[0m`,bgYellow:(e)=>`\x1B[43m${e}\x1B[0m`,bold:(e)=>`\x1B[1m${e}\x1B[0m`,dim:(e)=>`\x1B[2m${e}\x1B[0m`,italic:(e)=>`\x1B[3m${e}\x1B[0m`,underline:(e)=>`\x1B[4m${e}\x1B[0m`,reset:"\x1B[0m"},P=X,Kd=X.red,is=X.green,Hd=X.yellow,os=X.blue,Gd=X.magenta,qd=X.cyan,Fn=X.white,Yd=X.gray,ss=X.bgRed,as=X.bgYellow,Dn=X.bold,Jd=X.dim,Xd=X.italic,Zd=X.underline,Qd=X.reset,hr={activationLevel:"error",bufferSize:50,flushOnDeactivation:!0,stopBuffering:!1},Ps={debug:"\uD83D\uDD0D",info:os("\u2139"),success:is("\u2713"),warning:as(Fn(Dn(" WARN "))),error:ss(Fn(Dn(" ERROR ")))},eh=new $r("stacks"),Z=new $r("bunfig",{showTags:!0}),th=re(Nt.cwd(),"config"),rh=re(Nt.cwd(),"src/generated"),ls=yr.env.CLARITY_LOG_DIR||Of(Ad(),"logs"),gr={level:"info",defaultName:"clarity",timestamp:!0,colors:!0,format:"text",maxLogSize:10485760,logDatePattern:"YYYY-MM-DD",logDirectory:ls,rotation:{frequency:"daily",maxSize:10485760,maxFiles:5,compress:!1,rotateHour:0,rotateMinute:0,rotateDayOfWeek:0,rotateDayOfMonth:1,encrypt:!1},verbose:!1,writeToFile:!1},Gn=await Ed(),H={red:(e)=>`\x1B[31m${e}\x1B[0m`,green:(e)=>`\x1B[32m${e}\x1B[0m`,yellow:(e)=>`\x1B[33m${e}\x1B[0m`,blue:(e)=>`\x1B[34m${e}\x1B[0m`,magenta:(e)=>`\x1B[35m${e}\x1B[0m`,cyan:(e)=>`\x1B[36m${e}\x1B[0m`,white:(e)=>`\x1B[37m${e}\x1B[0m`,gray:(e)=>`\x1B[90m${e}\x1B[0m`,bgRed:(e)=>`\x1B[41m${e}\x1B[0m`,bgYellow:(e)=>`\x1B[43m${e}\x1B[0m`,bgGray:(e)=>`\x1B[100m${e}\x1B[0m`,bold:(e)=>`\x1B[1m${e}\x1B[0m`,dim:(e)=>`\x1B[2m${e}\x1B[0m`,italic:(e)=>`\x1B[3m${e}\x1B[0m`,underline:(e)=>`\x1B[4m${e}\x1B[0m`,strikethrough:(e)=>`\x1B[9m${e}\x1B[0m`,reset:"\x1B[0m"},A=H,nh=H.red,cs=H.green,ih=H.yellow,us=H.blue,oh=H.magenta,sh=H.cyan,jn=H.white,ah=H.gray,fs=H.bgRed,ds=H.bgYellow,lh=H.bgGray,Bn=H.bold,ch=H.dim,uh=H.italic,fh=H.underline,dh=H.strikethrough,hh=H.reset,mr={activationLevel:"error",bufferSize:50,flushOnDeactivation:!0,stopBuffering:!1},_s={debug:"\uD83D\uDD0D",info:us("\u2139"),success:cs("\u2713"),warning:ds(jn(Bn(" WARN "))),error:fs(jn(Bn(" ERROR ")))},gh=new Rr("stacks"),ae=class extends Error{timestamp;context;constructor(t,r={}){super(t);if(this.name=this.constructor.name,this.timestamp=new Date,this.context=r,Error.captureStackTrace)Error.captureStackTrace(this,this.constructor)}toJSON(){return{name:this.name,code:this.code,message:this.message,timestamp:this.timestamp.toISOString(),context:this.context,stack:this.stack}}toString(){let t=Object.keys(this.context).length>0?` (${Object.entries(this.context).map(([r,n])=>`${r}: ${n}`).join(", ")})`:"";return`${this.name} [${this.code}]: ${this.message}${t}`}},kr=class extends ae{code="CONFIG_NOT_FOUND";constructor(t,r,n){let i=n?` or alias "${n}"`:"";super(`Configuration "${t}"${i} not found`,{configName:t,alias:n,searchPaths:r,searchPathCount:r.length})}},Ot=class extends ae{code="CONFIG_LOAD_ERROR";constructor(t,r,n){super(`Failed to load configuration from "${t}": ${r.message}`,{configPath:t,configName:n,originalError:r.name,originalMessage:r.message});this.cause=r}},qn=class extends ae{code="CONFIG_VALIDATION_ERROR";constructor(t,r,n){super(`Configuration validation failed for "${t}"`,{configPath:t,configName:n,validationErrors:r,errorCount:r.length})}},Yn=class extends ae{code="CONFIG_MERGE_ERROR";constructor(t,r,n,i){super(`Failed to merge configuration from "${t}" with "${r}": ${n.message}`,{sourcePath:t,targetPath:r,configName:i,originalError:n.name,originalMessage:n.message});this.cause=n}},Sr=class extends ae{code="ENV_VAR_ERROR";constructor(t,r,n,i){super(`Failed to parse environment variable "${t}" with value "${r}" as ${n}`,{envKey:t,envValue:r,expectedType:n,configName:i})}},Jn=class extends ae{code="FILE_SYSTEM_ERROR";constructor(t,r,n){super(`File system ${t} failed for "${r}": ${n.message}`,{operation:t,path:r,originalError:n.name,originalMessage:n.message});this.cause=n}},Xn=class extends ae{code="TYPE_GENERATION_ERROR";constructor(t,r,n){super(`Failed to generate types from "${t}" to "${r}": ${n.message}`,{configDir:t,outputPath:r,originalError:n.name,originalMessage:n.message});this.cause=n}},It=class extends ae{code="SCHEMA_VALIDATION_ERROR";constructor(t,r,n){super(`Schema validation failed${n?` for config "${n}"`:""}`,{schemaPath:t,configName:n,validationErrors:r,errorCount:r.length})}},Zn=class extends ae{code="BROWSER_CONFIG_ERROR";constructor(t,r,n,i){super(`Failed to fetch configuration from "${t}": ${r} ${n}`,{endpoint:t,status:r,statusText:n,configName:i})}},Qn=class extends ae{code="PLUGIN_ERROR";constructor(t,r,n){super(`Plugin "${t}" failed during ${r}: ${n.message}`,{pluginName:t,operation:r,originalError:n.name,originalMessage:n.message});this.cause=n}},Fe={configNotFound(e,t,r){return new kr(e,t,r)},configLoad(e,t,r){return new Ot(e,t,r)},configValidation(e,t,r){return new qn(e,t,r)},configMerge(e,t,r,n){return new Yn(e,t,r,n)},envVar(e,t,r,n){return new Sr(e,t,r,n)},fileSystem(e,t,r){return new Jn(e,t,r)},typeGeneration(e,t,r){return new Xn(e,t,r)},schemaValidation(e,t,r){return new It(e,t,r)},browserConfig(e,t,r,n){return new Zn(e,t,r,n)},plugin(e,t,r){return new Qn(e,t,r)}},Ls={replace:"replace",concat:"concat",smart:"smart"},Ms=/^https?:\/\//,ge=new Rr("bunfig",{showTags:!0}),Ne=new li,Fs=ne(Ge.cwd(),"config"),Ds=ne(Ge.cwd(),"src/generated")});bh=vr.env.CLARITY_LOG_DIR||td(yh(),"logs"),js={level:"info",defaultName:"clarity",timestamp:!0,colors:!0,format:"text",maxLogSize:10485760,logDatePattern:"YYYY-MM-DD",logDirectory:bh,rotation:{frequency:"daily",maxSize:10485760,maxFiles:5,compress:!1,rotateHour:0,rotateMinute:0,rotateDayOfWeek:0,rotateDayOfMonth:1,encrypt:!1},verbose:!1,writeToFile:!1},Ar={...js},F1=(async()=>{try{let{loadConfig:e}=await ph().then(()=>$s),t=await e({name:"clarity",alias:"logging",defaultConfig:js,cwd:vr.cwd()});if(t)Object.assign(Ar,t)}catch{}return Ar})();Y={red:(e)=>`\x1B[31m${e}\x1B[0m`,green:(e)=>`\x1B[32m${e}\x1B[0m`,yellow:(e)=>`\x1B[33m${e}\x1B[0m`,blue:(e)=>`\x1B[34m${e}\x1B[0m`,magenta:(e)=>`\x1B[35m${e}\x1B[0m`,cyan:(e)=>`\x1B[36m${e}\x1B[0m`,white:(e)=>`\x1B[37m${e}\x1B[0m`,gray:(e)=>`\x1B[90m${e}\x1B[0m`,bgRed:(e)=>`\x1B[41m${e}\x1B[0m`,bgYellow:(e)=>`\x1B[43m${e}\x1B[0m`,bgGray:(e)=>`\x1B[100m${e}\x1B[0m`,bold:(e)=>`\x1B[1m${e}\x1B[0m`,dim:(e)=>`\x1B[2m${e}\x1B[0m`,italic:(e)=>`\x1B[3m${e}\x1B[0m`,underline:(e)=>`\x1B[4m${e}\x1B[0m`,strikethrough:(e)=>`\x1B[9m${e}\x1B[0m`,reset:"\x1B[0m"},E=Y,D1=Y.red,vh=Y.green,j1=Y.yellow,wh=Y.blue,B1=Y.magenta,U1=Y.cyan,hs=Y.white,V1=Y.gray,$h=Y.bgRed,Ch=Y.bgYellow,W1=Y.bgGray,gs=Y.bold,z1=Y.dim,K1=Y.italic,H1=Y.underline,G1=Y.strikethrough,q1=Y.reset,Un={activationLevel:"error",bufferSize:50,flushOnDeactivation:!0,stopBuffering:!1},Rh={debug:"\uD83D\uDD0D",info:wh("\u2139"),success:vh("\u2713"),warning:Ch(hs(gs(" WARN "))),error:$h(hs(gs(" ERROR ")))};Y1=new Pr("stacks");me=class me extends Error{timestamp;context;constructor(e,t={}){super(e);if(this.name=this.constructor.name,this.timestamp=new Date,this.context=t,Error.captureStackTrace)Error.captureStackTrace(this,this.constructor)}toJSON(){return{name:this.name,code:this.code,message:this.message,timestamp:this.timestamp.toISOString(),context:this.context,stack:this.stack}}toString(){let e=Object.keys(this.context).length>0?` (${Object.entries(this.context).map(([t,r])=>`${t}: ${r}`).join(", ")})`:"";return`${this.name} [${this.code}]: ${this.message}${e}`}};Us=class Us extends me{code="CONFIG_NOT_FOUND";constructor(e,t,r){let n=r===void 0?[]:Array.isArray(r)?r.filter(Boolean):[r],i="";if(n.length===1)i=` or alias "${n[0]}"`;else if(n.length>1)i=` or aliases ${n.map((o)=>`"${o}"`).join(", ")}`;super(`Configuration "${e}"${i} not found`,{configName:e,alias:r,searchPaths:t,searchPathCount:t.length})}};Er=class Er extends me{code="CONFIG_LOAD_ERROR";constructor(e,t,r){super(`Failed to load configuration from "${e}": ${t.message}`,{configPath:e,configName:r,originalError:t.name,originalMessage:t.message});this.cause=t}};Vs=class Vs extends me{code="CONFIG_VALIDATION_ERROR";constructor(e,t,r){super(`Configuration validation failed for "${e}"`,{configPath:e,configName:r,validationErrors:t,errorCount:t.length})}};Ws=class Ws extends me{code="CONFIG_MERGE_ERROR";constructor(e,t,r,n){super(`Failed to merge configuration from "${e}" with "${t}": ${r.message}`,{sourcePath:e,targetPath:t,configName:n,originalError:r.name,originalMessage:r.message});this.cause=r}};ci=class ci extends me{code="ENV_VAR_ERROR";constructor(e,t,r,n){super(`Failed to parse environment variable "${e}" with value "${t}" as ${r}`,{envKey:e,envValue:t,expectedType:r,configName:n})}};zs=class zs extends me{code="FILE_SYSTEM_ERROR";constructor(e,t,r){super(`File system ${e} failed for "${t}": ${r.message}`,{operation:e,path:t,originalError:r.name,originalMessage:r.message});this.cause=r}};Ks=class Ks extends me{code="TYPE_GENERATION_ERROR";constructor(e,t,r){super(`Failed to generate types from "${e}" to "${t}": ${r.message}`,{configDir:e,outputPath:t,originalError:r.name,originalMessage:r.message});this.cause=r}};Tr=class Tr extends me{code="SCHEMA_VALIDATION_ERROR";constructor(e,t,r){super(`Schema validation failed${r?` for config "${r}"`:""}`,{schemaPath:e,configName:r,validationErrors:t,errorCount:t.length})}};Hs=class Hs extends me{code="BROWSER_CONFIG_ERROR";constructor(e,t,r,n){super(`Failed to fetch configuration from "${e}": ${t} ${r}`,{endpoint:e,status:t,statusText:r,configName:n})}};Gs=class Gs extends me{code="PLUGIN_ERROR";constructor(e,t,r){super(`Plugin "${e}" failed during ${t}: ${r.message}`,{pluginName:e,operation:t,originalError:r.name,originalMessage:r.message});this.cause=r}};He={configNotFound(e,t,r){return new Us(e,t,r)},configLoad(e,t,r){return new Er(e,t,r)},configValidation(e,t,r){return new Vs(e,t,r)},configMerge(e,t,r,n){return new Ws(e,t,r,n)},envVar(e,t,r,n){return new ci(e,t,r,n)},fileSystem(e,t,r){return new zs(e,t,r)},typeGeneration(e,t,r){return new Ks(e,t,r)},schemaValidation(e,t,r){return new Tr(e,t,r)},browserConfig(e,t,r,n){return new Hs(e,t,r,n)},plugin(e,t,r){return new Gs(e,t,r)}};Ih=/^https?:\/\//;he=new Pr("bunfig",{showTags:!0});Vn=new Qs;e$=ve(Nr.cwd(),"config"),t$=ve(Nr.cwd(),"src/generated")});import{existsSync as Be,statSync as fx,watch as bc}from"fs";import{unlink as dx}from"fs/promises";import{dirname as hx,resolve as Li}from"path";import ye from"process";var{Glob:gx}=globalThis.Bun;import{EventEmitter as wc}from"events";import Ie from"process";import Fi from"process";import tn from"process";import Dt from"process";import wt from"process";import Ui from"tty";import cu,{stdin as Nx,stdout as Ox}from"process";import{existsSync as gu}from"fs";import Zr from"fs/promises";import Vi from"os";import Qr from"path";import Ue from"process";function en(e){return e.replace(/[<[].+/,"").trim()}function $c(e){let t=/<([^>]+)>/g,r=/\[([^\]]+)\]/g,n=[],i=(c)=>{let a=!1,l=c[1];if(l.startsWith("..."))l=l.slice(3),a=!0;else if(l.endsWith("..."))l=l.slice(0,-3),a=!0;return{required:c[0].startsWith("<"),value:l.trim(),variadic:a}},o;while(o=t.exec(e))n.push(i(o));let s;while(s=r.exec(e))n.push(i(s));return n}function Cc(e){let t={alias:{},boolean:[]};for(let[r,n]of e.entries()){if(n.names.length>1)t.alias[n.names[0]]=n.names.slice(1);if(n.isBoolean)if(n.negated){if(!e.some((o,s)=>s!==r&&o.names.some((c)=>n.names.includes(c))&&typeof o.required==="boolean"))t.boolean.push(n.names[0])}else t.boolean.push(n.names[0])}return t}function Di(e){return e.reduce((t,r)=>t.length>=r.length?t:r,"")}function Xr(e,t){return e.length>=t?e:`${e}${" ".repeat(t-e.length)}`}function Ft(e){return e.replace(/([a-z])-([a-z])/g,(t,r,n)=>r+n.toUpperCase())}function Rc(e,t,r){let n=0,i=t.length,o=e,s;for(;n<i;++n)s=o[t[n]],o=o[t[n]]=n===i-1?r:s!=null?s:!!~t[n+1].indexOf(".")||!(+t[n+1]>-1)?{}:[]}function kc(e,t){for(let r of Object.keys(t)){let n=t[r];if(e[r]===void 0)continue;if(n.shouldTransform){if(e[r]=Array.prototype.concat.call([],e[r]),typeof n.transformFunction==="function")e[r]=e[r].map(n.transformFunction)}}}function Sc(e){let t=/([^\\/]+)$/.exec(e);return t?t[1]:""}function $t(e){return e.split(".").map((t,r)=>r===0?Ft(t):t).join(".")}class Ct extends Error{exitCode=2;isUsageError=!0;usage;constructor(e,t){super(e);if(this.name=this.constructor.name,t!==void 0)this.usage=t;if(typeof Error.captureStackTrace==="function")Error.captureStackTrace(this,this.constructor);else this.stack=Error(e).stack}format(e=!1){if(e&&this.stack)return`${this.message}
|
|
63
63
|
|
|
64
64
|
Stack trace:
|
|
65
|
-
${this.stack}`;return this.message}}function
|
|
65
|
+
${this.stack}`;return this.message}}function Ac(e){if(e instanceof Ct)return!0;return!!e&&typeof e==="object"&&e.name==="ClappError"&&typeof e.message==="string"}function Ec(){let{env:e}=Fi,{TERM:t,TERM_PROGRAM:r}=e;if(Fi.platform!=="win32")return t!=="linux";return Boolean(e.WT_SESSION)||Boolean(e.TERMINUS_SUBLIME)||e.ConEmuTask==="{cmd::Cmder}"||r==="Terminus-Sublime"||r==="vscode"||t==="xterm-256color"||t==="alacritty"||t==="rxvt-unicode"||t==="rxvt-unicode-256color"||e.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var jt="\x1B",B=`${jt}[`;var ji={to(e,t){if(!t)return`${B}${e+1}G`;return`${B}${t+1};${e+1}H`},move(e,t){let r="";if(e<0)r+=`${B}${-e}D`;else if(e>0)r+=`${B}${e}C`;if(t<0)r+=`${B}${-t}A`;else if(t>0)r+=`${B}${t}B`;return r},up:(e=1)=>`${B}${e}A`,down:(e=1)=>`${B}${e}B`,forward:(e=1)=>`${B}${e}C`,backward:(e=1)=>`${B}${e}D`,nextLine:(e=1)=>`${B}E`.repeat(e),prevLine:(e=1)=>`${B}F`.repeat(e),left:`${B}G`,hide:`${B}?25l`,show:`${B}?25h`,save:`${jt}7`,restore:`${jt}8`};var wx={screen:`${B}2J`,up:(e=1)=>`${B}1J`.repeat(e),down:(e=1)=>`${B}J`.repeat(e),line:`${B}2K`,lineEnd:`${B}K`,lineStart:`${B}1K`,lines(e){let t="";for(let r=0;r<e;r++)t+=this.line+(r<e-1?ji.up():"");if(e)t+=ji.left;return t}},$x={screen:`${jt}c`};function Tc(e,t){let r=[];for(let n=0;n<=t.length;n++)r[n]=[n];for(let n=0;n<=e.length;n++)r[0][n]=n;for(let n=1;n<=t.length;n++)for(let i=1;i<=e.length;i++)if(t.charAt(n-1)===e.charAt(i-1))r[n][i]=r[n-1][i-1];else r[n][i]=Math.min(r[n-1][i-1]+1,r[n][i-1]+1,r[n-1][i]+1);return r[t.length][e.length]}function Wi(e,t,r=2,n=3){return t.map((i)=>({cmd:i,distance:Tc(e,i)})).filter(({distance:i})=>i<=r).sort((i,o)=>i.distance-o.distance).slice(0,n).map(({cmd:i})=>i)}function Nc(e,t={}){let r={_:[]},n=t.alias||{},i=new Set(t.boolean||[]),o={};for(let a of Object.keys(n))for(let l of n[a])o[l]=a;for(let a of i)if(n[a])for(let l of n[a])i.add(l);function s(a,l){if(a===void 0)return l;if(typeof l==="boolean")return l;return Array.isArray(a)?[...a,l]:[a,l]}function c(a,l){let u=o[a]||a,f=s(r[u],l);if(r[u]=f,n[u])for(let d of n[u])r[d]=f;if(o[a]&&n[o[a]])for(let d of n[o[a]])r[d]=f;r[a]=f}for(let a=0;a<e.length;a++){let l=e[a];if(l==="--"){r._.push(...e.slice(a+1));break}if(l.startsWith("--")){let u=l.indexOf("=");if(u!==-1){let f=Ft(l.slice(2,u)),d=l.slice(u+1);c(f,d)}else{let f=l.slice(2);if(f.startsWith("no-")){let m=Ft(f.slice(3));c(m,!1);continue}let d=Ft(f),h=o[d]||d;if(i.has(h)||i.has(d))c(d,!0);else{let m=e[a+1];if(m!==void 0&&!m.startsWith("-"))c(d,m),a++;else c(d,!0)}}}else if(l.startsWith("-")&&l.length>1){let u=l.slice(1);for(let f=0;f<u.length;f++){let d=u[f],h=o[d]||d;if(f===u.length-1&&!i.has(h)&&!i.has(d)){let m=e[a+1];if(m!==void 0&&!m.startsWith("-"))c(d,m),a++;else c(d,!0)}else c(d,!0)}}else r._.push(l)}return r}class zi{rawName;description;name;names;isBoolean;required;config;negated;variadic;constructor(e,t,r){if(this.rawName=e,this.description=t,this.config=Object.assign({},r),e=e.replace(/\.\*/g,""),this.negated=!1,this.variadic=/[<[](?:\.\.\.[^\]>]+|[^\]>]+\.\.\.)[\]>]/.test(e),this.names=en(e).split(",").map((n)=>{let i=n.trim().replace(/^-{1,2}/,"");if(i.startsWith("no-"))this.negated=!0,i=i.replace(/^no-/,"");return $t(i)}).sort((n,i)=>n.length>i.length?1:-1),this.name=this.names[this.names.length-1],this.negated&&this.config.default==null)this.config.default=!0;if(e.includes("<"))this.required=!0;else if(e.includes("["))this.required=!1;else this.isBoolean=!0}}var Rx=tn.argv,Oc=`${tn.platform}-${tn.arch} bun-v${typeof Bun<"u"?Bun.version:"unknown"}`,Bi=Dt.argv,Ic=`${Dt.platform}-${Dt.arch} node-${Dt.version}`;class rn{rawName;description;config;cli;options;aliasNames;name;namespace;args;commandAction;usageText;versionNumber;examples;helpCallback;globalCommand;beforeHooks;afterHooks;middleware;constructor(e,t,r,n){this.rawName=e,this.description=t,this.config=r,this.cli=n,this.options=[],this.aliasNames=[],this.name=en(e);let i=en(e),o=i.indexOf(":");if(o>0)this.namespace=i.substring(0,o),this.name=i.substring(o+1);if(this.args=$c(e),this.examples=[],this.beforeHooks=[],this.afterHooks=[],this.middleware=[],!r)this.config={}}usage(e){return this.usageText=e,this}allowUnknownOptions(){return this.config.allowUnknownOptions=!0,this}ignoreOptionDefaultValue(){return this.config.ignoreOptionDefaultValue=!0,this}version(e,t="-v, --version"){return this.versionNumber=e,this.option(t,"Display version number"),this}example(e){return this.examples.push(e),this}option(e,t,r){let n=new zi(e,t,r);return this.options.push(n),this}alias(e){return this.aliasNames.push(e),this}action(e){return this.commandAction=e,this}before(e){return this.beforeHooks.push(e),this}after(e){return this.afterHooks.push(e),this}use(e){return this.middleware.push(e),this}isMatched(e){if(this.aliasNames.includes(e))return!0;if(this.namespace)return`${this.namespace}:${this.name}`===e;return this.name===e}get isDefaultCommand(){return this.name===""||this.aliasNames.includes("!")}get isGlobalCommand(){return this instanceof nn}get displayName(){return this.namespace?`${this.namespace}:${this.name}`:this.name}hasOption(e){let t=$t(e.split(".")[0]);return!!this.options.find((r)=>r.names.some((n)=>$t(n)===t))}outputHelp(){let{name:e,commands:t}=this.cli,{versionNumber:r,options:n,helpCallback:i}=this.cli.globalCommand,o=[{body:`${e}${r?`/${r}`:""}`}];if(o.push({title:"Usage",body:` $ ${e} ${this.usageText||this.rawName}`}),(this.isGlobalCommand||this.isDefaultCommand)&&t.length>0){let l=Di(t.map((m)=>m.rawName)),u=new Map,f=[];for(let m of t)if(m.namespace){if(!u.has(m.namespace))u.set(m.namespace,[]);u.get(m.namespace).push(m)}else f.push(m);let d="";if(f.sort((m,g)=>m.rawName<g.rawName?-1:m.rawName>g.rawName?1:0),f.length>0)d+=f.map((m)=>` ${Xr(m.rawName,l.length)} ${m.description}`).join(`
|
|
66
66
|
`);let h=Array.from(u.keys()).sort();for(let m of h){let g=u.get(m);if(d.length>0)d+=`
|
|
67
67
|
|
|
68
68
|
`;d+=` ${m}:
|
|
69
|
-
`,d+=g.map((p)=>` ${
|
|
70
|
-
`)}o.push({title:"Commands",body:d}),o.push({body:`Run \`${e} <command> --help\` for command details.`})}let c=new Set(this.options.flatMap((l)=>l.names)),a=this.isGlobalCommand?n:[...this.options,...(n||[]).filter((l)=>!l.names.some((u)=>c.has(u)))];if(!this.isGlobalCommand&&!this.isDefaultCommand)a=a.filter((l)=>l.name!=="version");if(a.length>0){let l=
|
|
69
|
+
`,d+=g.map((p)=>` ${Xr(p.rawName,l.length-2)} ${p.description}`).join(`
|
|
70
|
+
`)}o.push({title:"Commands",body:d}),o.push({body:`Run \`${e} <command> --help\` for command details.`})}let c=new Set(this.options.flatMap((l)=>l.names)),a=this.isGlobalCommand?n:[...this.options,...(n||[]).filter((l)=>!l.names.some((u)=>c.has(u)))];if(!this.isGlobalCommand&&!this.isDefaultCommand)a=a.filter((l)=>l.name!=="version");if(a.length>0){let l=Di(a.map((u)=>u.rawName));o.push({title:"Options",body:a.map((u)=>` ${Xr(u.rawName,l.length)} ${u.description} ${u.config.default===void 0?"":`(default: ${u.config.default})`}`).join(`
|
|
71
71
|
`)})}if(this.examples.length>0)o.push({title:"Examples",body:this.examples.map((l)=>{if(typeof l==="function")return l(e);return l}).join(`
|
|
72
72
|
`)});if(i)o=i(o)||o;console.log(o.map((l)=>l.title?`${l.title}:
|
|
73
73
|
${l.body}`:l.body).join(`
|
|
74
74
|
|
|
75
|
-
`))}outputVersion(){let{name:e}=this.cli,{versionNumber:t}=this.cli.globalCommand;if(t)console.log(`${e}/${t} ${typeof Bun<"u"?
|
|
75
|
+
`))}outputVersion(){let{name:e}=this.cli,{versionNumber:t}=this.cli.globalCommand;if(t)console.log(`${e}/${t} ${typeof Bun<"u"?Oc:Ic}`)}get usageLine(){return`$ ${this.cli.name} ${this.usageText||this.rawName}`}checkRequiredArgs(){let e=this.args.filter((t)=>t.required).length;if(this.cli.args.length<e){let r=this.args.filter((i)=>i.required).slice(this.cli.args.length),n=r.map((i)=>`<${i.value}>`).join(" ");throw new Ct(`Missing required argument${r.length>1?"s":""}: ${n}
|
|
76
76
|
|
|
77
|
-
Run \`${this.cli.name} ${this.rawName} --help\` for usage information.`,this.usageLine)}}checkUnknownOptions(){let{options:e,globalCommand:t}=this.cli;if(!this.config.allowUnknownOptions){for(let r of Object.keys(e))if(r!=="--"&&!this.hasOption(r)&&!t.hasOption(r)){let i=[...t.options,...this.options].flatMap((l)=>l.names),o
|
|
77
|
+
Run \`${this.cli.name} ${this.rawName} --help\` for usage information.`,this.usageLine)}}checkUnknownOptions(){let{options:e,globalCommand:t}=this.cli;if(!this.config.allowUnknownOptions){for(let r of Object.keys(e))if(r!=="--"&&!this.hasOption(r)&&!t.hasOption(r)){let i=[...t.options,...this.options].flatMap((l)=>l.names),o=$t(r.split(".")[0]),s=r.length>1?`--${r}`:`-${r}`,c=Wi(o,i),a=`Unknown option \`${s}\``;if(c.length>0)a+=`
|
|
78
78
|
|
|
79
79
|
Did you mean one of these?`,c.forEach((l)=>{let u=l.length>1?`--${l}`:`-${l}`;a+=`
|
|
80
80
|
\u2022 ${u}`});throw a+=`
|
|
81
81
|
|
|
82
82
|
Run \`${this.cli.name} ${this.rawName} --help\` to see available options.`,new Ct(a,this.usageLine)}}}checkOptionValue(){let{options:e,globalCommand:t}=this.cli,r=[...t.options,...this.options];for(let n of r){let i=e[n.name.split(".")[0]];if(n.required){let o=r.some((s)=>s.negated&&s.names.includes(n.name));if(i===!0||i===!1&&!o)throw new Ct(`Option \`${n.rawName}\` requires a value.
|
|
83
83
|
|
|
84
|
-
Example: ${this.cli.name} ${this.rawName} ${n.rawName} <value>`,this.usageLine)}}}}class
|
|
84
|
+
Example: ${this.cli.name} ${this.rawName} ${n.rawName} <value>`,this.usageLine)}}}}class nn extends rn{constructor(e){super("@@global@@","",{},e)}}var Pc=rn,Pe={red:["\x1B[31m","\x1B[39m"],green:["\x1B[32m","\x1B[39m"],blue:["\x1B[34m","\x1B[39m"],yellow:["\x1B[33m","\x1B[39m"],cyan:["\x1B[36m","\x1B[39m"],magenta:["\x1B[35m","\x1B[39m"],white:["\x1B[37m","\x1B[39m"],gray:["\x1B[90m","\x1B[39m"],bgRed:["\x1B[41m","\x1B[49m"],bgGreen:["\x1B[42m","\x1B[49m"],bgBlue:["\x1B[44m","\x1B[49m"],bgYellow:["\x1B[43m","\x1B[49m"],bgCyan:["\x1B[46m","\x1B[49m"],bgMagenta:["\x1B[45m","\x1B[49m"],bold:["\x1B[1m","\x1B[22m"],italic:["\x1B[3m","\x1B[23m"],underline:["\x1B[4m","\x1B[24m"],dim:["\x1B[2m","\x1B[22m"],inverse:["\x1B[7m","\x1B[27m"],hidden:["\x1B[8m","\x1B[28m"],strikethrough:["\x1B[9m","\x1B[29m"]};var xt={primary:"blue",secondary:"cyan",success:"green",warning:"yellow",error:"red",info:"magenta",muted:"gray"};function _c(){return!0}function Lc(){let e={};e.supportsColor=_c();function t(n,i=[]){let o=n===""?[]:[...i,n],s=function(a){if(!e.supportsColor)return a;let l="",u="";for(let f of o)if(f in xt&&xt[f]in Pe){let d=xt[f];l+=Pe[d][0],u=Pe[d][1]+u}else if(f in Pe)l+=Pe[f][0],u=Pe[f][1]+u;return l+a+u},c=[...Object.keys(Pe),...Object.keys(xt)];for(let a of c)if(!(a in s))Object.defineProperty(s,a,{get(){return t(a,o)}});return s}let r=[...Object.keys(Pe),...Object.keys(xt)];for(let n of r)if(!(n in e))Object.defineProperty(e,n,{get(){return t(n)}});return e}var vt=Lc();class on extends wc{name;commands;globalCommand;matchedCommand;matchedCommandName;rawArgs;args;options;showHelpOnExit;showVersionOnExit;enableDidYouMean=!0;signalHandlersSet=!1;isVerbose=!1;isQuiet=!1;isDebug=!1;isNoInteraction=!1;environment;isDryRun=!1;isForce=!1;useEmoji=!0;theme;isNoCache=!1;constructor(e=""){super();this.name=e,this.commands=[],this.rawArgs=[],this.args=[],this.options={},this.globalCommand=new nn(this),this.globalCommand.usage("<command> [options]")}handleSignals(e){if(this.signalHandlersSet)return this;let t=async(r)=>{if(console.log(`
|
|
85
85
|
|
|
86
|
-
Received ${r}, cleaning up...`),e)try{await e()}catch(n){console.error("Error during cleanup:",n)}Ie.exit(0)};return Ie.on("SIGINT",()=>t("SIGINT")),Ie.on("SIGTERM",()=>t("SIGTERM")),this.signalHandlersSet=!0,this}didYouMean(e=!0){return this.enableDidYouMean=e,this}verbose(){return this.globalCommand.option("-v, --verbose","Enable verbose output"),this}quiet(){return this.globalCommand.option("-q, --quiet","Suppress non-essential output"),this}debug(){return this.globalCommand.option("--debug","Enable debug mode with detailed error information"),this}noInteraction(){return this.globalCommand.option("-n, --no-interaction","Do not ask any interactive questions (for CI/CD)"),this}env(){return this.globalCommand.option("--env <environment>","Target environment (e.g., production, staging, local)"),this}dryRun(){return this.globalCommand.option("--dry-run","Preview actions without executing them"),this}force(){return this.globalCommand.option("-f, --force","Skip confirmation prompts"),this}emoji(){return this.globalCommand.option("--no-emoji","Disable emoji in output"),this}themes(){return this.globalCommand.option("--theme <theme>","Color theme (default, dracula, nord, solarized, monokai)"),this}cache(){return this.globalCommand.option("--no-cache","Disable caching"),this}usage(e){return this.globalCommand.usage(e),this}command(e,t,r){if(!r)r={};let n=new
|
|
86
|
+
Received ${r}, cleaning up...`),e)try{await e()}catch(n){console.error("Error during cleanup:",n)}Ie.exit(0)};return Ie.on("SIGINT",()=>t("SIGINT")),Ie.on("SIGTERM",()=>t("SIGTERM")),this.signalHandlersSet=!0,this}didYouMean(e=!0){return this.enableDidYouMean=e,this}verbose(){return this.globalCommand.option("-v, --verbose","Enable verbose output"),this}quiet(){return this.globalCommand.option("-q, --quiet","Suppress non-essential output"),this}debug(){return this.globalCommand.option("--debug","Enable debug mode with detailed error information"),this}noInteraction(){return this.globalCommand.option("-n, --no-interaction","Do not ask any interactive questions (for CI/CD)"),this}env(){return this.globalCommand.option("--env <environment>","Target environment (e.g., production, staging, local)"),this}dryRun(){return this.globalCommand.option("--dry-run","Preview actions without executing them"),this}force(){return this.globalCommand.option("-f, --force","Skip confirmation prompts"),this}emoji(){return this.globalCommand.option("--no-emoji","Disable emoji in output"),this}themes(){return this.globalCommand.option("--theme <theme>","Color theme (default, dracula, nord, solarized, monokai)"),this}cache(){return this.globalCommand.option("--no-cache","Disable caching"),this}usage(e){return this.globalCommand.usage(e),this}command(e,t,r){if(!r)r={};let n=new Pc(e,t||"",r,this);return n.globalCommand=this.globalCommand,this.commands.push(n),n}option(e,t,r){return this.globalCommand.option(e,t,r),this}help(e){return this.globalCommand.option("-h, --help","Display this message"),this.globalCommand.helpCallback=e,this.showHelpOnExit=!0,this}version(e,t="-v, --version"){return this.globalCommand.version(e,t),this.showVersionOnExit=!0,this}example(e){return this.globalCommand.example(e),this}outputHelp(){if(this.matchedCommand)this.matchedCommand.outputHelp();else this.globalCommand.outputHelp()}outputVersion(){this.globalCommand.outputVersion()}setParsedInfo({args:e,options:t},r,n){if(this.args=e,this.options=t,r)this.matchedCommand=r;if(n)this.matchedCommandName=n;return this}unsetMatchedCommand(){this.matchedCommand=void 0,this.matchedCommandName=void 0}showCommandNotFound(e){if(console.log(vt.red(`
|
|
87
87
|
\u2717 Command "${e}" not found.
|
|
88
|
-
`)),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=
|
|
88
|
+
`)),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=Wi(e,t);if(r.length>0)console.log(vt.yellow("Did you mean one of these?")),r.forEach((n)=>console.log(` ${vt.dim("\u2022")} ${this.name} ${n}`)),console.log("")}console.log(vt.dim("Run"),`${this.name} --help`,vt.dim("to see all available commands")),Ie.exit(1)}async parse(e=Bi,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]?Sc(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=Cc(r),i=[],o=e.indexOf("--");if(o>-1)i=e.slice(o+1),e=e.slice(0,o);let s=Nc(e,n),c={_:s._};for(let d of Object.keys(s))if(d!=="_")c[$t(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(".");Rc(l,h,c[d]),kc(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=Bi){return this.parse(e,{run:!0,exitOnError:!0})}handleUsageError(e){if(!Ac(e)||e.isUsageError===!1)return;let t=e.message||"command-line error",r=this.name?`${this.name}: `:"",n=/--help/.test(t)?"":e.usage?`
|
|
89
89
|
Usage: ${e.usage}`:`
|
|
90
90
|
Run \`${this.name??"cli"} --help\` for usage.`;Ie.stderr.write(`${r}${t}${n}
|
|
91
|
-
`),Ie.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 Ie.removeAllListeners("SIGINT"),Ie.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 Ui{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 vx=new Ui;function Pc(){if("FORCE_COLOR"in vt.env)return vt.env.FORCE_COLOR!=="0";if("NO_COLOR"in vt.env||vt.env.TERM==="dumb")return!1;if(vt.platform==="win32")return!0;return Di.isatty(1)&&Di.isatty(2)}var Wi=Pc();function M(e,t){if(!Wi)return(r)=>r;return(r)=>e+r+t}var _c=M("\x1B[0m","\x1B[0m"),Lc=M("\x1B[31m","\x1B[39m"),Mc=M("\x1B[32m","\x1B[39m"),Fc=M("\x1B[33m","\x1B[39m"),Dc=M("\x1B[34m","\x1B[39m"),jc=M("\x1B[35m","\x1B[39m"),Bc=M("\x1B[36m","\x1B[39m"),Vc=M("\x1B[37m","\x1B[39m"),Uc=M("\x1B[90m","\x1B[39m"),Wc=M("\x1B[1m","\x1B[22m"),zc=M("\x1B[3m","\x1B[23m"),Kc=M("\x1B[4m","\x1B[24m"),Hc=M("\x1B[2m","\x1B[22m"),Gc=M("\x1B[7m","\x1B[27m"),qc=M("\x1B[8m","\x1B[28m"),Yc=M("\x1B[9m","\x1B[29m"),Jc=M("\x1B[41m","\x1B[49m"),Xc=M("\x1B[42m","\x1B[49m"),Zc=M("\x1B[43m","\x1B[49m"),Qc=M("\x1B[44m","\x1B[49m"),eu=M("\x1B[45m","\x1B[49m"),tu=M("\x1B[46m","\x1B[49m"),ru=M("\x1B[47m","\x1B[49m"),nu=Wi,iu={reset:_c,red:Lc,green:Mc,yellow:Fc,blue:Dc,magenta:jc,cyan:Bc,white:Vc,gray:Uc,bold:Wc,italic:zc,underline:Kc,dim:Hc,inverse:Gc,hidden:qc,strikethrough:Yc,bgRed:Jc,bgGreen:Xc,bgYellow:Zc,bgBlue:Qc,bgMagenta:eu,bgCyan:tu,bgWhite:ru,isColorSupported:nu},ou=iu,au=["up","down","left","right","space","enter","cancel"],Sx={actions:new Set(au),aliases:new Map([["k","up"],["j","down"],["h","left"],["l","right"],["\x03","cancel"],["escape","cancel"]]),messages:{cancel:"Canceled",error:"Something went wrong"}};var Ax=su.platform.startsWith("win"),Ex=Symbol("clapp:cancel");var lu=kc();var _=(e,t)=>lu?e:t,Tx=_("\u25C6","*"),Nx=_("\u25A0","x"),Ox=_("\u25B2","x"),Ix=_("\u25C7","o"),Px=_("\u250C","T"),cu=_("\u2502","|"),_x=_("\u2514","\u2014"),Lx=_("\u25CF",">"),Mx=_("\u25CB"," "),Fx=_("\u25FB","[\u2022]"),Dx=_("\u25FC","[+]"),jx=_("\u25FB","[ ]"),Bx=_("\u25AA","\u2022"),Vx=_("\u2500","-"),Ux=_("\u256E","+"),Wx=_("\u251C","+"),zx=_("\u256F","+"),Kx=_("\u25CF","\u2022"),Hx=_("\u25C6","*"),Gx=_("\u25B2","!"),qx=_("\u25A0","x");var Yx={light:_("\u2500","-"),heavy:_("\u2501","="),block:_("\u2588","#")};function uu(){return`${ou.gray(cu)} `}var Jx=uu();class zi{configPath;config=null;events=[];retryCount=0;maxRetries=3;retryDelayMs=1000;constructor(){let e=ji.homedir(),t=Jr.join(e,".config","clapp");this.configPath=Jr.join(t,"telemetry.json")}async isEnabled(){if(Ve.env.DO_NOT_TRACK==="1"||Ve.env.DO_NOT_TRACK==="true")return!1;if(Ve.env.NO_TELEMETRY==="1"||Ve.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:ji.platform(),nodeVersion:Ve.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:Ve.env.DO_NOT_TRACK==="1"||Ve.env.DO_NOT_TRACK==="true",eventsQueued:this.events.length,lastSent:e.lastSent}}async loadConfig(){if(this.config)return this.config;try{if(fu(this.configPath)){let e=await Yr.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=Jr.dirname(this.configPath);await Yr.mkdir(t,{recursive:!0}),await Yr.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 rv=new zi;var rn="0.3.21";function be(e){return{prev:null,next:null,data:e}}class le{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 be(e)}createItem(e){return be(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=be(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 le,r=null,n=0;for(let i=this.head;i!=null;i=i.next){let o=be(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 le,r=null,n=0;for(let i=this.head;i!=null;i=i.next)if(e(i.data,n++,this)){let o=be(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 le,t=null;for(let r=this.head;r!=null;r=r.next){let n=be(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(be(e),this.head)}append(e){return this.insert(e,null)}appendData(e){return this.insert(be(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(be(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(be(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 le)this.insertList(t,e),this.remove(e);else this.insert(t,e),this.remove(e)}}function Q(e){switch(e.type){case"StyleSheet":return oe(e.children,"");case"Rule":return`${Q(e.prelude)}{${Q(e.block)}}`;case"Block":return hu(e.children);case"Atrule":{let t=`@${e.name}`;if(e.prelude){let r=Q(e.prelude);if(r)t+=` ${r}`}if(e.block)t+=`{${Q(e.block)}}`;else t+=";";return t}case"AtrulePrelude":return oe(e.children,"");case"SelectorList":return oe(e.children,",");case"Selector":return oe(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+=`"${nn(e.value.value)}"`;else t+=e.value.name;if(e.flags)t+=` ${e.flags}`;return t+="]",t}case"PseudoClassSelector":return e.children?`:${e.name}(${oe(e.children,"")})`:`:${e.name}`;case"PseudoElementSelector":return e.children?`::${e.name}(${oe(e.children,"")})`:`::${e.name}`;case"Combinator":return e.name===" "?" ":e.name;case"Declaration":return`${e.property}:${Q(e.value)}${e.important?"!important":""}`;case"DeclarationList":return oe(e.children,";");case"Value":return oe(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`"${nn(e.value)}"`;case"Url":return/[\s"'()\\\u0000-\u001F\u007F]/.test(e.value)?`url("${nn(e.value)}")`:`url(${e.value})`;case"Hash":return`#${e.name}`;case"Operator":return e.value;case"Function":return`${e.name}(${oe(e.children,"")})`;case"Parentheses":return`(${oe(e.children,"")})`;case"Brackets":return`[${oe(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?`${Q(e.nth)} of ${Q(e.selector)}`:Q(e.nth);case"MediaQueryList":return oe(e.children,",");case"MediaQuery":return oe(e.children,"");case"MediaFeature":{let t=`(${e.name}`;if(e.value)t+=`:${Q(e.value)}`;return t+=")",t}}return""}function oe(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(Ki(i)||Ki(a)){o=o.next;continue}}let c=Q(s);if(!c){o=o.next;continue}if(!n&&t&&!mu(i))r+=t;n=!1,r+=c,i=s,o=o.next}return r}function hu(e){let t="",r=null,n=e.head;while(n!=null){let i=n.data,o=Q(i);if(!o){n=n.next;continue}if(r&&gu(r,i))t+=";";t+=o,r=i,n=n.next}return t}function gu(e,t){return e.type==="Declaration"&&t.type!=="Comment"}function Ki(e){if(!e||e.type!=="Operator")return!1;let t=e.value;return t===":"||t===","||t==="/"}function mu(e){if(!e)return!1;return e.type==="Operator"||e.type==="Combinator"}function nn(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 We=(()=>{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 fe(e){return e<128&&(We[e]&2)!==0}function $t(e){return e<128&&(We[e]&4)!==0}function Hi(e){return e>=128||e<128&&(We[e]&8)!==0}function pu(e){return e===45||e>=128||e<128&&(We[e]&10)!==0}function yu(e){return e>=0&&e<=8||e===11||e>=14&&e<=31||e===127}function sn(e){return e<128&&(We[e]&16)!==0}function Re(e){return e<128&&(We[e]&1)!==0}function Ue(e,t){if(e!==92)return!1;if(sn(t))return!1;return!0}function on(e,t,r){if(e===45)return Hi(t)||t===45||Ue(t,r);if(Hi(e))return!0;if(e===92)return Ue(e,t);return!1}function bu(e,t,r){if(e===43||e===45){if(fe(t))return!0;if(t===46&&fe(r))return!0;return!1}if(e===46)return fe(t);return fe(e)}class Dt{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=xu(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(Re(n)){let s=t;while(t<r&&Re(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&&(pu(e.charCodeAt(t+1))||Ue(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(on(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(bu(n,i,o)){t=this.consumeNumeric(t);continue}if(on(n,i,o)){t=this.consumeIdentLike(t);continue}if(n===92){if(Ue(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(sn(o))return this.addToken(6,t,i),i;if(o===92){let s=r.charCodeAt(i+1);if(sn(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($t(r)){let n=1;e++;while(n<6&&e<t.length&&$t(t.charCodeAt(e)))e++,n++;if(e<t.length&&Re(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&&(We[i]&10)!==0){n++;continue}if(i===45){n++;continue}if(i>=128){n++;continue}if(i===92&&Ue(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&&fe(t.charCodeAt(r)))r++;if(t.charCodeAt(r)===46&&fe(t.charCodeAt(r+1))){r+=2;while(r<t.length&&fe(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(fe(i)){r+=2;while(r<t.length&&fe(t.charCodeAt(r)))r++}else if((i===43||i===45)&&fe(o)){r+=3;while(r<t.length&&fe(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(on(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&&Re(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&&Re(r.charCodeAt(i)))i++;while(i<n){let o=r.charCodeAt(i);if(o===41)return i++,this.addToken(7,e,i),i;if(Re(o)){let s=i;while(i<n&&Re(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||yu(o))return this.consumeBadUrl(e,i);if(o===92){if(Ue(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&&Ue(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 xu(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 an(e,t,r){for(let n=t;n<r;n++)if(e.charCodeAt(n)===92)return vu(e,t,r,n);return e.slice(t,r)}function vu(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($t(c)){let a=o+1,l="";while(l.length<6&&a<r&&$t(e.charCodeAt(a)))l+=e[a],a++;let u=Number.parseInt(l,16);if(a<r&&Re(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 ln(e,t,r){for(let n=t;n<r;n++)if(e.charCodeAt(n)===92)return wu(e,t,r,n);return e.slice(t,r)}function wu(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&&$t(e.charCodeAt(c)))a+=e[c],c++;if(a.length>0){let l=Number.parseInt(a,16);if(c<r&&Re(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 Qi(e,t){let r=new Dt(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 b(e){return e.pos<e.end?e.types[e.pos]:0}function v(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 xe(e,t){return e.source.slice(t.start,t.end)}function de(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 Gi(e){let{types:t,end:r}=e;while(e.pos<r&&t[e.pos]===13)e.pos++}function R(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 eo(e){if(!e.positions)return null;let t=v(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 jt(e,t,r,n){return{type:"Raw",value:e,loc:R(n,t,r)}}function te(){return new le}function cn(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 Vt(e,t={}){let r=Qi(e,t);switch(t.context??"stylesheet"){case"stylesheet":return Ji(r);case"atrule":return Ut(r)??qi(r);case"atrulePrelude":return ku(r);case"mediaQuery":case"mediaQueryList":return Yi(r);case"rule":return fn(r);case"selectorList":return gn(r);case"selector":return io(r);case"block":return dn(r);case"declarationList":return Eu(r);case"declaration":return hn(r)??qi(r);case"value":return Tu(r);case"raw":return Yi(r);default:return Ji(r)}}function qi(e){return{type:"StyleSheet",children:te(),loc:eo(e)}}function Yi(e){let t=v(e),r=t;while(b(e)!==0)r=C(e);return{type:"Raw",value:e.source.slice(t.start,r.end),loc:R(e,t,r)}}function Ji(e){let t=v(e),r=te(),{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=un(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=Ut(e);if(u)r.appendData(u);continue}if(c===24){e.pos++;continue}let a=e.pos,l=fn(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:R(e,t,s)}}function un(e,t){return{type:"Comment",value:e.source.slice(t.start+2,t.end-2),loc:R(e,t,t)}}function Ut(e){let t=v(e);if(t.type!==3)return null;e.pos++;let r=Bt(e.source,t.start+1,t.end);de(e);let n=e.pos,i=v(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 g=e.end;e.end=a,e.pos=n;let p=te();while(b(e)!==0){let y=ze(e);if(y)p.appendData(y)}if(ro(p),e.end=g,e.pos=c,p.isEmpty)l=jt(m,i,h,e);else l={type:"AtrulePrelude",children:p,loc:null}}catch(g){let p=jt(m,i,h,e);cn(e,`Failed to parse @${r} prelude: ${g.message}`,i,p),l=p,e.pos=c}else l=jt(m,i,h,e),e.pos=c;else e.pos=c}else e.pos=c;let u=null;if(b(e)===17)C(e);else if(b(e)===23)u=dn(e,Ru.has(r));return{type:"Atrule",name:r,prelude:l,block:u,loc:R(e,t,v(e))}}var $u=new Set(["is","not","where","has","matches","-moz-any","-webkit-any"]),Ru=new Set(["media","supports","document","layer","container","scope","starting-style","-moz-document","keyframes","-webkit-keyframes","-moz-keyframes","-o-keyframes"]);function ku(e){let t=v(e),r=te();while(b(e)!==0){if(v(e).type===13){e.pos++;continue}let i=ze(e);if(i)r.appendData(i)}return{type:"AtrulePrelude",children:r,loc:R(e,t,v(e))}}function fn(e){let t=v(e),r;if(e.parseRulePrelude)r=gn(e);else{let i=v(e),o=i;while(b(e)!==0&&b(e)!==23)o=C(e);let s=e.source.slice(i.start,o.end).trim();r=jt(s,i,o,e)}let n=dn(e,!0);return{type:"Rule",prelude:r,block:n,loc:R(e,t,v(e))}}function dn(e,t=!1){let r=v(e);if(b(e)!==23)return{type:"Block",children:te(),loc:eo(e)};e.pos++;let n=te(),{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(un(e,a));continue}if(s===3){let a=Ut(e);if(a)n.appendData(a);continue}if(t&&Su(e,Au)){let a=fn(e);n.appendData(a);continue}let c=hn(e);if(c)n.appendData(c);if(e.pos<o&&i[e.pos]===17)e.pos++}if(b(e)===24)e.pos++;return{type:"Block",children:n,loc:R(e,r,v(e))}}function Su(e,t){let r=e.pos,n=t(e);return e.pos=r,n}function Au(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 Eu(e){let t=v(e),r=te();while(b(e)!==0&&b(e)!==24){let n=v(e);if(n.type===13){e.pos++;continue}if(n.type===25){r.appendData(un(e,C(e)));continue}if(n.type===17){e.pos++;continue}if(n.type===3){let o=Ut(e);if(o)r.appendData(o);continue}let i=hn(e);if(i)r.appendData(i);if(b(e)===17)C(e)}return{type:"DeclarationList",children:r,loc:R(e,t,v(e))}}function hn(e){de(e);let t=v(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{cn(e,"Expected property name",t,{type:"Raw",value:"",loc:null});let{types:S,end:j}=e;while(e.pos<j){let q=S[e.pos];if(q===0||q===17||q===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(Gi(e),b(e)!==16){cn(e,`Expected ':' after property "${i}"`,v(e),{type:"Raw",value:"",loc:null});let{types:S,end:j}=e;while(e.pos<j){let q=S[e.pos];if(q===0||q===17||q===24)break;e.pos++}return null}e.pos++,Gi(e);let{types:o,starts:s,end:c,pos:a}=e,l=a,u=a,f=-1,d=-1;while(l<c){let S=o[l];if(S===0||S===17||S===24)break;if(S===9&&e.source.charCodeAt(s[l])===33){let j=l+1;while(j<c&&o[j]===13)j++;if(j<c&&o[j]===1){let q=s[j];if(e.ends[j]-q===9&&(e.source.charCodeAt(q)|32)===105&&(e.source.charCodeAt(q+1)|32)===109&&(e.source.charCodeAt(q+2)|32)===112&&(e.source.charCodeAt(q+3)|32)===111&&(e.source.charCodeAt(q+4)|32)===114&&(e.source.charCodeAt(q+5)|32)===116&&(e.source.charCodeAt(q+6)|32)===97&&(e.source.charCodeAt(q+7)|32)===110&&(e.source.charCodeAt(q+8)|32)===116){d=l,f=j,l=j+1;continue}}}if(S!==13&&S!==25)u=l+1;l++}let h=u,m=f>=0?{type:1,start:s[f],end:e.ends[f]}:null,g=i.startsWith("--"),p,y=s[a],x=h>a?e.ends[h-1]:y,w={type:o[a],start:y,end:e.ends[a]},T=h>a?{type:o[h-1],start:s[h-1],end:x}:w;if(g&&!e.parseCustomProperty||!e.parseValue)p={type:"Raw",value:e.source.slice(y,x).trim(),loc:R(e,w,T)};else if(h===a)p={type:"Value",children:te(),loc:R(e,w,T)};else{let S=e.end;e.end=h,e.pos=a,p=to(e),e.end=S}return e.pos=l,{type:"Declaration",property:i,important:m?!0:!1,value:p,loc:R(e,t,v(e))}}function Tu(e){return to(e)}function to(e){let t=v(e),r=te();while(b(e)!==0&&b(e)!==17&&b(e)!==24&&b(e)!==22&&b(e)!==20){let n=ze(e);if(n)r.appendData(n)}return no(r),{type:"Value",children:r,loc:R(e,t,v(e))}}function ro(e){for(let t of e)if("children"in t&&t.children instanceof le)ro(t.children);no(e)}function no(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 ze(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:ee(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?ee(e,n,i):null};case 10:return e.pos++,{type:"Number",value:o.slice(n,i),loc:e.positions?ee(e,n,i):null};case 11:return e.pos++,{type:"Percentage",value:o.slice(n,i-1),loc:e.positions?ee(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?ee(e,n,i):null}}case 1:return e.pos++,{type:"Identifier",name:ln(o,n,i),loc:e.positions?ee(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:an(o,s,a),loc:e.positions?ee(e,n,i):null}}case 7:{e.pos++;let s=n+4;while(s<i&&Xi(o.charCodeAt(s)))s++;let c=i;if(c>s&&o.charCodeAt(c-1)===41)c--;while(c>s&&Xi(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?ee(e,n,i):null}}case 4:return e.pos++,{type:"Hash",name:o.slice(n+1,i),loc:e.positions?ee(e,n,i):null};case 2:return Ou(e);case 21:return Iu(e);case 18:return e.pos++,{type:"Operator",value:",",loc:e.positions?ee(e,n,i):null};case 16:return e.pos++,{type:"Operator",value:":",loc:e.positions?ee(e,n,i):null};case 9:{e.pos++;let s=o.charCodeAt(n),c=o[n];if(Nu(s))return{type:"Operator",value:c,loc:e.positions?ee(e,n,i):null};return{type:"Identifier",name:c,loc:e.positions?ee(e,n,i):null}}case 19:{e.pos++;let s=te();while(b(e)!==0&&b(e)!==20){let a=ze(e);if(a)s.appendData(a)}let c=e.pos<e.end?e.ends[e.pos]:i;if(b(e)===20)e.pos++;return{type:"Brackets",children:s,loc:e.positions?ee(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?ee(e,n,i):null}}return e.pos++,null}function Xi(e){return e===32||e===9||e===10||e===12||e===13}function Nu(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 Bt(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 ee(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 Ou(e){let t=C(e),r=Bt(e.source,t.start,t.end-1),n=te();while(b(e)!==0&&b(e)!==22){let i=ze(e);if(i)n.appendData(i)}if(b(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:R(e,t,v(e))}}return{type:"Function",name:r,children:n,loc:R(e,t,v(e))}}function Iu(e){let t=C(e),r=te();while(b(e)!==0&&b(e)!==22){let n=ze(e);if(n)r.appendData(n)}if(b(e)===22)C(e);return{type:"Parentheses",children:r,loc:R(e,t,v(e))}}function gn(e){let t=v(e),r=te();while(b(e)!==0){if(de(e),b(e)===0||b(e)===23)break;let n=io(e);if(n.children.head!==null)r.appendData(n);if(de(e),b(e)===18){C(e);continue}break}return{type:"SelectorList",children:r,loc:R(e,t,v(e))}}function io(e){let t=v(e),r=te(),n=!0;while(b(e)!==0&&b(e)!==18&&b(e)!==23){let i=v(e);if(i.type===13){if(C(e),!n&&b(e)!==0&&b(e)!==18&&b(e)!==23&&!Zi(e)&&!Pu(e)){let s={type:"Combinator",name:" ",loc:R(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=v(e);C(e);let c=C(e),a={type:"Combinator",name:"||",loc:R(e,s,c)};r.appendData(a),n=!0,de(e);continue}if(Zi(e)){let s=C(e),a={type:"Combinator",name:e.source[s.start],loc:R(e,s,s)};r.appendData(a),n=!0,de(e);continue}let o=_u(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:R(e,t,v(e))}}function Zi(e){let t=v(e);if(t.type!==9)return!1;let r=e.source[t.start];return r===">"||r==="+"||r==="~"}function Pu(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 _u(e){let t=v(e);switch(t.type){case 1:{if(C(e),b(e)===9&&e.source[v(e).start]==="|"&&e.source[v(e).start+1]!=="="&&!(e.types[e.pos+1]===9&&e.source.charCodeAt(e.starts[e.pos+1])===124)){if(C(e),b(e)===1){let n=C(e);return{type:"TypeSelector",name:`${xe(e,t)}|${xe(e,n)}`,loc:R(e,t,n)}}if(b(e)===9&&e.source[v(e).start]==="*"){let n=C(e);return{type:"TypeSelector",name:`${xe(e,t)}|*`,loc:R(e,t,n)}}}return{type:"TypeSelector",name:xe(e,t),loc:R(e,t,t)}}case 11:return C(e),{type:"TypeSelector",name:xe(e,t),loc:R(e,t,t)};case 10:return C(e),{type:"TypeSelector",name:xe(e,t),loc:R(e,t,t)};case 9:{let r=e.source[t.start];if(r==="*")return C(e),{type:"TypeSelector",name:"*",loc:R(e,t,t)};if(r==="."){if(C(e),b(e)===1){let n=C(e);return{type:"ClassSelector",name:xe(e,n),loc:R(e,t,n)}}return null}if(r==="&")return C(e),{type:"NestingSelector",loc:R(e,t,t)};return C(e),null}case 4:return C(e),{type:"IdSelector",name:e.source.slice(t.start+1,t.end),loc:R(e,t,t)};case 16:{C(e);let r=b(e)===16;if(r)C(e);return Lu(e,r,t)}case 19:return Mu(e)}return null}function Lu(e,t,r){let n=v(e);if(n.type===1){C(e);let i=Bt(e.source,n.start,n.end);return t?{type:"PseudoElementSelector",name:i,children:null,loc:R(e,r,n)}:{type:"PseudoClassSelector",name:i,children:null,loc:R(e,r,n)}}if(n.type===2){C(e);let i=Bt(e.source,n.start,n.end-1),o=te();if(!t&&$u.has(i)){let a=v(e),l=a,u=1;while(b(e)!==0&&u>0){if(b(e)===21||b(e)===2)u++;else if(b(e)===22){if(u--,u===0)break}l=C(e)}if(b(e)===22)C(e);let f=e.source.slice(a.start,l.end).trim();if(f.length>0){let d=Qi(f,{positions:!1}),h=gn(d);o.appendData(h)}}else{while(b(e)!==0&&b(e)!==22){let a=ze(e);if(a)o.appendData(a)}if(b(e)===22)C(e)}if(t)return{type:"PseudoElementSelector",name:i,children:o,loc:R(e,r,v(e))};return{type:"PseudoClassSelector",name:i,children:o,loc:R(e,r,v(e))}}return null}function Mu(e){let t=C(e);de(e);let r=v(e);if(r.type!==1)return null;C(e);let n={type:"Identifier",name:xe(e,r),loc:R(e,r,r)};de(e);let i=null,o=null,s=null,c=v(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=v(e);if(h.type===9&&e.source[h.start]==="=")C(e),i=`${l}=`}de(e);let f=v(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:an(e.source,f.start+1,h?f.end-1:f.end),loc:R(e,f,f)}}else if(f.type===1)C(e),o={type:"Identifier",name:xe(e,f),loc:R(e,f,f)};de(e);let d=v(e);if(d.type===1)C(e),s=xe(e,d)}de(e);let a=v(e);if(b(e)===20)a=C(e);return{type:"AttributeSelector",name:n,matcher:i,value:o,flags:s,loc:R(e,t,a)}}var oo=Symbol("walkSkip"),V=Symbol("walkStop");function Fu(e){return{root:e,stylesheet:null,atrule:null,atrulePrelude:null,rule:null,selector:null,block:null,declaration:null,function:null}}function Du(e,t){let r=Fu(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===oo){if(f)r[f]=d;return}if(m===V){if(f)r[f]=d;return V}}if(h=ju(a,s,c),h===V){if(f)r[f]=d;return V}if((o===null||o===a.type)&&i){if(i.call(r,a,l,u)===V){if(f)r[f]=d;return V}}if(f)r[f]=d;return}return c(e,null,null)}var Ke=Object.assign(Du,{skip:oo,stop:V});function ju(e,t,r){if("children"in e&&e.children instanceof le)return Bu(e.children,t,r);if(e.type==="Rule"){if(r(e.prelude,null,null)===V)return V;if(r(e.block,null,null)===V)return V;return}if(e.type==="Atrule"){if(e.prelude){if(r(e.prelude,null,null)===V)return V}if(e.block){if(r(e.block,null,null)===V)return V}return}if(e.type==="Declaration")return r(e.value,null,null);if(e.type==="AttributeSelector"){if(r(e.name,null,null)===V)return V;if(e.value)return r(e.value,null,null);return}return}function Bu(e,t,r){let n;if(t)e.forEachRight((i,o,s)=>{if(n)return;if(r(i,o,s)===V)n=V});else e.forEach((i,o,s)=>{if(n)return;if(r(i,o,s)===V)n=V});return n}function Qe(e,t={}){let r=t.exclamation??!1,n=!1;Ke(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 Wt(e){Ke(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 Vu={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"},Uu={"#f00":"red","#ff0000":"red","#000080":"navy","#008080":"teal"};function pn(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 so(e){let t=e.toLowerCase();return Vu[t]??null}function ao(e){let t=e.toLowerCase();return Uu[t]??null}function Wu(e,t,r){let n=(e<<16|t<<8|r).toString(16).padStart(6,"0");return pn(`#${n}`)}var zu=/^rgba?\(\s*([+-]?\d*\.?\d+%?)\s*[,\s]\s*([+-]?\d*\.?\d+%?)\s*[,\s]\s*([+-]?\d*\.?\d+%?)\s*(?:[,/]\s*([+-]?\d*\.?\d+%?)\s*)?\)$/;function lo(e){let t=zu.exec(e.trim());if(!t)return e;let r=mn(t[1]),n=mn(t[2]),i=mn(t[3]);if(t[4]!==void 0&&!Ku(t[4]))return e;return Wu(r,n,i)}function Ku(e){if(e.endsWith("%"))return Number.parseFloat(e)>=100;return Number.parseFloat(e)>=1}function mn(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 Hu=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 zt(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 co(e,t){let r=zt(e);if((r==="0"||r==="-0")&&Hu.has(t.toLowerCase()))return{value:"0",unit:""};return{value:r,unit:t}}function uo(e){return zt(e)}function fo(e,t){let r=Number.parseFloat(e);if(!Number.isFinite(r))return e;let n=t<0?0:t;return r.toFixed(n)}var ho=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 go(e){if(!e||e.type!=="Operator")return!1;let t=e.value;return t===":"||t===","||t==="/"}function Gu(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&&go(r.prev.data),o=n&&go(n.data);if(i||o)t.remove(r)}r=n}}function yn(e,t={}){let r=t.floatPrecision??null,n=r===null?null:(i)=>fo(i,r);Ke(e,{enter(i,o,s){switch(i.type){case"Number":{let c=n?n(i.value):i.value;i.value=zt(c);return}case"Percentage":{let c=n?n(i.value):i.value;i.value=uo(c);return}case"Dimension":{let c=n?n(i.value):i.value,a=co(c,i.unit);i.value=a.value,i.unit=a.unit;return}case"Hash":{let c=pn(`#${i.name}`).slice(1);if(i.name=c,o&&s&&this.declaration&&ho.has(this.declaration.property.toLowerCase())){let a=ao(`#${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(!ho.has(this.declaration.property.toLowerCase()))return;let c=so(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")Gu(i);if(i.type==="Function"&&i.__rgbReplaceCandidate&&o&&s){let c=Q(i),a=lo(c);if(a!==c&&a.startsWith("#")){let l={type:"Hash",name:a.slice(1),loc:i.loc};s.replace(o,s.createItem(l))}}}})}function qu(e,t={}){let r=Vt(e,{context:"stylesheet"});return mo(r,t)}function bn(e,t={}){let r=Vt(e,{context:"declarationList"});return mo(r,t)}function mo(e,t){if(t.comments===!1)Qe(e,{exclamation:!1});else if(t.comments==="first-exclamation")Qe(e,{exclamation:"first-exclamation"});else Qe(e,{exclamation:!0});return yn(e,{floatPrecision:t.floatPrecision??null}),Wt(e),{css:Q(e),ast:e}}function Le(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 po=new Map,_e=new Map;var xn={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"},Xu=/[%#()]/,Zu=/^\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)$/,$o=["calc","min","max","clamp","mod","rem","sin","cos","tan","asin","acos","atan","atan2","pow","sqrt","hypot","log","exp","round"],Qu=new Set($o);function se(e){return Xu.test(e)||Zu.test(e)}function yo(e){if(!$o.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(Qu.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 Kt(e){if(!e.includes("_"))return yo(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 yo(t)}function bo(e,t){if(t.length!==2)return null;let[r,n]=t;if(r!=="min"&&r!=="max")return null;return[se(n)?`${r}-${e}-[${n}]`:`${r}-${e}-${n}`]}var ef={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(se(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(se(r))return`w-[${r}]`;return`w-${r}`},multiValue:(e)=>bo("w",e)},h:{expand:(e,t)=>{let r=t[e]||e;if(se(r))return`h-[${r}]`;return`h-${r}`},multiValue:(e)=>bo("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(se(r))return`inset-[${r}]`;return`inset-${r}`}},top:{expand:(e)=>se(e)?`top-[${e}]`:`top-${e}`},right:{expand:(e)=>se(e)?`right-[${e}]`:`right-${e}`},bottom:{expand:(e)=>se(e)?`bottom-[${e}]`:`bottom-${e}`},left:{expand:(e)=>se(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)=>se(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)=>se(e)?`backdrop-hue-rotate-[${e}]`:`backdrop-hue-rotate-${e}`},animate:{expand:(e)=>`animate-${e}`},"forced-colors":{expand:(e)=>`forced-colors-${e}`}},Rt=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","only-of-type","checked","indeterminate","default","required","valid","invalid","in-range","out-of-range","placeholder-shown","autofill","read-only","user-valid","user-invalid","inert","empty","before","after","selection","marker","file","first-letter","first-line","backdrop","details-content","print","motion-safe","motion-reduce","pointer-none","pointer-coarse","pointer-fine","any-pointer-none","any-pointer-coarse","any-pointer-fine","inverted-colors","noscript","starting","contrast-more","contrast-less","rtl","ltr","portrait","landscape","@sm","@md","@lg","@xl","@2xl"]),xo=new WeakMap,vo=new WeakMap;function tf(e){if(!e)return xn;let t=xo.get(e);if(!t)t=e.aliases?{...xn,...e.aliases}:xn,xo.set(e,t);return t}function rf(e){if(!e?.aliases)return"";let t=vo.get(e);if(t===void 0)t=JSON.stringify(e.aliases),vo.set(e,t);return t}function kt(e){let t=[],r="",n=0;for(let i=0;i<e.length;i++){let o=e[i];if(o==="[")n++;else if(o==="]")n--;if(o===":"&&n===0)t.push(r),r="";else r+=o}return t.push(r),t}function nf(e,t){let r=`${e}:${t?.colonSyntax}:${rf(t)}`,n=_e.get(r);if(n)return n;let i=tf(t);if(t?.colonSyntax===!0){let g=e.match(/^([a-z][a-z0-9-]*):([^[\]:]+)$/i);if(g){let[,p,y]=g;if(!Rt.has(p)){if(se(y)){let w=[`${p}-[${y}]`];return Le(_e,r,w),w}let x=y.startsWith("-")?[`-${p}-${y.slice(1)}`]:[`${p}-${y}`];return Le(_e,r,x),x}}}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)=>Rt.has(y)))o=a[1],s=a[2]}let l=s.match(/^([a-z][a-z0-9-]*)\[([^\]]*)\]$/i);if(!l||s.includes("-[")){let g=[e];return Le(_e,r,g),g}let[,u,f]=l,d=f.split(/\s+/).filter(Boolean);if(d.length===0)return Le(_e,r,[]),[];let h=ef[u.toLowerCase()];if(h?.multiValue){let g=h.multiValue(d,i);if(g){let p=g.map((y)=>`${o}${c?"-":""}${y}`);return Le(_e,r,p),p}}if(!h){let g=[];for(let p of d){let y=p.match(/^([a-z@][a-z0-9-]*):(.+)$/i),x="",w=p;if(y&&Rt.has(y[1]))x=`${y[1]}:`,w=y[2];let T="";if(w.startsWith("-"))T="-",w=w.slice(1);let S="";if(w.endsWith("!"))S="!",w=w.slice(0,-1);let j=c?"-":"";if(se(w))g.push(`${o}${x}${S}${j}${T}${u}-[${w}]`);else g.push(`${o}${x}${S}${j}${T}${u}-${w}`)}return Le(_e,r,g),g}let m=[];for(let g of d){let p=g.match(/^([a-z@][a-z0-9-]*):(.+)$/i),y="",x=g;if(p&&Rt.has(p[1]))y=`${p[1]}:`,x=p[2];let w="";if(x.startsWith("-"))w="-",x=x.slice(1);let T="";if(x.endsWith("!"))T="!",x=x.slice(0,-1);let S=h.expand(x,i);if(S){let j=c?"-":"";m.push(`${o}${y}${T}${j}${w}${S}`)}}return Le(_e,r,m),m}function of(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="",g=d,p=d.match(/^((?:[a-z@][a-z0-9-]*:)+)([a-z][a-z0-9-]*)$/i);if(p){if(p[1].slice(0,-1).split(":").every((w)=>Rt.has(w)))m=p[1],g=p[2]}if(h!==void 0){let y=h.split(/\s+/).filter(Boolean);for(let x of y){let w=`${m}${g}-${x}`;if(wo(w.replace(/^(?:[a-z@][a-z0-9-]*:)+/gi,"")))r.add(w)}}else{let y=`${m}${g}`;if(wo(g))r.add(y)}}}return r}function wo(e){if(!e||e.length===0)return!1;return/^[a-z][a-z0-9-/]*(?:-\[[^\]]+\])?$/i.test(e)}function vn(e){let t=po.get(e);if(t)return t;let r=uf(e);return r.base=cf(r),Le(po,e,r),r}var sf=new Set(["bg","text","border","ring","placeholder","divide","accent","caret","fill","stroke","outline","decoration","shadow","ring-offset","from","via","to"]),af=/^(.+?)\/(\d+|\[\d*\.?\d+\])$/,lf=/^(\d+)\/(\d+)$/;function Co(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 cf(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 uf(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 h=kt(r),m=h[h.length-1],g=!1;if(m.charCodeAt(0)===33&&m.length>1)g=!0,m=m.slice(1);let p=m.match(/^\[([a-z-]+):(.+)\]$/);if(p)return{raw:e,variants:h.slice(0,-1),utility:p[1],value:Kt(p[2]),important:t||g,arbitrary:!0}}let n=r.match(/^((?:[a-z-]+:)*)(-?[a-z-]+?)-\[([^\]]+)\]\/\[([^\]]+)\]$/);if(n){let[,h,m,g,p]=n,y=h?h.split(":").filter(Boolean):[],x=m.startsWith("-"),w=x?m.slice(1):m,T=Kt(g);if(x)T=T.startsWith("-")?T:`-${T}`;return{raw:e,variants:y,utility:w,value:`${T}/${p}`,important:t,arbitrary:!0,modifierArbitrary:!0}}let i=r.match(/^((?:[a-z-]+:)*)(-?[a-z-]+?)-\[(.+)\]$/);if(i){let h=i[1],m=h?h.split(":").filter(Boolean):[],g=i[2],p=g.startsWith("-");if(p)g=g.slice(1);let y=Kt(i[3]),x,w=y.match(/^(color|length|url|number|percentage|position|line-width|absolute-size|relative-size|image|angle|time|flex|string|family-name):(.*)/i);if(w)x=w[1].toLowerCase(),y=w[2];if(p)y=y.startsWith("-")?y:`-${y}`;return{raw:e,variants:m,utility:g,value:y,important:t,arbitrary:!0,typeHint:x}}let o=kt(r),s=o[o.length-1],c=o.slice(0,-1);if(s.startsWith("!")&&s.length>1)t=!0,s=s.slice(1);else if(s.endsWith("!")&&s.length>1)t=!0,s=s.slice(0,-1);if(c.length>0)r=`${c.join(":")}:${s}`;else r=s;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(s))return{raw:e,variants:c,utility:s,value:void 0,important:t,arbitrary:!1};let l=s.match(/^([a-z-]+?)-\[(.+?)\]$/);if(l){let h=Kt(l[2]),m,g=h.match(/^(color|length|url|number|percentage|position|line-width|absolute-size|relative-size|image|angle|time|flex|string|family-name):(.*)/i);if(g)m=g[1].toLowerCase(),h=g[2];return{raw:e,variants:c,utility:l[1],value:h,important:t,arbitrary:!0,typeHint:m}}let u=["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(s==="divide-x"||s==="divide-y")return{raw:e,variants:c,utility:s,value:void 0,important:t,arbitrary:!1};let f=s.match(/^(divide-[xy])-(.+)$/);if(f)return{raw:e,variants:c,utility:f[1],value:f[2],important:t,arbitrary:!1};for(let h of u)if(s.startsWith(`${h}-`))return{raw:e,variants:c,utility:h,value:s.slice(h.length+1),important:t,arbitrary:!1};if(s.startsWith("-")){let h=s.slice(1);for(let g of u)if(h.startsWith(`${g}-`))return{raw:e,variants:c,utility:g,value:`-${h.slice(g.length+1)}`,important:t,arbitrary:!1};let m=Co(h);if(m)return{raw:e,variants:c,utility:m[0],value:`-${m[1]}`,important:t,arbitrary:!1};return{raw:e,variants:c,utility:h,value:void 0,important:t,arbitrary:!1}}let d=Co(s);if(d){let[h,m]=d,g=m.match(af);if(g&&sf.has(h))return{raw:e,variants:c,utility:h,value:`${g[1]}/${g[2]}`,important:t,arbitrary:!1};let p=m.match(lf);if(p)return{raw:e,variants:c,utility:h,value:`${p[1]}/${p[2]}`,important:t,arbitrary:!1};return{raw:e,variants:c,utility:h,value:m,important:t,arbitrary:!1}}return{raw:e,variants:c,utility:s,value:void 0,important:t,arbitrary:!1}}function ff(e){return/^\[[a-z-]+:[^\]]+\]$/i.test(e)}function df(e){if(!e)return!1;if(e==="*"||e==="**")return!0;if(e.startsWith("[")&&e.endsWith("]"))return e.length>2;return/^(?:@[a-z0-9]|[a-z])[a-z0-9.-]*(?:\[[^\]]+\])?(?:\/[\w-]+)?$/i.test(e)}function hf(e,t){let r=e;if(r.startsWith("!"))r=r.slice(1);if(r.endsWith("!"))r=r.slice(0,-1);if(!r)return!1;if(ff(r))return!0;if(t?.enabled&&/^[a-z]+\[[^\]]+\]$/i.test(r))return!0;return/^[-@]?[a-z][a-z0-9.-]*(?:-\[[^\]]+\])?(?:\/(?:[\w.]+|[\w-]+|\[[^\]]+\]))?$/i.test(r)}function Ro(e,t){if(!e||e.length===0)return!1;if(t?.colonSyntax&&/^[a-z]+:[^[\]:]+$/i.test(e))return!0;let r=e;if(r.startsWith("!"))r=r.slice(1);if(r.endsWith("!"))r=r.slice(0,-1);if(!r)return!1;let n=kt(r);for(let i=0;i<n.length-1;i++)if(!df(n[i]))return!1;return hf(n[n.length-1],t)}function Gt(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 qt(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=Gt(d);for(let m of h)Ht(r,m,t)}let l=c.replace(/["'`]/g," ").replace(/\$\{[^}]+\}/g," "),u=Gt(l).filter((f)=>Ro(f,t?.bracketSyntax));for(let f of u)Ht(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 Gt(l))Ht(r,u,t)}}}if(t?.codeStrings?.enabled!==!1)for(let o of ko(e,t?.bracketSyntax))Ht(r,o,t);if(t?.attributify?.enabled){let o=of(e,t.attributify);for(let s of o)r.add(s)}return r}function gf(e,t){if(!/[-:/[]/.test(e))return!1;if(e.startsWith("-")&&!/^-[a-z]/i.test(e))return!1;return Ro(e,t)}function ko(e,t){let r=new Set,n=e.length,i=0,o="";while(i<n){let s=e[i];if(s==="/"&&e[i+1]==="/"){let d=e.indexOf(`
|
|
92
|
-
`,i);i=
|
|
93
|
-
`)break;if(
|
|
94
|
-
`)return-1;if(i==="\\"){n++;continue}if(i==="[")r=!0;else if(i==="]")r=!1;else if(i==="/"&&!r){let o=n+1;while(o<e.length&&/[a-z]/i.test(e[o]))o++;return o}}return-1}var
|
|
91
|
+
`),Ie.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 Ie.removeAllListeners("SIGINT"),Ie.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 Ki{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 Sx=new Ki;function Mc(){if("FORCE_COLOR"in wt.env)return wt.env.FORCE_COLOR!=="0";if("NO_COLOR"in wt.env||wt.env.TERM==="dumb")return!1;if(wt.platform==="win32")return!0;return Ui.isatty(1)&&Ui.isatty(2)}var Hi=Mc();function M(e,t){if(!Hi)return(r)=>r;return(r)=>e+r+t}var Fc=M("\x1B[0m","\x1B[0m"),Dc=M("\x1B[31m","\x1B[39m"),jc=M("\x1B[32m","\x1B[39m"),Bc=M("\x1B[33m","\x1B[39m"),Uc=M("\x1B[34m","\x1B[39m"),Vc=M("\x1B[35m","\x1B[39m"),Wc=M("\x1B[36m","\x1B[39m"),zc=M("\x1B[37m","\x1B[39m"),Kc=M("\x1B[90m","\x1B[39m"),Hc=M("\x1B[1m","\x1B[22m"),Gc=M("\x1B[3m","\x1B[23m"),qc=M("\x1B[4m","\x1B[24m"),Yc=M("\x1B[2m","\x1B[22m"),Jc=M("\x1B[7m","\x1B[27m"),Xc=M("\x1B[8m","\x1B[28m"),Zc=M("\x1B[9m","\x1B[29m"),Qc=M("\x1B[41m","\x1B[49m"),eu=M("\x1B[42m","\x1B[49m"),tu=M("\x1B[43m","\x1B[49m"),ru=M("\x1B[44m","\x1B[49m"),nu=M("\x1B[45m","\x1B[49m"),iu=M("\x1B[46m","\x1B[49m"),ou=M("\x1B[47m","\x1B[49m"),su=Hi,au={reset:Fc,red:Dc,green:jc,yellow:Bc,blue:Uc,magenta:Vc,cyan:Wc,white:zc,gray:Kc,bold:Hc,italic:Gc,underline:qc,dim:Yc,inverse:Jc,hidden:Xc,strikethrough:Zc,bgRed:Qc,bgGreen:eu,bgYellow:tu,bgBlue:ru,bgMagenta:nu,bgCyan:iu,bgWhite:ou,isColorSupported:su},lu=au,uu=["up","down","left","right","space","enter","cancel"],Ix={actions:new Set(uu),aliases:new Map([["k","up"],["j","down"],["h","left"],["l","right"],["\x03","cancel"],["escape","cancel"]]),messages:{cancel:"Canceled",error:"Something went wrong"}};var Px=cu.platform.startsWith("win"),_x=Symbol("clapp:cancel");var fu=Ec();var _=(e,t)=>fu?e:t,Lx=_("\u25C6","*"),Mx=_("\u25A0","x"),Fx=_("\u25B2","x"),Dx=_("\u25C7","o"),jx=_("\u250C","T"),du=_("\u2502","|"),Bx=_("\u2514","\u2014"),Ux=_("\u25CF",">"),Vx=_("\u25CB"," "),Wx=_("\u25FB","[\u2022]"),zx=_("\u25FC","[+]"),Kx=_("\u25FB","[ ]"),Hx=_("\u25AA","\u2022"),Gx=_("\u2500","-"),qx=_("\u256E","+"),Yx=_("\u251C","+"),Jx=_("\u256F","+"),Xx=_("\u25CF","\u2022"),Zx=_("\u25C6","*"),Qx=_("\u25B2","!"),ev=_("\u25A0","x");var tv={light:_("\u2500","-"),heavy:_("\u2501","="),block:_("\u2588","#")};function hu(){return`${lu.gray(du)} `}var rv=hu();class Gi{configPath;config=null;events=[];retryCount=0;maxRetries=3;retryDelayMs=1000;constructor(){let e=Vi.homedir(),t=Qr.join(e,".config","clapp");this.configPath=Qr.join(t,"telemetry.json")}async isEnabled(){if(Ue.env.DO_NOT_TRACK==="1"||Ue.env.DO_NOT_TRACK==="true")return!1;if(Ue.env.NO_TELEMETRY==="1"||Ue.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:Vi.platform(),nodeVersion:Ue.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:Ue.env.DO_NOT_TRACK==="1"||Ue.env.DO_NOT_TRACK==="true",eventsQueued:this.events.length,lastSent:e.lastSent}}async loadConfig(){if(this.config)return this.config;try{if(gu(this.configPath)){let e=await Zr.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=Qr.dirname(this.configPath);await Zr.mkdir(t,{recursive:!0}),await Zr.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 lv=new Gi;var sn="0.3.23";function be(e){return{prev:null,next:null,data:e}}class le{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 be(e)}createItem(e){return be(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=be(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 le,r=null,n=0;for(let i=this.head;i!=null;i=i.next){let o=be(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 le,r=null,n=0;for(let i=this.head;i!=null;i=i.next)if(e(i.data,n++,this)){let o=be(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 le,t=null;for(let r=this.head;r!=null;r=r.next){let n=be(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(be(e),this.head)}append(e){return this.insert(e,null)}appendData(e){return this.insert(be(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(be(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(be(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 le)this.insertList(t,e),this.remove(e);else this.insert(t,e),this.remove(e)}}function Q(e){switch(e.type){case"StyleSheet":return oe(e.children,"");case"Rule":return`${Q(e.prelude)}{${Q(e.block)}}`;case"Block":return pu(e.children);case"Atrule":{let t=`@${e.name}`;if(e.prelude){let r=Q(e.prelude);if(r)t+=` ${r}`}if(e.block)t+=`{${Q(e.block)}}`;else t+=";";return t}case"AtrulePrelude":return oe(e.children,"");case"SelectorList":return oe(e.children,",");case"Selector":return oe(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+=`"${an(e.value.value)}"`;else t+=e.value.name;if(e.flags)t+=` ${e.flags}`;return t+="]",t}case"PseudoClassSelector":return e.children?`:${e.name}(${oe(e.children,"")})`:`:${e.name}`;case"PseudoElementSelector":return e.children?`::${e.name}(${oe(e.children,"")})`:`::${e.name}`;case"Combinator":return e.name===" "?" ":e.name;case"Declaration":return`${e.property}:${Q(e.value)}${e.important?"!important":""}`;case"DeclarationList":return oe(e.children,";");case"Value":return oe(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`"${an(e.value)}"`;case"Url":return/[\s"'()\\\u0000-\u001F\u007F]/.test(e.value)?`url("${an(e.value)}")`:`url(${e.value})`;case"Hash":return`#${e.name}`;case"Operator":return e.value;case"Function":return`${e.name}(${oe(e.children,"")})`;case"Parentheses":return`(${oe(e.children,"")})`;case"Brackets":return`[${oe(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?`${Q(e.nth)} of ${Q(e.selector)}`:Q(e.nth);case"MediaQueryList":return oe(e.children,",");case"MediaQuery":return oe(e.children,"");case"MediaFeature":{let t=`(${e.name}`;if(e.value)t+=`:${Q(e.value)}`;return t+=")",t}}return""}function oe(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(qi(i)||qi(a)){o=o.next;continue}}let c=Q(s);if(!c){o=o.next;continue}if(!n&&t&&!bu(i))r+=t;n=!1,r+=c,i=s,o=o.next}return r}function pu(e){let t="",r=null,n=e.head;while(n!=null){let i=n.data,o=Q(i);if(!o){n=n.next;continue}if(r&&yu(r,i))t+=";";t+=o,r=i,n=n.next}return t}function yu(e,t){return e.type==="Declaration"&&t.type!=="Comment"}function qi(e){if(!e||e.type!=="Operator")return!1;let t=e.value;return t===":"||t===","||t==="/"}function bu(e){if(!e)return!1;return e.type==="Operator"||e.type==="Combinator"}function an(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 We=(()=>{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 fe(e){return e<128&&(We[e]&2)!==0}function Rt(e){return e<128&&(We[e]&4)!==0}function Yi(e){return e>=128||e<128&&(We[e]&8)!==0}function xu(e){return e===45||e>=128||e<128&&(We[e]&10)!==0}function vu(e){return e>=0&&e<=8||e===11||e>=14&&e<=31||e===127}function cn(e){return e<128&&(We[e]&16)!==0}function Re(e){return e<128&&(We[e]&1)!==0}function Ve(e,t){if(e!==92)return!1;if(cn(t))return!1;return!0}function ln(e,t,r){if(e===45)return Yi(t)||t===45||Ve(t,r);if(Yi(e))return!0;if(e===92)return Ve(e,t);return!1}function wu(e,t,r){if(e===43||e===45){if(fe(t))return!0;if(t===46&&fe(r))return!0;return!1}if(e===46)return fe(t);return fe(e)}class Bt{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=$u(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(Re(n)){let s=t;while(t<r&&Re(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&&(xu(e.charCodeAt(t+1))||Ve(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(ln(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(wu(n,i,o)){t=this.consumeNumeric(t);continue}if(ln(n,i,o)){t=this.consumeIdentLike(t);continue}if(n===92){if(Ve(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(cn(o))return this.addToken(6,t,i),i;if(o===92){let s=r.charCodeAt(i+1);if(cn(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(Rt(r)){let n=1;e++;while(n<6&&e<t.length&&Rt(t.charCodeAt(e)))e++,n++;if(e<t.length&&Re(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&&(We[i]&10)!==0){n++;continue}if(i===45){n++;continue}if(i>=128){n++;continue}if(i===92&&Ve(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&&fe(t.charCodeAt(r)))r++;if(t.charCodeAt(r)===46&&fe(t.charCodeAt(r+1))){r+=2;while(r<t.length&&fe(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(fe(i)){r+=2;while(r<t.length&&fe(t.charCodeAt(r)))r++}else if((i===43||i===45)&&fe(o)){r+=3;while(r<t.length&&fe(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(ln(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&&Re(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&&Re(r.charCodeAt(i)))i++;while(i<n){let o=r.charCodeAt(i);if(o===41)return i++,this.addToken(7,e,i),i;if(Re(o)){let s=i;while(i<n&&Re(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||vu(o))return this.consumeBadUrl(e,i);if(o===92){if(Ve(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&&Ve(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 $u(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 un(e,t,r){for(let n=t;n<r;n++)if(e.charCodeAt(n)===92)return Cu(e,t,r,n);return e.slice(t,r)}function Cu(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(Rt(c)){let a=o+1,l="";while(l.length<6&&a<r&&Rt(e.charCodeAt(a)))l+=e[a],a++;let u=Number.parseInt(l,16);if(a<r&&Re(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 fn(e,t,r){for(let n=t;n<r;n++)if(e.charCodeAt(n)===92)return Ru(e,t,r,n);return e.slice(t,r)}function Ru(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&&Rt(e.charCodeAt(c)))a+=e[c],c++;if(a.length>0){let l=Number.parseInt(a,16);if(c<r&&Re(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 ro(e,t){let r=new Bt(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 v(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 xe(e,t){return e.source.slice(t.start,t.end)}function de(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 Ji(e){let{types:t,end:r}=e;while(e.pos<r&&t[e.pos]===13)e.pos++}function R(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 no(e){if(!e.positions)return null;let t=v(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 Ut(e,t,r,n){return{type:"Raw",value:e,loc:R(n,t,r)}}function te(){return new le}function dn(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 Wt(e,t={}){let r=ro(e,t);switch(t.context??"stylesheet"){case"stylesheet":return Qi(r);case"atrule":return zt(r)??Xi(r);case"atrulePrelude":return Eu(r);case"mediaQuery":case"mediaQueryList":return Zi(r);case"rule":return gn(r);case"selectorList":return yn(r);case"selector":return ao(r);case"block":return mn(r);case"declarationList":return Ou(r);case"declaration":return pn(r)??Xi(r);case"value":return Iu(r);case"raw":return Zi(r);default:return Qi(r)}}function Xi(e){return{type:"StyleSheet",children:te(),loc:no(e)}}function Zi(e){let t=v(e),r=t;while(x(e)!==0)r=C(e);return{type:"Raw",value:e.source.slice(t.start,r.end),loc:R(e,t,r)}}function Qi(e){let t=v(e),r=te(),{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=hn(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=zt(e);if(u)r.appendData(u);continue}if(c===24){e.pos++;continue}let a=e.pos,l=gn(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:R(e,t,s)}}function hn(e,t){return{type:"Comment",value:e.source.slice(t.start+2,t.end-2),loc:R(e,t,t)}}function zt(e){let t=v(e);if(t.type!==3)return null;e.pos++;let r=Vt(e.source,t.start+1,t.end);de(e);let n=e.pos,i=v(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 g=e.end;e.end=a,e.pos=n;let p=te();while(x(e)!==0){let y=ze(e);if(y)p.appendData(y)}if(oo(p),e.end=g,e.pos=c,p.isEmpty)l=Ut(m,i,h,e);else l={type:"AtrulePrelude",children:p,loc:null}}catch(g){let p=Ut(m,i,h,e);dn(e,`Failed to parse @${r} prelude: ${g.message}`,i,p),l=p,e.pos=c}else l=Ut(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=mn(e,Au.has(r));return{type:"Atrule",name:r,prelude:l,block:u,loc:R(e,t,v(e))}}var Su=new Set(["is","not","where","has","matches","-moz-any","-webkit-any"]),Au=new Set(["media","supports","document","layer","container","scope","starting-style","-moz-document","keyframes","-webkit-keyframes","-moz-keyframes","-o-keyframes"]);function Eu(e){let t=v(e),r=te();while(x(e)!==0){if(v(e).type===13){e.pos++;continue}let i=ze(e);if(i)r.appendData(i)}return{type:"AtrulePrelude",children:r,loc:R(e,t,v(e))}}function gn(e){let t=v(e),r;if(e.parseRulePrelude)r=yn(e);else{let i=v(e),o=i;while(x(e)!==0&&x(e)!==23)o=C(e);let s=e.source.slice(i.start,o.end).trim();r=Ut(s,i,o,e)}let n=mn(e,!0);return{type:"Rule",prelude:r,block:n,loc:R(e,t,v(e))}}function mn(e,t=!1){let r=v(e);if(x(e)!==23)return{type:"Block",children:te(),loc:no(e)};e.pos++;let n=te(),{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(hn(e,a));continue}if(s===3){let a=zt(e);if(a)n.appendData(a);continue}if(t&&Tu(e,Nu)){let a=gn(e);n.appendData(a);continue}let c=pn(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:R(e,r,v(e))}}function Tu(e,t){let r=e.pos,n=t(e);return e.pos=r,n}function Nu(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 Ou(e){let t=v(e),r=te();while(x(e)!==0&&x(e)!==24){let n=v(e);if(n.type===13){e.pos++;continue}if(n.type===25){r.appendData(hn(e,C(e)));continue}if(n.type===17){e.pos++;continue}if(n.type===3){let o=zt(e);if(o)r.appendData(o);continue}let i=pn(e);if(i)r.appendData(i);if(x(e)===17)C(e)}return{type:"DeclarationList",children:r,loc:R(e,t,v(e))}}function pn(e){de(e);let t=v(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{dn(e,"Expected property name",t,{type:"Raw",value:"",loc:null});let{types:S,end:j}=e;while(e.pos<j){let q=S[e.pos];if(q===0||q===17||q===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(Ji(e),x(e)!==16){dn(e,`Expected ':' after property "${i}"`,v(e),{type:"Raw",value:"",loc:null});let{types:S,end:j}=e;while(e.pos<j){let q=S[e.pos];if(q===0||q===17||q===24)break;e.pos++}return null}e.pos++,Ji(e);let{types:o,starts:s,end:c,pos:a}=e,l=a,u=a,f=-1,d=-1;while(l<c){let S=o[l];if(S===0||S===17||S===24)break;if(S===9&&e.source.charCodeAt(s[l])===33){let j=l+1;while(j<c&&o[j]===13)j++;if(j<c&&o[j]===1){let q=s[j];if(e.ends[j]-q===9&&(e.source.charCodeAt(q)|32)===105&&(e.source.charCodeAt(q+1)|32)===109&&(e.source.charCodeAt(q+2)|32)===112&&(e.source.charCodeAt(q+3)|32)===111&&(e.source.charCodeAt(q+4)|32)===114&&(e.source.charCodeAt(q+5)|32)===116&&(e.source.charCodeAt(q+6)|32)===97&&(e.source.charCodeAt(q+7)|32)===110&&(e.source.charCodeAt(q+8)|32)===116){d=l,f=j,l=j+1;continue}}}if(S!==13&&S!==25)u=l+1;l++}let h=u,m=f>=0?{type:1,start:s[f],end:e.ends[f]}:null,g=i.startsWith("--"),p,y=s[a],b=h>a?e.ends[h-1]:y,w={type:o[a],start:y,end:e.ends[a]},T=h>a?{type:o[h-1],start:s[h-1],end:b}:w;if(g&&!e.parseCustomProperty||!e.parseValue)p={type:"Raw",value:e.source.slice(y,b).trim(),loc:R(e,w,T)};else if(h===a)p={type:"Value",children:te(),loc:R(e,w,T)};else{let S=e.end;e.end=h,e.pos=a,p=io(e),e.end=S}return e.pos=l,{type:"Declaration",property:i,important:m?!0:!1,value:p,loc:R(e,t,v(e))}}function Iu(e){return io(e)}function io(e){let t=v(e),r=te();while(x(e)!==0&&x(e)!==17&&x(e)!==24&&x(e)!==22&&x(e)!==20){let n=ze(e);if(n)r.appendData(n)}return so(r),{type:"Value",children:r,loc:R(e,t,v(e))}}function oo(e){for(let t of e)if("children"in t&&t.children instanceof le)oo(t.children);so(e)}function so(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 ze(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:ee(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?ee(e,n,i):null};case 10:return e.pos++,{type:"Number",value:o.slice(n,i),loc:e.positions?ee(e,n,i):null};case 11:return e.pos++,{type:"Percentage",value:o.slice(n,i-1),loc:e.positions?ee(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?ee(e,n,i):null}}case 1:return e.pos++,{type:"Identifier",name:fn(o,n,i),loc:e.positions?ee(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:un(o,s,a),loc:e.positions?ee(e,n,i):null}}case 7:{e.pos++;let s=n+4;while(s<i&&eo(o.charCodeAt(s)))s++;let c=i;if(c>s&&o.charCodeAt(c-1)===41)c--;while(c>s&&eo(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?ee(e,n,i):null}}case 4:return e.pos++,{type:"Hash",name:o.slice(n+1,i),loc:e.positions?ee(e,n,i):null};case 2:return _u(e);case 21:return Lu(e);case 18:return e.pos++,{type:"Operator",value:",",loc:e.positions?ee(e,n,i):null};case 16:return e.pos++,{type:"Operator",value:":",loc:e.positions?ee(e,n,i):null};case 9:{e.pos++;let s=o.charCodeAt(n),c=o[n];if(Pu(s))return{type:"Operator",value:c,loc:e.positions?ee(e,n,i):null};return{type:"Identifier",name:c,loc:e.positions?ee(e,n,i):null}}case 19:{e.pos++;let s=te();while(x(e)!==0&&x(e)!==20){let a=ze(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?ee(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?ee(e,n,i):null}}return e.pos++,null}function eo(e){return e===32||e===9||e===10||e===12||e===13}function Pu(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 Vt(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 ee(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 _u(e){let t=C(e),r=Vt(e.source,t.start,t.end-1),n=te();while(x(e)!==0&&x(e)!==22){let i=ze(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:R(e,t,v(e))}}return{type:"Function",name:r,children:n,loc:R(e,t,v(e))}}function Lu(e){let t=C(e),r=te();while(x(e)!==0&&x(e)!==22){let n=ze(e);if(n)r.appendData(n)}if(x(e)===22)C(e);return{type:"Parentheses",children:r,loc:R(e,t,v(e))}}function yn(e){let t=v(e),r=te();while(x(e)!==0){if(de(e),x(e)===0||x(e)===23)break;let n=ao(e);if(n.children.head!==null)r.appendData(n);if(de(e),x(e)===18){C(e);continue}break}return{type:"SelectorList",children:r,loc:R(e,t,v(e))}}function ao(e){let t=v(e),r=te(),n=!0;while(x(e)!==0&&x(e)!==18&&x(e)!==23){let i=v(e);if(i.type===13){if(C(e),!n&&x(e)!==0&&x(e)!==18&&x(e)!==23&&!to(e)&&!Mu(e)){let s={type:"Combinator",name:" ",loc:R(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=v(e);C(e);let c=C(e),a={type:"Combinator",name:"||",loc:R(e,s,c)};r.appendData(a),n=!0,de(e);continue}if(to(e)){let s=C(e),a={type:"Combinator",name:e.source[s.start],loc:R(e,s,s)};r.appendData(a),n=!0,de(e);continue}let o=Fu(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:R(e,t,v(e))}}function to(e){let t=v(e);if(t.type!==9)return!1;let r=e.source[t.start];return r===">"||r==="+"||r==="~"}function Mu(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 Fu(e){let t=v(e);switch(t.type){case 1:{if(C(e),x(e)===9&&e.source[v(e).start]==="|"&&e.source[v(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:`${xe(e,t)}|${xe(e,n)}`,loc:R(e,t,n)}}if(x(e)===9&&e.source[v(e).start]==="*"){let n=C(e);return{type:"TypeSelector",name:`${xe(e,t)}|*`,loc:R(e,t,n)}}}return{type:"TypeSelector",name:xe(e,t),loc:R(e,t,t)}}case 11:return C(e),{type:"TypeSelector",name:xe(e,t),loc:R(e,t,t)};case 10:return C(e),{type:"TypeSelector",name:xe(e,t),loc:R(e,t,t)};case 9:{let r=e.source[t.start];if(r==="*")return C(e),{type:"TypeSelector",name:"*",loc:R(e,t,t)};if(r==="."){if(C(e),x(e)===1){let n=C(e);return{type:"ClassSelector",name:xe(e,n),loc:R(e,t,n)}}return null}if(r==="&")return C(e),{type:"NestingSelector",loc:R(e,t,t)};return C(e),null}case 4:return C(e),{type:"IdSelector",name:e.source.slice(t.start+1,t.end),loc:R(e,t,t)};case 16:{C(e);let r=x(e)===16;if(r)C(e);return Du(e,r,t)}case 19:return ju(e)}return null}function Du(e,t,r){let n=v(e);if(n.type===1){C(e);let i=Vt(e.source,n.start,n.end);return t?{type:"PseudoElementSelector",name:i,children:null,loc:R(e,r,n)}:{type:"PseudoClassSelector",name:i,children:null,loc:R(e,r,n)}}if(n.type===2){C(e);let i=Vt(e.source,n.start,n.end-1),o=te();if(!t&&Su.has(i)){let a=v(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=ro(f,{positions:!1}),h=yn(d);o.appendData(h)}}else{while(x(e)!==0&&x(e)!==22){let a=ze(e);if(a)o.appendData(a)}if(x(e)===22)C(e)}if(t)return{type:"PseudoElementSelector",name:i,children:o,loc:R(e,r,v(e))};return{type:"PseudoClassSelector",name:i,children:o,loc:R(e,r,v(e))}}return null}function ju(e){let t=C(e);de(e);let r=v(e);if(r.type!==1)return null;C(e);let n={type:"Identifier",name:xe(e,r),loc:R(e,r,r)};de(e);let i=null,o=null,s=null,c=v(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=v(e);if(h.type===9&&e.source[h.start]==="=")C(e),i=`${l}=`}de(e);let f=v(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:un(e.source,f.start+1,h?f.end-1:f.end),loc:R(e,f,f)}}else if(f.type===1)C(e),o={type:"Identifier",name:xe(e,f),loc:R(e,f,f)};de(e);let d=v(e);if(d.type===1)C(e),s=xe(e,d)}de(e);let a=v(e);if(x(e)===20)a=C(e);return{type:"AttributeSelector",name:n,matcher:i,value:o,flags:s,loc:R(e,t,a)}}var lo=Symbol("walkSkip"),U=Symbol("walkStop");function Bu(e){return{root:e,stylesheet:null,atrule:null,atrulePrelude:null,rule:null,selector:null,block:null,declaration:null,function:null}}function Uu(e,t){let r=Bu(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===lo){if(f)r[f]=d;return}if(m===U){if(f)r[f]=d;return U}}if(h=Vu(a,s,c),h===U){if(f)r[f]=d;return U}if((o===null||o===a.type)&&i){if(i.call(r,a,l,u)===U){if(f)r[f]=d;return U}}if(f)r[f]=d;return}return c(e,null,null)}var Ke=Object.assign(Uu,{skip:lo,stop:U});function Vu(e,t,r){if("children"in e&&e.children instanceof le)return Wu(e.children,t,r);if(e.type==="Rule"){if(r(e.prelude,null,null)===U)return U;if(r(e.block,null,null)===U)return U;return}if(e.type==="Atrule"){if(e.prelude){if(r(e.prelude,null,null)===U)return U}if(e.block){if(r(e.block,null,null)===U)return U}return}if(e.type==="Declaration")return r(e.value,null,null);if(e.type==="AttributeSelector"){if(r(e.name,null,null)===U)return U;if(e.value)return r(e.value,null,null);return}return}function Wu(e,t,r){let n;if(t)e.forEachRight((i,o,s)=>{if(n)return;if(r(i,o,s)===U)n=U});else e.forEach((i,o,s)=>{if(n)return;if(r(i,o,s)===U)n=U});return n}function et(e,t={}){let r=t.exclamation??!1,n=!1;Ke(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 Kt(e){Ke(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 zu={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"},Ku={"#f00":"red","#ff0000":"red","#000080":"navy","#008080":"teal"};function xn(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 co(e){let t=e.toLowerCase();return zu[t]??null}function uo(e){let t=e.toLowerCase();return Ku[t]??null}function Hu(e,t,r){let n=(e<<16|t<<8|r).toString(16).padStart(6,"0");return xn(`#${n}`)}var Gu=/^rgba?\(\s*([+-]?\d*\.?\d+%?)\s*[,\s]\s*([+-]?\d*\.?\d+%?)\s*[,\s]\s*([+-]?\d*\.?\d+%?)\s*(?:[,/]\s*([+-]?\d*\.?\d+%?)\s*)?\)$/;function fo(e){let t=Gu.exec(e.trim());if(!t)return e;let r=bn(t[1]),n=bn(t[2]),i=bn(t[3]);if(t[4]!==void 0&&!qu(t[4]))return e;return Hu(r,n,i)}function qu(e){if(e.endsWith("%"))return Number.parseFloat(e)>=100;return Number.parseFloat(e)>=1}function bn(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 Yu=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 Ht(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 ho(e,t){let r=Ht(e);if((r==="0"||r==="-0")&&Yu.has(t.toLowerCase()))return{value:"0",unit:""};return{value:r,unit:t}}function go(e){return Ht(e)}function mo(e,t){let r=Number.parseFloat(e);if(!Number.isFinite(r))return e;let n=t<0?0:t;return r.toFixed(n)}var po=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 yo(e){if(!e||e.type!=="Operator")return!1;let t=e.value;return t===":"||t===","||t==="/"}function Ju(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&&yo(r.prev.data),o=n&&yo(n.data);if(i||o)t.remove(r)}r=n}}function vn(e,t={}){let r=t.floatPrecision??null,n=r===null?null:(i)=>mo(i,r);Ke(e,{enter(i,o,s){switch(i.type){case"Number":{let c=n?n(i.value):i.value;i.value=Ht(c);return}case"Percentage":{let c=n?n(i.value):i.value;i.value=go(c);return}case"Dimension":{let c=n?n(i.value):i.value,a=ho(c,i.unit);i.value=a.value,i.unit=a.unit;return}case"Hash":{let c=xn(`#${i.name}`).slice(1);if(i.name=c,o&&s&&this.declaration&&po.has(this.declaration.property.toLowerCase())){let a=uo(`#${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(!po.has(this.declaration.property.toLowerCase()))return;let c=co(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")Ju(i);if(i.type==="Function"&&i.__rgbReplaceCandidate&&o&&s){let c=Q(i),a=fo(c);if(a!==c&&a.startsWith("#")){let l={type:"Hash",name:a.slice(1),loc:i.loc};s.replace(o,s.createItem(l))}}}})}function Xu(e,t={}){let r=Wt(e,{context:"stylesheet"});return bo(r,t)}function wn(e,t={}){let r=Wt(e,{context:"declarationList"});return bo(r,t)}function bo(e,t){if(t.comments===!1)et(e,{exclamation:!1});else if(t.comments==="first-exclamation")et(e,{exclamation:"first-exclamation"});else et(e,{exclamation:!0});return vn(e,{floatPrecision:t.floatPrecision??null}),Kt(e),{css:Q(e),ast:e}}function Le(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 xo=new Map,_e=new Map;var $n={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"},ef=/[%#()]/,tf=/^\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)$/,So=["calc","min","max","clamp","mod","rem","sin","cos","tan","asin","acos","atan","atan2","pow","sqrt","hypot","log","exp","round"],rf=new Set(So);function se(e){return ef.test(e)||tf.test(e)}function vo(e){if(!So.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(rf.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 Gt(e){if(!e.includes("_"))return vo(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 vo(t)}function wo(e,t){if(t.length!==2)return null;let[r,n]=t;if(r!=="min"&&r!=="max")return null;return[se(n)?`${r}-${e}-[${n}]`:`${r}-${e}-${n}`]}var nf={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(se(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(se(r))return`w-[${r}]`;return`w-${r}`},multiValue:(e)=>wo("w",e)},h:{expand:(e,t)=>{let r=t[e]||e;if(se(r))return`h-[${r}]`;return`h-${r}`},multiValue:(e)=>wo("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(se(r))return`inset-[${r}]`;return`inset-${r}`}},top:{expand:(e)=>se(e)?`top-[${e}]`:`top-${e}`},right:{expand:(e)=>se(e)?`right-[${e}]`:`right-${e}`},bottom:{expand:(e)=>se(e)?`bottom-[${e}]`:`bottom-${e}`},left:{expand:(e)=>se(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)=>se(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)=>se(e)?`backdrop-hue-rotate-[${e}]`:`backdrop-hue-rotate-${e}`},animate:{expand:(e)=>`animate-${e}`},"forced-colors":{expand:(e)=>`forced-colors-${e}`}},kt=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","only-of-type","checked","indeterminate","default","required","valid","invalid","in-range","out-of-range","placeholder-shown","autofill","read-only","user-valid","user-invalid","inert","empty","before","after","selection","marker","file","first-letter","first-line","backdrop","details-content","print","motion-safe","motion-reduce","pointer-none","pointer-coarse","pointer-fine","any-pointer-none","any-pointer-coarse","any-pointer-fine","inverted-colors","noscript","starting","contrast-more","contrast-less","rtl","ltr","portrait","landscape","@sm","@md","@lg","@xl","@2xl"]),$o=new WeakMap,Co=new WeakMap;function of(e){if(!e)return $n;let t=$o.get(e);if(!t)t=e.aliases?{...$n,...e.aliases}:$n,$o.set(e,t);return t}function sf(e){if(!e?.aliases)return"";let t=Co.get(e);if(t===void 0)t=JSON.stringify(e.aliases),Co.set(e,t);return t}function St(e){let t=[],r="",n=0;for(let i=0;i<e.length;i++){let o=e[i];if(o==="[")n++;else if(o==="]")n--;if(o===":"&&n===0)t.push(r),r="";else r+=o}return t.push(r),t}function af(e,t){let r=`${e}:${t?.colonSyntax}:${sf(t)}`,n=_e.get(r);if(n)return n;let i=of(t);if(t?.colonSyntax===!0){let g=e.match(/^([a-z][a-z0-9-]*):([^[\]:]+)$/i);if(g){let[,p,y]=g;if(!kt.has(p)){if(se(y)){let w=[`${p}-[${y}]`];return Le(_e,r,w),w}let b=y.startsWith("-")?[`-${p}-${y.slice(1)}`]:[`${p}-${y}`];return Le(_e,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)=>kt.has(y)))o=a[1],s=a[2]}let l=s.match(/^([a-z][a-z0-9-]*)\[([^\]]*)\]$/i);if(!l||s.includes("-[")){let g=[e];return Le(_e,r,g),g}let[,u,f]=l,d=f.split(/\s+/).filter(Boolean);if(d.length===0)return Le(_e,r,[]),[];let h=nf[u.toLowerCase()];if(h?.multiValue){let g=h.multiValue(d,i);if(g){let p=g.map((y)=>`${o}${c?"-":""}${y}`);return Le(_e,r,p),p}}if(!h){let g=[];for(let p of d){let y=p.match(/^([a-z@][a-z0-9-]*):(.+)$/i),b="",w=p;if(y&&kt.has(y[1]))b=`${y[1]}:`,w=y[2];let T="";if(w.startsWith("-"))T="-",w=w.slice(1);let S="";if(w.endsWith("!"))S="!",w=w.slice(0,-1);let j=c?"-":"";if(se(w))g.push(`${o}${b}${S}${j}${T}${u}-[${w}]`);else g.push(`${o}${b}${S}${j}${T}${u}-${w}`)}return Le(_e,r,g),g}let m=[];for(let g of d){let p=g.match(/^([a-z@][a-z0-9-]*):(.+)$/i),y="",b=g;if(p&&kt.has(p[1]))y=`${p[1]}:`,b=p[2];let w="";if(b.startsWith("-"))w="-",b=b.slice(1);let T="";if(b.endsWith("!"))T="!",b=b.slice(0,-1);let S=h.expand(b,i);if(S){let j=c?"-":"";m.push(`${o}${y}${T}${j}${w}${S}`)}}return Le(_e,r,m),m}function lf(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="",g=d,p=d.match(/^((?:[a-z@][a-z0-9-]*:)+)([a-z][a-z0-9-]*)$/i);if(p){if(p[1].slice(0,-1).split(":").every((w)=>kt.has(w)))m=p[1],g=p[2]}if(h!==void 0){let y=h.split(/\s+/).filter(Boolean);for(let b of y){let w=`${m}${g}-${b}`;if(Ro(w.replace(/^(?:[a-z@][a-z0-9-]*:)+/gi,"")))r.add(w)}}else{let y=`${m}${g}`;if(Ro(g))r.add(y)}}}return r}function Ro(e){if(!e||e.length===0)return!1;return/^[a-z][a-z0-9-/]*(?:-\[[^\]]+\])?$/i.test(e)}function Cn(e){let t=xo.get(e);if(t)return t;let r=hf(e);return r.base=df(r),Le(xo,e,r),r}var cf=new Set(["bg","text","border","ring","placeholder","divide","accent","caret","fill","stroke","outline","decoration","shadow","ring-offset","from","via","to"]),uf=/^(.+?)\/(\d+|\[\d*\.?\d+\])$/,ff=/^(\d+)\/(\d+)$/;function ko(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 df(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 hf(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 h=St(r),m=h[h.length-1],g=!1;if(m.charCodeAt(0)===33&&m.length>1)g=!0,m=m.slice(1);let p=m.match(/^\[([a-z-]+):(.+)\]$/);if(p)return{raw:e,variants:h.slice(0,-1),utility:p[1],value:Gt(p[2]),important:t||g,arbitrary:!0}}let n=r.match(/^((?:[a-z-]+:)*)(-?[a-z-]+?)-\[([^\]]+)\]\/\[([^\]]+)\]$/);if(n){let[,h,m,g,p]=n,y=h?h.split(":").filter(Boolean):[],b=m.startsWith("-"),w=b?m.slice(1):m,T=Gt(g);if(b)T=T.startsWith("-")?T:`-${T}`;return{raw:e,variants:y,utility:w,value:`${T}/${p}`,important:t,arbitrary:!0,modifierArbitrary:!0}}let i=r.match(/^((?:[a-z-]+:)*)(-?[a-z-]+?)-\[(.+)\]$/);if(i){let h=i[1],m=h?h.split(":").filter(Boolean):[],g=i[2],p=g.startsWith("-");if(p)g=g.slice(1);let y=Gt(i[3]),b,w=y.match(/^(color|length|url|number|percentage|position|line-width|absolute-size|relative-size|image|angle|time|flex|string|family-name):(.*)/i);if(w)b=w[1].toLowerCase(),y=w[2];if(p)y=y.startsWith("-")?y:`-${y}`;return{raw:e,variants:m,utility:g,value:y,important:t,arbitrary:!0,typeHint:b}}let o=St(r),s=o[o.length-1],c=o.slice(0,-1);if(s.startsWith("!")&&s.length>1)t=!0,s=s.slice(1);else if(s.endsWith("!")&&s.length>1)t=!0,s=s.slice(0,-1);if(c.length>0)r=`${c.join(":")}:${s}`;else r=s;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(s))return{raw:e,variants:c,utility:s,value:void 0,important:t,arbitrary:!1};let l=s.match(/^([a-z-]+?)-\[(.+?)\]$/);if(l){let h=Gt(l[2]),m,g=h.match(/^(color|length|url|number|percentage|position|line-width|absolute-size|relative-size|image|angle|time|flex|string|family-name):(.*)/i);if(g)m=g[1].toLowerCase(),h=g[2];return{raw:e,variants:c,utility:l[1],value:h,important:t,arbitrary:!0,typeHint:m}}let u=["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(s==="divide-x"||s==="divide-y")return{raw:e,variants:c,utility:s,value:void 0,important:t,arbitrary:!1};let f=s.match(/^(divide-[xy])-(.+)$/);if(f)return{raw:e,variants:c,utility:f[1],value:f[2],important:t,arbitrary:!1};for(let h of u)if(s.startsWith(`${h}-`))return{raw:e,variants:c,utility:h,value:s.slice(h.length+1),important:t,arbitrary:!1};if(s.startsWith("-")){let h=s.slice(1);for(let g of u)if(h.startsWith(`${g}-`))return{raw:e,variants:c,utility:g,value:`-${h.slice(g.length+1)}`,important:t,arbitrary:!1};let m=ko(h);if(m)return{raw:e,variants:c,utility:m[0],value:`-${m[1]}`,important:t,arbitrary:!1};return{raw:e,variants:c,utility:h,value:void 0,important:t,arbitrary:!1}}let d=ko(s);if(d){let[h,m]=d,g=m.match(uf);if(g&&cf.has(h))return{raw:e,variants:c,utility:h,value:`${g[1]}/${g[2]}`,important:t,arbitrary:!1};let p=m.match(ff);if(p)return{raw:e,variants:c,utility:h,value:`${p[1]}/${p[2]}`,important:t,arbitrary:!1};return{raw:e,variants:c,utility:h,value:m,important:t,arbitrary:!1}}return{raw:e,variants:c,utility:s,value:void 0,important:t,arbitrary:!1}}function gf(e){return/^\[[a-z-]+:[^\]]+\]$/i.test(e)}function mf(e){if(!e)return!1;if(e==="*"||e==="**")return!0;if(e.startsWith("[")&&e.endsWith("]"))return e.length>2;return/^(?:@[a-z0-9]|[a-z])[a-z0-9.-]*(?:\[[^\]]+\])?(?:\/[\w-]+)?$/i.test(e)}function pf(e,t){let r=e;if(r.startsWith("!"))r=r.slice(1);if(r.endsWith("!"))r=r.slice(0,-1);if(!r)return!1;if(gf(r))return!0;if(t?.enabled&&/^[a-z]+\[[^\]]+\]$/i.test(r))return!0;return/^[-@]?[a-z][a-z0-9.-]*(?:-\[[^\]]+\])?(?:\/(?:[\w.]+|[\w-]+|\[[^\]]+\]))?$/i.test(r)}function Ao(e,t){if(!e||e.length===0)return!1;if(t?.colonSyntax&&/^[a-z]+:[^[\]:]+$/i.test(e))return!0;let r=e;if(r.startsWith("!"))r=r.slice(1);if(r.endsWith("!"))r=r.slice(0,-1);if(!r)return!1;let n=St(r);for(let i=0;i<n.length-1;i++)if(!mf(n[i]))return!1;return pf(n[n.length-1],t)}function Yt(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=Yt(d);for(let m of h)qt(r,m,t)}let l=c.replace(/["'`]/g," ").replace(/\$\{[^}]+\}/g," "),u=Yt(l).filter((f)=>Ao(f,t?.bracketSyntax));for(let f of u)qt(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 Yt(l))qt(r,u,t)}}}if(t?.codeStrings?.enabled!==!1)for(let o of Eo(e,t?.bracketSyntax))qt(r,o,t);if(t?.attributify?.enabled){let o=lf(e,t.attributify);for(let s of o)r.add(s)}return r}function yf(e,t){if(!/[-:/[]/.test(e))return!1;if(e.startsWith("-")&&!/^-[a-z]/i.test(e))return!1;return Ao(e,t)}function Eo(e,t){let r=new Set,n=e.length,i=0,o=/[<>]/g,s=o.exec(e),c=-1,a=-1,l="";while(i<n){let u=e[i];if(u==="/"&&e[i+1]==="/"){let p=e.indexOf(`
|
|
92
|
+
`,i);i=p===-1?n:p;continue}if(u==="/"&&e[i+1]==="*"){let p=e.indexOf("*/",i+2);i=p===-1?n:p+2;continue}if(u==="/"&&(!/[\w$)\]]/.test(l)||xf(e,i))){let p=vf(e,i);if(p!==-1){i=p,l=")";continue}}if(u!=='"'&&u!=="'"&&u!=="`"){if(!/\s/.test(u))l=u;i++;continue}l=")";while(s&&s.index<i){if(s[0]==="<")c=s.index;else a=s.index;s=o.exec(e)}let f=$f(e,i,c,a),d=u==="`",h=i+1,m="",g=!1;while(h<n){let p=e[h];if(p==="\\"){m+=e[h+1]??"",h+=2;continue}if(p===u){g=!0,h++;break}if(!d&&p===`
|
|
93
|
+
`)break;if(d&&p==="$"&&e[h+1]==="{"){let y=1;h+=2;let b=h;while(h<n&&y>0){if(e[h]==="{")y++;else if(e[h]==="}")y--;h++}for(let w of Eo(e.slice(b,h-1),t))r.add(w);m+=" ";continue}m+=p,h++}if(g){if(f){for(let p of m.match(wf)??[])r.add(p);i=h;continue}for(let p of Yt(m))if(yf(p,t))r.add(p);i=h}else i++}return r}var bf=new Set(["return","typeof","case","in","of","delete","void","throw","new","else","do","yield","await","instanceof"]);function xf(e,t){let r=t;while(r>0&&/\s/.test(e[r-1]))r--;let n=r;while(n>0&&/[\w$]/.test(e[n-1]))n--;if(n===r||!bf.has(e.slice(n,r)))return!1;let i=n;while(i>0&&/\s/.test(e[i-1]))i--;return e[i-1]!=="."}function vf(e,t){let r=!1;for(let n=t+1;n<e.length;n++){let i=e[n];if(i===`
|
|
94
|
+
`)return-1;if(i==="\\"){n++;continue}if(i==="[")r=!0;else if(i==="]")r=!1;else if(i==="/"&&!r){let o=n+1;while(o<e.length&&/[a-z]/i.test(e[o]))o++;return o}}return-1}var wf=/(?<![\w-])i-[a-z0-9]+(?:-[a-z0-9]+)+(?![\w-])/gi;function $f(e,t,r,n){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 qt(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=af(t,r.bracketSyntax);for(let s of o)e.add(s);return}}e.add(t)}var Xt={getCSS:()=>`
|
|
95
95
|
/*
|
|
96
96
|
! Tailwind CSS Preflight | MIT License | https://tailwindcss.com
|
|
97
97
|
*/
|
|
@@ -354,7 +354,7 @@ video {
|
|
|
354
354
|
[hidden] {
|
|
355
355
|
display: none;
|
|
356
356
|
}
|
|
357
|
-
`.trim()};var dt={content:["./src/**/*.{html,js,ts,jsx,tsx,stx}"],output:"./dist/styles.css",minify:!0,watch:!1,theme:{colors:{inherit:"inherit",current:"currentColor",transparent:"transparent",black:"#000",white:"#fff",slate:{50:"oklch(98.4% 0.003 247.858)",100:"oklch(96.8% 0.007 247.896)",200:"oklch(92.9% 0.013 255.508)",300:"oklch(86.9% 0.022 252.894)",400:"oklch(70.4% 0.04 256.788)",500:"oklch(55.4% 0.046 257.417)",600:"oklch(44.6% 0.043 257.281)",700:"oklch(37.2% 0.044 257.287)",800:"oklch(27.9% 0.041 260.031)",900:"oklch(20.8% 0.042 265.755)",950:"oklch(12.9% 0.042 264.695)"},gray:{50:"oklch(98.5% 0.002 247.839)",100:"oklch(96.7% 0.003 264.542)",200:"oklch(92.8% 0.006 264.531)",300:"oklch(87.2% 0.01 258.338)",400:"oklch(70.7% 0.022 261.325)",500:"oklch(55.1% 0.027 264.364)",600:"oklch(44.6% 0.03 256.802)",700:"oklch(37.3% 0.034 259.733)",800:"oklch(27.8% 0.033 256.848)",900:"oklch(21% 0.034 264.665)",950:"oklch(13% 0.028 261.692)"},zinc:{50:"oklch(98.5% 0 0)",100:"oklch(96.7% 0.001 286.375)",200:"oklch(92% 0.004 286.32)",300:"oklch(87.1% 0.006 286.286)",400:"oklch(70.5% 0.015 286.067)",500:"oklch(55.2% 0.016 285.938)",600:"oklch(44.2% 0.017 285.786)",700:"oklch(37% 0.013 285.805)",800:"oklch(27.4% 0.006 286.033)",900:"oklch(21% 0.006 285.885)",950:"oklch(14.1% 0.005 285.823)"},neutral:{50:"oklch(98.5% 0 0)",100:"oklch(97% 0 0)",200:"oklch(92.2% 0 0)",300:"oklch(87% 0 0)",400:"oklch(70.8% 0 0)",500:"oklch(55.6% 0 0)",600:"oklch(43.9% 0 0)",700:"oklch(37.1% 0 0)",800:"oklch(26.9% 0 0)",900:"oklch(20.5% 0 0)",950:"oklch(14.5% 0 0)"},stone:{50:"oklch(98.5% 0.001 106.423)",100:"oklch(97% 0.001 106.424)",200:"oklch(92.3% 0.003 48.717)",300:"oklch(86.9% 0.005 56.366)",400:"oklch(70.9% 0.01 56.259)",500:"oklch(55.3% 0.013 58.071)",600:"oklch(44.4% 0.011 73.639)",700:"oklch(37.4% 0.01 67.558)",800:"oklch(26.8% 0.007 34.298)",900:"oklch(21.6% 0.006 56.043)",950:"oklch(14.7% 0.004 49.25)"},red:{50:"oklch(97.1% 0.013 17.38)",100:"oklch(93.6% 0.032 17.717)",200:"oklch(88.5% 0.062 18.334)",300:"oklch(80.8% 0.114 19.571)",400:"oklch(70.4% 0.191 22.216)",500:"oklch(63.7% 0.237 25.331)",600:"oklch(57.7% 0.245 27.325)",700:"oklch(50.5% 0.213 27.518)",800:"oklch(44.4% 0.177 26.899)",900:"oklch(39.6% 0.141 25.723)",950:"oklch(25.8% 0.092 26.042)"},orange:{50:"oklch(98% 0.016 73.684)",100:"oklch(95.4% 0.038 75.164)",200:"oklch(90.1% 0.076 70.697)",300:"oklch(83.7% 0.128 66.29)",400:"oklch(75% 0.183 55.934)",500:"oklch(70.5% 0.213 47.604)",600:"oklch(64.6% 0.222 41.116)",700:"oklch(55.3% 0.195 38.402)",800:"oklch(47% 0.157 37.304)",900:"oklch(40.8% 0.123 38.172)",950:"oklch(26.6% 0.079 36.259)"},amber:{50:"oklch(98.7% 0.022 95.277)",100:"oklch(96.2% 0.059 95.617)",200:"oklch(92.4% 0.12 95.746)",300:"oklch(87.9% 0.169 91.605)",400:"oklch(82.8% 0.189 84.429)",500:"oklch(76.9% 0.188 70.08)",600:"oklch(66.6% 0.179 58.318)",700:"oklch(55.5% 0.163 48.998)",800:"oklch(47.3% 0.137 46.201)",900:"oklch(41.4% 0.112 45.904)",950:"oklch(27.9% 0.077 45.635)"},yellow:{50:"oklch(98.7% 0.026 102.212)",100:"oklch(97.3% 0.071 103.193)",200:"oklch(94.5% 0.129 101.54)",300:"oklch(90.5% 0.182 98.111)",400:"oklch(85.2% 0.199 91.936)",500:"oklch(79.5% 0.184 86.047)",600:"oklch(68.1% 0.162 75.834)",700:"oklch(55.4% 0.135 66.442)",800:"oklch(47.6% 0.114 61.907)",900:"oklch(42.1% 0.095 57.708)",950:"oklch(28.6% 0.066 53.813)"},lime:{50:"oklch(98.6% 0.031 120.757)",100:"oklch(96.7% 0.067 122.328)",200:"oklch(93.8% 0.127 124.321)",300:"oklch(89.7% 0.196 126.665)",400:"oklch(84.1% 0.238 128.85)",500:"oklch(76.8% 0.233 130.85)",600:"oklch(64.8% 0.2 131.684)",700:"oklch(53.2% 0.157 131.589)",800:"oklch(45.3% 0.124 130.933)",900:"oklch(40.5% 0.101 131.063)",950:"oklch(27.4% 0.072 132.109)"},green:{50:"oklch(98.2% 0.018 155.826)",100:"oklch(96.2% 0.044 156.743)",200:"oklch(92.5% 0.084 155.995)",300:"oklch(87.1% 0.15 154.449)",400:"oklch(79.2% 0.209 151.711)",500:"oklch(72.3% 0.219 149.579)",600:"oklch(62.7% 0.194 149.214)",700:"oklch(52.7% 0.154 150.069)",800:"oklch(44.8% 0.119 151.328)",900:"oklch(39.3% 0.095 152.535)",950:"oklch(26.6% 0.065 152.934)"},emerald:{50:"oklch(97.9% 0.021 166.113)",100:"oklch(95% 0.052 163.051)",200:"oklch(90.5% 0.093 164.15)",300:"oklch(84.5% 0.143 164.978)",400:"oklch(76.5% 0.177 163.223)",500:"oklch(69.6% 0.17 162.48)",600:"oklch(59.6% 0.145 163.225)",700:"oklch(50.8% 0.118 165.612)",800:"oklch(43.2% 0.095 166.913)",900:"oklch(37.8% 0.077 168.94)",950:"oklch(26.2% 0.051 172.552)"},teal:{50:"oklch(98.4% 0.014 180.72)",100:"oklch(95.3% 0.051 180.801)",200:"oklch(91% 0.096 180.426)",300:"oklch(85.5% 0.138 181.071)",400:"oklch(77.7% 0.152 181.912)",500:"oklch(70.4% 0.14 182.503)",600:"oklch(60% 0.118 184.704)",700:"oklch(51.1% 0.096 186.391)",800:"oklch(43.7% 0.078 188.216)",900:"oklch(38.6% 0.063 188.416)",950:"oklch(27.7% 0.046 192.524)"},cyan:{50:"oklch(98.4% 0.019 200.873)",100:"oklch(95.6% 0.045 203.388)",200:"oklch(91.7% 0.08 205.041)",300:"oklch(86.5% 0.127 207.078)",400:"oklch(78.9% 0.154 211.53)",500:"oklch(71.5% 0.143 215.221)",600:"oklch(60.9% 0.126 221.723)",700:"oklch(52% 0.105 223.128)",800:"oklch(45% 0.085 224.283)",900:"oklch(39.8% 0.07 227.392)",950:"oklch(30.2% 0.056 229.695)"},sky:{50:"oklch(97.7% 0.013 236.62)",100:"oklch(95.1% 0.026 236.824)",200:"oklch(90.1% 0.058 230.902)",300:"oklch(82.8% 0.111 230.318)",400:"oklch(74.6% 0.16 232.661)",500:"oklch(68.5% 0.169 237.323)",600:"oklch(58.8% 0.158 241.966)",700:"oklch(50% 0.134 242.749)",800:"oklch(44.3% 0.11 240.79)",900:"oklch(39.1% 0.09 240.876)",950:"oklch(29.3% 0.066 243.157)"},blue:{50:"oklch(97% 0.014 254.604)",100:"oklch(93.2% 0.032 255.585)",200:"oklch(88.2% 0.059 254.128)",300:"oklch(80.9% 0.105 251.813)",400:"oklch(70.7% 0.165 254.624)",500:"oklch(62.3% 0.214 259.815)",600:"oklch(54.6% 0.245 262.881)",700:"oklch(48.8% 0.243 264.376)",800:"oklch(42.4% 0.199 265.638)",900:"oklch(37.9% 0.146 265.522)",950:"oklch(28.2% 0.091 267.935)"},indigo:{50:"oklch(96.2% 0.018 272.314)",100:"oklch(93% 0.034 272.788)",200:"oklch(87% 0.065 274.039)",300:"oklch(78.5% 0.115 274.713)",400:"oklch(67.3% 0.182 276.935)",500:"oklch(58.5% 0.233 277.117)",600:"oklch(51.1% 0.262 276.966)",700:"oklch(45.7% 0.24 277.023)",800:"oklch(39.8% 0.195 277.366)",900:"oklch(35.9% 0.144 278.697)",950:"oklch(25.7% 0.09 281.288)"},violet:{50:"oklch(96.9% 0.016 293.756)",100:"oklch(94.3% 0.029 294.588)",200:"oklch(89.4% 0.057 293.283)",300:"oklch(81.1% 0.111 293.571)",400:"oklch(70.2% 0.183 293.541)",500:"oklch(60.6% 0.25 292.717)",600:"oklch(54.1% 0.281 293.009)",700:"oklch(49.1% 0.27 292.581)",800:"oklch(43.2% 0.232 292.759)",900:"oklch(38% 0.189 293.745)",950:"oklch(28.3% 0.141 291.089)"},purple:{50:"oklch(97.7% 0.014 308.299)",100:"oklch(94.6% 0.033 307.174)",200:"oklch(90.2% 0.063 306.703)",300:"oklch(82.7% 0.119 306.383)",400:"oklch(71.4% 0.203 305.504)",500:"oklch(62.7% 0.265 303.9)",600:"oklch(55.8% 0.288 302.321)",700:"oklch(49.6% 0.265 301.924)",800:"oklch(43.8% 0.218 303.724)",900:"oklch(38.1% 0.176 304.987)",950:"oklch(29.1% 0.149 302.717)"},fuchsia:{50:"oklch(97.7% 0.017 320.058)",100:"oklch(95.2% 0.037 318.852)",200:"oklch(90.3% 0.076 319.62)",300:"oklch(83.3% 0.145 321.434)",400:"oklch(74% 0.238 322.16)",500:"oklch(66.7% 0.295 322.15)",600:"oklch(59.1% 0.293 322.896)",700:"oklch(51.8% 0.253 323.949)",800:"oklch(45.2% 0.211 324.591)",900:"oklch(40.1% 0.17 325.612)",950:"oklch(29.3% 0.136 325.661)"},pink:{50:"oklch(97.1% 0.014 343.198)",100:"oklch(94.8% 0.028 342.258)",200:"oklch(89.9% 0.061 343.231)",300:"oklch(82.3% 0.12 346.018)",400:"oklch(71.8% 0.202 349.761)",500:"oklch(65.6% 0.241 354.308)",600:"oklch(59.2% 0.249 0.584)",700:"oklch(52.5% 0.223 3.958)",800:"oklch(45.9% 0.187 3.815)",900:"oklch(40.8% 0.153 2.432)",950:"oklch(28.4% 0.109 3.907)"},rose:{50:"oklch(96.9% 0.015 12.422)",100:"oklch(94.1% 0.03 12.58)",200:"oklch(89.2% 0.058 10.001)",300:"oklch(81% 0.117 11.638)",400:"oklch(71.2% 0.194 13.428)",500:"oklch(64.5% 0.246 16.439)",600:"oklch(58.6% 0.253 17.585)",700:"oklch(51.4% 0.222 16.935)",800:"oklch(45.5% 0.188 13.697)",900:"oklch(41% 0.159 10.272)",950:"oklch(27.1% 0.105 12.094)"}},spacing:{0:"0",px:"1px",0.5:"0.125rem",1:"0.25rem",1.5:"0.375rem",2:"0.5rem",2.5:"0.625rem",3:"0.75rem",3.5:"0.875rem",4:"1rem",5:"1.25rem",6:"1.5rem",7:"1.75rem",8:"2rem",9:"2.25rem",10:"2.5rem",11:"2.75rem",12:"3rem",14:"3.5rem",16:"4rem",20:"5rem",24:"6rem",28:"7rem",32:"8rem",36:"9rem",40:"10rem",44:"11rem",48:"12rem",52:"13rem",56:"14rem",60:"15rem",64:"16rem",72:"18rem",80:"20rem",96:"24rem"},fontSize:{xs:["0.75rem",{lineHeight:"1rem"}],sm:["0.875rem",{lineHeight:"1.25rem"}],base:["1rem",{lineHeight:"1.5rem"}],lg:["1.125rem",{lineHeight:"1.75rem"}],xl:["1.25rem",{lineHeight:"1.75rem"}],"2xl":["1.5rem",{lineHeight:"2rem"}],"3xl":["1.875rem",{lineHeight:"2.25rem"}],"4xl":["2.25rem",{lineHeight:"2.5rem"}],"5xl":["3rem",{lineHeight:"1"}],"6xl":["3.75rem",{lineHeight:"1"}],"7xl":["4.5rem",{lineHeight:"1"}],"8xl":["6rem",{lineHeight:"1"}],"9xl":["8rem",{lineHeight:"1"}]},fontFamily:{sans:["ui-sans-serif","system-ui","sans-serif"],serif:["ui-serif","Georgia","serif"],mono:["ui-monospace","monospace"]},screens:{sm:"640px",md:"768px",lg:"1024px",xl:"1280px","2xl":"1536px"},containers:{"3xs":"16rem","2xs":"18rem",xs:"20rem",sm:"24rem",md:"28rem",lg:"32rem",xl:"36rem","2xl":"42rem","3xl":"48rem","4xl":"56rem","5xl":"64rem","6xl":"72rem","7xl":"80rem"},borderRadius:{none:"0",xs:"0.125rem",sm:"0.25rem",DEFAULT:"0.25rem",md:"0.375rem",lg:"0.5rem",xl:"0.75rem","2xl":"1rem","3xl":"1.5rem","4xl":"2rem",full:"9999px"},boxShadow:{"2xs":"0 1px rgb(0 0 0 / 0.05)",xs:"0 1px 2px 0 rgb(0 0 0 / 0.05)",sm:"0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1)",DEFAULT:"0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1)",md:"0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1)",lg:"0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1)",xl:"0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1)","2xl":"0 25px 50px -12px rgb(0 0 0 / 0.25)",inner:"inset 0 2px 4px 0 rgb(0 0 0 / 0.05)",none:"none"}},shortcuts:{},rules:[],attributify:{enabled:!1,prefix:"tc-",ignoreAttributes:["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"]},bracketSyntax:{enabled:!1,colonSyntax:!1,aliases:{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"}},variants:{responsive:!0,hover:!0,focus:!0,active:!0,disabled:!0,dark:!0,light:!0,group:!0,peer:!0,"*":!0,"**":!0,in:!0,before:!0,after:!0,marker:!0,"first-letter":!0,"first-line":!0,backdrop:!0,"details-content":!0,first:!0,last:!0,odd:!0,even:!0,"first-of-type":!0,"last-of-type":!0,visited:!0,checked:!0,"focus-within":!0,"focus-visible":!0,placeholder:!0,selection:!0,file:!0,required:!0,valid:!0,invalid:!0,"read-only":!0,autofill:!0,"user-valid":!0,"user-invalid":!0,"in-range":!0,"out-of-range":!0,"placeholder-shown":!0,open:!0,closed:!0,empty:!0,enabled:!0,only:!0,target:!0,indeterminate:!0,default:!0,optional:!0,inert:!0,"only-of-type":!0,aria:!0,data:!0,has:!0,not:!0,supports:!0,print:!0,landscape:!0,portrait:!0,"forced-colors":!0,"pointer-none":!0,"pointer-coarse":!0,"pointer-fine":!0,"any-pointer-none":!0,"any-pointer-coarse":!0,"any-pointer-fine":!0,"inverted-colors":!0,noscript:!0,starting:!0,rtl:!0,ltr:!0,"motion-safe":!0,"motion-reduce":!0,"contrast-more":!0,"contrast-less":!0},safelist:[],blocklist:[],preflights:[Yt],presets:[],cssVariables:!1},li=null;async function Qs(){if(!li){await Promise.resolve().then(() => Zs());li=await Xs({name:"css",defaultConfig:dt})}return li}var ci=dt;function Oe(e){if(e.indexOf("/")===-1)return-1;let r=0,n=0,i="";for(let o=0;o<e.length;o++){let s=e[o];if(s==="\\"){o++;continue}if(i){if(s===i)i="";continue}if(s==='"'||s==="'"){i=s;continue}if(s==="(")r++;else if(s===")")r=Math.max(0,r-1);else if(s==="[")n++;else if(s==="]")n=Math.max(0,n-1);else if(s==="/"&&r===0&&n===0)return o}return-1}var Ir="0 0 #0000",Oh=["inset-shadow","inset-ring-shadow","ring-offset-shadow","ring-shadow","shadow"],U=Oh.map((e)=>`var(--tc-${e}, 0 0 #0000)`).join(", ");var Pr={"0":"0",full:"100%",min:"min-content",max:"max-content",fit:"fit-content",none:"none",xs:"20rem",sm:"24rem",md:"28rem",lg:"32rem",xl:"36rem","2xl":"42rem","3xl":"48rem","4xl":"56rem","5xl":"64rem","6xl":"72rem","7xl":"80rem",screen:"100vw"},Ih={...Pr,prose:"65ch"};function ra(e,t,r){let n=e.value;if(t[n])return{[r]:t[n]};if(e.arbitrary)return{[r]:n};if(/^\d+$/.test(n)){let i=Number.parseInt(n,10);if(i>=0&&i<=100)return{[r]:`${i/100}`}}return}var Ph=(e,t)=>{if(e.utility==="min-w"&&e.value){let r=pe(e,t,Pr);return r!==void 0?{"min-width":r}:void 0}if(e.utility==="max-w"&&e.value){let r=pe(e,t,Ih);return r!==void 0?{"max-width":r}:void 0}if(e.utility==="min-h"&&e.value){let r={...Pr,screen:"100vh"},n=pe(e,t,r);return n!==void 0?{"min-height":n}:void 0}if(e.utility==="max-h"&&e.value){let r={...Pr,screen:"100vh"},n=pe(e,t,r);return n!==void 0?{"max-height":n}:void 0}},_h=(e,t)=>{if(e.utility==="ring"){if(e.value==="inset")return{"--tc-ring-inset":"inset"};if(e.value){let i=z(e.value,t,e.modifierArbitrary);if(i)return{"--tc-ring-color":i}}let r={0:"0",1:"1px",2:"2px",4:"4px",8:"8px",DEFAULT:"1px"},n;if(!e.value)n=r.DEFAULT;else if(r[e.value])n=r[e.value];else if(e.arbitrary)n=e.value;else if(/^\d+(?:\.\d+)?$/.test(e.value))n=`${e.value}px`;if(n===void 0)return;return{"--tc-ring-offset-shadow":"var(--tc-ring-inset,) 0 0 0 var(--tc-ring-offset-width, 0px) var(--tc-ring-offset-color, #fff)","--tc-ring-shadow":`var(--tc-ring-inset,) 0 0 0 calc(${n} + var(--tc-ring-offset-width, 0px)) var(--tc-ring-color, currentcolor)`,"box-shadow":U}}if(e.utility==="ring-offset"&&e.value){let r={0:"0px",1:"1px",2:"2px",4:"4px",8:"8px"};if(r[e.value])return{"--tc-ring-offset-width":r[e.value]};let n=z(e.value,t,e.modifierArbitrary);if(n)return{"--tc-ring-offset-color":n}}if(e.utility==="ring-opacity"&&e.value)return ra(e,{0:"0",5:"0.05",10:"0.1",20:"0.2",25:"0.25",30:"0.3",40:"0.4",50:"0.5",60:"0.6",70:"0.7",75:"0.75",80:"0.8",90:"0.9",95:"0.95",100:"1"},"--tc-ring-opacity")},Lh=(e)=>{if(e.utility==="border-opacity"&&e.value)return ra(e,{0:"0",5:"0.05",10:"0.1",20:"0.2",25:"0.25",30:"0.3",40:"0.4",50:"0.5",60:"0.6",70:"0.7",75:"0.75",80:"0.8",90:"0.9",95:"0.95",100:"1"},"--tc-border-opacity")};function ea(e,t){let r=e.value;if(e.arbitrary)return r;let n=r.startsWith("-"),i=n?r.slice(1):r,o=t.theme.spacing[i];if(o===void 0&&/^\d+(?:\.\d+)?$/.test(i))o=`${Number.parseFloat(i)*0.25}rem`;if(o===void 0)return;return n?`-${o}`:o}var Mh=(e,t)=>{if(e.utility==="space-x"&&e.value){if(e.value==="reverse")return{properties:{"--tc-space-x-reverse":"1"},childSelector:"> :not([hidden]) ~ :not([hidden])"};let r=ea(e,t);if(r===void 0)return;return{properties:{"--tc-space-x-reverse":"0","margin-right":`calc(${r} * var(--tc-space-x-reverse))`,"margin-left":`calc(${r} * calc(1 - var(--tc-space-x-reverse)))`},childSelector:"> :not([hidden]) ~ :not([hidden])"}}if(e.utility==="space-y"&&e.value){if(e.value==="reverse")return{properties:{"--tc-space-y-reverse":"1"},childSelector:"> :not([hidden]) ~ :not([hidden])"};let r=ea(e,t);if(r===void 0)return;return{properties:{"--tc-space-y-reverse":"0","margin-top":`calc(${r} * calc(1 - var(--tc-space-y-reverse)))`,"margin-bottom":`calc(${r} * var(--tc-space-y-reverse))`},childSelector:"> :not([hidden]) ~ :not([hidden])"}}},Fh=(e)=>{if(e.utility==="border"&&e.value){let t={solid:"solid",dashed:"dashed",dotted:"dotted",double:"double",hidden:"hidden",none:"none"};if(t[e.value])return{"border-style":t[e.value]}}};function ta(e){if(!e.value)return"1px";let t={0:"0",2:"2px",4:"4px",8:"8px"};if(t[e.value])return t[e.value];if(e.arbitrary)return e.value;if(/^\d+(?:\.\d+)?$/.test(e.value))return`${e.value}px`;return}function Dh(e){let t=Oe(e),r=t===-1?e:e.slice(0,t);if(r.charCodeAt(0)!==91||r.charCodeAt(r.length-1)!==93)return e;let n=r.slice(1,-1).replace(/_/g," ");return t===-1?n:n+e.slice(t)}var jh=(e,t)=>{if(e.utility==="divide"&&e.value){let r={solid:"solid",dashed:"dashed",dotted:"dotted",double:"double",none:"none"};if(r[e.value])return{properties:{"border-style":r[e.value]},childSelector:"> :not([hidden]) ~ :not([hidden])"}}if(e.utility==="divide-x"){if(e.value==="reverse")return{properties:{"--tc-divide-x-reverse":"1"},childSelector:"> :not([hidden]) ~ :not([hidden])"};let r=ta(e);if(r===void 0)return;return{properties:{"--tc-divide-x-reverse":"0","border-right-width":`calc(${r} * var(--tc-divide-x-reverse))`,"border-left-width":`calc(${r} * calc(1 - var(--tc-divide-x-reverse)))`},childSelector:"> :not([hidden]) ~ :not([hidden])"}}if(e.utility==="divide-y"){if(e.value==="reverse")return{properties:{"--tc-divide-y-reverse":"1"},childSelector:"> :not([hidden]) ~ :not([hidden])"};let r=ta(e);if(r===void 0)return;return{properties:{"--tc-divide-y-reverse":"0","border-top-width":`calc(${r} * calc(1 - var(--tc-divide-y-reverse)))`,"border-bottom-width":`calc(${r} * var(--tc-divide-y-reverse))`},childSelector:"> :not([hidden]) ~ :not([hidden])"}}if(e.utility==="divide"&&e.value){let r=Dh(e.value);if(r==="auto")return;let n=z(r,t,e.modifierArbitrary);if(n!==void 0)return{properties:{"border-color":n},childSelector:"> :not([hidden]) ~ :not([hidden])"}}},Bh=(e,t)=>{let r=(n)=>{let i=null,o=n,s=Oe(n);if(s!==-1){o=n.slice(0,s);let u=n.slice(s+1);if(u.startsWith("[")&&u.endsWith("]"))i=u.slice(1,-1);else if(e.modifierArbitrary){let f=Number.parseFloat(u);if(!Number.isNaN(f)&&f>=0&&f<=1)i=f.toString()}else{let f=Number.parseInt(u,10);if(!Number.isNaN(f))i=(f/100).toString()}}let c=(u)=>{if(!i)return u;let f=u.match(/^(oklch|rgb|hsl|oklab|lab|lch)\(([^)]+)\)$/i);if(f){let d=f[1],h=f[2].split("/")[0].trim();return`${d}(${h} / ${i})`}if(/^#[0-9a-f]{3,8}$/i.test(u)){let d=u.replace("#",""),h=(y)=>Number.parseInt(y.length===1?y+y:y,16),m=h(d.slice(0,d.length===3?1:2)),g=h(d.slice(d.length===3?1:2,d.length===3?2:4)),p=h(d.slice(d.length===3?2:4,d.length===3?3:6));return`rgb(${m} ${g} ${p} / ${i})`}return`color-mix(in srgb, ${u} ${Math.round(Number.parseFloat(i)*100)}%, transparent)`};if(o.startsWith("[")&&o.endsWith("]"))o=o.slice(1,-1);let a=t.theme.colors[o];if(typeof a==="string")return c(W(o,a,o,t.colorVariables));if(typeof a==="object"&&a!==null&&typeof a.DEFAULT==="string")return c(W(o,a.DEFAULT,o,t.colorVariables));let l=o.split("-");if(l.length>=2){let u=l.slice(0,-1).join("-"),f=l[l.length-1],d=t.theme.colors[u];if(typeof d==="object"&&d[f])return c(W(o,d[f],u,t.colorVariables))}if(e.arbitrary||o.startsWith("#")||/^(?:var|rgb|rgba|hsl|hsla|oklch|oklab|lab|lch|color|color-mix)\(/.test(o))return c(o);return};if(e.utility==="from"&&e.value){let n=r(e.value);if(n===void 0)return;return{"--tc-gradient-from":n,"--tc-gradient-to":"rgb(255 255 255 / 0)","--tc-gradient-stops":"var(--tc-gradient-from), var(--tc-gradient-to)"}}if(e.utility==="via"&&e.value){let n=r(e.value);if(n===void 0)return;return{"--tc-gradient-to":"rgb(255 255 255 / 0)","--tc-gradient-stops":`var(--tc-gradient-from), ${n}, var(--tc-gradient-to)`}}if(e.utility==="to"&&e.value){let n=r(e.value);if(n===void 0)return;return{"--tc-gradient-to":n,"--tc-gradient-stops":"var(--tc-gradient-from), var(--tc-gradient-to)"}}},Vh=(e)=>{if(e.utility==="order"&&e.value){let t={first:"-9999",last:"9999",none:"0"};if(t[e.value])return{order:t[e.value]};if(e.arbitrary||/^-?\d+$/.test(e.value))return{order:e.value};return}},Uh=(e,t)=>{if(e.utility==="basis"&&e.value){let r={auto:"auto",full:"100%",0:"0"};if(r[e.value])return{"flex-basis":r[e.value]};let n=pe(e,t,{});return n!==void 0?{"flex-basis":n}:void 0}},Wh=(e)=>{if(e.utility==="justify-self"){let t={auto:"auto",start:"start",end:"end",center:"center",stretch:"stretch"};return e.value&&t[e.value]?{"justify-self":t[e.value]}:void 0}},zh=(e)=>{if(e.utility==="self"){let t={auto:"auto",start:"flex-start",end:"flex-end",center:"center",stretch:"stretch",baseline:"baseline"};return e.value&&t[e.value]?{"align-self":t[e.value]}:void 0}},Kh=(e,t)=>{if(e.utility==="container"){if(!e.value)return{width:"100%","margin-left":"auto","margin-right":"auto","max-width":t.theme.screens.xl||"1280px"};let r={sm:t.theme.screens.sm||"640px",md:t.theme.screens.md||"768px",lg:t.theme.screens.lg||"1024px",xl:t.theme.screens.xl||"1280px","2xl":t.theme.screens["2xl"]||"1536px",full:"100%",prose:"65ch","3xl":"1920px"};if(r[e.value])return{width:"100%","margin-left":"auto","margin-right":"auto","max-width":r[e.value]};if(e.arbitrary)return{width:"100%","margin-left":"auto","margin-right":"auto","max-width":e.value}}},ui=(e)=>{if(e.arbitrary&&e.utility&&e.value&&e.base.startsWith("["))return{[e.utility]:e.value}},na=[Ph,_h,Lh,Fh,Mh,jh,Bh,Vh,Uh,Wh,zh,Kh,ui];var ia={"bg-origin-border":"border-box","bg-origin-padding":"padding-box","bg-origin-content":"content-box"},oa={"bg-bottom":"bottom","bg-center":"center","bg-left":"left","bg-left-bottom":"left bottom","bg-left-top":"left top","bg-right":"right","bg-right-bottom":"right bottom","bg-right-top":"right top","bg-top":"top"},sa={"bg-repeat":"repeat","bg-no-repeat":"no-repeat","bg-repeat-x":"repeat-x","bg-repeat-y":"repeat-y","bg-repeat-round":"round","bg-repeat-space":"space"},aa={"bg-auto":"auto","bg-cover":"cover","bg-contain":"contain"},fi=null,la=null;function Hh(e){let t=new Map;for(let[r,n]of Object.entries(e))if(typeof n==="string")t.set(r,n);else if(typeof n==="object"&&n!==null){for(let[i,o]of Object.entries(n))if(typeof o==="string")t.set(i==="DEFAULT"?r:`${r}-${i}`,o)}return t}function Gh(e){return e.replace(/rgba?\([^)]+\)/g,"var(--tc-shadow-color)")}var qh=(e)=>{if(e.utility==="bg"&&e.value){let t={fixed:"fixed",local:"local",scroll:"scroll"};return t[e.value]?{"background-attachment":t[e.value]}:void 0}return},Yh=(e)=>{if(e.utility==="bg"&&e.value&&e.value.startsWith("clip-")){let t=e.value.replace("clip-",""),r={border:"border-box",padding:"padding-box",content:"content-box",text:"text"};return r[t]?{"background-clip":r[t]}:void 0}return},ca={t:"to top",tr:"to top right",r:"to right",br:"to bottom right",b:"to bottom",bl:"to bottom left",l:"to left",tl:"to top left"},Jh=new Set(["srgb","srgb-linear","oklab","oklch","lab","lch","hsl","hwb","xyz","xyz-d50","xyz-d65","display-p3","a98-rgb","prophoto-rgb","rec2020"]),Xh=new Set(["shorter","longer","increasing","decreasing"]);function Zh(e){if(Jh.has(e))return`in ${e}`;if(Xh.has(e))return`in oklch ${e} hue`;return}var Qh=(e)=>{if(e.utility!=="bg"||!e.value||e.arbitrary||e.typeHint)return;if(e.value.includes("("))return;let t=e.value.lastIndexOf("/"),r=t===-1?e.value:e.value.slice(0,t),n=t===-1?void 0:e.value.slice(t+1),i;if(n!==void 0){if(i=Zh(n),i===void 0)return}let o=r.charCodeAt(0)===45,s=o?r.slice(1):r,c,a="";if(s==="conic")c="conic-gradient";else if(s==="radial")c="radial-gradient";else if(s.startsWith("conic-")){let u=s.slice(6);if(!/^\d+(?:\.\d+)?$/.test(u))return;c="conic-gradient",a=`from ${o?"-":""}${u}deg`}else if(s.startsWith("linear-")||s.startsWith("gradient-")){let u=s.slice(s.indexOf("-")+1);if(c="linear-gradient",u.startsWith("to-")){let f=ca[u.slice(3)];if(f===void 0)return;a=f}else if(/^\d+(?:\.\d+)?$/.test(u))a=`${o?"-":""}${u}deg`;else return}else return;if(!a&&i===void 0)return;let l=[a,i].filter(Boolean).join(" ");return{"background-image":l?`${c}(${l}, var(--tc-gradient-stops))`:`${c}(var(--tc-gradient-stops))`}},eg=(e)=>{if(!e.value)return;let t;if(e.utility==="bg-linear"||e.utility==="bg-gradient")t=e.value;else if(e.utility==="bg"){if(e.typeHint||e.value.includes("("))return;let r=e.value.startsWith("-"),i=(r?e.value.slice(1):e.value).match(/^(?:gradient|linear)-(.+)$/);if(!i)return;t=r?`-${i[1]}`:i[1]}else return;if(t.startsWith("to-")){let r=ca[t.slice(3)];return r?{"background-image":`linear-gradient(${r}, var(--tc-gradient-stops))`}:void 0}if(e.arbitrary)return{"background-image":`linear-gradient(${t}, var(--tc-gradient-stops))`};if(/^-?\d+(?:\.\d+)?$/.test(t))return{"background-image":`linear-gradient(${t}deg, var(--tc-gradient-stops))`};return},tg=(e)=>ia[e.base]?{"background-origin":ia[e.base]}:void 0,rg=(e)=>oa[e.base]?{"background-position":oa[e.base]}:void 0,ng=(e)=>sa[e.base]?{"background-repeat":sa[e.base]}:void 0,ig=(e)=>aa[e.base]?{"background-size":aa[e.base]}:void 0,og=(e)=>{if(e.utility==="border"&&e.value){let t={solid:"solid",dashed:"dashed",dotted:"dotted",double:"double",hidden:"hidden",none:"none"};return t[e.value]?{"border-style":t[e.value]}:void 0}return},sg=(e,t)=>{if(e.utility==="outline-offset"&&e.value){let r={0:"0px",1:"1px",2:"2px",4:"4px",8:"8px"};if(r[e.value])return{"outline-offset":r[e.value]};if(e.arbitrary)return{"outline-offset":e.value};if(/^\d+(?:\.\d+)?$/.test(e.value))return{"outline-offset":`${e.value}px`};return}if(e.utility==="outline"&&e.value){let r={none:"none",solid:"solid",dashed:"dashed",dotted:"dotted",double:"double"};if(r[e.value])return{"outline-style":r[e.value]};if(e.value==="hidden")return{outline:"2px solid transparent","outline-offset":"2px"}}if(e.utility==="outline"){if(!e.value)return{"outline-width":"1px"};let r=z(e.value,t,e.modifierArbitrary);if(r)return{"outline-color":r};let n={0:"0px",1:"1px",2:"2px",4:"4px",8:"8px"};if(n[e.value])return{"outline-width":n[e.value]};if(e.arbitrary)return{"outline-width":e.value};if(/^\d+(?:\.\d+)?$/.test(e.value))return{"outline-width":`${e.value}px`};return}},ag=(e,t)=>{if(e.utility==="shadow"){let n=e.arbitrary&&!!e.value&&(/\s/.test(e.value)||e.value==="none")?e.value:e.value?t.theme.boxShadow[e.value]:t.theme.boxShadow.DEFAULT;if(!n)return;if(n==="none")return{"--tc-shadow":Ir,"box-shadow":U};let i=Gh(n);return{"--tc-shadow":n,"--tc-shadow-colored":i,"box-shadow":U}}},lg=(e,t)=>{if(e.utility!=="shadow"||!e.value)return;if(t.theme.boxShadow[e.value])return;if(e.arbitrary&&/\s/.test(e.value))return;if(fi===null||la!==t.theme.colors)fi=Hh(t.theme.colors),la=t.theme.colors;let r=e.value,n=Oe(r),i,o;if(n!==-1){i=r.slice(0,n);let a=r.slice(n+1);if(a.charCodeAt(0)===91&&a.charCodeAt(a.length-1)===93){let l=Number.parseFloat(a.slice(1,-1));if(Number.isNaN(l)||l<0||l>1)return;o=l}else if(e.modifierArbitrary){let l=Number.parseFloat(a);if(Number.isNaN(l)||l<0||l>1)return;o=l}else{let l=Number.parseInt(a,10);if(Number.isNaN(l)||l<0||l>100)return;o=l/100}}else i=r;let s=fi.get(i)??(e.arbitrary?i:void 0);if(!s)return;return{"--tc-shadow-color":o!==void 0?we(s,o):s,"--tc-shadow":"var(--tc-shadow-colored)"}};function Pt(e){return`${e} var(--tc-text-shadow-color, rgba(0, 0, 0, 0.05))`}var cg=(e,t)=>{if(e.utility!=="text-shadow")return;let r={sm:Pt("0 1px 2px"),DEFAULT:Pt("0 1px 3px"),md:Pt("0 4px 6px"),lg:Pt("0 10px 15px"),xl:Pt("0 20px 25px"),none:"none"};if(!e.value)return{"text-shadow":r.DEFAULT};if(r[e.value])return{"text-shadow":r[e.value]};if(e.arbitrary&&e.value){if(/\s/.test(e.value))return{"text-shadow":e.value};return{"--tc-text-shadow-color":e.value}}let n=z(e.value,t,e.modifierArbitrary);return n===void 0?void 0:{"--tc-text-shadow-color":n}},ug=(e)=>{if(e.utility==="opacity"&&e.value){let t={0:"0",5:"0.05",10:"0.1",20:"0.2",25:"0.25",30:"0.3",40:"0.4",50:"0.5",60:"0.6",70:"0.7",75:"0.75",80:"0.8",90:"0.9",95:"0.95",100:"1"};if(t[e.value])return{opacity:t[e.value]};if(e.arbitrary)return{opacity:e.value};if(/^\d+$/.test(e.value)){let r=Number.parseInt(e.value,10);if(r>=0&&r<=100)return{opacity:`${r/100}`}}return}},fg=(e)=>{if(e.utility==="mix-blend"){let t=["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"];return e.value&&t.includes(e.value)?{"mix-blend-mode":e.value}:void 0}},dg=(e)=>{if(e.utility==="bg-blend"){let t=["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"];return e.value&&t.includes(e.value)?{"background-blend-mode":e.value}:void 0}},hg=(e)=>{if(e.utility==="mask-clip"&&e.value){let t={border:"border-box",padding:"padding-box",content:"content-box",text:"text",fill:"fill-box",stroke:"stroke-box",view:"view-box","no-clip":"no-clip"};if(t[e.value])return{"mask-clip":t[e.value]};return e.arbitrary?{"mask-clip":e.value}:void 0}if(e.utility==="mask-composite"&&e.value)return["add","subtract","intersect","exclude"].includes(e.value)?{"mask-composite":e.value}:void 0;if(e.utility==="mask-image"&&e.value){if(e.value==="none")return{"mask-image":"none"};if(e.arbitrary)return{"mask-image":e.value.startsWith("url(")||e.value.includes("gradient(")?e.value:`url(${e.value})`};return}if(e.utility==="mask-mode"&&e.value)return["alpha","luminance","match-source"].includes(e.value)?{"mask-mode":e.value}:void 0;if(e.utility==="mask-origin"&&e.value){let t={border:"border-box",padding:"padding-box",content:"content-box",fill:"fill-box",stroke:"stroke-box",view:"view-box"};if(t[e.value])return{"mask-origin":t[e.value]};return e.arbitrary?{"mask-origin":e.value}:void 0}if(e.utility==="mask-position"&&e.value){let t={center:"center",top:"top",right:"right",bottom:"bottom",left:"left","top-left":"top left","top-right":"top right","bottom-left":"bottom left","bottom-right":"bottom right"};if(t[e.value])return{"mask-position":t[e.value]};return e.arbitrary?{"mask-position":e.value}:void 0}if(e.utility==="mask-repeat"&&e.value){let t={repeat:"repeat","no-repeat":"no-repeat","repeat-x":"repeat-x","repeat-y":"repeat-y",round:"round",space:"space"};if(t[e.value])return{"mask-repeat":t[e.value]};return e.arbitrary?{"mask-repeat":e.value}:void 0}if(e.utility==="mask-size"&&e.value){let t={auto:"auto",cover:"cover",contain:"contain"};if(t[e.value])return{"mask-size":t[e.value]};return e.arbitrary?{"mask-size":e.value}:void 0}if(e.utility==="mask-type"&&e.value)return["alpha","luminance"].includes(e.value)?{"mask-type":e.value}:void 0},di=[qh,Yh,Qh,eg,tg,rg,ng,ig,og,sg,ag,lg,cg,ug,fg,dg,hg];var ua={add:"add",subtract:"subtract",intersect:"intersect",exclude:"exclude"},fa={alpha:"alpha",luminance:"luminance",match:"match-source"},da={auto:"auto",cover:"cover",contain:"contain"},ha={center:"center",top:"top",right:"right",bottom:"bottom",left:"left","top-left":"left top","top-right":"right top","bottom-left":"left bottom","bottom-right":"right bottom"},ga={repeat:"repeat","no-repeat":"no-repeat"},gg=(e)=>{if(e.utility!=="mask"||!e.value)return;let t=e.value;if(e.arbitrary)return{"mask-image":t};if(t==="none")return{"mask-image":"none"};if(ua[t]!==void 0)return{"mask-composite":ua[t]};if(fa[t]!==void 0)return{"mask-mode":fa[t]};if(da[t]!==void 0)return{"mask-size":da[t]};if(ha[t]!==void 0)return{"mask-position":ha[t]};if(ga[t]!==void 0)return{"mask-repeat":ga[t]};if(t==="no-clip")return{"mask-clip":"no-clip"};return},mg=(e)=>{if(e.utility!=="mask-repeat"||e.arbitrary)return;if(e.value==="x")return{"mask-repeat":"repeat-x"};if(e.value==="y")return{"mask-repeat":"repeat-y"};return},qe="linear-gradient(#fff, #fff)";function k(e,t){return`var(--tc-mask-${e}, ${t})`}function Ye(){return{"mask-image":`${k("linear",qe)}, ${k("radial",qe)}, ${k("conic",qe)}`,"mask-composite":"intersect"}}var pg=[k("left",qe),k("right",qe),k("bottom",qe),k("top",qe)].join(", "),yg={t:["top"],r:["right"],b:["bottom"],l:["left"],x:["right","left"],y:["top","bottom"]};function bg(e){let t=`${k(`${e}-from-color`,"black")} ${k(`${e}-from-position`,"0%")}`,r=`${k(`${e}-to-color`,"transparent")} ${k(`${e}-to-position`,"100%")}`;return`linear-gradient(to ${e}, ${t}, ${r})`}var xg=[k("linear-position","0deg"),`${k("linear-from-color","black")} ${k("linear-from-position","0%")}`,`${k("linear-to-color","transparent")} ${k("linear-to-position","100%")}`].join(", "),vg=/^(?:var|rgb|rgba|hsl|hsla|oklch|oklab|lab|lch|color|color-mix)\(/;function _r(e,t,r){if(!e)return;if(/^\d+(?:\.\d+)?%$/.test(e))return{position:e};if(/^\d+(?:\.\d+)?$/.test(e)){let i=pe({value:e,arbitrary:!1},r,{});return i===void 0?void 0:{position:i}}if(t)return e.charCodeAt(0)===35||vg.test(e)?{color:e}:{position:e};let n=z(e,r,!1);return n===void 0?void 0:{color:n}}function Lr(e){if(e.startsWith("from-"))return{stop:"from",token:e.slice(5)};if(e.startsWith("to-"))return{stop:"to",token:e.slice(3)};return}var wg=(e,t)=>{if(e.utility!=="mask"||!e.value||e.arbitrary)return;let r=e.value,n=r.charCodeAt(0)===45,i=n?r.slice(1):r;if(!i.startsWith("linear-"))return;let o=i.slice(7);if(/^\d+(?:\.\d+)?$/.test(o))return{...Ye(),"--tc-mask-linear":`linear-gradient(${k("linear-stops",k("linear-position","0deg"))})`,"--tc-mask-linear-position":`calc(1deg * ${n?"-":""}${o})`};if(n)return;let s=Lr(o);if(s===void 0)return;let c=_r(s.token,e.arbitrary,t);if(c===void 0)return;let a={...Ye(),"--tc-mask-linear-stops":xg,"--tc-mask-linear":"linear-gradient(var(--tc-mask-linear-stops))"};if(c.color!==void 0)a[`--tc-mask-linear-${s.stop}-color`]=c.color;else a[`--tc-mask-linear-${s.stop}-position`]=c.position;return a},Cg=(e,t)=>{if(e.utility!=="mask"||!e.value||e.arbitrary)return;let r=e.value,n=r.indexOf("-");if(n===-1)return;let i=yg[r.slice(0,n)];if(i===void 0)return;let o=Lr(r.slice(n+1));if(o===void 0)return;let s=_r(o.token,e.arbitrary,t);if(s===void 0)return;let c={...Ye(),"--tc-mask-linear":pg};for(let a of i)if(c[`--tc-mask-${a}`]=bg(a),s.color!==void 0)c[`--tc-mask-${a}-${o.stop}-color`]=s.color;else c[`--tc-mask-${a}-${o.stop}-position`]=s.position;return c},$g=[`${k("radial-shape","ellipse")} ${k("radial-size","farthest-corner")} at ${k("radial-position","center")}`,`${k("radial-from-color","black")} ${k("radial-from-position","0%")}`,`${k("radial-to-color","transparent")} ${k("radial-to-position","100%")}`].join(", "),Rg=new Set(["closest-side","closest-corner","farthest-side","farthest-corner"]),kg={center:"center",top:"top",right:"right",bottom:"bottom",left:"left","top-left":"top left","top-right":"top right","bottom-left":"bottom left","bottom-right":"bottom right"},Sg=[`from ${k("conic-position","0deg")}`,`${k("conic-from-color","black")} ${k("conic-from-position","0%")}`,`${k("conic-to-color","transparent")} ${k("conic-to-position","100%")}`].join(", "),Ag=(e,t)=>{if(e.utility==="mask-radial"&&e.arbitrary&&e.value)return{...Ye(),"--tc-mask-radial":`radial-gradient(${k("radial-stops",k("radial-size","farthest-corner"))})`,"--tc-mask-radial-size":e.value};if(e.utility!=="mask"||!e.value||e.arbitrary)return;let r=e.value;if(r==="circle"||r==="ellipse")return{"--tc-mask-radial-shape":r};if(!r.startsWith("radial-"))return;let n=r.slice(7);if(n.startsWith("at-")){let c=kg[n.slice(3)];return c===void 0?void 0:{"--tc-mask-radial-position":c}}if(Rg.has(n))return{"--tc-mask-radial-size":n};let i=Lr(n);if(i===void 0)return;let o=_r(i.token,e.arbitrary,t);if(o===void 0)return;let s={...Ye(),"--tc-mask-radial-stops":$g,"--tc-mask-radial":"radial-gradient(var(--tc-mask-radial-stops))"};if(o.color!==void 0)s[`--tc-mask-radial-${i.stop}-color`]=o.color;else s[`--tc-mask-radial-${i.stop}-position`]=o.position;return s},Eg=(e,t)=>{if(e.utility!=="mask"||!e.value||e.arbitrary)return;let r=e.value,n=r.charCodeAt(0)===45,i=n?r.slice(1):r;if(!i.startsWith("conic-"))return;let o=i.slice(6);if(/^\d+(?:\.\d+)?$/.test(o))return{...Ye(),"--tc-mask-conic":`conic-gradient(${k("conic-stops",k("conic-position","0deg"))})`,"--tc-mask-conic-position":`calc(1deg * ${n?"-":""}${o})`};if(n)return;let s=Lr(o);if(s===void 0)return;let c=_r(s.token,e.arbitrary,t);if(c===void 0)return;let a={...Ye(),"--tc-mask-conic-stops":Sg,"--tc-mask-conic":"conic-gradient(var(--tc-mask-conic-stops))"};if(c.color!==void 0)a[`--tc-mask-conic-${s.stop}-color`]=c.color;else a[`--tc-mask-conic-${s.stop}-position`]=c.position;return a},ma=[wg,Cg,Ag,Eg,gg,mg];var Tg={"2xs":"inset 0 1px",xs:"inset 0 1px 1px",sm:"inset 0 2px 4px"},Ng="rgb(0 0 0 / 0.05)",Og=/^(?:var|rgb|rgba|hsl|hsla|oklch|oklab|lab|lch|color|color-mix)\(/;function mi(e){return e.charCodeAt(0)===35||Og.test(e)}function Ig(e){return/^-?[\d.]+[a-z%]*$/i.test(e)||e.startsWith("calc(")||e.startsWith("var(")}function Pg(e,t){let r=e.trim().split(/\s+/),n=r[r.length-1];if(r.length>1&&!Ig(n))return`inset ${r.slice(0,-1).join(" ")} var(${t}, ${n})`;return`inset ${e} var(${t}, currentcolor)`}function hi(e){return{"--tc-inset-shadow":e,"box-shadow":U}}var _g=(e,t)=>{if(e.utility==="inset-shadow"&&e.arbitrary&&e.value){if(!/\s/.test(e.value)&&mi(e.value))return{"--tc-inset-shadow-color":e.value};return hi(Pg(e.value,"--tc-inset-shadow-color"))}if(e.utility!=="inset"||!e.value||e.arbitrary)return;if(!e.value.startsWith("shadow-"))return;let r=e.value.slice(7),n=Tg[r];if(n!==void 0)return hi(`${n} var(--tc-inset-shadow-color, ${Ng})`);if(r==="none")return hi(`inset ${Ir}`);let i=z(r,t,e.modifierArbitrary);return i===void 0?void 0:{"--tc-inset-shadow-color":i}};function gi(e){return{"--tc-inset-ring-shadow":`inset 0 0 0 ${e} var(--tc-inset-ring-color, currentcolor)`,"box-shadow":U}}var Lg=(e,t)=>{if(e.utility==="inset-ring"&&e.arbitrary&&e.value){if(mi(e.value))return{"--tc-inset-ring-color":e.value};return gi(e.value)}if(e.utility!=="inset"||!e.value||e.arbitrary)return;if(e.value!=="ring"&&!e.value.startsWith("ring-"))return;if(e.value==="ring")return gi("1px");let r=e.value.slice(5);if(/^\d+(?:\.\d+)?$/.test(r))return gi(`${r}px`);let n=z(r,t,e.modifierArbitrary);return n===void 0?void 0:{"--tc-inset-ring-color":n}},Mg=(e,t)=>{if(e.utility!=="drop-shadow"||!e.value)return;if(e.arbitrary){if(/\s/.test(e.value))return;return mi(e.value)?{"--tc-drop-shadow-color":e.value}:void 0}let r=z(e.value,t,e.modifierArbitrary);return r===void 0?void 0:{"--tc-drop-shadow-color":r}},pa=[_g,Lg,Mg];var Mr={appearance:"none","background-color":"#fff","border-color":"#6b7280","border-width":"1px","border-radius":"0px","padding-top":"0.5rem","padding-right":"0.75rem","padding-bottom":"0.5rem","padding-left":"0.75rem","font-size":"1rem","line-height":"1.5rem"},ya={appearance:"none",padding:"0","print-color-adjust":"exact",display:"inline-block","vertical-align":"middle","background-origin":"border-box","user-select":"none","flex-shrink":"0",height:"1rem",width:"1rem",color:"#2563eb","background-color":"#fff","border-color":"#6b7280","border-width":"1px"};function ht(e,t){return e.utility==="form"&&e.value===t||e.utility===`form-${t}`&&!e.value}var Fg=(e)=>{if(ht(e,"input"))return Mr},Dg=(e)=>{if(ht(e,"textarea"))return Mr},jg=(e)=>{if(ht(e,"select"))return{...Mr,"background-image":`url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e")`,"background-position":"right 0.5rem center","background-repeat":"no-repeat","background-size":"1.5em 1.5em","padding-right":"2.5rem","print-color-adjust":"exact"}},Bg=(e)=>{if(ht(e,"multiselect"))return{...Mr,"background-image":"initial","background-position":"initial","background-repeat":"unset","background-size":"initial","print-color-adjust":"unset"}},Vg=(e)=>{if(ht(e,"checkbox"))return{...ya,"border-radius":"0px"}},Ug=(e)=>{if(ht(e,"radio"))return{...ya,"border-radius":"100%"}},ba=[Fg,Dg,jg,Bg,Vg,Ug];var Wg={gap:"gap","gap-x":"column-gap","gap-y":"row-gap"},gt=/^-?\d+$/,xa=/^span-(\d+)$/,zg=(e)=>{if(e.utility==="grid-cols"&&e.value){if(e.arbitrary)return{"grid-template-columns":e.value};if(e.value==="none"||e.value==="subgrid")return{"grid-template-columns":e.value};if(/^\d+$/.test(e.value))return{"grid-template-columns":`repeat(${e.value}, minmax(0, 1fr))`};return}},Kg=(e)=>{if(e.utility==="col"){if(!e.value)return;if(e.arbitrary)return{"grid-column":e.value};if(e.value==="auto")return{"grid-column":"auto"};if(e.value==="span-full")return{"grid-column":"1 / -1"};let t=e.value.match(xa);if(t)return{"grid-column":`span ${t[1]} / span ${t[1]}`};if(gt.test(e.value))return{"grid-column":e.value};return}if(e.utility==="col-span"&&e.value){if(e.arbitrary)return{"grid-column":`span ${e.value} / span ${e.value}`};if(e.value==="auto")return{"grid-column":"auto"};if(e.value==="full")return{"grid-column":"1 / -1"};if(/^\d+$/.test(e.value))return{"grid-column":`span ${e.value} / span ${e.value}`};return}if(e.utility==="col-start"&&e.value){if(e.arbitrary||e.value==="auto"||gt.test(e.value))return{"grid-column-start":e.value};return}if(e.utility==="col-end"&&e.value){if(e.arbitrary||e.value==="auto"||gt.test(e.value))return{"grid-column-end":e.value};return}},Hg=(e)=>{if(e.utility==="grid-rows"&&e.value){if(e.arbitrary)return{"grid-template-rows":e.value};if(e.value==="none"||e.value==="subgrid")return{"grid-template-rows":e.value};if(/^\d+$/.test(e.value))return{"grid-template-rows":`repeat(${e.value}, minmax(0, 1fr))`};return}},Gg=(e)=>{if(e.utility==="row"){if(!e.value)return;if(e.arbitrary)return{"grid-row":e.value};if(e.value==="auto")return{"grid-row":"auto"};if(e.value==="span-full")return{"grid-row":"1 / -1"};let t=e.value.match(xa);if(t)return{"grid-row":`span ${t[1]} / span ${t[1]}`};if(gt.test(e.value))return{"grid-row":e.value};return}if(e.utility==="row-span"&&e.value){if(e.arbitrary)return{"grid-row":`span ${e.value} / span ${e.value}`};if(e.value==="auto")return{"grid-row":"auto"};if(e.value==="full")return{"grid-row":"1 / -1"};if(/^\d+$/.test(e.value))return{"grid-row":`span ${e.value} / span ${e.value}`};return}if(e.utility==="row-start"&&e.value){if(e.arbitrary||e.value==="auto"||gt.test(e.value))return{"grid-row-start":e.value};return}if(e.utility==="row-end"&&e.value){if(e.arbitrary||e.value==="auto"||gt.test(e.value))return{"grid-row-end":e.value};return}},qg=(e)=>{if(e.utility==="grid-flow"&&e.value){let t={row:"row",col:"column",dense:"dense","row-dense":"row dense","col-dense":"column dense"};return t[e.value]?{"grid-auto-flow":t[e.value]}:void 0}return},Yg=(e)=>{if(e.utility==="auto-cols"&&e.value){let t={auto:"auto",min:"min-content",max:"max-content",fr:"minmax(0, 1fr)"};if(e.arbitrary)return{"grid-auto-columns":e.value};return t[e.value]?{"grid-auto-columns":t[e.value]}:void 0}},Jg=(e)=>{if(e.utility==="auto-rows"&&e.value){let t={auto:"auto",min:"min-content",max:"max-content",fr:"minmax(0, 1fr)"};if(e.arbitrary)return{"grid-auto-rows":e.value};return t[e.value]?{"grid-auto-rows":t[e.value]}:void 0}};function Xg(e,t,r){let n=t.theme.spacing?.[r];if(n!==void 0)return n;if(e.arbitrary)return r;if(/^\d+(?:\.\d+)?$/.test(r)){let i=Number.parseFloat(r);if(Number.isFinite(i))return`${i*0.25}rem`}return}var Zg=(e,t)=>{let r=Wg[e.utility];if(!r||!e.value)return;let n=Xg(e,t,e.value);return n!==void 0?{[r]:n}:void 0},Qg=(e)=>{if(e.utility==="place"&&e.value&&e.value.startsWith("content-")){let t=e.value.replace("content-",""),r={center:"center",start:"start",end:"end",between:"space-between",around:"space-around",evenly:"space-evenly",stretch:"stretch"};return r[t]?{"place-content":r[t]}:void 0}return},em=(e)=>{if(e.utility==="place"&&e.value&&e.value.startsWith("items-")){let t=e.value.replace("items-",""),r={start:"start",end:"end",center:"center",stretch:"stretch"};return r[t]?{"place-items":r[t]}:void 0}return},tm=(e)=>{if(e.utility==="place"&&e.value&&e.value.startsWith("self-")){let t=e.value.replace("self-",""),r={auto:"auto",start:"start",end:"end",center:"center",stretch:"stretch"};return r[t]?{"place-self":r[t]}:void 0}return},va=[zg,Kg,Hg,Gg,qg,Yg,Jg,Zg,Qg,em,tm];import{existsSync as wa,readFileSync as rm,readdirSync as nm}from"fs";import{join as Fr}from"path";var Dr=new Map;function im(e){if(Dr.has(e))return Dr.get(e);let t=[Fr(process.cwd(),"node_modules","@iconify-json",e,"icons.json"),Fr(process.cwd(),"node_modules",".bun","@iconify-json",e,"icons.json")],r=Fr(process.cwd(),"node_modules",".bun");if(wa(r))try{let n=`@iconify-json+${e}@`;for(let i of nm(r))if(i.startsWith(n))t.push(Fr(r,i,"node_modules","@iconify-json",e,"icons.json"))}catch{}for(let n of t)if(wa(n))try{let i=JSON.parse(rm(n,"utf-8"));return Dr.set(e,i),i}catch{}return Dr.set(e,null),null}function om(e,t){let r=e.icons[t];if(r)return r;let n=e.aliases?.[t];if(n)return e.icons[n.parent]??null;return null}function sm(e,t){let r=t.width??e.width??24,n=t.height??e.height??24,i=t.left??0,o=t.top??0;return`<svg xmlns='http://www.w3.org/2000/svg' viewBox='${i} ${o} ${r} ${n}' width='${r}' height='${n}'>${t.body}</svg>`}function am(e){return`url("data:image/svg+xml;utf8,${e.replace(/"/g,"'").replace(/%/g,"%25").replace(/#/g,"%23").replace(/</g,"%3C").replace(/>/g,"%3E").replace(/\?/g,"%3F").replace(/\s+/g," ")}")`}var lm=/^i-([a-z][a-z0-9]*(?:-[a-z0-9]+)*)-(.+)$/;function cm(e){if(!e.startsWith("i-"))return;let t=e.slice(2);for(let r=t.indexOf("-");r!==-1;r=t.indexOf("-",r+1)){let n=t.slice(0,r),i=t.slice(r+1);if(!/^[a-z][a-z0-9-]*$/.test(n))continue;let o=im(n);if(!o)continue;let s=om(o,i);if(s)return{collection:o,icon:s}}return}var Ca=(e,t)=>{if(!lm.test(e.base))return;let r=cm(e.base);if(!r)return;let{collection:n,icon:i}=r,o=am(sm(n,i));return{defaults:!0,properties:{display:"inline-block",width:"1em",height:"1em","background-color":"currentColor","-webkit-mask":`${o} no-repeat`,mask:`${o} no-repeat`,"-webkit-mask-size":"100% 100%","mask-size":"100% 100%","vertical-align":"-0.125em"}}};var $a={"border-collapse":"collapse","border-separate":"separate"},Ra={"caption-top":"top","caption-bottom":"bottom"},ka={"field-sizing-content":"content","field-sizing-fixed":"fixed"},Sa={"cursor-auto":"auto","cursor-default":"default","cursor-pointer":"pointer","cursor-wait":"wait","cursor-text":"text","cursor-move":"move","cursor-help":"help","cursor-not-allowed":"not-allowed","cursor-none":"none","cursor-context-menu":"context-menu","cursor-progress":"progress","cursor-cell":"cell","cursor-crosshair":"crosshair","cursor-vertical-text":"vertical-text","cursor-alias":"alias","cursor-copy":"copy","cursor-no-drop":"no-drop","cursor-grab":"grab","cursor-grabbing":"grabbing","cursor-all-scroll":"all-scroll","cursor-col-resize":"col-resize","cursor-row-resize":"row-resize","cursor-n-resize":"n-resize","cursor-e-resize":"e-resize","cursor-s-resize":"s-resize","cursor-w-resize":"w-resize","cursor-ne-resize":"ne-resize","cursor-nw-resize":"nw-resize","cursor-se-resize":"se-resize","cursor-sw-resize":"sw-resize","cursor-ew-resize":"ew-resize","cursor-ns-resize":"ns-resize","cursor-nesw-resize":"nesw-resize","cursor-nwse-resize":"nwse-resize","cursor-zoom-in":"zoom-in","cursor-zoom-out":"zoom-out"},Aa={"pointer-events-none":"none","pointer-events-auto":"auto"},Ea={"resize-none":"none",resize:"both","resize-y":"vertical","resize-x":"horizontal"},Ta={"scroll-auto":"auto","scroll-smooth":"smooth"},Na={"snap-none":"none","snap-x":"x var(--tc-scroll-snap-strictness, proximity)","snap-y":"y var(--tc-scroll-snap-strictness, proximity)","snap-both":"both var(--tc-scroll-snap-strictness, proximity)"},Oa={"snap-mandatory":"mandatory","snap-proximity":"proximity"},Ia={"snap-start":"start","snap-end":"end","snap-center":"center","snap-align-none":"none"},Pa={"snap-normal":"normal","snap-always":"always"},_a={"touch-auto":"auto","touch-none":"none","touch-pan-x":"pan-x","touch-pan-left":"pan-left","touch-pan-right":"pan-right","touch-pan-y":"pan-y","touch-pan-up":"pan-up","touch-pan-down":"pan-down","touch-pinch-zoom":"pinch-zoom","touch-manipulation":"manipulation"},La={"select-none":"none","select-text":"text","select-all":"all","select-auto":"auto"},Ma={"will-change-auto":"auto","will-change-scroll":"scroll-position","will-change-contents":"contents","will-change-transform":"transform"},Fa={"stroke-linecap-butt":"butt","stroke-linecap-round":"round","stroke-linecap-square":"square"},Da={"stroke-linejoin-miter":"miter","stroke-linejoin-round":"round","stroke-linejoin-bevel":"bevel"},ja={"forced-color-adjust-auto":"auto","forced-color-adjust-none":"none"},pi={none:"0",sm:"4px",DEFAULT:"8px",md:"12px",lg:"16px",xl:"24px","2xl":"40px","3xl":"64px"};function Ua(e){if(e.arbitrary)return e.value;if(/^\d+(?:\.\d+)?$/.test(e.value))return`${Number(e.value)/100}`;return}function Wa(e){if(!e.value)return pi.DEFAULT;if(pi[e.value]!==void 0)return pi[e.value];if(e.arbitrary)return e.value;if(/^\d+(?:\.\d+)?$/.test(e.value))return`${e.value}px`;return}var za=["brightness","contrast","grayscale","invert","saturate","sepia"],um=["blur","brightness","contrast","grayscale","hue-rotate","invert","saturate","sepia","drop-shadow"],fm=["blur","brightness","contrast","grayscale","hue-rotate","invert","opacity","saturate","sepia"],dm=um.map((e)=>`var(--tc-${e}, )`).join(" "),Ba=fm.map((e)=>`var(--tc-backdrop-${e}, )`).join(" ");function Je(e,t){return{[`--tc-${e}`]:t,filter:dm}}function jr(e,t){return{[`--tc-backdrop-${e}`]:t,"-webkit-backdrop-filter":Ba,"backdrop-filter":Ba}}var hm=(e)=>{if(e.base==="filter-none")return{filter:"none"};if(e.utility==="blur"){let t=Wa(e);return t!==void 0?Je("blur",`blur(${t})`):void 0}if(za.includes(e.utility)&&e.value){let t=Ua(e);return t!==void 0?Je(e.utility,`${e.utility}(${t})`):void 0}if(e.utility==="hue-rotate"&&e.value){if(e.arbitrary)return Je("hue-rotate",`hue-rotate(${e.value})`);if(/^-?\d+(?:\.\d+)?$/.test(e.value))return Je("hue-rotate",`hue-rotate(${e.value}deg)`);return}if(e.utility==="drop-shadow"){let t={sm:"drop-shadow(0 1px 1px rgb(0 0 0 / 0.05))",DEFAULT:"drop-shadow(0 1px 2px rgb(0 0 0 / 0.1)) drop-shadow(0 1px 1px rgb(0 0 0 / 0.06))",md:"drop-shadow(0 4px 3px rgb(0 0 0 / 0.07)) drop-shadow(0 2px 2px rgb(0 0 0 / 0.06))",lg:"drop-shadow(0 10px 8px rgb(0 0 0 / 0.04)) drop-shadow(0 4px 3px rgb(0 0 0 / 0.1))",xl:"drop-shadow(0 20px 13px rgb(0 0 0 / 0.03)) drop-shadow(0 8px 5px rgb(0 0 0 / 0.08))","2xl":"drop-shadow(0 25px 25px rgb(0 0 0 / 0.15))",none:"drop-shadow(0 0 #0000)"};if(!e.value)return Je("drop-shadow",t.DEFAULT);if(t[e.value])return Je("drop-shadow",t[e.value]);if(e.arbitrary)return Je("drop-shadow",`drop-shadow(${e.value})`);return}},gm=(e)=>{if(e.base==="backdrop-filter-none")return{"backdrop-filter":"none"};if(e.utility==="backdrop-blur"){let t=Wa(e);return t!==void 0?jr("blur",`blur(${t})`):void 0}if(e.utility.startsWith("backdrop-")&&e.value){let t=e.utility.slice(9);if(za.includes(t)||t==="opacity"){let r=Ua(e);if(r===void 0)return;return jr(t,`${t}(${r})`)}if(t==="hue-rotate"){if(e.arbitrary)return jr(t,`hue-rotate(${e.value})`);if(/^-?\d+(?:\.\d+)?$/.test(e.value))return jr(t,`hue-rotate(${e.value}deg)`);return}}},mm=(e)=>$a[e.base]?{"border-collapse":$a[e.base]}:void 0,pm=(e,t)=>{if(!e.utility.startsWith("border-spacing")||!e.value)return;let r=t.theme.spacing[e.value];if(r===void 0&&e.arbitrary)r=e.value;if(r===void 0&&/^\d+(?:\.\d+)?$/.test(e.value))r=`${Number.parseFloat(e.value)*0.25}rem`;if(r===void 0)return;if(e.utility==="border-spacing")return{"border-spacing":`${r} ${r}`};if(e.utility==="border-spacing-x")return{"border-spacing":`${r} 0`};if(e.utility==="border-spacing-y")return{"border-spacing":`0 ${r}`}},ym=(e)=>{if(e.utility==="table"&&e.value){let t={auto:"auto",fixed:"fixed"};return t[e.value]?{"table-layout":t[e.value]}:void 0}return},bm=(e)=>Ra[e.base]?{"caption-side":Ra[e.base]}:void 0,xm=(e,t)=>{if(e.utility==="accent"&&e.value){let r=z(e.value,t,e.modifierArbitrary);if(r)return{"accent-color":r}}},vm=(e)=>{let t={"appearance-none":"none","appearance-auto":"auto","appearance-base":"base"};return t[e.base]?{appearance:t[e.base]}:void 0},wm=(e,t)=>{if(e.utility==="caret"&&e.value){let r=z(e.value,t,e.modifierArbitrary);if(r)return{"caret-color":r}}},Cm={normal:"normal",light:"light",dark:"dark","light-dark":"light dark","only-dark":"only dark","only-light":"only light"},Va=(e)=>{let t=e.base,r=t.startsWith("scheme-")?t.slice(7):t.startsWith("color-scheme-")?t.slice(13):void 0;if(r===void 0)return;let n=Cm[r];return n?{"color-scheme":n}:void 0},$m=(e)=>ka[e.base]?{"field-sizing":ka[e.base]}:void 0,Rm=(e)=>Sa[e.base]?{cursor:Sa[e.base]}:void 0,km=(e)=>Aa[e.base]?{"pointer-events":Aa[e.base]}:void 0,Sm=(e)=>Ea[e.base]?{resize:Ea[e.base]}:void 0,Am=(e)=>Ta[e.base]?{"scroll-behavior":Ta[e.base]}:void 0,Em=(e,t)=>{let n={"scroll-m":["scroll-margin"],"scroll-mx":["scroll-margin-left","scroll-margin-right"],"scroll-my":["scroll-margin-top","scroll-margin-bottom"],"scroll-mt":["scroll-margin-top"],"scroll-mr":["scroll-margin-right"],"scroll-mb":["scroll-margin-bottom"],"scroll-ml":["scroll-margin-left"]}[e.utility];if(!n||!e.value)return;let i=t.theme.spacing[e.value];if(i===void 0&&e.arbitrary)i=e.value;if(i===void 0&&/^\d+(?:\.\d+)?$/.test(e.value))i=`${Number.parseFloat(e.value)*0.25}rem`;if(i===void 0)return;let o={};for(let s of n)o[s]=i;return o},Tm=(e,t)=>{let n={"scroll-p":["scroll-padding"],"scroll-px":["scroll-padding-left","scroll-padding-right"],"scroll-py":["scroll-padding-top","scroll-padding-bottom"],"scroll-pt":["scroll-padding-top"],"scroll-pr":["scroll-padding-right"],"scroll-pb":["scroll-padding-bottom"],"scroll-pl":["scroll-padding-left"]}[e.utility];if(!n||!e.value)return;let i=t.theme.spacing[e.value];if(i===void 0&&e.arbitrary)i=e.value;if(i===void 0&&/^\d+(?:\.\d+)?$/.test(e.value))i=`${Number.parseFloat(e.value)*0.25}rem`;if(i===void 0)return;let o={};for(let s of n)o[s]=i;return o},Nm=(e)=>{if(Na[e.base])return{"scroll-snap-type":Na[e.base]};if(Oa[e.base])return{"--tc-scroll-snap-strictness":Oa[e.base]};if(Ia[e.base])return{"scroll-snap-align":Ia[e.base]};if(Pa[e.base])return{"scroll-snap-stop":Pa[e.base]}},Om=(e)=>_a[e.base]?{"touch-action":_a[e.base]}:void 0,Im=(e)=>La[e.base]?{"user-select":La[e.base]}:void 0,Pm=(e)=>Ma[e.base]?{"will-change":Ma[e.base]}:void 0,_m=(e,t)=>{if(e.utility==="fill"&&e.value){if(e.value==="none")return{fill:"none"};let r=z(e.value,t,e.modifierArbitrary);if(r)return{fill:r}}},Lm=(e,t)=>{if(e.utility==="stroke"&&e.value){if(e.value==="none")return{stroke:"none"};let r=z(e.value,t,e.modifierArbitrary);if(r)return{stroke:r}}},Mm=(e)=>{if(e.utility==="stroke"&&e.value){if(e.arbitrary||/^\d+(?:\.\d+)?$/.test(e.value))return{"stroke-width":e.value};return}},Fm=(e)=>{if(e.utility==="stroke-dasharray"&&e.value){if(e.value==="none")return{"stroke-dasharray":"none"};if(e.arbitrary||/^\d+(?:\.\d+)?$/.test(e.value))return{"stroke-dasharray":e.value};return}},Dm=(e)=>{if(e.utility==="stroke-dashoffset"&&e.value){if(e.arbitrary||/^-?\d+(?:\.\d+)?$/.test(e.value))return{"stroke-dashoffset":e.value};return}},jm=(e)=>Fa[e.base]?{"stroke-linecap":Fa[e.base]}:void 0,Bm=(e)=>Da[e.base]?{"stroke-linejoin":Da[e.base]}:void 0,Vm=(e)=>{if(e.base==="sr-only")return{position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)","white-space":"nowrap","border-width":"0"};if(e.base==="not-sr-only")return{position:"static",width:"auto",height:"auto",padding:"0",margin:"0",overflow:"visible",clip:"auto","white-space":"normal"};return},Um=(e)=>ja[e.base]?{"forced-color-adjust":ja[e.base]}:void 0,Ka=[hm,gm,mm,pm,ym,bm,xm,vm,Va,wm,Va,$m,Rm,km,Sm,Am,Em,Tm,Nm,Om,Im,Pm,_m,Lm,Mm,Fm,Dm,jm,Bm,Vm,Um];function Ce(e,t){let r=e/t*100;if(!Number.isFinite(r))return;return`${Wm(r)}%`}function Wm(e){if(Number.isInteger(e))return String(e);return e.toFixed(6).replace(/\.?0+$/,"")}var Ha={"column-fill-auto":"auto","column-fill-balance":"balance","column-fill-balance-all":"balance-all"},Ga={"column-span-all":"all","column-span-none":"none"},qa={"box-decoration-clone":"clone","box-decoration-slice":"slice"},Ya={"box-border":"border-box","box-content":"content-box"},Ja={"float-start":"inline-start","float-end":"inline-end","float-right":"right","float-left":"left","float-none":"none"},Xa={"clear-start":"inline-start","clear-end":"inline-end","clear-left":"left","clear-right":"right","clear-both":"both","clear-none":"none"},Za={isolate:"isolate","isolation-auto":"auto"},Qa={"object-contain":"contain","object-cover":"cover","object-fill":"fill","object-none":"none","object-scale-down":"scale-down"},el={"object-bottom":"bottom","object-center":"center","object-left":"left","object-left-bottom":"left bottom","object-left-top":"left top","object-right":"right","object-right-bottom":"right bottom","object-right-top":"right top","object-top":"top"},tl={"overscroll-auto":"auto","overscroll-contain":"contain","overscroll-none":"none","overscroll-x-auto":"auto","overscroll-x-contain":"contain","overscroll-x-none":"none","overscroll-y-auto":"auto","overscroll-y-contain":"contain","overscroll-y-none":"none"},rl={visible:"visible",invisible:"hidden",collapse:"collapse"},zm=(e)=>{if(e.utility==="aspect"&&e.value){let t={auto:"auto",square:"1 / 1",video:"16 / 9"};if(t[e.value])return{"aspect-ratio":t[e.value]};if(e.arbitrary)return{"aspect-ratio":e.value};let r=e.value.match(/^(\d+(?:\.\d+)?)\/(\d+(?:\.\d+)?)$/);if(r)return{"aspect-ratio":`${r[1]} / ${r[2]}`};if(/^\d+(?:\.\d+)?$/.test(e.value))return{"aspect-ratio":e.value};return}},Km=(e,t)=>{if(e.utility==="columns"&&e.value){let r={"1":"1","2":"2","3":"3","4":"4","5":"5","6":"6","7":"7","8":"8","9":"9","10":"10","11":"11","12":"12",auto:"auto"},n={"3xs":"16rem","2xs":"18rem",xs:"20rem",sm:"24rem",md:"28rem",lg:"32rem",xl:"36rem","2xl":"42rem","3xl":"48rem","4xl":"56rem","5xl":"64rem","6xl":"72rem","7xl":"80rem"};if(r[e.value])return{columns:r[e.value]};if(n[e.value])return{columns:n[e.value]};if(t.theme.spacing[e.value])return{columns:t.theme.spacing[e.value]};if(e.arbitrary||/^\d+$/.test(e.value))return{columns:e.value};return}},Hm=(e)=>Ha[e.base]?{"column-fill":Ha[e.base]}:void 0,Gm=(e,t)=>{if(e.utility==="column-gap"&&e.value){let r=t.theme.spacing[e.value];if(r===void 0&&e.arbitrary)r=e.value;if(r===void 0&&/^\d+(?:\.\d+)?$/.test(e.value))r=`${Number.parseFloat(e.value)*0.25}rem`;return r!==void 0?{"column-gap":r}:void 0}},qm=(e,t)=>{if(e.utility==="column-rule"&&e.value){let r={"0":"0px","1":"1px","2":"2px","4":"4px","8":"8px"};if(r[e.value])return{"column-rule-width":r[e.value]};let n=e.value.split("-");if(n.length===2){let[s,c]=n,a=t.theme.colors[s];if(typeof a==="object"&&a[c])return{"column-rule-color":W(e.value,a[c],s,t.colorVariables)}}let i=t.theme.colors[e.value];if(typeof i==="string")return{"column-rule-color":W(e.value,i,e.value,t.colorVariables)};if(typeof i==="object"&&i!==null&&typeof i.DEFAULT==="string")return{"column-rule-color":W(e.value,i.DEFAULT,e.value,t.colorVariables)};let o={solid:"solid",dashed:"dashed",dotted:"dotted",double:"double",hidden:"hidden",none:"none"};if(o[e.value])return{"column-rule-style":o[e.value]}}},Ym=(e)=>Ga[e.base]?{"column-span":Ga[e.base]}:void 0,Jm=(e)=>({"break-before-auto":{"break-before":"auto"},"break-before-avoid":{"break-before":"avoid"},"break-before-all":{"break-before":"all"},"break-before-avoid-page":{"break-before":"avoid-page"},"break-before-page":{"break-before":"page"},"break-after-auto":{"break-after":"auto"},"break-after-avoid":{"break-after":"avoid"},"break-after-all":{"break-after":"all"},"break-after-avoid-page":{"break-after":"avoid-page"},"break-after-page":{"break-after":"page"},"break-inside-auto":{"break-inside":"auto"},"break-inside-avoid":{"break-inside":"avoid"},"break-inside-avoid-page":{"break-inside":"avoid-page"},"break-inside-avoid-column":{"break-inside":"avoid-column"}})[e.base],Xm=(e)=>qa[e.base]?{"box-decoration-break":qa[e.base]}:void 0,Zm=(e)=>Ya[e.base]?{"box-sizing":Ya[e.base]}:void 0,Qm=(e)=>Ja[e.base]?{float:Ja[e.base]}:void 0,ep=(e)=>Xa[e.base]?{clear:Xa[e.base]}:void 0,tp=(e)=>Za[e.base]?{isolation:Za[e.base]}:void 0,nl=["size","inline-size","layout","paint","style"],rp=nl.map((e)=>`var(--tc-contain-${e}, )`).join(" "),np=["none","content","strict"],ip=(e)=>{if(e.utility!=="contain"||!e.value)return;if(e.arbitrary)return{contain:e.value};if(np.includes(e.value))return{contain:e.value};if(nl.includes(e.value))return{[`--tc-contain-${e.value}`]:e.value,contain:rp};return},op=(e)=>Qa[e.base]?{"object-fit":Qa[e.base]}:void 0,sp=(e)=>el[e.base]?{"object-position":el[e.base]}:void 0,ap=(e)=>{if(e.utility==="overflow"){let t=["auto","hidden","clip","visible","scroll"];if(e.value&&t.includes(e.value))return{overflow:e.value}}if(e.utility==="overflow-x"||e.utility==="overflow-y"){let t=["auto","hidden","clip","visible","scroll"];if(e.value&&t.includes(e.value))return{[e.utility]:e.value}}},lp=(e)=>{let t=e.base.startsWith("overscroll-x")?"overscroll-behavior-x":e.base.startsWith("overscroll-y")?"overscroll-behavior-y":"overscroll-behavior";return tl[e.base]?{[t]:tl[e.base]}:void 0},cp=(e)=>{if(["static","fixed","absolute","relative","sticky"].includes(e.utility))return{position:e.utility}},up=(e,t)=>{let n={inset:["top","right","bottom","left"],"inset-x":["left","right"],"inset-y":["top","bottom"],top:["top"],right:["right"],bottom:["bottom"],left:["left"],start:["inset-inline-start"],end:["inset-inline-end"]}[e.utility];if(!n||!e.value)return;let i=(c)=>{if(c.includes("/")&&!e.arbitrary){let[l,u]=c.split("/").map(Number);if(!Number.isNaN(l)&&!Number.isNaN(u)&&u!==0)return Ce(l,u);return}if(c==="full")return"100%";if(c==="auto")return"auto";if(e.arbitrary)return c;let a=t.theme.spacing[c];if(a!==void 0)return a;if(/^\d+(?:\.\d+)?$/.test(c))return`${Number.parseFloat(c)*0.25}rem`;return},o;if(e.value.startsWith("-")){let c=e.value.slice(1),a=i(c);if(a===void 0)o=void 0;else if(a.endsWith("%"))o=`${-Number.parseFloat(a)}%`;else o=a.startsWith("-")?a:`-${a}`}else o=i(e.value);if(o===void 0)return;let s={};for(let c of n)s[c]=o;return s},fp=(e)=>rl[e.utility]?{visibility:rl[e.utility]}:void 0,dp=(e)=>{if(e.utility==="z"&&e.value){if(e.arbitrary||e.value==="auto"||/^-?\d+$/.test(e.value))return{"z-index":e.value};return}},il=[zm,Km,Hm,Gm,qm,Ym,Jm,Xm,Zm,Qm,ep,ip,tp,op,sp,ap,lp,cp,up,fp,dp];var hp={rotate:"rotate","rotate-x":"rotateX","rotate-y":"rotateY","rotate-z":"rotateZ"},gp={"translate-x":"translateX","translate-y":"translateY","translate-z":"translateZ"},ol={"backface-visible":"visible","backface-hidden":"hidden"},sl={"transform-flat":"flat","transform-3d":"preserve-3d"},al={"transition-none":"none","transition-all":"all",transition:"color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter","transition-colors":"color, background-color, border-color, text-decoration-color, fill, stroke","transition-opacity":"opacity","transition-shadow":"box-shadow","transition-transform":"transform"},ll={"ease-linear":"linear","ease-in":"cubic-bezier(0.4, 0, 1, 1)","ease-out":"cubic-bezier(0, 0, 0.2, 1)","ease-in-out":"cubic-bezier(0.4, 0, 0.2, 1)","ease-initial":"initial"},cl={"transition-normal":"normal","transition-discrete":"allow-discrete","transition-behavior-normal":"normal","transition-behavior-allow-discrete":"allow-discrete"},ul={none:"none",spin:"spin 1s linear infinite",ping:"ping 1s cubic-bezier(0, 0, 0.2, 1) infinite",pulse:"pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite",bounce:"bounce 1s infinite"},fl={"animate-running":"running","animate-paused":"paused"},dl={"animate-normal":"normal","animate-reverse":"reverse","animate-alternate":"alternate","animate-alternate-reverse":"alternate-reverse"},hl={"animate-fill-none":"none","animate-fill-forwards":"forwards","animate-fill-backwards":"backwards","animate-fill-both":"both"},gl={"animate-ease-linear":"linear","animate-ease-in":"cubic-bezier(0.4, 0, 1, 1)","animate-ease-out":"cubic-bezier(0, 0, 0.2, 1)","animate-ease-in-out":"cubic-bezier(0.4, 0, 0.2, 1)"},ml="rotate(var(--tc-rotate, 0deg)) skewX(var(--tc-skew-x, 0deg)) skewY(var(--tc-skew-y, 0deg)) scaleX(var(--tc-scale-x, 1)) scaleY(var(--tc-scale-y, 1))",_t=`translate(var(--tc-translate-x, 0), var(--tc-translate-y, 0)) ${ml}`,bi=`translate3d(var(--tc-translate-x, 0), var(--tc-translate-y, 0), 0) ${ml}`,mp={transform:_t,"transform-cpu":_t,"transform-gpu":bi,"transform-none":"none"},pp=(e)=>{let t=mp[e.base];return t?{transform:t}:void 0};function Br(e,t){if(!t.value)return{transform:`${e}(1)`};if(t.arbitrary)return{transform:`${e}(${t.value})`};if(/^-?\d+(?:\.\d+)?$/.test(t.value))return{transform:`${e}(${Number(t.value)/100})`};return}function yi(e){let t=e.value;if(e.arbitrary)return t;if(/^-?\d+(?:\.\d+)?$/.test(t))return`${t}deg`;if(/^-?\d+(?:\.\d+)?(?:deg|rad|grad|turn)$/.test(t))return t;return}var yp=(e)=>{if(e.utility==="scale")return Br("scale",e);if(e.utility==="scale-x")return Br("scaleX",e);if(e.utility==="scale-y")return Br("scaleY",e);if(e.utility==="scale-z")return Br("scaleZ",e)},bp=(e)=>{if(!e.value)return;let t=hp[e.utility];if(!t)return;let r=yi(e);return r!==void 0?{transform:`${t}(${r})`}:void 0},xp=(e,t)=>{let r=(o)=>{if(o.includes("/")){let[c,a]=o.split("/");return Ce(Number(c),Number(a))}if(o==="full")return"100%";if(o==="half")return"50%";if(e.arbitrary)return o;let s=t.theme.spacing[o];if(s!==void 0)return s;if(/^\d+(?:\.\d+)?$/.test(o))return`${Number.parseFloat(o)*0.25}rem`;return},n=gp[e.utility];if(!n||!e.value)return;let i;if(e.value.startsWith("-")){let o=r(e.value.slice(1));i=o===void 0?void 0:`-${o}`}else i=r(e.value);return i!==void 0?{transform:`${n}(${i})`}:void 0},vp=(e)=>{if(e.utility==="skew-x"&&e.value){let t=yi(e);return t!==void 0?{transform:`skewX(${t})`}:void 0}if(e.utility==="skew-y"&&e.value){let t=yi(e);return t!==void 0?{transform:`skewY(${t})`}:void 0}},wp=(e)=>{if(e.utility==="origin"&&e.value){if(e.arbitrary)return{"transform-origin":e.value.replace(/_/g," ")};let t={center:"center",top:"top","top-right":"top right",right:"right","bottom-right":"bottom right",bottom:"bottom","bottom-left":"bottom left",left:"left","top-left":"top left"};return t[e.value]?{"transform-origin":t[e.value]}:void 0}return},Cp={dramatic:"100px",near:"300px",normal:"500px",midrange:"800px",distant:"1200px"},$p=(e)=>{if(e.utility==="perspective"&&e.value){if(e.value==="none")return{perspective:"none"};if(e.arbitrary||/^\d+(?:\.\d+)?(?:px|rem|em)$/.test(e.value))return{perspective:e.value};let t=Cp[e.value];if(t)return{perspective:t};if(/^\d+(?:\.\d+)?$/.test(e.value))return{perspective:`${e.value}px`};return}return},Rp=(e)=>{if(e.utility==="perspective-origin"&&e.value)return{"perspective-origin":{center:"center",top:"top","top-right":"top right",right:"right","bottom-right":"bottom right",bottom:"bottom","bottom-left":"bottom left",left:"left","top-left":"top left"}[e.value]||e.value}},kp=(e)=>ol[e.base]?{"backface-visibility":ol[e.base]}:void 0,Sp=(e)=>sl[e.base]?{"transform-style":sl[e.base]}:void 0,Ap=(e)=>al[e.base]?{"transition-property":al[e.base]}:void 0;function Vr(e,t){let r=e.value;if(t[r])return t[r];if(e.arbitrary)return r;if(/^\d+(?:\.\d+)?$/.test(r))return`${r}ms`;return}var Ep=(e)=>{if(e.utility==="duration"&&e.value){let r=Vr(e,{"0":"0s","75":"75ms","100":"100ms","150":"150ms","200":"200ms","300":"300ms","500":"500ms","700":"700ms","1000":"1000ms"});return r!==void 0?{"transition-duration":r}:void 0}},Tp=(e)=>ll[e.base]?{"transition-timing-function":ll[e.base]}:void 0,Np=(e)=>{if(e.utility==="delay"&&e.value){let r=Vr(e,{"0":"0s","75":"75ms","100":"100ms","150":"150ms","200":"200ms","300":"300ms","500":"500ms","700":"700ms","1000":"1000ms"});return r!==void 0?{"transition-delay":r}:void 0}},Op=(e)=>cl[e.base]?{"transition-behavior":cl[e.base]}:void 0,Ip=(e)=>{if(e.utility!=="animate")return;if(e.arbitrary&&e.value)return{animation:e.value.replace(/_/g," ")};if(e.value&&ul[e.value])return{animation:ul[e.value]};return},Pp=(e)=>fl[e.base]?{"animation-play-state":fl[e.base]}:void 0,_p=(e)=>dl[e.base]?{"animation-direction":dl[e.base]}:void 0,Lp=(e)=>hl[e.base]?{"animation-fill-mode":hl[e.base]}:void 0,Mp=(e)=>{if(e.utility==="animate-iteration"&&e.value){if(e.value==="infinite"||e.arbitrary||/^\d+(?:\.\d+)?$/.test(e.value))return{"animation-iteration-count":e.value};return}},Fp=(e)=>{if(e.utility==="animate-duration"&&e.value){let r=Vr(e,{"75":"75ms","100":"100ms","150":"150ms","200":"200ms","300":"300ms","500":"500ms","700":"700ms","1000":"1000ms"});return r!==void 0?{"animation-duration":r}:void 0}},Dp=(e)=>{if(e.utility==="animate-delay"&&e.value){let r=Vr(e,{"75":"75ms","100":"100ms","150":"150ms","200":"200ms","300":"300ms","500":"500ms","700":"700ms","1000":"1000ms"});return r!==void 0?{"animation-delay":r}:void 0}},jp=(e)=>gl[e.base]?{"animation-timing-function":gl[e.base]}:void 0,pl=[pp,yp,bp,xp,vp,wp,$p,Rp,kp,Sp,Ap,Op,Ep,Tp,Np,Ip,Pp,_p,Lp,Mp,Fp,Dp,jp];var yl={italic:"italic","not-italic":"normal"},bl={"normal-nums":"normal",ordinal:"ordinal","slashed-zero":"slashed-zero","lining-nums":"lining-nums","oldstyle-nums":"oldstyle-nums","proportional-nums":"proportional-nums","tabular-nums":"tabular-nums","diagonal-fractions":"diagonal-fractions","stacked-fractions":"stacked-fractions"},xl={"list-inside":"inside","list-outside":"outside"},vl={none:"none",disc:"disc",decimal:"decimal"},wl={underline:"underline",overline:"overline","line-through":"line-through","no-underline":"none"},Cl={uppercase:"uppercase",lowercase:"lowercase",capitalize:"capitalize","normal-case":"none"},$l={"text-wrap":"wrap","text-nowrap":"nowrap","text-balance":"balance","text-pretty":"pretty"},Rl={"align-baseline":"baseline","align-top":"top","align-middle":"middle","align-bottom":"bottom","align-text-top":"text-top","align-text-bottom":"text-bottom","align-sub":"sub","align-super":"super"},kl={"whitespace-normal":"normal","whitespace-nowrap":"nowrap","whitespace-pre":"pre","whitespace-pre-line":"pre-line","whitespace-pre-wrap":"pre-wrap","whitespace-break-spaces":"break-spaces"},Sl={"break-all":"break-all","break-keep":"keep-all"},Al={"hyphens-none":"none","hyphens-manual":"manual","hyphens-auto":"auto"},El={"writing-horizontal-tb":"horizontal-tb","writing-vertical-rl":"vertical-rl","writing-vertical-lr":"vertical-lr"},Tl={"text-orientation-mixed":"mixed","text-orientation-upright":"upright","text-orientation-sideways":"sideways"},Nl={"direction-ltr":"ltr","direction-rtl":"rtl"},Ol={"small-caps":"small-caps","all-small-caps":"all-small-caps","petite-caps":"petite-caps","all-petite-caps":"all-petite-caps",unicase:"unicase","titling-caps":"titling-caps","normal-caps":"normal"},Il={"ligatures-normal":"normal","ligatures-none":"none","common-ligatures":"common-ligatures","no-common-ligatures":"no-common-ligatures","discretionary-ligatures":"discretionary-ligatures","no-discretionary-ligatures":"no-discretionary-ligatures","historical-ligatures":"historical-ligatures","no-historical-ligatures":"no-historical-ligatures",contextual:"contextual","no-contextual":"no-contextual"},Bp=(e,t)=>{if(e.utility==="font"&&e.value){let r=t.theme.fontFamily[e.value];if(r)return{"font-family":r.join(", ")}}},Vp=(e)=>({antialiased:{"-webkit-font-smoothing":"antialiased","-moz-osx-font-smoothing":"grayscale"},"subpixel-antialiased":{"-webkit-font-smoothing":"auto","-moz-osx-font-smoothing":"auto"}})[e.base],Up=(e)=>yl[e.base]?{"font-style":yl[e.base]}:void 0,Wp=(e)=>{if(e.utility==="font-stretch"&&e.value){if(["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded"].includes(e.value))return{"font-stretch":e.value};if(e.arbitrary||/^\d+(?:\.\d+)?%$/.test(e.value))return{"font-stretch":e.value};return}},zp=(e)=>bl[e.base]?{"font-variant-numeric":bl[e.base]}:void 0,Kp=(e)=>{if(e.utility==="tracking"){let t={tighter:"-0.05em",tight:"-0.025em",normal:"0em",wide:"0.025em",wider:"0.05em",widest:"0.1em"};if(!e.value)return;if(e.arbitrary)return{"letter-spacing":e.value};if(e.value.startsWith("-")){let r=e.value.slice(1);return t[r]?{"letter-spacing":`-${t[r]}`}:void 0}return t[e.value]?{"letter-spacing":t[e.value]}:void 0}},Hp=(e)=>{if(e.utility==="line-clamp"&&e.value){if(e.value==="none")return{overflow:"visible",display:"block","-webkit-box-orient":"horizontal","-webkit-line-clamp":"none"};if(!e.arbitrary&&!/^\d+$/.test(e.value))return;return{overflow:"hidden",display:"-webkit-box","-webkit-box-orient":"vertical","-webkit-line-clamp":e.value}}},Gp=(e)=>{if(e.utility==="list-image"&&e.value){if(e.value==="none")return{"list-style-image":"none"};if(e.arbitrary)return{"list-style-image":e.value};return{"list-style-image":`url(${e.value})`}}},qp=(e)=>xl[e.base]?{"list-style-position":xl[e.base]}:void 0,Yp=(e)=>{if(e.utility!=="list"||!e.value)return;return vl[e.value]?{"list-style-type":vl[e.value]}:void 0},Jp=(e,t)=>{if(wl[e.base])return{"text-decoration-line":wl[e.base]};if(e.utility==="decoration"&&e.value){let r={solid:"solid",double:"double",dotted:"dotted",dashed:"dashed",wavy:"wavy"};if(r[e.value])return{"text-decoration-style":r[e.value]};let n={auto:"auto","from-font":"from-font","0":"0px","1":"1px","2":"2px","4":"4px","8":"8px"};if(n[e.value])return{"text-decoration-thickness":n[e.value]};if(e.arbitrary)return{"text-decoration-thickness":e.value};let i=z(e.value,t,e.modifierArbitrary);if(i)return{"text-decoration-color":i};return}return},Xp=(e)=>{if(e.utility==="underline-offset"&&e.value){let t={auto:"auto",0:"0px",1:"1px",2:"2px",4:"4px",8:"8px"};if(t[e.value])return{"text-underline-offset":t[e.value]};if(e.arbitrary)return{"text-underline-offset":e.value};if(/^\d+(?:\.\d+)?$/.test(e.value))return{"text-underline-offset":`${e.value}px`};return}},Zp=(e)=>Cl[e.base]?{"text-transform":Cl[e.base]}:void 0,Qp=(e)=>({truncate:{overflow:"hidden","text-overflow":"ellipsis","white-space":"nowrap"},"text-ellipsis":{"text-overflow":"ellipsis"},"text-clip":{"text-overflow":"clip"}})[e.base],ey=(e)=>$l[e.base]?{"text-wrap":$l[e.base]}:void 0,ty=(e,t)=>{if(e.utility==="indent"&&e.value){if(e.arbitrary)return{"text-indent":e.value};let r=(i)=>{let o=t.theme.spacing[i];if(o!==void 0)return o;if(/^\d+(?:\.\d+)?$/.test(i))return`${Number.parseFloat(i)*0.25}rem`;return};if(e.value.startsWith("-")){let i=r(e.value.slice(1));return i!==void 0?{"text-indent":`-${i}`}:void 0}let n=r(e.value);return n!==void 0?{"text-indent":n}:void 0}},ry=(e)=>Rl[e.base]?{"vertical-align":Rl[e.base]}:void 0,ny=(e)=>kl[e.base]?{"white-space":kl[e.base]}:void 0,iy=(e)=>{if(e.base==="break-normal")return{"overflow-wrap":"normal","word-break":"normal"};if(e.base==="break-words")return{"overflow-wrap":"break-word"};return Sl[e.base]?{"word-break":Sl[e.base]}:void 0},oy=(e)=>{let t={"overflow-wrap-normal":"normal","overflow-wrap-break":"break-word","overflow-wrap-anywhere":"anywhere","wrap-normal":"normal","wrap-break-word":"break-word","wrap-anywhere":"anywhere"};return t[e.base]?{"overflow-wrap":t[e.base]}:void 0},sy=(e)=>{if(e.utility!=="tab"||!e.value)return;if(e.arbitrary||/^\d+$/.test(e.value))return{"tab-size":e.value};return},ay=(e)=>Al[e.base]?{hyphens:Al[e.base]}:void 0,ly=(e)=>{if(e.utility==="content"&&e.value){let t={none:"none"};if(t[e.value]||e.value.startsWith('"')||e.value.startsWith("'"))return{content:t[e.value]||e.value};if(e.arbitrary)return{content:e.value};return}},cy=(e,t)=>{if(e.utility==="leading"){if(!e.value)return;let r={none:"1",tight:"1.25",snug:"1.375",normal:"1.5",relaxed:"1.625",loose:"2",3:".75rem",4:"1rem",5:"1.25rem",6:"1.5rem",7:"1.75rem",8:"2rem",9:"2.25rem",10:"2.5rem"};if(r[e.value])return{"line-height":r[e.value]};if(e.arbitrary)return{"line-height":e.value};if(/^\d+(?:\.\d+)?$/.test(e.value))return{"line-height":`${Number.parseFloat(e.value)*0.25}rem`};return}},uy=(e)=>El[e.base]?{"writing-mode":El[e.base]}:void 0,fy=(e)=>Tl[e.base]?{"text-orientation":Tl[e.base]}:void 0,dy=(e)=>Nl[e.base]?{direction:Nl[e.base]}:void 0,hy=(e)=>{if(e.utility==="text-emphasis"&&e.value){let t={none:"none",filled:"filled",open:"open",dot:"dot",circle:"circle","double-circle":"double-circle",triangle:"triangle",sesame:"sesame"};if(t[e.value])return{"text-emphasis":t[e.value]};return e.arbitrary?{"text-emphasis":e.value}:void 0}},gy=(e,t)=>{if(e.utility==="text-emphasis-color"&&e.value){let r=e.value.split("-");if(r.length===2){let[i,o]=r,s=t.theme.colors[i];if(typeof s==="object"&&s[o])return{"text-emphasis-color":W(e.value,s[o],i,t.colorVariables)}}let n=t.theme.colors[e.value];if(typeof n==="string")return{"text-emphasis-color":W(e.value,n,e.value,t.colorVariables)};if(typeof n==="object"&&n!==null&&typeof n.DEFAULT==="string")return{"text-emphasis-color":W(e.value,n.DEFAULT,e.value,t.colorVariables)}}},my=(e,t)=>{if(e.utility==="word-spacing"&&e.value){let r={tighter:"-0.05em",tight:"-0.025em",normal:"normal",wide:"0.025em",wider:"0.05em",widest:"0.1em"};if(r[e.value])return{"word-spacing":r[e.value]};if(t.theme.spacing[e.value])return{"word-spacing":t.theme.spacing[e.value]};if(e.arbitrary)return{"word-spacing":e.value};return}},py=(e)=>Ol[e.base]?{"font-variant-caps":Ol[e.base]}:void 0,yy=(e)=>Il[e.base]?{"font-variant-ligatures":Il[e.base]}:void 0,Pl=[Bp,Vp,Up,Wp,zp,py,yy,Kp,cy,Hp,Gp,qp,Yp,Jp,Xp,Zp,Qp,ey,ty,ry,ny,iy,oy,sy,ay,ly,uy,fy,dy,hy,gy,my];var _l={"flex-row":"row","flex-row-reverse":"row-reverse","flex-col":"column","flex-col-reverse":"column-reverse"},Ll={"flex-wrap":"wrap","flex-wrap-reverse":"wrap-reverse","flex-nowrap":"nowrap"},xi={0:"0px",2:"2px",4:"4px",8:"8px"},by=(e)=>{if(["block","inline-block","inline","flex","inline-flex","grid","inline-grid","hidden","none","contents","flow-root","list-item"].includes(e.utility)&&!e.value)return{display:e.utility==="hidden"?"none":e.utility};if(e.utility==="table"){if(!e.value)return{display:"table"};if(new Set(["cell","row","row-group","column","column-group","header-group","footer-group","caption"]).has(e.value))return{display:`table-${e.value}`}}if(e.utility==="inline"&&e.value==="table")return{display:"inline-table"};if(e.utility==="flow"&&e.value==="root")return{display:"flow-root"};if(e.utility==="list"&&e.value==="item")return{display:"list-item"}},xy=(e)=>{if(e.utility==="scrollbar"&&e.value){let r={auto:"auto",thin:"thin",none:"none"}[e.value];if(r)return{"scrollbar-width":r}}},vy=(e)=>{if(e.utility==="content"){if(e.value==="none")return{content:"none"};if(e.value==="empty")return{content:'""'};if(e.arbitrary&&e.value)return{content:e.value}}},wy=(e)=>{if(e.utility==="@container")return{"container-type":"inline-size"};if(e.utility==="@container-normal")return{"container-type":"normal"};if(e.utility.startsWith("@container/"))return{"container-type":"inline-size","container-name":e.utility.slice(11)}},Cy=(e)=>_l[e.utility]?{"flex-direction":_l[e.utility]}:void 0,$y=(e)=>Ll[e.utility]?{"flex-wrap":Ll[e.utility]}:void 0,Ry=(e)=>{if(e.utility==="flex"||e.utility.startsWith("flex-")){let t={"flex-1":"1 1 0%","flex-auto":"1 1 auto","flex-initial":"0 1 auto","flex-none":"none"};if(t[e.utility])return{flex:t[e.utility]};if(e.utility==="flex"&&e.arbitrary&&e.value)return{flex:e.value.replace(/_/g," ")}}return},ky=(e)=>{if(e.utility==="flex-grow"&&!e.value)return{"flex-grow":"1"};if(e.utility==="flex-grow"&&e.value)return{"flex-grow":e.value}},Sy=(e)=>{if(e.utility==="flex-shrink"&&!e.value)return{"flex-shrink":"1"};if(e.utility==="flex-shrink"&&e.value)return{"flex-shrink":e.value}},Ay=(e)=>{if(e.utility==="justify"&&e.value){let t={start:"flex-start",end:"flex-end",center:"center",between:"space-between",around:"space-around",evenly:"space-evenly"};if(t[e.value])return{"justify-content":t[e.value]};if(e.arbitrary)return{"justify-content":e.value}}return},Ey=(e)=>{if(e.utility==="items"&&e.value){let t={start:"flex-start",end:"flex-end",center:"center",baseline:"baseline",stretch:"stretch"};if(t[e.value])return{"align-items":t[e.value]};if(e.arbitrary)return{"align-items":e.value}}return},Ty=(e)=>{if(e.utility==="justify"&&e.value&&e.value.startsWith("items-")){let t={"items-start":"start","items-end":"end","items-center":"center","items-stretch":"stretch","items-center-safe":"safe center","items-end-safe":"safe end"};return t[e.value]?{"justify-items":t[e.value]}:void 0}return},Ny=(e)=>{if(e.utility==="content"&&e.value){let t={normal:"normal",center:"center",start:"flex-start",end:"flex-end",between:"space-between",around:"space-around",evenly:"space-evenly",baseline:"baseline",stretch:"stretch"};return t[e.value]?{"align-content":t[e.value]}:void 0}return},Oy=(e,t)=>{let n={p:["padding"],px:["padding-left","padding-right"],py:["padding-top","padding-bottom"],pt:["padding-top"],pr:["padding-right"],pb:["padding-bottom"],pl:["padding-left"],ps:["padding-inline-start"],pe:["padding-inline-end"],m:["margin"],mx:["margin-left","margin-right"],my:["margin-top","margin-bottom"],mt:["margin-top"],mr:["margin-right"],mb:["margin-bottom"],ml:["margin-left"],ms:["margin-inline-start"],me:["margin-inline-end"]}[e.utility];if(!n||!e.value)return;let i=(c)=>{if(c==="auto")return e.utility.charCodeAt(0)===109?"auto":void 0;let a=t.theme.spacing[c];if(a!==void 0)return a;if(e.arbitrary)return c;if(/^\d+(?:\.\d+)?$/.test(c)){let l=Number.parseFloat(c);if(Number.isFinite(l))return`${l*0.25}rem`}return},o;if(e.value.startsWith("-")){if(e.utility.charCodeAt(0)===112)return;let c=e.value.slice(1);if(c==="0")o=t.theme.spacing[c]||"0";else{let a=i(c);o=a===void 0?void 0:`-${a}`}}else o=i(e.value);if(o===void 0)return;let s={};for(let c of n)s[c]=o;return s};function pe(e,t,r){let n=e.value;if(n.includes("/")&&!e.arbitrary){let[o,s]=n.split("/").map(Number);if(Number.isNaN(o)||Number.isNaN(s)||s===0)return;return Ce(o,s)}let i=t.theme.spacing[n];if(i!==void 0)return i;if(r[n])return r[n];if(e.arbitrary)return n;if(/^\d+(?:\.\d+)?$/.test(n))return`${Number.parseFloat(n)*0.25}rem`;return}var Iy=(e,t)=>{if(e.utility==="w"&&e.value){let n=pe(e,t,{full:"100%",screen:"100vw",svw:"100svw",lvw:"100lvw",dvw:"100dvw",auto:"auto",min:"min-content",max:"max-content",fit:"fit-content"});return n!==void 0?{width:n}:void 0}if(e.utility==="h"&&e.value){let n=pe(e,t,{full:"100%",screen:"100vh",svh:"100svh",lvh:"100lvh",dvh:"100dvh",auto:"auto",min:"min-content",max:"max-content",fit:"fit-content"});return n!==void 0?{height:n}:void 0}if(e.utility==="size"&&e.value){let n=pe(e,t,{full:"100%",auto:"auto",min:"min-content",max:"max-content",fit:"fit-content"});return n!==void 0?{width:n,height:n}:void 0}return},De=null,Ur=null,Wr,Py={bg:"background-color",text:"color",border:"border-color"},_y={bg:{color:"background-color",image:"background-image",url:"background-image",position:"background-position",length:"background-size"},text:{color:"color",length:"font-size","absolute-size":"font-size","relative-size":"font-size","family-name":"font-family"},border:{color:"border-color",length:"border-width","line-width":"border-width"}},Ly=new Set(["length","absolute-size","relative-size","percentage","number"]),My=/^(?:url|(?:repeating-)?(?:linear|radial|conic)-gradient|image-set|-webkit-image-set|cross-fade|element|paint)\(/i,Fl={current:"currentColor",transparent:"transparent",inherit:"inherit"};function W(e,t,r,n){return n?.includes(r)?`var(--color-${e}, ${t})`:t}function Dl(e,t){let r=new Map;for(let[n,i]of Object.entries(e))if(typeof i==="string")r.set(n,W(n,i,n,t));else if(typeof i==="object"&&i!==null){for(let[o,s]of Object.entries(i))if(typeof s==="string"){let c=o==="DEFAULT"?n:`${n}-${o}`;r.set(c,W(c,s,n,t))}}return r}var Fy=(e,t)=>{let r=Py[e.utility];if(!r||!e.value)return;let n=e.value;if(e.arbitrary&&e.typeHint){let l=_y[e.utility]?.[e.typeHint];return l?{[l]:n}:void 0}if(e.arbitrary&&e.utility==="bg"&&My.test(n))return{"background-image":n};if(De===null||Ur!==t.theme.colors||Wr!==t.colorVariables)De=Dl(t.theme.colors,t.colorVariables),Ur=t.theme.colors,Wr=t.colorVariables;let i=Oe(n);if(i===-1){let l=De.get(n);if(l)return{[r]:l}}let o,s=n;if(i!==-1){s=n.slice(0,i);let l=n.slice(i+1);if(l.charCodeAt(0)===91&&l.charCodeAt(l.length-1)===93){let f=Number.parseFloat(l.slice(1,-1));if(Number.isNaN(f)||f<0||f>1)return;o=f}else if(e.modifierArbitrary){let f=Number.parseFloat(l);if(Number.isNaN(f)||f<0||f>1)return;o=f}else{let f=Number.parseInt(l,10);if(Number.isNaN(f)||f<0||f>100)return;o=f/100}let u=De.get(s);if(u)return{[r]:we(u,o)}}let c=Fl[s];if(c)return{[r]:c};if((e.arbitrary||s&&s.charCodeAt(0)===91)&&s){let l=o!==void 0?we(s,o):s;return{[r]:l}}return};function we(e,t){let r=e;if(e.charCodeAt(0)===91&&e.charCodeAt(e.length-1)===93)r=e.slice(1,-1);if(r.charCodeAt(0)===35){let n=r.slice(1);if(n.length===3||n.length===4)n=n.split("").map((c)=>c+c).join("");let i=Number.parseInt(n.slice(0,2),16),o=Number.parseInt(n.slice(2,4),16),s=Number.parseInt(n.slice(4,6),16);return`rgb(${i} ${o} ${s} / ${t})`}if(r.charCodeAt(0)===114){let n=r.match(/rgb\((\d+)\s+(\d+)\s+(\d+)/);if(n)return`rgb(${n[1]} ${n[2]} ${n[3]} / ${t})`}if(r.charCodeAt(0)===111){let n=r.match(/oklch\(([^)]+)\)/);if(n)return`oklch(${n[1]} / ${t})`}if(r.charCodeAt(0)===104){let n=r.match(/hsl\(([^)]+)\)/);if(n)return`hsl(${n[1]} / ${t})`}if(r!=="inherit"&&r!=="transparent"){let n=Number((t*100).toFixed(2));return`color-mix(in srgb, ${r} ${n}%, transparent)`}return r}function z(e,t,r=!1){let n=Oe(e),i=e,o;if(n!==-1){i=e.slice(0,n);let f=e.slice(n+1);if(f.charCodeAt(0)===91&&f.charCodeAt(f.length-1)===93){if(o=Number.parseFloat(f.slice(1,-1)),Number.isNaN(o)||o<0||o>1)return}else if(r){if(o=Number.parseFloat(f),Number.isNaN(o)||o<0||o>1)return}else{let d=Number.parseInt(f,10);if(Number.isNaN(d)||d<0||d>100)return;o=d/100}}let s={current:"currentColor",transparent:"transparent",inherit:"inherit",auto:"auto"};if(s[i])return o!==void 0?we(s[i],o):s[i];let c=t.colorVariables,a=t.theme.colors[i],l=typeof a==="string"?W(i,a,i,c):a;if(typeof l==="string")return o!==void 0?we(l,o):l;if(typeof l==="object"&&l!==null&&typeof l.DEFAULT==="string"){let f=W(i,l.DEFAULT,i,c);return o!==void 0?we(f,o):f}let u=i.split("-");if(u.length>=2){let f=u[u.length-1],d=u.slice(0,-1).join("-"),h=t.theme.colors[d];if(typeof h==="object"&&h[f]){let m=W(i,h[f],d,c);return o!==void 0?we(m,o):m}}if(i.startsWith("var(")||i.startsWith("#")||i.startsWith("rgb(")||i.startsWith("rgba(")||i.startsWith("hsl(")||i.startsWith("hsla(")||i.startsWith("oklch(")||i.startsWith("oklab(")||i.startsWith("lab(")||i.startsWith("lch(")||i.startsWith("color(")||i.startsWith("color-mix(")||i.startsWith("hwb("))return o!==void 0?we(i,o):i;return}var Dy=(e,t)=>{if(e.utility!=="placeholder"||!e.value)return;if(De===null||Ur!==t.theme.colors||Wr!==t.colorVariables)De=Dl(t.theme.colors,t.colorVariables),Ur=t.theme.colors,Wr=t.colorVariables;let r=e.value,n=Oe(r);if(n===-1){let o=De.get(r);if(o)return{properties:{color:o},pseudoElement:"::placeholder"}}else{let o=r.slice(0,n),s=r.slice(n+1),c;if(s.charCodeAt(0)===91&&s.charCodeAt(s.length-1)===93){let l=Number.parseFloat(s.slice(1,-1));if(Number.isNaN(l)||l<0||l>1)return;c=l}else if(e.modifierArbitrary){let l=Number.parseFloat(s);if(Number.isNaN(l)||l<0||l>1)return;c=l}else{let l=Number.parseInt(s,10);if(Number.isNaN(l)||l<0||l>100)return;c=l/100}let a=De.get(o);if(a)return{properties:{color:we(a,c)},pseudoElement:"::placeholder"}}let i=Fl[e.value];if(i)return{properties:{color:i},pseudoElement:"::placeholder"};return},jy=(e,t)=>{if(e.utility==="text"&&e.value){let r=e.value,n,i=r.lastIndexOf("/");if(i!==-1&&!e.value.startsWith("[")&&!r.slice(i+1).includes("]"));if(i!==-1){let s=r.slice(0,i),c=r.slice(i+1);if(c&&(t.theme.fontSize[s]||e.arbitrary)){r=s;let a={none:"1",tight:"1.25",snug:"1.375",normal:"1.5",relaxed:"1.625",loose:"2",3:"0.75rem",4:"1rem",5:"1.25rem",6:"1.5rem",7:"1.75rem",8:"2rem",9:"2.25rem",10:"2.5rem"};n=t.theme.lineHeight?.[c]??a[c]??c}}if(e.arbitrary){if(e.typeHint){if(!Ly.has(e.typeHint))return;let c={"font-size":r};if(n)c["line-height"]=n;return c}if(/^#|^rgb|^hsl|^hwb|^lab|^lch|^oklch|^oklab|^color\(|^var\(--/.test(r))return;let s={"font-size":r};if(n)s["line-height"]=n;return s}let o=t.theme.fontSize[r];if(o)return{"font-size":o[0],"line-height":n??o[1].lineHeight}}},By=(e)=>{if(e.utility==="font"&&e.value){if(e.arbitrary){let r=e.typeHint;return r==="family-name"||r==="string"?{"font-family":e.value}:{"font-weight":e.value}}let t={thin:"100",extralight:"200",light:"300",normal:"400",medium:"500",semibold:"600",bold:"700",extrabold:"800",black:"900"};return t[e.value]?{"font-weight":t[e.value]}:void 0}return},Vy=(e)=>{if(e.utility==="leading"&&e.value){if(e.arbitrary)return{"line-height":e.value};let t={none:"1",tight:"1.25",snug:"1.375",normal:"1.5",relaxed:"1.625",loose:"2","3":"0.75rem","4":"1rem","5":"1.25rem","6":"1.5rem","7":"1.75rem","8":"2rem","9":"2.25rem","10":"2.5rem"};return t[e.value]?{"line-height":t[e.value]}:void 0}return},Uy=(e)=>{if(e.utility==="text"&&e.value){let t={left:"left",center:"center",right:"right",justify:"justify"};return t[e.value]?{"text-align":t[e.value]}:void 0}},Wy=(e)=>{if(e.utility==="border"){if(!e.value)return{"border-width":"1px"};let t={0:"0px",2:"2px",4:"4px",8:"8px"};if(t[e.value])return{"border-width":t[e.value]};let r={t:"border-top-width",r:"border-right-width",b:"border-bottom-width",l:"border-left-width",s:"border-inline-start-width",e:"border-inline-end-width"};if(e.value==="x")return{"border-left-width":"1px","border-right-width":"1px"};if(e.value==="y")return{"border-top-width":"1px","border-bottom-width":"1px"};let n=r[e.value];if(typeof n==="string")return{[n]:"1px"};return}},zy=(e,t)=>{let r={"border-t":"border-top-width","border-r":"border-right-width","border-b":"border-bottom-width","border-l":"border-left-width","border-x":["border-left-width","border-right-width"],"border-y":["border-top-width","border-bottom-width"],"border-s":"border-inline-start-width","border-e":"border-inline-end-width"},n={"border-t":"border-top-color","border-r":"border-right-color","border-b":"border-bottom-color","border-l":"border-left-color","border-x":["border-left-color","border-right-color"],"border-y":["border-top-color","border-bottom-color"],"border-s":"border-inline-start-color","border-e":"border-inline-end-color"},i=r[e.utility];if(!i)return;if(!e.value){let s=i;if(Array.isArray(s))return s.reduce((c,a)=>({...c,[a]:"1px"}),{});return{[s]:"1px"}}if(e.arbitrary){let s=e.value,l=(/^#|^(?:rgb|rgba|hsl|hsla|oklch|oklab|lab|lch)\(|^(?:currentColor|transparent|inherit)$/i.test(s)?n[e.utility]:i)??i;if(Array.isArray(l))return l.reduce((u,f)=>({...u,[f]:s}),{});return{[l]:s}}if(xi[e.value]){let s=i;if(Array.isArray(s))return s.reduce((c,a)=>({...c,[a]:xi[e.value]}),{});return{[s]:xi[e.value]}}let o=n[e.utility];if(o&&t){let s=e.value.split("-");if(s.length>=2){let a=s[s.length-1],l=s.slice(0,-1).join("-"),u=t.theme.colors[l];if(u&&typeof u==="object"&&u[a]){let f=o,d=W(e.value,u[a],l,t.colorVariables);if(Array.isArray(f))return f.reduce((h,m)=>({...h,[m]:d}),{});return{[f]:d}}}let c=t.theme.colors[e.value];if(typeof c==="string"){let a=o;if(Array.isArray(a))return a.reduce((l,u)=>({...l,[u]:c}),{});return{[a]:c}}if(c&&typeof c==="object"&&typeof c.DEFAULT==="string"){let a=o;if(Array.isArray(a))return a.reduce((l,u)=>({...l,[u]:c.DEFAULT}),{});return{[a]:c.DEFAULT}}if(e.value==="transparent"||e.value==="current"||e.value==="inherit"){let a=e.value==="current"?"currentColor":e.value,l=o;if(Array.isArray(l))return l.reduce((u,f)=>({...u,[f]:a}),{});return{[l]:a}}}return};function Xe(e,t){if(!e.value)return t.theme.borderRadius.DEFAULT;if(t.theme.borderRadius[e.value]!==void 0)return t.theme.borderRadius[e.value];if(e.arbitrary)return e.value;return}var Ml={t:["border-top-left-radius","border-top-right-radius"],r:["border-top-right-radius","border-bottom-right-radius"],b:["border-bottom-left-radius","border-bottom-right-radius"],l:["border-top-left-radius","border-bottom-left-radius"],tl:["border-top-left-radius"],tr:["border-top-right-radius"],bl:["border-bottom-left-radius"],br:["border-bottom-right-radius"],s:["border-start-start-radius","border-end-start-radius"],e:["border-start-end-radius","border-end-end-radius"],ss:["border-start-start-radius"],se:["border-start-end-radius"],es:["border-end-start-radius"],ee:["border-end-end-radius"]},Ky=(e,t)=>{if(e.utility==="rounded"){if(e.arbitrary&&e.value)return{"border-radius":e.value};if(e.value&&Ml[e.value]){let o=t.theme.borderRadius.DEFAULT,s={};for(let c of Ml[e.value])s[c]=o;return s}let i=e.value?t.theme.borderRadius[e.value]:t.theme.borderRadius.DEFAULT;return i?{"border-radius":i}:void 0}if(e.utility==="rounded-s"){let i=Xe(e,t);if(i===void 0)return;return{"border-start-start-radius":i,"border-end-start-radius":i}}if(e.utility==="rounded-e"){let i=Xe(e,t);if(i===void 0)return;return{"border-start-end-radius":i,"border-end-end-radius":i}}if(e.utility==="rounded-ss"){let i=Xe(e,t);if(i===void 0)return;return{"border-start-start-radius":i}}if(e.utility==="rounded-se"){let i=Xe(e,t);if(i===void 0)return;return{"border-start-end-radius":i}}if(e.utility==="rounded-es"){let i=Xe(e,t);if(i===void 0)return;return{"border-end-start-radius":i}}if(e.utility==="rounded-ee"){let i=Xe(e,t);if(i===void 0)return;return{"border-end-end-radius":i}}let n={"rounded-t":["border-top-left-radius","border-top-right-radius"],"rounded-r":["border-top-right-radius","border-bottom-right-radius"],"rounded-b":["border-bottom-left-radius","border-bottom-right-radius"],"rounded-l":["border-top-left-radius","border-bottom-left-radius"],"rounded-tl":["border-top-left-radius"],"rounded-tr":["border-top-right-radius"],"rounded-bl":["border-bottom-left-radius"],"rounded-br":["border-bottom-right-radius"]}[e.utility];if(n){let i=Xe(e,t);if(i===void 0)return;let o={};for(let s of n)o[s]=i;return o}},vi=[ui,Ca,Oy,Iy,Ny,jy,Uy,...Pl,By,Vy,...pa,...ma,...di,Dy,Fy,...na,...il,Cy,$y,Ry,ky,Sy,Ay,Ey,Ty,...va,...pl,...di,...Ka,...ba,zy,Wy,Ky,wy,xy,vy,by];function Ri(e,t){let r={...e};for(let n in t){let i=t[n],o=r[n];if(i&&typeof i==="object"&&!Array.isArray(i)&&o&&typeof o==="object"&&!Array.isArray(o))r[n]=Ri(o,i);else if(i!==void 0)r[n]=i}return r}var Hy={block:{display:"block"},"inline-block":{display:"inline-block"},inline:{display:"inline"},flex:{display:"flex"},"inline-flex":{display:"inline-flex"},grid:{display:"grid"},"inline-grid":{display:"inline-grid"},hidden:{display:"none"},none:{display:"none"}},Gy={"flex-row":{"flex-direction":"row"},"flex-row-reverse":{"flex-direction":"row-reverse"},"flex-col":{"flex-direction":"column"},"flex-col-reverse":{"flex-direction":"column-reverse"}},qy={"flex-wrap":{"flex-wrap":"wrap"},"flex-wrap-reverse":{"flex-wrap":"wrap-reverse"},"flex-nowrap":{"flex-wrap":"nowrap"}},Yy={"flex-1":{flex:"1 1 0%"},"flex-auto":{flex:"1 1 auto"},"flex-initial":{flex:"0 1 auto"},"flex-none":{flex:"none"}},Jy={grow:{"flex-grow":"1"},"grow-0":{"flex-grow":"0"},shrink:{"flex-shrink":"1"},"shrink-0":{"flex-shrink":"0"}},Xy={start:"flex-start",end:"flex-end",center:"center",between:"space-between",around:"space-around",evenly:"space-evenly","center-safe":"safe center","end-safe":"safe flex-end"},Zy={start:"flex-start",end:"flex-end",center:"center",baseline:"baseline",stretch:"stretch","center-safe":"safe center","end-safe":"safe flex-end"},Qy={normal:"normal",center:"center",start:"flex-start",end:"flex-end",between:"space-between",around:"space-around",evenly:"space-evenly",baseline:"baseline",stretch:"stretch","center-safe":"safe center","end-safe":"safe flex-end"},eb={auto:"auto",start:"flex-start",end:"flex-end",center:"center",stretch:"stretch",baseline:"baseline","center-safe":"safe center","end-safe":"safe flex-end"},tb={"border-solid":{"border-style":"solid"},"border-dashed":{"border-style":"dashed"},"border-dotted":{"border-style":"dotted"},"border-double":{"border-style":"double"},"border-none":{"border-style":"none"}},rb={transform:{transform:_t},"transform-cpu":{transform:_t},"transform-gpu":{transform:bi},"transform-none":{transform:"none"}},mt={"transition-timing-function":"cubic-bezier(0.4, 0, 0.2, 1)","transition-duration":"150ms"},nb={"transition-none":{"transition-property":"none"},"transition-all":{"transition-property":"all",...mt},transition:{"transition-property":"color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter",...mt},"transition-colors":{"transition-property":"color, background-color, border-color, text-decoration-color, fill, stroke",...mt},"transition-opacity":{"transition-property":"opacity",...mt},"transition-shadow":{"transition-property":"box-shadow",...mt},"transition-transform":{"transition-property":"transform",...mt}},ib={"ease-linear":{"transition-timing-function":"linear"},"ease-in":{"transition-timing-function":"cubic-bezier(0.4, 0, 1, 1)"},"ease-out":{"transition-timing-function":"cubic-bezier(0, 0, 0.2, 1)"},"ease-in-out":{"transition-timing-function":"cubic-bezier(0.4, 0, 0.2, 1)"}},ob={"animate-none":{animation:"none"},"animate-spin":{animation:"spin 1s linear infinite"},"animate-ping":{animation:"ping 1s cubic-bezier(0, 0, 0.2, 1) infinite"},"animate-pulse":{animation:"pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite"},"animate-bounce":{animation:"bounce 1s infinite"}},sb={spin:`@keyframes spin {
|
|
357
|
+
`.trim()};var ht={content:["./src/**/*.{html,js,ts,jsx,tsx,stx}"],output:"./dist/styles.css",minify:!0,watch:!1,theme:{colors:{inherit:"inherit",current:"currentColor",transparent:"transparent",black:"#000",white:"#fff",slate:{50:"oklch(98.4% 0.003 247.858)",100:"oklch(96.8% 0.007 247.896)",200:"oklch(92.9% 0.013 255.508)",300:"oklch(86.9% 0.022 252.894)",400:"oklch(70.4% 0.04 256.788)",500:"oklch(55.4% 0.046 257.417)",600:"oklch(44.6% 0.043 257.281)",700:"oklch(37.2% 0.044 257.287)",800:"oklch(27.9% 0.041 260.031)",900:"oklch(20.8% 0.042 265.755)",950:"oklch(12.9% 0.042 264.695)"},gray:{50:"oklch(98.5% 0.002 247.839)",100:"oklch(96.7% 0.003 264.542)",200:"oklch(92.8% 0.006 264.531)",300:"oklch(87.2% 0.01 258.338)",400:"oklch(70.7% 0.022 261.325)",500:"oklch(55.1% 0.027 264.364)",600:"oklch(44.6% 0.03 256.802)",700:"oklch(37.3% 0.034 259.733)",800:"oklch(27.8% 0.033 256.848)",900:"oklch(21% 0.034 264.665)",950:"oklch(13% 0.028 261.692)"},zinc:{50:"oklch(98.5% 0 0)",100:"oklch(96.7% 0.001 286.375)",200:"oklch(92% 0.004 286.32)",300:"oklch(87.1% 0.006 286.286)",400:"oklch(70.5% 0.015 286.067)",500:"oklch(55.2% 0.016 285.938)",600:"oklch(44.2% 0.017 285.786)",700:"oklch(37% 0.013 285.805)",800:"oklch(27.4% 0.006 286.033)",900:"oklch(21% 0.006 285.885)",950:"oklch(14.1% 0.005 285.823)"},neutral:{50:"oklch(98.5% 0 0)",100:"oklch(97% 0 0)",200:"oklch(92.2% 0 0)",300:"oklch(87% 0 0)",400:"oklch(70.8% 0 0)",500:"oklch(55.6% 0 0)",600:"oklch(43.9% 0 0)",700:"oklch(37.1% 0 0)",800:"oklch(26.9% 0 0)",900:"oklch(20.5% 0 0)",950:"oklch(14.5% 0 0)"},stone:{50:"oklch(98.5% 0.001 106.423)",100:"oklch(97% 0.001 106.424)",200:"oklch(92.3% 0.003 48.717)",300:"oklch(86.9% 0.005 56.366)",400:"oklch(70.9% 0.01 56.259)",500:"oklch(55.3% 0.013 58.071)",600:"oklch(44.4% 0.011 73.639)",700:"oklch(37.4% 0.01 67.558)",800:"oklch(26.8% 0.007 34.298)",900:"oklch(21.6% 0.006 56.043)",950:"oklch(14.7% 0.004 49.25)"},red:{50:"oklch(97.1% 0.013 17.38)",100:"oklch(93.6% 0.032 17.717)",200:"oklch(88.5% 0.062 18.334)",300:"oklch(80.8% 0.114 19.571)",400:"oklch(70.4% 0.191 22.216)",500:"oklch(63.7% 0.237 25.331)",600:"oklch(57.7% 0.245 27.325)",700:"oklch(50.5% 0.213 27.518)",800:"oklch(44.4% 0.177 26.899)",900:"oklch(39.6% 0.141 25.723)",950:"oklch(25.8% 0.092 26.042)"},orange:{50:"oklch(98% 0.016 73.684)",100:"oklch(95.4% 0.038 75.164)",200:"oklch(90.1% 0.076 70.697)",300:"oklch(83.7% 0.128 66.29)",400:"oklch(75% 0.183 55.934)",500:"oklch(70.5% 0.213 47.604)",600:"oklch(64.6% 0.222 41.116)",700:"oklch(55.3% 0.195 38.402)",800:"oklch(47% 0.157 37.304)",900:"oklch(40.8% 0.123 38.172)",950:"oklch(26.6% 0.079 36.259)"},amber:{50:"oklch(98.7% 0.022 95.277)",100:"oklch(96.2% 0.059 95.617)",200:"oklch(92.4% 0.12 95.746)",300:"oklch(87.9% 0.169 91.605)",400:"oklch(82.8% 0.189 84.429)",500:"oklch(76.9% 0.188 70.08)",600:"oklch(66.6% 0.179 58.318)",700:"oklch(55.5% 0.163 48.998)",800:"oklch(47.3% 0.137 46.201)",900:"oklch(41.4% 0.112 45.904)",950:"oklch(27.9% 0.077 45.635)"},yellow:{50:"oklch(98.7% 0.026 102.212)",100:"oklch(97.3% 0.071 103.193)",200:"oklch(94.5% 0.129 101.54)",300:"oklch(90.5% 0.182 98.111)",400:"oklch(85.2% 0.199 91.936)",500:"oklch(79.5% 0.184 86.047)",600:"oklch(68.1% 0.162 75.834)",700:"oklch(55.4% 0.135 66.442)",800:"oklch(47.6% 0.114 61.907)",900:"oklch(42.1% 0.095 57.708)",950:"oklch(28.6% 0.066 53.813)"},lime:{50:"oklch(98.6% 0.031 120.757)",100:"oklch(96.7% 0.067 122.328)",200:"oklch(93.8% 0.127 124.321)",300:"oklch(89.7% 0.196 126.665)",400:"oklch(84.1% 0.238 128.85)",500:"oklch(76.8% 0.233 130.85)",600:"oklch(64.8% 0.2 131.684)",700:"oklch(53.2% 0.157 131.589)",800:"oklch(45.3% 0.124 130.933)",900:"oklch(40.5% 0.101 131.063)",950:"oklch(27.4% 0.072 132.109)"},green:{50:"oklch(98.2% 0.018 155.826)",100:"oklch(96.2% 0.044 156.743)",200:"oklch(92.5% 0.084 155.995)",300:"oklch(87.1% 0.15 154.449)",400:"oklch(79.2% 0.209 151.711)",500:"oklch(72.3% 0.219 149.579)",600:"oklch(62.7% 0.194 149.214)",700:"oklch(52.7% 0.154 150.069)",800:"oklch(44.8% 0.119 151.328)",900:"oklch(39.3% 0.095 152.535)",950:"oklch(26.6% 0.065 152.934)"},emerald:{50:"oklch(97.9% 0.021 166.113)",100:"oklch(95% 0.052 163.051)",200:"oklch(90.5% 0.093 164.15)",300:"oklch(84.5% 0.143 164.978)",400:"oklch(76.5% 0.177 163.223)",500:"oklch(69.6% 0.17 162.48)",600:"oklch(59.6% 0.145 163.225)",700:"oklch(50.8% 0.118 165.612)",800:"oklch(43.2% 0.095 166.913)",900:"oklch(37.8% 0.077 168.94)",950:"oklch(26.2% 0.051 172.552)"},teal:{50:"oklch(98.4% 0.014 180.72)",100:"oklch(95.3% 0.051 180.801)",200:"oklch(91% 0.096 180.426)",300:"oklch(85.5% 0.138 181.071)",400:"oklch(77.7% 0.152 181.912)",500:"oklch(70.4% 0.14 182.503)",600:"oklch(60% 0.118 184.704)",700:"oklch(51.1% 0.096 186.391)",800:"oklch(43.7% 0.078 188.216)",900:"oklch(38.6% 0.063 188.416)",950:"oklch(27.7% 0.046 192.524)"},cyan:{50:"oklch(98.4% 0.019 200.873)",100:"oklch(95.6% 0.045 203.388)",200:"oklch(91.7% 0.08 205.041)",300:"oklch(86.5% 0.127 207.078)",400:"oklch(78.9% 0.154 211.53)",500:"oklch(71.5% 0.143 215.221)",600:"oklch(60.9% 0.126 221.723)",700:"oklch(52% 0.105 223.128)",800:"oklch(45% 0.085 224.283)",900:"oklch(39.8% 0.07 227.392)",950:"oklch(30.2% 0.056 229.695)"},sky:{50:"oklch(97.7% 0.013 236.62)",100:"oklch(95.1% 0.026 236.824)",200:"oklch(90.1% 0.058 230.902)",300:"oklch(82.8% 0.111 230.318)",400:"oklch(74.6% 0.16 232.661)",500:"oklch(68.5% 0.169 237.323)",600:"oklch(58.8% 0.158 241.966)",700:"oklch(50% 0.134 242.749)",800:"oklch(44.3% 0.11 240.79)",900:"oklch(39.1% 0.09 240.876)",950:"oklch(29.3% 0.066 243.157)"},blue:{50:"oklch(97% 0.014 254.604)",100:"oklch(93.2% 0.032 255.585)",200:"oklch(88.2% 0.059 254.128)",300:"oklch(80.9% 0.105 251.813)",400:"oklch(70.7% 0.165 254.624)",500:"oklch(62.3% 0.214 259.815)",600:"oklch(54.6% 0.245 262.881)",700:"oklch(48.8% 0.243 264.376)",800:"oklch(42.4% 0.199 265.638)",900:"oklch(37.9% 0.146 265.522)",950:"oklch(28.2% 0.091 267.935)"},indigo:{50:"oklch(96.2% 0.018 272.314)",100:"oklch(93% 0.034 272.788)",200:"oklch(87% 0.065 274.039)",300:"oklch(78.5% 0.115 274.713)",400:"oklch(67.3% 0.182 276.935)",500:"oklch(58.5% 0.233 277.117)",600:"oklch(51.1% 0.262 276.966)",700:"oklch(45.7% 0.24 277.023)",800:"oklch(39.8% 0.195 277.366)",900:"oklch(35.9% 0.144 278.697)",950:"oklch(25.7% 0.09 281.288)"},violet:{50:"oklch(96.9% 0.016 293.756)",100:"oklch(94.3% 0.029 294.588)",200:"oklch(89.4% 0.057 293.283)",300:"oklch(81.1% 0.111 293.571)",400:"oklch(70.2% 0.183 293.541)",500:"oklch(60.6% 0.25 292.717)",600:"oklch(54.1% 0.281 293.009)",700:"oklch(49.1% 0.27 292.581)",800:"oklch(43.2% 0.232 292.759)",900:"oklch(38% 0.189 293.745)",950:"oklch(28.3% 0.141 291.089)"},purple:{50:"oklch(97.7% 0.014 308.299)",100:"oklch(94.6% 0.033 307.174)",200:"oklch(90.2% 0.063 306.703)",300:"oklch(82.7% 0.119 306.383)",400:"oklch(71.4% 0.203 305.504)",500:"oklch(62.7% 0.265 303.9)",600:"oklch(55.8% 0.288 302.321)",700:"oklch(49.6% 0.265 301.924)",800:"oklch(43.8% 0.218 303.724)",900:"oklch(38.1% 0.176 304.987)",950:"oklch(29.1% 0.149 302.717)"},fuchsia:{50:"oklch(97.7% 0.017 320.058)",100:"oklch(95.2% 0.037 318.852)",200:"oklch(90.3% 0.076 319.62)",300:"oklch(83.3% 0.145 321.434)",400:"oklch(74% 0.238 322.16)",500:"oklch(66.7% 0.295 322.15)",600:"oklch(59.1% 0.293 322.896)",700:"oklch(51.8% 0.253 323.949)",800:"oklch(45.2% 0.211 324.591)",900:"oklch(40.1% 0.17 325.612)",950:"oklch(29.3% 0.136 325.661)"},pink:{50:"oklch(97.1% 0.014 343.198)",100:"oklch(94.8% 0.028 342.258)",200:"oklch(89.9% 0.061 343.231)",300:"oklch(82.3% 0.12 346.018)",400:"oklch(71.8% 0.202 349.761)",500:"oklch(65.6% 0.241 354.308)",600:"oklch(59.2% 0.249 0.584)",700:"oklch(52.5% 0.223 3.958)",800:"oklch(45.9% 0.187 3.815)",900:"oklch(40.8% 0.153 2.432)",950:"oklch(28.4% 0.109 3.907)"},rose:{50:"oklch(96.9% 0.015 12.422)",100:"oklch(94.1% 0.03 12.58)",200:"oklch(89.2% 0.058 10.001)",300:"oklch(81% 0.117 11.638)",400:"oklch(71.2% 0.194 13.428)",500:"oklch(64.5% 0.246 16.439)",600:"oklch(58.6% 0.253 17.585)",700:"oklch(51.4% 0.222 16.935)",800:"oklch(45.5% 0.188 13.697)",900:"oklch(41% 0.159 10.272)",950:"oklch(27.1% 0.105 12.094)"}},spacing:{0:"0",px:"1px",0.5:"0.125rem",1:"0.25rem",1.5:"0.375rem",2:"0.5rem",2.5:"0.625rem",3:"0.75rem",3.5:"0.875rem",4:"1rem",5:"1.25rem",6:"1.5rem",7:"1.75rem",8:"2rem",9:"2.25rem",10:"2.5rem",11:"2.75rem",12:"3rem",14:"3.5rem",16:"4rem",20:"5rem",24:"6rem",28:"7rem",32:"8rem",36:"9rem",40:"10rem",44:"11rem",48:"12rem",52:"13rem",56:"14rem",60:"15rem",64:"16rem",72:"18rem",80:"20rem",96:"24rem"},fontSize:{xs:["0.75rem",{lineHeight:"1rem"}],sm:["0.875rem",{lineHeight:"1.25rem"}],base:["1rem",{lineHeight:"1.5rem"}],lg:["1.125rem",{lineHeight:"1.75rem"}],xl:["1.25rem",{lineHeight:"1.75rem"}],"2xl":["1.5rem",{lineHeight:"2rem"}],"3xl":["1.875rem",{lineHeight:"2.25rem"}],"4xl":["2.25rem",{lineHeight:"2.5rem"}],"5xl":["3rem",{lineHeight:"1"}],"6xl":["3.75rem",{lineHeight:"1"}],"7xl":["4.5rem",{lineHeight:"1"}],"8xl":["6rem",{lineHeight:"1"}],"9xl":["8rem",{lineHeight:"1"}]},fontFamily:{sans:["ui-sans-serif","system-ui","sans-serif"],serif:["ui-serif","Georgia","serif"],mono:["ui-monospace","monospace"]},screens:{sm:"640px",md:"768px",lg:"1024px",xl:"1280px","2xl":"1536px"},containers:{"3xs":"16rem","2xs":"18rem",xs:"20rem",sm:"24rem",md:"28rem",lg:"32rem",xl:"36rem","2xl":"42rem","3xl":"48rem","4xl":"56rem","5xl":"64rem","6xl":"72rem","7xl":"80rem"},borderRadius:{none:"0",xs:"0.125rem",sm:"0.25rem",DEFAULT:"0.25rem",md:"0.375rem",lg:"0.5rem",xl:"0.75rem","2xl":"1rem","3xl":"1.5rem","4xl":"2rem",full:"9999px"},boxShadow:{"2xs":"0 1px rgb(0 0 0 / 0.05)",xs:"0 1px 2px 0 rgb(0 0 0 / 0.05)",sm:"0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1)",DEFAULT:"0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1)",md:"0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1)",lg:"0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1)",xl:"0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1)","2xl":"0 25px 50px -12px rgb(0 0 0 / 0.25)",inner:"inset 0 2px 4px 0 rgb(0 0 0 / 0.05)",none:"none"}},shortcuts:{},rules:[],attributify:{enabled:!1,prefix:"tc-",ignoreAttributes:["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"]},bracketSyntax:{enabled:!1,colonSyntax:!1,aliases:{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"}},variants:{responsive:!0,hover:!0,focus:!0,active:!0,disabled:!0,dark:!0,light:!0,group:!0,peer:!0,"*":!0,"**":!0,in:!0,before:!0,after:!0,marker:!0,"first-letter":!0,"first-line":!0,backdrop:!0,"details-content":!0,first:!0,last:!0,odd:!0,even:!0,"first-of-type":!0,"last-of-type":!0,visited:!0,checked:!0,"focus-within":!0,"focus-visible":!0,placeholder:!0,selection:!0,file:!0,required:!0,valid:!0,invalid:!0,"read-only":!0,autofill:!0,"user-valid":!0,"user-invalid":!0,"in-range":!0,"out-of-range":!0,"placeholder-shown":!0,open:!0,closed:!0,empty:!0,enabled:!0,only:!0,target:!0,indeterminate:!0,default:!0,optional:!0,inert:!0,"only-of-type":!0,aria:!0,data:!0,has:!0,not:!0,supports:!0,print:!0,landscape:!0,portrait:!0,"forced-colors":!0,"pointer-none":!0,"pointer-coarse":!0,"pointer-fine":!0,"any-pointer-none":!0,"any-pointer-coarse":!0,"any-pointer-fine":!0,"inverted-colors":!0,noscript:!0,starting:!0,rtl:!0,ltr:!0,"motion-safe":!0,"motion-reduce":!0,"contrast-more":!0,"contrast-less":!0},safelist:[],blocklist:[],preflights:[Xt],presets:[],cssVariables:!1},fi=null;async function ra(){if(!fi){await Promise.resolve().then(() => ta());fi=await ea({name:"css",defaultConfig:ht})}return fi}var di=ht;function Oe(e){if(e.indexOf("/")===-1)return-1;let r=0,n=0,i="";for(let o=0;o<e.length;o++){let s=e[o];if(s==="\\"){o++;continue}if(i){if(s===i)i="";continue}if(s==='"'||s==="'"){i=s;continue}if(s==="(")r++;else if(s===")")r=Math.max(0,r-1);else if(s==="[")n++;else if(s==="]")n=Math.max(0,n-1);else if(s==="/"&&r===0&&n===0)return o}return-1}var _r="0 0 #0000",_h=["inset-shadow","inset-ring-shadow","ring-offset-shadow","ring-shadow","shadow"],V=_h.map((e)=>`var(--tc-${e}, 0 0 #0000)`).join(", ");var Lr={"0":"0",full:"100%",min:"min-content",max:"max-content",fit:"fit-content",none:"none",xs:"20rem",sm:"24rem",md:"28rem",lg:"32rem",xl:"36rem","2xl":"42rem","3xl":"48rem","4xl":"56rem","5xl":"64rem","6xl":"72rem","7xl":"80rem",screen:"100vw"},Lh={...Lr,prose:"65ch"};function oa(e,t,r){let n=e.value;if(t[n])return{[r]:t[n]};if(e.arbitrary)return{[r]:n};if(/^\d+$/.test(n)){let i=Number.parseInt(n,10);if(i>=0&&i<=100)return{[r]:`${i/100}`}}return}var Mh=(e,t)=>{if(e.utility==="min-w"&&e.value){let r=pe(e,t,Lr);return r!==void 0?{"min-width":r}:void 0}if(e.utility==="max-w"&&e.value){let r=pe(e,t,Lh);return r!==void 0?{"max-width":r}:void 0}if(e.utility==="min-h"&&e.value){let r={...Lr,screen:"100vh"},n=pe(e,t,r);return n!==void 0?{"min-height":n}:void 0}if(e.utility==="max-h"&&e.value){let r={...Lr,screen:"100vh"},n=pe(e,t,r);return n!==void 0?{"max-height":n}:void 0}},Fh=(e,t)=>{if(e.utility==="ring"){if(e.value==="inset")return{"--tc-ring-inset":"inset"};if(e.value){let i=z(e.value,t,e.modifierArbitrary);if(i)return{"--tc-ring-color":i}}let r={0:"0",1:"1px",2:"2px",4:"4px",8:"8px",DEFAULT:"1px"},n;if(!e.value)n=r.DEFAULT;else if(r[e.value])n=r[e.value];else if(e.arbitrary)n=e.value;else if(/^\d+(?:\.\d+)?$/.test(e.value))n=`${e.value}px`;if(n===void 0)return;return{"--tc-ring-offset-shadow":"var(--tc-ring-inset,) 0 0 0 var(--tc-ring-offset-width, 0px) var(--tc-ring-offset-color, #fff)","--tc-ring-shadow":`var(--tc-ring-inset,) 0 0 0 calc(${n} + var(--tc-ring-offset-width, 0px)) var(--tc-ring-color, currentcolor)`,"box-shadow":V}}if(e.utility==="ring-offset"&&e.value){let r={0:"0px",1:"1px",2:"2px",4:"4px",8:"8px"};if(r[e.value])return{"--tc-ring-offset-width":r[e.value]};let n=z(e.value,t,e.modifierArbitrary);if(n)return{"--tc-ring-offset-color":n}}if(e.utility==="ring-opacity"&&e.value)return oa(e,{0:"0",5:"0.05",10:"0.1",20:"0.2",25:"0.25",30:"0.3",40:"0.4",50:"0.5",60:"0.6",70:"0.7",75:"0.75",80:"0.8",90:"0.9",95:"0.95",100:"1"},"--tc-ring-opacity")},Dh=(e)=>{if(e.utility==="border-opacity"&&e.value)return oa(e,{0:"0",5:"0.05",10:"0.1",20:"0.2",25:"0.25",30:"0.3",40:"0.4",50:"0.5",60:"0.6",70:"0.7",75:"0.75",80:"0.8",90:"0.9",95:"0.95",100:"1"},"--tc-border-opacity")};function na(e,t){let r=e.value;if(e.arbitrary)return r;let n=r.startsWith("-"),i=n?r.slice(1):r,o=t.theme.spacing[i];if(o===void 0&&/^\d+(?:\.\d+)?$/.test(i))o=`${Number.parseFloat(i)*0.25}rem`;if(o===void 0)return;return n?`-${o}`:o}var jh=(e,t)=>{if(e.utility==="space-x"&&e.value){if(e.value==="reverse")return{properties:{"--tc-space-x-reverse":"1"},childSelector:"> :not([hidden]) ~ :not([hidden])"};let r=na(e,t);if(r===void 0)return;return{properties:{"--tc-space-x-reverse":"0","margin-right":`calc(${r} * var(--tc-space-x-reverse))`,"margin-left":`calc(${r} * calc(1 - var(--tc-space-x-reverse)))`},childSelector:"> :not([hidden]) ~ :not([hidden])"}}if(e.utility==="space-y"&&e.value){if(e.value==="reverse")return{properties:{"--tc-space-y-reverse":"1"},childSelector:"> :not([hidden]) ~ :not([hidden])"};let r=na(e,t);if(r===void 0)return;return{properties:{"--tc-space-y-reverse":"0","margin-top":`calc(${r} * calc(1 - var(--tc-space-y-reverse)))`,"margin-bottom":`calc(${r} * var(--tc-space-y-reverse))`},childSelector:"> :not([hidden]) ~ :not([hidden])"}}},Bh=(e)=>{if(e.utility==="border"&&e.value){let t={solid:"solid",dashed:"dashed",dotted:"dotted",double:"double",hidden:"hidden",none:"none"};if(t[e.value])return{"border-style":t[e.value]}}};function ia(e){if(!e.value)return"1px";let t={0:"0",2:"2px",4:"4px",8:"8px"};if(t[e.value])return t[e.value];if(e.arbitrary)return e.value;if(/^\d+(?:\.\d+)?$/.test(e.value))return`${e.value}px`;return}function Uh(e){let t=Oe(e),r=t===-1?e:e.slice(0,t);if(r.charCodeAt(0)!==91||r.charCodeAt(r.length-1)!==93)return e;let n=r.slice(1,-1).replace(/_/g," ");return t===-1?n:n+e.slice(t)}var Vh=(e,t)=>{if(e.utility==="divide"&&e.value){let r={solid:"solid",dashed:"dashed",dotted:"dotted",double:"double",none:"none"};if(r[e.value])return{properties:{"border-style":r[e.value]},childSelector:"> :not([hidden]) ~ :not([hidden])"}}if(e.utility==="divide-x"){if(e.value==="reverse")return{properties:{"--tc-divide-x-reverse":"1"},childSelector:"> :not([hidden]) ~ :not([hidden])"};let r=ia(e);if(r===void 0)return;return{properties:{"--tc-divide-x-reverse":"0","border-right-width":`calc(${r} * var(--tc-divide-x-reverse))`,"border-left-width":`calc(${r} * calc(1 - var(--tc-divide-x-reverse)))`},childSelector:"> :not([hidden]) ~ :not([hidden])"}}if(e.utility==="divide-y"){if(e.value==="reverse")return{properties:{"--tc-divide-y-reverse":"1"},childSelector:"> :not([hidden]) ~ :not([hidden])"};let r=ia(e);if(r===void 0)return;return{properties:{"--tc-divide-y-reverse":"0","border-top-width":`calc(${r} * calc(1 - var(--tc-divide-y-reverse)))`,"border-bottom-width":`calc(${r} * var(--tc-divide-y-reverse))`},childSelector:"> :not([hidden]) ~ :not([hidden])"}}if(e.utility==="divide"&&e.value){let r=Uh(e.value);if(r==="auto")return;let n=z(r,t,e.modifierArbitrary);if(n!==void 0)return{properties:{"border-color":n},childSelector:"> :not([hidden]) ~ :not([hidden])"}}},Wh=(e,t)=>{let r=(n)=>{let i=null,o=n,s=Oe(n);if(s!==-1){o=n.slice(0,s);let u=n.slice(s+1);if(u.startsWith("[")&&u.endsWith("]"))i=u.slice(1,-1);else if(e.modifierArbitrary){let f=Number.parseFloat(u);if(!Number.isNaN(f)&&f>=0&&f<=1)i=f.toString()}else{let f=Number.parseInt(u,10);if(!Number.isNaN(f))i=(f/100).toString()}}let c=(u)=>{if(!i)return u;let f=u.match(/^(oklch|rgb|hsl|oklab|lab|lch)\(([^)]+)\)$/i);if(f){let d=f[1],h=f[2].split("/")[0].trim();return`${d}(${h} / ${i})`}if(/^#[0-9a-f]{3,8}$/i.test(u)){let d=u.replace("#",""),h=(y)=>Number.parseInt(y.length===1?y+y:y,16),m=h(d.slice(0,d.length===3?1:2)),g=h(d.slice(d.length===3?1:2,d.length===3?2:4)),p=h(d.slice(d.length===3?2:4,d.length===3?3:6));return`rgb(${m} ${g} ${p} / ${i})`}return`color-mix(in srgb, ${u} ${Math.round(Number.parseFloat(i)*100)}%, transparent)`};if(o.startsWith("[")&&o.endsWith("]"))o=o.slice(1,-1);let a=t.theme.colors[o];if(typeof a==="string")return c(W(o,a,o,t.colorVariables));if(typeof a==="object"&&a!==null&&typeof a.DEFAULT==="string")return c(W(o,a.DEFAULT,o,t.colorVariables));let l=o.split("-");if(l.length>=2){let u=l.slice(0,-1).join("-"),f=l[l.length-1],d=t.theme.colors[u];if(typeof d==="object"&&d[f])return c(W(o,d[f],u,t.colorVariables))}if(e.arbitrary||o.startsWith("#")||/^(?:var|rgb|rgba|hsl|hsla|oklch|oklab|lab|lch|color|color-mix)\(/.test(o))return c(o);return};if(e.utility==="from"&&e.value){let n=r(e.value);if(n===void 0)return;return{"--tc-gradient-from":n,"--tc-gradient-to":"rgb(255 255 255 / 0)","--tc-gradient-stops":"var(--tc-gradient-from), var(--tc-gradient-to)"}}if(e.utility==="via"&&e.value){let n=r(e.value);if(n===void 0)return;return{"--tc-gradient-to":"rgb(255 255 255 / 0)","--tc-gradient-stops":`var(--tc-gradient-from), ${n}, var(--tc-gradient-to)`}}if(e.utility==="to"&&e.value){let n=r(e.value);if(n===void 0)return;return{"--tc-gradient-to":n,"--tc-gradient-stops":"var(--tc-gradient-from), var(--tc-gradient-to)"}}},zh=(e)=>{if(e.utility==="order"&&e.value){let t={first:"-9999",last:"9999",none:"0"};if(t[e.value])return{order:t[e.value]};if(e.arbitrary||/^-?\d+$/.test(e.value))return{order:e.value};return}},Kh=(e,t)=>{if(e.utility==="basis"&&e.value){let r={auto:"auto",full:"100%",0:"0"};if(r[e.value])return{"flex-basis":r[e.value]};let n=pe(e,t,{});return n!==void 0?{"flex-basis":n}:void 0}},Hh=(e)=>{if(e.utility==="justify-self"){let t={auto:"auto",start:"start",end:"end",center:"center",stretch:"stretch"};return e.value&&t[e.value]?{"justify-self":t[e.value]}:void 0}},Gh=(e)=>{if(e.utility==="self"){let t={auto:"auto",start:"flex-start",end:"flex-end",center:"center",stretch:"stretch",baseline:"baseline"};return e.value&&t[e.value]?{"align-self":t[e.value]}:void 0}},qh=(e,t)=>{if(e.utility==="container"){if(!e.value)return{width:"100%","margin-left":"auto","margin-right":"auto","max-width":t.theme.screens.xl||"1280px"};let r={sm:t.theme.screens.sm||"640px",md:t.theme.screens.md||"768px",lg:t.theme.screens.lg||"1024px",xl:t.theme.screens.xl||"1280px","2xl":t.theme.screens["2xl"]||"1536px",full:"100%",prose:"65ch","3xl":"1920px"};if(r[e.value])return{width:"100%","margin-left":"auto","margin-right":"auto","max-width":r[e.value]};if(e.arbitrary)return{width:"100%","margin-left":"auto","margin-right":"auto","max-width":e.value}}},hi=(e)=>{if(e.arbitrary&&e.utility&&e.value&&e.base.startsWith("["))return{[e.utility]:e.value}},sa=[Mh,Fh,Dh,Bh,jh,Vh,Wh,zh,Kh,Hh,Gh,qh,hi];var aa={"bg-origin-border":"border-box","bg-origin-padding":"padding-box","bg-origin-content":"content-box"},la={"bg-bottom":"bottom","bg-center":"center","bg-left":"left","bg-left-bottom":"left bottom","bg-left-top":"left top","bg-right":"right","bg-right-bottom":"right bottom","bg-right-top":"right top","bg-top":"top"},ca={"bg-repeat":"repeat","bg-no-repeat":"no-repeat","bg-repeat-x":"repeat-x","bg-repeat-y":"repeat-y","bg-repeat-round":"round","bg-repeat-space":"space"},ua={"bg-auto":"auto","bg-cover":"cover","bg-contain":"contain"},gi=null,fa=null;function Yh(e){let t=new Map;for(let[r,n]of Object.entries(e))if(typeof n==="string")t.set(r,n);else if(typeof n==="object"&&n!==null){for(let[i,o]of Object.entries(n))if(typeof o==="string")t.set(i==="DEFAULT"?r:`${r}-${i}`,o)}return t}function Jh(e){return e.replace(/rgba?\([^)]+\)/g,"var(--tc-shadow-color)")}var Xh=(e)=>{if(e.utility==="bg"&&e.value){let t={fixed:"fixed",local:"local",scroll:"scroll"};return t[e.value]?{"background-attachment":t[e.value]}:void 0}return},Zh=(e)=>{if(e.utility==="bg"&&e.value&&e.value.startsWith("clip-")){let t=e.value.replace("clip-",""),r={border:"border-box",padding:"padding-box",content:"content-box",text:"text"};return r[t]?{"background-clip":r[t]}:void 0}return},da={t:"to top",tr:"to top right",r:"to right",br:"to bottom right",b:"to bottom",bl:"to bottom left",l:"to left",tl:"to top left"},Qh=new Set(["srgb","srgb-linear","oklab","oklch","lab","lch","hsl","hwb","xyz","xyz-d50","xyz-d65","display-p3","a98-rgb","prophoto-rgb","rec2020"]),eg=new Set(["shorter","longer","increasing","decreasing"]);function tg(e){if(Qh.has(e))return`in ${e}`;if(eg.has(e))return`in oklch ${e} hue`;return}var rg=(e)=>{if(e.utility!=="bg"||!e.value||e.arbitrary||e.typeHint)return;if(e.value.includes("("))return;let t=e.value.lastIndexOf("/"),r=t===-1?e.value:e.value.slice(0,t),n=t===-1?void 0:e.value.slice(t+1),i;if(n!==void 0){if(i=tg(n),i===void 0)return}let o=r.charCodeAt(0)===45,s=o?r.slice(1):r,c,a="";if(s==="conic")c="conic-gradient";else if(s==="radial")c="radial-gradient";else if(s.startsWith("conic-")){let u=s.slice(6);if(!/^\d+(?:\.\d+)?$/.test(u))return;c="conic-gradient",a=`from ${o?"-":""}${u}deg`}else if(s.startsWith("linear-")||s.startsWith("gradient-")){let u=s.slice(s.indexOf("-")+1);if(c="linear-gradient",u.startsWith("to-")){let f=da[u.slice(3)];if(f===void 0)return;a=f}else if(/^\d+(?:\.\d+)?$/.test(u))a=`${o?"-":""}${u}deg`;else return}else return;if(!a&&i===void 0)return;let l=[a,i].filter(Boolean).join(" ");return{"background-image":l?`${c}(${l}, var(--tc-gradient-stops))`:`${c}(var(--tc-gradient-stops))`}},ng=(e)=>{if(!e.value)return;let t;if(e.utility==="bg-linear"||e.utility==="bg-gradient")t=e.value;else if(e.utility==="bg"){if(e.typeHint||e.value.includes("("))return;let r=e.value.startsWith("-"),i=(r?e.value.slice(1):e.value).match(/^(?:gradient|linear)-(.+)$/);if(!i)return;t=r?`-${i[1]}`:i[1]}else return;if(t.startsWith("to-")){let r=da[t.slice(3)];return r?{"background-image":`linear-gradient(${r}, var(--tc-gradient-stops))`}:void 0}if(e.arbitrary)return{"background-image":`linear-gradient(${t}, var(--tc-gradient-stops))`};if(/^-?\d+(?:\.\d+)?$/.test(t))return{"background-image":`linear-gradient(${t}deg, var(--tc-gradient-stops))`};return},ig=(e)=>aa[e.base]?{"background-origin":aa[e.base]}:void 0,og=(e)=>la[e.base]?{"background-position":la[e.base]}:void 0,sg=(e)=>ca[e.base]?{"background-repeat":ca[e.base]}:void 0,ag=(e)=>ua[e.base]?{"background-size":ua[e.base]}:void 0,lg=(e)=>{if(e.utility==="border"&&e.value){let t={solid:"solid",dashed:"dashed",dotted:"dotted",double:"double",hidden:"hidden",none:"none"};return t[e.value]?{"border-style":t[e.value]}:void 0}return},cg=(e,t)=>{if(e.utility==="outline-offset"&&e.value){let r={0:"0px",1:"1px",2:"2px",4:"4px",8:"8px"};if(r[e.value])return{"outline-offset":r[e.value]};if(e.arbitrary)return{"outline-offset":e.value};if(/^\d+(?:\.\d+)?$/.test(e.value))return{"outline-offset":`${e.value}px`};return}if(e.utility==="outline"&&e.value){let r={none:"none",solid:"solid",dashed:"dashed",dotted:"dotted",double:"double"};if(r[e.value])return{"outline-style":r[e.value]};if(e.value==="hidden")return{outline:"2px solid transparent","outline-offset":"2px"}}if(e.utility==="outline"){if(!e.value)return{"outline-width":"1px"};let r=z(e.value,t,e.modifierArbitrary);if(r)return{"outline-color":r};let n={0:"0px",1:"1px",2:"2px",4:"4px",8:"8px"};if(n[e.value])return{"outline-width":n[e.value]};if(e.arbitrary)return{"outline-width":e.value};if(/^\d+(?:\.\d+)?$/.test(e.value))return{"outline-width":`${e.value}px`};return}},ug=(e,t)=>{if(e.utility==="shadow"){let n=e.arbitrary&&!!e.value&&(/\s/.test(e.value)||e.value==="none")?e.value:e.value?t.theme.boxShadow[e.value]:t.theme.boxShadow.DEFAULT;if(!n)return;if(n==="none")return{"--tc-shadow":_r,"box-shadow":V};let i=Jh(n);return{"--tc-shadow":n,"--tc-shadow-colored":i,"box-shadow":V}}},fg=(e,t)=>{if(e.utility!=="shadow"||!e.value)return;if(t.theme.boxShadow[e.value])return;if(e.arbitrary&&/\s/.test(e.value))return;if(gi===null||fa!==t.theme.colors)gi=Yh(t.theme.colors),fa=t.theme.colors;let r=e.value,n=Oe(r),i,o;if(n!==-1){i=r.slice(0,n);let a=r.slice(n+1);if(a.charCodeAt(0)===91&&a.charCodeAt(a.length-1)===93){let l=Number.parseFloat(a.slice(1,-1));if(Number.isNaN(l)||l<0||l>1)return;o=l}else if(e.modifierArbitrary){let l=Number.parseFloat(a);if(Number.isNaN(l)||l<0||l>1)return;o=l}else{let l=Number.parseInt(a,10);if(Number.isNaN(l)||l<0||l>100)return;o=l/100}}else i=r;let s=gi.get(i)??(e.arbitrary?i:void 0);if(!s)return;return{"--tc-shadow-color":o!==void 0?we(s,o):s,"--tc-shadow":"var(--tc-shadow-colored)"}};function _t(e){return`${e} var(--tc-text-shadow-color, rgba(0, 0, 0, 0.05))`}var dg=(e,t)=>{if(e.utility!=="text-shadow")return;let r={sm:_t("0 1px 2px"),DEFAULT:_t("0 1px 3px"),md:_t("0 4px 6px"),lg:_t("0 10px 15px"),xl:_t("0 20px 25px"),none:"none"};if(!e.value)return{"text-shadow":r.DEFAULT};if(r[e.value])return{"text-shadow":r[e.value]};if(e.arbitrary&&e.value){if(/\s/.test(e.value))return{"text-shadow":e.value};return{"--tc-text-shadow-color":e.value}}let n=z(e.value,t,e.modifierArbitrary);return n===void 0?void 0:{"--tc-text-shadow-color":n}},hg=(e)=>{if(e.utility==="opacity"&&e.value){let t={0:"0",5:"0.05",10:"0.1",20:"0.2",25:"0.25",30:"0.3",40:"0.4",50:"0.5",60:"0.6",70:"0.7",75:"0.75",80:"0.8",90:"0.9",95:"0.95",100:"1"};if(t[e.value])return{opacity:t[e.value]};if(e.arbitrary)return{opacity:e.value};if(/^\d+$/.test(e.value)){let r=Number.parseInt(e.value,10);if(r>=0&&r<=100)return{opacity:`${r/100}`}}return}},gg=(e)=>{if(e.utility==="mix-blend"){let t=["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"];return e.value&&t.includes(e.value)?{"mix-blend-mode":e.value}:void 0}},mg=(e)=>{if(e.utility==="bg-blend"){let t=["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"];return e.value&&t.includes(e.value)?{"background-blend-mode":e.value}:void 0}},pg=(e)=>{if(e.utility==="mask-clip"&&e.value){let t={border:"border-box",padding:"padding-box",content:"content-box",text:"text",fill:"fill-box",stroke:"stroke-box",view:"view-box","no-clip":"no-clip"};if(t[e.value])return{"mask-clip":t[e.value]};return e.arbitrary?{"mask-clip":e.value}:void 0}if(e.utility==="mask-composite"&&e.value)return["add","subtract","intersect","exclude"].includes(e.value)?{"mask-composite":e.value}:void 0;if(e.utility==="mask-image"&&e.value){if(e.value==="none")return{"mask-image":"none"};if(e.arbitrary)return{"mask-image":e.value.startsWith("url(")||e.value.includes("gradient(")?e.value:`url(${e.value})`};return}if(e.utility==="mask-mode"&&e.value)return["alpha","luminance","match-source"].includes(e.value)?{"mask-mode":e.value}:void 0;if(e.utility==="mask-origin"&&e.value){let t={border:"border-box",padding:"padding-box",content:"content-box",fill:"fill-box",stroke:"stroke-box",view:"view-box"};if(t[e.value])return{"mask-origin":t[e.value]};return e.arbitrary?{"mask-origin":e.value}:void 0}if(e.utility==="mask-position"&&e.value){let t={center:"center",top:"top",right:"right",bottom:"bottom",left:"left","top-left":"top left","top-right":"top right","bottom-left":"bottom left","bottom-right":"bottom right"};if(t[e.value])return{"mask-position":t[e.value]};return e.arbitrary?{"mask-position":e.value}:void 0}if(e.utility==="mask-repeat"&&e.value){let t={repeat:"repeat","no-repeat":"no-repeat","repeat-x":"repeat-x","repeat-y":"repeat-y",round:"round",space:"space"};if(t[e.value])return{"mask-repeat":t[e.value]};return e.arbitrary?{"mask-repeat":e.value}:void 0}if(e.utility==="mask-size"&&e.value){let t={auto:"auto",cover:"cover",contain:"contain"};if(t[e.value])return{"mask-size":t[e.value]};return e.arbitrary?{"mask-size":e.value}:void 0}if(e.utility==="mask-type"&&e.value)return["alpha","luminance"].includes(e.value)?{"mask-type":e.value}:void 0},mi=[Xh,Zh,rg,ng,ig,og,sg,ag,lg,cg,ug,fg,dg,hg,gg,mg,pg];var ha={add:"add",subtract:"subtract",intersect:"intersect",exclude:"exclude"},ga={alpha:"alpha",luminance:"luminance",match:"match-source"},ma={auto:"auto",cover:"cover",contain:"contain"},pa={center:"center",top:"top",right:"right",bottom:"bottom",left:"left","top-left":"left top","top-right":"right top","bottom-left":"left bottom","bottom-right":"right bottom"},ya={repeat:"repeat","no-repeat":"no-repeat"},yg=(e)=>{if(e.utility!=="mask"||!e.value)return;let t=e.value;if(e.arbitrary)return{"mask-image":t};if(t==="none")return{"mask-image":"none"};if(ha[t]!==void 0)return{"mask-composite":ha[t]};if(ga[t]!==void 0)return{"mask-mode":ga[t]};if(ma[t]!==void 0)return{"mask-size":ma[t]};if(pa[t]!==void 0)return{"mask-position":pa[t]};if(ya[t]!==void 0)return{"mask-repeat":ya[t]};if(t==="no-clip")return{"mask-clip":"no-clip"};return},bg=(e)=>{if(e.utility!=="mask-repeat"||e.arbitrary)return;if(e.value==="x")return{"mask-repeat":"repeat-x"};if(e.value==="y")return{"mask-repeat":"repeat-y"};return},qe="linear-gradient(#fff, #fff)";function k(e,t){return`var(--tc-mask-${e}, ${t})`}function Ye(){return{"mask-image":`${k("linear",qe)}, ${k("radial",qe)}, ${k("conic",qe)}`,"mask-composite":"intersect"}}var xg=[k("left",qe),k("right",qe),k("bottom",qe),k("top",qe)].join(", "),vg={t:["top"],r:["right"],b:["bottom"],l:["left"],x:["right","left"],y:["top","bottom"]};function wg(e){let t=`${k(`${e}-from-color`,"black")} ${k(`${e}-from-position`,"0%")}`,r=`${k(`${e}-to-color`,"transparent")} ${k(`${e}-to-position`,"100%")}`;return`linear-gradient(to ${e}, ${t}, ${r})`}var $g=[k("linear-position","0deg"),`${k("linear-from-color","black")} ${k("linear-from-position","0%")}`,`${k("linear-to-color","transparent")} ${k("linear-to-position","100%")}`].join(", "),Cg=/^(?:var|rgb|rgba|hsl|hsla|oklch|oklab|lab|lch|color|color-mix)\(/;function Mr(e,t,r){if(!e)return;if(/^\d+(?:\.\d+)?%$/.test(e))return{position:e};if(/^\d+(?:\.\d+)?$/.test(e)){let i=pe({value:e,arbitrary:!1},r,{});return i===void 0?void 0:{position:i}}if(t)return e.charCodeAt(0)===35||Cg.test(e)?{color:e}:{position:e};let n=z(e,r,!1);return n===void 0?void 0:{color:n}}function Fr(e){if(e.startsWith("from-"))return{stop:"from",token:e.slice(5)};if(e.startsWith("to-"))return{stop:"to",token:e.slice(3)};return}var Rg=(e,t)=>{if(e.utility!=="mask"||!e.value||e.arbitrary)return;let r=e.value,n=r.charCodeAt(0)===45,i=n?r.slice(1):r;if(!i.startsWith("linear-"))return;let o=i.slice(7);if(/^\d+(?:\.\d+)?$/.test(o))return{...Ye(),"--tc-mask-linear":`linear-gradient(${k("linear-stops",k("linear-position","0deg"))})`,"--tc-mask-linear-position":`calc(1deg * ${n?"-":""}${o})`};if(n)return;let s=Fr(o);if(s===void 0)return;let c=Mr(s.token,e.arbitrary,t);if(c===void 0)return;let a={...Ye(),"--tc-mask-linear-stops":$g,"--tc-mask-linear":"linear-gradient(var(--tc-mask-linear-stops))"};if(c.color!==void 0)a[`--tc-mask-linear-${s.stop}-color`]=c.color;else a[`--tc-mask-linear-${s.stop}-position`]=c.position;return a},kg=(e,t)=>{if(e.utility!=="mask"||!e.value||e.arbitrary)return;let r=e.value,n=r.indexOf("-");if(n===-1)return;let i=vg[r.slice(0,n)];if(i===void 0)return;let o=Fr(r.slice(n+1));if(o===void 0)return;let s=Mr(o.token,e.arbitrary,t);if(s===void 0)return;let c={...Ye(),"--tc-mask-linear":xg};for(let a of i)if(c[`--tc-mask-${a}`]=wg(a),s.color!==void 0)c[`--tc-mask-${a}-${o.stop}-color`]=s.color;else c[`--tc-mask-${a}-${o.stop}-position`]=s.position;return c},Sg=[`${k("radial-shape","ellipse")} ${k("radial-size","farthest-corner")} at ${k("radial-position","center")}`,`${k("radial-from-color","black")} ${k("radial-from-position","0%")}`,`${k("radial-to-color","transparent")} ${k("radial-to-position","100%")}`].join(", "),Ag=new Set(["closest-side","closest-corner","farthest-side","farthest-corner"]),Eg={center:"center",top:"top",right:"right",bottom:"bottom",left:"left","top-left":"top left","top-right":"top right","bottom-left":"bottom left","bottom-right":"bottom right"},Tg=[`from ${k("conic-position","0deg")}`,`${k("conic-from-color","black")} ${k("conic-from-position","0%")}`,`${k("conic-to-color","transparent")} ${k("conic-to-position","100%")}`].join(", "),Ng=(e,t)=>{if(e.utility==="mask-radial"&&e.arbitrary&&e.value)return{...Ye(),"--tc-mask-radial":`radial-gradient(${k("radial-stops",k("radial-size","farthest-corner"))})`,"--tc-mask-radial-size":e.value};if(e.utility!=="mask"||!e.value||e.arbitrary)return;let r=e.value;if(r==="circle"||r==="ellipse")return{"--tc-mask-radial-shape":r};if(!r.startsWith("radial-"))return;let n=r.slice(7);if(n.startsWith("at-")){let c=Eg[n.slice(3)];return c===void 0?void 0:{"--tc-mask-radial-position":c}}if(Ag.has(n))return{"--tc-mask-radial-size":n};let i=Fr(n);if(i===void 0)return;let o=Mr(i.token,e.arbitrary,t);if(o===void 0)return;let s={...Ye(),"--tc-mask-radial-stops":Sg,"--tc-mask-radial":"radial-gradient(var(--tc-mask-radial-stops))"};if(o.color!==void 0)s[`--tc-mask-radial-${i.stop}-color`]=o.color;else s[`--tc-mask-radial-${i.stop}-position`]=o.position;return s},Og=(e,t)=>{if(e.utility!=="mask"||!e.value||e.arbitrary)return;let r=e.value,n=r.charCodeAt(0)===45,i=n?r.slice(1):r;if(!i.startsWith("conic-"))return;let o=i.slice(6);if(/^\d+(?:\.\d+)?$/.test(o))return{...Ye(),"--tc-mask-conic":`conic-gradient(${k("conic-stops",k("conic-position","0deg"))})`,"--tc-mask-conic-position":`calc(1deg * ${n?"-":""}${o})`};if(n)return;let s=Fr(o);if(s===void 0)return;let c=Mr(s.token,e.arbitrary,t);if(c===void 0)return;let a={...Ye(),"--tc-mask-conic-stops":Tg,"--tc-mask-conic":"conic-gradient(var(--tc-mask-conic-stops))"};if(c.color!==void 0)a[`--tc-mask-conic-${s.stop}-color`]=c.color;else a[`--tc-mask-conic-${s.stop}-position`]=c.position;return a},ba=[Rg,kg,Ng,Og,yg,bg];var Ig={"2xs":"inset 0 1px",xs:"inset 0 1px 1px",sm:"inset 0 2px 4px"},Pg="rgb(0 0 0 / 0.05)",_g=/^(?:var|rgb|rgba|hsl|hsla|oklch|oklab|lab|lch|color|color-mix)\(/;function bi(e){return e.charCodeAt(0)===35||_g.test(e)}function Lg(e){return/^-?[\d.]+[a-z%]*$/i.test(e)||e.startsWith("calc(")||e.startsWith("var(")}function Mg(e,t){let r=e.trim().split(/\s+/),n=r[r.length-1];if(r.length>1&&!Lg(n))return`inset ${r.slice(0,-1).join(" ")} var(${t}, ${n})`;return`inset ${e} var(${t}, currentcolor)`}function pi(e){return{"--tc-inset-shadow":e,"box-shadow":V}}var Fg=(e,t)=>{if(e.utility==="inset-shadow"&&e.arbitrary&&e.value){if(!/\s/.test(e.value)&&bi(e.value))return{"--tc-inset-shadow-color":e.value};return pi(Mg(e.value,"--tc-inset-shadow-color"))}if(e.utility!=="inset"||!e.value||e.arbitrary)return;if(!e.value.startsWith("shadow-"))return;let r=e.value.slice(7),n=Ig[r];if(n!==void 0)return pi(`${n} var(--tc-inset-shadow-color, ${Pg})`);if(r==="none")return pi(`inset ${_r}`);let i=z(r,t,e.modifierArbitrary);return i===void 0?void 0:{"--tc-inset-shadow-color":i}};function yi(e){return{"--tc-inset-ring-shadow":`inset 0 0 0 ${e} var(--tc-inset-ring-color, currentcolor)`,"box-shadow":V}}var Dg=(e,t)=>{if(e.utility==="inset-ring"&&e.arbitrary&&e.value){if(bi(e.value))return{"--tc-inset-ring-color":e.value};return yi(e.value)}if(e.utility!=="inset"||!e.value||e.arbitrary)return;if(e.value!=="ring"&&!e.value.startsWith("ring-"))return;if(e.value==="ring")return yi("1px");let r=e.value.slice(5);if(/^\d+(?:\.\d+)?$/.test(r))return yi(`${r}px`);let n=z(r,t,e.modifierArbitrary);return n===void 0?void 0:{"--tc-inset-ring-color":n}},jg=(e,t)=>{if(e.utility!=="drop-shadow"||!e.value)return;if(e.arbitrary){if(/\s/.test(e.value))return;return bi(e.value)?{"--tc-drop-shadow-color":e.value}:void 0}let r=z(e.value,t,e.modifierArbitrary);return r===void 0?void 0:{"--tc-drop-shadow-color":r}},xa=[Fg,Dg,jg];var Dr={appearance:"none","background-color":"#fff","border-color":"#6b7280","border-width":"1px","border-radius":"0px","padding-top":"0.5rem","padding-right":"0.75rem","padding-bottom":"0.5rem","padding-left":"0.75rem","font-size":"1rem","line-height":"1.5rem"},va={appearance:"none",padding:"0","print-color-adjust":"exact",display:"inline-block","vertical-align":"middle","background-origin":"border-box","user-select":"none","flex-shrink":"0",height:"1rem",width:"1rem",color:"#2563eb","background-color":"#fff","border-color":"#6b7280","border-width":"1px"};function gt(e,t){return e.utility==="form"&&e.value===t||e.utility===`form-${t}`&&!e.value}var Bg=(e)=>{if(gt(e,"input"))return Dr},Ug=(e)=>{if(gt(e,"textarea"))return Dr},Vg=(e)=>{if(gt(e,"select"))return{...Dr,"background-image":`url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e")`,"background-position":"right 0.5rem center","background-repeat":"no-repeat","background-size":"1.5em 1.5em","padding-right":"2.5rem","print-color-adjust":"exact"}},Wg=(e)=>{if(gt(e,"multiselect"))return{...Dr,"background-image":"initial","background-position":"initial","background-repeat":"unset","background-size":"initial","print-color-adjust":"unset"}},zg=(e)=>{if(gt(e,"checkbox"))return{...va,"border-radius":"0px"}},Kg=(e)=>{if(gt(e,"radio"))return{...va,"border-radius":"100%"}},wa=[Bg,Ug,Vg,Wg,zg,Kg];var Hg={gap:"gap","gap-x":"column-gap","gap-y":"row-gap"},mt=/^-?\d+$/,$a=/^span-(\d+)$/,Gg=(e)=>{if(e.utility==="grid-cols"&&e.value){if(e.arbitrary)return{"grid-template-columns":e.value};if(e.value==="none"||e.value==="subgrid")return{"grid-template-columns":e.value};if(/^\d+$/.test(e.value))return{"grid-template-columns":`repeat(${e.value}, minmax(0, 1fr))`};return}},qg=(e)=>{if(e.utility==="col"){if(!e.value)return;if(e.arbitrary)return{"grid-column":e.value};if(e.value==="auto")return{"grid-column":"auto"};if(e.value==="span-full")return{"grid-column":"1 / -1"};let t=e.value.match($a);if(t)return{"grid-column":`span ${t[1]} / span ${t[1]}`};if(mt.test(e.value))return{"grid-column":e.value};return}if(e.utility==="col-span"&&e.value){if(e.arbitrary)return{"grid-column":`span ${e.value} / span ${e.value}`};if(e.value==="auto")return{"grid-column":"auto"};if(e.value==="full")return{"grid-column":"1 / -1"};if(/^\d+$/.test(e.value))return{"grid-column":`span ${e.value} / span ${e.value}`};return}if(e.utility==="col-start"&&e.value){if(e.arbitrary||e.value==="auto"||mt.test(e.value))return{"grid-column-start":e.value};return}if(e.utility==="col-end"&&e.value){if(e.arbitrary||e.value==="auto"||mt.test(e.value))return{"grid-column-end":e.value};return}},Yg=(e)=>{if(e.utility==="grid-rows"&&e.value){if(e.arbitrary)return{"grid-template-rows":e.value};if(e.value==="none"||e.value==="subgrid")return{"grid-template-rows":e.value};if(/^\d+$/.test(e.value))return{"grid-template-rows":`repeat(${e.value}, minmax(0, 1fr))`};return}},Jg=(e)=>{if(e.utility==="row"){if(!e.value)return;if(e.arbitrary)return{"grid-row":e.value};if(e.value==="auto")return{"grid-row":"auto"};if(e.value==="span-full")return{"grid-row":"1 / -1"};let t=e.value.match($a);if(t)return{"grid-row":`span ${t[1]} / span ${t[1]}`};if(mt.test(e.value))return{"grid-row":e.value};return}if(e.utility==="row-span"&&e.value){if(e.arbitrary)return{"grid-row":`span ${e.value} / span ${e.value}`};if(e.value==="auto")return{"grid-row":"auto"};if(e.value==="full")return{"grid-row":"1 / -1"};if(/^\d+$/.test(e.value))return{"grid-row":`span ${e.value} / span ${e.value}`};return}if(e.utility==="row-start"&&e.value){if(e.arbitrary||e.value==="auto"||mt.test(e.value))return{"grid-row-start":e.value};return}if(e.utility==="row-end"&&e.value){if(e.arbitrary||e.value==="auto"||mt.test(e.value))return{"grid-row-end":e.value};return}},Xg=(e)=>{if(e.utility==="grid-flow"&&e.value){let t={row:"row",col:"column",dense:"dense","row-dense":"row dense","col-dense":"column dense"};return t[e.value]?{"grid-auto-flow":t[e.value]}:void 0}return},Zg=(e)=>{if(e.utility==="auto-cols"&&e.value){let t={auto:"auto",min:"min-content",max:"max-content",fr:"minmax(0, 1fr)"};if(e.arbitrary)return{"grid-auto-columns":e.value};return t[e.value]?{"grid-auto-columns":t[e.value]}:void 0}},Qg=(e)=>{if(e.utility==="auto-rows"&&e.value){let t={auto:"auto",min:"min-content",max:"max-content",fr:"minmax(0, 1fr)"};if(e.arbitrary)return{"grid-auto-rows":e.value};return t[e.value]?{"grid-auto-rows":t[e.value]}:void 0}};function em(e,t,r){let n=t.theme.spacing?.[r];if(n!==void 0)return n;if(e.arbitrary)return r;if(/^\d+(?:\.\d+)?$/.test(r)){let i=Number.parseFloat(r);if(Number.isFinite(i))return`${i*0.25}rem`}return}var tm=(e,t)=>{let r=Hg[e.utility];if(!r||!e.value)return;let n=em(e,t,e.value);return n!==void 0?{[r]:n}:void 0},rm=(e)=>{if(e.utility==="place"&&e.value&&e.value.startsWith("content-")){let t=e.value.replace("content-",""),r={center:"center",start:"start",end:"end",between:"space-between",around:"space-around",evenly:"space-evenly",stretch:"stretch"};return r[t]?{"place-content":r[t]}:void 0}return},nm=(e)=>{if(e.utility==="place"&&e.value&&e.value.startsWith("items-")){let t=e.value.replace("items-",""),r={start:"start",end:"end",center:"center",stretch:"stretch"};return r[t]?{"place-items":r[t]}:void 0}return},im=(e)=>{if(e.utility==="place"&&e.value&&e.value.startsWith("self-")){let t=e.value.replace("self-",""),r={auto:"auto",start:"start",end:"end",center:"center",stretch:"stretch"};return r[t]?{"place-self":r[t]}:void 0}return},Ca=[Gg,qg,Yg,Jg,Xg,Zg,Qg,tm,rm,nm,im];import{existsSync as Ra,readFileSync as om,readdirSync as sm}from"fs";import{join as jr}from"path";var Br=new Map;function am(e){if(Br.has(e))return Br.get(e);let t=[jr(process.cwd(),"node_modules","@iconify-json",e,"icons.json"),jr(process.cwd(),"node_modules",".bun","@iconify-json",e,"icons.json")],r=jr(process.cwd(),"node_modules",".bun");if(Ra(r))try{let n=`@iconify-json+${e}@`;for(let i of sm(r))if(i.startsWith(n))t.push(jr(r,i,"node_modules","@iconify-json",e,"icons.json"))}catch{}for(let n of t)if(Ra(n))try{let i=JSON.parse(om(n,"utf-8"));return Br.set(e,i),i}catch{}return Br.set(e,null),null}function lm(e,t){let r=e.icons[t];if(r)return r;let n=e.aliases?.[t];if(n)return e.icons[n.parent]??null;return null}function cm(e,t){let r=t.width??e.width??24,n=t.height??e.height??24,i=t.left??0,o=t.top??0;return`<svg xmlns='http://www.w3.org/2000/svg' viewBox='${i} ${o} ${r} ${n}' width='${r}' height='${n}'>${t.body}</svg>`}function um(e){return`url("data:image/svg+xml;utf8,${e.replace(/"/g,"'").replace(/%/g,"%25").replace(/#/g,"%23").replace(/</g,"%3C").replace(/>/g,"%3E").replace(/\?/g,"%3F").replace(/\s+/g," ")}")`}var fm=/^i-([a-z][a-z0-9]*(?:-[a-z0-9]+)*)-(.+)$/;function dm(e){if(!e.startsWith("i-"))return;let t=e.slice(2);for(let r=t.indexOf("-");r!==-1;r=t.indexOf("-",r+1)){let n=t.slice(0,r),i=t.slice(r+1);if(!/^[a-z][a-z0-9-]*$/.test(n))continue;let o=am(n);if(!o)continue;let s=lm(o,i);if(s)return{collection:o,icon:s}}return}var ka=(e,t)=>{if(!fm.test(e.base))return;let r=dm(e.base);if(!r)return;let{collection:n,icon:i}=r,o=um(cm(n,i));return{defaults:!0,properties:{display:"inline-block",width:"1em",height:"1em","background-color":"currentColor","-webkit-mask":`${o} no-repeat`,mask:`${o} no-repeat`,"-webkit-mask-size":"100% 100%","mask-size":"100% 100%","vertical-align":"-0.125em"}}};var Sa={"border-collapse":"collapse","border-separate":"separate"},Aa={"caption-top":"top","caption-bottom":"bottom"},Ea={"field-sizing-content":"content","field-sizing-fixed":"fixed"},Ta={"cursor-auto":"auto","cursor-default":"default","cursor-pointer":"pointer","cursor-wait":"wait","cursor-text":"text","cursor-move":"move","cursor-help":"help","cursor-not-allowed":"not-allowed","cursor-none":"none","cursor-context-menu":"context-menu","cursor-progress":"progress","cursor-cell":"cell","cursor-crosshair":"crosshair","cursor-vertical-text":"vertical-text","cursor-alias":"alias","cursor-copy":"copy","cursor-no-drop":"no-drop","cursor-grab":"grab","cursor-grabbing":"grabbing","cursor-all-scroll":"all-scroll","cursor-col-resize":"col-resize","cursor-row-resize":"row-resize","cursor-n-resize":"n-resize","cursor-e-resize":"e-resize","cursor-s-resize":"s-resize","cursor-w-resize":"w-resize","cursor-ne-resize":"ne-resize","cursor-nw-resize":"nw-resize","cursor-se-resize":"se-resize","cursor-sw-resize":"sw-resize","cursor-ew-resize":"ew-resize","cursor-ns-resize":"ns-resize","cursor-nesw-resize":"nesw-resize","cursor-nwse-resize":"nwse-resize","cursor-zoom-in":"zoom-in","cursor-zoom-out":"zoom-out"},Na={"pointer-events-none":"none","pointer-events-auto":"auto"},Oa={"resize-none":"none",resize:"both","resize-y":"vertical","resize-x":"horizontal"},Ia={"scroll-auto":"auto","scroll-smooth":"smooth"},Pa={"snap-none":"none","snap-x":"x var(--tc-scroll-snap-strictness, proximity)","snap-y":"y var(--tc-scroll-snap-strictness, proximity)","snap-both":"both var(--tc-scroll-snap-strictness, proximity)"},_a={"snap-mandatory":"mandatory","snap-proximity":"proximity"},La={"snap-start":"start","snap-end":"end","snap-center":"center","snap-align-none":"none"},Ma={"snap-normal":"normal","snap-always":"always"},Fa={"touch-auto":"auto","touch-none":"none","touch-pan-x":"pan-x","touch-pan-left":"pan-left","touch-pan-right":"pan-right","touch-pan-y":"pan-y","touch-pan-up":"pan-up","touch-pan-down":"pan-down","touch-pinch-zoom":"pinch-zoom","touch-manipulation":"manipulation"},Da={"select-none":"none","select-text":"text","select-all":"all","select-auto":"auto"},ja={"will-change-auto":"auto","will-change-scroll":"scroll-position","will-change-contents":"contents","will-change-transform":"transform"},Ba={"stroke-linecap-butt":"butt","stroke-linecap-round":"round","stroke-linecap-square":"square"},Ua={"stroke-linejoin-miter":"miter","stroke-linejoin-round":"round","stroke-linejoin-bevel":"bevel"},Va={"forced-color-adjust-auto":"auto","forced-color-adjust-none":"none"},xi={none:"0",sm:"4px",DEFAULT:"8px",md:"12px",lg:"16px",xl:"24px","2xl":"40px","3xl":"64px"};function Ka(e){if(e.arbitrary)return e.value;if(/^\d+(?:\.\d+)?$/.test(e.value))return`${Number(e.value)/100}`;return}function Ha(e){if(!e.value)return xi.DEFAULT;if(xi[e.value]!==void 0)return xi[e.value];if(e.arbitrary)return e.value;if(/^\d+(?:\.\d+)?$/.test(e.value))return`${e.value}px`;return}var Ga=["brightness","contrast","grayscale","invert","saturate","sepia"],hm=["blur","brightness","contrast","grayscale","hue-rotate","invert","saturate","sepia","drop-shadow"],gm=["blur","brightness","contrast","grayscale","hue-rotate","invert","opacity","saturate","sepia"],mm=hm.map((e)=>`var(--tc-${e}, )`).join(" "),Wa=gm.map((e)=>`var(--tc-backdrop-${e}, )`).join(" ");function Je(e,t){return{[`--tc-${e}`]:t,filter:mm}}function Ur(e,t){return{[`--tc-backdrop-${e}`]:t,"-webkit-backdrop-filter":Wa,"backdrop-filter":Wa}}var pm=(e)=>{if(e.base==="filter-none")return{filter:"none"};if(e.utility==="blur"){let t=Ha(e);return t!==void 0?Je("blur",`blur(${t})`):void 0}if(Ga.includes(e.utility)&&e.value){let t=Ka(e);return t!==void 0?Je(e.utility,`${e.utility}(${t})`):void 0}if(e.utility==="hue-rotate"&&e.value){if(e.arbitrary)return Je("hue-rotate",`hue-rotate(${e.value})`);if(/^-?\d+(?:\.\d+)?$/.test(e.value))return Je("hue-rotate",`hue-rotate(${e.value}deg)`);return}if(e.utility==="drop-shadow"){let t={sm:"drop-shadow(0 1px 1px rgb(0 0 0 / 0.05))",DEFAULT:"drop-shadow(0 1px 2px rgb(0 0 0 / 0.1)) drop-shadow(0 1px 1px rgb(0 0 0 / 0.06))",md:"drop-shadow(0 4px 3px rgb(0 0 0 / 0.07)) drop-shadow(0 2px 2px rgb(0 0 0 / 0.06))",lg:"drop-shadow(0 10px 8px rgb(0 0 0 / 0.04)) drop-shadow(0 4px 3px rgb(0 0 0 / 0.1))",xl:"drop-shadow(0 20px 13px rgb(0 0 0 / 0.03)) drop-shadow(0 8px 5px rgb(0 0 0 / 0.08))","2xl":"drop-shadow(0 25px 25px rgb(0 0 0 / 0.15))",none:"drop-shadow(0 0 #0000)"};if(!e.value)return Je("drop-shadow",t.DEFAULT);if(t[e.value])return Je("drop-shadow",t[e.value]);if(e.arbitrary)return Je("drop-shadow",`drop-shadow(${e.value})`);return}},ym=(e)=>{if(e.base==="backdrop-filter-none")return{"backdrop-filter":"none"};if(e.utility==="backdrop-blur"){let t=Ha(e);return t!==void 0?Ur("blur",`blur(${t})`):void 0}if(e.utility.startsWith("backdrop-")&&e.value){let t=e.utility.slice(9);if(Ga.includes(t)||t==="opacity"){let r=Ka(e);if(r===void 0)return;return Ur(t,`${t}(${r})`)}if(t==="hue-rotate"){if(e.arbitrary)return Ur(t,`hue-rotate(${e.value})`);if(/^-?\d+(?:\.\d+)?$/.test(e.value))return Ur(t,`hue-rotate(${e.value}deg)`);return}}},bm=(e)=>Sa[e.base]?{"border-collapse":Sa[e.base]}:void 0,xm=(e,t)=>{if(!e.utility.startsWith("border-spacing")||!e.value)return;let r=t.theme.spacing[e.value];if(r===void 0&&e.arbitrary)r=e.value;if(r===void 0&&/^\d+(?:\.\d+)?$/.test(e.value))r=`${Number.parseFloat(e.value)*0.25}rem`;if(r===void 0)return;if(e.utility==="border-spacing")return{"border-spacing":`${r} ${r}`};if(e.utility==="border-spacing-x")return{"border-spacing":`${r} 0`};if(e.utility==="border-spacing-y")return{"border-spacing":`0 ${r}`}},vm=(e)=>{if(e.utility==="table"&&e.value){let t={auto:"auto",fixed:"fixed"};return t[e.value]?{"table-layout":t[e.value]}:void 0}return},wm=(e)=>Aa[e.base]?{"caption-side":Aa[e.base]}:void 0,$m=(e,t)=>{if(e.utility==="accent"&&e.value){let r=z(e.value,t,e.modifierArbitrary);if(r)return{"accent-color":r}}},Cm=(e)=>{let t={"appearance-none":"none","appearance-auto":"auto","appearance-base":"base"};return t[e.base]?{appearance:t[e.base]}:void 0},Rm=(e,t)=>{if(e.utility==="caret"&&e.value){let r=z(e.value,t,e.modifierArbitrary);if(r)return{"caret-color":r}}},km={normal:"normal",light:"light",dark:"dark","light-dark":"light dark","only-dark":"only dark","only-light":"only light"},za=(e)=>{let t=e.base,r=t.startsWith("scheme-")?t.slice(7):t.startsWith("color-scheme-")?t.slice(13):void 0;if(r===void 0)return;let n=km[r];return n?{"color-scheme":n}:void 0},Sm=(e)=>Ea[e.base]?{"field-sizing":Ea[e.base]}:void 0,Am=(e)=>Ta[e.base]?{cursor:Ta[e.base]}:void 0,Em=(e)=>Na[e.base]?{"pointer-events":Na[e.base]}:void 0,Tm=(e)=>Oa[e.base]?{resize:Oa[e.base]}:void 0,Nm=(e)=>Ia[e.base]?{"scroll-behavior":Ia[e.base]}:void 0,Om=(e,t)=>{let n={"scroll-m":["scroll-margin"],"scroll-mx":["scroll-margin-left","scroll-margin-right"],"scroll-my":["scroll-margin-top","scroll-margin-bottom"],"scroll-mt":["scroll-margin-top"],"scroll-mr":["scroll-margin-right"],"scroll-mb":["scroll-margin-bottom"],"scroll-ml":["scroll-margin-left"]}[e.utility];if(!n||!e.value)return;let i=t.theme.spacing[e.value];if(i===void 0&&e.arbitrary)i=e.value;if(i===void 0&&/^\d+(?:\.\d+)?$/.test(e.value))i=`${Number.parseFloat(e.value)*0.25}rem`;if(i===void 0)return;let o={};for(let s of n)o[s]=i;return o},Im=(e,t)=>{let n={"scroll-p":["scroll-padding"],"scroll-px":["scroll-padding-left","scroll-padding-right"],"scroll-py":["scroll-padding-top","scroll-padding-bottom"],"scroll-pt":["scroll-padding-top"],"scroll-pr":["scroll-padding-right"],"scroll-pb":["scroll-padding-bottom"],"scroll-pl":["scroll-padding-left"]}[e.utility];if(!n||!e.value)return;let i=t.theme.spacing[e.value];if(i===void 0&&e.arbitrary)i=e.value;if(i===void 0&&/^\d+(?:\.\d+)?$/.test(e.value))i=`${Number.parseFloat(e.value)*0.25}rem`;if(i===void 0)return;let o={};for(let s of n)o[s]=i;return o},Pm=(e)=>{if(Pa[e.base])return{"scroll-snap-type":Pa[e.base]};if(_a[e.base])return{"--tc-scroll-snap-strictness":_a[e.base]};if(La[e.base])return{"scroll-snap-align":La[e.base]};if(Ma[e.base])return{"scroll-snap-stop":Ma[e.base]}},_m=(e)=>Fa[e.base]?{"touch-action":Fa[e.base]}:void 0,Lm=(e)=>Da[e.base]?{"user-select":Da[e.base]}:void 0,Mm=(e)=>ja[e.base]?{"will-change":ja[e.base]}:void 0,Fm=(e,t)=>{if(e.utility==="fill"&&e.value){if(e.value==="none")return{fill:"none"};let r=z(e.value,t,e.modifierArbitrary);if(r)return{fill:r}}},Dm=(e,t)=>{if(e.utility==="stroke"&&e.value){if(e.value==="none")return{stroke:"none"};let r=z(e.value,t,e.modifierArbitrary);if(r)return{stroke:r}}},jm=(e)=>{if(e.utility==="stroke"&&e.value){if(e.arbitrary||/^\d+(?:\.\d+)?$/.test(e.value))return{"stroke-width":e.value};return}},Bm=(e)=>{if(e.utility==="stroke-dasharray"&&e.value){if(e.value==="none")return{"stroke-dasharray":"none"};if(e.arbitrary||/^\d+(?:\.\d+)?$/.test(e.value))return{"stroke-dasharray":e.value};return}},Um=(e)=>{if(e.utility==="stroke-dashoffset"&&e.value){if(e.arbitrary||/^-?\d+(?:\.\d+)?$/.test(e.value))return{"stroke-dashoffset":e.value};return}},Vm=(e)=>Ba[e.base]?{"stroke-linecap":Ba[e.base]}:void 0,Wm=(e)=>Ua[e.base]?{"stroke-linejoin":Ua[e.base]}:void 0,zm=(e)=>{if(e.base==="sr-only")return{position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)","white-space":"nowrap","border-width":"0"};if(e.base==="not-sr-only")return{position:"static",width:"auto",height:"auto",padding:"0",margin:"0",overflow:"visible",clip:"auto","white-space":"normal"};return},Km=(e)=>Va[e.base]?{"forced-color-adjust":Va[e.base]}:void 0,qa=[pm,ym,bm,xm,vm,wm,$m,Cm,za,Rm,za,Sm,Am,Em,Tm,Nm,Om,Im,Pm,_m,Lm,Mm,Fm,Dm,jm,Bm,Um,Vm,Wm,zm,Km];function $e(e,t){let r=e/t*100;if(!Number.isFinite(r))return;return`${Hm(r)}%`}function Hm(e){if(Number.isInteger(e))return String(e);return e.toFixed(6).replace(/\.?0+$/,"")}var Ya={"column-fill-auto":"auto","column-fill-balance":"balance","column-fill-balance-all":"balance-all"},Ja={"column-span-all":"all","column-span-none":"none"},Xa={"box-decoration-clone":"clone","box-decoration-slice":"slice"},Za={"box-border":"border-box","box-content":"content-box"},Qa={"float-start":"inline-start","float-end":"inline-end","float-right":"right","float-left":"left","float-none":"none"},el={"clear-start":"inline-start","clear-end":"inline-end","clear-left":"left","clear-right":"right","clear-both":"both","clear-none":"none"},tl={isolate:"isolate","isolation-auto":"auto"},rl={"object-contain":"contain","object-cover":"cover","object-fill":"fill","object-none":"none","object-scale-down":"scale-down"},nl={"object-bottom":"bottom","object-center":"center","object-left":"left","object-left-bottom":"left bottom","object-left-top":"left top","object-right":"right","object-right-bottom":"right bottom","object-right-top":"right top","object-top":"top"},il={"overscroll-auto":"auto","overscroll-contain":"contain","overscroll-none":"none","overscroll-x-auto":"auto","overscroll-x-contain":"contain","overscroll-x-none":"none","overscroll-y-auto":"auto","overscroll-y-contain":"contain","overscroll-y-none":"none"},ol={visible:"visible",invisible:"hidden",collapse:"collapse"},Gm=(e)=>{if(e.utility==="aspect"&&e.value){let t={auto:"auto",square:"1 / 1",video:"16 / 9"};if(t[e.value])return{"aspect-ratio":t[e.value]};if(e.arbitrary)return{"aspect-ratio":e.value};let r=e.value.match(/^(\d+(?:\.\d+)?)\/(\d+(?:\.\d+)?)$/);if(r)return{"aspect-ratio":`${r[1]} / ${r[2]}`};if(/^\d+(?:\.\d+)?$/.test(e.value))return{"aspect-ratio":e.value};return}},qm=(e,t)=>{if(e.utility==="columns"&&e.value){let r={"1":"1","2":"2","3":"3","4":"4","5":"5","6":"6","7":"7","8":"8","9":"9","10":"10","11":"11","12":"12",auto:"auto"},n={"3xs":"16rem","2xs":"18rem",xs:"20rem",sm:"24rem",md:"28rem",lg:"32rem",xl:"36rem","2xl":"42rem","3xl":"48rem","4xl":"56rem","5xl":"64rem","6xl":"72rem","7xl":"80rem"};if(r[e.value])return{columns:r[e.value]};if(n[e.value])return{columns:n[e.value]};if(t.theme.spacing[e.value])return{columns:t.theme.spacing[e.value]};if(e.arbitrary||/^\d+$/.test(e.value))return{columns:e.value};return}},Ym=(e)=>Ya[e.base]?{"column-fill":Ya[e.base]}:void 0,Jm=(e,t)=>{if(e.utility==="column-gap"&&e.value){let r=t.theme.spacing[e.value];if(r===void 0&&e.arbitrary)r=e.value;if(r===void 0&&/^\d+(?:\.\d+)?$/.test(e.value))r=`${Number.parseFloat(e.value)*0.25}rem`;return r!==void 0?{"column-gap":r}:void 0}},Xm=(e,t)=>{if(e.utility==="column-rule"&&e.value){let r={"0":"0px","1":"1px","2":"2px","4":"4px","8":"8px"};if(r[e.value])return{"column-rule-width":r[e.value]};let n=e.value.split("-");if(n.length===2){let[s,c]=n,a=t.theme.colors[s];if(typeof a==="object"&&a[c])return{"column-rule-color":W(e.value,a[c],s,t.colorVariables)}}let i=t.theme.colors[e.value];if(typeof i==="string")return{"column-rule-color":W(e.value,i,e.value,t.colorVariables)};if(typeof i==="object"&&i!==null&&typeof i.DEFAULT==="string")return{"column-rule-color":W(e.value,i.DEFAULT,e.value,t.colorVariables)};let o={solid:"solid",dashed:"dashed",dotted:"dotted",double:"double",hidden:"hidden",none:"none"};if(o[e.value])return{"column-rule-style":o[e.value]}}},Zm=(e)=>Ja[e.base]?{"column-span":Ja[e.base]}:void 0,Qm=(e)=>({"break-before-auto":{"break-before":"auto"},"break-before-avoid":{"break-before":"avoid"},"break-before-all":{"break-before":"all"},"break-before-avoid-page":{"break-before":"avoid-page"},"break-before-page":{"break-before":"page"},"break-after-auto":{"break-after":"auto"},"break-after-avoid":{"break-after":"avoid"},"break-after-all":{"break-after":"all"},"break-after-avoid-page":{"break-after":"avoid-page"},"break-after-page":{"break-after":"page"},"break-inside-auto":{"break-inside":"auto"},"break-inside-avoid":{"break-inside":"avoid"},"break-inside-avoid-page":{"break-inside":"avoid-page"},"break-inside-avoid-column":{"break-inside":"avoid-column"}})[e.base],ep=(e)=>Xa[e.base]?{"box-decoration-break":Xa[e.base]}:void 0,tp=(e)=>Za[e.base]?{"box-sizing":Za[e.base]}:void 0,rp=(e)=>Qa[e.base]?{float:Qa[e.base]}:void 0,np=(e)=>el[e.base]?{clear:el[e.base]}:void 0,ip=(e)=>tl[e.base]?{isolation:tl[e.base]}:void 0,sl=["size","inline-size","layout","paint","style"],op=sl.map((e)=>`var(--tc-contain-${e}, )`).join(" "),sp=["none","content","strict"],ap=(e)=>{if(e.utility!=="contain"||!e.value)return;if(e.arbitrary)return{contain:e.value};if(sp.includes(e.value))return{contain:e.value};if(sl.includes(e.value))return{[`--tc-contain-${e.value}`]:e.value,contain:op};return},lp=(e)=>rl[e.base]?{"object-fit":rl[e.base]}:void 0,cp=(e)=>nl[e.base]?{"object-position":nl[e.base]}:void 0,up=(e)=>{if(e.utility==="overflow"){let t=["auto","hidden","clip","visible","scroll"];if(e.value&&t.includes(e.value))return{overflow:e.value}}if(e.utility==="overflow-x"||e.utility==="overflow-y"){let t=["auto","hidden","clip","visible","scroll"];if(e.value&&t.includes(e.value))return{[e.utility]:e.value}}},fp=(e)=>{let t=e.base.startsWith("overscroll-x")?"overscroll-behavior-x":e.base.startsWith("overscroll-y")?"overscroll-behavior-y":"overscroll-behavior";return il[e.base]?{[t]:il[e.base]}:void 0},dp=(e)=>{if(["static","fixed","absolute","relative","sticky"].includes(e.utility))return{position:e.utility}},hp=(e,t)=>{let n={inset:["top","right","bottom","left"],"inset-x":["left","right"],"inset-y":["top","bottom"],top:["top"],right:["right"],bottom:["bottom"],left:["left"],start:["inset-inline-start"],end:["inset-inline-end"]}[e.utility];if(!n||!e.value)return;let i=(c)=>{if(c.includes("/")&&!e.arbitrary){let[l,u]=c.split("/").map(Number);if(!Number.isNaN(l)&&!Number.isNaN(u)&&u!==0)return $e(l,u);return}if(c==="full")return"100%";if(c==="auto")return"auto";if(e.arbitrary)return c;let a=t.theme.spacing[c];if(a!==void 0)return a;if(/^\d+(?:\.\d+)?$/.test(c))return`${Number.parseFloat(c)*0.25}rem`;return},o;if(e.value.startsWith("-")){let c=e.value.slice(1),a=i(c);if(a===void 0)o=void 0;else if(a.endsWith("%"))o=`${-Number.parseFloat(a)}%`;else o=a.startsWith("-")?a:`-${a}`}else o=i(e.value);if(o===void 0)return;let s={};for(let c of n)s[c]=o;return s},gp=(e)=>ol[e.utility]?{visibility:ol[e.utility]}:void 0,mp=(e)=>{if(e.utility==="z"&&e.value){if(e.arbitrary||e.value==="auto"||/^-?\d+$/.test(e.value))return{"z-index":e.value};return}},al=[Gm,qm,Ym,Jm,Xm,Zm,Qm,ep,tp,rp,np,ap,ip,lp,cp,up,fp,dp,hp,gp,mp];var pp={rotate:"rotate","rotate-x":"rotateX","rotate-y":"rotateY","rotate-z":"rotateZ"},yp={"translate-x":"translateX","translate-y":"translateY","translate-z":"translateZ"},ll={"backface-visible":"visible","backface-hidden":"hidden"},cl={"transform-flat":"flat","transform-3d":"preserve-3d"},ul={"transition-none":"none","transition-all":"all",transition:"color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter","transition-colors":"color, background-color, border-color, text-decoration-color, fill, stroke","transition-opacity":"opacity","transition-shadow":"box-shadow","transition-transform":"transform"},fl={"ease-linear":"linear","ease-in":"cubic-bezier(0.4, 0, 1, 1)","ease-out":"cubic-bezier(0, 0, 0.2, 1)","ease-in-out":"cubic-bezier(0.4, 0, 0.2, 1)","ease-initial":"initial"},dl={"transition-normal":"normal","transition-discrete":"allow-discrete","transition-behavior-normal":"normal","transition-behavior-allow-discrete":"allow-discrete"},hl={none:"none",spin:"spin 1s linear infinite",ping:"ping 1s cubic-bezier(0, 0, 0.2, 1) infinite",pulse:"pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite",bounce:"bounce 1s infinite"},gl={"animate-running":"running","animate-paused":"paused"},ml={"animate-normal":"normal","animate-reverse":"reverse","animate-alternate":"alternate","animate-alternate-reverse":"alternate-reverse"},pl={"animate-fill-none":"none","animate-fill-forwards":"forwards","animate-fill-backwards":"backwards","animate-fill-both":"both"},yl={"animate-ease-linear":"linear","animate-ease-in":"cubic-bezier(0.4, 0, 1, 1)","animate-ease-out":"cubic-bezier(0, 0, 0.2, 1)","animate-ease-in-out":"cubic-bezier(0.4, 0, 0.2, 1)"},bl="rotate(var(--tc-rotate, 0deg)) skewX(var(--tc-skew-x, 0deg)) skewY(var(--tc-skew-y, 0deg)) scaleX(var(--tc-scale-x, 1)) scaleY(var(--tc-scale-y, 1))",Lt=`translate(var(--tc-translate-x, 0), var(--tc-translate-y, 0)) ${bl}`,wi=`translate3d(var(--tc-translate-x, 0), var(--tc-translate-y, 0), 0) ${bl}`,bp={transform:Lt,"transform-cpu":Lt,"transform-gpu":wi,"transform-none":"none"},xp=(e)=>{let t=bp[e.base];return t?{transform:t}:void 0};function Vr(e,t){if(!t.value)return{transform:`${e}(1)`};if(t.arbitrary)return{transform:`${e}(${t.value})`};if(/^-?\d+(?:\.\d+)?$/.test(t.value))return{transform:`${e}(${Number(t.value)/100})`};return}function vi(e){let t=e.value;if(e.arbitrary)return t;if(/^-?\d+(?:\.\d+)?$/.test(t))return`${t}deg`;if(/^-?\d+(?:\.\d+)?(?:deg|rad|grad|turn)$/.test(t))return t;return}var vp=(e)=>{if(e.utility==="scale")return Vr("scale",e);if(e.utility==="scale-x")return Vr("scaleX",e);if(e.utility==="scale-y")return Vr("scaleY",e);if(e.utility==="scale-z")return Vr("scaleZ",e)},wp=(e)=>{if(!e.value)return;let t=pp[e.utility];if(!t)return;let r=vi(e);return r!==void 0?{transform:`${t}(${r})`}:void 0},$p=(e,t)=>{let r=(o)=>{if(o.includes("/")){let[c,a]=o.split("/");return $e(Number(c),Number(a))}if(o==="full")return"100%";if(o==="half")return"50%";if(e.arbitrary)return o;let s=t.theme.spacing[o];if(s!==void 0)return s;if(/^\d+(?:\.\d+)?$/.test(o))return`${Number.parseFloat(o)*0.25}rem`;return},n=yp[e.utility];if(!n||!e.value)return;let i;if(e.value.startsWith("-")){let o=r(e.value.slice(1));i=o===void 0?void 0:`-${o}`}else i=r(e.value);return i!==void 0?{transform:`${n}(${i})`}:void 0},Cp=(e)=>{if(e.utility==="skew-x"&&e.value){let t=vi(e);return t!==void 0?{transform:`skewX(${t})`}:void 0}if(e.utility==="skew-y"&&e.value){let t=vi(e);return t!==void 0?{transform:`skewY(${t})`}:void 0}},Rp=(e)=>{if(e.utility==="origin"&&e.value){if(e.arbitrary)return{"transform-origin":e.value.replace(/_/g," ")};let t={center:"center",top:"top","top-right":"top right",right:"right","bottom-right":"bottom right",bottom:"bottom","bottom-left":"bottom left",left:"left","top-left":"top left"};return t[e.value]?{"transform-origin":t[e.value]}:void 0}return},kp={dramatic:"100px",near:"300px",normal:"500px",midrange:"800px",distant:"1200px"},Sp=(e)=>{if(e.utility==="perspective"&&e.value){if(e.value==="none")return{perspective:"none"};if(e.arbitrary||/^\d+(?:\.\d+)?(?:px|rem|em)$/.test(e.value))return{perspective:e.value};let t=kp[e.value];if(t)return{perspective:t};if(/^\d+(?:\.\d+)?$/.test(e.value))return{perspective:`${e.value}px`};return}return},Ap=(e)=>{if(e.utility==="perspective-origin"&&e.value)return{"perspective-origin":{center:"center",top:"top","top-right":"top right",right:"right","bottom-right":"bottom right",bottom:"bottom","bottom-left":"bottom left",left:"left","top-left":"top left"}[e.value]||e.value}},Ep=(e)=>ll[e.base]?{"backface-visibility":ll[e.base]}:void 0,Tp=(e)=>cl[e.base]?{"transform-style":cl[e.base]}:void 0,Np=(e)=>ul[e.base]?{"transition-property":ul[e.base]}:void 0;function Wr(e,t){let r=e.value;if(t[r])return t[r];if(e.arbitrary)return r;if(/^\d+(?:\.\d+)?$/.test(r))return`${r}ms`;return}var Op=(e)=>{if(e.utility==="duration"&&e.value){let r=Wr(e,{"0":"0s","75":"75ms","100":"100ms","150":"150ms","200":"200ms","300":"300ms","500":"500ms","700":"700ms","1000":"1000ms"});return r!==void 0?{"transition-duration":r}:void 0}},Ip=(e)=>fl[e.base]?{"transition-timing-function":fl[e.base]}:void 0,Pp=(e)=>{if(e.utility==="delay"&&e.value){let r=Wr(e,{"0":"0s","75":"75ms","100":"100ms","150":"150ms","200":"200ms","300":"300ms","500":"500ms","700":"700ms","1000":"1000ms"});return r!==void 0?{"transition-delay":r}:void 0}},_p=(e)=>dl[e.base]?{"transition-behavior":dl[e.base]}:void 0,Lp=(e)=>{if(e.utility!=="animate")return;if(e.arbitrary&&e.value)return{animation:e.value.replace(/_/g," ")};if(e.value&&hl[e.value])return{animation:hl[e.value]};return},Mp=(e)=>gl[e.base]?{"animation-play-state":gl[e.base]}:void 0,Fp=(e)=>ml[e.base]?{"animation-direction":ml[e.base]}:void 0,Dp=(e)=>pl[e.base]?{"animation-fill-mode":pl[e.base]}:void 0,jp=(e)=>{if(e.utility==="animate-iteration"&&e.value){if(e.value==="infinite"||e.arbitrary||/^\d+(?:\.\d+)?$/.test(e.value))return{"animation-iteration-count":e.value};return}},Bp=(e)=>{if(e.utility==="animate-duration"&&e.value){let r=Wr(e,{"75":"75ms","100":"100ms","150":"150ms","200":"200ms","300":"300ms","500":"500ms","700":"700ms","1000":"1000ms"});return r!==void 0?{"animation-duration":r}:void 0}},Up=(e)=>{if(e.utility==="animate-delay"&&e.value){let r=Wr(e,{"75":"75ms","100":"100ms","150":"150ms","200":"200ms","300":"300ms","500":"500ms","700":"700ms","1000":"1000ms"});return r!==void 0?{"animation-delay":r}:void 0}},Vp=(e)=>yl[e.base]?{"animation-timing-function":yl[e.base]}:void 0,xl=[xp,vp,wp,$p,Cp,Rp,Sp,Ap,Ep,Tp,Np,_p,Op,Ip,Pp,Lp,Mp,Fp,Dp,jp,Bp,Up,Vp];var vl={italic:"italic","not-italic":"normal"},wl={"normal-nums":"normal",ordinal:"ordinal","slashed-zero":"slashed-zero","lining-nums":"lining-nums","oldstyle-nums":"oldstyle-nums","proportional-nums":"proportional-nums","tabular-nums":"tabular-nums","diagonal-fractions":"diagonal-fractions","stacked-fractions":"stacked-fractions"},$l={"list-inside":"inside","list-outside":"outside"},Cl={none:"none",disc:"disc",decimal:"decimal"},Rl={underline:"underline",overline:"overline","line-through":"line-through","no-underline":"none"},kl={uppercase:"uppercase",lowercase:"lowercase",capitalize:"capitalize","normal-case":"none"},Sl={"text-wrap":"wrap","text-nowrap":"nowrap","text-balance":"balance","text-pretty":"pretty"},Al={"align-baseline":"baseline","align-top":"top","align-middle":"middle","align-bottom":"bottom","align-text-top":"text-top","align-text-bottom":"text-bottom","align-sub":"sub","align-super":"super"},El={"whitespace-normal":"normal","whitespace-nowrap":"nowrap","whitespace-pre":"pre","whitespace-pre-line":"pre-line","whitespace-pre-wrap":"pre-wrap","whitespace-break-spaces":"break-spaces"},Tl={"break-all":"break-all","break-keep":"keep-all"},Nl={"hyphens-none":"none","hyphens-manual":"manual","hyphens-auto":"auto"},Ol={"writing-horizontal-tb":"horizontal-tb","writing-vertical-rl":"vertical-rl","writing-vertical-lr":"vertical-lr"},Il={"text-orientation-mixed":"mixed","text-orientation-upright":"upright","text-orientation-sideways":"sideways"},Pl={"direction-ltr":"ltr","direction-rtl":"rtl"},_l={"small-caps":"small-caps","all-small-caps":"all-small-caps","petite-caps":"petite-caps","all-petite-caps":"all-petite-caps",unicase:"unicase","titling-caps":"titling-caps","normal-caps":"normal"},Ll={"ligatures-normal":"normal","ligatures-none":"none","common-ligatures":"common-ligatures","no-common-ligatures":"no-common-ligatures","discretionary-ligatures":"discretionary-ligatures","no-discretionary-ligatures":"no-discretionary-ligatures","historical-ligatures":"historical-ligatures","no-historical-ligatures":"no-historical-ligatures",contextual:"contextual","no-contextual":"no-contextual"},Wp=(e,t)=>{if(e.utility==="font"&&e.value){let r=t.theme.fontFamily[e.value];if(r)return{"font-family":r.join(", ")}}},zp=(e)=>({antialiased:{"-webkit-font-smoothing":"antialiased","-moz-osx-font-smoothing":"grayscale"},"subpixel-antialiased":{"-webkit-font-smoothing":"auto","-moz-osx-font-smoothing":"auto"}})[e.base],Kp=(e)=>vl[e.base]?{"font-style":vl[e.base]}:void 0,Hp=(e)=>{if(e.utility==="font-stretch"&&e.value){if(["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded"].includes(e.value))return{"font-stretch":e.value};if(e.arbitrary||/^\d+(?:\.\d+)?%$/.test(e.value))return{"font-stretch":e.value};return}},Gp=(e)=>wl[e.base]?{"font-variant-numeric":wl[e.base]}:void 0,qp=(e)=>{if(e.utility==="tracking"){let t={tighter:"-0.05em",tight:"-0.025em",normal:"0em",wide:"0.025em",wider:"0.05em",widest:"0.1em"};if(!e.value)return;if(e.arbitrary)return{"letter-spacing":e.value};if(e.value.startsWith("-")){let r=e.value.slice(1);return t[r]?{"letter-spacing":`-${t[r]}`}:void 0}return t[e.value]?{"letter-spacing":t[e.value]}:void 0}},Yp=(e)=>{if(e.utility==="line-clamp"&&e.value){if(e.value==="none")return{overflow:"visible",display:"block","-webkit-box-orient":"horizontal","-webkit-line-clamp":"none"};if(!e.arbitrary&&!/^\d+$/.test(e.value))return;return{overflow:"hidden",display:"-webkit-box","-webkit-box-orient":"vertical","-webkit-line-clamp":e.value}}},Jp=(e)=>{if(e.utility==="list-image"&&e.value){if(e.value==="none")return{"list-style-image":"none"};if(e.arbitrary)return{"list-style-image":e.value};return{"list-style-image":`url(${e.value})`}}},Xp=(e)=>$l[e.base]?{"list-style-position":$l[e.base]}:void 0,Zp=(e)=>{if(e.utility!=="list"||!e.value)return;return Cl[e.value]?{"list-style-type":Cl[e.value]}:void 0},Qp=(e,t)=>{if(Rl[e.base])return{"text-decoration-line":Rl[e.base]};if(e.utility==="decoration"&&e.value){let r={solid:"solid",double:"double",dotted:"dotted",dashed:"dashed",wavy:"wavy"};if(r[e.value])return{"text-decoration-style":r[e.value]};let n={auto:"auto","from-font":"from-font","0":"0px","1":"1px","2":"2px","4":"4px","8":"8px"};if(n[e.value])return{"text-decoration-thickness":n[e.value]};if(e.arbitrary)return{"text-decoration-thickness":e.value};let i=z(e.value,t,e.modifierArbitrary);if(i)return{"text-decoration-color":i};return}return},ey=(e)=>{if(e.utility==="underline-offset"&&e.value){let t={auto:"auto",0:"0px",1:"1px",2:"2px",4:"4px",8:"8px"};if(t[e.value])return{"text-underline-offset":t[e.value]};if(e.arbitrary)return{"text-underline-offset":e.value};if(/^\d+(?:\.\d+)?$/.test(e.value))return{"text-underline-offset":`${e.value}px`};return}},ty=(e)=>kl[e.base]?{"text-transform":kl[e.base]}:void 0,ry=(e)=>({truncate:{overflow:"hidden","text-overflow":"ellipsis","white-space":"nowrap"},"text-ellipsis":{"text-overflow":"ellipsis"},"text-clip":{"text-overflow":"clip"}})[e.base],ny=(e)=>Sl[e.base]?{"text-wrap":Sl[e.base]}:void 0,iy=(e,t)=>{if(e.utility==="indent"&&e.value){if(e.arbitrary)return{"text-indent":e.value};let r=(i)=>{let o=t.theme.spacing[i];if(o!==void 0)return o;if(/^\d+(?:\.\d+)?$/.test(i))return`${Number.parseFloat(i)*0.25}rem`;return};if(e.value.startsWith("-")){let i=r(e.value.slice(1));return i!==void 0?{"text-indent":`-${i}`}:void 0}let n=r(e.value);return n!==void 0?{"text-indent":n}:void 0}},oy=(e)=>Al[e.base]?{"vertical-align":Al[e.base]}:void 0,sy=(e)=>El[e.base]?{"white-space":El[e.base]}:void 0,ay=(e)=>{if(e.base==="break-normal")return{"overflow-wrap":"normal","word-break":"normal"};if(e.base==="break-words")return{"overflow-wrap":"break-word"};return Tl[e.base]?{"word-break":Tl[e.base]}:void 0},ly=(e)=>{let t={"overflow-wrap-normal":"normal","overflow-wrap-break":"break-word","overflow-wrap-anywhere":"anywhere","wrap-normal":"normal","wrap-break-word":"break-word","wrap-anywhere":"anywhere"};return t[e.base]?{"overflow-wrap":t[e.base]}:void 0},cy=(e)=>{if(e.utility!=="tab"||!e.value)return;if(e.arbitrary||/^\d+$/.test(e.value))return{"tab-size":e.value};return},uy=(e)=>Nl[e.base]?{hyphens:Nl[e.base]}:void 0,fy=(e)=>{if(e.utility==="content"&&e.value){let t={none:"none"};if(t[e.value]||e.value.startsWith('"')||e.value.startsWith("'"))return{content:t[e.value]||e.value};if(e.arbitrary)return{content:e.value};return}},dy=(e,t)=>{if(e.utility==="leading"){if(!e.value)return;let r={none:"1",tight:"1.25",snug:"1.375",normal:"1.5",relaxed:"1.625",loose:"2",3:".75rem",4:"1rem",5:"1.25rem",6:"1.5rem",7:"1.75rem",8:"2rem",9:"2.25rem",10:"2.5rem"};if(r[e.value])return{"line-height":r[e.value]};if(e.arbitrary)return{"line-height":e.value};if(/^\d+(?:\.\d+)?$/.test(e.value))return{"line-height":`${Number.parseFloat(e.value)*0.25}rem`};return}},hy=(e)=>Ol[e.base]?{"writing-mode":Ol[e.base]}:void 0,gy=(e)=>Il[e.base]?{"text-orientation":Il[e.base]}:void 0,my=(e)=>Pl[e.base]?{direction:Pl[e.base]}:void 0,py=(e)=>{if(e.utility==="text-emphasis"&&e.value){let t={none:"none",filled:"filled",open:"open",dot:"dot",circle:"circle","double-circle":"double-circle",triangle:"triangle",sesame:"sesame"};if(t[e.value])return{"text-emphasis":t[e.value]};return e.arbitrary?{"text-emphasis":e.value}:void 0}},yy=(e,t)=>{if(e.utility==="text-emphasis-color"&&e.value){let r=e.value.split("-");if(r.length===2){let[i,o]=r,s=t.theme.colors[i];if(typeof s==="object"&&s[o])return{"text-emphasis-color":W(e.value,s[o],i,t.colorVariables)}}let n=t.theme.colors[e.value];if(typeof n==="string")return{"text-emphasis-color":W(e.value,n,e.value,t.colorVariables)};if(typeof n==="object"&&n!==null&&typeof n.DEFAULT==="string")return{"text-emphasis-color":W(e.value,n.DEFAULT,e.value,t.colorVariables)}}},by=(e,t)=>{if(e.utility==="word-spacing"&&e.value){let r={tighter:"-0.05em",tight:"-0.025em",normal:"normal",wide:"0.025em",wider:"0.05em",widest:"0.1em"};if(r[e.value])return{"word-spacing":r[e.value]};if(t.theme.spacing[e.value])return{"word-spacing":t.theme.spacing[e.value]};if(e.arbitrary)return{"word-spacing":e.value};return}},xy=(e)=>_l[e.base]?{"font-variant-caps":_l[e.base]}:void 0,vy=(e)=>Ll[e.base]?{"font-variant-ligatures":Ll[e.base]}:void 0,Ml=[Wp,zp,Kp,Hp,Gp,xy,vy,qp,dy,Yp,Jp,Xp,Zp,Qp,ey,ty,ry,ny,iy,oy,sy,ay,ly,cy,uy,fy,hy,gy,my,py,yy,by];var Fl={"flex-row":"row","flex-row-reverse":"row-reverse","flex-col":"column","flex-col-reverse":"column-reverse"},Dl={"flex-wrap":"wrap","flex-wrap-reverse":"wrap-reverse","flex-nowrap":"nowrap"},$i={0:"0px",2:"2px",4:"4px",8:"8px"},wy=(e)=>{if(["block","inline-block","inline","flex","inline-flex","grid","inline-grid","hidden","none","contents","flow-root","list-item"].includes(e.utility)&&!e.value)return{display:e.utility==="hidden"?"none":e.utility};if(e.utility==="table"){if(!e.value)return{display:"table"};if(new Set(["cell","row","row-group","column","column-group","header-group","footer-group","caption"]).has(e.value))return{display:`table-${e.value}`}}if(e.utility==="inline"&&e.value==="table")return{display:"inline-table"};if(e.utility==="flow"&&e.value==="root")return{display:"flow-root"};if(e.utility==="list"&&e.value==="item")return{display:"list-item"}},$y=(e)=>{if(e.utility==="scrollbar"&&e.value){let r={auto:"auto",thin:"thin",none:"none"}[e.value];if(r)return{"scrollbar-width":r}}},Cy=(e)=>{if(e.utility==="content"){if(e.value==="none")return{content:"none"};if(e.value==="empty")return{content:'""'};if(e.arbitrary&&e.value)return{content:e.value}}},Ry=(e)=>{if(e.utility==="@container")return{"container-type":"inline-size"};if(e.utility==="@container-normal")return{"container-type":"normal"};if(e.utility.startsWith("@container/"))return{"container-type":"inline-size","container-name":e.utility.slice(11)}},ky=(e)=>Fl[e.utility]?{"flex-direction":Fl[e.utility]}:void 0,Sy=(e)=>Dl[e.utility]?{"flex-wrap":Dl[e.utility]}:void 0,Ay=(e)=>{if(e.utility==="flex"||e.utility.startsWith("flex-")){let t={"flex-1":"1 1 0%","flex-auto":"1 1 auto","flex-initial":"0 1 auto","flex-none":"none"};if(t[e.utility])return{flex:t[e.utility]};if(e.utility==="flex"&&e.arbitrary&&e.value)return{flex:e.value.replace(/_/g," ")}}return},Ey=(e)=>{if(e.utility==="flex-grow"&&!e.value)return{"flex-grow":"1"};if(e.utility==="flex-grow"&&e.value)return{"flex-grow":e.value}},Ty=(e)=>{if(e.utility==="flex-shrink"&&!e.value)return{"flex-shrink":"1"};if(e.utility==="flex-shrink"&&e.value)return{"flex-shrink":e.value}},Ny=(e)=>{if(e.utility==="justify"&&e.value){let t={start:"flex-start",end:"flex-end",center:"center",between:"space-between",around:"space-around",evenly:"space-evenly"};if(t[e.value])return{"justify-content":t[e.value]};if(e.arbitrary)return{"justify-content":e.value}}return},Oy=(e)=>{if(e.utility==="items"&&e.value){let t={start:"flex-start",end:"flex-end",center:"center",baseline:"baseline",stretch:"stretch"};if(t[e.value])return{"align-items":t[e.value]};if(e.arbitrary)return{"align-items":e.value}}return},Iy=(e)=>{if(e.utility==="justify"&&e.value&&e.value.startsWith("items-")){let t={"items-start":"start","items-end":"end","items-center":"center","items-stretch":"stretch","items-center-safe":"safe center","items-end-safe":"safe end"};return t[e.value]?{"justify-items":t[e.value]}:void 0}return},Py=(e)=>{if(e.utility==="content"&&e.value){let t={normal:"normal",center:"center",start:"flex-start",end:"flex-end",between:"space-between",around:"space-around",evenly:"space-evenly",baseline:"baseline",stretch:"stretch"};return t[e.value]?{"align-content":t[e.value]}:void 0}return},_y=(e,t)=>{let n={p:["padding"],px:["padding-left","padding-right"],py:["padding-top","padding-bottom"],pt:["padding-top"],pr:["padding-right"],pb:["padding-bottom"],pl:["padding-left"],ps:["padding-inline-start"],pe:["padding-inline-end"],m:["margin"],mx:["margin-left","margin-right"],my:["margin-top","margin-bottom"],mt:["margin-top"],mr:["margin-right"],mb:["margin-bottom"],ml:["margin-left"],ms:["margin-inline-start"],me:["margin-inline-end"]}[e.utility];if(!n||!e.value)return;let i=(c)=>{if(c==="auto")return e.utility.charCodeAt(0)===109?"auto":void 0;let a=t.theme.spacing[c];if(a!==void 0)return a;if(e.arbitrary)return c;if(/^\d+(?:\.\d+)?$/.test(c)){let l=Number.parseFloat(c);if(Number.isFinite(l))return`${l*0.25}rem`}return},o;if(e.value.startsWith("-")){if(e.utility.charCodeAt(0)===112)return;let c=e.value.slice(1);if(c==="0")o=t.theme.spacing[c]||"0";else{let a=i(c);o=a===void 0?void 0:`-${a}`}}else o=i(e.value);if(o===void 0)return;let s={};for(let c of n)s[c]=o;return s};function pe(e,t,r){let n=e.value;if(n.includes("/")&&!e.arbitrary){let[o,s]=n.split("/").map(Number);if(Number.isNaN(o)||Number.isNaN(s)||s===0)return;return $e(o,s)}let i=t.theme.spacing[n];if(i!==void 0)return i;if(r[n])return r[n];if(e.arbitrary)return n;if(/^\d+(?:\.\d+)?$/.test(n))return`${Number.parseFloat(n)*0.25}rem`;return}var Ly=(e,t)=>{if(e.utility==="w"&&e.value){let n=pe(e,t,{full:"100%",screen:"100vw",svw:"100svw",lvw:"100lvw",dvw:"100dvw",auto:"auto",min:"min-content",max:"max-content",fit:"fit-content"});return n!==void 0?{width:n}:void 0}if(e.utility==="h"&&e.value){let n=pe(e,t,{full:"100%",screen:"100vh",svh:"100svh",lvh:"100lvh",dvh:"100dvh",auto:"auto",min:"min-content",max:"max-content",fit:"fit-content"});return n!==void 0?{height:n}:void 0}if(e.utility==="size"&&e.value){let n=pe(e,t,{full:"100%",auto:"auto",min:"min-content",max:"max-content",fit:"fit-content"});return n!==void 0?{width:n,height:n}:void 0}return},De=null,zr=null,Kr,My={bg:"background-color",text:"color",border:"border-color"},Fy={bg:{color:"background-color",image:"background-image",url:"background-image",position:"background-position",length:"background-size"},text:{color:"color",length:"font-size","absolute-size":"font-size","relative-size":"font-size","family-name":"font-family"},border:{color:"border-color",length:"border-width","line-width":"border-width"}},Dy=new Set(["length","absolute-size","relative-size","percentage","number"]),jy=/^(?:url|(?:repeating-)?(?:linear|radial|conic)-gradient|image-set|-webkit-image-set|cross-fade|element|paint)\(/i,Bl={current:"currentColor",transparent:"transparent",inherit:"inherit"};function W(e,t,r,n){return n?.includes(r)?`var(--color-${e}, ${t})`:t}function Ul(e,t){let r=new Map;for(let[n,i]of Object.entries(e))if(typeof i==="string")r.set(n,W(n,i,n,t));else if(typeof i==="object"&&i!==null){for(let[o,s]of Object.entries(i))if(typeof s==="string"){let c=o==="DEFAULT"?n:`${n}-${o}`;r.set(c,W(c,s,n,t))}}return r}var By=(e,t)=>{let r=My[e.utility];if(!r||!e.value)return;let n=e.value;if(e.arbitrary&&e.typeHint){let l=Fy[e.utility]?.[e.typeHint];return l?{[l]:n}:void 0}if(e.arbitrary&&e.utility==="bg"&&jy.test(n))return{"background-image":n};if(De===null||zr!==t.theme.colors||Kr!==t.colorVariables)De=Ul(t.theme.colors,t.colorVariables),zr=t.theme.colors,Kr=t.colorVariables;let i=Oe(n);if(i===-1){let l=De.get(n);if(l)return{[r]:l}}let o,s=n;if(i!==-1){s=n.slice(0,i);let l=n.slice(i+1);if(l.charCodeAt(0)===91&&l.charCodeAt(l.length-1)===93){let f=Number.parseFloat(l.slice(1,-1));if(Number.isNaN(f)||f<0||f>1)return;o=f}else if(e.modifierArbitrary){let f=Number.parseFloat(l);if(Number.isNaN(f)||f<0||f>1)return;o=f}else{let f=Number.parseInt(l,10);if(Number.isNaN(f)||f<0||f>100)return;o=f/100}let u=De.get(s);if(u)return{[r]:we(u,o)}}let c=Bl[s];if(c)return{[r]:c};if((e.arbitrary||s&&s.charCodeAt(0)===91)&&s){let l=o!==void 0?we(s,o):s;return{[r]:l}}return};function we(e,t){let r=e;if(e.charCodeAt(0)===91&&e.charCodeAt(e.length-1)===93)r=e.slice(1,-1);if(r.charCodeAt(0)===35){let n=r.slice(1);if(n.length===3||n.length===4)n=n.split("").map((c)=>c+c).join("");let i=Number.parseInt(n.slice(0,2),16),o=Number.parseInt(n.slice(2,4),16),s=Number.parseInt(n.slice(4,6),16);return`rgb(${i} ${o} ${s} / ${t})`}if(r.charCodeAt(0)===114){let n=r.match(/rgb\((\d+)\s+(\d+)\s+(\d+)/);if(n)return`rgb(${n[1]} ${n[2]} ${n[3]} / ${t})`}if(r.charCodeAt(0)===111){let n=r.match(/oklch\(([^)]+)\)/);if(n)return`oklch(${n[1]} / ${t})`}if(r.charCodeAt(0)===104){let n=r.match(/hsl\(([^)]+)\)/);if(n)return`hsl(${n[1]} / ${t})`}if(r!=="inherit"&&r!=="transparent"){let n=Number((t*100).toFixed(2));return`color-mix(in srgb, ${r} ${n}%, transparent)`}return r}function z(e,t,r=!1){let n=Oe(e),i=e,o;if(n!==-1){i=e.slice(0,n);let f=e.slice(n+1);if(f.charCodeAt(0)===91&&f.charCodeAt(f.length-1)===93){if(o=Number.parseFloat(f.slice(1,-1)),Number.isNaN(o)||o<0||o>1)return}else if(r){if(o=Number.parseFloat(f),Number.isNaN(o)||o<0||o>1)return}else{let d=Number.parseInt(f,10);if(Number.isNaN(d)||d<0||d>100)return;o=d/100}}let s={current:"currentColor",transparent:"transparent",inherit:"inherit",auto:"auto"};if(s[i])return o!==void 0?we(s[i],o):s[i];let c=t.colorVariables,a=t.theme.colors[i],l=typeof a==="string"?W(i,a,i,c):a;if(typeof l==="string")return o!==void 0?we(l,o):l;if(typeof l==="object"&&l!==null&&typeof l.DEFAULT==="string"){let f=W(i,l.DEFAULT,i,c);return o!==void 0?we(f,o):f}let u=i.split("-");if(u.length>=2){let f=u[u.length-1],d=u.slice(0,-1).join("-"),h=t.theme.colors[d];if(typeof h==="object"&&h[f]){let m=W(i,h[f],d,c);return o!==void 0?we(m,o):m}}if(i.startsWith("var(")||i.startsWith("#")||i.startsWith("rgb(")||i.startsWith("rgba(")||i.startsWith("hsl(")||i.startsWith("hsla(")||i.startsWith("oklch(")||i.startsWith("oklab(")||i.startsWith("lab(")||i.startsWith("lch(")||i.startsWith("color(")||i.startsWith("color-mix(")||i.startsWith("hwb("))return o!==void 0?we(i,o):i;return}var Uy=(e,t)=>{if(e.utility!=="placeholder"||!e.value)return;if(De===null||zr!==t.theme.colors||Kr!==t.colorVariables)De=Ul(t.theme.colors,t.colorVariables),zr=t.theme.colors,Kr=t.colorVariables;let r=e.value,n=Oe(r);if(n===-1){let o=De.get(r);if(o)return{properties:{color:o},pseudoElement:"::placeholder"}}else{let o=r.slice(0,n),s=r.slice(n+1),c;if(s.charCodeAt(0)===91&&s.charCodeAt(s.length-1)===93){let l=Number.parseFloat(s.slice(1,-1));if(Number.isNaN(l)||l<0||l>1)return;c=l}else if(e.modifierArbitrary){let l=Number.parseFloat(s);if(Number.isNaN(l)||l<0||l>1)return;c=l}else{let l=Number.parseInt(s,10);if(Number.isNaN(l)||l<0||l>100)return;c=l/100}let a=De.get(o);if(a)return{properties:{color:we(a,c)},pseudoElement:"::placeholder"}}let i=Bl[e.value];if(i)return{properties:{color:i},pseudoElement:"::placeholder"};return},Vy=(e,t)=>{if(e.utility==="text"&&e.value){let r=e.value,n,i=r.lastIndexOf("/");if(i!==-1&&!e.value.startsWith("[")&&!r.slice(i+1).includes("]"));if(i!==-1){let s=r.slice(0,i),c=r.slice(i+1);if(c&&(t.theme.fontSize[s]||e.arbitrary)){r=s;let a={none:"1",tight:"1.25",snug:"1.375",normal:"1.5",relaxed:"1.625",loose:"2",3:"0.75rem",4:"1rem",5:"1.25rem",6:"1.5rem",7:"1.75rem",8:"2rem",9:"2.25rem",10:"2.5rem"};n=t.theme.lineHeight?.[c]??a[c]??c}}if(e.arbitrary){if(e.typeHint){if(!Dy.has(e.typeHint))return;let c={"font-size":r};if(n)c["line-height"]=n;return c}if(/^#|^rgb|^hsl|^hwb|^lab|^lch|^oklch|^oklab|^color\(|^var\(--/.test(r))return;let s={"font-size":r};if(n)s["line-height"]=n;return s}let o=t.theme.fontSize[r];if(o)return{"font-size":o[0],"line-height":n??o[1].lineHeight}}},Wy=(e)=>{if(e.utility==="font"&&e.value){if(e.arbitrary){let r=e.typeHint;return r==="family-name"||r==="string"?{"font-family":e.value}:{"font-weight":e.value}}let t={thin:"100",extralight:"200",light:"300",normal:"400",medium:"500",semibold:"600",bold:"700",extrabold:"800",black:"900"};return t[e.value]?{"font-weight":t[e.value]}:void 0}return},zy=(e)=>{if(e.utility==="leading"&&e.value){if(e.arbitrary)return{"line-height":e.value};let t={none:"1",tight:"1.25",snug:"1.375",normal:"1.5",relaxed:"1.625",loose:"2","3":"0.75rem","4":"1rem","5":"1.25rem","6":"1.5rem","7":"1.75rem","8":"2rem","9":"2.25rem","10":"2.5rem"};return t[e.value]?{"line-height":t[e.value]}:void 0}return},Ky=(e)=>{if(e.utility==="text"&&e.value){let t={left:"left",center:"center",right:"right",justify:"justify"};return t[e.value]?{"text-align":t[e.value]}:void 0}},Hy=(e)=>{if(e.utility==="border"){if(!e.value)return{"border-width":"1px"};let t={0:"0px",2:"2px",4:"4px",8:"8px"};if(t[e.value])return{"border-width":t[e.value]};let r={t:"border-top-width",r:"border-right-width",b:"border-bottom-width",l:"border-left-width",s:"border-inline-start-width",e:"border-inline-end-width"};if(e.value==="x")return{"border-left-width":"1px","border-right-width":"1px"};if(e.value==="y")return{"border-top-width":"1px","border-bottom-width":"1px"};let n=r[e.value];if(typeof n==="string")return{[n]:"1px"};return}},Gy=(e,t)=>{let r={"border-t":"border-top-width","border-r":"border-right-width","border-b":"border-bottom-width","border-l":"border-left-width","border-x":["border-left-width","border-right-width"],"border-y":["border-top-width","border-bottom-width"],"border-s":"border-inline-start-width","border-e":"border-inline-end-width"},n={"border-t":"border-top-color","border-r":"border-right-color","border-b":"border-bottom-color","border-l":"border-left-color","border-x":["border-left-color","border-right-color"],"border-y":["border-top-color","border-bottom-color"],"border-s":"border-inline-start-color","border-e":"border-inline-end-color"},i=r[e.utility];if(!i)return;if(!e.value){let s=i;if(Array.isArray(s))return s.reduce((c,a)=>({...c,[a]:"1px"}),{});return{[s]:"1px"}}if(e.arbitrary){let s=e.value,l=(/^#|^(?:rgb|rgba|hsl|hsla|oklch|oklab|lab|lch)\(|^(?:currentColor|transparent|inherit)$/i.test(s)?n[e.utility]:i)??i;if(Array.isArray(l))return l.reduce((u,f)=>({...u,[f]:s}),{});return{[l]:s}}if($i[e.value]){let s=i;if(Array.isArray(s))return s.reduce((c,a)=>({...c,[a]:$i[e.value]}),{});return{[s]:$i[e.value]}}let o=n[e.utility];if(o&&t){let s=e.value.split("-");if(s.length>=2){let a=s[s.length-1],l=s.slice(0,-1).join("-"),u=t.theme.colors[l];if(u&&typeof u==="object"&&u[a]){let f=o,d=W(e.value,u[a],l,t.colorVariables);if(Array.isArray(f))return f.reduce((h,m)=>({...h,[m]:d}),{});return{[f]:d}}}let c=t.theme.colors[e.value];if(typeof c==="string"){let a=o;if(Array.isArray(a))return a.reduce((l,u)=>({...l,[u]:c}),{});return{[a]:c}}if(c&&typeof c==="object"&&typeof c.DEFAULT==="string"){let a=o;if(Array.isArray(a))return a.reduce((l,u)=>({...l,[u]:c.DEFAULT}),{});return{[a]:c.DEFAULT}}if(e.value==="transparent"||e.value==="current"||e.value==="inherit"){let a=e.value==="current"?"currentColor":e.value,l=o;if(Array.isArray(l))return l.reduce((u,f)=>({...u,[f]:a}),{});return{[l]:a}}}return};function Xe(e,t){if(!e.value)return t.theme.borderRadius.DEFAULT;if(t.theme.borderRadius[e.value]!==void 0)return t.theme.borderRadius[e.value];if(e.arbitrary)return e.value;return}var jl={t:["border-top-left-radius","border-top-right-radius"],r:["border-top-right-radius","border-bottom-right-radius"],b:["border-bottom-left-radius","border-bottom-right-radius"],l:["border-top-left-radius","border-bottom-left-radius"],tl:["border-top-left-radius"],tr:["border-top-right-radius"],bl:["border-bottom-left-radius"],br:["border-bottom-right-radius"],s:["border-start-start-radius","border-end-start-radius"],e:["border-start-end-radius","border-end-end-radius"],ss:["border-start-start-radius"],se:["border-start-end-radius"],es:["border-end-start-radius"],ee:["border-end-end-radius"]},qy=(e,t)=>{if(e.utility==="rounded"){if(e.arbitrary&&e.value)return{"border-radius":e.value};if(e.value&&jl[e.value]){let o=t.theme.borderRadius.DEFAULT,s={};for(let c of jl[e.value])s[c]=o;return s}let i=e.value?t.theme.borderRadius[e.value]:t.theme.borderRadius.DEFAULT;return i?{"border-radius":i}:void 0}if(e.utility==="rounded-s"){let i=Xe(e,t);if(i===void 0)return;return{"border-start-start-radius":i,"border-end-start-radius":i}}if(e.utility==="rounded-e"){let i=Xe(e,t);if(i===void 0)return;return{"border-start-end-radius":i,"border-end-end-radius":i}}if(e.utility==="rounded-ss"){let i=Xe(e,t);if(i===void 0)return;return{"border-start-start-radius":i}}if(e.utility==="rounded-se"){let i=Xe(e,t);if(i===void 0)return;return{"border-start-end-radius":i}}if(e.utility==="rounded-es"){let i=Xe(e,t);if(i===void 0)return;return{"border-end-start-radius":i}}if(e.utility==="rounded-ee"){let i=Xe(e,t);if(i===void 0)return;return{"border-end-end-radius":i}}let n={"rounded-t":["border-top-left-radius","border-top-right-radius"],"rounded-r":["border-top-right-radius","border-bottom-right-radius"],"rounded-b":["border-bottom-left-radius","border-bottom-right-radius"],"rounded-l":["border-top-left-radius","border-bottom-left-radius"],"rounded-tl":["border-top-left-radius"],"rounded-tr":["border-top-right-radius"],"rounded-bl":["border-bottom-left-radius"],"rounded-br":["border-bottom-right-radius"]}[e.utility];if(n){let i=Xe(e,t);if(i===void 0)return;let o={};for(let s of n)o[s]=i;return o}},Ci=[hi,ka,_y,Ly,Py,Vy,Ky,...Ml,Wy,zy,...xa,...ba,...mi,Uy,By,...sa,...al,ky,Sy,Ay,Ey,Ty,Ny,Oy,Iy,...Ca,...xl,...mi,...qa,...wa,Gy,Hy,qy,Ry,$y,Cy,wy];function Ai(e,t){let r={...e};for(let n in t){let i=t[n],o=r[n];if(i&&typeof i==="object"&&!Array.isArray(i)&&o&&typeof o==="object"&&!Array.isArray(o))r[n]=Ai(o,i);else if(i!==void 0)r[n]=i}return r}var Yy={block:{display:"block"},"inline-block":{display:"inline-block"},inline:{display:"inline"},flex:{display:"flex"},"inline-flex":{display:"inline-flex"},grid:{display:"grid"},"inline-grid":{display:"inline-grid"},hidden:{display:"none"},none:{display:"none"}},Jy={"flex-row":{"flex-direction":"row"},"flex-row-reverse":{"flex-direction":"row-reverse"},"flex-col":{"flex-direction":"column"},"flex-col-reverse":{"flex-direction":"column-reverse"}},Xy={"flex-wrap":{"flex-wrap":"wrap"},"flex-wrap-reverse":{"flex-wrap":"wrap-reverse"},"flex-nowrap":{"flex-wrap":"nowrap"}},Zy={"flex-1":{flex:"1 1 0%"},"flex-auto":{flex:"1 1 auto"},"flex-initial":{flex:"0 1 auto"},"flex-none":{flex:"none"}},Qy={grow:{"flex-grow":"1"},"grow-0":{"flex-grow":"0"},shrink:{"flex-shrink":"1"},"shrink-0":{"flex-shrink":"0"}},eb={start:"flex-start",end:"flex-end",center:"center",between:"space-between",around:"space-around",evenly:"space-evenly","center-safe":"safe center","end-safe":"safe flex-end"},tb={start:"flex-start",end:"flex-end",center:"center",baseline:"baseline",stretch:"stretch","center-safe":"safe center","end-safe":"safe flex-end"},rb={normal:"normal",center:"center",start:"flex-start",end:"flex-end",between:"space-between",around:"space-around",evenly:"space-evenly",baseline:"baseline",stretch:"stretch","center-safe":"safe center","end-safe":"safe flex-end"},nb={auto:"auto",start:"flex-start",end:"flex-end",center:"center",stretch:"stretch",baseline:"baseline","center-safe":"safe center","end-safe":"safe flex-end"},ib={"border-solid":{"border-style":"solid"},"border-dashed":{"border-style":"dashed"},"border-dotted":{"border-style":"dotted"},"border-double":{"border-style":"double"},"border-none":{"border-style":"none"}},ob={transform:{transform:Lt},"transform-cpu":{transform:Lt},"transform-gpu":{transform:wi},"transform-none":{transform:"none"}},pt={"transition-timing-function":"cubic-bezier(0.4, 0, 0.2, 1)","transition-duration":"150ms"},sb={"transition-none":{"transition-property":"none"},"transition-all":{"transition-property":"all",...pt},transition:{"transition-property":"color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter",...pt},"transition-colors":{"transition-property":"color, background-color, border-color, text-decoration-color, fill, stroke",...pt},"transition-opacity":{"transition-property":"opacity",...pt},"transition-shadow":{"transition-property":"box-shadow",...pt},"transition-transform":{"transition-property":"transform",...pt}},ab={"ease-linear":{"transition-timing-function":"linear"},"ease-in":{"transition-timing-function":"cubic-bezier(0.4, 0, 1, 1)"},"ease-out":{"transition-timing-function":"cubic-bezier(0, 0, 0.2, 1)"},"ease-in-out":{"transition-timing-function":"cubic-bezier(0.4, 0, 0.2, 1)"}},lb={"animate-none":{animation:"none"},"animate-spin":{animation:"spin 1s linear infinite"},"animate-ping":{animation:"ping 1s cubic-bezier(0, 0, 0.2, 1) infinite"},"animate-pulse":{animation:"pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite"},"animate-bounce":{animation:"bounce 1s infinite"}},cb={spin:`@keyframes spin {
|
|
358
358
|
from { transform: rotate(0deg); }
|
|
359
359
|
to { transform: rotate(360deg); }
|
|
360
360
|
}`,ping:`@keyframes ping {
|
|
@@ -365,32 +365,32 @@ video {
|
|
|
365
365
|
}`,bounce:`@keyframes bounce {
|
|
366
366
|
0%, 100% { transform: translateY(-25%); animation-timing-function: cubic-bezier(0.8, 0, 1, 1); }
|
|
367
367
|
50% { transform: translateY(0); animation-timing-function: cubic-bezier(0, 0, 0.2, 1); }
|
|
368
|
-
}`},ab={center:"center",top:"top","top-right":"top right",right:"right","bottom-right":"bottom right",bottom:"bottom","bottom-left":"bottom left",left:"left","top-left":"top left"},lb={"1":"repeat(1, minmax(0, 1fr))","2":"repeat(2, minmax(0, 1fr))","3":"repeat(3, minmax(0, 1fr))","4":"repeat(4, minmax(0, 1fr))","5":"repeat(5, minmax(0, 1fr))","6":"repeat(6, minmax(0, 1fr))","7":"repeat(7, minmax(0, 1fr))","8":"repeat(8, minmax(0, 1fr))","9":"repeat(9, minmax(0, 1fr))","10":"repeat(10, minmax(0, 1fr))","11":"repeat(11, minmax(0, 1fr))","12":"repeat(12, minmax(0, 1fr))",none:"none",subgrid:"subgrid"},cb={"1":"repeat(1, minmax(0, 1fr))","2":"repeat(2, minmax(0, 1fr))","3":"repeat(3, minmax(0, 1fr))","4":"repeat(4, minmax(0, 1fr))","5":"repeat(5, minmax(0, 1fr))","6":"repeat(6, minmax(0, 1fr))",none:"none",subgrid:"subgrid"},ub={auto:"auto","span-1":"span 1 / span 1","span-2":"span 2 / span 2","span-3":"span 3 / span 3","span-4":"span 4 / span 4","span-5":"span 5 / span 5","span-6":"span 6 / span 6","span-7":"span 7 / span 7","span-8":"span 8 / span 8","span-9":"span 9 / span 9","span-10":"span 10 / span 10","span-11":"span 11 / span 11","span-12":"span 12 / span 12","span-full":"1 / -1"},fb={auto:"auto","span-1":"span 1 / span 1","span-2":"span 2 / span 2","span-3":"span 3 / span 3","span-4":"span 4 / span 4","span-5":"span 5 / span 5","span-6":"span 6 / span 6","span-full":"1 / -1"},db={row:"row",col:"column",dense:"dense","row-dense":"row dense","col-dense":"column dense"},jl={auto:"auto",min:"min-content",max:"max-content",fr:"minmax(0, 1fr)"},wi={center:"center",start:"start",end:"end",between:"space-between",around:"space-around",evenly:"space-evenly",stretch:"stretch","center-safe":"safe center","end-safe":"safe end"};function pt(e){return{"--tc-ring-offset-shadow":"var(--tc-ring-inset,) 0 0 0 var(--tc-ring-offset-width, 0px) var(--tc-ring-offset-color, #fff)","--tc-ring-shadow":`var(--tc-ring-inset,) 0 0 0 calc(${e} + var(--tc-ring-offset-width, 0px)) var(--tc-ring-color, currentcolor)`,"box-shadow":U}}var hb={ring:pt("1px"),"ring-0":pt("0px"),"ring-1":pt("1px"),"ring-2":pt("2px"),"ring-4":pt("4px"),"ring-8":pt("8px"),"ring-inset":{"--tc-ring-inset":"inset"}},nc={"shadow-2xs":{"--tc-shadow":"0 1px rgb(0 0 0 / 0.05)","--tc-shadow-colored":"0 1px var(--tc-shadow-color)","box-shadow":U},"shadow-xs":{"--tc-shadow":"0 1px 2px 0 rgb(0 0 0 / 0.05)","--tc-shadow-colored":"0 1px 2px 0 var(--tc-shadow-color)","box-shadow":U},"shadow-sm":{"--tc-shadow":"0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1)","--tc-shadow-colored":"0 1px 3px 0 var(--tc-shadow-color), 0 1px 2px -1px var(--tc-shadow-color)","box-shadow":U},shadow:{"--tc-shadow":"0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1)","--tc-shadow-colored":"0 1px 3px 0 var(--tc-shadow-color), 0 1px 2px -1px var(--tc-shadow-color)","box-shadow":U},"shadow-md":{"--tc-shadow":"0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1)","--tc-shadow-colored":"0 4px 6px -1px var(--tc-shadow-color), 0 2px 4px -2px var(--tc-shadow-color)","box-shadow":U},"shadow-lg":{"--tc-shadow":"0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1)","--tc-shadow-colored":"0 10px 15px -3px var(--tc-shadow-color), 0 4px 6px -4px var(--tc-shadow-color)","box-shadow":U},"shadow-xl":{"--tc-shadow":"0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1)","--tc-shadow-colored":"0 20px 25px -5px var(--tc-shadow-color), 0 8px 10px -6px var(--tc-shadow-color)","box-shadow":U},"shadow-2xl":{"--tc-shadow":"0 25px 50px -12px rgb(0 0 0 / 0.25)","--tc-shadow-colored":"0 25px 50px -12px var(--tc-shadow-color)","box-shadow":U},"shadow-inner":{"--tc-shadow":"inset 0 2px 4px 0 rgb(0 0 0 / 0.05)","--tc-shadow-colored":"inset 0 2px 4px 0 var(--tc-shadow-color)","box-shadow":U},"shadow-none":{"--tc-shadow":"0 0 #0000","box-shadow":U}},ic={"rounded-none":{"border-radius":"0px"},"rounded-xs":{"border-radius":"0.125rem"},"rounded-sm":{"border-radius":"0.25rem"},rounded:{"border-radius":"0.25rem"},"rounded-md":{"border-radius":"0.375rem"},"rounded-lg":{"border-radius":"0.5rem"},"rounded-xl":{"border-radius":"0.75rem"},"rounded-2xl":{"border-radius":"1rem"},"rounded-3xl":{"border-radius":"1.5rem"},"rounded-4xl":{"border-radius":"2rem"},"rounded-full":{"border-radius":"9999px"},"rounded-t-none":{"border-top-left-radius":"0px","border-top-right-radius":"0px"},"rounded-t-sm":{"border-top-left-radius":"0.25rem","border-top-right-radius":"0.25rem"},"rounded-t-lg":{"border-top-left-radius":"0.5rem","border-top-right-radius":"0.5rem"},"rounded-r-lg":{"border-top-right-radius":"0.5rem","border-bottom-right-radius":"0.5rem"},"rounded-b-lg":{"border-bottom-left-radius":"0.5rem","border-bottom-right-radius":"0.5rem"},"rounded-l-lg":{"border-top-left-radius":"0.5rem","border-bottom-left-radius":"0.5rem"},"rounded-tl-lg":{"border-top-left-radius":"0.5rem"},"rounded-tr-lg":{"border-top-right-radius":"0.5rem"},"rounded-br-lg":{"border-bottom-right-radius":"0.5rem"},"rounded-bl-lg":{"border-bottom-left-radius":"0.5rem"}},gb={border:{"border-width":"1px"},"border-0":{"border-width":"0px"},"border-2":{"border-width":"2px"},"border-4":{"border-width":"4px"},"border-8":{"border-width":"8px"},"border-t":{"border-top-width":"1px"},"border-r":{"border-right-width":"1px"},"border-b":{"border-bottom-width":"1px"},"border-l":{"border-left-width":"1px"},"border-t-0":{"border-top-width":"0px"},"border-r-0":{"border-right-width":"0px"},"border-b-0":{"border-bottom-width":"0px"},"border-l-0":{"border-left-width":"0px"},"border-t-2":{"border-top-width":"2px"},"border-r-2":{"border-right-width":"2px"},"border-b-2":{"border-bottom-width":"2px"},"border-l-2":{"border-left-width":"2px"},"border-t-4":{"border-top-width":"4px"},"border-r-4":{"border-right-width":"4px"},"border-b-4":{"border-bottom-width":"4px"},"border-l-4":{"border-left-width":"4px"},"border-x":{"border-left-width":"1px","border-right-width":"1px"},"border-y":{"border-top-width":"1px","border-bottom-width":"1px"},"border-x-0":{"border-left-width":"0px","border-right-width":"0px"},"border-y-0":{"border-top-width":"0px","border-bottom-width":"0px"},"border-x-2":{"border-left-width":"2px","border-right-width":"2px"},"border-y-2":{"border-top-width":"2px","border-bottom-width":"2px"}},mb={"ring-offset-0":{"--tc-ring-offset-width":"0px"},"ring-offset-1":{"--tc-ring-offset-width":"1px"},"ring-offset-2":{"--tc-ring-offset-width":"2px"},"ring-offset-4":{"--tc-ring-offset-width":"4px"},"ring-offset-8":{"--tc-ring-offset-width":"8px"}},pb={"opacity-0":{opacity:"0"},"opacity-5":{opacity:"0.05"},"opacity-10":{opacity:"0.1"},"opacity-20":{opacity:"0.2"},"opacity-25":{opacity:"0.25"},"opacity-30":{opacity:"0.3"},"opacity-40":{opacity:"0.4"},"opacity-50":{opacity:"0.5"},"opacity-60":{opacity:"0.6"},"opacity-70":{opacity:"0.7"},"opacity-75":{opacity:"0.75"},"opacity-80":{opacity:"0.8"},"opacity-90":{opacity:"0.9"},"opacity-95":{opacity:"0.95"},"opacity-100":{opacity:"1"}},zr={"0":"0",px:"1px","0.5":"0.125rem","1":"0.25rem","1.5":"0.375rem","2":"0.5rem","2.5":"0.625rem","3":"0.75rem","3.5":"0.875rem","4":"1rem","5":"1.25rem","6":"1.5rem","7":"1.75rem","8":"2rem","9":"2.25rem","10":"2.5rem","11":"2.75rem","12":"3rem","14":"3.5rem","16":"4rem","20":"5rem","24":"6rem","28":"7rem","32":"8rem","36":"9rem","40":"10rem","44":"11rem","48":"12rem","52":"13rem","56":"14rem","60":"15rem","64":"16rem","72":"18rem","80":"20rem","96":"24rem"},Bl={...zr,auto:"auto",full:"100%",screen:"100vw",min:"min-content",max:"max-content",fit:"fit-content",...yb(6)};function yb(e){let t={};for(let r=2;r<=e;r++)for(let n=1;n<r;n++)t[`${n}/${r}`]=Ce(n,r);return t}var yt={"gray-50":"oklch(98.5% 0.002 247.839)","gray-100":"oklch(96.7% 0.003 264.542)","gray-200":"oklch(92.8% 0.006 264.531)","gray-300":"oklch(87.2% 0.01 258.338)","gray-400":"oklch(70.7% 0.022 261.325)","gray-500":"oklch(55.1% 0.027 264.364)","gray-600":"oklch(44.6% 0.03 256.802)","gray-700":"oklch(37.3% 0.034 259.733)","gray-800":"oklch(27.8% 0.033 256.848)","gray-900":"oklch(21% 0.034 264.665)","gray-950":"oklch(13% 0.028 261.692)","red-50":"oklch(97.1% 0.013 17.38)","red-100":"oklch(93.6% 0.032 17.717)","red-200":"oklch(88.5% 0.062 18.334)","red-300":"oklch(80.8% 0.114 19.571)","red-400":"oklch(70.4% 0.191 22.216)","red-500":"oklch(63.7% 0.237 25.331)","red-600":"oklch(57.7% 0.245 27.325)","red-700":"oklch(50.5% 0.213 27.518)","red-800":"oklch(44.4% 0.177 26.899)","red-900":"oklch(39.6% 0.141 25.723)","red-950":"oklch(25.8% 0.092 26.042)","blue-50":"oklch(97% 0.014 254.604)","blue-100":"oklch(93.2% 0.032 255.585)","blue-200":"oklch(88.2% 0.059 254.128)","blue-300":"oklch(80.9% 0.105 251.813)","blue-400":"oklch(70.7% 0.165 254.624)","blue-500":"oklch(62.3% 0.214 259.815)","blue-600":"oklch(54.6% 0.245 262.881)","blue-700":"oklch(48.8% 0.243 264.376)","blue-800":"oklch(42.4% 0.199 265.638)","blue-900":"oklch(37.9% 0.146 265.522)","blue-950":"oklch(28.2% 0.091 267.935)","green-50":"oklch(98.2% 0.018 155.826)","green-100":"oklch(96.2% 0.044 156.743)","green-200":"oklch(92.5% 0.084 155.995)","green-300":"oklch(87.1% 0.15 154.449)","green-400":"oklch(79.2% 0.209 151.711)","green-500":"oklch(72.3% 0.219 149.579)","green-600":"oklch(62.7% 0.194 149.214)","green-700":"oklch(52.7% 0.154 150.069)","green-800":"oklch(44.8% 0.119 151.328)","green-900":"oklch(39.3% 0.095 152.535)","green-950":"oklch(26.6% 0.065 152.934)","yellow-50":"oklch(98.7% 0.026 102.212)","yellow-100":"oklch(97.3% 0.071 103.193)","yellow-200":"oklch(94.5% 0.129 101.54)","yellow-300":"oklch(90.5% 0.182 98.111)","yellow-400":"oklch(85.2% 0.199 91.936)","yellow-500":"oklch(79.5% 0.184 86.047)","yellow-600":"oklch(68.1% 0.162 75.834)","yellow-700":"oklch(55.4% 0.135 66.442)","yellow-800":"oklch(47.6% 0.114 61.907)","yellow-900":"oklch(42.1% 0.095 57.708)","yellow-950":"oklch(28.6% 0.066 53.813)","purple-50":"oklch(97.7% 0.014 308.299)","purple-100":"oklch(94.6% 0.033 307.174)","purple-200":"oklch(90.2% 0.063 306.703)","purple-300":"oklch(82.7% 0.119 306.383)","purple-400":"oklch(71.4% 0.203 305.504)","purple-500":"oklch(62.7% 0.265 303.9)","purple-600":"oklch(55.8% 0.288 302.321)","purple-700":"oklch(49.6% 0.265 301.924)","purple-800":"oklch(43.8% 0.218 303.724)","purple-900":"oklch(38.1% 0.176 304.987)","purple-950":"oklch(29.1% 0.149 302.717)","pink-50":"oklch(97.1% 0.014 343.198)","pink-100":"oklch(94.8% 0.028 342.258)","pink-200":"oklch(89.9% 0.061 343.231)","pink-300":"oklch(82.3% 0.12 346.018)","pink-400":"oklch(71.8% 0.202 349.761)","pink-500":"oklch(65.6% 0.241 354.308)","pink-600":"oklch(59.2% 0.249 0.584)","pink-700":"oklch(52.5% 0.223 3.958)","pink-800":"oklch(45.9% 0.187 3.815)","pink-900":"oklch(40.8% 0.153 2.432)","pink-950":"oklch(28.4% 0.109 3.907)","indigo-50":"oklch(96.2% 0.018 272.314)","indigo-100":"oklch(93% 0.034 272.788)","indigo-200":"oklch(87% 0.065 274.039)","indigo-300":"oklch(78.5% 0.115 274.713)","indigo-400":"oklch(67.3% 0.182 276.935)","indigo-500":"oklch(58.5% 0.233 277.117)","indigo-600":"oklch(51.1% 0.262 276.966)","indigo-700":"oklch(45.7% 0.24 277.023)","indigo-800":"oklch(39.8% 0.195 277.366)","indigo-900":"oklch(35.9% 0.144 278.697)","indigo-950":"oklch(25.7% 0.09 281.288)","cyan-50":"oklch(98.4% 0.019 200.873)","cyan-100":"oklch(95.6% 0.045 203.388)","cyan-200":"oklch(91.7% 0.08 205.041)","cyan-300":"oklch(86.5% 0.127 207.078)","cyan-400":"oklch(78.9% 0.154 211.53)","cyan-500":"oklch(71.5% 0.143 215.221)","cyan-600":"oklch(60.9% 0.126 221.723)","cyan-700":"oklch(52% 0.105 223.128)","cyan-800":"oklch(45% 0.085 224.283)","cyan-900":"oklch(39.8% 0.07 227.392)","cyan-950":"oklch(30.2% 0.056 229.695)","emerald-50":"oklch(97.9% 0.021 166.113)","emerald-100":"oklch(95% 0.052 163.051)","emerald-200":"oklch(90.5% 0.093 164.15)","emerald-300":"oklch(84.5% 0.143 164.978)","emerald-400":"oklch(76.5% 0.177 163.223)","emerald-500":"oklch(69.6% 0.17 162.48)","emerald-600":"oklch(59.6% 0.145 163.225)","emerald-700":"oklch(50.8% 0.118 165.612)","emerald-800":"oklch(43.2% 0.095 166.913)","emerald-900":"oklch(37.8% 0.077 168.94)","emerald-950":"oklch(26.2% 0.051 172.552)",white:"#fff",black:"#000",transparent:"transparent",current:"currentColor"},bb={"font-thin":{"font-weight":"100"},"font-extralight":{"font-weight":"200"},"font-light":{"font-weight":"300"},"font-normal":{"font-weight":"400"},"font-medium":{"font-weight":"500"},"font-semibold":{"font-weight":"600"},"font-bold":{"font-weight":"700"},"font-extrabold":{"font-weight":"800"},"font-black":{"font-weight":"900"}},xb={italic:{"font-style":"italic"},"not-italic":{"font-style":"normal"}},vb={uppercase:{"text-transform":"uppercase"},lowercase:{"text-transform":"lowercase"},capitalize:{"text-transform":"capitalize"},"normal-case":{"text-transform":"none"}},wb={underline:{"text-decoration-line":"underline"},overline:{"text-decoration-line":"overline"},"line-through":{"text-decoration-line":"line-through"},"no-underline":{"text-decoration-line":"none"}},Cb={"decoration-solid":{"text-decoration-style":"solid"},"decoration-double":{"text-decoration-style":"double"},"decoration-dotted":{"text-decoration-style":"dotted"},"decoration-dashed":{"text-decoration-style":"dashed"},"decoration-wavy":{"text-decoration-style":"wavy"}},$b={"text-left":{"text-align":"left"},"text-center":{"text-align":"center"},"text-right":{"text-align":"right"},"text-justify":{"text-align":"justify"},"text-start":{"text-align":"start"},"text-end":{"text-align":"end"}},Rb={truncate:{overflow:"hidden","text-overflow":"ellipsis","white-space":"nowrap"},"text-ellipsis":{"text-overflow":"ellipsis"},"text-clip":{"text-overflow":"clip"}},kb={"text-wrap":{"text-wrap":"wrap"},"text-nowrap":{"text-wrap":"nowrap"},"text-balance":{"text-wrap":"balance"},"text-pretty":{"text-wrap":"pretty"}},Sb={"whitespace-normal":{"white-space":"normal"},"whitespace-nowrap":{"white-space":"nowrap"},"whitespace-pre":{"white-space":"pre"},"whitespace-pre-line":{"white-space":"pre-line"},"whitespace-pre-wrap":{"white-space":"pre-wrap"},"whitespace-break-spaces":{"white-space":"break-spaces"}},Ab={"break-normal":{"overflow-wrap":"normal","word-break":"normal"},"break-words":{"overflow-wrap":"break-word"},"break-all":{"word-break":"break-all"},"break-keep":{"word-break":"keep-all"}},Eb={"align-baseline":{"vertical-align":"baseline"},"align-top":{"vertical-align":"top"},"align-middle":{"vertical-align":"middle"},"align-bottom":{"vertical-align":"bottom"},"align-text-top":{"vertical-align":"text-top"},"align-text-bottom":{"vertical-align":"text-bottom"},"align-sub":{"vertical-align":"sub"},"align-super":{"vertical-align":"super"}},Tb={"list-none":{"list-style-type":"none"},"list-disc":{"list-style-type":"disc"},"list-decimal":{"list-style-type":"decimal"},"list-inside":{"list-style-position":"inside"},"list-outside":{"list-style-position":"outside"}},Nb={"hyphens-none":{hyphens:"none"},"hyphens-manual":{hyphens:"manual"},"hyphens-auto":{hyphens:"auto"}},Ob={static:{position:"static"},fixed:{position:"fixed"},absolute:{position:"absolute"},relative:{position:"relative"},sticky:{position:"sticky"}},Ib={visible:{visibility:"visible"},invisible:{visibility:"hidden"},collapse:{visibility:"collapse"}},Pb={"float-left":{float:"left"},"float-right":{float:"right"},"float-none":{float:"none"},"float-start":{float:"inline-start"},"float-end":{float:"inline-end"}},_b={"clear-left":{clear:"left"},"clear-right":{clear:"right"},"clear-both":{clear:"both"},"clear-none":{clear:"none"},"clear-start":{clear:"inline-start"},"clear-end":{clear:"inline-end"}},Lb={isolate:{isolation:"isolate"},"isolation-auto":{isolation:"auto"}},Mb={"object-contain":{"object-fit":"contain"},"object-cover":{"object-fit":"cover"},"object-fill":{"object-fit":"fill"},"object-none":{"object-fit":"none"},"object-scale-down":{"object-fit":"scale-down"}},Fb={"object-bottom":{"object-position":"bottom"},"object-center":{"object-position":"center"},"object-left":{"object-position":"left"},"object-left-bottom":{"object-position":"left bottom"},"object-left-top":{"object-position":"left top"},"object-right":{"object-position":"right"},"object-right-bottom":{"object-position":"right bottom"},"object-right-top":{"object-position":"right top"},"object-top":{"object-position":"top"}},Db={"overflow-auto":{overflow:"auto"},"overflow-hidden":{overflow:"hidden"},"overflow-clip":{overflow:"clip"},"overflow-ellipsis":{"text-overflow":"ellipsis"},"overflow-visible":{overflow:"visible"},"overflow-scroll":{overflow:"scroll"},"overflow-x-auto":{"overflow-x":"auto"},"overflow-x-hidden":{"overflow-x":"hidden"},"overflow-x-clip":{"overflow-x":"clip"},"overflow-x-visible":{"overflow-x":"visible"},"overflow-x-scroll":{"overflow-x":"scroll"},"overflow-y-auto":{"overflow-y":"auto"},"overflow-y-hidden":{"overflow-y":"hidden"},"overflow-y-clip":{"overflow-y":"clip"},"overflow-y-visible":{"overflow-y":"visible"},"overflow-y-scroll":{"overflow-y":"scroll"}},jb={"overscroll-auto":{"overscroll-behavior":"auto"},"overscroll-contain":{"overscroll-behavior":"contain"},"overscroll-none":{"overscroll-behavior":"none"},"overscroll-x-auto":{"overscroll-behavior-x":"auto"},"overscroll-x-contain":{"overscroll-behavior-x":"contain"},"overscroll-x-none":{"overscroll-behavior-x":"none"},"overscroll-y-auto":{"overscroll-behavior-y":"auto"},"overscroll-y-contain":{"overscroll-behavior-y":"contain"},"overscroll-y-none":{"overscroll-behavior-y":"none"}},Bb={"z-0":{"z-index":"0"},"z-10":{"z-index":"10"},"z-20":{"z-index":"20"},"z-30":{"z-index":"30"},"z-40":{"z-index":"40"},"z-50":{"z-index":"50"},"z-auto":{"z-index":"auto"}},Vb={"aspect-auto":{"aspect-ratio":"auto"},"aspect-square":{"aspect-ratio":"1 / 1"},"aspect-video":{"aspect-ratio":"16 / 9"}},Ub={"box-border":{"box-sizing":"border-box"},"box-content":{"box-sizing":"content-box"}},Wb={"box-decoration-clone":{"box-decoration-break":"clone"},"box-decoration-slice":{"box-decoration-break":"slice"}},zb={"bg-fixed":{"background-attachment":"fixed"},"bg-local":{"background-attachment":"local"},"bg-scroll":{"background-attachment":"scroll"}},Kb={"bg-clip-border":{"background-clip":"border-box"},"bg-clip-padding":{"background-clip":"padding-box"},"bg-clip-content":{"background-clip":"content-box"},"bg-clip-text":{"background-clip":"text","-webkit-background-clip":"text"}},Hb={"bg-origin-border":{"background-origin":"border-box"},"bg-origin-padding":{"background-origin":"padding-box"},"bg-origin-content":{"background-origin":"content-box"}},Gb={"bg-bottom":{"background-position":"bottom"},"bg-center":{"background-position":"center"},"bg-left":{"background-position":"left"},"bg-left-bottom":{"background-position":"left bottom"},"bg-left-top":{"background-position":"left top"},"bg-right":{"background-position":"right"},"bg-right-bottom":{"background-position":"right bottom"},"bg-right-top":{"background-position":"right top"},"bg-top":{"background-position":"top"}},qb={"bg-repeat":{"background-repeat":"repeat"},"bg-no-repeat":{"background-repeat":"no-repeat"},"bg-repeat-x":{"background-repeat":"repeat-x"},"bg-repeat-y":{"background-repeat":"repeat-y"},"bg-repeat-round":{"background-repeat":"round"},"bg-repeat-space":{"background-repeat":"space"}},Yb={"bg-auto":{"background-size":"auto"},"bg-cover":{"background-size":"cover"},"bg-contain":{"background-size":"contain"}},Jb={"bg-none":{"background-image":"none"},"bg-gradient-to-t":{"background-image":"linear-gradient(to top, var(--tc-gradient-stops))"},"bg-gradient-to-tr":{"background-image":"linear-gradient(to top right, var(--tc-gradient-stops))"},"bg-gradient-to-r":{"background-image":"linear-gradient(to right, var(--tc-gradient-stops))"},"bg-gradient-to-br":{"background-image":"linear-gradient(to bottom right, var(--tc-gradient-stops))"},"bg-gradient-to-b":{"background-image":"linear-gradient(to bottom, var(--tc-gradient-stops))"},"bg-gradient-to-bl":{"background-image":"linear-gradient(to bottom left, var(--tc-gradient-stops))"},"bg-gradient-to-l":{"background-image":"linear-gradient(to left, var(--tc-gradient-stops))"},"bg-gradient-to-tl":{"background-image":"linear-gradient(to top left, var(--tc-gradient-stops))"},"bg-radial":{"background-image":"radial-gradient(var(--tc-gradient-stops))"},"bg-radial-at-t":{"background-image":"radial-gradient(at top, var(--tc-gradient-stops))"},"bg-radial-at-tr":{"background-image":"radial-gradient(at top right, var(--tc-gradient-stops))"},"bg-radial-at-r":{"background-image":"radial-gradient(at right, var(--tc-gradient-stops))"},"bg-radial-at-br":{"background-image":"radial-gradient(at bottom right, var(--tc-gradient-stops))"},"bg-radial-at-b":{"background-image":"radial-gradient(at bottom, var(--tc-gradient-stops))"},"bg-radial-at-bl":{"background-image":"radial-gradient(at bottom left, var(--tc-gradient-stops))"},"bg-radial-at-l":{"background-image":"radial-gradient(at left, var(--tc-gradient-stops))"},"bg-radial-at-tl":{"background-image":"radial-gradient(at top left, var(--tc-gradient-stops))"},"bg-radial-at-c":{"background-image":"radial-gradient(at center, var(--tc-gradient-stops))"},"bg-conic":{"background-image":"conic-gradient(var(--tc-gradient-stops))"},"bg-conic-from-t":{"background-image":"conic-gradient(from 0deg at center, var(--tc-gradient-stops))"},"bg-conic-from-tr":{"background-image":"conic-gradient(from 45deg at center, var(--tc-gradient-stops))"},"bg-conic-from-r":{"background-image":"conic-gradient(from 90deg at center, var(--tc-gradient-stops))"},"bg-conic-from-br":{"background-image":"conic-gradient(from 135deg at center, var(--tc-gradient-stops))"},"bg-conic-from-b":{"background-image":"conic-gradient(from 180deg at center, var(--tc-gradient-stops))"},"bg-conic-from-bl":{"background-image":"conic-gradient(from 225deg at center, var(--tc-gradient-stops))"},"bg-conic-from-l":{"background-image":"conic-gradient(from 270deg at center, var(--tc-gradient-stops))"},"bg-conic-from-tl":{"background-image":"conic-gradient(from 315deg at center, var(--tc-gradient-stops))"}},Xb={"content-none":{content:"none"},"content-empty":{content:'""'}},Zb={"scrollbar-auto":{"scrollbar-width":"auto"},"scrollbar-thin":{"scrollbar-width":"thin"},"scrollbar-none":{"scrollbar-width":"none"}},Qb={"cursor-auto":{cursor:"auto"},"cursor-default":{cursor:"default"},"cursor-pointer":{cursor:"pointer"},"cursor-wait":{cursor:"wait"},"cursor-text":{cursor:"text"},"cursor-move":{cursor:"move"},"cursor-help":{cursor:"help"},"cursor-not-allowed":{cursor:"not-allowed"},"cursor-none":{cursor:"none"},"cursor-context-menu":{cursor:"context-menu"},"cursor-progress":{cursor:"progress"},"cursor-cell":{cursor:"cell"},"cursor-crosshair":{cursor:"crosshair"},"cursor-vertical-text":{cursor:"vertical-text"},"cursor-alias":{cursor:"alias"},"cursor-copy":{cursor:"copy"},"cursor-no-drop":{cursor:"no-drop"},"cursor-grab":{cursor:"grab"},"cursor-grabbing":{cursor:"grabbing"},"cursor-all-scroll":{cursor:"all-scroll"},"cursor-col-resize":{cursor:"col-resize"},"cursor-row-resize":{cursor:"row-resize"},"cursor-n-resize":{cursor:"n-resize"},"cursor-e-resize":{cursor:"e-resize"},"cursor-s-resize":{cursor:"s-resize"},"cursor-w-resize":{cursor:"w-resize"},"cursor-ne-resize":{cursor:"ne-resize"},"cursor-nw-resize":{cursor:"nw-resize"},"cursor-se-resize":{cursor:"se-resize"},"cursor-sw-resize":{cursor:"sw-resize"},"cursor-ew-resize":{cursor:"ew-resize"},"cursor-ns-resize":{cursor:"ns-resize"},"cursor-nesw-resize":{cursor:"nesw-resize"},"cursor-nwse-resize":{cursor:"nwse-resize"},"cursor-zoom-in":{cursor:"zoom-in"},"cursor-zoom-out":{cursor:"zoom-out"}},e0={"pointer-events-none":{"pointer-events":"none"},"pointer-events-auto":{"pointer-events":"auto"}},t0={"resize-none":{resize:"none"},"resize-y":{resize:"vertical"},"resize-x":{resize:"horizontal"},resize:{resize:"both"}},r0={"select-none":{"user-select":"none"},"select-text":{"user-select":"text"},"select-all":{"user-select":"all"},"select-auto":{"user-select":"auto"}},n0={"scroll-auto":{"scroll-behavior":"auto"},"scroll-smooth":{"scroll-behavior":"smooth"}},i0={"snap-none":{"scroll-snap-type":"none"},"snap-x":{"scroll-snap-type":"x var(--tc-scroll-snap-strictness, proximity)"},"snap-y":{"scroll-snap-type":"y var(--tc-scroll-snap-strictness, proximity)"},"snap-both":{"scroll-snap-type":"both var(--tc-scroll-snap-strictness, proximity)"},"snap-mandatory":{"--tc-scroll-snap-strictness":"mandatory"},"snap-proximity":{"--tc-scroll-snap-strictness":"proximity"},"snap-start":{"scroll-snap-align":"start"},"snap-end":{"scroll-snap-align":"end"},"snap-center":{"scroll-snap-align":"center"},"snap-align-none":{"scroll-snap-align":"none"},"snap-normal":{"scroll-snap-stop":"normal"},"snap-always":{"scroll-snap-stop":"always"}},Ze="var(--tc-pan-x,) var(--tc-pan-y,) var(--tc-pinch-zoom,)",o0={"touch-auto":{"touch-action":"auto"},"touch-none":{"touch-action":"none"},"touch-pan-x":{"--tc-pan-x":"pan-x","touch-action":Ze},"touch-pan-left":{"--tc-pan-x":"pan-left","touch-action":Ze},"touch-pan-right":{"--tc-pan-x":"pan-right","touch-action":Ze},"touch-pan-y":{"--tc-pan-y":"pan-y","touch-action":Ze},"touch-pan-up":{"--tc-pan-y":"pan-up","touch-action":Ze},"touch-pan-down":{"--tc-pan-y":"pan-down","touch-action":Ze},"touch-pinch-zoom":{"--tc-pinch-zoom":"pinch-zoom","touch-action":Ze},"touch-manipulation":{"touch-action":"manipulation"}},s0={"will-change-auto":{"will-change":"auto"},"will-change-scroll":{"will-change":"scroll-position"},"will-change-contents":{"will-change":"contents"},"will-change-transform":{"will-change":"transform"}},a0={"appearance-none":{appearance:"none"},"appearance-auto":{appearance:"auto"}},l0={"border-collapse":{"border-collapse":"collapse"},"border-separate":{"border-collapse":"separate"}},c0={"table-auto":{"table-layout":"auto"},"table-fixed":{"table-layout":"fixed"}},u0={"caption-top":{"caption-side":"top"},"caption-bottom":{"caption-side":"bottom"}},f0={"sr-only":{position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)","white-space":"nowrap","border-width":"0"},"not-sr-only":{position:"static",width:"auto",height:"auto",padding:"0",margin:"0",overflow:"visible",clip:"auto","white-space":"normal"}},d0={"forced-color-adjust-auto":{"forced-color-adjust":"auto"},"forced-color-adjust-none":{"forced-color-adjust":"none"}},h0={"fill-none":{fill:"none"},"fill-current":{fill:"currentColor"},"fill-inherit":{fill:"inherit"}},g0={"stroke-none":{stroke:"none"},"stroke-current":{stroke:"currentColor"},"stroke-inherit":{stroke:"inherit"},"stroke-0":{"stroke-width":"0"},"stroke-1":{"stroke-width":"1"},"stroke-2":{"stroke-width":"2"}},m0={"stroke-linecap-butt":{"stroke-linecap":"butt"},"stroke-linecap-round":{"stroke-linecap":"round"},"stroke-linecap-square":{"stroke-linecap":"square"}},p0={"stroke-linejoin-miter":{"stroke-linejoin":"miter"},"stroke-linejoin-round":{"stroke-linejoin":"round"},"stroke-linejoin-bevel":{"stroke-linejoin":"bevel"}},y0=["blur","brightness","contrast","grayscale","hue-rotate","invert","saturate","sepia","drop-shadow"],b0=["blur","brightness","contrast","grayscale","hue-rotate","invert","opacity","saturate","sepia"],x0=y0.map((e)=>`var(--tc-${e}, )`).join(" "),Vl=b0.map((e)=>`var(--tc-backdrop-${e}, )`).join(" ");function je(e){return`var(--tc-drop-shadow-color, ${e})`}function F(e,t){return{[`--tc-${e}`]:t,filter:x0}}function ie(e,t){return{[`--tc-backdrop-${e}`]:t,"-webkit-backdrop-filter":Vl,"backdrop-filter":Vl}}var v0={"blur-none":F("blur","blur(0)"),"blur-xs":F("blur","blur(4px)"),"blur-sm":F("blur","blur(8px)"),blur:F("blur","blur(8px)"),"blur-md":F("blur","blur(12px)"),"blur-lg":F("blur","blur(16px)"),"blur-xl":F("blur","blur(24px)"),"blur-2xl":F("blur","blur(40px)"),"blur-3xl":F("blur","blur(64px)")},w0={"backdrop-blur-none":ie("blur","blur(0)"),"backdrop-blur-xs":ie("blur","blur(4px)"),"backdrop-blur-sm":ie("blur","blur(8px)"),"backdrop-blur":ie("blur","blur(8px)"),"backdrop-blur-md":ie("blur","blur(12px)"),"backdrop-blur-lg":ie("blur","blur(16px)"),"backdrop-blur-xl":ie("blur","blur(24px)"),"backdrop-blur-2xl":ie("blur","blur(40px)"),"backdrop-blur-3xl":ie("blur","blur(64px)")},C0={"grayscale-0":F("grayscale","grayscale(0)"),grayscale:F("grayscale","grayscale(100%)"),"invert-0":F("invert","invert(0)"),invert:F("invert","invert(100%)"),"sepia-0":F("sepia","sepia(0)"),sepia:F("sepia","sepia(100%)")},$0={"backdrop-grayscale-0":ie("grayscale","grayscale(0)"),"backdrop-grayscale":ie("grayscale","grayscale(100%)"),"backdrop-invert-0":ie("invert","invert(0)"),"backdrop-invert":ie("invert","invert(100%)"),"backdrop-sepia-0":ie("sepia","sepia(0)"),"backdrop-sepia":ie("sepia","sepia(100%)")},R0={"drop-shadow-xs":F("drop-shadow",`drop-shadow(0 1px 1px ${je("rgb(0 0 0 / 0.05)")})`),"drop-shadow-sm":F("drop-shadow",`drop-shadow(0 1px 2px ${je("rgb(0 0 0 / 0.15)")})`),"drop-shadow":F("drop-shadow",`drop-shadow(0 1px 2px ${je("rgb(0 0 0 / 0.1)")}) drop-shadow(0 1px 1px ${je("rgb(0 0 0 / 0.06)")})`),"drop-shadow-md":F("drop-shadow",`drop-shadow(0 3px 3px ${je("rgb(0 0 0 / 0.12)")})`),"drop-shadow-lg":F("drop-shadow",`drop-shadow(0 4px 4px ${je("rgb(0 0 0 / 0.15)")})`),"drop-shadow-xl":F("drop-shadow",`drop-shadow(0 9px 7px ${je("rgb(0 0 0 / 0.1)")})`),"drop-shadow-2xl":F("drop-shadow",`drop-shadow(0 25px 25px ${je("rgb(0 0 0 / 0.15)")})`),"drop-shadow-none":F("drop-shadow","drop-shadow(0 0 #0000)")},k0={"mix-blend-normal":{"mix-blend-mode":"normal"},"mix-blend-multiply":{"mix-blend-mode":"multiply"},"mix-blend-screen":{"mix-blend-mode":"screen"},"mix-blend-overlay":{"mix-blend-mode":"overlay"},"mix-blend-darken":{"mix-blend-mode":"darken"},"mix-blend-lighten":{"mix-blend-mode":"lighten"},"mix-blend-color-dodge":{"mix-blend-mode":"color-dodge"},"mix-blend-color-burn":{"mix-blend-mode":"color-burn"},"mix-blend-hard-light":{"mix-blend-mode":"hard-light"},"mix-blend-soft-light":{"mix-blend-mode":"soft-light"},"mix-blend-difference":{"mix-blend-mode":"difference"},"mix-blend-exclusion":{"mix-blend-mode":"exclusion"},"mix-blend-hue":{"mix-blend-mode":"hue"},"mix-blend-saturation":{"mix-blend-mode":"saturation"},"mix-blend-color":{"mix-blend-mode":"color"},"mix-blend-luminosity":{"mix-blend-mode":"luminosity"},"mix-blend-plus-darker":{"mix-blend-mode":"plus-darker"},"mix-blend-plus-lighter":{"mix-blend-mode":"plus-lighter"}},S0={"bg-blend-normal":{"background-blend-mode":"normal"},"bg-blend-multiply":{"background-blend-mode":"multiply"},"bg-blend-screen":{"background-blend-mode":"screen"},"bg-blend-overlay":{"background-blend-mode":"overlay"},"bg-blend-darken":{"background-blend-mode":"darken"},"bg-blend-lighten":{"background-blend-mode":"lighten"},"bg-blend-color-dodge":{"background-blend-mode":"color-dodge"},"bg-blend-color-burn":{"background-blend-mode":"color-burn"},"bg-blend-hard-light":{"background-blend-mode":"hard-light"},"bg-blend-soft-light":{"background-blend-mode":"soft-light"},"bg-blend-difference":{"background-blend-mode":"difference"},"bg-blend-exclusion":{"background-blend-mode":"exclusion"},"bg-blend-hue":{"background-blend-mode":"hue"},"bg-blend-saturation":{"background-blend-mode":"saturation"},"bg-blend-color":{"background-blend-mode":"color"},"bg-blend-luminosity":{"background-blend-mode":"luminosity"}},A0={...Hy,...Gy,...qy,...Yy,...Jy,...tb,...rb,...nb,...ib,...ob,...hb,...nc,...ic,...gb,...mb,...pb,...bb,...xb,...vb,...wb,...Cb,...$b,...Rb,...kb,...Sb,...Ab,...Eb,...Tb,...Nb,...Ob,...Ib,...Pb,..._b,...Lb,...Mb,...Fb,...Db,...jb,...Bb,...Vb,...Ub,...Wb,...zb,...Kb,...Hb,...Gb,...qb,...Yb,...Jb,...Qb,...e0,...t0,...r0,...n0,...i0,...o0,...s0,...a0,...l0,...c0,...u0,...f0,...d0,...h0,...g0,...m0,...p0,...v0,...w0,...C0,...$0,...R0,...k0,...S0,...Xb,...Zb},Kr={hover:":hover",focus:":focus",active:":active",disabled:":disabled",visited:":visited",checked:":checked","focus-within":":focus-within","focus-visible":":focus-visible",first:":first-child",last:":last-child",odd:":nth-child(odd)",even:":nth-child(even)","first-of-type":":first-of-type","last-of-type":":last-of-type",before:"::before",after:"::after",marker:"::marker",placeholder:"::placeholder",selection:"::selection",file:"::file-selector-button","first-letter":"::first-letter","first-line":"::first-line",backdrop:"::backdrop","details-content":"::details-content",required:":required",valid:":valid",invalid:":invalid","read-only":":read-only",autofill:":autofill","user-valid":":user-valid","user-invalid":":user-invalid","in-range":":in-range","out-of-range":":out-of-range","placeholder-shown":":placeholder-shown",open:":is([open], :popover-open, :open)",closed:":not(:is([open], :popover-open, :open))",empty:":empty",enabled:":enabled",only:":only-child","only-of-type":":only-of-type",target:":target",indeterminate:":indeterminate",default:":default",optional:":optional",inert:":is([inert], [inert] *)"};function Ul(e){if(!e)return;if(e.charCodeAt(0)===91&&e.charCodeAt(e.length-1)===93){let n=e.slice(1,-1).replace(/_/g," ").trim();return n?`:is(${n})`:void 0}let t=Kr[e];if(t!==void 0)return t.startsWith("::")?void 0:t;let r=ki(e);if(r!==void 0)return r;if(e.startsWith("has-")){let n=e.slice(4);if(!n)return;return n.charCodeAt(0)===91&&n.charCodeAt(n.length-1)===93?`:has(${n.slice(1,-1)})`:`:has(:${n})`}if(e.startsWith("aria-")||e.startsWith("data-")){let n=e.slice(0,4),i=e.slice(5);if(!i)return;if(i.charCodeAt(0)===91&&i.charCodeAt(i.length-1)===93)return`[${n}-${i.slice(1,-1)}]`;return n==="aria"?`[aria-${i}="true"]`:`[data-${i}]`}if(e.startsWith("in-")){let n=Si(e.slice(3));return n===void 0?void 0:`:where(${n}) *`}return}var Ci=[["nth-last-of-type-","nth-last-of-type"],["nth-of-type-","nth-of-type"],["nth-last-","nth-last-child"],["nth-","nth-child"]];function ki(e){for(let t=0;t<Ci.length;t++){let r=Ci[t][0];if(!e.startsWith(r))continue;let n=Ci[t][1],i=e.slice(r.length);if(i.charCodeAt(0)===91&&i.charCodeAt(i.length-1)===93){let o=i.slice(1,-1).replace(/_/g," ").trim();return o?`:${n}(${o})`:void 0}return/^\d+$/.test(i)?`:${n}(${i})`:void 0}return}function Si(e){if(!e)return;if(e.charCodeAt(0)===91&&e.charCodeAt(e.length-1)===93){let r=e.slice(1,-1).replace(/_/g," ").trim();if(!r)return;return r.includes("&")?r.replace(/&/g,"*"):`:is(${r})`}if(e.startsWith("data-")){let r=e.slice(5);return r.charCodeAt(0)===91&&r.charCodeAt(r.length-1)===93?`[data-${r.slice(1,-1)}]`:`[data-${r}]`}if(e.startsWith("aria-")){let r=e.slice(5);return r.charCodeAt(0)===91&&r.charCodeAt(r.length-1)===93?`[aria-${r.slice(1,-1)}]`:`[aria-${r}="true"]`}let t=Kr[e];return t!==void 0&&!t.startsWith("::")?t:void 0}function Wl(e){return bn(e).css}var $i={"pointer-none":"(pointer: none)","pointer-coarse":"(pointer: coarse)","pointer-fine":"(pointer: fine)","any-pointer-none":"(any-pointer: none)","any-pointer-coarse":"(any-pointer: coarse)","any-pointer-fine":"(any-pointer: fine)","inverted-colors":"(inverted-colors: inverted)",noscript:"(scripting: none)"},zl={print:"print","motion-safe":"(prefers-reduced-motion: no-preference)","motion-reduce":"(prefers-reduced-motion: reduce)","contrast-more":"(prefers-contrast: more)","contrast-less":"(prefers-contrast: less)",landscape:"(orientation: landscape)",portrait:"(orientation: portrait)","forced-colors":"(forced-colors: active)"};function Kl(e){if(e.charCodeAt(0)===91&&e.charCodeAt(e.length-1)===93){let t=e.slice(1,-1).replace(/_/g," "),r=t.indexOf(":");if(r!==-1)return`(${t.slice(0,r).trim()}: ${t.slice(r+1).trim()})`;return`(${t})`}return`(${e})`}function E0(e){let t=0;for(let r=e.length-1;r>=0;r--){let n=e.charCodeAt(r);if(n===93)t++;else if(n===91)t--;else if(n===47&&t===0)return{size:e.slice(0,r),name:e.slice(r+1)}}return{size:e}}var Hl="\x01",Gl={dark:".dark ",light:".light "},ql={rtl:':is([dir="rtl"], [dir="rtl"] *)',ltr:':is([dir="ltr"], [dir="ltr"] *)'},Yl=new WeakMap,Jl=new WeakMap,Xl=new WeakMap,Zl=new WeakMap,Ql=new WeakMap,ec=new WeakMap,tc=new WeakMap;function T0(e){let t=Jl.get(e);if(t)return t;let r=!1;for(let i in e)if(zr[i]!==e[i]){r=!0;break}let n=r?{...zr,...e}:zr;return Jl.set(e,n),n}function N0(e){let t=e.lastIndexOf("-");return t>0&&/^\d+$/.test(e.slice(t+1))?e.slice(0,t):e}function O0(e,t){let r=t?.length?t.join("\x00"):"",n=Xl.get(e),i=n?.get(r);if(i)return i;let o=null;for(let c in e){let a=e[c];if(typeof a==="string"){if(yt[c]!==void 0&&yt[c]!==a)o??={},o[c]=a;continue}if(!a||typeof a!=="object")continue;for(let l in a){let u=a[l];if(typeof u!=="string")continue;let f=l==="DEFAULT"?c:`${c}-${l}`;if(yt[f]!==void 0&&yt[f]!==u)o??={},o[f]=u}}let s=o?{...yt,...o}:yt;if(r){let c=null;for(let a in s){let l=N0(a);if(!t.includes(l))continue;c??={...s},c[a]=W(a,s[a],l,t)}if(c)s=c}if(!n)n=new Map,Xl.set(e,n);return n.set(r,s),s}function I0(e){let t=Zl.get(e);if(t!==void 0)return t;let r=!1;for(let n in e){let i=n==="DEFAULT"?"rounded":`rounded-${n}`;if(ic[i]?.["border-radius"]!==e[n]){r=!0;break}}return Zl.set(e,r),r}function P0(e){let t=Ql.get(e);if(t!==void 0)return t;let r=!1;for(let n in e){let i=n==="DEFAULT"?"shadow":`shadow-${n}`,o=nc[i];if(o!==void 0&&o["--tc-shadow"]!==e[n]){r=!0;break}}return Ql.set(e,r),r}function _0(e){let t=e??dt.theme.screens,r=ec.get(t);if(r)return r;let n=new Map(Object.entries(t));return ec.set(t,n),n}function L0(e){let t=e??dt.theme.containers,r=tc.get(t);if(r)return r;let n=new Map(Object.entries(t));return tc.set(t,n),n}function M0(e){let t=Yl.get(e);if(t)return t;if(e.presets&&e.presets.length>0)for(let u of e.presets){if(u.theme)e.theme=Ri(e.theme,u.theme);if(u.rules&&u.rules.length>0)e.rules=[...u.rules,...e.rules];if(u.shortcuts)e.shortcuts={...u.shortcuts,...e.shortcuts};if(u.variants)e.variants={...u.variants,...e.variants};if(u.preflights&&u.preflights.length>0)e.preflights=[...u.preflights,...e.preflights]}let r=e.theme.extend?.colors?e.theme.extend.colors:null;if(e.theme.extend){let{extend:u,...f}=e.theme;if(u)e.theme=Ri(f,u)}let n=[],i=new Set;for(let u of e.blocklist)if(u.includes("*"))n.push(new RegExp(`^${u.replace(/\*/g,".*")}$`));else i.add(u);let o=T0(e.theme.spacing),s=O0(e.theme.colors,e.colorVariables),c=I0(e.theme.borderRadius),a=P0(e.theme.boxShadow),l={config:e,variantEnabled:e.variants,spacingValues:o,commonColors:s,skipStaticRadius:c,skipStaticShadow:a,screenBreakpoints:_0(e.theme.screens),containerBreakpoints:L0(e.theme.containers),blocklistRegexCache:n,blocklistExact:i,extendColors:r,hasBlocklist:n.length>0||i.size>0,hasShortcuts:Object.keys(e.shortcuts).length>0};return Yl.set(e,l),l}function rc(e){return e>=97&&e<=122||e>=65&&e<=90||e>=48&&e<=57||e===45||e===95}function F0(e){let t=e.indexOf(".");if(t===-1)return;t++;let r=()=>{if(e.charCodeAt(t)===92&&e.charCodeAt(t+1)===33)t+=2};r();for(;;){let i=t;while(i<e.length&&rc(e.charCodeAt(i)))i++;if(e.charCodeAt(i)!==92||e.charCodeAt(i+1)!==58)break;t=i+2}r();let n=t;while(n<e.length&&rc(e.charCodeAt(n)))n++;return n>t?e.slice(t,n):void 0}var D0=/^(?:mx|my|px|py|inset-x|inset-y|border-x|border-y|scroll-mx|scroll-my|scroll-px|scroll-py|space-x|space-y|gap-x|gap-y)-/,j0=/^rounded-[tlbr](?:-|$)/,B0=/^(?:mt|mr|mb|ml|pt|pr|pb|pl|top|right|bottom|left|border-t|border-r|border-b|border-l|scroll-mt|scroll-mr|scroll-mb|scroll-ml|scroll-pt|scroll-pr|scroll-pb|scroll-pl)-/,V0=/^rounded-(?:tl|tr|bl|br)(?:-|$)/,U0=/^i-[a-z][a-z0-9]*(?:-[a-z0-9]+)*-.+/;function W0(e){let t=F0(e);if(!t)return 0;if(U0.test(t))return-1;if(D0.test(t)||j0.test(t))return 1;if(B0.test(t)||V0.test(t))return 2;return 0}class Ai{config;rules=new Map;classCache=new Set;selectorCache=new Map;mediaQueryCache=new Map;ruleCache=new Map;variantEnabled;screenBreakpoints;containerBreakpoints;noMatchCache=new Set;usedKeyframes=new Set;variantHandledCache=new Map;utilityRankCache=new Map;compiledGenerated=new Set;darkStrategy;spacingValues;commonColors;skipStaticRadius;skipStaticShadow;shortcutSelectorRaw=null;extendColors=null;processed;revision=0;cssCache=null;cssCacheRevision=-1;cssCachePreflight=!1;cssCacheMinify=!1;constructor(e){this.config=e;this.processed=M0(e),this.variantEnabled=this.processed.variantEnabled,this.screenBreakpoints=this.processed.screenBreakpoints,this.containerBreakpoints=this.processed.containerBreakpoints,this.extendColors=this.processed.extendColors,this.darkStrategy=e.darkMode==="media"?"media":"class",this.spacingValues=this.processed.spacingValues,this.commonColors=this.processed.commonColors,this.skipStaticRadius=this.processed.skipStaticRadius,this.skipStaticShadow=this.processed.skipStaticShadow}buildRuleLookup(){}generateBatch(e){for(let t=0;t<e.length;t++)this.generate(e[t])}generate(e){if(this.classCache.has(e))return;if(this.classCache.add(e),this.processed.hasShortcuts){let t=this.config.shortcuts[e];if(t){this.expandShortcut(e,t,new Set([e]));return}let r=this.resolveVariantShortcut(e);if(r){let{base:n,prefix:i,important:o}=r;this.expandShortcut(e,this.config.shortcuts[n],new Set([n]),i,o);return}}this.generateUtility(e)}resolveVariantShortcut(e){if(!e.includes(":")&&!e.includes("!"))return;let t=!1,r=e;if(r.charCodeAt(0)===33)t=!0,r=r.slice(1);else if(r.length>1&&r.charCodeAt(r.length-1)===33)t=!0,r=r.slice(0,-1);let n=kt(r),i=n[n.length-1];if(!t&&i.length>1&&i.charCodeAt(0)===33)t=!0,i=i.slice(1);if(i===e||!Object.hasOwn(this.config.shortcuts,i))return;let o=n.slice(0,-1);return{base:i,prefix:o.length>0?`${o.join(":")}:`:"",important:t}}expandShortcut(e,t,r,n="",i=!1){let o=Array.isArray(t)?t:t.split(/\s+/),s=this.shortcutSelectorRaw;this.shortcutSelectorRaw=e;for(let c of o){if(!c)continue;let a=this.config.shortcuts[c];if(a){if(!r.has(c))r.add(c),this.expandShortcut(e,a,r,n,i);continue}let l=this.resolveVariantShortcut(c);if(l){if(!r.has(l.base))r.add(l.base),this.expandShortcut(e,this.config.shortcuts[l.base],r,n+l.prefix,i||l.important),r.delete(l.base);continue}let u=n===""?c:n+c;if(i&&!vn(u).important)u+="!";this.generateUtility(u)}this.shortcutSelectorRaw=s}generateCompiledClass(e,t){if(this.compiledGenerated.has(e))return;this.compiledGenerated.add(e),this.classCache.add(e),this.expandShortcut(e,t,new Set([e]))}generateUtility(e){if(this.processed.hasBlocklist){if(this.processed.blocklistExact.has(e))return;let l=this.processed.blocklistRegexCache;for(let u=0;u<l.length;u++)if(l[u].test(e))return}let t=vn(e),r=t.base,n=A0[r];if(n&&(this.skipStaticRadius&&r.startsWith("rounded")||this.skipStaticShadow&&(r==="shadow"||r.startsWith("shadow-"))))n=void 0;if(n){if(this.addRule(t,n),n.animation){let l=n.animation.split(" ")[0];if(l&&l!=="none")this.usedKeyframes.add(l),this.revision++}return}let{utility:i,value:o}=t;if(i==="w"&&o){let l=Bl[o]||this.config.theme.spacing[o];if(l){this.addRule(t,{width:l});return}if(t.arbitrary){let u=o.match(/^(\d+)\/(\d+)$/);if(u){let f=Number(u[1]),d=Number(u[2]);if(!Number.isNaN(f)&&!Number.isNaN(d)&&d!==0){this.addRule(t,{width:Ce(f,d)});return}}this.addRule(t,{width:o});return}}if(i==="h"&&o){let l=Bl[o]||this.config.theme.spacing[o];if(l){this.addRule(t,{height:o==="screen"?"100vh":l});return}if(t.arbitrary){let u=o.match(/^(\d+)\/(\d+)$/);if(u){let f=Number(u[1]),d=Number(u[2]);if(!Number.isNaN(f)&&!Number.isNaN(d)&&d!==0){this.addRule(t,{height:Ce(f,d)});return}}this.addRule(t,{height:o});return}}if(i==="p"&&o){let l=this.spacingValues[o];if(l){this.addRule(t,{padding:l});return}}if(i==="px"&&o){let l=this.spacingValues[o];if(l){this.addRule(t,{"padding-left":l,"padding-right":l});return}}if(i==="py"&&o){let l=this.spacingValues[o];if(l){this.addRule(t,{"padding-top":l,"padding-bottom":l});return}}if((i==="pt"||i==="pr"||i==="pb"||i==="pl")&&o){let l=this.spacingValues[o];if(l){let u={pt:"padding-top",pr:"padding-right",pb:"padding-bottom",pl:"padding-left"};this.addRule(t,{[u[i]]:l});return}}if(i==="m"&&o){let l=this.spacingValues[o];if(l){this.addRule(t,{margin:l});return}}if(i==="mx"&&o){let l=this.spacingValues[o];if(l){this.addRule(t,{"margin-left":l,"margin-right":l});return}}if(i==="my"&&o){let l=this.spacingValues[o];if(l){this.addRule(t,{"margin-top":l,"margin-bottom":l});return}}if((i==="mt"||i==="mr"||i==="mb"||i==="ml")&&o){let l=this.spacingValues[o];if(l){let u={mt:"margin-top",mr:"margin-right",mb:"margin-bottom",ml:"margin-left"};this.addRule(t,{[u[i]]:l});return}}if((i==="top"||i==="right"||i==="bottom"||i==="left")&&o){let l=this.spacingValues[o];if(l){this.addRule(t,{[i]:l});return}}if(i==="inset"&&o){let l=this.spacingValues[o];if(l){this.addRule(t,{top:l,right:l,bottom:l,left:l});return}}if(i==="inset-x"&&o){let l=this.spacingValues[o];if(l){this.addRule(t,{left:l,right:l});return}}if(i==="inset-y"&&o){let l=this.spacingValues[o];if(l){this.addRule(t,{top:l,bottom:l});return}}if(i==="bg"&&o){let l=this.commonColors[o];if(l){this.addRule(t,{"background-color":l});return}}if(i==="text"&&o){let l=this.commonColors[o];if(l){this.addRule(t,{color:l});return}}if(i==="border"&&o){let l=this.commonColors[o];if(l){this.addRule(t,{"border-color":l});return}}if(i==="justify"&&o){let l=Xy[o];if(l){this.addRule(t,{"justify-content":l});return}}if(i==="items"&&o){let l=Zy[o];if(l){this.addRule(t,{"align-items":l});return}}if(i==="content"&&o){let l=Qy[o];if(l){this.addRule(t,{"align-content":l});return}if(t.arbitrary){this.addRule(t,{content:o});return}}if(i==="self"&&o){let l=eb[o];if(l){this.addRule(t,{"align-self":l});return}}if(i==="grid-cols"&&o){let l=lb[o];if(l){this.addRule(t,{"grid-template-columns":l});return}}if(i==="grid-rows"&&o){let l=cb[o];if(l){this.addRule(t,{"grid-template-rows":l});return}}if(i==="col"&&o){let l=ub[o];if(l){this.addRule(t,{"grid-column":l});return}}if(i==="row"&&o){let l=fb[o];if(l){this.addRule(t,{"grid-row":l});return}}if(i==="grid-flow"&&o){let l=db[o];if(l){this.addRule(t,{"grid-auto-flow":l});return}}if(i==="auto-cols"&&o){let l=jl[o];if(l){this.addRule(t,{"grid-auto-columns":l});return}}if(i==="auto-rows"&&o){let l=jl[o];if(l){this.addRule(t,{"grid-auto-rows":l});return}}if(i==="origin"&&o){let l=ab[o];if(l){this.addRule(t,{"transform-origin":l});return}}if(i==="scale"&&o&&!t.arbitrary){let l=Number(o)/100;if(!Number.isNaN(l)){this.addRule(t,{transform:`scale(${l})`});return}}if(i==="scale-x"&&o&&!t.arbitrary){let l=Number(o)/100;if(!Number.isNaN(l)){this.addRule(t,{transform:`scaleX(${l})`});return}}if(i==="scale-y"&&o&&!t.arbitrary){let l=Number(o)/100;if(!Number.isNaN(l)){this.addRule(t,{transform:`scaleY(${l})`});return}}if(i==="rotate"&&o&&!t.arbitrary&&/^-?\d+(?:\.\d+)?$/.test(o)){this.addRule(t,{transform:`rotate(${o}deg)`});return}if(i==="duration"&&o&&o!=="0"&&!t.arbitrary&&/^\d+(?:\.\d+)?$/.test(o)){this.addRule(t,{"transition-duration":`${o}ms`});return}if(i==="delay"&&o&&o!=="0"&&!t.arbitrary&&/^\d+(?:\.\d+)?$/.test(o)){this.addRule(t,{"transition-delay":`${o}ms`});return}let s=(l)=>{let u=this.config.theme.spacing[l];if(u!==void 0)return u;if(t.arbitrary)return l;if(/^\d+(?:\.\d+)?$/.test(l)){let f=Number.parseFloat(l);if(Number.isFinite(f))return`${f*0.25}rem`}return};if(i==="gap"&&o){let l=s(o);if(l!==void 0)this.addRule(t,{gap:l});return}if(i==="gap-x"&&o){let l=s(o);if(l!==void 0)this.addRule(t,{"column-gap":l});return}if(i==="gap-y"&&o){let l=s(o);if(l!==void 0)this.addRule(t,{"row-gap":l});return}if(i==="place"&&o){if(o.startsWith("content-")){let l=wi[o.slice(8)];if(l){this.addRule(t,{"place-content":l});return}}if(o.startsWith("items-")){let l=wi[o.slice(6)];if(l){this.addRule(t,{"place-items":l});return}}if(o.startsWith("self-")){let l=wi[o.slice(5)];if(l){this.addRule(t,{"place-self":l});return}}}let c=`${t.utility}:${t.value||""}`;if(this.noMatchCache.has(c))return;if(this.config.rules.length>0)for(let[l,u]of this.config.rules){let f=e.match(l);if(f){let d=u(f);if(d){this.addRule(t,d);return}}}let a=vi.length;for(let l=0;l<a;l++){let u=vi[l](t,this.config);if(u){if("properties"in u&&typeof u.properties==="object")this.addRule(t,u.properties,u.childSelector,u.pseudoElement,u.defaults);else this.addRule(t,u);return}}this.noMatchCache.add(c)}isVariantHandled(e){let t=this.variantHandledCache.get(e);if(t!==void 0)return t;let r=Kr[e]!==void 0||Gl[e]!==void 0||ql[e]!==void 0||e.startsWith("not-")&&this.isNegationResolvable(e.slice(4))||this.screenBreakpoints.has(e)||e.startsWith("max-")&&this.screenBreakpoints.has(e.slice(4))||e.charCodeAt(0)===64&&this.containerQuery(e.slice(1))!==void 0||e==="*"||e==="**"||ki(e)!==void 0||e.startsWith("in-")&&Si(e.slice(3))!==void 0||e.startsWith("group-")||e.startsWith("group/")||e.startsWith("peer-")||e.startsWith("peer/")||e.startsWith("has-")||e.startsWith("aria-")||e.startsWith("data-")||e.startsWith("supports-")||e.startsWith("[")&&e.endsWith("]")||$i[e]!==void 0||e==="starting"||["print","motion-safe","motion-reduce","contrast-more","contrast-less","landscape","portrait","forced-colors"].includes(e);return this.variantHandledCache.set(e,r),r}containerQuery(e){if(!e)return;let{size:t,name:r}=E0(e);if(!t||r!==void 0&&!r)return;let n=t,i=!0;if(t.startsWith("max-"))n=t.slice(4),i=!1;else if(t.startsWith("min-"))n=t.slice(4);let o;if(n.charCodeAt(0)===91&&n.charCodeAt(n.length-1)===93)o=n.slice(1,-1).replace(/_/g," ").trim()||void 0;else o=this.containerBreakpoints.get(n);if(o===void 0)return;let s=i?`(width >= ${o})`:`(width < ${o})`;return r===void 0?`@container ${s}`:`@container ${r} ${s}`}negatableAtRule(e){if(!e)return;let t=zl[e];if(t!==void 0)return{media:t};let r=$i[e];if(r!==void 0)return{media:r};let n=this.screenBreakpoints.get(e);if(n!==void 0)return{media:`(min-width: ${n})`};if(this.darkStrategy==="media"&&(e==="dark"||e==="light"))return{media:`(prefers-color-scheme: ${e})`};if(e.startsWith("supports-")){let i=e.slice(9);return i?{supports:Kl(i)}:void 0}return}isNegationResolvable(e){return Ul(e)!==void 0||this.negatableAtRule(e)!==void 0}addRule(e,t,r,n,i){for(let l=0;l<e.variants.length;l++)if(!this.isVariantHandled(e.variants[l]))return;let o=this.shortcutSelectorRaw===null?r===void 0&&n===void 0?e.raw:`${e.raw}${r||""}${n||""}`:`${this.shortcutSelectorRaw}>${e.raw}${r||""}${n||""}`,s=this.selectorCache.get(o);if(!s){if(s=this.buildSelector(e),n)s+=n;if(r)s+=` ${r}`;if(i&&!s.includes("::"))s=`:where(${s})`;this.selectorCache.set(o,s)}let c=this.getMediaQuery(e);if(e.important){let l={};for(let u in t)l[u]=`${t[u]} !important`;t=l}let a=c||"base";if(!this.rules.has(a))this.rules.set(a,[]);this.revision++,this.rules.get(a).push({selector:s,properties:t,mediaQuery:c,childSelector:r})}buildSelector(e){let t=`.${this.escapeSelector(this.shortcutSelectorRaw??e.raw)}`,r="",n=e.variants,i=n.length;if(i===0)return t;for(let o=0;o<i;o++){let s=n[o];if(s.charCodeAt(0)===91&&s.charCodeAt(s.length-1)===93){let u=s.slice(1,-1).replace(/_/g," ");if(u.includes("&"))t=u.replace(/&/g,t);continue}if(s==="*"||s==="**"){if(this.variantEnabled[s])t=s==="*"?`:is(${t} > *)`:`:is(${t} *)`;continue}let c=Kr[s];if(c!==void 0){if(this.variantEnabled[s])t+=c;continue}let a=ql[s];if(a!==void 0){if(this.variantEnabled[s]){let u=t.indexOf("::");t=u===-1?t+a:t.slice(0,u)+a+t.slice(u)}continue}let l=Gl[s];if(l!==void 0){if(this.darkStrategy==="media"&&(s==="dark"||s==="light"))continue;if(this.variantEnabled[s])r=l;continue}if(s.charCodeAt(0)===110&&s.startsWith("not-")){if(this.variantEnabled.not){let u=Ul(s.slice(4));if(u!==void 0)t+=`:not(${u})`}continue}if(s.charCodeAt(0)===110&&s.startsWith("nth-")){let u=ki(s);if(u!==void 0)t+=u;continue}if(s.charCodeAt(0)===105&&s.startsWith("in-")){if(this.variantEnabled.in){let u=Si(s.slice(3));if(u!==void 0)r=`:where(${u}) `}continue}if(s.charCodeAt(0)===103&&s.startsWith("group-")){if(this.variantEnabled.group){let u=s.slice(6);if(u.startsWith("has-")){let f=u.slice(4);if(f.charCodeAt(0)===91&&f.charCodeAt(f.length-1)===93)r=`.group:has(${f.slice(1,-1)}) `;else r=`.group:has(:${f}) `}else r=`.group:${u} `}continue}if(s.charCodeAt(0)===103&&s.startsWith("group/")){if(this.variantEnabled.group)r=`.group\\/${s.slice(6)} `;continue}if(s.charCodeAt(0)===112&&s.startsWith("peer-")){if(this.variantEnabled.peer){let u=s.slice(5);if(u.startsWith("has-")){let f=u.slice(4);if(f.charCodeAt(0)===91&&f.charCodeAt(f.length-1)===93)r=`.peer:has(${f.slice(1,-1)}) ~ `;else r=`.peer:has(:${f}) ~ `}else r=`.peer:${u} ~ `}continue}if(s.charCodeAt(0)===112&&s.startsWith("peer/")){if(this.variantEnabled.peer)r=`.peer\\/${s.slice(5)} ~ `;continue}if(s.charCodeAt(0)===104&&s.startsWith("has-")){if(this.variantEnabled.has){let u=s.slice(4);if(u.charCodeAt(0)===91&&u.charCodeAt(u.length-1)===93){let f=u.slice(1,-1);t+=`:has(${f})`}else t+=`:has(:${u})`}continue}if(s.charCodeAt(0)===97&&s.startsWith("aria-")){if(this.variantEnabled.aria){let u=s.slice(5);if(u.charCodeAt(0)===91&&u.charCodeAt(u.length-1)===93){let f=u.slice(1,-1);t+=`[aria-${f}]`}else t+=`[aria-${u}="true"]`}continue}if(s.charCodeAt(0)===100&&s.startsWith("data-")){if(this.variantEnabled.data){let u=s.slice(5);if(u.charCodeAt(0)===91&&u.charCodeAt(u.length-1)===93){let f=u.slice(1,-1);t+=`[data-${f}]`}else t+=`[data-${u}]`}continue}}return r+t}getMediaQuery(e){let t=e.variants,r=t.length;if(r===0)return;let n=r===1?t[0]:t.join(":"),i=this.mediaQueryCache.get(n);if(i!==void 0)return i||void 0;let o=[],s=[],c=[],a=!1;for(let u=0;u<r;u++){let f=t[u],d=f.charCodeAt(0);if(d===91&&f.startsWith("[@media")&&f.endsWith("]")){let g=f.slice(1,-1).replace(/_/g," ").slice(6).trim();if(g)o.push(g);continue}if(d===64){let g=this.containerQuery(f.slice(1));if(g!==void 0)c.push(g);continue}if(d===110&&f.startsWith("not-")){if(this.variantEnabled.not){let g=this.negatableAtRule(f.slice(4));if(g!==void 0)if(g.supports!==void 0)s.push(`@supports not ${g.supports}`);else o.push(`not ${g.media}`)}continue}if(this.darkStrategy==="media"&&(f==="dark"||f==="light")){o.push(`(prefers-color-scheme: ${f})`);continue}if(this.variantEnabled.responsive){let g=this.screenBreakpoints.get(f);if(g){o.push(`(min-width: ${g})`);continue}if(f.startsWith("max-")){let p=this.screenBreakpoints.get(f.slice(4));if(p){let y=p.match(/^([\d.]+)px$/);o.push(y?`(max-width: ${Number.parseFloat(y[1])-0.02}px)`:`not all and (min-width: ${p})`);continue}}}if(f==="starting"){if(this.variantEnabled.starting)a=!0;continue}let h=$i[f];if(h!==void 0){if(this.variantEnabled[f])o.push(h);continue}let m=zl[f];if(m!==void 0){if(this.variantEnabled[f])o.push(m);continue}if(f.charCodeAt(0)===115&&f.startsWith("supports-")){if(this.variantEnabled.supports)s.push(`@supports ${Kl(f.slice(9))}`)}}let l=[];if(o.length>0)o.sort((u,f)=>Number(u.charCodeAt(0)===40)-Number(f.charCodeAt(0)===40)),l.push(`@media ${o.join(" and ")}`);if(l.push(...s,...c),a)l.push("@starting-style");if(l.length>0){let u=l.join(Hl);return this.mediaQueryCache.set(n,u),u}this.mediaQueryCache.set(n,"");return}escapeSelector(e){let t=!1;for(let r=0;r<e.length;r++){let n=e.charCodeAt(r);if(!(n>=97&&n<=122||n>=65&&n<=90||n>=48&&n<=57||n===45||n===95||n>127)){t=!0;break}}if(!t)return e;return e.replace(/[\x00-\x2C\x2E\x2F\x3A-\x40\x5B-\x5E\x60\x7B-\x7F]/g,"\\$&")}buildFontCSS(){let e=this.config.fonts;if(!e)return"";let t=[],r=e.google?.filter(Boolean)??[];if(r.length>0){let n=r.map((o)=>`family=${o.trim().replace(/\s+/g,"+")}`).join("&"),i=e.display??"swap";t.push(`@import url('https://fonts.googleapis.com/css2?${n}&display=${i}');`)}if(e.faces?.length)t.push(...e.faces.map((n)=>n.trim()).filter(Boolean));return t.join(`
|
|
368
|
+
}`},ub={center:"center",top:"top","top-right":"top right",right:"right","bottom-right":"bottom right",bottom:"bottom","bottom-left":"bottom left",left:"left","top-left":"top left"},fb={"1":"repeat(1, minmax(0, 1fr))","2":"repeat(2, minmax(0, 1fr))","3":"repeat(3, minmax(0, 1fr))","4":"repeat(4, minmax(0, 1fr))","5":"repeat(5, minmax(0, 1fr))","6":"repeat(6, minmax(0, 1fr))","7":"repeat(7, minmax(0, 1fr))","8":"repeat(8, minmax(0, 1fr))","9":"repeat(9, minmax(0, 1fr))","10":"repeat(10, minmax(0, 1fr))","11":"repeat(11, minmax(0, 1fr))","12":"repeat(12, minmax(0, 1fr))",none:"none",subgrid:"subgrid"},db={"1":"repeat(1, minmax(0, 1fr))","2":"repeat(2, minmax(0, 1fr))","3":"repeat(3, minmax(0, 1fr))","4":"repeat(4, minmax(0, 1fr))","5":"repeat(5, minmax(0, 1fr))","6":"repeat(6, minmax(0, 1fr))",none:"none",subgrid:"subgrid"},hb={auto:"auto","span-1":"span 1 / span 1","span-2":"span 2 / span 2","span-3":"span 3 / span 3","span-4":"span 4 / span 4","span-5":"span 5 / span 5","span-6":"span 6 / span 6","span-7":"span 7 / span 7","span-8":"span 8 / span 8","span-9":"span 9 / span 9","span-10":"span 10 / span 10","span-11":"span 11 / span 11","span-12":"span 12 / span 12","span-full":"1 / -1"},gb={auto:"auto","span-1":"span 1 / span 1","span-2":"span 2 / span 2","span-3":"span 3 / span 3","span-4":"span 4 / span 4","span-5":"span 5 / span 5","span-6":"span 6 / span 6","span-full":"1 / -1"},mb={row:"row",col:"column",dense:"dense","row-dense":"row dense","col-dense":"column dense"},Vl={auto:"auto",min:"min-content",max:"max-content",fr:"minmax(0, 1fr)"},Ri={center:"center",start:"start",end:"end",between:"space-between",around:"space-around",evenly:"space-evenly",stretch:"stretch","center-safe":"safe center","end-safe":"safe end"};function yt(e){return{"--tc-ring-offset-shadow":"var(--tc-ring-inset,) 0 0 0 var(--tc-ring-offset-width, 0px) var(--tc-ring-offset-color, #fff)","--tc-ring-shadow":`var(--tc-ring-inset,) 0 0 0 calc(${e} + var(--tc-ring-offset-width, 0px)) var(--tc-ring-color, currentcolor)`,"box-shadow":V}}var pb={ring:yt("1px"),"ring-0":yt("0px"),"ring-1":yt("1px"),"ring-2":yt("2px"),"ring-4":yt("4px"),"ring-8":yt("8px"),"ring-inset":{"--tc-ring-inset":"inset"}},sc={"shadow-2xs":{"--tc-shadow":"0 1px rgb(0 0 0 / 0.05)","--tc-shadow-colored":"0 1px var(--tc-shadow-color)","box-shadow":V},"shadow-xs":{"--tc-shadow":"0 1px 2px 0 rgb(0 0 0 / 0.05)","--tc-shadow-colored":"0 1px 2px 0 var(--tc-shadow-color)","box-shadow":V},"shadow-sm":{"--tc-shadow":"0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1)","--tc-shadow-colored":"0 1px 3px 0 var(--tc-shadow-color), 0 1px 2px -1px var(--tc-shadow-color)","box-shadow":V},shadow:{"--tc-shadow":"0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1)","--tc-shadow-colored":"0 1px 3px 0 var(--tc-shadow-color), 0 1px 2px -1px var(--tc-shadow-color)","box-shadow":V},"shadow-md":{"--tc-shadow":"0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1)","--tc-shadow-colored":"0 4px 6px -1px var(--tc-shadow-color), 0 2px 4px -2px var(--tc-shadow-color)","box-shadow":V},"shadow-lg":{"--tc-shadow":"0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1)","--tc-shadow-colored":"0 10px 15px -3px var(--tc-shadow-color), 0 4px 6px -4px var(--tc-shadow-color)","box-shadow":V},"shadow-xl":{"--tc-shadow":"0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1)","--tc-shadow-colored":"0 20px 25px -5px var(--tc-shadow-color), 0 8px 10px -6px var(--tc-shadow-color)","box-shadow":V},"shadow-2xl":{"--tc-shadow":"0 25px 50px -12px rgb(0 0 0 / 0.25)","--tc-shadow-colored":"0 25px 50px -12px var(--tc-shadow-color)","box-shadow":V},"shadow-inner":{"--tc-shadow":"inset 0 2px 4px 0 rgb(0 0 0 / 0.05)","--tc-shadow-colored":"inset 0 2px 4px 0 var(--tc-shadow-color)","box-shadow":V},"shadow-none":{"--tc-shadow":"0 0 #0000","box-shadow":V}},ac={"rounded-none":{"border-radius":"0px"},"rounded-xs":{"border-radius":"0.125rem"},"rounded-sm":{"border-radius":"0.25rem"},rounded:{"border-radius":"0.25rem"},"rounded-md":{"border-radius":"0.375rem"},"rounded-lg":{"border-radius":"0.5rem"},"rounded-xl":{"border-radius":"0.75rem"},"rounded-2xl":{"border-radius":"1rem"},"rounded-3xl":{"border-radius":"1.5rem"},"rounded-4xl":{"border-radius":"2rem"},"rounded-full":{"border-radius":"9999px"},"rounded-t-none":{"border-top-left-radius":"0px","border-top-right-radius":"0px"},"rounded-t-sm":{"border-top-left-radius":"0.25rem","border-top-right-radius":"0.25rem"},"rounded-t-lg":{"border-top-left-radius":"0.5rem","border-top-right-radius":"0.5rem"},"rounded-r-lg":{"border-top-right-radius":"0.5rem","border-bottom-right-radius":"0.5rem"},"rounded-b-lg":{"border-bottom-left-radius":"0.5rem","border-bottom-right-radius":"0.5rem"},"rounded-l-lg":{"border-top-left-radius":"0.5rem","border-bottom-left-radius":"0.5rem"},"rounded-tl-lg":{"border-top-left-radius":"0.5rem"},"rounded-tr-lg":{"border-top-right-radius":"0.5rem"},"rounded-br-lg":{"border-bottom-right-radius":"0.5rem"},"rounded-bl-lg":{"border-bottom-left-radius":"0.5rem"}},yb={border:{"border-width":"1px"},"border-0":{"border-width":"0px"},"border-2":{"border-width":"2px"},"border-4":{"border-width":"4px"},"border-8":{"border-width":"8px"},"border-t":{"border-top-width":"1px"},"border-r":{"border-right-width":"1px"},"border-b":{"border-bottom-width":"1px"},"border-l":{"border-left-width":"1px"},"border-t-0":{"border-top-width":"0px"},"border-r-0":{"border-right-width":"0px"},"border-b-0":{"border-bottom-width":"0px"},"border-l-0":{"border-left-width":"0px"},"border-t-2":{"border-top-width":"2px"},"border-r-2":{"border-right-width":"2px"},"border-b-2":{"border-bottom-width":"2px"},"border-l-2":{"border-left-width":"2px"},"border-t-4":{"border-top-width":"4px"},"border-r-4":{"border-right-width":"4px"},"border-b-4":{"border-bottom-width":"4px"},"border-l-4":{"border-left-width":"4px"},"border-x":{"border-left-width":"1px","border-right-width":"1px"},"border-y":{"border-top-width":"1px","border-bottom-width":"1px"},"border-x-0":{"border-left-width":"0px","border-right-width":"0px"},"border-y-0":{"border-top-width":"0px","border-bottom-width":"0px"},"border-x-2":{"border-left-width":"2px","border-right-width":"2px"},"border-y-2":{"border-top-width":"2px","border-bottom-width":"2px"}},bb={"ring-offset-0":{"--tc-ring-offset-width":"0px"},"ring-offset-1":{"--tc-ring-offset-width":"1px"},"ring-offset-2":{"--tc-ring-offset-width":"2px"},"ring-offset-4":{"--tc-ring-offset-width":"4px"},"ring-offset-8":{"--tc-ring-offset-width":"8px"}},xb={"opacity-0":{opacity:"0"},"opacity-5":{opacity:"0.05"},"opacity-10":{opacity:"0.1"},"opacity-20":{opacity:"0.2"},"opacity-25":{opacity:"0.25"},"opacity-30":{opacity:"0.3"},"opacity-40":{opacity:"0.4"},"opacity-50":{opacity:"0.5"},"opacity-60":{opacity:"0.6"},"opacity-70":{opacity:"0.7"},"opacity-75":{opacity:"0.75"},"opacity-80":{opacity:"0.8"},"opacity-90":{opacity:"0.9"},"opacity-95":{opacity:"0.95"},"opacity-100":{opacity:"1"}},qr={"0":"0",px:"1px","0.5":"0.125rem","1":"0.25rem","1.5":"0.375rem","2":"0.5rem","2.5":"0.625rem","3":"0.75rem","3.5":"0.875rem","4":"1rem","5":"1.25rem","6":"1.5rem","7":"1.75rem","8":"2rem","9":"2.25rem","10":"2.5rem","11":"2.75rem","12":"3rem","14":"3.5rem","16":"4rem","20":"5rem","24":"6rem","28":"7rem","32":"8rem","36":"9rem","40":"10rem","44":"11rem","48":"12rem","52":"13rem","56":"14rem","60":"15rem","64":"16rem","72":"18rem","80":"20rem","96":"24rem"},Wl={...qr,auto:"auto",full:"100%",screen:"100vw",min:"min-content",max:"max-content",fit:"fit-content",...vb(6)};function vb(e){let t={};for(let r=2;r<=e;r++)for(let n=1;n<r;n++)t[`${n}/${r}`]=$e(n,r);return t}var bt={"gray-50":"oklch(98.5% 0.002 247.839)","gray-100":"oklch(96.7% 0.003 264.542)","gray-200":"oklch(92.8% 0.006 264.531)","gray-300":"oklch(87.2% 0.01 258.338)","gray-400":"oklch(70.7% 0.022 261.325)","gray-500":"oklch(55.1% 0.027 264.364)","gray-600":"oklch(44.6% 0.03 256.802)","gray-700":"oklch(37.3% 0.034 259.733)","gray-800":"oklch(27.8% 0.033 256.848)","gray-900":"oklch(21% 0.034 264.665)","gray-950":"oklch(13% 0.028 261.692)","red-50":"oklch(97.1% 0.013 17.38)","red-100":"oklch(93.6% 0.032 17.717)","red-200":"oklch(88.5% 0.062 18.334)","red-300":"oklch(80.8% 0.114 19.571)","red-400":"oklch(70.4% 0.191 22.216)","red-500":"oklch(63.7% 0.237 25.331)","red-600":"oklch(57.7% 0.245 27.325)","red-700":"oklch(50.5% 0.213 27.518)","red-800":"oklch(44.4% 0.177 26.899)","red-900":"oklch(39.6% 0.141 25.723)","red-950":"oklch(25.8% 0.092 26.042)","blue-50":"oklch(97% 0.014 254.604)","blue-100":"oklch(93.2% 0.032 255.585)","blue-200":"oklch(88.2% 0.059 254.128)","blue-300":"oklch(80.9% 0.105 251.813)","blue-400":"oklch(70.7% 0.165 254.624)","blue-500":"oklch(62.3% 0.214 259.815)","blue-600":"oklch(54.6% 0.245 262.881)","blue-700":"oklch(48.8% 0.243 264.376)","blue-800":"oklch(42.4% 0.199 265.638)","blue-900":"oklch(37.9% 0.146 265.522)","blue-950":"oklch(28.2% 0.091 267.935)","green-50":"oklch(98.2% 0.018 155.826)","green-100":"oklch(96.2% 0.044 156.743)","green-200":"oklch(92.5% 0.084 155.995)","green-300":"oklch(87.1% 0.15 154.449)","green-400":"oklch(79.2% 0.209 151.711)","green-500":"oklch(72.3% 0.219 149.579)","green-600":"oklch(62.7% 0.194 149.214)","green-700":"oklch(52.7% 0.154 150.069)","green-800":"oklch(44.8% 0.119 151.328)","green-900":"oklch(39.3% 0.095 152.535)","green-950":"oklch(26.6% 0.065 152.934)","yellow-50":"oklch(98.7% 0.026 102.212)","yellow-100":"oklch(97.3% 0.071 103.193)","yellow-200":"oklch(94.5% 0.129 101.54)","yellow-300":"oklch(90.5% 0.182 98.111)","yellow-400":"oklch(85.2% 0.199 91.936)","yellow-500":"oklch(79.5% 0.184 86.047)","yellow-600":"oklch(68.1% 0.162 75.834)","yellow-700":"oklch(55.4% 0.135 66.442)","yellow-800":"oklch(47.6% 0.114 61.907)","yellow-900":"oklch(42.1% 0.095 57.708)","yellow-950":"oklch(28.6% 0.066 53.813)","purple-50":"oklch(97.7% 0.014 308.299)","purple-100":"oklch(94.6% 0.033 307.174)","purple-200":"oklch(90.2% 0.063 306.703)","purple-300":"oklch(82.7% 0.119 306.383)","purple-400":"oklch(71.4% 0.203 305.504)","purple-500":"oklch(62.7% 0.265 303.9)","purple-600":"oklch(55.8% 0.288 302.321)","purple-700":"oklch(49.6% 0.265 301.924)","purple-800":"oklch(43.8% 0.218 303.724)","purple-900":"oklch(38.1% 0.176 304.987)","purple-950":"oklch(29.1% 0.149 302.717)","pink-50":"oklch(97.1% 0.014 343.198)","pink-100":"oklch(94.8% 0.028 342.258)","pink-200":"oklch(89.9% 0.061 343.231)","pink-300":"oklch(82.3% 0.12 346.018)","pink-400":"oklch(71.8% 0.202 349.761)","pink-500":"oklch(65.6% 0.241 354.308)","pink-600":"oklch(59.2% 0.249 0.584)","pink-700":"oklch(52.5% 0.223 3.958)","pink-800":"oklch(45.9% 0.187 3.815)","pink-900":"oklch(40.8% 0.153 2.432)","pink-950":"oklch(28.4% 0.109 3.907)","indigo-50":"oklch(96.2% 0.018 272.314)","indigo-100":"oklch(93% 0.034 272.788)","indigo-200":"oklch(87% 0.065 274.039)","indigo-300":"oklch(78.5% 0.115 274.713)","indigo-400":"oklch(67.3% 0.182 276.935)","indigo-500":"oklch(58.5% 0.233 277.117)","indigo-600":"oklch(51.1% 0.262 276.966)","indigo-700":"oklch(45.7% 0.24 277.023)","indigo-800":"oklch(39.8% 0.195 277.366)","indigo-900":"oklch(35.9% 0.144 278.697)","indigo-950":"oklch(25.7% 0.09 281.288)","cyan-50":"oklch(98.4% 0.019 200.873)","cyan-100":"oklch(95.6% 0.045 203.388)","cyan-200":"oklch(91.7% 0.08 205.041)","cyan-300":"oklch(86.5% 0.127 207.078)","cyan-400":"oklch(78.9% 0.154 211.53)","cyan-500":"oklch(71.5% 0.143 215.221)","cyan-600":"oklch(60.9% 0.126 221.723)","cyan-700":"oklch(52% 0.105 223.128)","cyan-800":"oklch(45% 0.085 224.283)","cyan-900":"oklch(39.8% 0.07 227.392)","cyan-950":"oklch(30.2% 0.056 229.695)","emerald-50":"oklch(97.9% 0.021 166.113)","emerald-100":"oklch(95% 0.052 163.051)","emerald-200":"oklch(90.5% 0.093 164.15)","emerald-300":"oklch(84.5% 0.143 164.978)","emerald-400":"oklch(76.5% 0.177 163.223)","emerald-500":"oklch(69.6% 0.17 162.48)","emerald-600":"oklch(59.6% 0.145 163.225)","emerald-700":"oklch(50.8% 0.118 165.612)","emerald-800":"oklch(43.2% 0.095 166.913)","emerald-900":"oklch(37.8% 0.077 168.94)","emerald-950":"oklch(26.2% 0.051 172.552)",white:"#fff",black:"#000",transparent:"transparent",current:"currentColor"},wb={"font-thin":{"font-weight":"100"},"font-extralight":{"font-weight":"200"},"font-light":{"font-weight":"300"},"font-normal":{"font-weight":"400"},"font-medium":{"font-weight":"500"},"font-semibold":{"font-weight":"600"},"font-bold":{"font-weight":"700"},"font-extrabold":{"font-weight":"800"},"font-black":{"font-weight":"900"}},$b={italic:{"font-style":"italic"},"not-italic":{"font-style":"normal"}},Cb={uppercase:{"text-transform":"uppercase"},lowercase:{"text-transform":"lowercase"},capitalize:{"text-transform":"capitalize"},"normal-case":{"text-transform":"none"}},Rb={underline:{"text-decoration-line":"underline"},overline:{"text-decoration-line":"overline"},"line-through":{"text-decoration-line":"line-through"},"no-underline":{"text-decoration-line":"none"}},kb={"decoration-solid":{"text-decoration-style":"solid"},"decoration-double":{"text-decoration-style":"double"},"decoration-dotted":{"text-decoration-style":"dotted"},"decoration-dashed":{"text-decoration-style":"dashed"},"decoration-wavy":{"text-decoration-style":"wavy"}},Sb={"text-left":{"text-align":"left"},"text-center":{"text-align":"center"},"text-right":{"text-align":"right"},"text-justify":{"text-align":"justify"},"text-start":{"text-align":"start"},"text-end":{"text-align":"end"}},Ab={truncate:{overflow:"hidden","text-overflow":"ellipsis","white-space":"nowrap"},"text-ellipsis":{"text-overflow":"ellipsis"},"text-clip":{"text-overflow":"clip"}},Eb={"text-wrap":{"text-wrap":"wrap"},"text-nowrap":{"text-wrap":"nowrap"},"text-balance":{"text-wrap":"balance"},"text-pretty":{"text-wrap":"pretty"}},Tb={"whitespace-normal":{"white-space":"normal"},"whitespace-nowrap":{"white-space":"nowrap"},"whitespace-pre":{"white-space":"pre"},"whitespace-pre-line":{"white-space":"pre-line"},"whitespace-pre-wrap":{"white-space":"pre-wrap"},"whitespace-break-spaces":{"white-space":"break-spaces"}},Nb={"break-normal":{"overflow-wrap":"normal","word-break":"normal"},"break-words":{"overflow-wrap":"break-word"},"break-all":{"word-break":"break-all"},"break-keep":{"word-break":"keep-all"}},Ob={"align-baseline":{"vertical-align":"baseline"},"align-top":{"vertical-align":"top"},"align-middle":{"vertical-align":"middle"},"align-bottom":{"vertical-align":"bottom"},"align-text-top":{"vertical-align":"text-top"},"align-text-bottom":{"vertical-align":"text-bottom"},"align-sub":{"vertical-align":"sub"},"align-super":{"vertical-align":"super"}},Ib={"list-none":{"list-style-type":"none"},"list-disc":{"list-style-type":"disc"},"list-decimal":{"list-style-type":"decimal"},"list-inside":{"list-style-position":"inside"},"list-outside":{"list-style-position":"outside"}},Pb={"hyphens-none":{hyphens:"none"},"hyphens-manual":{hyphens:"manual"},"hyphens-auto":{hyphens:"auto"}},_b={static:{position:"static"},fixed:{position:"fixed"},absolute:{position:"absolute"},relative:{position:"relative"},sticky:{position:"sticky"}},Lb={visible:{visibility:"visible"},invisible:{visibility:"hidden"},collapse:{visibility:"collapse"}},Mb={"float-left":{float:"left"},"float-right":{float:"right"},"float-none":{float:"none"},"float-start":{float:"inline-start"},"float-end":{float:"inline-end"}},Fb={"clear-left":{clear:"left"},"clear-right":{clear:"right"},"clear-both":{clear:"both"},"clear-none":{clear:"none"},"clear-start":{clear:"inline-start"},"clear-end":{clear:"inline-end"}},Db={isolate:{isolation:"isolate"},"isolation-auto":{isolation:"auto"}},jb={"object-contain":{"object-fit":"contain"},"object-cover":{"object-fit":"cover"},"object-fill":{"object-fit":"fill"},"object-none":{"object-fit":"none"},"object-scale-down":{"object-fit":"scale-down"}},Bb={"object-bottom":{"object-position":"bottom"},"object-center":{"object-position":"center"},"object-left":{"object-position":"left"},"object-left-bottom":{"object-position":"left bottom"},"object-left-top":{"object-position":"left top"},"object-right":{"object-position":"right"},"object-right-bottom":{"object-position":"right bottom"},"object-right-top":{"object-position":"right top"},"object-top":{"object-position":"top"}},Ub={"overflow-auto":{overflow:"auto"},"overflow-hidden":{overflow:"hidden"},"overflow-clip":{overflow:"clip"},"overflow-ellipsis":{"text-overflow":"ellipsis"},"overflow-visible":{overflow:"visible"},"overflow-scroll":{overflow:"scroll"},"overflow-x-auto":{"overflow-x":"auto"},"overflow-x-hidden":{"overflow-x":"hidden"},"overflow-x-clip":{"overflow-x":"clip"},"overflow-x-visible":{"overflow-x":"visible"},"overflow-x-scroll":{"overflow-x":"scroll"},"overflow-y-auto":{"overflow-y":"auto"},"overflow-y-hidden":{"overflow-y":"hidden"},"overflow-y-clip":{"overflow-y":"clip"},"overflow-y-visible":{"overflow-y":"visible"},"overflow-y-scroll":{"overflow-y":"scroll"}},Vb={"overscroll-auto":{"overscroll-behavior":"auto"},"overscroll-contain":{"overscroll-behavior":"contain"},"overscroll-none":{"overscroll-behavior":"none"},"overscroll-x-auto":{"overscroll-behavior-x":"auto"},"overscroll-x-contain":{"overscroll-behavior-x":"contain"},"overscroll-x-none":{"overscroll-behavior-x":"none"},"overscroll-y-auto":{"overscroll-behavior-y":"auto"},"overscroll-y-contain":{"overscroll-behavior-y":"contain"},"overscroll-y-none":{"overscroll-behavior-y":"none"}},Wb={"z-0":{"z-index":"0"},"z-10":{"z-index":"10"},"z-20":{"z-index":"20"},"z-30":{"z-index":"30"},"z-40":{"z-index":"40"},"z-50":{"z-index":"50"},"z-auto":{"z-index":"auto"}},zb={"aspect-auto":{"aspect-ratio":"auto"},"aspect-square":{"aspect-ratio":"1 / 1"},"aspect-video":{"aspect-ratio":"16 / 9"}},Kb={"box-border":{"box-sizing":"border-box"},"box-content":{"box-sizing":"content-box"}},Hb={"box-decoration-clone":{"box-decoration-break":"clone"},"box-decoration-slice":{"box-decoration-break":"slice"}},Gb={"bg-fixed":{"background-attachment":"fixed"},"bg-local":{"background-attachment":"local"},"bg-scroll":{"background-attachment":"scroll"}},qb={"bg-clip-border":{"background-clip":"border-box"},"bg-clip-padding":{"background-clip":"padding-box"},"bg-clip-content":{"background-clip":"content-box"},"bg-clip-text":{"background-clip":"text","-webkit-background-clip":"text"}},Yb={"bg-origin-border":{"background-origin":"border-box"},"bg-origin-padding":{"background-origin":"padding-box"},"bg-origin-content":{"background-origin":"content-box"}},Jb={"bg-bottom":{"background-position":"bottom"},"bg-center":{"background-position":"center"},"bg-left":{"background-position":"left"},"bg-left-bottom":{"background-position":"left bottom"},"bg-left-top":{"background-position":"left top"},"bg-right":{"background-position":"right"},"bg-right-bottom":{"background-position":"right bottom"},"bg-right-top":{"background-position":"right top"},"bg-top":{"background-position":"top"}},Xb={"bg-repeat":{"background-repeat":"repeat"},"bg-no-repeat":{"background-repeat":"no-repeat"},"bg-repeat-x":{"background-repeat":"repeat-x"},"bg-repeat-y":{"background-repeat":"repeat-y"},"bg-repeat-round":{"background-repeat":"round"},"bg-repeat-space":{"background-repeat":"space"}},Zb={"bg-auto":{"background-size":"auto"},"bg-cover":{"background-size":"cover"},"bg-contain":{"background-size":"contain"}},Qb={"bg-none":{"background-image":"none"},"bg-gradient-to-t":{"background-image":"linear-gradient(to top, var(--tc-gradient-stops))"},"bg-gradient-to-tr":{"background-image":"linear-gradient(to top right, var(--tc-gradient-stops))"},"bg-gradient-to-r":{"background-image":"linear-gradient(to right, var(--tc-gradient-stops))"},"bg-gradient-to-br":{"background-image":"linear-gradient(to bottom right, var(--tc-gradient-stops))"},"bg-gradient-to-b":{"background-image":"linear-gradient(to bottom, var(--tc-gradient-stops))"},"bg-gradient-to-bl":{"background-image":"linear-gradient(to bottom left, var(--tc-gradient-stops))"},"bg-gradient-to-l":{"background-image":"linear-gradient(to left, var(--tc-gradient-stops))"},"bg-gradient-to-tl":{"background-image":"linear-gradient(to top left, var(--tc-gradient-stops))"},"bg-radial":{"background-image":"radial-gradient(var(--tc-gradient-stops))"},"bg-radial-at-t":{"background-image":"radial-gradient(at top, var(--tc-gradient-stops))"},"bg-radial-at-tr":{"background-image":"radial-gradient(at top right, var(--tc-gradient-stops))"},"bg-radial-at-r":{"background-image":"radial-gradient(at right, var(--tc-gradient-stops))"},"bg-radial-at-br":{"background-image":"radial-gradient(at bottom right, var(--tc-gradient-stops))"},"bg-radial-at-b":{"background-image":"radial-gradient(at bottom, var(--tc-gradient-stops))"},"bg-radial-at-bl":{"background-image":"radial-gradient(at bottom left, var(--tc-gradient-stops))"},"bg-radial-at-l":{"background-image":"radial-gradient(at left, var(--tc-gradient-stops))"},"bg-radial-at-tl":{"background-image":"radial-gradient(at top left, var(--tc-gradient-stops))"},"bg-radial-at-c":{"background-image":"radial-gradient(at center, var(--tc-gradient-stops))"},"bg-conic":{"background-image":"conic-gradient(var(--tc-gradient-stops))"},"bg-conic-from-t":{"background-image":"conic-gradient(from 0deg at center, var(--tc-gradient-stops))"},"bg-conic-from-tr":{"background-image":"conic-gradient(from 45deg at center, var(--tc-gradient-stops))"},"bg-conic-from-r":{"background-image":"conic-gradient(from 90deg at center, var(--tc-gradient-stops))"},"bg-conic-from-br":{"background-image":"conic-gradient(from 135deg at center, var(--tc-gradient-stops))"},"bg-conic-from-b":{"background-image":"conic-gradient(from 180deg at center, var(--tc-gradient-stops))"},"bg-conic-from-bl":{"background-image":"conic-gradient(from 225deg at center, var(--tc-gradient-stops))"},"bg-conic-from-l":{"background-image":"conic-gradient(from 270deg at center, var(--tc-gradient-stops))"},"bg-conic-from-tl":{"background-image":"conic-gradient(from 315deg at center, var(--tc-gradient-stops))"}},e0={"content-none":{content:"none"},"content-empty":{content:'""'}},t0={"scrollbar-auto":{"scrollbar-width":"auto"},"scrollbar-thin":{"scrollbar-width":"thin"},"scrollbar-none":{"scrollbar-width":"none"}},r0={"cursor-auto":{cursor:"auto"},"cursor-default":{cursor:"default"},"cursor-pointer":{cursor:"pointer"},"cursor-wait":{cursor:"wait"},"cursor-text":{cursor:"text"},"cursor-move":{cursor:"move"},"cursor-help":{cursor:"help"},"cursor-not-allowed":{cursor:"not-allowed"},"cursor-none":{cursor:"none"},"cursor-context-menu":{cursor:"context-menu"},"cursor-progress":{cursor:"progress"},"cursor-cell":{cursor:"cell"},"cursor-crosshair":{cursor:"crosshair"},"cursor-vertical-text":{cursor:"vertical-text"},"cursor-alias":{cursor:"alias"},"cursor-copy":{cursor:"copy"},"cursor-no-drop":{cursor:"no-drop"},"cursor-grab":{cursor:"grab"},"cursor-grabbing":{cursor:"grabbing"},"cursor-all-scroll":{cursor:"all-scroll"},"cursor-col-resize":{cursor:"col-resize"},"cursor-row-resize":{cursor:"row-resize"},"cursor-n-resize":{cursor:"n-resize"},"cursor-e-resize":{cursor:"e-resize"},"cursor-s-resize":{cursor:"s-resize"},"cursor-w-resize":{cursor:"w-resize"},"cursor-ne-resize":{cursor:"ne-resize"},"cursor-nw-resize":{cursor:"nw-resize"},"cursor-se-resize":{cursor:"se-resize"},"cursor-sw-resize":{cursor:"sw-resize"},"cursor-ew-resize":{cursor:"ew-resize"},"cursor-ns-resize":{cursor:"ns-resize"},"cursor-nesw-resize":{cursor:"nesw-resize"},"cursor-nwse-resize":{cursor:"nwse-resize"},"cursor-zoom-in":{cursor:"zoom-in"},"cursor-zoom-out":{cursor:"zoom-out"}},n0={"pointer-events-none":{"pointer-events":"none"},"pointer-events-auto":{"pointer-events":"auto"}},i0={"resize-none":{resize:"none"},"resize-y":{resize:"vertical"},"resize-x":{resize:"horizontal"},resize:{resize:"both"}},o0={"select-none":{"user-select":"none"},"select-text":{"user-select":"text"},"select-all":{"user-select":"all"},"select-auto":{"user-select":"auto"}},s0={"scroll-auto":{"scroll-behavior":"auto"},"scroll-smooth":{"scroll-behavior":"smooth"}},a0={"snap-none":{"scroll-snap-type":"none"},"snap-x":{"scroll-snap-type":"x var(--tc-scroll-snap-strictness, proximity)"},"snap-y":{"scroll-snap-type":"y var(--tc-scroll-snap-strictness, proximity)"},"snap-both":{"scroll-snap-type":"both var(--tc-scroll-snap-strictness, proximity)"},"snap-mandatory":{"--tc-scroll-snap-strictness":"mandatory"},"snap-proximity":{"--tc-scroll-snap-strictness":"proximity"},"snap-start":{"scroll-snap-align":"start"},"snap-end":{"scroll-snap-align":"end"},"snap-center":{"scroll-snap-align":"center"},"snap-align-none":{"scroll-snap-align":"none"},"snap-normal":{"scroll-snap-stop":"normal"},"snap-always":{"scroll-snap-stop":"always"}},Ze="var(--tc-pan-x,) var(--tc-pan-y,) var(--tc-pinch-zoom,)",l0={"touch-auto":{"touch-action":"auto"},"touch-none":{"touch-action":"none"},"touch-pan-x":{"--tc-pan-x":"pan-x","touch-action":Ze},"touch-pan-left":{"--tc-pan-x":"pan-left","touch-action":Ze},"touch-pan-right":{"--tc-pan-x":"pan-right","touch-action":Ze},"touch-pan-y":{"--tc-pan-y":"pan-y","touch-action":Ze},"touch-pan-up":{"--tc-pan-y":"pan-up","touch-action":Ze},"touch-pan-down":{"--tc-pan-y":"pan-down","touch-action":Ze},"touch-pinch-zoom":{"--tc-pinch-zoom":"pinch-zoom","touch-action":Ze},"touch-manipulation":{"touch-action":"manipulation"}},c0={"will-change-auto":{"will-change":"auto"},"will-change-scroll":{"will-change":"scroll-position"},"will-change-contents":{"will-change":"contents"},"will-change-transform":{"will-change":"transform"}},u0={"appearance-none":{appearance:"none"},"appearance-auto":{appearance:"auto"}},f0={"border-collapse":{"border-collapse":"collapse"},"border-separate":{"border-collapse":"separate"}},d0={"table-auto":{"table-layout":"auto"},"table-fixed":{"table-layout":"fixed"}},h0={"caption-top":{"caption-side":"top"},"caption-bottom":{"caption-side":"bottom"}},g0={"sr-only":{position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)","white-space":"nowrap","border-width":"0"},"not-sr-only":{position:"static",width:"auto",height:"auto",padding:"0",margin:"0",overflow:"visible",clip:"auto","white-space":"normal"}},m0={"forced-color-adjust-auto":{"forced-color-adjust":"auto"},"forced-color-adjust-none":{"forced-color-adjust":"none"}},p0={"fill-none":{fill:"none"},"fill-current":{fill:"currentColor"},"fill-inherit":{fill:"inherit"}},y0={"stroke-none":{stroke:"none"},"stroke-current":{stroke:"currentColor"},"stroke-inherit":{stroke:"inherit"},"stroke-0":{"stroke-width":"0"},"stroke-1":{"stroke-width":"1"},"stroke-2":{"stroke-width":"2"}},b0={"stroke-linecap-butt":{"stroke-linecap":"butt"},"stroke-linecap-round":{"stroke-linecap":"round"},"stroke-linecap-square":{"stroke-linecap":"square"}},x0={"stroke-linejoin-miter":{"stroke-linejoin":"miter"},"stroke-linejoin-round":{"stroke-linejoin":"round"},"stroke-linejoin-bevel":{"stroke-linejoin":"bevel"}},v0=["blur","brightness","contrast","grayscale","hue-rotate","invert","saturate","sepia","drop-shadow"],w0=["blur","brightness","contrast","grayscale","hue-rotate","invert","opacity","saturate","sepia"],$0=v0.map((e)=>`var(--tc-${e}, )`).join(" "),zl=w0.map((e)=>`var(--tc-backdrop-${e}, )`).join(" ");function je(e){return`var(--tc-drop-shadow-color, ${e})`}function F(e,t){return{[`--tc-${e}`]:t,filter:$0}}function ie(e,t){return{[`--tc-backdrop-${e}`]:t,"-webkit-backdrop-filter":zl,"backdrop-filter":zl}}var C0={"blur-none":F("blur","blur(0)"),"blur-xs":F("blur","blur(4px)"),"blur-sm":F("blur","blur(8px)"),blur:F("blur","blur(8px)"),"blur-md":F("blur","blur(12px)"),"blur-lg":F("blur","blur(16px)"),"blur-xl":F("blur","blur(24px)"),"blur-2xl":F("blur","blur(40px)"),"blur-3xl":F("blur","blur(64px)")},R0={"backdrop-blur-none":ie("blur","blur(0)"),"backdrop-blur-xs":ie("blur","blur(4px)"),"backdrop-blur-sm":ie("blur","blur(8px)"),"backdrop-blur":ie("blur","blur(8px)"),"backdrop-blur-md":ie("blur","blur(12px)"),"backdrop-blur-lg":ie("blur","blur(16px)"),"backdrop-blur-xl":ie("blur","blur(24px)"),"backdrop-blur-2xl":ie("blur","blur(40px)"),"backdrop-blur-3xl":ie("blur","blur(64px)")},k0={"grayscale-0":F("grayscale","grayscale(0)"),grayscale:F("grayscale","grayscale(100%)"),"invert-0":F("invert","invert(0)"),invert:F("invert","invert(100%)"),"sepia-0":F("sepia","sepia(0)"),sepia:F("sepia","sepia(100%)")},S0={"backdrop-grayscale-0":ie("grayscale","grayscale(0)"),"backdrop-grayscale":ie("grayscale","grayscale(100%)"),"backdrop-invert-0":ie("invert","invert(0)"),"backdrop-invert":ie("invert","invert(100%)"),"backdrop-sepia-0":ie("sepia","sepia(0)"),"backdrop-sepia":ie("sepia","sepia(100%)")},A0={"drop-shadow-xs":F("drop-shadow",`drop-shadow(0 1px 1px ${je("rgb(0 0 0 / 0.05)")})`),"drop-shadow-sm":F("drop-shadow",`drop-shadow(0 1px 2px ${je("rgb(0 0 0 / 0.15)")})`),"drop-shadow":F("drop-shadow",`drop-shadow(0 1px 2px ${je("rgb(0 0 0 / 0.1)")}) drop-shadow(0 1px 1px ${je("rgb(0 0 0 / 0.06)")})`),"drop-shadow-md":F("drop-shadow",`drop-shadow(0 3px 3px ${je("rgb(0 0 0 / 0.12)")})`),"drop-shadow-lg":F("drop-shadow",`drop-shadow(0 4px 4px ${je("rgb(0 0 0 / 0.15)")})`),"drop-shadow-xl":F("drop-shadow",`drop-shadow(0 9px 7px ${je("rgb(0 0 0 / 0.1)")})`),"drop-shadow-2xl":F("drop-shadow",`drop-shadow(0 25px 25px ${je("rgb(0 0 0 / 0.15)")})`),"drop-shadow-none":F("drop-shadow","drop-shadow(0 0 #0000)")},E0={"mix-blend-normal":{"mix-blend-mode":"normal"},"mix-blend-multiply":{"mix-blend-mode":"multiply"},"mix-blend-screen":{"mix-blend-mode":"screen"},"mix-blend-overlay":{"mix-blend-mode":"overlay"},"mix-blend-darken":{"mix-blend-mode":"darken"},"mix-blend-lighten":{"mix-blend-mode":"lighten"},"mix-blend-color-dodge":{"mix-blend-mode":"color-dodge"},"mix-blend-color-burn":{"mix-blend-mode":"color-burn"},"mix-blend-hard-light":{"mix-blend-mode":"hard-light"},"mix-blend-soft-light":{"mix-blend-mode":"soft-light"},"mix-blend-difference":{"mix-blend-mode":"difference"},"mix-blend-exclusion":{"mix-blend-mode":"exclusion"},"mix-blend-hue":{"mix-blend-mode":"hue"},"mix-blend-saturation":{"mix-blend-mode":"saturation"},"mix-blend-color":{"mix-blend-mode":"color"},"mix-blend-luminosity":{"mix-blend-mode":"luminosity"},"mix-blend-plus-darker":{"mix-blend-mode":"plus-darker"},"mix-blend-plus-lighter":{"mix-blend-mode":"plus-lighter"}},T0={"bg-blend-normal":{"background-blend-mode":"normal"},"bg-blend-multiply":{"background-blend-mode":"multiply"},"bg-blend-screen":{"background-blend-mode":"screen"},"bg-blend-overlay":{"background-blend-mode":"overlay"},"bg-blend-darken":{"background-blend-mode":"darken"},"bg-blend-lighten":{"background-blend-mode":"lighten"},"bg-blend-color-dodge":{"background-blend-mode":"color-dodge"},"bg-blend-color-burn":{"background-blend-mode":"color-burn"},"bg-blend-hard-light":{"background-blend-mode":"hard-light"},"bg-blend-soft-light":{"background-blend-mode":"soft-light"},"bg-blend-difference":{"background-blend-mode":"difference"},"bg-blend-exclusion":{"background-blend-mode":"exclusion"},"bg-blend-hue":{"background-blend-mode":"hue"},"bg-blend-saturation":{"background-blend-mode":"saturation"},"bg-blend-color":{"background-blend-mode":"color"},"bg-blend-luminosity":{"background-blend-mode":"luminosity"}},N0={...Yy,...Jy,...Xy,...Zy,...Qy,...ib,...ob,...sb,...ab,...lb,...pb,...sc,...ac,...yb,...bb,...xb,...wb,...$b,...Cb,...Rb,...kb,...Sb,...Ab,...Eb,...Tb,...Nb,...Ob,...Ib,...Pb,..._b,...Lb,...Mb,...Fb,...Db,...jb,...Bb,...Ub,...Vb,...Wb,...zb,...Kb,...Hb,...Gb,...qb,...Yb,...Jb,...Xb,...Zb,...Qb,...r0,...n0,...i0,...o0,...s0,...a0,...l0,...c0,...u0,...f0,...d0,...h0,...g0,...m0,...p0,...y0,...b0,...x0,...C0,...R0,...k0,...S0,...A0,...E0,...T0,...e0,...t0},Mt={hover:":hover",focus:":focus",active:":active",disabled:":disabled",visited:":visited",checked:":checked","focus-within":":focus-within","focus-visible":":focus-visible",first:":first-child",last:":last-child",odd:":nth-child(odd)",even:":nth-child(even)","first-of-type":":first-of-type","last-of-type":":last-of-type",before:"::before",after:"::after",marker:"::marker",placeholder:"::placeholder",selection:"::selection",file:"::file-selector-button","first-letter":"::first-letter","first-line":"::first-line",backdrop:"::backdrop","details-content":"::details-content",required:":required",valid:":valid",invalid:":invalid","read-only":":read-only",autofill:":autofill","user-valid":":user-valid","user-invalid":":user-invalid","in-range":":in-range","out-of-range":":out-of-range","placeholder-shown":":placeholder-shown",open:":is([open], :popover-open, :open)",closed:":not(:is([open], :popover-open, :open))",empty:":empty",enabled:":enabled",only:":only-child","only-of-type":":only-of-type",target:":target",indeterminate:":indeterminate",default:":default",optional:":optional",inert:":is([inert], [inert] *)"};function Kl(e){if(!e)return;if(e.charCodeAt(0)===91&&e.charCodeAt(e.length-1)===93){let n=e.slice(1,-1).replace(/_/g," ").trim();return n?`:is(${n})`:void 0}let t=Mt[e];if(t!==void 0)return t.startsWith("::")?void 0:t;let r=Ei(e);if(r!==void 0)return r;if(e.startsWith("has-")){let n=e.slice(4);if(!n)return;return n.charCodeAt(0)===91&&n.charCodeAt(n.length-1)===93?`:has(${n.slice(1,-1)})`:`:has(:${n})`}if(e.startsWith("aria-")||e.startsWith("data-"))return Qe(e.slice(0,4),e.slice(5));if(e.startsWith("in-")){let n=Ti(e.slice(3));return n===void 0?void 0:`:where(${n}) *`}return}var ki=[["nth-last-of-type-","nth-last-of-type"],["nth-of-type-","nth-of-type"],["nth-last-","nth-last-child"],["nth-","nth-child"]];function Ei(e){for(let t=0;t<ki.length;t++){let r=ki[t][0];if(!e.startsWith(r))continue;let n=ki[t][1],i=e.slice(r.length);if(i.charCodeAt(0)===91&&i.charCodeAt(i.length-1)===93){let o=i.slice(1,-1).replace(/_/g," ").trim();return o?`:${n}(${o})`:void 0}return/^\d+$/.test(i)?`:${n}(${i})`:void 0}return}function Ti(e){if(!e)return;if(e.charCodeAt(0)===91&&e.charCodeAt(e.length-1)===93){let r=e.slice(1,-1).replace(/_/g," ").trim();if(!r)return;return r.includes("&")?r.replace(/&/g,"*"):`:is(${r})`}if(e.startsWith("data-"))return Qe("data",e.slice(5));if(e.startsWith("aria-"))return Qe("aria",e.slice(5));let t=Mt[e];return t!==void 0&&!t.startsWith("::")?t:void 0}var O0=/^([^~|^$*=\s]+)([~|^$*]?=)([\s\S]*)$/,I0=/\s+([is])$/i;function P0(e){let t=O0.exec(e);if(t===null)return e;let r=t[1],n=t[2],i=t[3],o="",s=I0.exec(i);if(s!==null)o=` ${s[1]}`,i=i.slice(0,s.index);let c=i.length>1&&(i.charCodeAt(0)===34||i.charCodeAt(0)===39)&&i.charCodeAt(i.length-1)===i.charCodeAt(0)?i:`"${i.replace(/["\\]/g,"\\$&")}"`;return`${r}${n}${c}${o}`}function Qe(e,t){if(!t)return;if(t.charCodeAt(0)===91&&t.charCodeAt(t.length-1)===93){let r=t.slice(1,-1).replace(/_/g," ").trim();return r?`[${e}-${P0(r)}]`:void 0}return e==="aria"?`[aria-${t}="true"]`:`[data-${t}]`}function Hr(e){if(!e)return;if(e.startsWith("has-")){let r=e.slice(4);if(!r)return;return r.charCodeAt(0)===91&&r.charCodeAt(r.length-1)===93?`:has(${r.slice(1,-1)})`:`:has(:${r})`}if(e.charCodeAt(0)===91&&e.charCodeAt(e.length-1)===93){let r=e.slice(1,-1).replace(/_/g," ").trim();if(!r)return;return r.includes("&")?r.replace(/&/g,""):`:is(${r})`}if(e.startsWith("data-"))return Qe("data",e.slice(5));if(e.startsWith("aria-"))return Qe("aria",e.slice(5));let t=Mt[e];return t!==void 0&&!t.startsWith("::")?t:void 0}function Gr(e){let t=0,r=-1;for(let n=0;n<e.length;n++){let i=e.charCodeAt(n);if(i===91||i===40)t++;else if(i===93||i===41)t--;else if(i===47&&t===0)r=n}if(r===-1)return{base:e,name:""};return{base:e.slice(0,r),name:e.slice(r+1)}}function Hl(e){return wn(e).css}var Si={"pointer-none":"(pointer: none)","pointer-coarse":"(pointer: coarse)","pointer-fine":"(pointer: fine)","any-pointer-none":"(any-pointer: none)","any-pointer-coarse":"(any-pointer: coarse)","any-pointer-fine":"(any-pointer: fine)","inverted-colors":"(inverted-colors: inverted)",noscript:"(scripting: none)"},Gl={print:"print","motion-safe":"(prefers-reduced-motion: no-preference)","motion-reduce":"(prefers-reduced-motion: reduce)","contrast-more":"(prefers-contrast: more)","contrast-less":"(prefers-contrast: less)",landscape:"(orientation: landscape)",portrait:"(orientation: portrait)","forced-colors":"(forced-colors: active)"};function ql(e){if(e.charCodeAt(0)===91&&e.charCodeAt(e.length-1)===93){let t=e.slice(1,-1).replace(/_/g," "),r=t.indexOf(":");if(r!==-1)return`(${t.slice(0,r).trim()}: ${t.slice(r+1).trim()})`;return`(${t})`}return`(${e})`}function _0(e){let t=0;for(let r=e.length-1;r>=0;r--){let n=e.charCodeAt(r);if(n===93)t++;else if(n===91)t--;else if(n===47&&t===0)return{size:e.slice(0,r),name:e.slice(r+1)}}return{size:e}}var Yl="\x01",Jl={dark:".dark ",light:".light "},Xl={rtl:':is([dir="rtl"], [dir="rtl"] *)',ltr:':is([dir="ltr"], [dir="ltr"] *)'},Zl=new WeakMap,Ql=new WeakMap,ec=new WeakMap,tc=new WeakMap,rc=new WeakMap,nc=new WeakMap,ic=new WeakMap;function L0(e){let t=Ql.get(e);if(t)return t;let r=!1;for(let i in e)if(qr[i]!==e[i]){r=!0;break}let n=r?{...qr,...e}:qr;return Ql.set(e,n),n}function M0(e){let t=e.lastIndexOf("-");return t>0&&/^\d+$/.test(e.slice(t+1))?e.slice(0,t):e}function F0(e,t){let r=t?.length?t.join("\x00"):"",n=ec.get(e),i=n?.get(r);if(i)return i;let o=null;for(let c in e){let a=e[c];if(typeof a==="string"){if(bt[c]!==void 0&&bt[c]!==a)o??={},o[c]=a;continue}if(!a||typeof a!=="object")continue;for(let l in a){let u=a[l];if(typeof u!=="string")continue;let f=l==="DEFAULT"?c:`${c}-${l}`;if(bt[f]!==void 0&&bt[f]!==u)o??={},o[f]=u}}let s=o?{...bt,...o}:bt;if(r){let c=null;for(let a in s){let l=M0(a);if(!t.includes(l))continue;c??={...s},c[a]=W(a,s[a],l,t)}if(c)s=c}if(!n)n=new Map,ec.set(e,n);return n.set(r,s),s}function D0(e){let t=tc.get(e);if(t!==void 0)return t;let r=!1;for(let n in e){let i=n==="DEFAULT"?"rounded":`rounded-${n}`;if(ac[i]?.["border-radius"]!==e[n]){r=!0;break}}return tc.set(e,r),r}function j0(e){let t=rc.get(e);if(t!==void 0)return t;let r=!1;for(let n in e){let i=n==="DEFAULT"?"shadow":`shadow-${n}`,o=sc[i];if(o!==void 0&&o["--tc-shadow"]!==e[n]){r=!0;break}}return rc.set(e,r),r}function B0(e){let t=e??ht.theme.screens,r=nc.get(t);if(r)return r;let n=new Map(Object.entries(t));return nc.set(t,n),n}function U0(e){let t=e??ht.theme.containers,r=ic.get(t);if(r)return r;let n=new Map(Object.entries(t));return ic.set(t,n),n}function V0(e){let t=Zl.get(e);if(t)return t;if(e.presets&&e.presets.length>0)for(let u of e.presets){if(u.theme)e.theme=Ai(e.theme,u.theme);if(u.rules&&u.rules.length>0)e.rules=[...u.rules,...e.rules];if(u.shortcuts)e.shortcuts={...u.shortcuts,...e.shortcuts};if(u.variants)e.variants={...u.variants,...e.variants};if(u.preflights&&u.preflights.length>0)e.preflights=[...u.preflights,...e.preflights]}let r=e.theme.extend?.colors?e.theme.extend.colors:null;if(e.theme.extend){let{extend:u,...f}=e.theme;if(u)e.theme=Ai(f,u)}let n=[],i=new Set;for(let u of e.blocklist)if(u.includes("*"))n.push(new RegExp(`^${u.replace(/\*/g,".*")}$`));else i.add(u);let o=L0(e.theme.spacing),s=F0(e.theme.colors,e.colorVariables),c=D0(e.theme.borderRadius),a=j0(e.theme.boxShadow),l={config:e,variantEnabled:e.variants,spacingValues:o,commonColors:s,skipStaticRadius:c,skipStaticShadow:a,screenBreakpoints:B0(e.theme.screens),containerBreakpoints:U0(e.theme.containers),blocklistRegexCache:n,blocklistExact:i,extendColors:r,hasBlocklist:n.length>0||i.size>0,hasShortcuts:Object.keys(e.shortcuts).length>0};return Zl.set(e,l),l}function oc(e){return e>=97&&e<=122||e>=65&&e<=90||e>=48&&e<=57||e===45||e===95}function W0(e){let t=e.indexOf(".");if(t===-1)return;t++;let r=()=>{if(e.charCodeAt(t)===92&&e.charCodeAt(t+1)===33)t+=2};r();for(;;){let i=t;while(i<e.length&&oc(e.charCodeAt(i)))i++;if(e.charCodeAt(i)!==92||e.charCodeAt(i+1)!==58)break;t=i+2}r();let n=t;while(n<e.length&&oc(e.charCodeAt(n)))n++;return n>t?e.slice(t,n):void 0}var z0=/^(?:mx|my|px|py|inset-x|inset-y|border-x|border-y|scroll-mx|scroll-my|scroll-px|scroll-py|space-x|space-y|gap-x|gap-y)-/,K0=/^rounded-[tlbr](?:-|$)/,H0=/^(?:mt|mr|mb|ml|pt|pr|pb|pl|top|right|bottom|left|border-t|border-r|border-b|border-l|scroll-mt|scroll-mr|scroll-mb|scroll-ml|scroll-pt|scroll-pr|scroll-pb|scroll-pl)-/,G0=/^rounded-(?:tl|tr|bl|br)(?:-|$)/,q0=/^i-[a-z][a-z0-9]*(?:-[a-z0-9]+)*-.+/;function Y0(e){let t=W0(e);if(!t)return 0;if(q0.test(t))return-1;if(z0.test(t)||K0.test(t))return 1;if(H0.test(t)||G0.test(t))return 2;return 0}class Ni{config;rules=new Map;classCache=new Set;selectorCache=new Map;mediaQueryCache=new Map;ruleCache=new Map;variantEnabled;screenBreakpoints;containerBreakpoints;noMatchCache=new Set;usedKeyframes=new Set;variantHandledCache=new Map;utilityRankCache=new Map;compiledGenerated=new Set;darkStrategy;spacingValues;commonColors;skipStaticRadius;skipStaticShadow;shortcutSelectorRaw=null;extendColors=null;processed;revision=0;cssCache=null;cssCacheRevision=-1;cssCachePreflight=!1;cssCacheMinify=!1;constructor(e){this.config=e;this.processed=V0(e),this.variantEnabled=this.processed.variantEnabled,this.screenBreakpoints=this.processed.screenBreakpoints,this.containerBreakpoints=this.processed.containerBreakpoints,this.extendColors=this.processed.extendColors,this.darkStrategy=e.darkMode==="media"?"media":"class",this.spacingValues=this.processed.spacingValues,this.commonColors=this.processed.commonColors,this.skipStaticRadius=this.processed.skipStaticRadius,this.skipStaticShadow=this.processed.skipStaticShadow}buildRuleLookup(){}generateBatch(e){for(let t=0;t<e.length;t++)this.generate(e[t])}generate(e){if(this.classCache.has(e))return;if(this.classCache.add(e),this.processed.hasShortcuts){let t=this.config.shortcuts[e];if(t){this.expandShortcut(e,t,new Set([e]));return}let r=this.resolveVariantShortcut(e);if(r){let{base:n,prefix:i,important:o}=r;this.expandShortcut(e,this.config.shortcuts[n],new Set([n]),i,o);return}}this.generateUtility(e)}resolveVariantShortcut(e){if(!e.includes(":")&&!e.includes("!"))return;let t=!1,r=e;if(r.charCodeAt(0)===33)t=!0,r=r.slice(1);else if(r.length>1&&r.charCodeAt(r.length-1)===33)t=!0,r=r.slice(0,-1);let n=St(r),i=n[n.length-1];if(!t&&i.length>1&&i.charCodeAt(0)===33)t=!0,i=i.slice(1);if(i===e||!Object.hasOwn(this.config.shortcuts,i))return;let o=n.slice(0,-1);return{base:i,prefix:o.length>0?`${o.join(":")}:`:"",important:t}}expandShortcut(e,t,r,n="",i=!1){let o=Array.isArray(t)?t:t.split(/\s+/),s=this.shortcutSelectorRaw;this.shortcutSelectorRaw=e;for(let c of o){if(!c)continue;let a=this.config.shortcuts[c];if(a){if(!r.has(c))r.add(c),this.expandShortcut(e,a,r,n,i);continue}let l=this.resolveVariantShortcut(c);if(l){if(!r.has(l.base))r.add(l.base),this.expandShortcut(e,this.config.shortcuts[l.base],r,n+l.prefix,i||l.important),r.delete(l.base);continue}let u=n===""?c:n+c;if(i&&!Cn(u).important)u+="!";this.generateUtility(u)}this.shortcutSelectorRaw=s}generateCompiledClass(e,t){if(this.compiledGenerated.has(e))return;this.compiledGenerated.add(e),this.classCache.add(e),this.expandShortcut(e,t,new Set([e]))}generateUtility(e){if(this.processed.hasBlocklist){if(this.processed.blocklistExact.has(e))return;let l=this.processed.blocklistRegexCache;for(let u=0;u<l.length;u++)if(l[u].test(e))return}let t=Cn(e),r=t.base,n=N0[r];if(n&&(this.skipStaticRadius&&r.startsWith("rounded")||this.skipStaticShadow&&(r==="shadow"||r.startsWith("shadow-"))))n=void 0;if(n){if(this.addRule(t,n),n.animation){let l=n.animation.split(" ")[0];if(l&&l!=="none")this.usedKeyframes.add(l),this.revision++}return}let{utility:i,value:o}=t;if(i==="w"&&o){let l=Wl[o]||this.config.theme.spacing[o];if(l){this.addRule(t,{width:l});return}if(t.arbitrary){let u=o.match(/^(\d+)\/(\d+)$/);if(u){let f=Number(u[1]),d=Number(u[2]);if(!Number.isNaN(f)&&!Number.isNaN(d)&&d!==0){this.addRule(t,{width:$e(f,d)});return}}this.addRule(t,{width:o});return}}if(i==="h"&&o){let l=Wl[o]||this.config.theme.spacing[o];if(l){this.addRule(t,{height:o==="screen"?"100vh":l});return}if(t.arbitrary){let u=o.match(/^(\d+)\/(\d+)$/);if(u){let f=Number(u[1]),d=Number(u[2]);if(!Number.isNaN(f)&&!Number.isNaN(d)&&d!==0){this.addRule(t,{height:$e(f,d)});return}}this.addRule(t,{height:o});return}}if(i==="p"&&o){let l=this.spacingValues[o];if(l){this.addRule(t,{padding:l});return}}if(i==="px"&&o){let l=this.spacingValues[o];if(l){this.addRule(t,{"padding-left":l,"padding-right":l});return}}if(i==="py"&&o){let l=this.spacingValues[o];if(l){this.addRule(t,{"padding-top":l,"padding-bottom":l});return}}if((i==="pt"||i==="pr"||i==="pb"||i==="pl")&&o){let l=this.spacingValues[o];if(l){let u={pt:"padding-top",pr:"padding-right",pb:"padding-bottom",pl:"padding-left"};this.addRule(t,{[u[i]]:l});return}}if(i==="m"&&o){let l=this.spacingValues[o];if(l){this.addRule(t,{margin:l});return}}if(i==="mx"&&o){let l=this.spacingValues[o];if(l){this.addRule(t,{"margin-left":l,"margin-right":l});return}}if(i==="my"&&o){let l=this.spacingValues[o];if(l){this.addRule(t,{"margin-top":l,"margin-bottom":l});return}}if((i==="mt"||i==="mr"||i==="mb"||i==="ml")&&o){let l=this.spacingValues[o];if(l){let u={mt:"margin-top",mr:"margin-right",mb:"margin-bottom",ml:"margin-left"};this.addRule(t,{[u[i]]:l});return}}if((i==="top"||i==="right"||i==="bottom"||i==="left")&&o){let l=this.spacingValues[o];if(l){this.addRule(t,{[i]:l});return}}if(i==="inset"&&o){let l=this.spacingValues[o];if(l){this.addRule(t,{top:l,right:l,bottom:l,left:l});return}}if(i==="inset-x"&&o){let l=this.spacingValues[o];if(l){this.addRule(t,{left:l,right:l});return}}if(i==="inset-y"&&o){let l=this.spacingValues[o];if(l){this.addRule(t,{top:l,bottom:l});return}}if(i==="bg"&&o){let l=this.commonColors[o];if(l){this.addRule(t,{"background-color":l});return}}if(i==="text"&&o){let l=this.commonColors[o];if(l){this.addRule(t,{color:l});return}}if(i==="border"&&o){let l=this.commonColors[o];if(l){this.addRule(t,{"border-color":l});return}}if(i==="justify"&&o){let l=eb[o];if(l){this.addRule(t,{"justify-content":l});return}}if(i==="items"&&o){let l=tb[o];if(l){this.addRule(t,{"align-items":l});return}}if(i==="content"&&o){let l=rb[o];if(l){this.addRule(t,{"align-content":l});return}if(t.arbitrary){this.addRule(t,{content:o});return}}if(i==="self"&&o){let l=nb[o];if(l){this.addRule(t,{"align-self":l});return}}if(i==="grid-cols"&&o){let l=fb[o];if(l){this.addRule(t,{"grid-template-columns":l});return}}if(i==="grid-rows"&&o){let l=db[o];if(l){this.addRule(t,{"grid-template-rows":l});return}}if(i==="col"&&o){let l=hb[o];if(l){this.addRule(t,{"grid-column":l});return}}if(i==="row"&&o){let l=gb[o];if(l){this.addRule(t,{"grid-row":l});return}}if(i==="grid-flow"&&o){let l=mb[o];if(l){this.addRule(t,{"grid-auto-flow":l});return}}if(i==="auto-cols"&&o){let l=Vl[o];if(l){this.addRule(t,{"grid-auto-columns":l});return}}if(i==="auto-rows"&&o){let l=Vl[o];if(l){this.addRule(t,{"grid-auto-rows":l});return}}if(i==="origin"&&o){let l=ub[o];if(l){this.addRule(t,{"transform-origin":l});return}}if(i==="scale"&&o&&!t.arbitrary){let l=Number(o)/100;if(!Number.isNaN(l)){this.addRule(t,{transform:`scale(${l})`});return}}if(i==="scale-x"&&o&&!t.arbitrary){let l=Number(o)/100;if(!Number.isNaN(l)){this.addRule(t,{transform:`scaleX(${l})`});return}}if(i==="scale-y"&&o&&!t.arbitrary){let l=Number(o)/100;if(!Number.isNaN(l)){this.addRule(t,{transform:`scaleY(${l})`});return}}if(i==="rotate"&&o&&!t.arbitrary&&/^-?\d+(?:\.\d+)?$/.test(o)){this.addRule(t,{transform:`rotate(${o}deg)`});return}if(i==="duration"&&o&&o!=="0"&&!t.arbitrary&&/^\d+(?:\.\d+)?$/.test(o)){this.addRule(t,{"transition-duration":`${o}ms`});return}if(i==="delay"&&o&&o!=="0"&&!t.arbitrary&&/^\d+(?:\.\d+)?$/.test(o)){this.addRule(t,{"transition-delay":`${o}ms`});return}let s=(l)=>{let u=this.config.theme.spacing[l];if(u!==void 0)return u;if(t.arbitrary)return l;if(/^\d+(?:\.\d+)?$/.test(l)){let f=Number.parseFloat(l);if(Number.isFinite(f))return`${f*0.25}rem`}return};if(i==="gap"&&o){let l=s(o);if(l!==void 0)this.addRule(t,{gap:l});return}if(i==="gap-x"&&o){let l=s(o);if(l!==void 0)this.addRule(t,{"column-gap":l});return}if(i==="gap-y"&&o){let l=s(o);if(l!==void 0)this.addRule(t,{"row-gap":l});return}if(i==="place"&&o){if(o.startsWith("content-")){let l=Ri[o.slice(8)];if(l){this.addRule(t,{"place-content":l});return}}if(o.startsWith("items-")){let l=Ri[o.slice(6)];if(l){this.addRule(t,{"place-items":l});return}}if(o.startsWith("self-")){let l=Ri[o.slice(5)];if(l){this.addRule(t,{"place-self":l});return}}}let c=`${t.utility}:${t.value||""}`;if(this.noMatchCache.has(c))return;if(this.config.rules.length>0)for(let[l,u]of this.config.rules){let f=e.match(l);if(f){let d=u(f);if(d){this.addRule(t,d);return}}}let a=Ci.length;for(let l=0;l<a;l++){let u=Ci[l](t,this.config);if(u){if("properties"in u&&typeof u.properties==="object")this.addRule(t,u.properties,u.childSelector,u.pseudoElement,u.defaults);else this.addRule(t,u);return}}this.noMatchCache.add(c)}isVariantHandled(e){let t=this.variantHandledCache.get(e);if(t!==void 0)return t;let r=Mt[e]!==void 0||Jl[e]!==void 0||Xl[e]!==void 0||e.startsWith("not-")&&this.isNegationResolvable(e.slice(4))||this.screenBreakpoints.has(e)||e.startsWith("max-")&&this.screenBreakpoints.has(e.slice(4))||e.charCodeAt(0)===64&&this.containerQuery(e.slice(1))!==void 0||e==="*"||e==="**"||Ei(e)!==void 0||e.startsWith("in-")&&Ti(e.slice(3))!==void 0||e.startsWith("group-")&&Hr(Gr(e.slice(6)).base)!==void 0||e.startsWith("peer-")&&Hr(Gr(e.slice(5)).base)!==void 0||e.startsWith("group/")||e.startsWith("peer/")||e.startsWith("has-")||e.startsWith("aria-")||e.startsWith("data-")||e.startsWith("supports-")||e.startsWith("[")&&e.endsWith("]")||Si[e]!==void 0||e==="starting"||["print","motion-safe","motion-reduce","contrast-more","contrast-less","landscape","portrait","forced-colors"].includes(e);return this.variantHandledCache.set(e,r),r}containerQuery(e){if(!e)return;let{size:t,name:r}=_0(e);if(!t||r!==void 0&&!r)return;let n=t,i=!0;if(t.startsWith("max-"))n=t.slice(4),i=!1;else if(t.startsWith("min-"))n=t.slice(4);let o;if(n.charCodeAt(0)===91&&n.charCodeAt(n.length-1)===93)o=n.slice(1,-1).replace(/_/g," ").trim()||void 0;else o=this.containerBreakpoints.get(n);if(o===void 0)return;let s=i?`(width >= ${o})`:`(width < ${o})`;return r===void 0?`@container ${s}`:`@container ${r} ${s}`}negatableAtRule(e){if(!e)return;let t=Gl[e];if(t!==void 0)return{media:t};let r=Si[e];if(r!==void 0)return{media:r};let n=this.screenBreakpoints.get(e);if(n!==void 0)return{media:`(min-width: ${n})`};if(this.darkStrategy==="media"&&(e==="dark"||e==="light"))return{media:`(prefers-color-scheme: ${e})`};if(e.startsWith("supports-")){let i=e.slice(9);return i?{supports:ql(i)}:void 0}return}isNegationResolvable(e){return Kl(e)!==void 0||this.negatableAtRule(e)!==void 0}addRule(e,t,r,n,i){for(let l=0;l<e.variants.length;l++)if(!this.isVariantHandled(e.variants[l]))return;let o=this.shortcutSelectorRaw===null?r===void 0&&n===void 0?e.raw:`${e.raw}${r||""}${n||""}`:`${this.shortcutSelectorRaw}>${e.raw}${r||""}${n||""}`,s=this.selectorCache.get(o);if(!s){if(s=this.buildSelector(e),n)s+=n;if(r)s+=` ${r}`;if(i&&!s.includes("::"))s=`:where(${s})`;this.selectorCache.set(o,s)}let c=this.getMediaQuery(e);if(e.important){let l={};for(let u in t)l[u]=`${t[u]} !important`;t=l}let a=c||"base";if(!this.rules.has(a))this.rules.set(a,[]);this.revision++,this.rules.get(a).push({selector:s,properties:t,mediaQuery:c,childSelector:r})}buildSelector(e){let t=`.${this.escapeSelector(this.shortcutSelectorRaw??e.raw)}`,r="",n=e.variants,i=n.length;if(i===0)return t;for(let o=0;o<i;o++){let s=n[o];if(s.charCodeAt(0)===91&&s.charCodeAt(s.length-1)===93){let u=s.slice(1,-1).replace(/_/g," ");if(u.includes("&"))t=u.replace(/&/g,t);continue}if(s==="*"||s==="**"){if(this.variantEnabled[s])t=s==="*"?`:is(${t} > *)`:`:is(${t} *)`;continue}let c=Mt[s];if(c!==void 0){if(this.variantEnabled[s])t+=c;continue}let a=Xl[s];if(a!==void 0){if(this.variantEnabled[s]){let u=t.indexOf("::");t=u===-1?t+a:t.slice(0,u)+a+t.slice(u)}continue}let l=Jl[s];if(l!==void 0){if(this.darkStrategy==="media"&&(s==="dark"||s==="light"))continue;if(this.variantEnabled[s])r=l;continue}if(s.charCodeAt(0)===110&&s.startsWith("not-")){if(this.variantEnabled.not){let u=Kl(s.slice(4));if(u!==void 0)t+=`:not(${u})`}continue}if(s.charCodeAt(0)===110&&s.startsWith("nth-")){let u=Ei(s);if(u!==void 0)t+=u;continue}if(s.charCodeAt(0)===105&&s.startsWith("in-")){if(this.variantEnabled.in){let u=Ti(s.slice(3));if(u!==void 0)r=`:where(${u}) `}continue}if(s.charCodeAt(0)===103&&s.startsWith("group-")){if(this.variantEnabled.group){let{base:u,name:f}=Gr(s.slice(6)),d=f?`.group\\/${f}`:".group",h=Hr(u);if(h!==void 0)r=`${d}${h} `}continue}if(s.charCodeAt(0)===103&&s.startsWith("group/")){if(this.variantEnabled.group)r=`.group\\/${s.slice(6)} `;continue}if(s.charCodeAt(0)===112&&s.startsWith("peer-")){if(this.variantEnabled.peer){let{base:u,name:f}=Gr(s.slice(5)),d=f?`.peer\\/${f}`:".peer",h=Hr(u);if(h!==void 0)r=`${d}${h} ~ `}continue}if(s.charCodeAt(0)===112&&s.startsWith("peer/")){if(this.variantEnabled.peer)r=`.peer\\/${s.slice(5)} ~ `;continue}if(s.charCodeAt(0)===104&&s.startsWith("has-")){if(this.variantEnabled.has){let u=s.slice(4);if(u.charCodeAt(0)===91&&u.charCodeAt(u.length-1)===93){let f=u.slice(1,-1);t+=`:has(${f})`}else t+=`:has(:${u})`}continue}if(s.charCodeAt(0)===97&&s.startsWith("aria-")){if(this.variantEnabled.aria){let u=Qe("aria",s.slice(5));if(u!==void 0)t+=u}continue}if(s.charCodeAt(0)===100&&s.startsWith("data-")){if(this.variantEnabled.data){let u=Qe("data",s.slice(5));if(u!==void 0)t+=u}continue}}return r+t}getMediaQuery(e){let t=e.variants,r=t.length;if(r===0)return;let n=r===1?t[0]:t.join(":"),i=this.mediaQueryCache.get(n);if(i!==void 0)return i||void 0;let o=[],s=[],c=[],a=!1;for(let u=0;u<r;u++){let f=t[u],d=f.charCodeAt(0);if(d===91&&f.startsWith("[@media")&&f.endsWith("]")){let g=f.slice(1,-1).replace(/_/g," ").slice(6).trim();if(g)o.push(g);continue}if(d===64){let g=this.containerQuery(f.slice(1));if(g!==void 0)c.push(g);continue}if(d===110&&f.startsWith("not-")){if(this.variantEnabled.not){let g=this.negatableAtRule(f.slice(4));if(g!==void 0)if(g.supports!==void 0)s.push(`@supports not ${g.supports}`);else o.push(`not ${g.media}`)}continue}if(this.darkStrategy==="media"&&(f==="dark"||f==="light")){o.push(`(prefers-color-scheme: ${f})`);continue}if(this.variantEnabled.responsive){let g=this.screenBreakpoints.get(f);if(g){o.push(`(min-width: ${g})`);continue}if(f.startsWith("max-")){let p=this.screenBreakpoints.get(f.slice(4));if(p){let y=p.match(/^([\d.]+)px$/);o.push(y?`(max-width: ${Number.parseFloat(y[1])-0.02}px)`:`not all and (min-width: ${p})`);continue}}}if(f==="starting"){if(this.variantEnabled.starting)a=!0;continue}let h=Si[f];if(h!==void 0){if(this.variantEnabled[f])o.push(h);continue}let m=Gl[f];if(m!==void 0){if(this.variantEnabled[f])o.push(m);continue}if(f.charCodeAt(0)===115&&f.startsWith("supports-")){if(this.variantEnabled.supports)s.push(`@supports ${ql(f.slice(9))}`)}}let l=[];if(o.length>0)o.sort((u,f)=>Number(u.charCodeAt(0)===40)-Number(f.charCodeAt(0)===40)),l.push(`@media ${o.join(" and ")}`);if(l.push(...s,...c),a)l.push("@starting-style");if(l.length>0){let u=l.join(Yl);return this.mediaQueryCache.set(n,u),u}this.mediaQueryCache.set(n,"");return}escapeSelector(e){let t=!1;for(let r=0;r<e.length;r++){let n=e.charCodeAt(r);if(!(n>=97&&n<=122||n>=65&&n<=90||n>=48&&n<=57||n===45||n===95||n>127)){t=!0;break}}if(!t)return e;return e.replace(/[\x00-\x2C\x2E\x2F\x3A-\x40\x5B-\x5E\x60\x7B-\x7F]/g,"\\$&")}buildFontCSS(){let e=this.config.fonts;if(!e)return"";let t=[],r=e.google?.filter(Boolean)??[];if(r.length>0){let n=r.map((o)=>`family=${o.trim().replace(/\s+/g,"+")}`).join("&"),i=e.display??"swap";t.push(`@import url('https://fonts.googleapis.com/css2?${n}&display=${i}');`)}if(e.faces?.length)t.push(...e.faces.map((n)=>n.trim()).filter(Boolean));return t.join(`
|
|
369
369
|
`)}toCSS(e=!0,t=!1){if(this.cssCache!==null&&this.cssCacheRevision===this.revision&&this.cssCachePreflight===e&&this.cssCacheMinify===t)return this.cssCache;let r=[],n=this.buildFontCSS();if(n)r.push(t?n.replace(/\s*\n\s*/g,""):n);if(e)for(let a of this.config.preflights){let l=a.getCSS(),u=this.config.theme?.fontFamily?.sans;if(u&&Array.isArray(u)){let d=u.join(", ");l=l.replace(/font-family:\s*ui-sans-serif[^;]+;/g,`font-family: ${d};`)}let f=`@layer tc-base {
|
|
370
370
|
${l}
|
|
371
|
-
}`;r.push(t?
|
|
371
|
+
}`;r.push(t?Hl(f):f)}if(this.config.cssVariables){let a=this.generateCSSVariables();if(a)r.push(t?a.replace(/\s+/g," ").trim():a)}let i=this.rules.get("base")||[];if(i.length>0)r.push(this.rulesToCSS(i,t));if(this.usedKeyframes.size>0)for(let a of this.usedKeyframes){let l=cb[a];if(l)r.push(t?Hl(l):l)}let o=[...this.rules.entries()].filter(([a,l])=>a!=="base"&&l.length>0),s=(a)=>{let l=a.match(/min-width:\s*([\d.]+)(px|rem|em)/);if(!l)return Number.MAX_SAFE_INTEGER;let u=Number.parseFloat(l[1]);return l[2]==="px"?u:u*16};o.sort((a,l)=>s(a[1][0].mediaQuery)-s(l[1][0].mediaQuery));for(let[,a]of o){let l=a[0].mediaQuery.split(Yl),u=this.rulesToCSS(a,t);for(let f=l.length-1;f>=0;f--)u=t?`${l[f]}{${u}}`:`${l[f]} {
|
|
372
372
|
${u}
|
|
373
373
|
}`;r.push(u)}let c=t?r.join(""):r.join(`
|
|
374
374
|
|
|
375
|
-
`);return this.cssCache=c,this.cssCacheRevision=this.revision,this.cssCachePreflight=e,this.cssCacheMinify=t,c}getUtilityRank(e){let t=this.utilityRankCache.get(e);if(t!==void 0)return t;let r=
|
|
375
|
+
`);return this.cssCache=c,this.cssCacheRevision=this.revision,this.cssCachePreflight=e,this.cssCacheMinify=t,c}getUtilityRank(e){let t=this.utilityRankCache.get(e);if(t!==void 0)return t;let r=Y0(e);return this.utilityRankCache.set(e,r),r}rulesToCSS(e,t){let r=e.length,n=Array.from({length:r}),i=Array.from({length:r});for(let c=0;c<r;c++)n[c]=this.getUtilityRank(e[c].selector),i[c]=c;i.sort((c,a)=>n[c]-n[a]||c-a);let o=new Map;for(let c=0;c<r;c++){let a=e[i[c]],l=o.get(a.selector);if(l===void 0)l=new Map,o.set(a.selector,l);let u=a.properties;for(let f in u)l.set(f,u[f])}let s=[];for(let[c,a]of o){let l="",u=!0;for(let[f,d]of a){if(t){if(!u)l+=";";l+=`${f}:${d}`}else{if(!u)l+=`
|
|
376
376
|
`;l+=` ${f}: ${d};`}u=!1}s.push(t?`${c}{${l}}`:`${c} {
|
|
377
377
|
${l}
|
|
378
378
|
}`)}return t?s.join(""):s.join(`
|
|
379
379
|
|
|
380
|
-
`)}generateCSSVariables(){let e=this.extendColors;if(!e){let r=
|
|
380
|
+
`)}generateCSSVariables(){let e=this.extendColors;if(!e){let r=ht.theme.colors,n={};for(let[i,o]of Object.entries(this.config.theme.colors)){let s=r[i];if(typeof o==="string"){if(s!==o)n[i]=o}else if(o&&typeof o==="object")if(!s||typeof s!=="object")n[i]=o;else{let c={};for(let[a,l]of Object.entries(o))if(typeof l==="string"&&s[a]!==l)c[a]=l;if(Object.keys(c).length>0)n[i]=c}}e=n}if(!e||Object.keys(e).length===0)return null;let t=[];for(let[r,n]of Object.entries(e))if(typeof n==="string")t.push(` --${r}: ${n};`);else if(typeof n==="object"&&n!==null){for(let[i,o]of Object.entries(n))if(typeof o==="string")t.push(i==="DEFAULT"?` --${r}: ${o};`:` --${r}-${i}: ${o};`)}if(t.length===0)return null;return`:root {
|
|
381
381
|
${t.join(`
|
|
382
382
|
`)}
|
|
383
|
-
}`}reset(){this.revision++,this.rules.clear(),this.classCache.clear(),this.selectorCache.clear(),this.mediaQueryCache.clear(),this.noMatchCache.clear(),this.usedKeyframes.clear(),this.compiledGenerated.clear(),this.utilityRankCache.clear()}}var{Glob:
|
|
384
|
-
`,r=[];for(let i of this.vars)r.push(
|
|
383
|
+
}`}reset(){this.revision++,this.rules.clear(),this.classCache.clear(),this.selectorCache.clear(),this.mediaQueryCache.clear(),this.noMatchCache.clear(),this.usedKeyframes.clear(),this.compiledGenerated.clear(),this.utilityRankCache.clear()}}var{Glob:J0}=globalThis.Bun;var X0=32;class Oi{patterns;transformer;extractOptions;constructor(e,t=void 0,r=void 0){this.patterns=e;this.transformer=t;this.extractOptions=r}async scan(){let e=new Set,t=new Map,r=new Set,n=Array.from({length:this.patterns.length},()=>!1),i=[];await Promise.all(this.patterns.map(async(l,u)=>{try{let f=new J0(l);for await(let d of f.scan(".")){if(n[u]=!0,r.has(d))continue;r.add(d),i.push(d)}}catch{}}));let o=Math.min(i.length,X0),s=0;await Promise.all(Array.from({length:o},async()=>{while(s<i.length){let l=i[s++];try{let u=await Bun.file(l).text();if(this.transformer){let f=this.transformer.processFile(u);if(f.hasChanges)t.set(l,f.content),u=f.content}for(let f of Jt(u,this.extractOptions))e.add(f)}catch{}}}));let a=this.patterns.filter((l,u)=>!n[u]);return{classes:e,transformedFiles:t,unmatchedPatterns:a}}async scanFile(e){try{let t=await Bun.file(e).text();return Jt(t,this.extractOptions)}catch{return new Set}}scanContent(e){return Jt(e,this.extractOptions)}}import{resolve as nx}from"path";var{Glob:ix}=globalThis.Bun;import{statSync as tx}from"fs";var lc=new Map;function cc(e){let t=lc.get(e);if(t!==void 0)return t;let r;if(e.startsWith("--"))r=e;else r=e.replace(/[A-Z]/g,(n)=>`-${n.toLowerCase()}`);return lc.set(e,r),r}class uc{rules=new Map;keyframes=new Map;vars=[];varKeys=new Set;insertionOrder=new Map;nextIndex=0;generation=0;addRule(e){if(this.rules.has(e.className))return;this.rules.set(e.className,e),this.insertionOrder.set(e.className,this.nextIndex++)}addKeyframes(e){if(!this.keyframes.has(e.name))this.keyframes.set(e.name,e)}addVars(e){let t=`${e.atRule??""}|${e.selector}|${Object.keys(e.declarations).join(",")}`;if(this.varKeys.has(t))return;this.varKeys.add(t),this.vars.push(e)}has(e){return this.rules.has(e)}get size(){return this.rules.size}clear(){this.rules.clear(),this.keyframes.clear(),this.vars=[],this.varKeys.clear(),this.insertionOrder.clear(),this.nextIndex=0,this.generation++}get currentGeneration(){return this.generation}toCSS(e=!1){let t=e?"":`
|
|
384
|
+
`,r=[];for(let i of this.vars)r.push(ex(i,e));for(let i of this.keyframes.values())r.push(i.css);let n=[...this.rules.values()].sort((i,o)=>{if(i.priority!==o.priority)return i.priority-o.priority;return(this.insertionOrder.get(i.className)??0)-(this.insertionOrder.get(o.className)??0)});for(let i of n)r.push(Q0(i,e));return r.join(t)}}function Z0(e,t){let r=cc(e.property),n=t?"":" ";return e.values.map((i)=>`${r}:${n}${i}`).join(t?";":"; ")}function Q0(e,t){let r=e.conditions.filter((s)=>s.startsWith("@")),n=e.conditions.filter((s)=>!s.startsWith("@")),i=`.${e.className}`;for(let s of n)i=s.includes("&")?s.replace(/&/g,i):`${i}${s}`;let o=`${i}${t?"":" "}{${t?"":" "}${Z0(e,t)}${t?"":" "}}`;return fc(o,r,t)}function ex(e,t){let r=t?"":" ",n=Object.entries(e.declarations).map(([o,s])=>`${o}:${r}${s}`).join(t?";":"; "),i=`${e.selector}${t?"":" "}{${r}${n}${r}}`;return fc(i,e.atRule?[e.atRule]:[],t)}function fc(e,t,r){let n=e;for(let i=t.length-1;i>=0;i--)n=`${t[i]}${r?"":" "}{${r?"":" "}${n}${r?"":" "}}`;return n}var Ii=new uc;function dc(e=!1){return Ii.toCSS(e)}function hc(){Ii.clear()}function gc(){return Ii.currentGeneration}async function mc(e){try{await import(`${e}?mtime=${rx(e)}&gen=${gc()}`)}catch(t){throw Error(`Failed to evaluate style module ${e}: ${t.message}`,{cause:t})}}function rx(e){try{return tx(e).mtimeMs}catch{return 0}}async function pc(e,t={}){let r=t.cwd??process.cwd(),n=new Set,i=Array.from({length:e.length},()=>!1);await Promise.all(e.map(async(s,c)=>{try{let a=new ix(s);for await(let l of a.scan(r))i[c]=!0,n.add(nx(r,l))}catch{}}));let o=[...n].sort();for(let s of o)await mc(s);return{css:dc(t.minify??!1),modules:o,unmatchedPatterns:e.filter((s,c)=>!i[c])}}function ox(e){let t=0;for(let r=0;r<e.length;r++){let n=e.charCodeAt(r);t=(t<<5)-t+n,t=t&t}return Math.abs(t).toString(36)}function sx(e,t={}){let r=t.trigger||":tc:",n=new Map,i=/(?:class|className)=["']([^"']*)["']/g,o;while((o=i.exec(e))!==null){let s=o[1];if(s.trim().startsWith(r)){let c=s.replace(r,"").trim().split(/\s+/).filter(Boolean);if(c.length>0){let a=c.sort().join(" ");if(!n.has(a))n.set(a,c)}}}return n}function ax(e,t,r={}){let n=r.trigger||":tc:",i=e,o=/(?:class|className)=["']([^"']*)["']/g,s,c=[];while((s=o.exec(e))!==null){let a=s[1];if(a.trim().startsWith(n)){let u=a.replace(n,"").trim().split(/\s+/).filter(Boolean).sort().join(" "),f=t.get(u);if(f){let d=s[0].startsWith("class=")?"class":"className",h=s[0].includes('"')?'"':"'",m=`${d}=${h}${f}${h}`;c.push({start:s.index,end:s.index+s[0].length,replacement:m})}}}for(let a=c.length-1;a>=0;a--){let{start:l,end:u,replacement:f}=c[a];i=i.substring(0,l)+f+i.substring(u)}return i}function lx(e,t={}){let r=t.classPrefix||"tc-",n=t.hashFn||ox,i=new Map;for(let[o]of e){let s=n(o),c=`${r}${s}`;i.set(o,c)}return i}class Pi{compiledClasses=new Map;classNameMap=new Map;options;constructor(e={}){this.options={trigger:":tc:",classPrefix:"tc-",layer:"shortcuts",...e}}processFile(e){let t=sx(e,this.options);if(t.size===0)return{content:e,hasChanges:!1};let r=!1;for(let[i,o]of t)if(!this.compiledClasses.has(i))this.compiledClasses.set(i,o),r=!0;if(r||this.classNameMap.size!==this.compiledClasses.size)this.classNameMap=lx(this.compiledClasses,this.options);let n=ax(e,this.classNameMap,this.options);return{content:n,hasChanges:n!==e}}getCompiledClasses(){let e=new Map;for(let[t,r]of this.compiledClasses){let n=this.classNameMap.get(t);if(n)e.set(t,{className:n,utilities:r})}return e}generateCSS(e,t){let r=this.getCompiledClasses(),n="";for(let[,{className:i,utilities:o}]of r){for(let c of o)t.generate(c);let s=t.toCSS(!1);n+=`
|
|
385
385
|
/* Compiled class: ${i} */
|
|
386
386
|
`,n+=`/* Original utilities: ${o.join(" ")} */
|
|
387
|
-
`}return n}reset(){this.compiledClasses.clear(),this.classNameMap.clear()}getStats(){let e=0;for(let[,t]of this.compiledClasses)e+=t.length;return{totalGroups:this.compiledClasses.size,totalUtilities:e,averageUtilitiesPerGroup:this.compiledClasses.size>0?e/this.compiledClasses.size:0}}}async function
|
|
388
|
-
`)+f.css;s.push(...f.unmatchedPatterns)}let u=performance.now()-t;return{css:a,classes:i,duration:u,compiledClasses:r?.getCompiledClasses(),transformedFiles:o,unmatchedPatterns:s,styleModules:l}}async function
|
|
387
|
+
`}return n}reset(){this.compiledClasses.clear(),this.classNameMap.clear()}getStats(){let e=0;for(let[,t]of this.compiledClasses)e+=t.length;return{totalGroups:this.compiledClasses.size,totalUtilities:e,averageUtilitiesPerGroup:this.compiledClasses.size>0?e/this.compiledClasses.size:0}}}async function _i(e){let t=performance.now(),r=e.compileClass?.enabled?new Pi({trigger:e.compileClass.trigger,classPrefix:e.compileClass.classPrefix,layer:e.compileClass.layer}):null,n=new Oi(e.content,r,{attributify:e.attributify,bracketSyntax:e.bracketSyntax,codeStrings:e.codeStrings}),{classes:i,transformedFiles:o,unmatchedPatterns:s}=await n.scan();for(let f of e.safelist)if(typeof f==="string")i.add(f);else console.warn(`\u26A0\uFE0F Ignoring non-string safelist entry (patterns are not supported): ${JSON.stringify(f)}`);let c=new Ni(e);for(let f of i)c.generate(f);if(r){let f=r.getCompiledClasses();for(let[,{className:d,utilities:h}]of f)c.generateCompiledClass(d,h)}let a=c.toCSS(e.includePreflight!==!1,e.minify),l;if(e.styles&&e.styles.length>0){hc();let f=await pc(e.styles,{minify:e.minify});if(l=f.modules,f.css)a+=(e.minify?"":`
|
|
388
|
+
`)+f.css;s.push(...f.unmatchedPatterns)}let u=performance.now()-t;return{css:a,classes:i,duration:u,compiledClasses:r?.getCompiledClasses(),transformedFiles:o,unmatchedPatterns:s,styleModules:l}}async function cx(e,t){await Bun.write(t,e)}async function ux(e){let t=Array.from(e.entries()).map(([r,n])=>Bun.write(r,n));await Promise.all(t)}async function yc(e){let t=await _i(e);if(await cx(t.css,e.output),t.transformedFiles&&t.transformedFiles.size>0)await ux(t.transformedFiles);return t}var Ce=new on("cssx");async function Jr(e){if(e){let t=Li(ye.cwd(),e);if(!Be(t))console.error(`\u274C Config file not found: ${t}`),ye.exit(1);try{let r=await import(t);return{...di,...r.default||r}}catch(r){console.error(`\u274C Failed to load config file: ${t}`),console.error(r),ye.exit(1)}}return ra()}function mx(e){if(e)return Li(ye.cwd(),e);for(let t of["css.config.ts","css.config.js","css.config.mjs"]){let r=Li(ye.cwd(),t);if(Be(r))return r}return null}function Mi(e,t){return{...e,output:t.output||e.output,minify:t.minify??e.minify,content:t.content?[t.content]:e.content,verbose:t.verbose??e.verbose,includePreflight:t.noPreflight===!0||t.preflight===!1?!1:e.includePreflight}}async function Yr(e,t){let r=t.verbose??e.verbose??!1;try{if(console.log(r?"\uD83D\uDE80 Building CSS (verbose mode)...":"\uD83D\uDE80 Building CSS..."),r)console.log(`\uD83D\uDCC2 Content patterns: ${e.content.join(", ")}`),console.log(`\uD83D\uDCDD Output: ${e.output}`),console.log(`\uD83D\uDDDC\uFE0F Minify: ${e.minify?"Yes":"No"}`);let i=await yc(e);if(i.unmatchedPatterns&&i.unmatchedPatterns.length>0)for(let o of i.unmatchedPatterns)console.warn(`\u26A0\uFE0F Content pattern matched no files: ${o}`);if(console.log(`\u2705 Built ${i.classes.size} classes in ${i.duration.toFixed(2)}ms`),console.log(`\uD83D\uDCDD Output: ${e.output}`),i.compiledClasses&&i.compiledClasses.size>0){if(console.log(`\uD83D\uDD28 Compiled ${i.compiledClasses.size} class groups`),i.transformedFiles)console.log(`\uD83D\uDCDD Transformed ${i.transformedFiles.size} files`);if(r){console.log(`
|
|
389
389
|
\uD83D\uDCE6 Compiled classes:`);for(let[,{className:o,utilities:s}]of i.compiledClasses)console.log(` ${o} \u2190 ${s.join(" ")}`)}}if(r&&i.classes.size>0){let o=Array.from(i.classes).sort();console.log(`
|
|
390
|
-
\uD83D\uDCCB Classes found (${i.classes.size}):`),o.forEach((s)=>console.log(` - ${s}`))}if(Be(e.output)){let s=(Bun.file(e.output).size/1024).toFixed(2);console.log(`\uD83D\uDCE6 File size: ${s} KB`)}}catch(n){if(console.error("\u274C Build failed:",n),r&&n instanceof Error)console.error(n.stack);ye.exit(1)}}function
|
|
391
|
-
\u2699\uFE0F ${n} changed, rebuilding with fresh config...`),await
|
|
392
|
-
\uD83D\uDCDD ${c} changed, rebuilding...`),await
|
|
393
|
-
\uD83D\uDC40 Watching: ${Array.from(i).join(", ")}`)}
|
|
390
|
+
\uD83D\uDCCB Classes found (${i.classes.size}):`),o.forEach((s)=>console.log(` - ${s}`))}if(Be(e.output)){let s=(Bun.file(e.output).size/1024).toFixed(2);console.log(`\uD83D\uDCE6 File size: ${s} KB`)}}catch(n){if(console.error("\u274C Build failed:",n),r&&n instanceof Error)console.error(n.stack);ye.exit(1)}}function xc(e,t){console.log("\uD83D\uDC40 Watching for changes...");let r={current:e},n=mx(t.config);if(n)try{bc(n,async()=>{try{let c=await import(`${n}?t=${Date.now()}`);r.current=Mi({...di,...c.default||c},t),console.log(`
|
|
391
|
+
\u2699\uFE0F ${n} changed, rebuilding with fresh config...`),await Yr(r.current,t)}catch(c){console.warn("\u26A0\uFE0F Failed to reload config:",c instanceof Error?c.message:c)}})}catch{}let i=new Set;for(let c of e.content){let a=c.search(/[*?[{]/),l=a===-1?c:c.slice(0,a);if(a!==-1||!Be(l)||!fx(l).isDirectory())l=l.slice(0,l.lastIndexOf("/")+1)||".";while(l!=="."&&l!=="/"&&!Be(l)){let u=hx(l);if(u===l)break;l=u}if(Be(l))i.add(l);else console.warn(`\u26A0\uFE0F Skipping watch for missing path: ${c}`)}let o=null,s=(c)=>{if(o)clearTimeout(o);o=setTimeout(async()=>{o=null,console.log(`
|
|
392
|
+
\uD83D\uDCDD ${c} changed, rebuilding...`),await Yr(r.current,t)},50)};for(let c of i)try{bc(c,{recursive:!0},(a,l)=>{if(l&&/\.(?:html|js|ts|jsx|tsx|stx)$/.test(l))s(l)})}catch(a){console.warn(`\u26A0\uFE0F Could not watch ${c}:`,a instanceof Error?a.message:a)}console.log(`
|
|
393
|
+
\uD83D\uDC40 Watching: ${Array.from(i).join(", ")}`)}Ce.command("build","Build CSS from content files").option("--output <path>","Output CSS file path").option("--minify","Minify CSS output").option("--watch","Watch for file changes").option("--content <pattern>","Content file pattern (can override config)").option("--config <path>","Path to config file").option("--verbose","Show detailed output").option("--no-preflight","Skip preflight CSS").example("cssx build").example("cssx build --output ./dist/styles.css").example("cssx build --minify --watch").example("cssx build --verbose").example("cssx build --config ./custom.config.ts").action(async(e)=>{let t=await Jr(e.config),r=Mi(t,e);if(await Yr(r,e),e.watch||r.watch)xc(r,e)});Ce.command("watch","Build and watch for changes").option("--output <path>","Output CSS file path").option("--minify","Minify CSS output").option("--content <pattern>","Content file pattern").option("--config <path>","Path to config file").option("--verbose","Show detailed output").example("cssx watch").example("cssx watch --output ./dist/styles.css").example("cssx watch --verbose").action(async(e)=>{let t=await Jr(e.config),r=Mi(t,e);await Yr(r,e),xc(r,e)});Ce.command("init","Create a css.config.ts file").option("--force","Overwrite existing config file").example("cssx init").example("cssx init --force").action(async(e)=>{if(Be("./css.config.ts")&&!e.force)console.error("\u274C Config file already exists. Use --force to overwrite."),ye.exit(1);let r=`import type { CssOptions } from '@stacksjs/ts-css/engine'
|
|
394
394
|
|
|
395
395
|
const config = {
|
|
396
396
|
content: ['./src/**/*.{html,js,ts,jsx,tsx,stx}'],
|
|
@@ -401,7 +401,7 @@ const config = {
|
|
|
401
401
|
|
|
402
402
|
export default config
|
|
403
403
|
`;try{await Bun.write("./css.config.ts",r),console.log("\u2705 Created css.config.ts"),console.log(`
|
|
404
|
-
Next steps:`),console.log(" 1. Update the content paths in css.config.ts"),console.log(" 2. Run: cssx build")}catch(n){console.error("\u274C Failed to create config file:",n),ye.exit(1)}})
|
|
405
|
-
`);let r=await
|
|
404
|
+
Next steps:`),console.log(" 1. Update the content paths in css.config.ts"),console.log(" 2. Run: cssx build")}catch(n){console.error("\u274C Failed to create config file:",n),ye.exit(1)}});Ce.command("analyze","Analyze utility class usage").option("--config <path>","Path to config file").option("--verbose","Show detailed output").option("--json","Output as JSON").option("--top <n>","Show top N most used classes",{default:10}).example("cssx analyze").example("cssx analyze --top 20").example("cssx analyze --json").action(async(e)=>{try{let t=await Jr(e.config);if(!e.json)console.log(`\uD83D\uDD0D Analyzing utility classes...
|
|
405
|
+
`);let r=await _i(t),n=new Map;for(let c of r.classes)n.set(c,0);for(let c of t.content){let a=new gx(c);for await(let l of a.scan(".")){let u;try{u=await Bun.file(l).text()}catch{continue}for(let f of r.classes){let d=u.indexOf(f);while(d!==-1)n.set(f,n.get(f)+1),d=u.indexOf(f,d+f.length)}}}let i=(c)=>{let a=c,l=a.indexOf("["),u=a.lastIndexOf(":",l===-1?a.length:l);if(u!==-1)a=a.slice(u+1);if(a.startsWith("!"))a=a.slice(1);if(a.endsWith("!"))a=a.slice(0,-1);if(a.startsWith("-"))a=a.slice(1);if(a.startsWith("["))return"arbitrary";return a.split("-")[0]||"other"},o=new Map;for(let c of r.classes){let a=i(c);if(!o.has(a))o.set(a,[]);o.get(a).push(c)}let s={totalClasses:r.classes.size,buildTime:r.duration,outputSize:Buffer.byteLength(r.css),utilityGroups:Object.fromEntries(Array.from(o.entries()).map(([c,a])=>[c,a.length]).sort((c,a)=>a[1]-c[1])),topClasses:[...n.entries()].sort((c,a)=>a[1]-c[1]).slice(0,e.top||10).map(([c,a])=>({class:c,count:a}))};if(e.json)console.log(JSON.stringify(s,null,2));else{console.log(`\uD83D\uDCCA Total classes: ${s.totalClasses}`),console.log(`\u23F1\uFE0F Build time: ${s.buildTime.toFixed(2)}ms`),console.log(`\uD83D\uDCE6 Output size: ${(s.outputSize/1024).toFixed(2)} KB
|
|
406
406
|
`),console.log(`\uD83C\uDFF7\uFE0F Utility groups (top ${e.top}):`);let c=Object.entries(s.utilityGroups).slice(0,e.top||10);for(let[a,l]of c)console.log(` ${a.padEnd(20)} ${l} classes`);if(e.verbose){console.log(`
|
|
407
|
-
\uD83D\uDCCB All classes:`);for(let a of Array.from(r.classes).sort())console.log(` - ${a}`)}}}catch(t){console.error("\u274C Analysis failed:",t),ye.exit(1)}})
|
|
407
|
+
\uD83D\uDCCB All classes:`);for(let a of Array.from(r.classes).sort())console.log(` - ${a}`)}}}catch(t){console.error("\u274C Analysis failed:",t),ye.exit(1)}});Ce.command("clean","Remove the output CSS file").option("--config <path>","Path to config file").option("--output <path>","Output CSS file path (defaults to the config output)").example("cssx clean").action(async(e)=>{try{let t=await Jr(e.config);if(e.output)t.output=e.output;if(!Be(t.output)){console.log("\u2139\uFE0F Output file does not exist");return}await dx(t.output),console.log(`\u2705 Removed ${t.output}`)}catch(t){console.error("\u274C Failed to remove output file:",t),ye.exit(1)}});Ce.command("preflight","Generate preflight CSS only").option("--output <path>","Output CSS file path",{default:"./preflight.css"}).example("cssx preflight").example("cssx preflight --output ./reset.css").action(async(e)=>{try{let t=e.output||"./preflight.css",r=Xt.getCSS();await Bun.write(t,r),console.log("\u2705 Generated preflight CSS"),console.log(`\uD83D\uDCDD Output: ${t}`);let i=(Bun.file(t).size/1024).toFixed(2);console.log(`\uD83D\uDCE6 File size: ${i} KB`)}catch(t){console.error("\u274C Failed to generate preflight CSS:",t),ye.exit(1)}});Ce.command("version","Show the version of ts-css").action(()=>{console.log(sn)});Ce.version(sn);Ce.help();Ce.parse();
|