@stacksjs/bunpress 0.1.1 → 0.1.3

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.
@@ -1,22 +1,22 @@
1
1
  // @bun
2
- var ce=import.meta.require;var{Glob:fr,YAML:fs}=globalThis.Bun;import{stat as br}from"fs/promises";import{join as kr}from"path";import st from"process";import{existsSync as Pt,statSync as en}from"fs";import{existsSync as Zr,mkdirSync as Ds,readdirSync as Hs,writeFileSync as Vs}from"fs";import{homedir as le}from"os";import{dirname as ti,resolve as H}from"path";import Ce from"process";import{join as xr,relative as Tr,resolve as tn}from"path";import Ge from"process";import{existsSync as _n,mkdirSync as si,readdirSync as ii,writeFileSync as ci}from"fs";import{homedir as dt}from"os";import{dirname as li,resolve as W}from"path";import $e from"process";import{join as Rr,relative as Lr,resolve as nn}from"path";import Oe from"process";import{existsSync as jn,mkdirSync as wi,readdirSync as fi,writeFileSync as bi}from"fs";import{dirname as gi,resolve as Ye}from"path";import jt from"process";import{Buffer as de}from"buffer";import{createCipheriv as Br,createDecipheriv as Sr,randomBytes as mt}from"crypto";import{closeSync as lt,createReadStream as rn,createWriteStream as Ur,existsSync as pt,fsyncSync as on,openSync as an,writeFileSync as Gr}from"fs";import{access as Or,constants as sn,mkdir as Yr,readdir as Ee,rename as cn,stat as pe,unlink as ze,writeFile as ut}from"fs/promises";import{join as ue}from"path";import X from"process";import{pipeline as Xr}from"stream/promises";import{createGzip as dn}from"zlib";import ye from"process";import ae from"process";import{Buffer as re}from"buffer";import{createCipheriv as Fr,createDecipheriv as Ir,randomBytes as yt}from"crypto";import{closeSync as ht,createReadStream as mn,createWriteStream as Jr,existsSync as Ne,fsyncSync as ln,openSync as pn,writeFileSync as Cr}from"fs";import{access as Qr,constants as un,mkdir as Wr,readdir as Ze,rename as yn,stat as he,unlink as xe,writeFile as wt}from"fs/promises";import{isAbsolute as vr,join as we,resolve as Mr}from"path";import j from"process";import{pipeline as Kr}from"stream/promises";import{createGzip as hn}from"zlib";import fe from"process";import se from"process";import Re from"process";import{existsSync as Le}from"fs";import{resolve as At}from"path";import{existsSync as jo}from"fs";class $n{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 n=t?`:${t}`:"";return`${this.options.keyPrefix}${e}${n}`}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(([,n],[,r])=>n.timestamp.getTime()-r.timestamp.getTime()),t=e.length-this.options.maxSize+1;for(let n=0;n<t;n++)this.cache.delete(e[n][0])}set(e,t,n,r){if(!this.options.enabled)return;let o=this.generateKey(e,n),a=r??this.options.ttl,s=this.estimateSize(t);this.cache.set(o,{value:t,timestamp:new Date,ttl:a,hits:0,size:s}),this.evictIfNeeded()}get(e,t){if(!this.options.enabled){this.totalMisses++;return}let n=this.generateKey(e,t),r=this.cache.get(n);if(!r){this.totalMisses++;return}if(this.isExpired(r)){this.cache.delete(n),this.totalMisses++;return}return r.hits++,this.totalHits++,r.value}isFileModified(e,t){try{if(!Pt(e))return!0;return en(e).mtime>t}catch{return!0}}getWithFileCheck(e,t){let n=this.get(e,t);if(!n)return;if(this.isFileModified(t,n.fileTimestamp)){this.delete(e,t);return}return n.value}setWithFileCheck(e,t,n,r){try{let o=Pt(n)?en(n):null,a=o?o.mtime:new Date;this.set(e,{value:t,fileTimestamp:a},n,r)}catch{this.set(e,t,n,r)}}delete(e,t){let n=this.generateKey(e,t);return this.cache.delete(n)}clear(){this.cache.clear(),this.totalHits=0,this.totalMisses=0}cleanup(){let e=0;for(let[t,n]of this.cache.entries())if(this.isExpired(n))this.cache.delete(t),e++;return e}getStats(){let e=Array.from(this.cache.values()),t=e.reduce((r,o)=>r+o.size,0),n=e.map((r)=>r.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:n[0],newestEntry:n[n.length-1]}}export(){let e={};for(let[t,n]of this.cache.entries())e[t]={value:n.value,timestamp:n.timestamp.toISOString(),ttl:n.ttl,hits:n.hits,size:n.size};return e}import(e){this.cache.clear();for(let[t,n]of Object.entries(e))if(typeof n==="object"&&n!==null){let r=n;this.cache.set(t,{value:r.value,timestamp:new Date(r.timestamp),ttl:r.ttl,hits:r.hits,size:r.size})}}}class qn{metrics=[];maxMetrics=1000;async track(e,t,n={}){let r=performance.now(),o=new Date;try{let a=await t(),s=performance.now()-r;return this.recordMetric({operation:e,duration:s,timestamp:o,...n}),a}catch(a){let s=performance.now()-r;throw this.recordMetric({operation:`${e}:error`,duration:s,timestamp:o,...n}),a}}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((o)=>o.operation===e):this.metrics;if(t.length===0)return{count:0,averageDuration:0,minDuration:0,maxDuration:0,totalDuration:0,recentMetrics:[]};let n=t.map((o)=>o.duration),r=n.reduce((o,a)=>o+a,0);return{count:t.length,averageDuration:r/t.length,minDuration:Math.min(...n),maxDuration:Math.max(...n),totalDuration:r,recentMetrics:t.slice(-10)}}getAllMetrics(){return[...this.metrics]}clearMetrics(){this.metrics=[]}getSlowOperations(e){return this.metrics.filter((t)=>t.duration>e)}}var Ue=new $n,_t=new qn;function Et(e,t){if(Array.isArray(t)&&Array.isArray(e)&&t.length===2&&e.length===2&&T(t[0])&&"id"in t[0]&&t[0].id===3&&T(t[1])&&"id"in t[1]&&t[1].id===4)return t;if(T(t)&&T(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(T(e)&&"arr"in e&&Array.isArray(e.arr)&&T(t)&&"arr"in t&&Array.isArray(t.arr))return t;if(t.length>0&&e.length>0&&T(t[0])&&T(e[0])){let r=[...t];for(let o of e)if(T(o)&&"name"in o){if(!r.find((s)=>T(s)&&("name"in s)&&s.name===o.name))r.push(o)}else if(T(o)&&"path"in o){if(!r.find((s)=>T(s)&&("path"in s)&&s.path===o.path))r.push(o)}else if(!r.some((a)=>Xe(a,o)))r.push(o);return r}if(t.every((r)=>typeof r==="string")&&e.every((r)=>typeof r==="string")){let r=[...t];for(let o of e)if(!r.includes(o))r.push(o);return r}return t}if(!T(t)||!T(e))return t;let n={...e};for(let r in t)if(Object.prototype.hasOwnProperty.call(t,r)){let o=t[r];if(o===null||o===void 0)continue;else if(T(o)&&T(n[r]))n[r]=Et(n[r],o);else if(Array.isArray(o)&&Array.isArray(n[r]))if(o.length>0&&n[r].length>0&&T(o[0])&&T(n[r][0])){let a=[...o];for(let s of n[r])if(T(s)&&"name"in s){if(!a.find((i)=>T(i)&&("name"in i)&&i.name===s.name))a.push(s)}else if(T(s)&&"path"in s){if(!a.find((i)=>T(i)&&("path"in i)&&i.path===s.path))a.push(s)}else if(!a.some((c)=>Xe(c,s)))a.push(s);n[r]=a}else if(o.every((a)=>typeof a==="string")&&n[r].every((a)=>typeof a==="string")){let a=[...o];for(let s of n[r])if(!a.includes(s))a.push(s);n[r]=a}else n[r]=o;else n[r]=o}return n}function Xe(e,t){if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!Xe(e[n],t[n]))return!1;return!0}if(T(e)&&T(t)){let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let o of n){if(!Object.prototype.hasOwnProperty.call(t,o))return!1;if(!Xe(e[o],t[o]))return!1}return!0}return!1}function T(e){return Boolean(e&&typeof e==="object"&&!Array.isArray(e))}async function Dr(e,t){if(!jn(e))return null;try{let n=await import(e),r=n.default||n;if(typeof r!=="object"||r===null||Array.isArray(r))return null;try{return Et(t,r)}catch{return null}}catch{return null}}async function Hr({name:e="",cwd:t,defaultConfig:n}){let r=t||jt.cwd(),o=[".ts",".js",".mjs",".cjs",".json"],a=[`${e}.config`,`.${e}.config`,e,`.${e}`];for(let s of a)for(let c of o){let i=Ye(r,`${s}${c}`),d=await Dr(i,n);if(d!==null)return d}try{let s=Ye(r,"package.json");if(jn(s)){let i=(await import(s))[e];if(i&&typeof i==="object"&&!Array.isArray(i))try{return Et(n,i)}catch{}}}catch{}return n}var Ii=Ye(jt.cwd(),"config"),Ji=Ye(jt.cwd(),"src/generated");function Vr(e,t={}){let n=Oe.cwd();while(n.includes("storage"))n=nn(n,"..");let r=nn(n,e||"");if(t?.relative)return Lr(Oe.cwd(),r);return r}var Pr=Oe.env.CLARITY_LOG_DIR||Rr(Vr(),"logs"),ft={level:"info",defaultName:"clarity",timestamp:!0,colors:!0,format:"text",maxLogSize:10485760,logDatePattern:"YYYY-MM-DD",logDirectory:Pr,rotation:{frequency:"daily",maxSize:10485760,maxFiles:5,compress:!1,rotateHour:0,rotateMinute:0,rotateDayOfWeek:0,rotateDayOfMonth:1,encrypt:!1},verbose:!1};async function eo(){try{let e=await Hr({name:"clarity",defaultConfig:ft,cwd:Oe.cwd(),endpoint:"",headers:{}});return{...ft,...e}}catch{return ft}}var wn=await eo();function B(){if(ae.env.NODE_ENV==="test"||ae.env.BUN_ENV==="test")return!1;return typeof window<"u"}async function to(){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 En{async format(e){let t=await to(),n=await this.getMetadata(t);return JSON.stringify({timestamp:e.timestamp.toISOString(),level:e.level,name:e.name,message:e.message,metadata:n})}async getMetadata(e){if(e){let{hostname:t}=await import("os");return{pid:ye.pid,hostname:t(),environment:ye.env.NODE_ENV||"development",platform:ye.platform,version:ye.version}}return{userAgent:navigator.userAgent,hostname:window.location.hostname||"browser",environment:ye.env.NODE_ENV||ye.env.BUN_ENV||"development",viewport:{width:window.innerWidth,height:window.innerHeight},language:navigator.language}}}var J={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"},x=J,Ci=J.red,no=J.green,Qi=J.yellow,ro=J.blue,Wi=J.magenta,vi=J.cyan,fn=J.white,Mi=J.gray,oo=J.bgRed,ao=J.bgYellow,bn=J.bold,Ki=J.dim,Di=J.italic,Hi=J.underline,Vi=J.reset,bt={activationLevel:"error",bufferSize:50,flushOnDeactivation:!0,stopBuffering:!1},so={debug:"\uD83D\uDD0D",info:ro("\u2139"),success:no("\u2713"),warning:ao(fn(bn(" WARN "))),error:oo(fn(bn(" ERROR ")))};class Qe{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 En,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??X.env.APP_ENV??"local",this.fingersCrossedConfig=this.initializeFingersCrossedConfig(t);let n={...t},r=t.timestamp!==void 0;if(r)delete n.timestamp;if(this.config={...this.config,...n,timestamp:r||this.config.timestamp},this.currentLogFile=this.generateLogFilename(),this.encryptionKeys=new Map,this.validateEncryptionConfig()){this.setupRotation();let o=this.generateKeyId(),a=this.generateKey();this.currentKeyId=o,this.keys.set(o,a),this.encryptionKeys.set(o,{key:a,createdAt:new Date}),this.setupKeyRotation()}}initializeFingersCrossedConfig(e){if(!e.fingersCrossedEnabled&&e.fingersCrossed)return{...bt,...e.fingersCrossed};if(!e.fingersCrossedEnabled)return null;if(!e.fingersCrossed)return{...bt};return{...bt,...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},n={...t,...Object.fromEntries(Object.entries(e).filter(([,r])=>r!==void 0))};if(!n.level||!["debug","info","success","warning","error"].includes(n.level))n.level=t.level;return n}async writeToFile(e){let n=(async()=>{let o,a=0,s=3,c=1000;while(a<s)try{try{try{await Or(this.config.logDirectory,sn.F_OK|sn.W_OK)}catch(d){if(d instanceof Error&&"code"in d)if(d.code==="ENOENT")await Yr(this.config.logDirectory,{recursive:!0,mode:493});else if(d.code==="EACCES")throw Error(`No write permission for log directory: ${this.config.logDirectory}`);else throw d;else throw d}}catch(d){throw console.error("Debug: [writeToFile] Failed to create log directory:",d),d}let i=this.validateEncryptionConfig()?(await this.encrypt(e)).encrypted:de.from(e);try{if(!pt(this.currentLogFile))await ut(this.currentLogFile,"",{mode:420});if(o=an(this.currentLogFile,"a",420),Gr(o,i,{flag:"a"}),on(o),o!==void 0)lt(o),o=void 0;if((await pe(this.currentLogFile)).size===0){if(await ut(this.currentLogFile,i,{flag:"w",mode:420}),(await pe(this.currentLogFile)).size===0)throw Error("File exists but is empty after retry write")}return}catch(d){let m=d;if(m.code&&["ENETDOWN","ENETUNREACH","ENOTFOUND","ETIMEDOUT"].includes(m.code)){if(a<s-1){let l=typeof m.message==="string"?m.message:"Unknown error";console.error(`Network error during write attempt ${a+1}/${s}:`,l);let u=c*2**a;await new Promise((p)=>setTimeout(p,u)),a++;continue}}if(m?.code&&["ENOSPC","EDQUOT"].includes(m.code))throw Error(`Disk quota exceeded or no space left on device: ${m.message}`);throw console.error("Debug: [writeToFile] Error writing to file:",m),m}finally{if(o!==void 0)try{lt(o)}catch(d){console.error("Debug: [writeToFile] Error closing file descriptor:",d)}}}catch(i){if(a===s-1){let m=i,l=typeof m.message==="string"?m.message:"Unknown error";throw console.error("Debug: [writeToFile] Max retries reached. Final error:",l),i}a++;let d=c*2**(a-1);await new Promise((m)=>setTimeout(m,d))}})();this.pendingOperations.push(n);let r=this.pendingOperations.length-1;try{await n}catch(o){throw console.error("Debug: [writeToFile] Error in operation:",o),o}finally{this.pendingOperations.splice(r,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 ue(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 ue(this.config.logDirectory,`${this.name}.log`);let e=new Date().toISOString().split("T")[0];return ue(this.config.logDirectory,`${this.name}-${e}.log`)}setupRotation(){if(B())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 n=typeof t.interval==="number"?t.interval:60,r=Math.max(n,60)*1000;this.keyRotationTimeout=setInterval(()=>{this.rotateKeys().catch((o)=>{console.error("Error rotating keys:",o)})},r)}async rotateKeys(){if(!this.validateEncryptionConfig()){console.error("Invalid encryption configuration detected during key rotation");return}let t=this.config.rotation.keyRotation,n=this.generateKeyId(),r=this.generateKey();this.currentKeyId=n,this.keys.set(n,r),this.encryptionKeys.set(n,{key:r,createdAt:new Date});let o=Array.from(this.encryptionKeys.entries()).sort(([,c],[,i])=>i.createdAt.getTime()-c.createdAt.getTime()),a=typeof t.maxKeys==="number"?t.maxKeys:1,s=Math.max(1,a);if(o.length>s)for(let[c]of o.slice(s))this.encryptionKeys.delete(c),this.keys.delete(c)}generateKeyId(){return mt(16).toString("hex")}generateKey(){return mt(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(),n=mt(16),r=Br("aes-256-gcm",t,n),o=de.concat([r.update(e,"utf8"),r.final()]),a=r.getAuthTag();return{encrypted:de.concat([n,o,a]),iv:n}}async compressData(e){return new Promise((t,n)=>{let r=dn(),o=[];r.on("data",(a)=>o.push(a)),r.on("end",()=>t(de.from(de.concat(o)))),r.on("error",n),r.write(e),r.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(B())return;let e=await pe(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 n=this.currentLogFile,r=this.generateLogFilename();if(this.name.includes("rotation-load-test")||this.name==="failed-rotation-test"){let o=await Ee(this.config.logDirectory),a=o.filter((i)=>i.startsWith(this.name)&&/\.log\.\d+$/.test(i)).sort((i,d)=>{let m=Number.parseInt(i.match(/\.log\.(\d+)$/)?.[1]||"0");return Number.parseInt(d.match(/\.log\.(\d+)$/)?.[1]||"0")-m}),s=a.length>0?Number.parseInt(a[0].match(/\.log\.(\d+)$/)?.[1]||"0")+1:1,c=`${n}.${s}`;if(await pe(n).catch(()=>null))try{if(await cn(n,c),t.compress)try{let i=`${c}.gz`;await this.compressLogFile(c,i),await ze(c)}catch(i){console.error("Error compressing rotated file:",i)}if(a.length===0&&!o.some((i)=>i.endsWith(".log.1")))try{let i=`${n}.1`;await ut(i,"")}catch(i){console.error("Error creating backup file:",i)}}catch(i){console.error(`Error during rotation: ${i instanceof Error?i.message:String(i)}`)}}else{let o=new Date().toISOString().replace(/[:.]/g,"-"),a=n.replace(/\.log$/,`-${o}.log`);if(await pe(n).catch(()=>null))await cn(n,a)}if(this.currentLogFile=r,t.maxFiles){let a=(await Ee(this.config.logDirectory)).filter((s)=>s.startsWith(this.name)).sort((s,c)=>c.localeCompare(s));for(let s of a.slice(t.maxFiles))await ze(ue(this.config.logDirectory,s))}}}async compressLogFile(e,t){let n=rn(e),r=Ur(t),o=dn();await Xr(n,o,r)}async handleFingersCrossedBuffer(e,t){if(!this.fingersCrossedConfig)return;if(this.shouldActivateFingersCrossed(e)&&!this.isActivated){this.isActivated=!0;for(let n of this.logBuffer){let r=await this.formatter.format(n);await this.writeToFile(r),console.log(r)}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 n={timestamp:new Date,level:e,message:t,name:this.name};this.logBuffer.push(n)}}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()})),pt(this.currentLogFile))try{let e=an(this.currentLogFile,"r+");on(e),lt(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(!B()&&this.config.rotation&&typeof this.config.rotation!=="boolean"&&this.config.rotation.compress)try{let t=(await Ee(this.config.logDirectory)).filter((n)=>(n.includes("temp")||n.includes(".tmp"))&&n.includes(this.name));for(let n of t)try{await ze(ue(this.config.logDirectory,n))}catch(r){console.error(`Failed to delete temp file ${n}:`,r)}}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?x.gray(e.toLocaleTimeString()):e.toLocaleTimeString()}formatConsoleMessage(e){let{timestamp:t,icon:n="",tag:r="",message:o,level:a,showTimestamp:s=!0}=e,c=(p)=>p.replace(this.ANSI_PATTERN,"");if(!this.fancy){let p=[];if(s)p.push(t);if(a==="warning")p.push("WARN");else if(a==="error")p.push("ERROR");else if(n)p.push(n.replace(/[^\p{L}\p{N}\p{P}\p{Z}]/gu,""));if(r)p.push(r.replace(/[[\]]/g,""));return p.push(o),p.join(" ")}let i=X.stdout.columns||120,d="";if(a==="warning"||a==="error")d=`${n} ${o}`;else if(a==="info"||a==="success")d=`${n} ${r} ${o}`;else d=`${n} ${r} ${x.cyan(o)}`;if(!s)return d.trim();let m=c(d).trim().length,l=c(t).length,u=Math.max(1,i-2-m-l);return`${d.trim()}${" ".repeat(u)}${t}`}formatMessage(e,t){if(t.length===1&&Array.isArray(t[0]))return e.replace(/\{(\d+)\}/g,(a,s)=>{let c=Number.parseInt(s,10);return c<t[0].length?String(t[0][c]):a});let n=/%([sdijfo%])/g,r=0,o=e.replace(n,(a,s)=>{if(s==="%")return"%";if(r>=t.length)return a;let c=t[r++];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 a}});if(r<t.length)o+=` ${t.slice(r).map((a)=>typeof a==="object"?JSON.stringify(a,null,2):String(a)).join(" ")}`;return o}async log(e,t,...n){let r=new Date,o=this.formatConsoleTimestamp(r),a=this.formatFileTimestamp(r),s,c;if(t instanceof Error)s=t.message,c=t.stack;else s=this.formatMessage(t,n);if(this.fancy&&!B()){let d=so[e],m=this.options.showTags!==!1&&this.name?x.gray(this.formatTag(this.name)):"",l;switch(e){case"debug":l=this.formatConsoleMessage({timestamp:o,icon:d,tag:m,message:x.gray(s),level:e}),console.error(l);break;case"info":l=this.formatConsoleMessage({timestamp:o,icon:d,tag:m,message:s,level:e}),console.error(l);break;case"success":l=this.formatConsoleMessage({timestamp:o,icon:d,tag:m,message:x.green(s),level:e}),console.error(l);break;case"warning":l=this.formatConsoleMessage({timestamp:o,icon:d,tag:m,message:s,level:e}),console.warn(l);break;case"error":if(l=this.formatConsoleMessage({timestamp:o,icon:d,tag:m,message:s,level:e}),console.error(l),c){let u=c.split(`
3
- `);for(let p of u)if(p.trim()&&!p.includes(s))console.error(this.formatConsoleMessage({timestamp:o,message:x.gray(` ${p}`),level:e,showTimestamp:!1}))}break}}else if(!B()){if(console.error(`${a} ${this.environment}.${e.toUpperCase()}: ${s}`),c)console.error(c)}if(!this.shouldLog(e))return;let i=`${a} ${this.environment}.${e.toUpperCase()}: ${s}
2
+ var V=import.meta.require;var{Glob:kr,YAML:As}=globalThis.Bun;import{stat as gr}from"fs/promises";import{join as Ar}from"path";import it from"process";import{existsSync as tn,statSync as nn}from"fs";import{existsSync as Rr,mkdirSync as si,readdirSync as ii,writeFileSync as ci}from"fs";import{homedir as pe}from"os";import{dirname as mi,resolve as D}from"path";import We from"process";import{join as Br,relative as Ur,resolve as rn}from"path";import Se from"process";import{existsSync as zn,mkdirSync as wi,readdirSync as fi,writeFileSync as bi}from"fs";import{homedir as dt}from"os";import{dirname as Ai,resolve as M}from"path";import _e from"process";import{join as Gr,relative as Or,resolve as on}from"path";import Ye from"process";import{existsSync as En,mkdirSync as zi,readdirSync as Ei,writeFileSync as Ti}from"fs";import{dirname as Zi,resolve as Fe}from"path";import jt from"process";import{Buffer as de}from"buffer";import{createCipheriv as Sr,createDecipheriv as Yr,randomBytes as lt}from"crypto";import{closeSync as mt,createReadStream as an,createWriteStream as Fr,existsSync as pt,fsyncSync as sn,openSync as cn,writeFileSync as Ir}from"fs";import{access as Xr,constants as dn,mkdir as Jr,readdir as Ee,rename as ln,stat as ue,unlink as Te,writeFile as ut}from"fs/promises";import{join as ye}from"path";import I from"process";import{pipeline as Qr}from"stream/promises";import{createGzip as mn}from"zlib";import he from"process";import ae from"process";import{Buffer as re}from"buffer";import{createCipheriv as Wr,createDecipheriv as Cr,randomBytes as yt}from"crypto";import{closeSync as ht,createReadStream as pn,createWriteStream as Mr,existsSync as Ne,fsyncSync as un,openSync as yn,writeFileSync as vr}from"fs";import{access as Kr,constants as hn,mkdir as Dr,readdir as Ze,rename as wn,stat as we,unlink as xe,writeFile as wt}from"fs/promises";import{isAbsolute as Hr,join as fe,resolve as Vr}from"path";import _ from"process";import{pipeline as Pr}from"stream/promises";import{createGzip as fn}from"zlib";import be from"process";import se from"process";import Re from"process";import{existsSync as Be}from"fs";import{resolve as At}from"path";import{existsSync as No}from"fs";class _n{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 n=t?`:${t}`:"";return`${this.options.keyPrefix}${e}${n}`}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(([,n],[,r])=>n.timestamp.getTime()-r.timestamp.getTime()),t=e.length-this.options.maxSize+1;for(let n=0;n<t;n++)this.cache.delete(e[n][0])}set(e,t,n,r){if(!this.options.enabled)return;let o=this.generateKey(e,n),a=r??this.options.ttl,s=this.estimateSize(t);this.cache.set(o,{value:t,timestamp:new Date,ttl:a,hits:0,size:s}),this.evictIfNeeded()}get(e,t){if(!this.options.enabled){this.totalMisses++;return}let n=this.generateKey(e,t),r=this.cache.get(n);if(!r){this.totalMisses++;return}if(this.isExpired(r)){this.cache.delete(n),this.totalMisses++;return}return r.hits++,this.totalHits++,r.value}isFileModified(e,t){try{if(!tn(e))return!0;return nn(e).mtime>t}catch{return!0}}getWithFileCheck(e,t){let n=this.get(e,t);if(!n)return;if(this.isFileModified(t,n.fileTimestamp)){this.delete(e,t);return}return n.value}setWithFileCheck(e,t,n,r){try{let o=tn(n)?nn(n):null,a=o?o.mtime:new Date;this.set(e,{value:t,fileTimestamp:a},n,r)}catch{this.set(e,t,n,r)}}delete(e,t){let n=this.generateKey(e,t);return this.cache.delete(n)}clear(){this.cache.clear(),this.totalHits=0,this.totalMisses=0}cleanup(){let e=0;for(let[t,n]of this.cache.entries())if(this.isExpired(n))this.cache.delete(t),e++;return e}getStats(){let e=Array.from(this.cache.values()),t=e.reduce((r,o)=>r+o.size,0),n=e.map((r)=>r.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:n[0],newestEntry:n[n.length-1]}}export(){let e={};for(let[t,n]of this.cache.entries())e[t]={value:n.value,timestamp:n.timestamp.toISOString(),ttl:n.ttl,hits:n.hits,size:n.size};return e}import(e){this.cache.clear();for(let[t,n]of Object.entries(e))if(typeof n==="object"&&n!==null){let r=n;this.cache.set(t,{value:r.value,timestamp:new Date(r.timestamp),ttl:r.ttl,hits:r.hits,size:r.size})}}}class jn{metrics=[];maxMetrics=1000;async track(e,t,n={}){let r=performance.now(),o=new Date;try{let a=await t(),s=performance.now()-r;return this.recordMetric({operation:e,duration:s,timestamp:o,...n}),a}catch(a){let s=performance.now()-r;throw this.recordMetric({operation:`${e}:error`,duration:s,timestamp:o,...n}),a}}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((o)=>o.operation===e):this.metrics;if(t.length===0)return{count:0,averageDuration:0,minDuration:0,maxDuration:0,totalDuration:0,recentMetrics:[]};let n=t.map((o)=>o.duration),r=n.reduce((o,a)=>o+a,0);return{count:t.length,averageDuration:r/t.length,minDuration:Math.min(...n),maxDuration:Math.max(...n),totalDuration:r,recentMetrics:t.slice(-10)}}getAllMetrics(){return[...this.metrics]}clearMetrics(){this.metrics=[]}getSlowOperations(e){return this.metrics.filter((t)=>t.duration>e)}}var Oe=new _n,_t=new jn;function zt(e,t){if(Array.isArray(t)&&Array.isArray(e)&&t.length===2&&e.length===2&&N(t[0])&&"id"in t[0]&&t[0].id===3&&N(t[1])&&"id"in t[1]&&t[1].id===4)return t;if(N(t)&&N(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(N(e)&&"arr"in e&&Array.isArray(e.arr)&&N(t)&&"arr"in t&&Array.isArray(t.arr))return t;if(t.length>0&&e.length>0&&N(t[0])&&N(e[0])){let r=[...t];for(let o of e)if(N(o)&&"name"in o){if(!r.find((s)=>N(s)&&("name"in s)&&s.name===o.name))r.push(o)}else if(N(o)&&"path"in o){if(!r.find((s)=>N(s)&&("path"in s)&&s.path===o.path))r.push(o)}else if(!r.some((a)=>Ie(a,o)))r.push(o);return r}if(t.every((r)=>typeof r==="string")&&e.every((r)=>typeof r==="string")){let r=[...t];for(let o of e)if(!r.includes(o))r.push(o);return r}return t}if(!N(t)||!N(e))return t;let n={...e};for(let r in t)if(Object.prototype.hasOwnProperty.call(t,r)){let o=t[r];if(o===null||o===void 0)continue;else if(N(o)&&N(n[r]))n[r]=zt(n[r],o);else if(Array.isArray(o)&&Array.isArray(n[r]))if(o.length>0&&n[r].length>0&&N(o[0])&&N(n[r][0])){let a=[...o];for(let s of n[r])if(N(s)&&"name"in s){if(!a.find((i)=>N(i)&&("name"in i)&&i.name===s.name))a.push(s)}else if(N(s)&&"path"in s){if(!a.find((i)=>N(i)&&("path"in i)&&i.path===s.path))a.push(s)}else if(!a.some((c)=>Ie(c,s)))a.push(s);n[r]=a}else if(o.every((a)=>typeof a==="string")&&n[r].every((a)=>typeof a==="string")){let a=[...o];for(let s of n[r])if(!a.includes(s))a.push(s);n[r]=a}else n[r]=o;else n[r]=o}return n}function Ie(e,t){if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!Ie(e[n],t[n]))return!1;return!0}if(N(e)&&N(t)){let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let o of n){if(!Object.prototype.hasOwnProperty.call(t,o))return!1;if(!Ie(e[o],t[o]))return!1}return!0}return!1}function N(e){return Boolean(e&&typeof e==="object"&&!Array.isArray(e))}async function eo(e,t){if(!En(e))return null;try{let n=await import(e),r=n.default||n;if(typeof r!=="object"||r===null||Array.isArray(r))return null;try{return zt(t,r)}catch{return null}}catch{return null}}async function to({name:e="",cwd:t,defaultConfig:n}){let r=t||jt.cwd(),o=[".ts",".js",".mjs",".cjs",".json"],a=[`${e}.config`,`.${e}.config`,e,`.${e}`];for(let s of a)for(let c of o){let i=Fe(r,`${s}${c}`),d=await eo(i,n);if(d!==null)return d}try{let s=Fe(r,"package.json");if(En(s)){let i=(await import(s))[e];if(i&&typeof i==="object"&&!Array.isArray(i))try{return zt(n,i)}catch{}}}catch{}return n}var Vi=Fe(jt.cwd(),"config"),Pi=Fe(jt.cwd(),"src/generated");function no(e,t={}){let n=Ye.cwd();while(n.includes("storage"))n=on(n,"..");let r=on(n,e||"");if(t?.relative)return Or(Ye.cwd(),r);return r}var ro=Ye.env.CLARITY_LOG_DIR||Gr(no(),"logs"),ft={level:"info",defaultName:"clarity",timestamp:!0,colors:!0,format:"text",maxLogSize:10485760,logDatePattern:"YYYY-MM-DD",logDirectory:ro,rotation:{frequency:"daily",maxSize:10485760,maxFiles:5,compress:!1,rotateHour:0,rotateMinute:0,rotateDayOfWeek:0,rotateDayOfMonth:1,encrypt:!1},verbose:!1};async function oo(){try{let e=await to({name:"clarity",defaultConfig:ft,cwd:Ye.cwd(),endpoint:"",headers:{}});return{...ft,...e}}catch{return ft}}var bn=await oo();function L(){if(ae.env.NODE_ENV==="test"||ae.env.BUN_ENV==="test")return!1;return typeof window<"u"}async function ao(){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 Tn{async format(e){let t=await ao(),n=await this.getMetadata(t);return JSON.stringify({timestamp:e.timestamp.toISOString(),level:e.level,name:e.name,message:e.message,metadata:n})}async getMetadata(e){if(e){let{hostname:t}=await import("os");return{pid:he.pid,hostname:t(),environment:he.env.NODE_ENV||"development",platform:he.platform,version:he.version}}return{userAgent:navigator.userAgent,hostname:window.location.hostname||"browser",environment:he.env.NODE_ENV||he.env.BUN_ENV||"development",viewport:{width:window.innerWidth,height:window.innerHeight},language:navigator.language}}}var Q={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"},T=Q,ec=Q.red,so=Q.green,tc=Q.yellow,io=Q.blue,nc=Q.magenta,rc=Q.cyan,kn=Q.white,oc=Q.gray,co=Q.bgRed,lo=Q.bgYellow,gn=Q.bold,ac=Q.dim,sc=Q.italic,ic=Q.underline,cc=Q.reset,bt={activationLevel:"error",bufferSize:50,flushOnDeactivation:!0,stopBuffering:!1},mo={debug:"\uD83D\uDD0D",info:io("\u2139"),success:so("\u2713"),warning:lo(kn(gn(" WARN "))),error:co(kn(gn(" ERROR ")))};class Ce{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={...bn},this.options=this.normalizeOptions(t),this.formatter=this.options.formatter||new Tn,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??I.env.APP_ENV??"local",this.fingersCrossedConfig=this.initializeFingersCrossedConfig(t);let n={...t},r=t.timestamp!==void 0;if(r)delete n.timestamp;if(this.config={...this.config,...n,timestamp:r||this.config.timestamp},this.currentLogFile=this.generateLogFilename(),this.encryptionKeys=new Map,this.validateEncryptionConfig()){this.setupRotation();let o=this.generateKeyId(),a=this.generateKey();this.currentKeyId=o,this.keys.set(o,a),this.encryptionKeys.set(o,{key:a,createdAt:new Date}),this.setupKeyRotation()}}initializeFingersCrossedConfig(e){if(!e.fingersCrossedEnabled&&e.fingersCrossed)return{...bt,...e.fingersCrossed};if(!e.fingersCrossedEnabled)return null;if(!e.fingersCrossed)return{...bt};return{...bt,...e.fingersCrossed}}normalizeOptions(e){let t={format:"json",level:"info",logDirectory:bn.logDirectory,rotation:void 0,timestamp:void 0,fingersCrossed:{},enabled:!0,showTags:!1,formatter:void 0},n={...t,...Object.fromEntries(Object.entries(e).filter(([,r])=>r!==void 0))};if(!n.level||!["debug","info","success","warning","error"].includes(n.level))n.level=t.level;return n}async writeToFile(e){let n=(async()=>{let o,a=0,s=3,c=1000;while(a<s)try{try{try{await Xr(this.config.logDirectory,dn.F_OK|dn.W_OK)}catch(d){if(d instanceof Error&&"code"in d)if(d.code==="ENOENT")await Jr(this.config.logDirectory,{recursive:!0,mode:493});else if(d.code==="EACCES")throw Error(`No write permission for log directory: ${this.config.logDirectory}`);else throw d;else throw d}}catch(d){throw console.error("Debug: [writeToFile] Failed to create log directory:",d),d}let i=this.validateEncryptionConfig()?(await this.encrypt(e)).encrypted:de.from(e);try{if(!pt(this.currentLogFile))await ut(this.currentLogFile,"",{mode:420});if(o=cn(this.currentLogFile,"a",420),Ir(o,i,{flag:"a"}),sn(o),o!==void 0)mt(o),o=void 0;if((await ue(this.currentLogFile)).size===0){if(await ut(this.currentLogFile,i,{flag:"w",mode:420}),(await ue(this.currentLogFile)).size===0)throw Error("File exists but is empty after retry write")}return}catch(d){let l=d;if(l.code&&["ENETDOWN","ENETUNREACH","ENOTFOUND","ETIMEDOUT"].includes(l.code)){if(a<s-1){let m=typeof l.message==="string"?l.message:"Unknown error";console.error(`Network error during write attempt ${a+1}/${s}:`,m);let u=c*2**a;await new Promise((p)=>setTimeout(p,u)),a++;continue}}if(l?.code&&["ENOSPC","EDQUOT"].includes(l.code))throw Error(`Disk quota exceeded or no space left on device: ${l.message}`);throw console.error("Debug: [writeToFile] Error writing to file:",l),l}finally{if(o!==void 0)try{mt(o)}catch(d){console.error("Debug: [writeToFile] Error closing file descriptor:",d)}}}catch(i){if(a===s-1){let l=i,m=typeof l.message==="string"?l.message:"Unknown error";throw console.error("Debug: [writeToFile] Max retries reached. Final error:",m),i}a++;let d=c*2**(a-1);await new Promise((l)=>setTimeout(l,d))}})();this.pendingOperations.push(n);let r=this.pendingOperations.length-1;try{await n}catch(o){throw console.error("Debug: [writeToFile] Error in operation:",o),o}finally{this.pendingOperations.splice(r,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 ye(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 ye(this.config.logDirectory,`${this.name}.log`);let e=new Date().toISOString().split("T")[0];return ye(this.config.logDirectory,`${this.name}-${e}.log`)}setupRotation(){if(L())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 n=typeof t.interval==="number"?t.interval:60,r=Math.max(n,60)*1000;this.keyRotationTimeout=setInterval(()=>{this.rotateKeys().catch((o)=>{console.error("Error rotating keys:",o)})},r)}async rotateKeys(){if(!this.validateEncryptionConfig()){console.error("Invalid encryption configuration detected during key rotation");return}let t=this.config.rotation.keyRotation,n=this.generateKeyId(),r=this.generateKey();this.currentKeyId=n,this.keys.set(n,r),this.encryptionKeys.set(n,{key:r,createdAt:new Date});let o=Array.from(this.encryptionKeys.entries()).sort(([,c],[,i])=>i.createdAt.getTime()-c.createdAt.getTime()),a=typeof t.maxKeys==="number"?t.maxKeys:1,s=Math.max(1,a);if(o.length>s)for(let[c]of o.slice(s))this.encryptionKeys.delete(c),this.keys.delete(c)}generateKeyId(){return lt(16).toString("hex")}generateKey(){return lt(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(),n=lt(16),r=Sr("aes-256-gcm",t,n),o=de.concat([r.update(e,"utf8"),r.final()]),a=r.getAuthTag();return{encrypted:de.concat([n,o,a]),iv:n}}async compressData(e){return new Promise((t,n)=>{let r=mn(),o=[];r.on("data",(a)=>o.push(a)),r.on("end",()=>t(de.from(de.concat(o)))),r.on("error",n),r.write(e),r.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(L())return;let e=await ue(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 n=this.currentLogFile,r=this.generateLogFilename();if(this.name.includes("rotation-load-test")||this.name==="failed-rotation-test"){let o=await Ee(this.config.logDirectory),a=o.filter((i)=>i.startsWith(this.name)&&/\.log\.\d+$/.test(i)).sort((i,d)=>{let l=Number.parseInt(i.match(/\.log\.(\d+)$/)?.[1]||"0");return Number.parseInt(d.match(/\.log\.(\d+)$/)?.[1]||"0")-l}),s=a.length>0?Number.parseInt(a[0].match(/\.log\.(\d+)$/)?.[1]||"0")+1:1,c=`${n}.${s}`;if(await ue(n).catch(()=>null))try{if(await ln(n,c),t.compress)try{let i=`${c}.gz`;await this.compressLogFile(c,i),await Te(c)}catch(i){console.error("Error compressing rotated file:",i)}if(a.length===0&&!o.some((i)=>i.endsWith(".log.1")))try{let i=`${n}.1`;await ut(i,"")}catch(i){console.error("Error creating backup file:",i)}}catch(i){console.error(`Error during rotation: ${i instanceof Error?i.message:String(i)}`)}}else{let o=new Date().toISOString().replace(/[:.]/g,"-"),a=n.replace(/\.log$/,`-${o}.log`);if(await ue(n).catch(()=>null))await ln(n,a)}if(this.currentLogFile=r,t.maxFiles){let a=(await Ee(this.config.logDirectory)).filter((s)=>s.startsWith(this.name)).sort((s,c)=>c.localeCompare(s));for(let s of a.slice(t.maxFiles))await Te(ye(this.config.logDirectory,s))}}}async compressLogFile(e,t){let n=an(e),r=Fr(t),o=mn();await Qr(n,o,r)}async handleFingersCrossedBuffer(e,t){if(!this.fingersCrossedConfig)return;if(this.shouldActivateFingersCrossed(e)&&!this.isActivated){this.isActivated=!0;for(let n of this.logBuffer){let r=await this.formatter.format(n);await this.writeToFile(r),console.log(r)}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 n={timestamp:new Date,level:e,message:t,name:this.name};this.logBuffer.push(n)}}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()})),pt(this.currentLogFile))try{let e=cn(this.currentLogFile,"r+");sn(e),mt(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(!L()&&this.config.rotation&&typeof this.config.rotation!=="boolean"&&this.config.rotation.compress)try{let t=(await Ee(this.config.logDirectory)).filter((n)=>(n.includes("temp")||n.includes(".tmp"))&&n.includes(this.name));for(let n of t)try{await Te(ye(this.config.logDirectory,n))}catch(r){console.error(`Failed to delete temp file ${n}:`,r)}}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?T.gray(e.toLocaleTimeString()):e.toLocaleTimeString()}formatConsoleMessage(e){let{timestamp:t,icon:n="",tag:r="",message:o,level:a,showTimestamp:s=!0}=e,c=(p)=>p.replace(this.ANSI_PATTERN,"");if(!this.fancy){let p=[];if(s)p.push(t);if(a==="warning")p.push("WARN");else if(a==="error")p.push("ERROR");else if(n)p.push(n.replace(/[^\p{L}\p{N}\p{P}\p{Z}]/gu,""));if(r)p.push(r.replace(/[[\]]/g,""));return p.push(o),p.join(" ")}let i=I.stdout.columns||120,d="";if(a==="warning"||a==="error")d=`${n} ${o}`;else if(a==="info"||a==="success")d=`${n} ${r} ${o}`;else d=`${n} ${r} ${T.cyan(o)}`;if(!s)return d.trim();let l=c(d).trim().length,m=c(t).length,u=Math.max(1,i-2-l-m);return`${d.trim()}${" ".repeat(u)}${t}`}formatMessage(e,t){if(t.length===1&&Array.isArray(t[0]))return e.replace(/\{(\d+)\}/g,(a,s)=>{let c=Number.parseInt(s,10);return c<t[0].length?String(t[0][c]):a});let n=/%([sdijfo%])/g,r=0,o=e.replace(n,(a,s)=>{if(s==="%")return"%";if(r>=t.length)return a;let c=t[r++];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 a}});if(r<t.length)o+=` ${t.slice(r).map((a)=>typeof a==="object"?JSON.stringify(a,null,2):String(a)).join(" ")}`;return o}async log(e,t,...n){let r=new Date,o=this.formatConsoleTimestamp(r),a=this.formatFileTimestamp(r),s,c;if(t instanceof Error)s=t.message,c=t.stack;else s=this.formatMessage(t,n);if(this.fancy&&!L()){let d=mo[e],l=this.options.showTags!==!1&&this.name?T.gray(this.formatTag(this.name)):"",m;switch(e){case"debug":m=this.formatConsoleMessage({timestamp:o,icon:d,tag:l,message:T.gray(s),level:e}),console.error(m);break;case"info":m=this.formatConsoleMessage({timestamp:o,icon:d,tag:l,message:s,level:e}),console.error(m);break;case"success":m=this.formatConsoleMessage({timestamp:o,icon:d,tag:l,message:T.green(s),level:e}),console.error(m);break;case"warning":m=this.formatConsoleMessage({timestamp:o,icon:d,tag:l,message:s,level:e}),console.warn(m);break;case"error":if(m=this.formatConsoleMessage({timestamp:o,icon:d,tag:l,message:s,level:e}),console.error(m),c){let u=c.split(`
3
+ `);for(let p of u)if(p.trim()&&!p.includes(s))console.error(this.formatConsoleMessage({timestamp:o,message:T.gray(` ${p}`),level:e,showTimestamp:!1}))}break}}else if(!L()){if(console.error(`${a} ${this.environment}.${e.toUpperCase()}: ${s}`),c)console.error(c)}if(!this.shouldLog(e))return;let i=`${a} ${this.environment}.${e.toUpperCase()}: ${s}
4
4
  `;if(c)i+=`${c}
5
- `;i=i.replace(this.ANSI_PATTERN,""),await this.writeToFile(i)}time(e){let t=performance.now();if(this.fancy&&!B()){let n=this.options.showTags!==!1&&this.name?x.gray(this.formatTag(this.name)):"",r=this.formatConsoleTimestamp(new Date);console.error(this.formatConsoleMessage({timestamp:r,icon:x.blue("\u25D0"),tag:n,message:`${x.cyan(e)}...`}))}return async(n)=>{if(!this.enabled)return;let r=performance.now(),o=Math.round(r-t),a=`${e} completed in ${o}ms`,s=new Date,c=this.formatConsoleTimestamp(s),d=`${this.formatFileTimestamp(s)} ${this.environment}.INFO: ${a}`;if(n)d+=` ${JSON.stringify(n)}`;if(d+=`
6
- `,d=d.replace(this.ANSI_PATTERN,""),this.fancy&&!B()){let m=this.options.showTags!==!1&&this.name?x.gray(this.formatTag(this.name)):"";console.error(this.formatConsoleMessage({timestamp:c,icon:x.green("\u2713"),tag:m,message:`${a}${n?` ${JSON.stringify(n)}`:""}`}))}else if(!B())console.error(d.trim());await this.writeToFile(d)}}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}`,n=new Qe(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(n),n}createReadStream(){if(B())throw Error("createReadStream is not supported in browser environments");if(!pt(this.currentLogFile))throw Error(`Log file does not exist: ${this.currentLogFile}`);return rn(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 n=this.keys.get(this.currentKeyId);try{let r=de.isBuffer(e)?e:de.from(e,"base64"),o=r.slice(0,16),a=r.slice(-16),s=r.slice(16,-16),c=Sr("aes-256-gcm",n,o);return c.setAuthTag(a),de.concat([c.update(s),c.final()]).toString("utf8")}catch(r){throw Error(`Decryption failed: ${r instanceof Error?r.message:String(r)}`)}}getLevel(){return this.config.level}getLogDirectory(){return this.config.logDirectory}getFormat(){return this.config.format}getRotationConfig(){return this.config.rotation}isBrowserMode(){return B()}isServerMode(){return!B()}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,n=this.formatConsoleTimestamp(t),r=this.formatFileTimestamp(t);if(this.fancy&&!B()){let a=e.split(`
7
- `),s=Math.max(...a.map((m)=>m.length))+2,c=`\u250C${"\u2500".repeat(s)}\u2510`,i=`\u2514${"\u2500".repeat(s)}\u2518`,d=a.map((m)=>{let l=" ".repeat(s-m.length-2);return`\u2502 ${m}${l} \u2502`});if(this.options.showTags!==!1&&this.name)console.error(this.formatConsoleMessage({timestamp:n,message:x.gray(this.formatTag(this.name)),showTimestamp:!1}));console.error(this.formatConsoleMessage({timestamp:n,message:x.cyan(c)})),d.forEach((m)=>console.error(this.formatConsoleMessage({timestamp:n,message:x.cyan(m),showTimestamp:!1}))),console.error(this.formatConsoleMessage({timestamp:n,message:x.cyan(i),showTimestamp:!1}))}else if(!B())console.error(`${r} ${this.environment}.INFO: [BOX] ${e}`);let o=`${r} ${this.environment}.INFO: [BOX] ${e}
8
- `.replace(this.ANSI_PATTERN,"");await this.writeToFile(o)}async prompt(e){if(B())return Promise.resolve(!0);return new Promise((t)=>{console.error(`${x.cyan("?")} ${e} (y/n) `);let n=(r)=>{let o=r.toString().trim().toLowerCase();X.stdin.removeListener("data",n);try{if(typeof X.stdin.setRawMode==="function")X.stdin.setRawMode(!1)}catch{}X.stdin.pause(),console.error(""),t(o==="y"||o==="yes")};try{if(typeof X.stdin.setRawMode==="function")X.stdin.setRawMode(!0)}catch{}X.stdin.resume(),X.stdin.once("data",n)})}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 n=e;if(t&&t.length>0){let s=/%([sdijfo%])/g,c=0;if(n=e.replace(s,(i,d)=>{if(d==="%")return"%";if(c>=t.length)return i;let m=t[c++];switch(d){case"s":return String(m);case"d":case"i":return Number(m).toString();case"j":case"o":return JSON.stringify(m,null,2);default:return i}}),c<t.length)n+=` ${t.slice(c).map((i)=>typeof i==="object"?JSON.stringify(i,null,2):String(i)).join(" ")}`}if(this.fancy&&!B()){let s=this.options.showTags!==!1&&this.name?x.gray(this.formatTag(this.name)):"",c=x.blue("\u25D0");console.error(`${c} ${s} ${x.cyan(n)}`)}let a=`[${new Date().toISOString()}] ${this.environment}.INFO: [START] ${n}
9
- `.replace(this.ANSI_PATTERN,"");await this.writeToFile(a)}progress(e,t=""){if(!this.enabled||!this.fancy||B()||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 n=20;return this.activeProgressBar={total:e,current:0,message:t,barLength:n,lastRenderedLine:""},this.renderProgressBar(this.activeProgressBar),{update:(s,c)=>{if(!this.activeProgressBar||!this.enabled||!this.fancy||B())return;if(this.activeProgressBar.current=Math.max(0,Math.min(e,s)),c!==void 0)this.activeProgressBar.message=c;let i=this.activeProgressBar.current===this.activeProgressBar.total;this.renderProgressBar(this.activeProgressBar,i)},finish:(s)=>{if(!this.activeProgressBar||!this.enabled||!this.fancy||B())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||B())return;X.stdout.write(`${"\r".padEnd(X.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||B()||!X.stdout.isTTY)return;let n=Math.min(100,Math.max(0,Math.round(e.current/e.total*100))),r=Math.round(e.barLength*n/100),o=e.barLength-r,a=x.green("\u2501".repeat(r)),s=x.gray("\u2501".repeat(o)),c=`[${a}${s}]`,i=`${n}%`.padStart(4),d=e.message?` ${e.message}`:"",m=t||n===100?x.green("\u2713"):x.blue("\u25B6"),l=this.options.showTags!==!1&&this.name?` ${x.gray(this.formatTag(this.name))}`:"",u=`\r${m}${l} ${c} ${i}${d}`,p=X.stdout.columns||80,f=" ".repeat(Math.max(0,p-u.replace(this.ANSI_PATTERN,"").length));if(e.lastRenderedLine=`${u}${f}`,X.stdout.write(e.lastRenderedLine),t)X.stdout.write(`
10
- `)}finishProgressBar(e,t){if(!this.enabled||!this.fancy||B()||!X.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(B()){console.warn("Log clearing is not supported in browser environments.");return}try{console.warn("Clearing logs...",this.config.logDirectory);let t=await Ee(this.config.logDirectory),n=[];for(let r of t){if(!(e.name?new RegExp(e.name.replace("*",".*")).test(r):r.startsWith(this.name))||!r.endsWith(".log"))continue;let a=ue(this.config.logDirectory,r);if(e.before)try{if((await pe(a)).mtime>=e.before)continue}catch(s){console.error(`Failed to get stats for file ${a}:`,s);continue}n.push(a)}if(n.length===0){console.warn("No log files matched the criteria for clearing.");return}console.warn(`Preparing to delete ${n.length} log file(s)...`);for(let r of n)try{await ze(r),console.warn(`Deleted log file: ${r}`)}catch(o){console.error(`Failed to delete log file ${r}:`,o)}console.warn("Log clearing process finished.")}catch(t){console.error("Error during log clearing process:",t)}}}var Pi=new Qe("stacks");function Se(e,t){if(Array.isArray(t)&&Array.isArray(e)&&t.length===2&&e.length===2&&z(t[0])&&"id"in t[0]&&t[0].id===3&&z(t[1])&&"id"in t[1]&&t[1].id===4)return t;if(z(t)&&z(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(z(e)&&"arr"in e&&Array.isArray(e.arr)&&z(t)&&"arr"in t&&Array.isArray(t.arr))return t;if(t.length>0&&e.length>0&&z(t[0])&&z(e[0])){let r=[...t];for(let o of e)if(z(o)&&"name"in o){if(!r.find((s)=>z(s)&&("name"in s)&&s.name===o.name))r.push(o)}else if(z(o)&&"path"in o){if(!r.find((s)=>z(s)&&("path"in s)&&s.path===o.path))r.push(o)}else if(!r.some((a)=>Fe(a,o)))r.push(o);return r}if(t.every((r)=>typeof r==="string")&&e.every((r)=>typeof r==="string")){let r=[...t];for(let o of e)if(!r.includes(o))r.push(o);return r}return t}if(!z(t)||!z(e))return t;let n={...e};for(let r in t)if(Object.prototype.hasOwnProperty.call(t,r)){let o=t[r];if(o===null||o===void 0)continue;else if(z(o)&&z(n[r]))n[r]=Se(n[r],o);else if(Array.isArray(o)&&Array.isArray(n[r]))if(o.length>0&&n[r].length>0&&z(o[0])&&z(n[r][0])){let a=[...o];for(let s of n[r])if(z(s)&&"name"in s){if(!a.find((i)=>z(i)&&("name"in i)&&i.name===s.name))a.push(s)}else if(z(s)&&"path"in s){if(!a.find((i)=>z(i)&&("path"in i)&&i.path===s.path))a.push(s)}else if(!a.some((c)=>Fe(c,s)))a.push(s);n[r]=a}else if(o.every((a)=>typeof a==="string")&&n[r].every((a)=>typeof a==="string")){let a=[...o];for(let s of n[r])if(!a.includes(s))a.push(s);n[r]=a}else n[r]=o;else n[r]=o}return n}function zt(e,t,n="replace"){if(t===null||t===void 0)return e;if(Array.isArray(t))return n==="replace"?t:Se(e,t);if(Array.isArray(e))return n==="replace"?t:Se(e,t);if(!z(t)||!z(e))return t;let r={...e};for(let o of Object.keys(t)){if(!Object.prototype.hasOwnProperty.call(t,o))continue;let a=t[o],s=r[o];if(a===null||a===void 0)continue;if(Array.isArray(a)||Array.isArray(s))if(n==="replace")r[o]=a;else r[o]=Se(s,a);else if(z(a)&&z(s))r[o]=zt(s,a,n);else r[o]=a}return r}function Fe(e,t){if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!Fe(e[n],t[n]))return!1;return!0}if(z(e)&&z(t)){let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let o of n){if(!Object.prototype.hasOwnProperty.call(t,o))return!1;if(!Fe(e[o],t[o]))return!1}return!0}return!1}function z(e){return Boolean(e&&typeof e==="object"&&!Array.isArray(e))}var I=new Qe("bunfig",{showTags:!0});async function Te(e,t,n="replace"){if(!_n(e))return null;try{let r=await import(e),o=r.default||r;if(typeof o!=="object"||o===null||Array.isArray(o))return null;try{return zt(t,o,n)}catch{return null}}catch{return null}}function io(e,t,n=!1){if(!e)return t;let r=e.toUpperCase().replace(/-/g,"_"),o={...t};function a(s,c=[]){let i={...s};for(let[d,m]of Object.entries(s)){let l=[...c,d],u=(y)=>y.replace(/([A-Z])/g,"_$1").toUpperCase(),p=`${r}_${l.map(u).join("_")}`,f=`${r}_${l.map((y)=>y.toUpperCase()).join("_")}`;if(n)I.info(`Checking environment variable ${p} for config ${e}.${l.join(".")}`);if(typeof m==="object"&&m!==null&&!Array.isArray(m))i[d]=a(m,l);else{let y=$e.env[p]||$e.env[f];if(y!==void 0){if(n)I.info(`Using environment variable ${y?p:f} for config ${e}.${l.join(".")}`);if(typeof m==="number")i[d]=Number(y);else if(typeof m==="boolean")i[d]=y.toLowerCase()==="true";else if(Array.isArray(m))try{let h=JSON.parse(y);if(Array.isArray(h))i[d]=h;else i[d]=y.split(",").map((w)=>w.trim())}catch{i[d]=y.split(",").map((h)=>h.trim())}else i[d]=y}}}return i}return a(o)}async function co({name:e="",alias:t,cwd:n,configDir:r,defaultConfig:o,verbose:a=!1,checkEnv:s=!0,arrayStrategy:c="replace"}){let i=s&&typeof o==="object"&&o!==null&&!Array.isArray(o)?io(e,o,a):o,d=n||$e.cwd(),m=[".ts",".js",".mjs",".cjs",".json"];if(a)I.info(`Loading configuration for "${e}"${t?` (alias: "${t}")`:""} from ${d}`);let l=[e,`.${e}`].filter(Boolean),u=[`${e}.config`,`.${e}.config`].filter(Boolean),p=t?[t,`.${t}`]:[],f=t?[`${t}.config`,`.${t}.config`]:[],y=Array.from(new Set([d,W(d,"config"),W(d,".config"),r?W(d,r):void 0].filter(Boolean)));for(let h of y){if(a)I.info(`Searching for configuration in: ${h}`);let b=[W(d,"config"),W(d,".config")].concat(r?[W(d,r)]:[]).includes(h)?[...l,...u,...p,...f]:[...u,...l,...f,...p];for(let _ of b)for(let A of m){let k=W(h,`${_}${A}`),g=await Te(k,i,c);if(g!==null){if(a)I.success(`Configuration loaded from: ${k}`);return g}}}if(e){let h=W(dt(),".config",e),w=["config",`${e}.config`];if(t)w.push(`${t}.config`);if(a)I.info(`Checking user config directory: ${h}`);for(let b of w)for(let _ of m){let A=W(h,`${b}${_}`),k=await Te(A,i,c);if(k!==null){if(a)I.success(`Configuration loaded from user config directory: ${A}`);return k}}}if(e){let h=W(dt(),".config"),w=[`.${e}.config`];if(t)w.push(`.${t}.config`);if(a)I.info(`Checking user config directory for dotfile configs: ${h}`);for(let b of w)for(let _ of m){let A=W(h,`${b}${_}`),k=await Te(A,i,c);if(k!==null){if(a)I.success(`Configuration loaded from user config directory dotfile: ${A}`);return k}}}if(e){let h=dt(),w=[`.${e}.config`,`.${e}`];if(t)w.push(`.${t}.config`),w.push(`.${t}`);if(a)I.info(`Checking user home directory for dotfile configs: ${h}`);for(let b of w)for(let _ of m){let A=W(h,`${b}${_}`),k=await Te(A,i,c);if(k!==null){if(a)I.success(`Configuration loaded from user home directory: ${A}`);return k}}}try{let h=W(d,"package.json");if(_n(h)){let w=await import(h),b=w[e];if(!b&&t){if(b=w[t],b&&a)I.success(`Using alias "${t}" configuration from package.json`)}if(b&&typeof b==="object"&&!Array.isArray(b))try{if(a)I.success(`Configuration loaded from package.json: ${b===w[e]?e:t}`);return zt(i,b,c)}catch(_){if(a)I.warn("Failed to merge package.json config:",_)}}}catch(h){if(a)I.warn("Failed to load package.json:",h)}if(a)I.info(`No configuration found for "${e}"${t?` or alias "${t}"`:""}, using default configuration with environment variables`);return i}var ec=W($e.cwd(),"config"),tc=W($e.cwd(),"src/generated");function mo(e,t={}){let n=Ge.cwd();while(n.includes("storage"))n=tn(n,"..");let r=tn(n,e||"");if(t?.relative)return Tr(Ge.cwd(),r);return r}var lo=Ge.env.CLARITY_LOG_DIR||xr(mo(),"logs"),kt={level:"info",defaultName:"clarity",timestamp:!0,colors:!0,format:"text",maxLogSize:10485760,logDatePattern:"YYYY-MM-DD",logDirectory:lo,rotation:{frequency:"daily",maxSize:10485760,maxFiles:5,compress:!1,rotateHour:0,rotateMinute:0,rotateDayOfWeek:0,rotateDayOfMonth:1,encrypt:!1},verbose:!1,writeToFile:!1};async function po(){try{let e=await co({name:"clarity",alias:"logging",defaultConfig:kt,cwd:Ge.cwd()});return{...kt,...e||{}}}catch{return kt}}var kn=await po();function G(){if(se.env.NODE_ENV==="test"||se.env.BUN_ENV==="test")return!1;return typeof window<"u"}async function uo(){if(se.env.NODE_ENV==="test"||se.env.BUN_ENV==="test")return!0;if(typeof navigator<"u"&&navigator.product==="ReactNative")return!0;if(typeof se<"u"){let e=se.type;if(e==="renderer"||e==="worker")return!1;return!!(se.versions&&(se.versions.node||se.versions.bun))}return!1}class zn{async format(e){let t=await uo(),n=await this.getMetadata(t);return JSON.stringify({timestamp:e.timestamp.toISOString(),level:e.level,name:e.name,message:e.message,metadata:n})}async getMetadata(e){if(e){let{hostname:t}=await import("os");return{pid:fe.pid,hostname:t(),environment:fe.env.NODE_ENV||"development",platform:fe.platform,version:fe.version}}return{userAgent:navigator.userAgent,hostname:window.location.hostname||"browser",environment:fe.env.NODE_ENV||fe.env.BUN_ENV||"development",viewport:{width:window.innerWidth,height:window.innerHeight},language:navigator.language}}}var 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,nc=Y.red,yo=Y.green,rc=Y.yellow,ho=Y.blue,oc=Y.magenta,ac=Y.cyan,gn=Y.white,sc=Y.gray,wo=Y.bgRed,fo=Y.bgYellow,ic=Y.bgGray,An=Y.bold,cc=Y.dim,dc=Y.italic,mc=Y.underline,lc=Y.strikethrough,pc=Y.reset,gt={activationLevel:"error",bufferSize:50,flushOnDeactivation:!0,stopBuffering:!1},bo={debug:"\uD83D\uDD0D",info:ho("\u2139"),success:yo("\u2713"),warning:fo(gn(An(" WARN "))),error:wo(gn(An(" ERROR ")))};class We{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={...kn},this.options=this.normalizeOptions(t),this.formatter=this.options.formatter||new zn,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 n={...t},r=t.timestamp!==void 0;if(r)delete n.timestamp;if(this.config={...this.config,...n,timestamp:r||this.config.timestamp},this.currentLogFile=this.generateLogFilename(),this.encryptionKeys=new Map,this.validateEncryptionConfig()){this.setupRotation();let o=this.generateKeyId(),a=this.generateKey();this.currentKeyId=o,this.keys.set(o,a),this.encryptionKeys.set(o,{key:a,createdAt:new Date}),this.setupKeyRotation()}}shouldActivateFingersCrossed(e){if(!this.fingersCrossedConfig)return!1;let t={debug:0,info:1,success:2,warning:3,error:4},n=this.fingersCrossedConfig.activationLevel??"error";return t[e]>=t[n]}initializeFingersCrossedConfig(e){if(!e.fingersCrossedEnabled&&e.fingersCrossed)return{...gt,...e.fingersCrossed};if(!e.fingersCrossedEnabled)return null;if(!e.fingersCrossed)return{...gt};return{...gt,...e.fingersCrossed}}normalizeOptions(e){let t={format:"json",level:"info",logDirectory:kn.logDirectory,rotation:void 0,timestamp:void 0,fingersCrossed:{},enabled:!0,showTags:!1,showIcons:!0,formatter:void 0},n={...t,...Object.fromEntries(Object.entries(e).filter(([,r])=>r!==void 0))};if(!n.level||!["debug","info","success","warning","error"].includes(n.level))n.level=t.level;return n}shouldWriteToFile(){return!G()&&this.config.writeToFile===!0}async writeToFile(e){let n=(async()=>{let o,a=0,s=3,c=1000;while(a<s)try{try{try{await Qr(this.config.logDirectory,un.F_OK|un.W_OK)}catch(d){if(d instanceof Error&&"code"in d)if(d.code==="ENOENT")await Wr(this.config.logDirectory,{recursive:!0,mode:493});else if(d.code==="EACCES")throw Error(`No write permission for log directory: ${this.config.logDirectory}`);else throw d;else throw d}}catch(d){throw console.error("Debug: [writeToFile] Failed to create log directory:",d),d}let i=this.validateEncryptionConfig()?(await this.encrypt(e)).encrypted:re.from(e);try{if(!Ne(this.currentLogFile))await wt(this.currentLogFile,"",{mode:420});if(o=pn(this.currentLogFile,"a",420),Cr(o,i,{flag:"a"}),ln(o),o!==void 0)ht(o),o=void 0;if((await he(this.currentLogFile)).size===0){if(await wt(this.currentLogFile,i,{flag:"w",mode:420}),(await he(this.currentLogFile)).size===0)throw Error("File exists but is empty after retry write")}return}catch(d){let m=d;if(m.code&&["ENETDOWN","ENETUNREACH","ENOTFOUND","ETIMEDOUT"].includes(m.code)){if(a<s-1){let l=typeof m.message==="string"?m.message:"Unknown error";console.error(`Network error during write attempt ${a+1}/${s}:`,l);let u=c*2**a;await new Promise((p)=>setTimeout(p,u)),a++;continue}}if(m?.code&&["ENOSPC","EDQUOT"].includes(m.code))throw Error(`Disk quota exceeded or no space left on device: ${m.message}`);throw console.error("Debug: [writeToFile] Error writing to file:",m),m}finally{if(o!==void 0)try{ht(o)}catch(d){console.error("Debug: [writeToFile] Error closing file descriptor:",d)}}}catch(i){if(a===s-1){let m=i,l=typeof m.message==="string"?m.message:"Unknown error";throw console.error("Debug: [writeToFile] Max retries reached. Final error:",l),i}a++;let d=c*2**(a-1);await new Promise((m)=>setTimeout(m,d))}})();this.pendingOperations.push(n);let r=this.pendingOperations.length-1;try{await n}catch(o){throw console.error("Debug: [writeToFile] Error in operation:",o),o}finally{this.pendingOperations.splice(r,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 we(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 we(this.config.logDirectory,`${this.name}.log`);let e=new Date().toISOString().split("T")[0];return we(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 n=typeof t.interval==="number"?t.interval:60,r=Math.max(n,60)*1000;this.keyRotationTimeout=setInterval(()=>{this.rotateKeys().catch((o)=>{console.error("Error rotating keys:",o)})},r)}async rotateKeys(){if(!this.validateEncryptionConfig()){console.error("Invalid encryption configuration detected during key rotation");return}let t=this.config.rotation.keyRotation,n=this.generateKeyId(),r=this.generateKey();this.currentKeyId=n,this.keys.set(n,r),this.encryptionKeys.set(n,{key:r,createdAt:new Date});let o=Array.from(this.encryptionKeys.entries()).sort(([,c],[,i])=>i.createdAt.getTime()-c.createdAt.getTime()),a=typeof t.maxKeys==="number"?t.maxKeys:1,s=Math.max(1,a);if(o.length>s)for(let[c]of o.slice(s))this.encryptionKeys.delete(c),this.keys.delete(c)}generateKeyId(){return yt(16).toString("hex")}generateKey(){return yt(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(),n=yt(16),r=Fr("aes-256-gcm",t,n),o=re.isBuffer(e)?e:re.from(e,"utf8"),a=r.update(o),s=r.final(),c=a.length+s.length,i=r.getAuthTag(),d=re.allocUnsafe(16+c+16);return n.copy(d,0),a.copy(d,16),s.copy(d,16+a.length),i.copy(d,16+c),{encrypted:d,iv:n}}async compressData(e){return new Promise((t,n)=>{let r=hn(),o=[];r.on("data",(a)=>o.push(a)),r.on("end",()=>t(re.from(re.concat(o)))),r.on("error",n),r.write(e),r.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 he(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 n=this.currentLogFile,r=this.generateLogFilename();if(this.name.includes("rotation-load-test")||this.name==="failed-rotation-test"){let o=await Ze(this.config.logDirectory),a=o.filter((i)=>i.startsWith(this.name)&&/\.log\.\d+$/.test(i)).sort((i,d)=>{let m=Number.parseInt(i.match(/\.log\.(\d+)$/)?.[1]||"0");return Number.parseInt(d.match(/\.log\.(\d+)$/)?.[1]||"0")-m}),s=a.length>0?Number.parseInt(a[0].match(/\.log\.(\d+)$/)?.[1]||"0")+1:1,c=`${n}.${s}`;if(await he(n).catch(()=>null))try{if(await yn(n,c),t.compress)try{let i=`${c}.gz`;await this.compressLogFile(c,i),await xe(c)}catch(i){console.error("Error compressing rotated file:",i)}if(a.length===0&&!o.some((i)=>i.endsWith(".log.1")))try{let i=`${n}.1`;await wt(i,"")}catch(i){console.error("Error creating backup file:",i)}}catch(i){console.error(`Error during rotation: ${i instanceof Error?i.message:String(i)}`)}}else{let o=new Date().toISOString().replace(/[:.]/g,"-"),a=n.replace(/\.log$/,`-${o}.log`);if(await he(n).catch(()=>null))await yn(n,a)}if(this.currentLogFile=r,t.maxFiles){let a=(await Ze(this.config.logDirectory)).filter((s)=>s.startsWith(this.name)).sort((s,c)=>c.localeCompare(s));for(let s of a.slice(t.maxFiles))await xe(we(this.config.logDirectory,s))}}}async compressLogFile(e,t){let n=mn(e),r=Jr(t),o=hn();await Kr(n,o,r)}async handleFingersCrossedBuffer(e,t){if(!this.fingersCrossedConfig)return;if(this.shouldActivateFingersCrossed(e)&&!this.isActivated){this.isActivated=!0;for(let n of this.logBuffer){let r=await this.formatter.format(n);if(this.shouldWriteToFile())await this.writeToFile(r);console.log(r)}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()})),Ne(this.currentLogFile))try{let e=pn(this.currentLogFile,"r+");ln(e),ht(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 Ze(this.config.logDirectory)).filter((n)=>(n.includes("temp")||n.includes(".tmp"))&&n.includes(this.name));for(let n of t)try{await xe(we(this.config.logDirectory,n))}catch(r){console.error(`Failed to delete temp file ${n}:`,r)}}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 j.env.NO_COLOR<"u",t=j.env.FORCE_COLOR==="0";if(e||t)return!1;return!!(typeof j.stderr<"u"&&j.stderr.isTTY||typeof j.stdout<"u"&&j.stdout.isTTY)}formatConsoleMessage(e){let{timestamp:t,icon:n="",tag:r="",message:o,level:a,showTimestamp:s=!0}=e,c=(p)=>p.replace(this.ANSI_PATTERN,"");if(!this.fancy){let p=[];if(s)p.push(t);if(a==="warning")p.push("WARN");else if(a==="error")p.push("ERROR");else if(n)p.push(n.replace(/[^\p{L}\p{N}\p{P}\p{Z}]/gu,""));if(r)p.push(r.replace(/[[\]]/g,""));return p.push(o),p.join(" ")}let i=j.stdout.columns||120,d="";if(a==="warning"||a==="error")d=`${n} ${o}`;else if(a==="info"||a==="success")d=`${n} ${r} ${o}`;else d=`${n} ${r} ${E.cyan(o)}`;if(!s)return d.trim();let m=c(d).trim().length,l=c(t).length,u=Math.max(1,i-2-m-l);return`${d.trim()}${" ".repeat(u)}${t}`}formatMessage(e,t){if(t.length===1&&Array.isArray(t[0]))return e.replace(/\{(\d+)\}/g,(a,s)=>{let c=Number.parseInt(s,10);return c<t[0].length?String(t[0][c]):a});let n=/%([sdijfo%])/g,r=0,o=e.replace(n,(a,s)=>{if(s==="%")return"%";if(r>=t.length)return a;let c=t[r++];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 a}});if(r<t.length)o+=` ${t.slice(r).map((a)=>typeof a==="object"?JSON.stringify(a,null,2):String(a)).join(" ")}`;return o}formatMarkdown(e){if(!e)return e;let t=e;return t=t.replace(/\[([^\]]+)\]\(([^)]+)\)/g,(n,r,o)=>{let a=E.underline(E.blue(r)),s=this.toAbsoluteFilePath(o);if(s&&this.shouldStyleConsole()&&this.supportsHyperlinks()){let c=`file://${encodeURI(s)}`,i="\x1B]8;;",d="\x1B\\";return`\x1B]8;;${c}\x1B\\${a}\x1B]8;;\x1B\\`}if(this.shouldStyleConsole()&&this.supportsHyperlinks())return`\x1B]8;;${o}\x1B\\${a}\x1B]8;;\x1B\\`;return a}),t=t.replace(/`([^`]+)`/g,(n,r)=>E.bgGray(r)),t=t.replace(/\*\*([^*]+)\*\*/g,(n,r)=>E.bold(r)),t=t.replace(/(?<!\*)\*([^*]+)\*(?!\*)/g,(n,r)=>E.italic(r)),t=t.replace(/(?<!_)_([^_]+)_(?!_)/g,(n,r)=>E.italic(r)),t=t.replace(/~([^~]+)~/g,(n,r)=>E.strikethrough(r)),t}supportsHyperlinks(){if(G())return!1;let e=j.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 n=j.env.HOME||"";if(n)t=t.replace(/^~(?=$|\/)/,n)}if(vr(t)||t.startsWith("./")||t.startsWith("../"))t=Mr(t);else return null;return Ne(t)?t:null}catch{return null}}buildOutputTexts(e){let t=this.shouldStyleConsole()?this.formatMarkdown(e):e,n=e.replace(this.ANSI_PATTERN,"");return{consoleText:t,fileText:n}}async log(e,t,...n){let r=new Date,o=this.formatConsoleTimestamp(r),a=this.formatFileTimestamp(r),s,c;if(t instanceof Error)s=t.message,c=t.stack;else s=this.formatMessage(t,n);let{consoleText:i,fileText:d}=this.buildOutputTexts(s);if(this.shouldStyleConsole()){let l=this.options.showIcons===!1?"":bo[e],u=this.options.showTags!==!1&&this.name?E.gray(this.formatTag(this.name)):"",p;switch(e){case"debug":p=this.formatConsoleMessage({timestamp:o,icon:l,tag:u,message:E.gray(i),level:e}),console.error(p);break;case"info":p=this.formatConsoleMessage({timestamp:o,icon:l,tag:u,message:i,level:e}),console.warn(p);break;case"success":p=this.formatConsoleMessage({timestamp:o,icon:l,tag:u,message:E.green(i),level:e}),console.error(p);break;case"warning":p=this.formatConsoleMessage({timestamp:o,icon:l,tag:u,message:i,level:e}),console.warn(p);break;case"error":if(p=this.formatConsoleMessage({timestamp:o,icon:l,tag:u,message:i,level:e}),console.error(p),c){let f=c.split(`
11
- `);for(let y of f)if(y.trim()&&!y.includes(s))console.error(this.formatConsoleMessage({timestamp:o,message:E.gray(` ${y}`),level:e,showTimestamp:!1}))}break}}else if(!G()){if(console.error(`${a} ${this.environment}.${e.toUpperCase()}: ${s}`),c)console.error(c)}if(!this.shouldLog(e))return;let m=`${a} ${this.environment}.${e.toUpperCase()}: ${d}
12
- `;if(c)m+=`${c}
13
- `;if(m=m.replace(this.ANSI_PATTERN,""),this.shouldWriteToFile())await this.writeToFile(m)}progress(e,t=""){let n={update:(c,i)=>{},finish:(c)=>{},interrupt:(c,i)=>{}};if(!this.enabled)return n;let r=30;if(this.activeProgressBar={total:Math.max(1,e||1),current:0,message:t||"",barLength:r,lastRenderedLine:""},this.shouldStyleConsole()&&!G()&&j.stdout.isTTY)this.renderProgressBar(this.activeProgressBar);return{update:(c,i)=>{if(!this.enabled||!this.activeProgressBar)return;if(this.activeProgressBar.current=Math.min(Math.max(0,c),this.activeProgressBar.total),i!==void 0)this.activeProgressBar.message=i;if(this.shouldStyleConsole()&&!G()&&j.stdout.isTTY)this.renderProgressBar(this.activeProgressBar)},finish:(c)=>{if(!this.activeProgressBar)return;this.finishProgressBar(this.activeProgressBar,c)},interrupt:(c,i="info")=>{if(!G()&&j.stdout.isTTY)j.stdout.write(`
14
- `);if(this[i==="warning"?"warn":i](c),this.activeProgressBar&&this.shouldStyleConsole()&&!G()&&j.stdout.isTTY)this.renderProgressBar(this.activeProgressBar)}}}time(e){let t=performance.now();if(this.shouldStyleConsole()){let n=this.options.showTags!==!1&&this.name?E.gray(this.formatTag(this.name)):"",r=this.formatConsoleTimestamp(new Date);console.error(this.formatConsoleMessage({timestamp:r,icon:this.options.showIcons===!1?"":E.blue("\u25D0"),tag:n,message:`${E.cyan(e)}...`}))}return async(n)=>{if(!this.enabled)return;let r=performance.now(),o=Math.round(r-t),a=`${e} completed in ${o}ms`,s=new Date,c=this.formatConsoleTimestamp(s),d=`${this.formatFileTimestamp(s)} ${this.environment}.INFO: ${a}`;if(n)d+=` ${JSON.stringify(n)}`;if(d+=`
15
- `,d=d.replace(this.ANSI_PATTERN,""),this.shouldStyleConsole()){let m=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:m,message:`${a}${n?` ${JSON.stringify(n)}`:""}`}))}else if(!G())console.error(d.trim());if(this.shouldWriteToFile())await this.writeToFile(d)}}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}`,n=new We(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(n),n}createReadStream(){if(G())throw Error("createReadStream is not supported in browser environments");if(!Ne(this.currentLogFile))throw Error(`Log file does not exist: ${this.currentLogFile}`);return mn(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 n=this.keys.get(this.currentKeyId);try{let r=re.isBuffer(e)?e:re.from(e,"base64"),o=r.subarray(0,16),a=r.subarray(r.length-16),s=r.subarray(16,r.length-16),c=Ir("aes-256-gcm",n,o);c.setAuthTag(a);let i=c.update(s),d=c.final(),m=i.length+d.length,l=re.allocUnsafe(m);return i.copy(l,0),d.copy(l,i.length),l.toString("utf8")}catch(r){throw Error(`Decryption failed: ${r instanceof Error?r.message:String(r)}`)}}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,n=this.formatConsoleTimestamp(t),r=this.formatFileTimestamp(t),{consoleText:o,fileText:a}=this.buildOutputTexts(e);if(this.shouldStyleConsole()){let c=o.split(`
16
- `),i=Math.max(...c.map((u)=>u.length))+2,d=`\u250C${"\u2500".repeat(i)}\u2510`,m=`\u2514${"\u2500".repeat(i)}\u2518`,l=c.map((u)=>{return this.formatConsoleMessage({timestamp:n,message:E.cyan(u),showTimestamp:!1})});console.error(this.formatConsoleMessage({timestamp:n,message:E.cyan(d),showTimestamp:!1})),l.forEach((u)=>console.error(u)),console.error(this.formatConsoleMessage({timestamp:n,message:E.cyan(m),showTimestamp:!1}))}else if(!G())console.error(`${r} ${this.environment}.INFO: [BOX] ${a}`);let s=`${r} ${this.environment}.INFO: [BOX] ${a}
17
- `.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 n=(r)=>{let o=r.toString().trim().toLowerCase();j.stdin.removeListener("data",n);try{if(typeof j.stdin.setRawMode==="function")j.stdin.setRawMode(!1)}catch{}j.stdin.pause(),console.error(""),t(o==="y"||o==="yes")};try{if(typeof j.stdin.setRawMode==="function")j.stdin.setRawMode(!0)}catch{}j.stdin.resume(),j.stdin.once("data",n)})}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 n=e;if(t&&t.length>0){let i=/%([sdijfo%])/g,d=0;if(n=e.replace(i,(m,l)=>{if(l==="%")return"%";if(d>=t.length)return m;let u=t[d++];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 m}}),d<t.length)n+=` ${t.slice(d).map((m)=>typeof m==="object"?JSON.stringify(m,null,2):String(m)).join(" ")}`}let{consoleText:r,fileText:o}=this.buildOutputTexts(n);if(this.shouldStyleConsole()){let i=this.options.showTags!==!1&&this.name?E.gray(this.formatTag(this.name)):"",d=this.options.showIcons===!1?"":`${E.blue("\u25D0")} `;console.error(`${d}${i} ${E.cyan(r)}`)}let c=`[${new Date().toISOString()}] ${this.environment}.INFO: [START] ${o}
18
- `.replace(this.ANSI_PATTERN,"");if(this.shouldWriteToFile())await this.writeToFile(c)}renderProgressBar(e,t=!1){if(!this.enabled||!this.shouldStyleConsole()||!j.stdout.isTTY)return;let n=Math.min(100,Math.max(0,Math.round(e.current/e.total*100))),r=Math.round(e.barLength*n/100),o=e.barLength-r,a=E.green("\u2501".repeat(r)),s=E.gray("\u2501".repeat(o)),c=`[${a}${s}]`,i=`${n}%`.padStart(4),d=e.message?` ${e.message}`:"",m=this.options.showIcons===!1?"":t||n===100?E.green("\u2713"):E.blue("\u25B6"),l=this.options.showTags!==!1&&this.name?` ${E.gray(this.formatTag(this.name))}`:"",u=`\r${m}${l} ${c} ${i}${d}`,p=j.stdout.columns||80,f=" ".repeat(Math.max(0,p-u.replace(this.ANSI_PATTERN,"").length));if(e.lastRenderedLine=`${u}${f}`,j.stdout.write(e.lastRenderedLine),t)j.stdout.write(`
19
- `)}finishProgressBar(e,t){if(!this.enabled||!this.fancy||G()||!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(G()){console.warn("Log clearing is not supported in browser environments.");return}try{console.warn("Clearing logs...",this.config.logDirectory);let t=await Ze(this.config.logDirectory),n=[];for(let r of t){if(!(e.name?new RegExp(e.name.replace("*",".*")).test(r):r.startsWith(this.name))||!r.endsWith(".log"))continue;let a=we(this.config.logDirectory,r);if(e.before)try{if((await he(a)).mtime>=e.before)continue}catch(s){console.error(`Failed to get stats for file ${a}:`,s);continue}n.push(a)}if(n.length===0){console.warn("No log files matched the criteria for clearing.");return}console.warn(`Preparing to delete ${n.length} log file(s)...`);for(let r of n)try{await xe(r),console.warn(`Deleted log file: ${r}`)}catch(o){console.error(`Failed to delete log file ${r}:`,o)}console.warn("Log clearing process finished.")}catch(t){console.error("Error during log clearing process:",t)}}}var uc=new We("stacks");class P 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,n])=>`${t}: ${n}`).join(", ")})`:"";return`${this.name} [${this.code}]: ${this.message}${e}`}}class Nn extends P{code="CONFIG_NOT_FOUND";constructor(e,t,n){let r=n?` or alias "${n}"`:"";super(`Configuration "${e}"${r} not found`,{configName:e,alias:n,searchPaths:t,searchPathCount:t.length})}}class Ie extends P{code="CONFIG_LOAD_ERROR";constructor(e,t,n){super(`Failed to load configuration from "${e}": ${t.message}`,{configPath:e,configName:n,originalError:t.name,originalMessage:t.message});this.cause=t}}class Zn extends P{code="CONFIG_VALIDATION_ERROR";constructor(e,t,n){super(`Configuration validation failed for "${e}"`,{configPath:e,configName:n,validationErrors:t,errorCount:t.length})}}class xn extends P{code="CONFIG_MERGE_ERROR";constructor(e,t,n,r){super(`Failed to merge configuration from "${e}" with "${t}": ${n.message}`,{sourcePath:e,targetPath:t,configName:r,originalError:n.name,originalMessage:n.message});this.cause=n}}class Nt extends P{code="ENV_VAR_ERROR";constructor(e,t,n,r){super(`Failed to parse environment variable "${e}" with value "${t}" as ${n}`,{envKey:e,envValue:t,expectedType:n,configName:r})}}class Tn extends P{code="FILE_SYSTEM_ERROR";constructor(e,t,n){super(`File system ${e} failed for "${t}": ${n.message}`,{operation:e,path:t,originalError:n.name,originalMessage:n.message});this.cause=n}}class Rn extends P{code="TYPE_GENERATION_ERROR";constructor(e,t,n){super(`Failed to generate types from "${e}" to "${t}": ${n.message}`,{configDir:e,outputPath:t,originalError:n.name,originalMessage:n.message});this.cause=n}}class Je extends P{code="SCHEMA_VALIDATION_ERROR";constructor(e,t,n){super(`Schema validation failed${n?` for config "${n}"`:""}`,{schemaPath:e,configName:n,validationErrors:t,errorCount:t.length})}}class Ln extends P{code="BROWSER_CONFIG_ERROR";constructor(e,t,n,r){super(`Failed to fetch configuration from "${e}": ${t} ${n}`,{endpoint:e,status:t,statusText:n,configName:r})}}class Bn extends P{code="PLUGIN_ERROR";constructor(e,t,n){super(`Plugin "${e}" failed during ${t}: ${n.message}`,{pluginName:e,operation:t,originalError:n.name,originalMessage:n.message});this.cause=n}}var be={configNotFound(e,t,n){return new Nn(e,t,n)},configLoad(e,t,n){return new Ie(e,t,n)},configValidation(e,t,n){return new Zn(e,t,n)},configMerge(e,t,n,r){return new xn(e,t,n,r)},envVar(e,t,n,r){return new Nt(e,t,n,r)},fileSystem(e,t,n){return new Tn(e,t,n)},typeGeneration(e,t,n){return new Rn(e,t,n)},schemaValidation(e,t,n){return new Je(e,t,n)},browserConfig(e,t,n,r){return new Ln(e,t,n,r)},plugin(e,t,n){return new Bn(e,t,n)}};async function ko(e,t={}){let{maxRetries:n=3,retryDelay:r=1000,isRetryable:o=()=>!0,fallback:a}=t,s=Error("Unknown error occurred");for(let c=0;c<=n;c++)try{return await e()}catch(i){if(s=i instanceof Error?i:Error(String(i)),c===n||!o(s))break;if(r>0)await new Promise((d)=>setTimeout(d,r))}if(a!==void 0)return a;throw s instanceof Error?s:Error(`Unknown error: ${String(s)}`)}class Zt{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,n={}){let{prefix:r,useCamelCase:o=!0,useBackwardCompatibility:a=!0,customParsers:s={},verbose:c=!1,trackPerformance:i=!0}=n,d=async()=>{if(!e)return{config:t,source:{type:"environment",priority:50,timestamp:new Date}};let m=r||this.generateEnvPrefix(e),l={...t};return this.processObject(l,[],m,{useCamelCase:o,useBackwardCompatibility:a,customParsers:s,verbose:c,configName:e}),{config:l,source:{type:"environment",priority:50,timestamp:new Date}}};if(i)return _t.track("applyEnvironmentVariables",d,{configName:e});return d()}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,n,r){for(let[o,a]of Object.entries(e)){let s=[...t,o],c=s.map((m)=>this.formatEnvKey(m,r.useCamelCase)),i=`${n}_${c.join("_")}`,d=r.useBackwardCompatibility?`${n}_${s.map((m)=>m.toUpperCase()).join("_")}`:null;if(r.verbose);if(typeof a==="object"&&a!==null&&!Array.isArray(a))this.processObject(a,s,n,r);else{let m=Re.env[i]||(d?Re.env[d]:void 0);if(m!==void 0){if(r.verbose){let l=Re.env[i]?i:d}try{e[o]=this.parseEnvironmentValue(m,typeof a,i,r.customParsers,r.configName)}catch(l){if(l instanceof Nt)throw l;throw be.envVar(i,m,typeof a,r.configName)}}}}}parseEnvironmentValue(e,t,n,r,o){for(let[a,s]of Object.entries(r))try{return s(e)}catch{continue}for(let a of this.defaultParsers)if(a.canParse(e,t))try{return a.parse(e)}catch{throw be.envVar(n,e,`${t} (via ${a.name} parser)`,o)}return e}getEnvironmentVariables(e){let t={},n=e.toUpperCase();for(let[r,o]of Object.entries(Re.env))if(r.startsWith(n)&&o!==void 0)t[r]=o;return t}validateEnvironmentVariable(e,t,n){let r=[];if(!/^[A-Z_][A-Z0-9_]*$/.test(e))r.push(`Environment variable key "${e}" should only contain uppercase letters, numbers, and underscores`);if(n)try{this.parseEnvironmentValue(e,t,n,{})}catch(o){r.push(`Cannot parse value "${t}" as ${n}: ${o}`)}return{isValid:r.length===0,errors:r}}generateEnvVarDocs(e,t,n={}){let{prefix:r,format:o="text"}=n,a=r||this.generateEnvPrefix(e),s=[];switch(this.extractEnvVarInfo(t,[],a,s),o){case"markdown":return this.formatAsMarkdown(s,e);case"json":return JSON.stringify(s,null,2);default:return this.formatAsText(s,e)}}extractEnvVarInfo(e,t,n,r){for(let[o,a]of Object.entries(e)){let s=[...t,o],c=`${n}_${s.map((i)=>this.formatEnvKey(i,!0)).join("_")}`;if(typeof a==="object"&&a!==null&&!Array.isArray(a))this.extractEnvVarInfo(a,s,n,r);else r.push({key:c,type:Array.isArray(a)?"array":typeof a,description:`Configuration for ${s.join(".")}`,example:this.generateExample(a)})}}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 n=`Environment Variables for ${t}:
5
+ `;i=i.replace(this.ANSI_PATTERN,""),await this.writeToFile(i)}time(e){let t=performance.now();if(this.fancy&&!L()){let n=this.options.showTags!==!1&&this.name?T.gray(this.formatTag(this.name)):"",r=this.formatConsoleTimestamp(new Date);console.error(this.formatConsoleMessage({timestamp:r,icon:T.blue("\u25D0"),tag:n,message:`${T.cyan(e)}...`}))}return async(n)=>{if(!this.enabled)return;let r=performance.now(),o=Math.round(r-t),a=`${e} completed in ${o}ms`,s=new Date,c=this.formatConsoleTimestamp(s),d=`${this.formatFileTimestamp(s)} ${this.environment}.INFO: ${a}`;if(n)d+=` ${JSON.stringify(n)}`;if(d+=`
6
+ `,d=d.replace(this.ANSI_PATTERN,""),this.fancy&&!L()){let l=this.options.showTags!==!1&&this.name?T.gray(this.formatTag(this.name)):"";console.error(this.formatConsoleMessage({timestamp:c,icon:T.green("\u2713"),tag:l,message:`${a}${n?` ${JSON.stringify(n)}`:""}`}))}else if(!L())console.error(d.trim());await this.writeToFile(d)}}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}`,n=new Ce(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(n),n}createReadStream(){if(L())throw Error("createReadStream is not supported in browser environments");if(!pt(this.currentLogFile))throw Error(`Log file does not exist: ${this.currentLogFile}`);return an(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 n=this.keys.get(this.currentKeyId);try{let r=de.isBuffer(e)?e:de.from(e,"base64"),o=r.slice(0,16),a=r.slice(-16),s=r.slice(16,-16),c=Yr("aes-256-gcm",n,o);return c.setAuthTag(a),de.concat([c.update(s),c.final()]).toString("utf8")}catch(r){throw Error(`Decryption failed: ${r instanceof Error?r.message:String(r)}`)}}getLevel(){return this.config.level}getLogDirectory(){return this.config.logDirectory}getFormat(){return this.config.format}getRotationConfig(){return this.config.rotation}isBrowserMode(){return L()}isServerMode(){return!L()}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,n=this.formatConsoleTimestamp(t),r=this.formatFileTimestamp(t);if(this.fancy&&!L()){let a=e.split(`
7
+ `),s=Math.max(...a.map((l)=>l.length))+2,c=`\u250C${"\u2500".repeat(s)}\u2510`,i=`\u2514${"\u2500".repeat(s)}\u2518`,d=a.map((l)=>{let m=" ".repeat(s-l.length-2);return`\u2502 ${l}${m} \u2502`});if(this.options.showTags!==!1&&this.name)console.error(this.formatConsoleMessage({timestamp:n,message:T.gray(this.formatTag(this.name)),showTimestamp:!1}));console.error(this.formatConsoleMessage({timestamp:n,message:T.cyan(c)})),d.forEach((l)=>console.error(this.formatConsoleMessage({timestamp:n,message:T.cyan(l),showTimestamp:!1}))),console.error(this.formatConsoleMessage({timestamp:n,message:T.cyan(i),showTimestamp:!1}))}else if(!L())console.error(`${r} ${this.environment}.INFO: [BOX] ${e}`);let o=`${r} ${this.environment}.INFO: [BOX] ${e}
8
+ `.replace(this.ANSI_PATTERN,"");await this.writeToFile(o)}async prompt(e){if(L())return Promise.resolve(!0);return new Promise((t)=>{console.error(`${T.cyan("?")} ${e} (y/n) `);let n=(r)=>{let o=r.toString().trim().toLowerCase();I.stdin.removeListener("data",n);try{if(typeof I.stdin.setRawMode==="function")I.stdin.setRawMode(!1)}catch{}I.stdin.pause(),console.error(""),t(o==="y"||o==="yes")};try{if(typeof I.stdin.setRawMode==="function")I.stdin.setRawMode(!0)}catch{}I.stdin.resume(),I.stdin.once("data",n)})}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 n=e;if(t&&t.length>0){let s=/%([sdijfo%])/g,c=0;if(n=e.replace(s,(i,d)=>{if(d==="%")return"%";if(c>=t.length)return i;let l=t[c++];switch(d){case"s":return String(l);case"d":case"i":return Number(l).toString();case"j":case"o":return JSON.stringify(l,null,2);default:return i}}),c<t.length)n+=` ${t.slice(c).map((i)=>typeof i==="object"?JSON.stringify(i,null,2):String(i)).join(" ")}`}if(this.fancy&&!L()){let s=this.options.showTags!==!1&&this.name?T.gray(this.formatTag(this.name)):"",c=T.blue("\u25D0");console.error(`${c} ${s} ${T.cyan(n)}`)}let a=`[${new Date().toISOString()}] ${this.environment}.INFO: [START] ${n}
9
+ `.replace(this.ANSI_PATTERN,"");await this.writeToFile(a)}progress(e,t=""){if(!this.enabled||!this.fancy||L()||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 n=20;return this.activeProgressBar={total:e,current:0,message:t,barLength:n,lastRenderedLine:""},this.renderProgressBar(this.activeProgressBar),{update:(s,c)=>{if(!this.activeProgressBar||!this.enabled||!this.fancy||L())return;if(this.activeProgressBar.current=Math.max(0,Math.min(e,s)),c!==void 0)this.activeProgressBar.message=c;let i=this.activeProgressBar.current===this.activeProgressBar.total;this.renderProgressBar(this.activeProgressBar,i)},finish:(s)=>{if(!this.activeProgressBar||!this.enabled||!this.fancy||L())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||L())return;I.stdout.write(`${"\r".padEnd(I.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||L()||!I.stdout.isTTY)return;let n=Math.min(100,Math.max(0,Math.round(e.current/e.total*100))),r=Math.round(e.barLength*n/100),o=e.barLength-r,a=T.green("\u2501".repeat(r)),s=T.gray("\u2501".repeat(o)),c=`[${a}${s}]`,i=`${n}%`.padStart(4),d=e.message?` ${e.message}`:"",l=t||n===100?T.green("\u2713"):T.blue("\u25B6"),m=this.options.showTags!==!1&&this.name?` ${T.gray(this.formatTag(this.name))}`:"",u=`\r${l}${m} ${c} ${i}${d}`,p=I.stdout.columns||80,h=" ".repeat(Math.max(0,p-u.replace(this.ANSI_PATTERN,"").length));if(e.lastRenderedLine=`${u}${h}`,I.stdout.write(e.lastRenderedLine),t)I.stdout.write(`
10
+ `)}finishProgressBar(e,t){if(!this.enabled||!this.fancy||L()||!I.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(L()){console.warn("Log clearing is not supported in browser environments.");return}try{console.warn("Clearing logs...",this.config.logDirectory);let t=await Ee(this.config.logDirectory),n=[];for(let r of t){if(!(e.name?new RegExp(e.name.replace("*",".*")).test(r):r.startsWith(this.name))||!r.endsWith(".log"))continue;let a=ye(this.config.logDirectory,r);if(e.before)try{if((await ue(a)).mtime>=e.before)continue}catch(s){console.error(`Failed to get stats for file ${a}:`,s);continue}n.push(a)}if(n.length===0){console.warn("No log files matched the criteria for clearing.");return}console.warn(`Preparing to delete ${n.length} log file(s)...`);for(let r of n)try{await Te(r),console.warn(`Deleted log file: ${r}`)}catch(o){console.error(`Failed to delete log file ${r}:`,o)}console.warn("Log clearing process finished.")}catch(t){console.error("Error during log clearing process:",t)}}}var dc=new Ce("stacks");function Ge(e,t){if(Array.isArray(t)&&Array.isArray(e)&&t.length===2&&e.length===2&&z(t[0])&&"id"in t[0]&&t[0].id===3&&z(t[1])&&"id"in t[1]&&t[1].id===4)return t;if(z(t)&&z(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(z(e)&&"arr"in e&&Array.isArray(e.arr)&&z(t)&&"arr"in t&&Array.isArray(t.arr))return t;if(t.length>0&&e.length>0&&z(t[0])&&z(e[0])){let r=[...t];for(let o of e)if(z(o)&&"name"in o){if(!r.find((s)=>z(s)&&("name"in s)&&s.name===o.name))r.push(o)}else if(z(o)&&"path"in o){if(!r.find((s)=>z(s)&&("path"in s)&&s.path===o.path))r.push(o)}else if(!r.some((a)=>Xe(a,o)))r.push(o);return r}if(t.every((r)=>typeof r==="string")&&e.every((r)=>typeof r==="string")){let r=[...t];for(let o of e)if(!r.includes(o))r.push(o);return r}return t}if(!z(t)||!z(e))return t;let n={...e};for(let r in t)if(Object.prototype.hasOwnProperty.call(t,r)){let o=t[r];if(o===null||o===void 0)continue;else if(z(o)&&z(n[r]))n[r]=Ge(n[r],o);else if(Array.isArray(o)&&Array.isArray(n[r]))if(o.length>0&&n[r].length>0&&z(o[0])&&z(n[r][0])){let a=[...o];for(let s of n[r])if(z(s)&&"name"in s){if(!a.find((i)=>z(i)&&("name"in i)&&i.name===s.name))a.push(s)}else if(z(s)&&"path"in s){if(!a.find((i)=>z(i)&&("path"in i)&&i.path===s.path))a.push(s)}else if(!a.some((c)=>Xe(c,s)))a.push(s);n[r]=a}else if(o.every((a)=>typeof a==="string")&&n[r].every((a)=>typeof a==="string")){let a=[...o];for(let s of n[r])if(!a.includes(s))a.push(s);n[r]=a}else n[r]=o;else n[r]=o}return n}function Et(e,t,n="replace"){if(t===null||t===void 0)return e;if(Array.isArray(t))return n==="replace"?t:Ge(e,t);if(Array.isArray(e))return n==="replace"?t:Ge(e,t);if(!z(t)||!z(e))return t;let r={...e};for(let o of Object.keys(t)){if(!Object.prototype.hasOwnProperty.call(t,o))continue;let a=t[o],s=r[o];if(a===null||a===void 0)continue;if(Array.isArray(a)||Array.isArray(s))if(n==="replace")r[o]=a;else r[o]=Ge(s,a);else if(z(a)&&z(s))r[o]=Et(s,a,n);else r[o]=a}return r}function Xe(e,t){if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!Xe(e[n],t[n]))return!1;return!0}if(z(e)&&z(t)){let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let o of n){if(!Object.prototype.hasOwnProperty.call(t,o))return!1;if(!Xe(e[o],t[o]))return!1}return!0}return!1}function z(e){return Boolean(e&&typeof e==="object"&&!Array.isArray(e))}var J=new Ce("bunfig",{showTags:!0});async function Le(e,t,n="replace"){if(!zn(e))return null;try{let r=await import(e),o=r.default||r;if(typeof o!=="object"||o===null||Array.isArray(o))return null;try{return Et(t,o,n)}catch{return null}}catch{return null}}function po(e,t,n=!1){if(!e)return t;let r=e.toUpperCase().replace(/-/g,"_"),o={...t};function a(s,c=[]){let i={...s};for(let[d,l]of Object.entries(s)){let m=[...c,d],u=(y)=>y.replace(/([A-Z])/g,"_$1").toUpperCase(),p=`${r}_${m.map(u).join("_")}`,h=`${r}_${m.map((y)=>y.toUpperCase()).join("_")}`;if(n)J.info(`Checking environment variable ${p} for config ${e}.${m.join(".")}`);if(typeof l==="object"&&l!==null&&!Array.isArray(l))i[d]=a(l,m);else{let y=_e.env[p]||_e.env[h];if(y!==void 0){if(n)J.info(`Using environment variable ${y?p:h} for config ${e}.${m.join(".")}`);if(typeof l==="number")i[d]=Number(y);else if(typeof l==="boolean")i[d]=y.toLowerCase()==="true";else if(Array.isArray(l))try{let w=JSON.parse(y);if(Array.isArray(w))i[d]=w;else i[d]=y.split(",").map((f)=>f.trim())}catch{i[d]=y.split(",").map((w)=>w.trim())}else i[d]=y}}}return i}return a(o)}async function uo({name:e="",alias:t,cwd:n,configDir:r,defaultConfig:o,verbose:a=!1,checkEnv:s=!0,arrayStrategy:c="replace"}){let i=s&&typeof o==="object"&&o!==null&&!Array.isArray(o)?po(e,o,a):o,d=n||_e.cwd(),l=[".ts",".js",".mjs",".cjs",".json"];if(a)J.info(`Loading configuration for "${e}"${t?` (alias: "${t}")`:""} from ${d}`);let m=[e,`.${e}`].filter(Boolean),u=[`${e}.config`,`.${e}.config`].filter(Boolean),p=t?[t,`.${t}`]:[],h=t?[`${t}.config`,`.${t}.config`]:[],y=Array.from(new Set([d,M(d,"config"),M(d,".config"),r?M(d,r):void 0].filter(Boolean)));for(let w of y){if(a)J.info(`Searching for configuration in: ${w}`);let b=[M(d,"config"),M(d,".config")].concat(r?[M(d,r)]:[]).includes(w)?[...m,...u,...p,...h]:[...u,...m,...h,...p];for(let q of b)for(let g of l){let k=M(w,`${q}${g}`),U=await Le(k,i,c);if(U!==null){if(a)J.success(`Configuration loaded from: ${k}`);return U}}}if(e){let w=M(dt(),".config",e),f=["config",`${e}.config`];if(t)f.push(`${t}.config`);if(a)J.info(`Checking user config directory: ${w}`);for(let b of f)for(let q of l){let g=M(w,`${b}${q}`),k=await Le(g,i,c);if(k!==null){if(a)J.success(`Configuration loaded from user config directory: ${g}`);return k}}}if(e){let w=M(dt(),".config"),f=[`.${e}.config`];if(t)f.push(`.${t}.config`);if(a)J.info(`Checking user config directory for dotfile configs: ${w}`);for(let b of f)for(let q of l){let g=M(w,`${b}${q}`),k=await Le(g,i,c);if(k!==null){if(a)J.success(`Configuration loaded from user config directory dotfile: ${g}`);return k}}}if(e){let w=dt(),f=[`.${e}.config`,`.${e}`];if(t)f.push(`.${t}.config`),f.push(`.${t}`);if(a)J.info(`Checking user home directory for dotfile configs: ${w}`);for(let b of f)for(let q of l){let g=M(w,`${b}${q}`),k=await Le(g,i,c);if(k!==null){if(a)J.success(`Configuration loaded from user home directory: ${g}`);return k}}}try{let w=M(d,"package.json");if(zn(w)){let f=await import(w),b=f[e];if(!b&&t){if(b=f[t],b&&a)J.success(`Using alias "${t}" configuration from package.json`)}if(b&&typeof b==="object"&&!Array.isArray(b))try{if(a)J.success(`Configuration loaded from package.json: ${b===f[e]?e:t}`);return Et(i,b,c)}catch(q){if(a)J.warn("Failed to merge package.json config:",q)}}}catch(w){if(a)J.warn("Failed to load package.json:",w)}if(a)J.info(`No configuration found for "${e}"${t?` or alias "${t}"`:""}, using default configuration with environment variables`);return i}var lc=M(_e.cwd(),"config"),mc=M(_e.cwd(),"src/generated");function yo(e,t={}){let n=Se.cwd();while(n.includes("storage"))n=rn(n,"..");let r=rn(n,e||"");if(t?.relative)return Ur(Se.cwd(),r);return r}var ho=Se.env.CLARITY_LOG_DIR||Br(yo(),"logs"),kt={level:"info",defaultName:"clarity",timestamp:!0,colors:!0,format:"text",maxLogSize:10485760,logDatePattern:"YYYY-MM-DD",logDirectory:ho,rotation:{frequency:"daily",maxSize:10485760,maxFiles:5,compress:!1,rotateHour:0,rotateMinute:0,rotateDayOfWeek:0,rotateDayOfMonth:1,encrypt:!1},verbose:!1,writeToFile:!1};async function wo(){try{let e=await uo({name:"clarity",alias:"logging",defaultConfig:kt,cwd:Se.cwd()});return{...kt,...e||{}}}catch{return kt}}var An=await wo();function G(){if(se.env.NODE_ENV==="test"||se.env.BUN_ENV==="test")return!1;return typeof window<"u"}async function fo(){if(se.env.NODE_ENV==="test"||se.env.BUN_ENV==="test")return!0;if(typeof navigator<"u"&&navigator.product==="ReactNative")return!0;if(typeof se<"u"){let e=se.type;if(e==="renderer"||e==="worker")return!1;return!!(se.versions&&(se.versions.node||se.versions.bun))}return!1}class Nn{async format(e){let t=await fo(),n=await this.getMetadata(t);return JSON.stringify({timestamp:e.timestamp.toISOString(),level:e.level,name:e.name,message:e.message,metadata:n})}async getMetadata(e){if(e){let{hostname:t}=await import("os");return{pid:be.pid,hostname:t(),environment:be.env.NODE_ENV||"development",platform:be.platform,version:be.version}}return{userAgent:navigator.userAgent,hostname:window.location.hostname||"browser",environment:be.env.NODE_ENV||be.env.BUN_ENV||"development",viewport:{width:window.innerWidth,height:window.innerHeight},language:navigator.language}}}var S={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"},j=S,pc=S.red,bo=S.green,uc=S.yellow,ko=S.blue,yc=S.magenta,hc=S.cyan,$n=S.white,wc=S.gray,go=S.bgRed,Ao=S.bgYellow,fc=S.bgGray,qn=S.bold,bc=S.dim,kc=S.italic,gc=S.underline,Ac=S.strikethrough,$c=S.reset,gt={activationLevel:"error",bufferSize:50,flushOnDeactivation:!0,stopBuffering:!1},$o={debug:"\uD83D\uDD0D",info:ko("\u2139"),success:bo("\u2713"),warning:Ao($n(qn(" WARN "))),error:go($n(qn(" ERROR ")))};class Me{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={...An},this.options=this.normalizeOptions(t),this.formatter=this.options.formatter||new Nn,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??_.env.APP_ENV??"local",this.fingersCrossedConfig=this.initializeFingersCrossedConfig(t);let n={...t},r=t.timestamp!==void 0;if(r)delete n.timestamp;if(this.config={...this.config,...n,timestamp:r||this.config.timestamp},this.currentLogFile=this.generateLogFilename(),this.encryptionKeys=new Map,this.validateEncryptionConfig()){this.setupRotation();let o=this.generateKeyId(),a=this.generateKey();this.currentKeyId=o,this.keys.set(o,a),this.encryptionKeys.set(o,{key:a,createdAt:new Date}),this.setupKeyRotation()}}shouldActivateFingersCrossed(e){if(!this.fingersCrossedConfig)return!1;let t={debug:0,info:1,success:2,warning:3,error:4},n=this.fingersCrossedConfig.activationLevel??"error";return t[e]>=t[n]}initializeFingersCrossedConfig(e){if(!e.fingersCrossedEnabled&&e.fingersCrossed)return{...gt,...e.fingersCrossed};if(!e.fingersCrossedEnabled)return null;if(!e.fingersCrossed)return{...gt};return{...gt,...e.fingersCrossed}}normalizeOptions(e){let t={format:"json",level:"info",logDirectory:An.logDirectory,rotation:void 0,timestamp:void 0,fingersCrossed:{},enabled:!0,showTags:!1,showIcons:!0,formatter:void 0},n={...t,...Object.fromEntries(Object.entries(e).filter(([,r])=>r!==void 0))};if(!n.level||!["debug","info","success","warning","error"].includes(n.level))n.level=t.level;return n}shouldWriteToFile(){return!G()&&this.config.writeToFile===!0}async writeToFile(e){let n=(async()=>{let o,a=0,s=3,c=1000;while(a<s)try{try{try{await Kr(this.config.logDirectory,hn.F_OK|hn.W_OK)}catch(d){if(d instanceof Error&&"code"in d)if(d.code==="ENOENT")await Dr(this.config.logDirectory,{recursive:!0,mode:493});else if(d.code==="EACCES")throw Error(`No write permission for log directory: ${this.config.logDirectory}`);else throw d;else throw d}}catch(d){throw console.error("Debug: [writeToFile] Failed to create log directory:",d),d}let i=this.validateEncryptionConfig()?(await this.encrypt(e)).encrypted:re.from(e);try{if(!Ne(this.currentLogFile))await wt(this.currentLogFile,"",{mode:420});if(o=yn(this.currentLogFile,"a",420),vr(o,i,{flag:"a"}),un(o),o!==void 0)ht(o),o=void 0;if((await we(this.currentLogFile)).size===0){if(await wt(this.currentLogFile,i,{flag:"w",mode:420}),(await we(this.currentLogFile)).size===0)throw Error("File exists but is empty after retry write")}return}catch(d){let l=d;if(l.code&&["ENETDOWN","ENETUNREACH","ENOTFOUND","ETIMEDOUT"].includes(l.code)){if(a<s-1){let m=typeof l.message==="string"?l.message:"Unknown error";console.error(`Network error during write attempt ${a+1}/${s}:`,m);let u=c*2**a;await new Promise((p)=>setTimeout(p,u)),a++;continue}}if(l?.code&&["ENOSPC","EDQUOT"].includes(l.code))throw Error(`Disk quota exceeded or no space left on device: ${l.message}`);throw console.error("Debug: [writeToFile] Error writing to file:",l),l}finally{if(o!==void 0)try{ht(o)}catch(d){console.error("Debug: [writeToFile] Error closing file descriptor:",d)}}}catch(i){if(a===s-1){let l=i,m=typeof l.message==="string"?l.message:"Unknown error";throw console.error("Debug: [writeToFile] Max retries reached. Final error:",m),i}a++;let d=c*2**(a-1);await new Promise((l)=>setTimeout(l,d))}})();this.pendingOperations.push(n);let r=this.pendingOperations.length-1;try{await n}catch(o){throw console.error("Debug: [writeToFile] Error in operation:",o),o}finally{this.pendingOperations.splice(r,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 fe(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 fe(this.config.logDirectory,`${this.name}.log`);let e=new Date().toISOString().split("T")[0];return fe(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 n=typeof t.interval==="number"?t.interval:60,r=Math.max(n,60)*1000;this.keyRotationTimeout=setInterval(()=>{this.rotateKeys().catch((o)=>{console.error("Error rotating keys:",o)})},r)}async rotateKeys(){if(!this.validateEncryptionConfig()){console.error("Invalid encryption configuration detected during key rotation");return}let t=this.config.rotation.keyRotation,n=this.generateKeyId(),r=this.generateKey();this.currentKeyId=n,this.keys.set(n,r),this.encryptionKeys.set(n,{key:r,createdAt:new Date});let o=Array.from(this.encryptionKeys.entries()).sort(([,c],[,i])=>i.createdAt.getTime()-c.createdAt.getTime()),a=typeof t.maxKeys==="number"?t.maxKeys:1,s=Math.max(1,a);if(o.length>s)for(let[c]of o.slice(s))this.encryptionKeys.delete(c),this.keys.delete(c)}generateKeyId(){return yt(16).toString("hex")}generateKey(){return yt(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(),n=yt(16),r=Wr("aes-256-gcm",t,n),o=re.isBuffer(e)?e:re.from(e,"utf8"),a=r.update(o),s=r.final(),c=a.length+s.length,i=r.getAuthTag(),d=re.allocUnsafe(16+c+16);return n.copy(d,0),a.copy(d,16),s.copy(d,16+a.length),i.copy(d,16+c),{encrypted:d,iv:n}}async compressData(e){return new Promise((t,n)=>{let r=fn(),o=[];r.on("data",(a)=>o.push(a)),r.on("end",()=>t(re.from(re.concat(o)))),r.on("error",n),r.write(e),r.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 we(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 n=this.currentLogFile,r=this.generateLogFilename();if(this.name.includes("rotation-load-test")||this.name==="failed-rotation-test"){let o=await Ze(this.config.logDirectory),a=o.filter((i)=>i.startsWith(this.name)&&/\.log\.\d+$/.test(i)).sort((i,d)=>{let l=Number.parseInt(i.match(/\.log\.(\d+)$/)?.[1]||"0");return Number.parseInt(d.match(/\.log\.(\d+)$/)?.[1]||"0")-l}),s=a.length>0?Number.parseInt(a[0].match(/\.log\.(\d+)$/)?.[1]||"0")+1:1,c=`${n}.${s}`;if(await we(n).catch(()=>null))try{if(await wn(n,c),t.compress)try{let i=`${c}.gz`;await this.compressLogFile(c,i),await xe(c)}catch(i){console.error("Error compressing rotated file:",i)}if(a.length===0&&!o.some((i)=>i.endsWith(".log.1")))try{let i=`${n}.1`;await wt(i,"")}catch(i){console.error("Error creating backup file:",i)}}catch(i){console.error(`Error during rotation: ${i instanceof Error?i.message:String(i)}`)}}else{let o=new Date().toISOString().replace(/[:.]/g,"-"),a=n.replace(/\.log$/,`-${o}.log`);if(await we(n).catch(()=>null))await wn(n,a)}if(this.currentLogFile=r,t.maxFiles){let a=(await Ze(this.config.logDirectory)).filter((s)=>s.startsWith(this.name)).sort((s,c)=>c.localeCompare(s));for(let s of a.slice(t.maxFiles))await xe(fe(this.config.logDirectory,s))}}}async compressLogFile(e,t){let n=pn(e),r=Mr(t),o=fn();await Pr(n,o,r)}async handleFingersCrossedBuffer(e,t){if(!this.fingersCrossedConfig)return;if(this.shouldActivateFingersCrossed(e)&&!this.isActivated){this.isActivated=!0;for(let n of this.logBuffer){let r=await this.formatter.format(n);if(this.shouldWriteToFile())await this.writeToFile(r);console.log(r)}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()})),Ne(this.currentLogFile))try{let e=yn(this.currentLogFile,"r+");un(e),ht(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 Ze(this.config.logDirectory)).filter((n)=>(n.includes("temp")||n.includes(".tmp"))&&n.includes(this.name));for(let n of t)try{await xe(fe(this.config.logDirectory,n))}catch(r){console.error(`Failed to delete temp file ${n}:`,r)}}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()?j.gray(e.toLocaleTimeString()):e.toLocaleTimeString()}shouldStyleConsole(){if(!this.fancy||G())return!1;let e=typeof _.env.NO_COLOR<"u",t=_.env.FORCE_COLOR==="0";if(e||t)return!1;return!!(typeof _.stderr<"u"&&_.stderr.isTTY||typeof _.stdout<"u"&&_.stdout.isTTY)}formatConsoleMessage(e){let{timestamp:t,icon:n="",tag:r="",message:o,level:a,showTimestamp:s=!0}=e,c=(p)=>p.replace(this.ANSI_PATTERN,"");if(!this.fancy){let p=[];if(s)p.push(t);if(a==="warning")p.push("WARN");else if(a==="error")p.push("ERROR");else if(n)p.push(n.replace(/[^\p{L}\p{N}\p{P}\p{Z}]/gu,""));if(r)p.push(r.replace(/[[\]]/g,""));return p.push(o),p.join(" ")}let i=_.stdout.columns||120,d="";if(a==="warning"||a==="error")d=`${n} ${o}`;else if(a==="info"||a==="success")d=`${n} ${r} ${o}`;else d=`${n} ${r} ${j.cyan(o)}`;if(!s)return d.trim();let l=c(d).trim().length,m=c(t).length,u=Math.max(1,i-2-l-m);return`${d.trim()}${" ".repeat(u)}${t}`}formatMessage(e,t){if(t.length===1&&Array.isArray(t[0]))return e.replace(/\{(\d+)\}/g,(a,s)=>{let c=Number.parseInt(s,10);return c<t[0].length?String(t[0][c]):a});let n=/%([sdijfo%])/g,r=0,o=e.replace(n,(a,s)=>{if(s==="%")return"%";if(r>=t.length)return a;let c=t[r++];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 a}});if(r<t.length)o+=` ${t.slice(r).map((a)=>typeof a==="object"?JSON.stringify(a,null,2):String(a)).join(" ")}`;return o}formatMarkdown(e){if(!e)return e;let t=e;return t=t.replace(/\[([^\]]+)\]\(([^)]+)\)/g,(n,r,o)=>{let a=j.underline(j.blue(r)),s=this.toAbsoluteFilePath(o);if(s&&this.shouldStyleConsole()&&this.supportsHyperlinks()){let c=`file://${encodeURI(s)}`,i="\x1B]8;;",d="\x1B\\";return`\x1B]8;;${c}\x1B\\${a}\x1B]8;;\x1B\\`}if(this.shouldStyleConsole()&&this.supportsHyperlinks())return`\x1B]8;;${o}\x1B\\${a}\x1B]8;;\x1B\\`;return a}),t=t.replace(/`([^`]+)`/g,(n,r)=>j.bgGray(r)),t=t.replace(/\*\*([^*]+)\*\*/g,(n,r)=>j.bold(r)),t=t.replace(/(?<!\*)\*([^*]+)\*(?!\*)/g,(n,r)=>j.italic(r)),t=t.replace(/(?<!_)_([^_]+)_(?!_)/g,(n,r)=>j.italic(r)),t=t.replace(/~([^~]+)~/g,(n,r)=>j.strikethrough(r)),t}supportsHyperlinks(){if(G())return!1;let e=_.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 n=_.env.HOME||"";if(n)t=t.replace(/^~(?=$|\/)/,n)}if(Hr(t)||t.startsWith("./")||t.startsWith("../"))t=Vr(t);else return null;return Ne(t)?t:null}catch{return null}}buildOutputTexts(e){let t=this.shouldStyleConsole()?this.formatMarkdown(e):e,n=e.replace(this.ANSI_PATTERN,"");return{consoleText:t,fileText:n}}async log(e,t,...n){let r=new Date,o=this.formatConsoleTimestamp(r),a=this.formatFileTimestamp(r),s,c;if(t instanceof Error)s=t.message,c=t.stack;else s=this.formatMessage(t,n);let{consoleText:i,fileText:d}=this.buildOutputTexts(s);if(this.shouldStyleConsole()){let m=this.options.showIcons===!1?"":$o[e],u=this.options.showTags!==!1&&this.name?j.gray(this.formatTag(this.name)):"",p;switch(e){case"debug":p=this.formatConsoleMessage({timestamp:o,icon:m,tag:u,message:j.gray(i),level:e}),console.error(p);break;case"info":p=this.formatConsoleMessage({timestamp:o,icon:m,tag:u,message:i,level:e}),console.warn(p);break;case"success":p=this.formatConsoleMessage({timestamp:o,icon:m,tag:u,message:j.green(i),level:e}),console.error(p);break;case"warning":p=this.formatConsoleMessage({timestamp:o,icon:m,tag:u,message:i,level:e}),console.warn(p);break;case"error":if(p=this.formatConsoleMessage({timestamp:o,icon:m,tag:u,message:i,level:e}),console.error(p),c){let h=c.split(`
11
+ `);for(let y of h)if(y.trim()&&!y.includes(s))console.error(this.formatConsoleMessage({timestamp:o,message:j.gray(` ${y}`),level:e,showTimestamp:!1}))}break}}else if(!G()){if(console.error(`${a} ${this.environment}.${e.toUpperCase()}: ${s}`),c)console.error(c)}if(!this.shouldLog(e))return;let l=`${a} ${this.environment}.${e.toUpperCase()}: ${d}
12
+ `;if(c)l+=`${c}
13
+ `;if(l=l.replace(this.ANSI_PATTERN,""),this.shouldWriteToFile())await this.writeToFile(l)}progress(e,t=""){let n={update:(c,i)=>{},finish:(c)=>{},interrupt:(c,i)=>{}};if(!this.enabled)return n;let r=30;if(this.activeProgressBar={total:Math.max(1,e||1),current:0,message:t||"",barLength:r,lastRenderedLine:""},this.shouldStyleConsole()&&!G()&&_.stdout.isTTY)this.renderProgressBar(this.activeProgressBar);return{update:(c,i)=>{if(!this.enabled||!this.activeProgressBar)return;if(this.activeProgressBar.current=Math.min(Math.max(0,c),this.activeProgressBar.total),i!==void 0)this.activeProgressBar.message=i;if(this.shouldStyleConsole()&&!G()&&_.stdout.isTTY)this.renderProgressBar(this.activeProgressBar)},finish:(c)=>{if(!this.activeProgressBar)return;this.finishProgressBar(this.activeProgressBar,c)},interrupt:(c,i="info")=>{if(!G()&&_.stdout.isTTY)_.stdout.write(`
14
+ `);if(this[i==="warning"?"warn":i](c),this.activeProgressBar&&this.shouldStyleConsole()&&!G()&&_.stdout.isTTY)this.renderProgressBar(this.activeProgressBar)}}}time(e){let t=performance.now();if(this.shouldStyleConsole()){let n=this.options.showTags!==!1&&this.name?j.gray(this.formatTag(this.name)):"",r=this.formatConsoleTimestamp(new Date);console.error(this.formatConsoleMessage({timestamp:r,icon:this.options.showIcons===!1?"":j.blue("\u25D0"),tag:n,message:`${j.cyan(e)}...`}))}return async(n)=>{if(!this.enabled)return;let r=performance.now(),o=Math.round(r-t),a=`${e} completed in ${o}ms`,s=new Date,c=this.formatConsoleTimestamp(s),d=`${this.formatFileTimestamp(s)} ${this.environment}.INFO: ${a}`;if(n)d+=` ${JSON.stringify(n)}`;if(d+=`
15
+ `,d=d.replace(this.ANSI_PATTERN,""),this.shouldStyleConsole()){let l=this.options.showTags!==!1&&this.name?j.gray(this.formatTag(this.name)):"";console.error(this.formatConsoleMessage({timestamp:c,icon:this.options.showIcons===!1?"":j.green("\u2713"),tag:l,message:`${a}${n?` ${JSON.stringify(n)}`:""}`}))}else if(!G())console.error(d.trim());if(this.shouldWriteToFile())await this.writeToFile(d)}}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}`,n=new Me(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(n),n}createReadStream(){if(G())throw Error("createReadStream is not supported in browser environments");if(!Ne(this.currentLogFile))throw Error(`Log file does not exist: ${this.currentLogFile}`);return pn(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 n=this.keys.get(this.currentKeyId);try{let r=re.isBuffer(e)?e:re.from(e,"base64"),o=r.subarray(0,16),a=r.subarray(r.length-16),s=r.subarray(16,r.length-16),c=Cr("aes-256-gcm",n,o);c.setAuthTag(a);let i=c.update(s),d=c.final(),l=i.length+d.length,m=re.allocUnsafe(l);return i.copy(m,0),d.copy(m,i.length),m.toString("utf8")}catch(r){throw Error(`Decryption failed: ${r instanceof Error?r.message:String(r)}`)}}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,n=this.formatConsoleTimestamp(t),r=this.formatFileTimestamp(t),{consoleText:o,fileText:a}=this.buildOutputTexts(e);if(this.shouldStyleConsole()){let c=o.split(`
16
+ `),i=Math.max(...c.map((u)=>u.length))+2,d=`\u250C${"\u2500".repeat(i)}\u2510`,l=`\u2514${"\u2500".repeat(i)}\u2518`,m=c.map((u)=>{return this.formatConsoleMessage({timestamp:n,message:j.cyan(u),showTimestamp:!1})});console.error(this.formatConsoleMessage({timestamp:n,message:j.cyan(d),showTimestamp:!1})),m.forEach((u)=>console.error(u)),console.error(this.formatConsoleMessage({timestamp:n,message:j.cyan(l),showTimestamp:!1}))}else if(!G())console.error(`${r} ${this.environment}.INFO: [BOX] ${a}`);let s=`${r} ${this.environment}.INFO: [BOX] ${a}
17
+ `.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(`${j.cyan("?")} ${e} (y/n) `);let n=(r)=>{let o=r.toString().trim().toLowerCase();_.stdin.removeListener("data",n);try{if(typeof _.stdin.setRawMode==="function")_.stdin.setRawMode(!1)}catch{}_.stdin.pause(),console.error(""),t(o==="y"||o==="yes")};try{if(typeof _.stdin.setRawMode==="function")_.stdin.setRawMode(!0)}catch{}_.stdin.resume(),_.stdin.once("data",n)})}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 n=e;if(t&&t.length>0){let i=/%([sdijfo%])/g,d=0;if(n=e.replace(i,(l,m)=>{if(m==="%")return"%";if(d>=t.length)return l;let u=t[d++];switch(m){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 l}}),d<t.length)n+=` ${t.slice(d).map((l)=>typeof l==="object"?JSON.stringify(l,null,2):String(l)).join(" ")}`}let{consoleText:r,fileText:o}=this.buildOutputTexts(n);if(this.shouldStyleConsole()){let i=this.options.showTags!==!1&&this.name?j.gray(this.formatTag(this.name)):"",d=this.options.showIcons===!1?"":`${j.blue("\u25D0")} `;console.error(`${d}${i} ${j.cyan(r)}`)}let c=`[${new Date().toISOString()}] ${this.environment}.INFO: [START] ${o}
18
+ `.replace(this.ANSI_PATTERN,"");if(this.shouldWriteToFile())await this.writeToFile(c)}renderProgressBar(e,t=!1){if(!this.enabled||!this.shouldStyleConsole()||!_.stdout.isTTY)return;let n=Math.min(100,Math.max(0,Math.round(e.current/e.total*100))),r=Math.round(e.barLength*n/100),o=e.barLength-r,a=j.green("\u2501".repeat(r)),s=j.gray("\u2501".repeat(o)),c=`[${a}${s}]`,i=`${n}%`.padStart(4),d=e.message?` ${e.message}`:"",l=this.options.showIcons===!1?"":t||n===100?j.green("\u2713"):j.blue("\u25B6"),m=this.options.showTags!==!1&&this.name?` ${j.gray(this.formatTag(this.name))}`:"",u=`\r${l}${m} ${c} ${i}${d}`,p=_.stdout.columns||80,h=" ".repeat(Math.max(0,p-u.replace(this.ANSI_PATTERN,"").length));if(e.lastRenderedLine=`${u}${h}`,_.stdout.write(e.lastRenderedLine),t)_.stdout.write(`
19
+ `)}finishProgressBar(e,t){if(!this.enabled||!this.fancy||G()||!_.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 Ze(this.config.logDirectory),n=[];for(let r of t){if(!(e.name?new RegExp(e.name.replace("*",".*")).test(r):r.startsWith(this.name))||!r.endsWith(".log"))continue;let a=fe(this.config.logDirectory,r);if(e.before)try{if((await we(a)).mtime>=e.before)continue}catch(s){console.error(`Failed to get stats for file ${a}:`,s);continue}n.push(a)}if(n.length===0){console.warn("No log files matched the criteria for clearing.");return}console.warn(`Preparing to delete ${n.length} log file(s)...`);for(let r of n)try{await xe(r),console.warn(`Deleted log file: ${r}`)}catch(o){console.error(`Failed to delete log file ${r}:`,o)}console.warn("Log clearing process finished.")}catch(t){console.error("Error during log clearing process:",t)}}}var qc=new Me("stacks");class P 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,n])=>`${t}: ${n}`).join(", ")})`:"";return`${this.name} [${this.code}]: ${this.message}${e}`}}class Zn extends P{code="CONFIG_NOT_FOUND";constructor(e,t,n){let r=n?` or alias "${n}"`:"";super(`Configuration "${e}"${r} not found`,{configName:e,alias:n,searchPaths:t,searchPathCount:t.length})}}class Je extends P{code="CONFIG_LOAD_ERROR";constructor(e,t,n){super(`Failed to load configuration from "${e}": ${t.message}`,{configPath:e,configName:n,originalError:t.name,originalMessage:t.message});this.cause=t}}class xn extends P{code="CONFIG_VALIDATION_ERROR";constructor(e,t,n){super(`Configuration validation failed for "${e}"`,{configPath:e,configName:n,validationErrors:t,errorCount:t.length})}}class Ln extends P{code="CONFIG_MERGE_ERROR";constructor(e,t,n,r){super(`Failed to merge configuration from "${e}" with "${t}": ${n.message}`,{sourcePath:e,targetPath:t,configName:r,originalError:n.name,originalMessage:n.message});this.cause=n}}class Tt extends P{code="ENV_VAR_ERROR";constructor(e,t,n,r){super(`Failed to parse environment variable "${e}" with value "${t}" as ${n}`,{envKey:e,envValue:t,expectedType:n,configName:r})}}class Rn extends P{code="FILE_SYSTEM_ERROR";constructor(e,t,n){super(`File system ${e} failed for "${t}": ${n.message}`,{operation:e,path:t,originalError:n.name,originalMessage:n.message});this.cause=n}}class Bn extends P{code="TYPE_GENERATION_ERROR";constructor(e,t,n){super(`Failed to generate types from "${e}" to "${t}": ${n.message}`,{configDir:e,outputPath:t,originalError:n.name,originalMessage:n.message});this.cause=n}}class Qe extends P{code="SCHEMA_VALIDATION_ERROR";constructor(e,t,n){super(`Schema validation failed${n?` for config "${n}"`:""}`,{schemaPath:e,configName:n,validationErrors:t,errorCount:t.length})}}class Un extends P{code="BROWSER_CONFIG_ERROR";constructor(e,t,n,r){super(`Failed to fetch configuration from "${e}": ${t} ${n}`,{endpoint:e,status:t,statusText:n,configName:r})}}class Gn extends P{code="PLUGIN_ERROR";constructor(e,t,n){super(`Plugin "${e}" failed during ${t}: ${n.message}`,{pluginName:e,operation:t,originalError:n.name,originalMessage:n.message});this.cause=n}}var ke={configNotFound(e,t,n){return new Zn(e,t,n)},configLoad(e,t,n){return new Je(e,t,n)},configValidation(e,t,n){return new xn(e,t,n)},configMerge(e,t,n,r){return new Ln(e,t,n,r)},envVar(e,t,n,r){return new Tt(e,t,n,r)},fileSystem(e,t,n){return new Rn(e,t,n)},typeGeneration(e,t,n){return new Bn(e,t,n)},schemaValidation(e,t,n){return new Qe(e,t,n)},browserConfig(e,t,n,r){return new Un(e,t,n,r)},plugin(e,t,n){return new Gn(e,t,n)}};async function qo(e,t={}){let{maxRetries:n=3,retryDelay:r=1000,isRetryable:o=()=>!0,fallback:a}=t,s=Error("Unknown error occurred");for(let c=0;c<=n;c++)try{return await e()}catch(i){if(s=i instanceof Error?i:Error(String(i)),c===n||!o(s))break;if(r>0)await new Promise((d)=>setTimeout(d,r))}if(a!==void 0)return a;throw s instanceof Error?s:Error(`Unknown error: ${String(s)}`)}class Nt{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,n={}){let{prefix:r,useCamelCase:o=!0,useBackwardCompatibility:a=!0,customParsers:s={},verbose:c=!1,trackPerformance:i=!0}=n,d=async()=>{if(!e)return{config:t,source:{type:"environment",priority:50,timestamp:new Date}};let l=r||this.generateEnvPrefix(e),m={...t};return this.processObject(m,[],l,{useCamelCase:o,useBackwardCompatibility:a,customParsers:s,verbose:c,configName:e}),{config:m,source:{type:"environment",priority:50,timestamp:new Date}}};if(i)return _t.track("applyEnvironmentVariables",d,{configName:e});return d()}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,n,r){for(let[o,a]of Object.entries(e)){let s=[...t,o],c=s.map((l)=>this.formatEnvKey(l,r.useCamelCase)),i=`${n}_${c.join("_")}`,d=r.useBackwardCompatibility?`${n}_${s.map((l)=>l.toUpperCase()).join("_")}`:null;if(r.verbose);if(typeof a==="object"&&a!==null&&!Array.isArray(a))this.processObject(a,s,n,r);else{let l=Re.env[i]||(d?Re.env[d]:void 0);if(l!==void 0){if(r.verbose){let m=Re.env[i]?i:d}try{e[o]=this.parseEnvironmentValue(l,typeof a,i,r.customParsers,r.configName)}catch(m){if(m instanceof Tt)throw m;throw ke.envVar(i,l,typeof a,r.configName)}}}}}parseEnvironmentValue(e,t,n,r,o){for(let[a,s]of Object.entries(r))try{return s(e)}catch{continue}for(let a of this.defaultParsers)if(a.canParse(e,t))try{return a.parse(e)}catch{throw ke.envVar(n,e,`${t} (via ${a.name} parser)`,o)}return e}getEnvironmentVariables(e){let t={},n=e.toUpperCase();for(let[r,o]of Object.entries(Re.env))if(r.startsWith(n)&&o!==void 0)t[r]=o;return t}validateEnvironmentVariable(e,t,n){let r=[];if(!/^[A-Z_][A-Z0-9_]*$/.test(e))r.push(`Environment variable key "${e}" should only contain uppercase letters, numbers, and underscores`);if(n)try{this.parseEnvironmentValue(e,t,n,{})}catch(o){r.push(`Cannot parse value "${t}" as ${n}: ${o}`)}return{isValid:r.length===0,errors:r}}generateEnvVarDocs(e,t,n={}){let{prefix:r,format:o="text"}=n,a=r||this.generateEnvPrefix(e),s=[];switch(this.extractEnvVarInfo(t,[],a,s),o){case"markdown":return this.formatAsMarkdown(s,e);case"json":return JSON.stringify(s,null,2);default:return this.formatAsText(s,e)}}extractEnvVarInfo(e,t,n,r){for(let[o,a]of Object.entries(e)){let s=[...t,o],c=`${n}_${s.map((i)=>this.formatEnvKey(i,!0)).join("_")}`;if(typeof a==="object"&&a!==null&&!Array.isArray(a))this.extractEnvVarInfo(a,s,n,r);else r.push({key:c,type:Array.isArray(a)?"array":typeof a,description:`Configuration for ${s.join(".")}`,example:this.generateExample(a)})}}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 n=`Environment Variables for ${t}:
20
20
 
21
21
  `;for(let r of e)n+=`${r.key}
22
22
  `,n+=` Type: ${r.type}
@@ -28,7 +28,7 @@ var ce=import.meta.require;var{Glob:fr,YAML:fs}=globalThis.Bun;import{stat as br
28
28
  `;n+=`| Variable | Type | Description | Example |
29
29
  `,n+=`|----------|------|-------------|----------|
30
30
  `;for(let r of e)n+=`| \`${r.key}\` | ${r.type} | ${r.description} | \`${r.example}\` |
31
- `;return n}}function go(e,t,n={}){return Sn(e,t,n,new WeakMap)}function Sn(e,t,n,r){let{arrayMergeMode:o="replace",skipNullish:a=!1,customMerger:s}=n;if(t===null||t===void 0)return a?e:t;if(s){let c=s(e,t);if(c!==void 0)return c}if(Array.isArray(t)||Array.isArray(e))return Un(e,t,o,r);if(!V(t)||!V(e))return t;return _o(e,t,n,r)}function Un(e,t,n,r){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(n){case"replace":return t;case"concat":return Ao(e,t);case"smart":return $o(e,t,r);default:return t}return t}function Ao(e,t){let n=[...t];for(let r of e)if(!n.some((o)=>qt(o,r)))n.push(r);return n}function $o(e,t,n){if(t.length===0)return e;if(e.length===0)return t;if(V(t[0])&&V(e[0]))return qo(e,t,n);if(t.every((r)=>typeof r==="string")&&e.every((r)=>typeof r==="string")){let r=[...t];for(let o of e)if(!r.includes(o))r.push(o);return r}return t}function qo(e,t,n){let r=[...t];for(let o of e){if(!V(o)){r.push(o);continue}let a=["id","name","key","path","type"],s=!1;for(let c of a)if(c in o){if(r.find((d)=>V(d)&&(c in d)&&d[c]===o[c])){s=!0;break}}if(!s)r.push(o)}return r}function _o(e,t,n,r){let o=t;if(V(o)&&r.has(o))return r.get(o);let a={...e};if(V(o))r.set(o,a);for(let s in o){if(!Object.prototype.hasOwnProperty.call(o,s))continue;let c=o[s],i=a[s];if(n.skipNullish&&(c===null||c===void 0))continue;if(c===null||c===void 0){a[s]=c;continue}if(V(c)&&V(i))a[s]=Sn(i,c,n,r);else if(Array.isArray(c)||Array.isArray(i))a[s]=Un(i,c,n.arrayMergeMode||"smart",r);else a[s]=c}return a}function Gn(e,t,n="replace"){return go(e,t,{arrayMergeMode:n==="replace"?"replace":"smart",skipNullish:!0})}function qt(e,t){if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!qt(e[n],t[n]))return!1;return!0}if(V(e)&&V(t)){let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let o of n){if(!Object.prototype.hasOwnProperty.call(t,o))return!1;if(!qt(e[o],t[o]))return!1}return!0}return!1}function V(e){return Boolean(e&&typeof e==="object"&&!Array.isArray(e))}class On{extensions=[".ts",".js",".mjs",".cjs",".json",".mts",".cts"];async loadFromPath(e,t,n={}){let{arrayStrategy:r="replace",useCache:o=!0,cacheTtl:a,trackPerformance:s=!0,verbose:c=!1}=n;if(o){let d=Ue.getWithFileCheck("file",e);if(d){if(c)console.log(`Configuration loaded from cache: ${e}`);return d}}let i=async()=>{if(!Le(e))return null;try{let d=`?t=${Date.now()}`,m=await import(e+d),l=m.default||m,u="default"in m,p=Object.keys(m).length>0;if(!u&&!p)throw new Ie(e,Error("Configuration file is empty and exports nothing"),"unknown");if(typeof l!=="object"||l===null||Array.isArray(l))throw new Ie(e,Error("Configuration must export a valid object"),"unknown");let h={config:Gn(t,l,r),source:{type:"file",path:e,priority:100,timestamp:new Date}};if(o)Ue.setWithFileCheck("file",h,e,a);return h}catch(d){throw d instanceof Error?be.configLoad(e,d):be.configLoad(e,Error(String(d)))}};if(s)return _t.track("loadFromPath",i,{path:e});return i()}async tryLoadFromPaths(e,t,n={}){for(let r of e)try{let o=await this.loadFromPath(r,t,n);if(o)return o}catch(o){if(o instanceof Error&&o.name==="ConfigLoadError")throw o;if(n.verbose)console.warn(`Failed to load config from ${r}:`,o)}return null}generateConfigPaths(e,t,n){let r=this.generateNamePatterns(e,n),o=[];for(let a of r)for(let s of this.extensions)o.push(At(t,`${a}${s}`));return o}generateNamePatterns(e,t){let n=[];if(n.push("config",".config"),e)n.push(e,`.${e}.config`,`${e}.config`,`.${e}`);if(t){if(n.push(t,`.${t}.config`,`${t}.config`,`.${t}`),e)n.push(`${e}.${t}.config`,`.${e}.${t}.config`)}return n.filter(Boolean)}checkFileAccess(e){return ko(async()=>{return Le(e)},{maxRetries:2,retryDelay:100,fallback:!1})}async discoverConfigFiles(e,t,n){let r=[];if(!Le(e))return r;if(t||n){let o=this.generateNamePatterns(t||"",n);for(let a of o)for(let s of this.extensions){let c=At(e,`${a}${s}`);if(await this.checkFileAccess(c))r.push(c)}}else try{let{readdirSync:o}=await import("fs"),a=o(e);for(let s of a)if(this.looksLikeConfigFile(s)){let c=At(e,s);if(await this.checkFileAccess(c))r.push(c)}}catch{return[]}return r}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((n)=>n.test(e))}async validateConfigFile(e){let t=[];try{if(!Le(e))return t.push("Configuration file does not exist"),t;let n=await import(e),r=n.default||n;if(r===void 0)t.push("Configuration file must export a default value or named exports");else if(typeof r!=="object"||r===null)t.push("Configuration must be an object");else if(Array.isArray(r))t.push("Configuration cannot be an array at the root level");if(e.endsWith(".json"))try{let{readFileSync:o}=await import("fs"),a=o(e,"utf8");JSON.parse(a)}catch(o){t.push(`Invalid JSON syntax: ${o}`)}}catch(n){t.push(`Failed to load configuration file: ${n}`)}return t}async getFileModificationTime(e){try{let{statSync:t}=await import("fs");return t(e).mtime}catch{return null}}async preloadConfigurations(e,t={}){let n=new Map;return await Promise.allSettled(e.map(async(r)=>{try{let o=await this.loadFromPath(r,{},t);if(o)n.set(r,o.config)}catch(o){if(t.verbose)console.warn(`Failed to preload ${r}:`,o)}})),n}}var Eo=/^https?:\/\//;class Yn{async validateConfiguration(e,t,n={}){let{stopOnFirstError:r=!1,validateRequired:o=!0,validateTypes:a=!0,customRules:s=[],trackPerformance:c=!0,verbose:i=!1}=n,d=async()=>{let m=[],l=[],u={stopOnFirstError:r,validateRequired:o,validateTypes:a,customRules:s,trackPerformance:c,verbose:i};try{if(typeof t==="string")return await this.validateWithSchemaFile(e,t,u);else if(Array.isArray(t))return this.validateWithRules(e,[...t,...s],u);else return this.validateWithJSONSchema(e,t,u)}catch(p){return m.push({path:"",message:`Validation failed: ${p}`,rule:"system"}),{isValid:!1,errors:m,warnings:l}}};if(c)return await _t.track("validateConfiguration",d);return d()}async validateWithSchemaFile(e,t,n){try{if(!jo(t))throw new Je(t,[{path:"",message:"Schema file does not exist"}]);let r=await import(t),o=r.default||r;if(Array.isArray(o))return this.validateWithRules(e,o,n);else return this.validateWithJSONSchema(e,o,n)}catch(r){throw new Je(t,[{path:"",message:`Failed to load schema: ${r}`}])}}validateWithJSONSchema(e,t,n){let r=[],o=[];return this.validateObjectAgainstSchema(e,t,"",r,o,n),{isValid:r.length===0,errors:r,warnings:o}}validateObjectAgainstSchema(e,t,n,r,o,a){if(a.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(r.push({path:n,message:`Expected type ${c.join(" or ")}, got ${s}`,expected:c.join(" or "),actual:s,rule:"type"}),a.stopOnFirstError)return}}if(t.enum&&!t.enum.includes(e)){if(r.push({path:n,message:`Value must be one of: ${t.enum.join(", ")}`,expected:t.enum.join(", "),actual:e,rule:"enum"}),a.stopOnFirstError)return}if(typeof e==="string"){if(t.minLength!==void 0&&e.length<t.minLength)r.push({path:n,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)r.push({path:n,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))r.push({path:n,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)r.push({path:n,message:`Value must be at least ${t.minimum}`,expected:`>= ${t.minimum}`,actual:e,rule:"minimum"});if(t.maximum!==void 0&&e>t.maximum)r.push({path:n,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=n?`${n}[${s}]`:`[${s}]`;if(this.validateObjectAgainstSchema(e[s],t.items,c,r,o,a),a.stopOnFirstError&&r.length>0)return}if(e&&typeof e==="object"&&!Array.isArray(e)){let s=e;if(a.validateRequired&&t.required){for(let c of t.required)if(!(c in s)){if(r.push({path:n?`${n}.${c}`:c,message:`Missing required property '${c}'`,expected:"required",rule:"required"}),a.stopOnFirstError)return}}if(t.properties){for(let[c,i]of Object.entries(t.properties))if(c in s){let d=n?`${n}.${c}`:c;if(this.validateObjectAgainstSchema(s[c],i,d,r,o,a),a.stopOnFirstError&&r.length>0)return}}if(t.additionalProperties===!1){let c=new Set(Object.keys(t.properties||{}));for(let i of Object.keys(s))if(!c.has(i))o.push({path:n?`${n}.${i}`:i,message:`Additional property '${i}' is not allowed`,rule:"additionalProperties"})}}}validateWithRules(e,t,n){let r=[],o=[];for(let a of t)try{let s=this.getValueByPath(e,a.path),c=this.validateWithRule(s,a,a.path);if(r.push(...c),n.stopOnFirstError&&r.length>0)break}catch(s){r.push({path:a.path,message:`Rule validation failed: ${s}`,rule:"system"})}return{isValid:r.length===0,errors:r,warnings:o}}validateWithRule(e,t,n){let r=[];if(t.required&&(e===void 0||e===null))return r.push({path:n,message:t.message||`Property '${n}' is required`,expected:"required",rule:"required"}),r;if(e===void 0||e===null)return r;if(t.type){let o=Array.isArray(e)?"array":typeof e;if(o!==t.type)r.push({path:n,message:t.message||`Expected type ${t.type}, got ${o}`,expected:t.type,actual:o,rule:"type"})}if(t.min!==void 0){let o=Array.isArray(e)?e.length:typeof e==="string"?e.length:typeof e==="number"?e:0;if(o<t.min)r.push({path:n,message:t.message||`Value must be at least ${t.min}`,expected:`>= ${t.min}`,actual:o,rule:"min"})}if(t.max!==void 0){let o=Array.isArray(e)?e.length:typeof e==="string"?e.length:typeof e==="number"?e:0;if(o>t.max)r.push({path:n,message:t.message||`Value must not exceed ${t.max}`,expected:`<= ${t.max}`,actual:o,rule:"max"})}if(t.pattern&&typeof e==="string"){if(!t.pattern.test(e))r.push({path:n,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))r.push({path:n,message:t.message||`Value must be one of: ${t.enum.join(", ")}`,expected:t.enum.join(", "),actual:e,rule:"enum"});if(t.validator){let o=t.validator(e);if(o)r.push({path:n,message:t.message||o,rule:"custom"})}return r}getValueByPath(e,t){if(!t)return e;let n=t.split("."),r=e;for(let o of n)if(r&&typeof r==="object"&&o in r)r=r[o];else return;return r}generateRulesFromInterface(e){let t=[],n=e.matchAll(/(\w+)(\?)?:\s*(\w+)/g);for(let r of n){let[,o,a,s]=r;t.push({path:o,required:!a,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:Eo},{path:"timeout",type:"number",min:0},{path:"retries",type:"number",min:0,max:10}]}}}var oe=new We("bunfig",{showTags:!0});class Xn{fileLoader=new On;envProcessor=new Zt;validator=new Yn;async loadConfig(e){let t=Date.now(),{cache:n,performance:r,schema:o,validate:a,...s}=e;try{if(n?.enabled){let i=this.checkCache(s.name||"",s);if(i)return i}let c;try{c=await this.loadConfigurationStrategies(s,!0,n)}catch(i){let d=s.__strictErrorHandling;if(i instanceof Error&&i.name==="ConfigNotFoundError"){if(d)throw i;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(i instanceof Error&&i.name==="ConfigLoadError"){let m=i.message.includes("EACCES")||i.message.includes("EPERM")||i.message.includes("permission denied"),l=!m&&(i.message.includes("syntax")||i.message.includes("Expected")||i.message.includes("Unexpected")||i.message.includes("BuildMessage")||i.message.includes("errors building")),u=i.message.includes("Configuration must export a valid object")||i.message.includes("Configuration file is empty and exports nothing");if(d&&(u||m))throw i;if(l&&(!d||!u))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(!d)c={...await this.applyEnvironmentVariables(s.name||"",s.defaultConfig,s.checkEnv!==!1,s.verbose||!1),warnings:[`Configuration loading error, using defaults: ${i.message}`]};else throw i}else c={...await this.applyEnvironmentVariables(s.name||"",s.defaultConfig,s.checkEnv!==!1,s.verbose||!1),warnings:[`Configuration loading failed, using defaults: ${i instanceof Error?i.message:String(i)}`]}}if(o||a)await this.validateConfiguration(c.config,o,a,s.name);if(n?.enabled&&c)this.cacheResult(s.name||"",c,n,s);if(r?.enabled){let i={operation:"loadConfig",duration:Date.now()-t,configName:s.name,timestamp:new Date};if(r.onMetrics)r.onMetrics(i);if(r.slowThreshold&&i.duration>r.slowThreshold)oe.warn(`Slow configuration loading detected: ${i.duration}ms for ${s.name}`);c.metrics=i}return c}catch(c){let i=Date.now()-t;throw oe.error(`Configuration loading failed after ${i}ms:`,[c instanceof Error?c:Error(String(c))]),c}}async loadConfigurationStrategies(e,t=!1,n){let{name:r="",alias:o,cwd:a,configDir:s,defaultConfig:c,checkEnv:i=!0,arrayStrategy:d="replace",verbose:m=!1}=e,l=a||Ce.cwd(),u=[],p=await this.loadLocalConfiguration(r,o,l,s,c,d,m,i,n);if(p)return u.push(...this.getLocalSearchPaths(r,o,l,s)),this.finalizeResult(p,u,i,r,m);let f=await this.loadHomeConfiguration(r,o,c,d,m,i);if(f)return u.push(...this.getHomeSearchPaths(r,o)),this.finalizeResult(f,u,i,r,m);let y=await this.loadPackageJsonConfiguration(r,o,l,c,d,m,i);if(y)return u.push(H(l,"package.json")),this.finalizeResult(y,u,i,r,m);if(u.push(...this.getAllSearchPaths(r,o,l,s)),t)throw be.configNotFound(r,u,o);return{...await this.applyEnvironmentVariables(r,c,i,m),warnings:[`No configuration file found for "${r}"${o?` or alias "${o}"`:""}, using defaults with environment variables`]}}async loadLocalConfiguration(e,t,n,r,o,a,s,c,i){let d=c?Be(e,o,s):o,m=this.getLocalDirectories(n,r);for(let l of m){if(s)oe.info(`Searching for configuration in: ${l}`);let u=this.fileLoader.generateConfigPaths(e,l,t),p=await this.fileLoader.tryLoadFromPaths(u,d,{arrayStrategy:a,verbose:s,cacheTtl:i?.ttl,useCache:!i?.ttl||i.ttl>100});if(p){if(s)oe.success(`Configuration loaded from: ${p.source.path}`);return p}}return null}async loadHomeConfiguration(e,t,n,r,o,a){if(!e)return null;let s=a?Be(e,n,o):n,c=[H(le(),".config",e),H(le(),".config"),le()];for(let i of c){if(o)oe.info(`Checking home directory: ${i}`);let d=this.fileLoader.generateConfigPaths(e,i,t),m=await this.fileLoader.tryLoadFromPaths(d,s,{arrayStrategy:r,verbose:o});if(m){if(o)oe.success(`Configuration loaded from home directory: ${m.source.path}`);return m}}return null}async loadPackageJsonConfiguration(e,t,n,r,o,a,s){let c=s?Be(e,r,a):r;try{let i=H(n,"package.json");if(!Zr(i))return null;let d=await import(i),m=d[e],l=e;if(!m&&t)m=d[t],l=t;if(m&&typeof m==="object"&&!Array.isArray(m)){if(a)oe.success(`Configuration loaded from package.json: ${l}`);return{config:Gn(c,m,o),source:{type:"package.json",path:i,priority:30,timestamp:new Date}}}}catch(i){if(a)oe.warn("Failed to load package.json:",[i instanceof Error?i:Error(String(i))])}return null}async applyEnvironmentVariables(e,t,n,r){if(!n||!e||typeof t!=="object"||t===null||Array.isArray(t))return{config:t,source:{type:"default",priority:10,timestamp:new Date}};return{config:Be(e,t,r),source:{type:"environment",priority:20,timestamp:new Date}}}async finalizeResult(e,t,n,r,o){return{config:e.config,source:e.source,path:e.source.path}}async validateConfiguration(e,t,n,r){let o=[];if(n){let a=n(e);if(a)o.push(...a)}if(t){let a=await this.validator.validateConfiguration(e,t);if(!a.isValid)o.push(...a.errors.map((s)=>s.path?`${s.path}: ${s.message}`:s.message))}if(o.length>0)throw be.configValidation(r||"unknown",o,r)}checkCache(e,t){let n=this.generateCacheKey(e,t);return Ue.get(n)||null}cacheResult(e,t,n,r){let o=this.generateCacheKey(e,r);Ue.set(o,t,void 0,n.ttl)}generateCacheKey(e,t){let n=[e];if(t.alias)n.push(`alias:${t.alias}`);if(t.cwd)n.push(`cwd:${t.cwd}`);if(t.configDir)n.push(`configDir:${t.configDir}`);if("checkEnv"in t)n.push(`checkEnv:${t.checkEnv}`);return n.join("|")}getLocalDirectories(e,t){return Array.from(new Set([e,H(e,"config"),H(e,".config"),t?H(e,t):void 0].filter(Boolean)))}getAllSearchPaths(e,t,n,r){let o=[];return o.push(...this.getLocalSearchPaths(e,t,n,r)),o.push(...this.getHomeSearchPaths(e,t)),o.push(H(n,"package.json")),o}getLocalSearchPaths(e,t,n,r){let o=this.getLocalDirectories(n,r),a=[];for(let s of o)a.push(...this.fileLoader.generateConfigPaths(e,s,t));return a}getHomeSearchPaths(e,t){if(!e)return[];let n=[H(le(),".config",e),H(le(),".config"),le()],r=[];for(let o of n)r.push(...this.fileLoader.generateConfigPaths(e,o,t));return r}async loadConfigWithResult(e){return this.loadConfig(e)}}var $t=new Xn;async function Fn(e){let t="defaultConfig"in e&&e.defaultConfig!==void 0?e.defaultConfig:{},n="cache"in e||"performance"in e||"schema"in e||"validate"in e;try{let r;if(n)r=await $t.loadConfig(e);else r=await $t.loadConfig({...e,defaultConfig:t,cache:{enabled:!0},performance:{enabled:!1}});return r?.config??t}catch(r){let o=r instanceof Error?r.name:"UnknownError",a=r instanceof Error?r.message:String(r);if(!(o==="ConfigNotFoundError"||o==="ConfigLoadError"||o==="ConfigValidationError"||a.includes("config"))&&e.verbose)oe.warn("Unexpected error loading config, using defaults:",[r instanceof Error?r:Error(String(r))]);let c=n?{...e,defaultConfig:t}:{...e,defaultConfig:t,cache:{enabled:!0},performance:{enabled:!1}};if("checkEnv"in e?e.checkEnv!==!1:!0)return(await $t.applyEnvironmentVariables(c.name||"",t,!0,c.verbose||!1))?.config??t;return t}}function Be(e,t,n=!1){let r=new Zt,o=e.toUpperCase().replace(/[^A-Z0-9]/g,"_");function a(s,c=[]){let i={...s};for(let[d,m]of Object.entries(s)){let l=[...c,d],u=[`${o}_${l.join("_").toUpperCase()}`,`${o}_${l.map((y)=>y.toUpperCase()).join("")}`,`${o}_${l.map((y)=>y.replace(/([A-Z])/g,"_$1").toUpperCase()).join("")}`],p,f;for(let y of u)if(p=Ce.env[y],p!==void 0){f=y;break}if(p!==void 0&&f)if(typeof m==="boolean")i[d]=["true","1","yes"].includes(p.toLowerCase());else if(typeof m==="number"){let y=Number(p);if(!Number.isNaN(y))i[d]=y}else if(Array.isArray(m))try{i[d]=JSON.parse(p)}catch{i[d]=p.split(",").map((y)=>y.trim())}else i[d]=p;else if(m&&typeof m==="object"&&!Array.isArray(m))i[d]=a(m,l)}return i}return a(t)}var bc=H(Ce.cwd(),"config"),kc=H(Ce.cwd(),"src/generated");var zo={docsDir:"./docs",outDir:"./docs",theme:"vitepress",nav:[{text:"Guide",link:"/install"},{text:"API",link:"/advanced#api-reference"},{text:"Examples",link:"/examples"}],plugins:[],markdown:{title:"BunPress Documentation",meta:{description:"Documentation built with BunPress",generator:"BunPress",viewport:"width=device-width, initial-scale=1.0"},sidebar:{"/":[{text:"Getting Started",items:[{text:"Introduction",link:"/"},{text:"Installation",link:"/install"},{text:"Quick Start",link:"/quick-start"},{text:"Usage",link:"/usage"},{text:"Configuration",link:"/config"}]},{text:"Core Features",items:[{text:"Features Overview",link:"/features"},{text:"Markdown Extensions",link:"/markdown-extensions"},{text:"Syntax Highlighting",link:"/syntax-highlighting"},{text:"Table of Contents",link:"/table-of-contents"},{text:"CLI Commands",link:"/cli"}]},{text:"SEO & Analytics",items:[{text:"SEO Features",link:"/seo"},{text:"Analytics (Fathom)",link:"/config#fathom-analytics"}]},{text:"Advanced",items:[{text:"Advanced Usage",link:"/advanced"},{text:"Examples",link:"/examples"},{text:"Best Practices",link:"/best-practices"}]},{text:"More",items:[{text:"Showcase",link:"/showcase"},{text:"Partners",link:"/partners"},{text:"License",link:"/license"},{text:"Postcardware",link:"/postcardware"}]}]},css:`
31
+ `;return n}}function _o(e,t,n={}){return On(e,t,n,new WeakMap)}function On(e,t,n,r){let{arrayMergeMode:o="replace",skipNullish:a=!1,customMerger:s}=n;if(t===null||t===void 0)return a?e:t;if(s){let c=s(e,t);if(c!==void 0)return c}if(Array.isArray(t)||Array.isArray(e))return Sn(e,t,o,r);if(!H(t)||!H(e))return t;return To(e,t,n,r)}function Sn(e,t,n,r){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(n){case"replace":return t;case"concat":return jo(e,t);case"smart":return zo(e,t,r);default:return t}return t}function jo(e,t){let n=[...t];for(let r of e)if(!n.some((o)=>qt(o,r)))n.push(r);return n}function zo(e,t,n){if(t.length===0)return e;if(e.length===0)return t;if(H(t[0])&&H(e[0]))return Eo(e,t,n);if(t.every((r)=>typeof r==="string")&&e.every((r)=>typeof r==="string")){let r=[...t];for(let o of e)if(!r.includes(o))r.push(o);return r}return t}function Eo(e,t,n){let r=[...t];for(let o of e){if(!H(o)){r.push(o);continue}let a=["id","name","key","path","type"],s=!1;for(let c of a)if(c in o){if(r.find((d)=>H(d)&&(c in d)&&d[c]===o[c])){s=!0;break}}if(!s)r.push(o)}return r}function To(e,t,n,r){let o=t;if(H(o)&&r.has(o))return r.get(o);let a={...e};if(H(o))r.set(o,a);for(let s in o){if(!Object.prototype.hasOwnProperty.call(o,s))continue;let c=o[s],i=a[s];if(n.skipNullish&&(c===null||c===void 0))continue;if(c===null||c===void 0){a[s]=c;continue}if(H(c)&&H(i))a[s]=On(i,c,n,r);else if(Array.isArray(c)||Array.isArray(i))a[s]=Sn(i,c,n.arrayMergeMode||"smart",r);else a[s]=c}return a}function Yn(e,t,n="replace"){return _o(e,t,{arrayMergeMode:n==="replace"?"replace":"smart",skipNullish:!0})}function qt(e,t){if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!qt(e[n],t[n]))return!1;return!0}if(H(e)&&H(t)){let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let o of n){if(!Object.prototype.hasOwnProperty.call(t,o))return!1;if(!qt(e[o],t[o]))return!1}return!0}return!1}function H(e){return Boolean(e&&typeof e==="object"&&!Array.isArray(e))}class Fn{extensions=[".ts",".js",".mjs",".cjs",".json",".mts",".cts"];async loadFromPath(e,t,n={}){let{arrayStrategy:r="replace",useCache:o=!0,cacheTtl:a,trackPerformance:s=!0,verbose:c=!1}=n;if(o){let d=Oe.getWithFileCheck("file",e);if(d){if(c)console.log(`Configuration loaded from cache: ${e}`);return d}}let i=async()=>{if(!Be(e))return null;try{let d=`?t=${Date.now()}`,l=await import(e+d),m=l.default||l,u="default"in l,p=Object.keys(l).length>0;if(!u&&!p)throw new Je(e,Error("Configuration file is empty and exports nothing"),"unknown");if(typeof m!=="object"||m===null||Array.isArray(m))throw new Je(e,Error("Configuration must export a valid object"),"unknown");let w={config:Yn(t,m,r),source:{type:"file",path:e,priority:100,timestamp:new Date}};if(o)Oe.setWithFileCheck("file",w,e,a);return w}catch(d){throw d instanceof Error?ke.configLoad(e,d):ke.configLoad(e,Error(String(d)))}};if(s)return _t.track("loadFromPath",i,{path:e});return i()}async tryLoadFromPaths(e,t,n={}){for(let r of e)try{let o=await this.loadFromPath(r,t,n);if(o)return o}catch(o){if(o instanceof Error&&o.name==="ConfigLoadError")throw o;if(n.verbose)console.warn(`Failed to load config from ${r}:`,o)}return null}generateConfigPaths(e,t,n){let r=this.generateNamePatterns(e,n),o=[];for(let a of r)for(let s of this.extensions)o.push(At(t,`${a}${s}`));return o}generateNamePatterns(e,t){let n=[];if(n.push("config",".config"),e)n.push(e,`.${e}.config`,`${e}.config`,`.${e}`);if(t){if(n.push(t,`.${t}.config`,`${t}.config`,`.${t}`),e)n.push(`${e}.${t}.config`,`.${e}.${t}.config`)}return n.filter(Boolean)}checkFileAccess(e){return qo(async()=>{return Be(e)},{maxRetries:2,retryDelay:100,fallback:!1})}async discoverConfigFiles(e,t,n){let r=[];if(!Be(e))return r;if(t||n){let o=this.generateNamePatterns(t||"",n);for(let a of o)for(let s of this.extensions){let c=At(e,`${a}${s}`);if(await this.checkFileAccess(c))r.push(c)}}else try{let{readdirSync:o}=await import("fs"),a=o(e);for(let s of a)if(this.looksLikeConfigFile(s)){let c=At(e,s);if(await this.checkFileAccess(c))r.push(c)}}catch{return[]}return r}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((n)=>n.test(e))}async validateConfigFile(e){let t=[];try{if(!Be(e))return t.push("Configuration file does not exist"),t;let n=await import(e),r=n.default||n;if(r===void 0)t.push("Configuration file must export a default value or named exports");else if(typeof r!=="object"||r===null)t.push("Configuration must be an object");else if(Array.isArray(r))t.push("Configuration cannot be an array at the root level");if(e.endsWith(".json"))try{let{readFileSync:o}=await import("fs"),a=o(e,"utf8");JSON.parse(a)}catch(o){t.push(`Invalid JSON syntax: ${o}`)}}catch(n){t.push(`Failed to load configuration file: ${n}`)}return t}async getFileModificationTime(e){try{let{statSync:t}=await import("fs");return t(e).mtime}catch{return null}}async preloadConfigurations(e,t={}){let n=new Map;return await Promise.allSettled(e.map(async(r)=>{try{let o=await this.loadFromPath(r,{},t);if(o)n.set(r,o.config)}catch(o){if(t.verbose)console.warn(`Failed to preload ${r}:`,o)}})),n}}var Zo=/^https?:\/\//;class In{async validateConfiguration(e,t,n={}){let{stopOnFirstError:r=!1,validateRequired:o=!0,validateTypes:a=!0,customRules:s=[],trackPerformance:c=!0,verbose:i=!1}=n,d=async()=>{let l=[],m=[],u={stopOnFirstError:r,validateRequired:o,validateTypes:a,customRules:s,trackPerformance:c,verbose:i};try{if(typeof t==="string")return await this.validateWithSchemaFile(e,t,u);else if(Array.isArray(t))return this.validateWithRules(e,[...t,...s],u);else return this.validateWithJSONSchema(e,t,u)}catch(p){return l.push({path:"",message:`Validation failed: ${p}`,rule:"system"}),{isValid:!1,errors:l,warnings:m}}};if(c)return await _t.track("validateConfiguration",d);return d()}async validateWithSchemaFile(e,t,n){try{if(!No(t))throw new Qe(t,[{path:"",message:"Schema file does not exist"}]);let r=await import(t),o=r.default||r;if(Array.isArray(o))return this.validateWithRules(e,o,n);else return this.validateWithJSONSchema(e,o,n)}catch(r){throw new Qe(t,[{path:"",message:`Failed to load schema: ${r}`}])}}validateWithJSONSchema(e,t,n){let r=[],o=[];return this.validateObjectAgainstSchema(e,t,"",r,o,n),{isValid:r.length===0,errors:r,warnings:o}}validateObjectAgainstSchema(e,t,n,r,o,a){if(a.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(r.push({path:n,message:`Expected type ${c.join(" or ")}, got ${s}`,expected:c.join(" or "),actual:s,rule:"type"}),a.stopOnFirstError)return}}if(t.enum&&!t.enum.includes(e)){if(r.push({path:n,message:`Value must be one of: ${t.enum.join(", ")}`,expected:t.enum.join(", "),actual:e,rule:"enum"}),a.stopOnFirstError)return}if(typeof e==="string"){if(t.minLength!==void 0&&e.length<t.minLength)r.push({path:n,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)r.push({path:n,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))r.push({path:n,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)r.push({path:n,message:`Value must be at least ${t.minimum}`,expected:`>= ${t.minimum}`,actual:e,rule:"minimum"});if(t.maximum!==void 0&&e>t.maximum)r.push({path:n,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=n?`${n}[${s}]`:`[${s}]`;if(this.validateObjectAgainstSchema(e[s],t.items,c,r,o,a),a.stopOnFirstError&&r.length>0)return}if(e&&typeof e==="object"&&!Array.isArray(e)){let s=e;if(a.validateRequired&&t.required){for(let c of t.required)if(!(c in s)){if(r.push({path:n?`${n}.${c}`:c,message:`Missing required property '${c}'`,expected:"required",rule:"required"}),a.stopOnFirstError)return}}if(t.properties){for(let[c,i]of Object.entries(t.properties))if(c in s){let d=n?`${n}.${c}`:c;if(this.validateObjectAgainstSchema(s[c],i,d,r,o,a),a.stopOnFirstError&&r.length>0)return}}if(t.additionalProperties===!1){let c=new Set(Object.keys(t.properties||{}));for(let i of Object.keys(s))if(!c.has(i))o.push({path:n?`${n}.${i}`:i,message:`Additional property '${i}' is not allowed`,rule:"additionalProperties"})}}}validateWithRules(e,t,n){let r=[],o=[];for(let a of t)try{let s=this.getValueByPath(e,a.path),c=this.validateWithRule(s,a,a.path);if(r.push(...c),n.stopOnFirstError&&r.length>0)break}catch(s){r.push({path:a.path,message:`Rule validation failed: ${s}`,rule:"system"})}return{isValid:r.length===0,errors:r,warnings:o}}validateWithRule(e,t,n){let r=[];if(t.required&&(e===void 0||e===null))return r.push({path:n,message:t.message||`Property '${n}' is required`,expected:"required",rule:"required"}),r;if(e===void 0||e===null)return r;if(t.type){let o=Array.isArray(e)?"array":typeof e;if(o!==t.type)r.push({path:n,message:t.message||`Expected type ${t.type}, got ${o}`,expected:t.type,actual:o,rule:"type"})}if(t.min!==void 0){let o=Array.isArray(e)?e.length:typeof e==="string"?e.length:typeof e==="number"?e:0;if(o<t.min)r.push({path:n,message:t.message||`Value must be at least ${t.min}`,expected:`>= ${t.min}`,actual:o,rule:"min"})}if(t.max!==void 0){let o=Array.isArray(e)?e.length:typeof e==="string"?e.length:typeof e==="number"?e:0;if(o>t.max)r.push({path:n,message:t.message||`Value must not exceed ${t.max}`,expected:`<= ${t.max}`,actual:o,rule:"max"})}if(t.pattern&&typeof e==="string"){if(!t.pattern.test(e))r.push({path:n,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))r.push({path:n,message:t.message||`Value must be one of: ${t.enum.join(", ")}`,expected:t.enum.join(", "),actual:e,rule:"enum"});if(t.validator){let o=t.validator(e);if(o)r.push({path:n,message:t.message||o,rule:"custom"})}return r}getValueByPath(e,t){if(!t)return e;let n=t.split("."),r=e;for(let o of n)if(r&&typeof r==="object"&&o in r)r=r[o];else return;return r}generateRulesFromInterface(e){let t=[],n=e.matchAll(/(\w+)(\?)?:\s*(\w+)/g);for(let r of n){let[,o,a,s]=r;t.push({path:o,required:!a,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:Zo},{path:"timeout",type:"number",min:0},{path:"retries",type:"number",min:0,max:10}]}}}var oe=new Me("bunfig",{showTags:!0});class Xn{fileLoader=new Fn;envProcessor=new Nt;validator=new In;async loadConfig(e){let t=Date.now(),{cache:n,performance:r,schema:o,validate:a,...s}=e;try{if(n?.enabled){let i=this.checkCache(s.name||"",s);if(i)return i}let c;try{c=await this.loadConfigurationStrategies(s,!0,n)}catch(i){let d=s.__strictErrorHandling;if(i instanceof Error&&i.name==="ConfigNotFoundError"){if(d)throw i;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(i instanceof Error&&i.name==="ConfigLoadError"){let l=i.message.includes("EACCES")||i.message.includes("EPERM")||i.message.includes("permission denied"),m=!l&&(i.message.includes("syntax")||i.message.includes("Expected")||i.message.includes("Unexpected")||i.message.includes("BuildMessage")||i.message.includes("errors building")),u=i.message.includes("Configuration must export a valid object")||i.message.includes("Configuration file is empty and exports nothing");if(d&&(u||l))throw i;if(m&&(!d||!u))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(!d)c={...await this.applyEnvironmentVariables(s.name||"",s.defaultConfig,s.checkEnv!==!1,s.verbose||!1),warnings:[`Configuration loading error, using defaults: ${i.message}`]};else throw i}else c={...await this.applyEnvironmentVariables(s.name||"",s.defaultConfig,s.checkEnv!==!1,s.verbose||!1),warnings:[`Configuration loading failed, using defaults: ${i instanceof Error?i.message:String(i)}`]}}if(o||a)await this.validateConfiguration(c.config,o,a,s.name);if(n?.enabled&&c)this.cacheResult(s.name||"",c,n,s);if(r?.enabled){let i={operation:"loadConfig",duration:Date.now()-t,configName:s.name,timestamp:new Date};if(r.onMetrics)r.onMetrics(i);if(r.slowThreshold&&i.duration>r.slowThreshold)oe.warn(`Slow configuration loading detected: ${i.duration}ms for ${s.name}`);c.metrics=i}return c}catch(c){let i=Date.now()-t;throw oe.error(`Configuration loading failed after ${i}ms:`,[c instanceof Error?c:Error(String(c))]),c}}async loadConfigurationStrategies(e,t=!1,n){let{name:r="",alias:o,cwd:a,configDir:s,defaultConfig:c,checkEnv:i=!0,arrayStrategy:d="replace",verbose:l=!1}=e,m=a||We.cwd(),u=[],p=await this.loadLocalConfiguration(r,o,m,s,c,d,l,i,n);if(p)return u.push(...this.getLocalSearchPaths(r,o,m,s)),this.finalizeResult(p,u,i,r,l);let h=await this.loadHomeConfiguration(r,o,c,d,l,i);if(h)return u.push(...this.getHomeSearchPaths(r,o)),this.finalizeResult(h,u,i,r,l);let y=await this.loadPackageJsonConfiguration(r,o,m,c,d,l,i);if(y)return u.push(D(m,"package.json")),this.finalizeResult(y,u,i,r,l);if(u.push(...this.getAllSearchPaths(r,o,m,s)),t)throw ke.configNotFound(r,u,o);return{...await this.applyEnvironmentVariables(r,c,i,l),warnings:[`No configuration file found for "${r}"${o?` or alias "${o}"`:""}, using defaults with environment variables`]}}async loadLocalConfiguration(e,t,n,r,o,a,s,c,i){let d=c?Ue(e,o,s):o,l=this.getLocalDirectories(n,r);for(let m of l){if(s)oe.info(`Searching for configuration in: ${m}`);let u=this.fileLoader.generateConfigPaths(e,m,t),p=await this.fileLoader.tryLoadFromPaths(u,d,{arrayStrategy:a,verbose:s,cacheTtl:i?.ttl,useCache:!i?.ttl||i.ttl>100});if(p){if(s)oe.success(`Configuration loaded from: ${p.source.path}`);return p}}return null}async loadHomeConfiguration(e,t,n,r,o,a){if(!e)return null;let s=a?Ue(e,n,o):n,c=[D(pe(),".config",e),D(pe(),".config"),pe()];for(let i of c){if(o)oe.info(`Checking home directory: ${i}`);let d=this.fileLoader.generateConfigPaths(e,i,t),l=await this.fileLoader.tryLoadFromPaths(d,s,{arrayStrategy:r,verbose:o});if(l){if(o)oe.success(`Configuration loaded from home directory: ${l.source.path}`);return l}}return null}async loadPackageJsonConfiguration(e,t,n,r,o,a,s){let c=s?Ue(e,r,a):r;try{let i=D(n,"package.json");if(!Rr(i))return null;let d=await import(i),l=d[e],m=e;if(!l&&t)l=d[t],m=t;if(l&&typeof l==="object"&&!Array.isArray(l)){if(a)oe.success(`Configuration loaded from package.json: ${m}`);return{config:Yn(c,l,o),source:{type:"package.json",path:i,priority:30,timestamp:new Date}}}}catch(i){if(a)oe.warn("Failed to load package.json:",[i instanceof Error?i:Error(String(i))])}return null}async applyEnvironmentVariables(e,t,n,r){if(!n||!e||typeof t!=="object"||t===null||Array.isArray(t))return{config:t,source:{type:"default",priority:10,timestamp:new Date}};return{config:Ue(e,t,r),source:{type:"environment",priority:20,timestamp:new Date}}}async finalizeResult(e,t,n,r,o){return{config:e.config,source:e.source,path:e.source.path}}async validateConfiguration(e,t,n,r){let o=[];if(n){let a=n(e);if(a)o.push(...a)}if(t){let a=await this.validator.validateConfiguration(e,t);if(!a.isValid)o.push(...a.errors.map((s)=>s.path?`${s.path}: ${s.message}`:s.message))}if(o.length>0)throw ke.configValidation(r||"unknown",o,r)}checkCache(e,t){let n=this.generateCacheKey(e,t);return Oe.get(n)||null}cacheResult(e,t,n,r){let o=this.generateCacheKey(e,r);Oe.set(o,t,void 0,n.ttl)}generateCacheKey(e,t){let n=[e];if(t.alias)n.push(`alias:${t.alias}`);if(t.cwd)n.push(`cwd:${t.cwd}`);if(t.configDir)n.push(`configDir:${t.configDir}`);if("checkEnv"in t)n.push(`checkEnv:${t.checkEnv}`);return n.join("|")}getLocalDirectories(e,t){return Array.from(new Set([e,D(e,"config"),D(e,".config"),t?D(e,t):void 0].filter(Boolean)))}getAllSearchPaths(e,t,n,r){let o=[];return o.push(...this.getLocalSearchPaths(e,t,n,r)),o.push(...this.getHomeSearchPaths(e,t)),o.push(D(n,"package.json")),o}getLocalSearchPaths(e,t,n,r){let o=this.getLocalDirectories(n,r),a=[];for(let s of o)a.push(...this.fileLoader.generateConfigPaths(e,s,t));return a}getHomeSearchPaths(e,t){if(!e)return[];let n=[D(pe(),".config",e),D(pe(),".config"),pe()],r=[];for(let o of n)r.push(...this.fileLoader.generateConfigPaths(e,o,t));return r}async loadConfigWithResult(e){return this.loadConfig(e)}}var $t=new Xn;async function Jn(e){let t="defaultConfig"in e&&e.defaultConfig!==void 0?e.defaultConfig:{},n="cache"in e||"performance"in e||"schema"in e||"validate"in e;try{let r;if(n)r=await $t.loadConfig(e);else r=await $t.loadConfig({...e,defaultConfig:t,cache:{enabled:!0},performance:{enabled:!1}});return r?.config??t}catch(r){let o=r instanceof Error?r.name:"UnknownError",a=r instanceof Error?r.message:String(r);if(!(o==="ConfigNotFoundError"||o==="ConfigLoadError"||o==="ConfigValidationError"||a.includes("config"))&&e.verbose)oe.warn("Unexpected error loading config, using defaults:",[r instanceof Error?r:Error(String(r))]);let c=n?{...e,defaultConfig:t}:{...e,defaultConfig:t,cache:{enabled:!0},performance:{enabled:!1}};if("checkEnv"in e?e.checkEnv!==!1:!0)return(await $t.applyEnvironmentVariables(c.name||"",t,!0,c.verbose||!1))?.config??t;return t}}function Ue(e,t,n=!1){let r=new Nt,o=e.toUpperCase().replace(/[^A-Z0-9]/g,"_");function a(s,c=[]){let i={...s};for(let[d,l]of Object.entries(s)){let m=[...c,d],u=[`${o}_${m.join("_").toUpperCase()}`,`${o}_${m.map((y)=>y.toUpperCase()).join("")}`,`${o}_${m.map((y)=>y.replace(/([A-Z])/g,"_$1").toUpperCase()).join("")}`],p,h;for(let y of u)if(p=We.env[y],p!==void 0){h=y;break}if(p!==void 0&&h)if(typeof l==="boolean")i[d]=["true","1","yes"].includes(p.toLowerCase());else if(typeof l==="number"){let y=Number(p);if(!Number.isNaN(y))i[d]=y}else if(Array.isArray(l))try{i[d]=JSON.parse(p)}catch{i[d]=p.split(",").map((y)=>y.trim())}else i[d]=p;else if(l&&typeof l==="object"&&!Array.isArray(l))i[d]=a(l,m)}return i}return a(t)}var Tc=D(We.cwd(),"config"),Nc=D(We.cwd(),"src/generated");var xo={docsDir:"./docs",outDir:"./dist",theme:"vitepress",nav:[{text:"Guide",link:"/install"},{text:"API",link:"/advanced#api-reference"},{text:"Examples",link:"/examples"}],plugins:[],markdown:{title:"BunPress Documentation",meta:{description:"Documentation built with BunPress",generator:"BunPress",viewport:"width=device-width, initial-scale=1.0"},sidebar:{"/":[{text:"Getting Started",items:[{text:"Introduction",link:"/"},{text:"Installation",link:"/install"},{text:"Quick Start",link:"/quick-start"},{text:"Usage",link:"/usage"},{text:"Configuration",link:"/config"}]},{text:"Core Features",items:[{text:"Features Overview",link:"/features"},{text:"Markdown Extensions",link:"/markdown-extensions"},{text:"Syntax Highlighting",link:"/syntax-highlighting"},{text:"Table of Contents",link:"/table-of-contents"},{text:"CLI Commands",link:"/cli"}]},{text:"SEO & Analytics",items:[{text:"SEO Features",link:"/seo"},{text:"Analytics (Fathom)",link:"/config#fathom-analytics"}]},{text:"Advanced",items:[{text:"Advanced Usage",link:"/advanced"},{text:"Examples",link:"/examples"},{text:"Best Practices",link:"/best-practices"}]},{text:"More",items:[{text:"Showcase",link:"/showcase"},{text:"Partners",link:"/partners"},{text:"License",link:"/license"},{text:"Postcardware",link:"/postcardware"}]}]},css:`
32
32
  /* Additional BunPress customizations */
33
33
  /* Note: Base styles are provided by the VitePress theme */
34
34
 
@@ -702,7 +702,8 @@ function getPreferredTheme() {
702
702
  function setTheme(theme) {
703
703
  if (theme === 'dark') {
704
704
  document.documentElement.classList.add('dark');
705
- } else {
705
+ }
706
+ else {
706
707
  document.documentElement.classList.remove('dark');
707
708
  }
708
709
  localStorage.setItem('bunpress-theme', theme);
@@ -737,7 +738,8 @@ function switchCodeTab(groupId, panelIndex) {
737
738
  tabs.forEach((tab, index) => {
738
739
  if (index === panelIndex) {
739
740
  tab.classList.add('active');
740
- } else {
741
+ }
742
+ else {
741
743
  tab.classList.remove('active');
742
744
  }
743
745
  });
@@ -747,7 +749,8 @@ function switchCodeTab(groupId, panelIndex) {
747
749
  panels.forEach((panel, index) => {
748
750
  if (index === panelIndex) {
749
751
  panel.classList.add('active');
750
- } else {
752
+ }
753
+ else {
751
754
  panel.classList.remove('active');
752
755
  }
753
756
  });
@@ -768,7 +771,8 @@ function fallbackCopyToClipboard(text) {
768
771
  document.execCommand('copy');
769
772
  document.body.removeChild(textArea);
770
773
  return true;
771
- } catch (err) {
774
+ }
775
+ catch (err) {
772
776
  document.body.removeChild(textArea);
773
777
  return false;
774
778
  }
@@ -785,15 +789,18 @@ function copyToClipboard(text) {
785
789
  // Fallback to execCommand
786
790
  if (fallbackCopyToClipboard(text)) {
787
791
  resolve();
788
- } else {
792
+ }
793
+ else {
789
794
  reject(new Error('Copy failed'));
790
795
  }
791
796
  });
792
- } else {
797
+ }
798
+ else {
793
799
  // Use fallback directly
794
800
  if (fallbackCopyToClipboard(text)) {
795
801
  resolve();
796
- } else {
802
+ }
803
+ else {
797
804
  reject(new Error('Copy failed'));
798
805
  }
799
806
  }
@@ -1187,16 +1194,16 @@ if (typeof document !== 'undefined') {
1187
1194
  }
1188
1195
  });
1189
1196
  }
1190
- `],preserveDirectoryStructure:!0,features:{inlineFormatting:!0,containers:!0,githubAlerts:!0,codeBlocks:{lineHighlighting:!0,lineNumbers:!0,focus:!0,diffs:!0,errorWarningMarkers:!0},codeGroups:!0,codeImports:!0,inlineToc:!0,customAnchors:!0,emoji:!0,badges:!0,includes:!0,externalLinks:{autoTarget:!0,autoRel:!0,showIcon:!0},imageLazyLoading:!0,tables:{alignment:!0,enhancedStyling:!0,responsive:!0}},syntaxHighlightTheme:"github-light"},verbose:!0,sitemap:{enabled:!0,filename:"sitemap.xml",defaultPriority:0.5,defaultChangefreq:"monthly",maxUrlsPerFile:50000,useSitemapIndex:!1},robots:{enabled:!0,filename:"robots.txt"}},qe=await Fn({name:"bunpress",alias:"docs",defaultConfig:zo});async function $c(){return qe}import{existsSync as Vn,mkdirSync as jc,readdirSync as Ec,writeFileSync as zc}from"fs";import{homedir as xt}from"os";import{dirname as xc,resolve as v}from"path";import _e from"process";import{join as No,relative as Zo,resolve as In}from"path";import He from"process";import{existsSync as Pn,mkdirSync as Sc,readdirSync as Uc,writeFileSync as Gc}from"fs";import{dirname as Yc,resolve as Ve}from"path";import Yt from"process";import{Buffer as me}from"buffer";import{createCipheriv as xo,createDecipheriv as To,randomBytes as Tt}from"crypto";import{closeSync as Rt,createReadStream as Jn,createWriteStream as Ro,existsSync as Lt,fsyncSync as Cn,openSync as Qn,writeFileSync as Lo}from"fs";import{access as Bo,constants as Wn,mkdir as So,readdir as ve,rename as vn,stat as ke,unlink as Me,writeFile as Bt}from"fs/promises";import{join as ge}from"path";import F from"process";import{pipeline as Uo}from"stream/promises";import{createGzip as Mn}from"zlib";import Ae from"process";import ie from"process";function Xt(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 r=[...t];for(let o of e)if(L(o)&&"name"in o){if(!r.find((a)=>L(a)&&("name"in a)&&a.name===o.name))r.push(o)}else if(L(o)&&"path"in o){if(!r.find((a)=>L(a)&&("path"in a)&&a.path===o.path))r.push(o)}else if(!r.some((a)=>Pe(a,o)))r.push(o);return r}if(t.every((r)=>typeof r==="string")&&e.every((r)=>typeof r==="string")){let r=[...t];for(let o of e)if(!r.includes(o))r.push(o);return r}return t}if(!L(t)||!L(e))return t;let n={...e};for(let r in t)if(Object.prototype.hasOwnProperty.call(t,r)){let o=t[r];if(o===null||o===void 0)continue;else if(L(o)&&L(n[r]))n[r]=Xt(n[r],o);else if(Array.isArray(o)&&Array.isArray(n[r]))if(o.length>0&&n[r].length>0&&L(o[0])&&L(n[r][0])){let a=[...o];for(let s of n[r])if(L(s)&&"name"in s){if(!a.find((c)=>L(c)&&("name"in c)&&c.name===s.name))a.push(s)}else if(L(s)&&"path"in s){if(!a.find((c)=>L(c)&&("path"in c)&&c.path===s.path))a.push(s)}else if(!a.some((c)=>Pe(c,s)))a.push(s);n[r]=a}else if(o.every((a)=>typeof a==="string")&&n[r].every((a)=>typeof a==="string")){let a=[...o];for(let s of n[r])if(!a.includes(s))a.push(s);n[r]=a}else n[r]=o;else n[r]=o}return n}function Pe(e,t){if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!Pe(e[n],t[n]))return!1;return!0}if(L(e)&&L(t)){let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let o of n){if(!Object.prototype.hasOwnProperty.call(t,o))return!1;if(!Pe(e[o],t[o]))return!1}return!0}return!1}function L(e){return Boolean(e&&typeof e==="object"&&!Array.isArray(e))}async function Go(e,t){if(!Pn(e))return null;try{let n=await import(e),r=n.default||n;if(typeof r!=="object"||r===null||Array.isArray(r))return null;try{return Xt(t,r)}catch{return null}}catch{return null}}async function Oo({name:e="",cwd:t,defaultConfig:n}){let r=t||Yt.cwd(),o=[".ts",".js",".mjs",".cjs",".json"],a=[`${e}.config`,`.${e}.config`,e,`.${e}`];for(let s of a)for(let c of o){let i=Ve(r,`${s}${c}`),d=await Go(i,n);if(d!==null)return d}try{let s=Ve(r,"package.json");if(Pn(s)){let c=(await import(s))[e];if(c&&typeof c==="object"&&!Array.isArray(c))try{return Xt(n,c)}catch{}}}catch{}return n}var Hc=Ve(Yt.cwd(),"config"),Vc=Ve(Yt.cwd(),"src/generated");function Yo(e,t={}){let n=He.cwd();while(n.includes("storage"))n=In(n,"..");let r=In(n,e||"");if(t?.relative)return Zo(He.cwd(),r);return r}var Xo=He.env.CLARITY_LOG_DIR||No(Yo(),"logs"),St={level:"info",defaultName:"clarity",timestamp:!0,colors:!0,format:"text",maxLogSize:10485760,logDatePattern:"YYYY-MM-DD",logDirectory:Xo,rotation:{frequency:"daily",maxSize:10485760,maxFiles:5,compress:!1,rotateHour:0,rotateMinute:0,rotateDayOfWeek:0,rotateDayOfMonth:1,encrypt:!1},verbose:!1};async function Fo(){try{let e=await Oo({name:"clarity",defaultConfig:St,cwd:He.cwd(),endpoint:"",headers:{}});return{...St,...e}}catch{return St}}var Kn=await Fo();function S(){if(ie.env.NODE_ENV==="test"||ie.env.BUN_ENV==="test")return!1;return typeof window<"u"}async function Io(){if(ie.env.NODE_ENV==="test"||ie.env.BUN_ENV==="test")return!0;if(typeof navigator<"u"&&navigator.product==="ReactNative")return!0;if(typeof ie<"u"){let e=ie.type;if(e==="renderer"||e==="worker")return!1;return!!(ie.versions&&(ie.versions.node||ie.versions.bun))}return!1}class er{async format(e){let t=await Io(),n=await this.getMetadata(t);return JSON.stringify({timestamp:e.timestamp.toISOString(),level:e.level,name:e.name,message:e.message,metadata:n})}async getMetadata(e){if(e){let{hostname:t}=await import("os");return{pid:Ae.pid,hostname:t(),environment:Ae.env.NODE_ENV||"development",platform:Ae.platform,version:Ae.version}}return{userAgent:navigator.userAgent,hostname:window.location.hostname||"browser",environment:Ae.env.NODE_ENV||Ae.env.BUN_ENV||"development",viewport:{width:window.innerWidth,height:window.innerHeight},language:navigator.language}}}var Q={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"},R=Q,Pc=Q.red,Jo=Q.green,ed=Q.yellow,Co=Q.blue,td=Q.magenta,nd=Q.cyan,Dn=Q.white,rd=Q.gray,Qo=Q.bgRed,Wo=Q.bgYellow,Hn=Q.bold,od=Q.dim,ad=Q.italic,sd=Q.underline,id=Q.reset,Ut={activationLevel:"error",bufferSize:50,flushOnDeactivation:!0,stopBuffering:!1},vo={debug:"\uD83D\uDD0D",info:Co("\u2139"),success:Jo("\u2713"),warning:Wo(Dn(Hn(" WARN "))),error:Qo(Dn(Hn(" ERROR ")))};class tt{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={...Kn},this.options=this.normalizeOptions(t),this.formatter=this.options.formatter||new er,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??F.env.APP_ENV??"local",this.fingersCrossedConfig=this.initializeFingersCrossedConfig(t);let n={...t},r=t.timestamp!==void 0;if(r)delete n.timestamp;if(this.config={...this.config,...n,timestamp:r||this.config.timestamp},this.currentLogFile=this.generateLogFilename(),this.encryptionKeys=new Map,this.validateEncryptionConfig()){this.setupRotation();let o=this.generateKeyId(),a=this.generateKey();this.currentKeyId=o,this.keys.set(o,a),this.encryptionKeys.set(o,{key:a,createdAt:new Date}),this.setupKeyRotation()}}initializeFingersCrossedConfig(e){if(!e.fingersCrossedEnabled&&e.fingersCrossed)return{...Ut,...e.fingersCrossed};if(!e.fingersCrossedEnabled)return null;if(!e.fingersCrossed)return{...Ut};return{...Ut,...e.fingersCrossed}}normalizeOptions(e){let t={format:"json",level:"info",logDirectory:Kn.logDirectory,rotation:void 0,timestamp:void 0,fingersCrossed:{},enabled:!0,showTags:!1,formatter:void 0},n={...t,...Object.fromEntries(Object.entries(e).filter(([,r])=>r!==void 0))};if(!n.level||!["debug","info","success","warning","error"].includes(n.level))n.level=t.level;return n}async writeToFile(e){let t=(async()=>{let r,o=0,a=3,s=1000;while(o<a)try{try{try{await Bo(this.config.logDirectory,Wn.F_OK|Wn.W_OK)}catch(i){if(i instanceof Error&&"code"in i)if(i.code==="ENOENT")await So(this.config.logDirectory,{recursive:!0,mode:493});else if(i.code==="EACCES")throw Error(`No write permission for log directory: ${this.config.logDirectory}`);else throw i;else throw i}}catch(i){throw console.error("Debug: [writeToFile] Failed to create log directory:",i),i}let c=this.validateEncryptionConfig()?(await this.encrypt(e)).encrypted:me.from(e);try{if(!Lt(this.currentLogFile))await Bt(this.currentLogFile,"",{mode:420});if(r=Qn(this.currentLogFile,"a",420),Lo(r,c,{flag:"a"}),Cn(r),r!==void 0)Rt(r),r=void 0;if((await ke(this.currentLogFile)).size===0){if(await Bt(this.currentLogFile,c,{flag:"w",mode:420}),(await ke(this.currentLogFile)).size===0)throw Error("File exists but is empty after retry write")}return}catch(i){let d=i;if(d.code&&["ENETDOWN","ENETUNREACH","ENOTFOUND","ETIMEDOUT"].includes(d.code)){if(o<a-1){let m=typeof d.message==="string"?d.message:"Unknown error";console.error(`Network error during write attempt ${o+1}/${a}:`,m);let l=s*2**o;await new Promise((u)=>setTimeout(u,l)),o++;continue}}if(d?.code&&["ENOSPC","EDQUOT"].includes(d.code))throw Error(`Disk quota exceeded or no space left on device: ${d.message}`);throw console.error("Debug: [writeToFile] Error writing to file:",d),d}finally{if(r!==void 0)try{Rt(r)}catch(i){console.error("Debug: [writeToFile] Error closing file descriptor:",i)}}}catch(c){if(o===a-1){let d=c,m=typeof d.message==="string"?d.message:"Unknown error";throw console.error("Debug: [writeToFile] Max retries reached. Final error:",m),c}o++;let i=s*2**(o-1);await new Promise((d)=>setTimeout(d,i))}})();this.pendingOperations.push(t);let n=this.pendingOperations.length-1;try{await t}catch(r){throw console.error("Debug: [writeToFile] Error in operation:",r),r}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 ge(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 ge(this.config.logDirectory,`${this.name}.log`);let e=new Date().toISOString().split("T")[0];return ge(this.config.logDirectory,`${this.name}-${e}.log`)}setupRotation(){if(S())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 e=this.config.rotation.keyRotation;if(!e?.enabled)return;let t=typeof e.interval==="number"?e.interval:60,n=Math.max(t,60)*1000;this.keyRotationTimeout=setInterval(()=>{this.rotateKeys().catch((r)=>{console.error("Error rotating keys:",r)})},n)}async rotateKeys(){if(!this.validateEncryptionConfig()){console.error("Invalid encryption configuration detected during key rotation");return}let e=this.config.rotation.keyRotation,t=this.generateKeyId(),n=this.generateKey();this.currentKeyId=t,this.keys.set(t,n),this.encryptionKeys.set(t,{key:n,createdAt:new Date});let r=Array.from(this.encryptionKeys.entries()).sort(([,s],[,c])=>c.createdAt.getTime()-s.createdAt.getTime()),o=typeof e.maxKeys==="number"?e.maxKeys:1,a=Math.max(1,o);if(r.length>a)for(let[s]of r.slice(a))this.encryptionKeys.delete(s),this.keys.delete(s)}generateKeyId(){return Tt(16).toString("hex")}generateKey(){return Tt(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(),n=Tt(16),r=xo("aes-256-gcm",t,n),o=me.concat([r.update(e,"utf8"),r.final()]),a=r.getAuthTag();return{encrypted:me.concat([n,o,a]),iv:n}}async compressData(e){return new Promise((t,n)=>{let r=Mn(),o=[];r.on("data",(a)=>o.push(a)),r.on("end",()=>t(me.from(me.concat(o)))),r.on("error",n),r.write(e),r.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(S())return;let e=await ke(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 n=this.currentLogFile,r=this.generateLogFilename();if(this.name.includes("rotation-load-test")||this.name==="failed-rotation-test"){let o=await ve(this.config.logDirectory),a=o.filter((i)=>i.startsWith(this.name)&&/\.log\.\d+$/.test(i)).sort((i,d)=>{let m=Number.parseInt(i.match(/\.log\.(\d+)$/)?.[1]||"0");return Number.parseInt(d.match(/\.log\.(\d+)$/)?.[1]||"0")-m}),s=a.length>0?Number.parseInt(a[0].match(/\.log\.(\d+)$/)?.[1]||"0")+1:1,c=`${n}.${s}`;if(await ke(n).catch(()=>null))try{if(await vn(n,c),t.compress)try{let i=`${c}.gz`;await this.compressLogFile(c,i),await Me(c)}catch(i){console.error("Error compressing rotated file:",i)}if(a.length===0&&!o.some((i)=>i.endsWith(".log.1")))try{let i=`${n}.1`;await Bt(i,"")}catch(i){console.error("Error creating backup file:",i)}}catch(i){console.error(`Error during rotation: ${i instanceof Error?i.message:String(i)}`)}}else{let o=new Date().toISOString().replace(/[:.]/g,"-"),a=n.replace(/\.log$/,`-${o}.log`);if(await ke(n).catch(()=>null))await vn(n,a)}if(this.currentLogFile=r,t.maxFiles){let o=(await ve(this.config.logDirectory)).filter((a)=>a.startsWith(this.name)).sort((a,s)=>s.localeCompare(a));for(let a of o.slice(t.maxFiles))await Me(ge(this.config.logDirectory,a))}}}async compressLogFile(e,t){let n=Jn(e),r=Ro(t),o=Mn();await Uo(n,o,r)}async handleFingersCrossedBuffer(e,t){if(!this.fingersCrossedConfig)return;if(this.shouldActivateFingersCrossed(e)&&!this.isActivated){this.isActivated=!0;for(let n of this.logBuffer){let r=await this.formatter.format(n);await this.writeToFile(r),console.log(r)}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 n={timestamp:new Date,level:e,message:t,name:this.name};this.logBuffer.push(n)}}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()})),Lt(this.currentLogFile))try{let e=Qn(this.currentLogFile,"r+");Cn(e),Rt(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(!S()&&this.config.rotation&&typeof this.config.rotation!=="boolean"&&this.config.rotation.compress)try{let e=(await ve(this.config.logDirectory)).filter((t)=>(t.includes("temp")||t.includes(".tmp"))&&t.includes(this.name));for(let t of e)try{await Me(ge(this.config.logDirectory,t))}catch(n){console.error(`Failed to delete temp file ${t}:`,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?R.gray(e.toLocaleTimeString()):e.toLocaleTimeString()}formatConsoleMessage(e){let{timestamp:t,icon:n="",tag:r="",message:o,level:a,showTimestamp:s=!0}=e,c=(p)=>p.replace(this.ANSI_PATTERN,"");if(!this.fancy){let p=[];if(s)p.push(t);if(a==="warning")p.push("WARN");else if(a==="error")p.push("ERROR");else if(n)p.push(n.replace(/[^\p{L}\p{N}\p{P}\p{Z}]/gu,""));if(r)p.push(r.replace(/[[\]]/g,""));return p.push(o),p.join(" ")}let i=F.stdout.columns||120,d="";if(a==="warning"||a==="error")d=`${n} ${o}`;else if(a==="info"||a==="success")d=`${n} ${r} ${o}`;else d=`${n} ${r} ${R.cyan(o)}`;if(!s)return d.trim();let m=c(d).trim().length,l=c(t).length,u=Math.max(1,i-2-m-l);return`${d.trim()}${" ".repeat(u)}${t}`}formatMessage(e,t){if(t.length===1&&Array.isArray(t[0]))return e.replace(/\{(\d+)\}/g,(a,s)=>{let c=Number.parseInt(s,10);return c<t[0].length?String(t[0][c]):a});let n=/%([sdijfo%])/g,r=0,o=e.replace(n,(a,s)=>{if(s==="%")return"%";if(r>=t.length)return a;let c=t[r++];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 a}});if(r<t.length)o+=` ${t.slice(r).map((a)=>typeof a==="object"?JSON.stringify(a,null,2):String(a)).join(" ")}`;return o}async log(e,t,...n){let r=new Date,o=this.formatConsoleTimestamp(r),a=this.formatFileTimestamp(r),s,c;if(t instanceof Error)s=t.message,c=t.stack;else s=this.formatMessage(t,n);if(this.fancy&&!S()){let d=vo[e],m=this.options.showTags!==!1&&this.name?R.gray(this.formatTag(this.name)):"",l;switch(e){case"debug":l=this.formatConsoleMessage({timestamp:o,icon:d,tag:m,message:R.gray(s),level:e}),console.error(l);break;case"info":l=this.formatConsoleMessage({timestamp:o,icon:d,tag:m,message:s,level:e}),console.error(l);break;case"success":l=this.formatConsoleMessage({timestamp:o,icon:d,tag:m,message:R.green(s),level:e}),console.error(l);break;case"warning":l=this.formatConsoleMessage({timestamp:o,icon:d,tag:m,message:s,level:e}),console.warn(l);break;case"error":if(l=this.formatConsoleMessage({timestamp:o,icon:d,tag:m,message:s,level:e}),console.error(l),c){let u=c.split(`
1191
- `);for(let p of u)if(p.trim()&&!p.includes(s))console.error(this.formatConsoleMessage({timestamp:o,message:R.gray(` ${p}`),level:e,showTimestamp:!1}))}break}}else if(!S()){if(console.error(`${a} ${this.environment}.${e.toUpperCase()}: ${s}`),c)console.error(c)}if(!this.shouldLog(e))return;let i=`${a} ${this.environment}.${e.toUpperCase()}: ${s}
1197
+ `],preserveDirectoryStructure:!0,features:{inlineFormatting:!0,containers:!0,githubAlerts:!0,codeBlocks:{lineHighlighting:!0,lineNumbers:!0,focus:!0,diffs:!0,errorWarningMarkers:!0},codeGroups:!0,codeImports:!0,inlineToc:!0,customAnchors:!0,emoji:!0,badges:!0,includes:!0,externalLinks:{autoTarget:!0,autoRel:!0,showIcon:!0},imageLazyLoading:!0,tables:{alignment:!0,enhancedStyling:!0,responsive:!0}},syntaxHighlightTheme:"github-light"},verbose:!1,sitemap:{enabled:!0,filename:"sitemap.xml",defaultPriority:0.5,defaultChangefreq:"monthly",maxUrlsPerFile:50000,useSitemapIndex:!1},robots:{enabled:!0,filename:"robots.txt"}},ge=await Jn({name:"bunpress",alias:"docs",defaultConfig:xo});async function Lc(){return ge}import{existsSync as er,mkdirSync as Uc,readdirSync as Gc,writeFileSync as Oc}from"fs";import{homedir as Zt}from"os";import{dirname as Fc,resolve as v}from"path";import je from"process";import{join as Lo,relative as Ro,resolve as Qn}from"path";import Ve from"process";import{existsSync as tr,mkdirSync as Wc,readdirSync as Cc,writeFileSync as Mc}from"fs";import{dirname as Kc,resolve as Pe}from"path";import Yt from"process";import{Buffer as le}from"buffer";import{createCipheriv as Bo,createDecipheriv as Uo,randomBytes as xt}from"crypto";import{closeSync as Lt,createReadStream as Wn,createWriteStream as Go,existsSync as Rt,fsyncSync as Cn,openSync as Mn,writeFileSync as Oo}from"fs";import{access as So,constants as vn,mkdir as Yo,readdir as ve,rename as Kn,stat as Ae,unlink as Ke,writeFile as Bt}from"fs/promises";import{join as $e}from"path";import X from"process";import{pipeline as Fo}from"stream/promises";import{createGzip as Dn}from"zlib";import qe from"process";import ie from"process";function Ft(e,t){if(Array.isArray(t)&&Array.isArray(e)&&t.length===2&&e.length===2&&x(t[0])&&"id"in t[0]&&t[0].id===3&&x(t[1])&&"id"in t[1]&&t[1].id===4)return t;if(x(t)&&x(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(x(e)&&"arr"in e&&Array.isArray(e.arr)&&x(t)&&"arr"in t&&Array.isArray(t.arr))return t;if(t.length>0&&e.length>0&&x(t[0])&&x(e[0])){let r=[...t];for(let o of e)if(x(o)&&"name"in o){if(!r.find((a)=>x(a)&&("name"in a)&&a.name===o.name))r.push(o)}else if(x(o)&&"path"in o){if(!r.find((a)=>x(a)&&("path"in a)&&a.path===o.path))r.push(o)}else if(!r.some((a)=>et(a,o)))r.push(o);return r}if(t.every((r)=>typeof r==="string")&&e.every((r)=>typeof r==="string")){let r=[...t];for(let o of e)if(!r.includes(o))r.push(o);return r}return t}if(!x(t)||!x(e))return t;let n={...e};for(let r in t)if(Object.prototype.hasOwnProperty.call(t,r)){let o=t[r];if(o===null||o===void 0)continue;else if(x(o)&&x(n[r]))n[r]=Ft(n[r],o);else if(Array.isArray(o)&&Array.isArray(n[r]))if(o.length>0&&n[r].length>0&&x(o[0])&&x(n[r][0])){let a=[...o];for(let s of n[r])if(x(s)&&"name"in s){if(!a.find((c)=>x(c)&&("name"in c)&&c.name===s.name))a.push(s)}else if(x(s)&&"path"in s){if(!a.find((c)=>x(c)&&("path"in c)&&c.path===s.path))a.push(s)}else if(!a.some((c)=>et(c,s)))a.push(s);n[r]=a}else if(o.every((a)=>typeof a==="string")&&n[r].every((a)=>typeof a==="string")){let a=[...o];for(let s of n[r])if(!a.includes(s))a.push(s);n[r]=a}else n[r]=o;else n[r]=o}return n}function et(e,t){if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!et(e[n],t[n]))return!1;return!0}if(x(e)&&x(t)){let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let o of n){if(!Object.prototype.hasOwnProperty.call(t,o))return!1;if(!et(e[o],t[o]))return!1}return!0}return!1}function x(e){return Boolean(e&&typeof e==="object"&&!Array.isArray(e))}async function Io(e,t){if(!tr(e))return null;try{let n=await import(e),r=n.default||n;if(typeof r!=="object"||r===null||Array.isArray(r))return null;try{return Ft(t,r)}catch{return null}}catch{return null}}async function Xo({name:e="",cwd:t,defaultConfig:n}){let r=t||Yt.cwd(),o=[".ts",".js",".mjs",".cjs",".json"],a=[`${e}.config`,`.${e}.config`,e,`.${e}`];for(let s of a)for(let c of o){let i=Pe(r,`${s}${c}`),d=await Io(i,n);if(d!==null)return d}try{let s=Pe(r,"package.json");if(tr(s)){let c=(await import(s))[e];if(c&&typeof c==="object"&&!Array.isArray(c))try{return Ft(n,c)}catch{}}}catch{}return n}var id=Pe(Yt.cwd(),"config"),cd=Pe(Yt.cwd(),"src/generated");function Jo(e,t={}){let n=Ve.cwd();while(n.includes("storage"))n=Qn(n,"..");let r=Qn(n,e||"");if(t?.relative)return Ro(Ve.cwd(),r);return r}var Qo=Ve.env.CLARITY_LOG_DIR||Lo(Jo(),"logs"),Ut={level:"info",defaultName:"clarity",timestamp:!0,colors:!0,format:"text",maxLogSize:10485760,logDatePattern:"YYYY-MM-DD",logDirectory:Qo,rotation:{frequency:"daily",maxSize:10485760,maxFiles:5,compress:!1,rotateHour:0,rotateMinute:0,rotateDayOfWeek:0,rotateDayOfMonth:1,encrypt:!1},verbose:!1};async function Wo(){try{let e=await Xo({name:"clarity",defaultConfig:Ut,cwd:Ve.cwd(),endpoint:"",headers:{}});return{...Ut,...e}}catch{return Ut}}var Hn=await Wo();function R(){if(ie.env.NODE_ENV==="test"||ie.env.BUN_ENV==="test")return!1;return typeof window<"u"}async function Co(){if(ie.env.NODE_ENV==="test"||ie.env.BUN_ENV==="test")return!0;if(typeof navigator<"u"&&navigator.product==="ReactNative")return!0;if(typeof ie<"u"){let e=ie.type;if(e==="renderer"||e==="worker")return!1;return!!(ie.versions&&(ie.versions.node||ie.versions.bun))}return!1}class nr{async format(e){let t=await Co(),n=await this.getMetadata(t);return JSON.stringify({timestamp:e.timestamp.toISOString(),level:e.level,name:e.name,message:e.message,metadata:n})}async getMetadata(e){if(e){let{hostname:t}=await import("os");return{pid:qe.pid,hostname:t(),environment:qe.env.NODE_ENV||"development",platform:qe.platform,version:qe.version}}return{userAgent:navigator.userAgent,hostname:window.location.hostname||"browser",environment:qe.env.NODE_ENV||qe.env.BUN_ENV||"development",viewport:{width:window.innerWidth,height:window.innerHeight},language:navigator.language}}}var C={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"},Z=C,dd=C.red,Mo=C.green,ld=C.yellow,vo=C.blue,md=C.magenta,pd=C.cyan,Vn=C.white,ud=C.gray,Ko=C.bgRed,Do=C.bgYellow,Pn=C.bold,yd=C.dim,hd=C.italic,wd=C.underline,fd=C.reset,Gt={activationLevel:"error",bufferSize:50,flushOnDeactivation:!0,stopBuffering:!1},Ho={debug:"\uD83D\uDD0D",info:vo("\u2139"),success:Mo("\u2713"),warning:Do(Vn(Pn(" WARN "))),error:Ko(Vn(Pn(" ERROR ")))};class nt{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 nr,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??X.env.APP_ENV??"local",this.fingersCrossedConfig=this.initializeFingersCrossedConfig(t);let n={...t},r=t.timestamp!==void 0;if(r)delete n.timestamp;if(this.config={...this.config,...n,timestamp:r||this.config.timestamp},this.currentLogFile=this.generateLogFilename(),this.encryptionKeys=new Map,this.validateEncryptionConfig()){this.setupRotation();let o=this.generateKeyId(),a=this.generateKey();this.currentKeyId=o,this.keys.set(o,a),this.encryptionKeys.set(o,{key:a,createdAt:new Date}),this.setupKeyRotation()}}initializeFingersCrossedConfig(e){if(!e.fingersCrossedEnabled&&e.fingersCrossed)return{...Gt,...e.fingersCrossed};if(!e.fingersCrossedEnabled)return null;if(!e.fingersCrossed)return{...Gt};return{...Gt,...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},n={...t,...Object.fromEntries(Object.entries(e).filter(([,r])=>r!==void 0))};if(!n.level||!["debug","info","success","warning","error"].includes(n.level))n.level=t.level;return n}async writeToFile(e){let t=(async()=>{let r,o=0,a=3,s=1000;while(o<a)try{try{try{await So(this.config.logDirectory,vn.F_OK|vn.W_OK)}catch(i){if(i instanceof Error&&"code"in i)if(i.code==="ENOENT")await Yo(this.config.logDirectory,{recursive:!0,mode:493});else if(i.code==="EACCES")throw Error(`No write permission for log directory: ${this.config.logDirectory}`);else throw i;else throw i}}catch(i){throw console.error("Debug: [writeToFile] Failed to create log directory:",i),i}let c=this.validateEncryptionConfig()?(await this.encrypt(e)).encrypted:le.from(e);try{if(!Rt(this.currentLogFile))await Bt(this.currentLogFile,"",{mode:420});if(r=Mn(this.currentLogFile,"a",420),Oo(r,c,{flag:"a"}),Cn(r),r!==void 0)Lt(r),r=void 0;if((await Ae(this.currentLogFile)).size===0){if(await Bt(this.currentLogFile,c,{flag:"w",mode:420}),(await Ae(this.currentLogFile)).size===0)throw Error("File exists but is empty after retry write")}return}catch(i){let d=i;if(d.code&&["ENETDOWN","ENETUNREACH","ENOTFOUND","ETIMEDOUT"].includes(d.code)){if(o<a-1){let l=typeof d.message==="string"?d.message:"Unknown error";console.error(`Network error during write attempt ${o+1}/${a}:`,l);let m=s*2**o;await new Promise((u)=>setTimeout(u,m)),o++;continue}}if(d?.code&&["ENOSPC","EDQUOT"].includes(d.code))throw Error(`Disk quota exceeded or no space left on device: ${d.message}`);throw console.error("Debug: [writeToFile] Error writing to file:",d),d}finally{if(r!==void 0)try{Lt(r)}catch(i){console.error("Debug: [writeToFile] Error closing file descriptor:",i)}}}catch(c){if(o===a-1){let d=c,l=typeof d.message==="string"?d.message:"Unknown error";throw console.error("Debug: [writeToFile] Max retries reached. Final error:",l),c}o++;let i=s*2**(o-1);await new Promise((d)=>setTimeout(d,i))}})();this.pendingOperations.push(t);let n=this.pendingOperations.length-1;try{await t}catch(r){throw console.error("Debug: [writeToFile] Error in operation:",r),r}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 $e(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 $e(this.config.logDirectory,`${this.name}.log`);let e=new Date().toISOString().split("T")[0];return $e(this.config.logDirectory,`${this.name}-${e}.log`)}setupRotation(){if(R())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 e=this.config.rotation.keyRotation;if(!e?.enabled)return;let t=typeof e.interval==="number"?e.interval:60,n=Math.max(t,60)*1000;this.keyRotationTimeout=setInterval(()=>{this.rotateKeys().catch((r)=>{console.error("Error rotating keys:",r)})},n)}async rotateKeys(){if(!this.validateEncryptionConfig()){console.error("Invalid encryption configuration detected during key rotation");return}let e=this.config.rotation.keyRotation,t=this.generateKeyId(),n=this.generateKey();this.currentKeyId=t,this.keys.set(t,n),this.encryptionKeys.set(t,{key:n,createdAt:new Date});let r=Array.from(this.encryptionKeys.entries()).sort(([,s],[,c])=>c.createdAt.getTime()-s.createdAt.getTime()),o=typeof e.maxKeys==="number"?e.maxKeys:1,a=Math.max(1,o);if(r.length>a)for(let[s]of r.slice(a))this.encryptionKeys.delete(s),this.keys.delete(s)}generateKeyId(){return xt(16).toString("hex")}generateKey(){return xt(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(),n=xt(16),r=Bo("aes-256-gcm",t,n),o=le.concat([r.update(e,"utf8"),r.final()]),a=r.getAuthTag();return{encrypted:le.concat([n,o,a]),iv:n}}async compressData(e){return new Promise((t,n)=>{let r=Dn(),o=[];r.on("data",(a)=>o.push(a)),r.on("end",()=>t(le.from(le.concat(o)))),r.on("error",n),r.write(e),r.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(R())return;let e=await Ae(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 n=this.currentLogFile,r=this.generateLogFilename();if(this.name.includes("rotation-load-test")||this.name==="failed-rotation-test"){let o=await ve(this.config.logDirectory),a=o.filter((i)=>i.startsWith(this.name)&&/\.log\.\d+$/.test(i)).sort((i,d)=>{let l=Number.parseInt(i.match(/\.log\.(\d+)$/)?.[1]||"0");return Number.parseInt(d.match(/\.log\.(\d+)$/)?.[1]||"0")-l}),s=a.length>0?Number.parseInt(a[0].match(/\.log\.(\d+)$/)?.[1]||"0")+1:1,c=`${n}.${s}`;if(await Ae(n).catch(()=>null))try{if(await Kn(n,c),t.compress)try{let i=`${c}.gz`;await this.compressLogFile(c,i),await Ke(c)}catch(i){console.error("Error compressing rotated file:",i)}if(a.length===0&&!o.some((i)=>i.endsWith(".log.1")))try{let i=`${n}.1`;await Bt(i,"")}catch(i){console.error("Error creating backup file:",i)}}catch(i){console.error(`Error during rotation: ${i instanceof Error?i.message:String(i)}`)}}else{let o=new Date().toISOString().replace(/[:.]/g,"-"),a=n.replace(/\.log$/,`-${o}.log`);if(await Ae(n).catch(()=>null))await Kn(n,a)}if(this.currentLogFile=r,t.maxFiles){let o=(await ve(this.config.logDirectory)).filter((a)=>a.startsWith(this.name)).sort((a,s)=>s.localeCompare(a));for(let a of o.slice(t.maxFiles))await Ke($e(this.config.logDirectory,a))}}}async compressLogFile(e,t){let n=Wn(e),r=Go(t),o=Dn();await Fo(n,o,r)}async handleFingersCrossedBuffer(e,t){if(!this.fingersCrossedConfig)return;if(this.shouldActivateFingersCrossed(e)&&!this.isActivated){this.isActivated=!0;for(let n of this.logBuffer){let r=await this.formatter.format(n);await this.writeToFile(r),console.log(r)}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 n={timestamp:new Date,level:e,message:t,name:this.name};this.logBuffer.push(n)}}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()})),Rt(this.currentLogFile))try{let e=Mn(this.currentLogFile,"r+");Cn(e),Lt(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(!R()&&this.config.rotation&&typeof this.config.rotation!=="boolean"&&this.config.rotation.compress)try{let e=(await ve(this.config.logDirectory)).filter((t)=>(t.includes("temp")||t.includes(".tmp"))&&t.includes(this.name));for(let t of e)try{await Ke($e(this.config.logDirectory,t))}catch(n){console.error(`Failed to delete temp file ${t}:`,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?Z.gray(e.toLocaleTimeString()):e.toLocaleTimeString()}formatConsoleMessage(e){let{timestamp:t,icon:n="",tag:r="",message:o,level:a,showTimestamp:s=!0}=e,c=(p)=>p.replace(this.ANSI_PATTERN,"");if(!this.fancy){let p=[];if(s)p.push(t);if(a==="warning")p.push("WARN");else if(a==="error")p.push("ERROR");else if(n)p.push(n.replace(/[^\p{L}\p{N}\p{P}\p{Z}]/gu,""));if(r)p.push(r.replace(/[[\]]/g,""));return p.push(o),p.join(" ")}let i=X.stdout.columns||120,d="";if(a==="warning"||a==="error")d=`${n} ${o}`;else if(a==="info"||a==="success")d=`${n} ${r} ${o}`;else d=`${n} ${r} ${Z.cyan(o)}`;if(!s)return d.trim();let l=c(d).trim().length,m=c(t).length,u=Math.max(1,i-2-l-m);return`${d.trim()}${" ".repeat(u)}${t}`}formatMessage(e,t){if(t.length===1&&Array.isArray(t[0]))return e.replace(/\{(\d+)\}/g,(a,s)=>{let c=Number.parseInt(s,10);return c<t[0].length?String(t[0][c]):a});let n=/%([sdijfo%])/g,r=0,o=e.replace(n,(a,s)=>{if(s==="%")return"%";if(r>=t.length)return a;let c=t[r++];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 a}});if(r<t.length)o+=` ${t.slice(r).map((a)=>typeof a==="object"?JSON.stringify(a,null,2):String(a)).join(" ")}`;return o}async log(e,t,...n){let r=new Date,o=this.formatConsoleTimestamp(r),a=this.formatFileTimestamp(r),s,c;if(t instanceof Error)s=t.message,c=t.stack;else s=this.formatMessage(t,n);if(this.fancy&&!R()){let d=Ho[e],l=this.options.showTags!==!1&&this.name?Z.gray(this.formatTag(this.name)):"",m;switch(e){case"debug":m=this.formatConsoleMessage({timestamp:o,icon:d,tag:l,message:Z.gray(s),level:e}),console.error(m);break;case"info":m=this.formatConsoleMessage({timestamp:o,icon:d,tag:l,message:s,level:e}),console.error(m);break;case"success":m=this.formatConsoleMessage({timestamp:o,icon:d,tag:l,message:Z.green(s),level:e}),console.error(m);break;case"warning":m=this.formatConsoleMessage({timestamp:o,icon:d,tag:l,message:s,level:e}),console.warn(m);break;case"error":if(m=this.formatConsoleMessage({timestamp:o,icon:d,tag:l,message:s,level:e}),console.error(m),c){let u=c.split(`
1198
+ `);for(let p of u)if(p.trim()&&!p.includes(s))console.error(this.formatConsoleMessage({timestamp:o,message:Z.gray(` ${p}`),level:e,showTimestamp:!1}))}break}}else if(!R()){if(console.error(`${a} ${this.environment}.${e.toUpperCase()}: ${s}`),c)console.error(c)}if(!this.shouldLog(e))return;let i=`${a} ${this.environment}.${e.toUpperCase()}: ${s}
1192
1199
  `;if(c)i+=`${c}
1193
- `;i=i.replace(this.ANSI_PATTERN,""),await this.writeToFile(i)}time(e){let t=performance.now();if(this.fancy&&!S()){let n=this.options.showTags!==!1&&this.name?R.gray(this.formatTag(this.name)):"",r=this.formatConsoleTimestamp(new Date);console.error(this.formatConsoleMessage({timestamp:r,icon:R.blue("\u25D0"),tag:n,message:`${R.cyan(e)}...`}))}return async(n)=>{if(!this.enabled)return;let r=performance.now(),o=Math.round(r-t),a=`${e} completed in ${o}ms`,s=new Date,c=this.formatConsoleTimestamp(s),i=`${this.formatFileTimestamp(s)} ${this.environment}.INFO: ${a}`;if(n)i+=` ${JSON.stringify(n)}`;if(i+=`
1194
- `,i=i.replace(this.ANSI_PATTERN,""),this.fancy&&!S()){let d=this.options.showTags!==!1&&this.name?R.gray(this.formatTag(this.name)):"";console.error(this.formatConsoleMessage({timestamp:c,icon:R.green("\u2713"),tag:d,message:`${a}${n?` ${JSON.stringify(n)}`:""}`}))}else if(!S())console.error(i.trim());await this.writeToFile(i)}}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}`,n=new tt(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(n),n}createReadStream(){if(S())throw Error("createReadStream is not supported in browser environments");if(!Lt(this.currentLogFile))throw Error(`Log file does not exist: ${this.currentLogFile}`);return Jn(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 n=this.keys.get(this.currentKeyId);try{let r=me.isBuffer(e)?e:me.from(e,"base64"),o=r.slice(0,16),a=r.slice(-16),s=r.slice(16,-16),c=To("aes-256-gcm",n,o);return c.setAuthTag(a),me.concat([c.update(s),c.final()]).toString("utf8")}catch(r){throw Error(`Decryption failed: ${r instanceof Error?r.message:String(r)}`)}}getLevel(){return this.config.level}getLogDirectory(){return this.config.logDirectory}getFormat(){return this.config.format}getRotationConfig(){return this.config.rotation}isBrowserMode(){return S()}isServerMode(){return!S()}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,n=this.formatConsoleTimestamp(t),r=this.formatFileTimestamp(t);if(this.fancy&&!S()){let a=e.split(`
1195
- `),s=Math.max(...a.map((m)=>m.length))+2,c=`\u250C${"\u2500".repeat(s)}\u2510`,i=`\u2514${"\u2500".repeat(s)}\u2518`,d=a.map((m)=>{let l=" ".repeat(s-m.length-2);return`\u2502 ${m}${l} \u2502`});if(this.options.showTags!==!1&&this.name)console.error(this.formatConsoleMessage({timestamp:n,message:R.gray(this.formatTag(this.name)),showTimestamp:!1}));console.error(this.formatConsoleMessage({timestamp:n,message:R.cyan(c)})),d.forEach((m)=>console.error(this.formatConsoleMessage({timestamp:n,message:R.cyan(m),showTimestamp:!1}))),console.error(this.formatConsoleMessage({timestamp:n,message:R.cyan(i),showTimestamp:!1}))}else if(!S())console.error(`${r} ${this.environment}.INFO: [BOX] ${e}`);let o=`${r} ${this.environment}.INFO: [BOX] ${e}
1196
- `.replace(this.ANSI_PATTERN,"");await this.writeToFile(o)}async prompt(e){if(S())return Promise.resolve(!0);return new Promise((t)=>{console.error(`${R.cyan("?")} ${e} (y/n) `);let n=(r)=>{let o=r.toString().trim().toLowerCase();F.stdin.removeListener("data",n);try{if(typeof F.stdin.setRawMode==="function")F.stdin.setRawMode(!1)}catch{}F.stdin.pause(),console.error(""),t(o==="y"||o==="yes")};try{if(typeof F.stdin.setRawMode==="function")F.stdin.setRawMode(!0)}catch{}F.stdin.resume(),F.stdin.once("data",n)})}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 n=e;if(t&&t.length>0){let o=/%([sdijfo%])/g,a=0;if(n=e.replace(o,(s,c)=>{if(c==="%")return"%";if(a>=t.length)return s;let i=t[a++];switch(c){case"s":return String(i);case"d":case"i":return Number(i).toString();case"j":case"o":return JSON.stringify(i,null,2);default:return s}}),a<t.length)n+=` ${t.slice(a).map((s)=>typeof s==="object"?JSON.stringify(s,null,2):String(s)).join(" ")}`}if(this.fancy&&!S()){let o=this.options.showTags!==!1&&this.name?R.gray(this.formatTag(this.name)):"",a=R.blue("\u25D0");console.error(`${a} ${o} ${R.cyan(n)}`)}let r=`[${new Date().toISOString()}] ${this.environment}.INFO: [START] ${n}
1197
- `.replace(this.ANSI_PATTERN,"");await this.writeToFile(r)}progress(e,t=""){if(!this.enabled||!this.fancy||S()||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 n=20;return this.activeProgressBar={total:e,current:0,message:t,barLength:n,lastRenderedLine:""},this.renderProgressBar(this.activeProgressBar),{update:(r,o)=>{if(!this.activeProgressBar||!this.enabled||!this.fancy||S())return;if(this.activeProgressBar.current=Math.max(0,Math.min(e,r)),o!==void 0)this.activeProgressBar.message=o;let a=this.activeProgressBar.current===this.activeProgressBar.total;this.renderProgressBar(this.activeProgressBar,a)},finish:(r)=>{if(!this.activeProgressBar||!this.enabled||!this.fancy||S())return;if(this.activeProgressBar.current=this.activeProgressBar.total,r!==void 0)this.activeProgressBar.message=r;this.renderProgressBar(this.activeProgressBar,!0),this.finishProgressBar(this.activeProgressBar)},interrupt:(r,o="info")=>{if(!this.activeProgressBar||!this.enabled||!this.fancy||S())return;F.stdout.write(`${"\r".padEnd(F.stdout.columns||80)}\r`),this.log(o,r),setTimeout(()=>{if(this.activeProgressBar)this.renderProgressBar(this.activeProgressBar)},50)}}}renderProgressBar(e,t=!1){if(!this.enabled||!this.fancy||S()||!F.stdout.isTTY)return;let n=Math.min(100,Math.max(0,Math.round(e.current/e.total*100))),r=Math.round(e.barLength*n/100),o=e.barLength-r,a=R.green("\u2501".repeat(r)),s=R.gray("\u2501".repeat(o)),c=`[${a}${s}]`,i=`${n}%`.padStart(4),d=e.message?` ${e.message}`:"",m=t||n===100?R.green("\u2713"):R.blue("\u25B6"),l=this.options.showTags!==!1&&this.name?` ${R.gray(this.formatTag(this.name))}`:"",u=`\r${m}${l} ${c} ${i}${d}`,p=F.stdout.columns||80,f=" ".repeat(Math.max(0,p-u.replace(this.ANSI_PATTERN,"").length));if(e.lastRenderedLine=`${u}${f}`,F.stdout.write(e.lastRenderedLine),t)F.stdout.write(`
1198
- `)}finishProgressBar(e,t){if(!this.enabled||!this.fancy||S()||!F.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(S()){console.warn("Log clearing is not supported in browser environments.");return}try{console.warn("Clearing logs...",this.config.logDirectory);let t=await ve(this.config.logDirectory),n=[];for(let r of t){if(!(e.name?new RegExp(e.name.replace("*",".*")).test(r):r.startsWith(this.name))||!r.endsWith(".log"))continue;let o=ge(this.config.logDirectory,r);if(e.before)try{if((await ke(o)).mtime>=e.before)continue}catch(a){console.error(`Failed to get stats for file ${o}:`,a);continue}n.push(o)}if(n.length===0){console.warn("No log files matched the criteria for clearing.");return}console.warn(`Preparing to delete ${n.length} log file(s)...`);for(let r of n)try{await Me(r),console.warn(`Deleted log file: ${r}`)}catch(o){console.error(`Failed to delete log file ${r}:`,o)}console.warn("Log clearing process finished.")}catch(t){console.error("Error during log clearing process:",t)}}}var cd=new tt("stacks");function De(e,t){if(Array.isArray(t)&&Array.isArray(e)&&t.length===2&&e.length===2&&N(t[0])&&"id"in t[0]&&t[0].id===3&&N(t[1])&&"id"in t[1]&&t[1].id===4)return t;if(N(t)&&N(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(N(e)&&"arr"in e&&Array.isArray(e.arr)&&N(t)&&"arr"in t&&Array.isArray(t.arr))return t;if(t.length>0&&e.length>0&&N(t[0])&&N(e[0])){let r=[...t];for(let o of e)if(N(o)&&"name"in o){if(!r.find((a)=>N(a)&&("name"in a)&&a.name===o.name))r.push(o)}else if(N(o)&&"path"in o){if(!r.find((a)=>N(a)&&("path"in a)&&a.path===o.path))r.push(o)}else if(!r.some((a)=>et(a,o)))r.push(o);return r}if(t.every((r)=>typeof r==="string")&&e.every((r)=>typeof r==="string")){let r=[...t];for(let o of e)if(!r.includes(o))r.push(o);return r}return t}if(!N(t)||!N(e))return t;let n={...e};for(let r in t)if(Object.prototype.hasOwnProperty.call(t,r)){let o=t[r];if(o===null||o===void 0)continue;else if(N(o)&&N(n[r]))n[r]=De(n[r],o);else if(Array.isArray(o)&&Array.isArray(n[r]))if(o.length>0&&n[r].length>0&&N(o[0])&&N(n[r][0])){let a=[...o];for(let s of n[r])if(N(s)&&"name"in s){if(!a.find((c)=>N(c)&&("name"in c)&&c.name===s.name))a.push(s)}else if(N(s)&&"path"in s){if(!a.find((c)=>N(c)&&("path"in c)&&c.path===s.path))a.push(s)}else if(!a.some((c)=>et(c,s)))a.push(s);n[r]=a}else if(o.every((a)=>typeof a==="string")&&n[r].every((a)=>typeof a==="string")){let a=[...o];for(let s of n[r])if(!a.includes(s))a.push(s);n[r]=a}else n[r]=o;else n[r]=o}return n}function Ft(e,t,n="replace"){if(t===null||t===void 0)return e;if(Array.isArray(t))return n==="replace"?t:De(e,t);if(Array.isArray(e))return n==="replace"?t:De(e,t);if(!N(t)||!N(e))return t;let r={...e};for(let o of Object.keys(t)){if(!Object.prototype.hasOwnProperty.call(t,o))continue;let a=t[o],s=r[o];if(a===null||a===void 0)continue;if(Array.isArray(a)||Array.isArray(s))if(n==="replace")r[o]=a;else r[o]=De(s,a);else if(N(a)&&N(s))r[o]=Ft(s,a,n);else r[o]=a}return r}function et(e,t){if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!et(e[n],t[n]))return!1;return!0}if(N(e)&&N(t)){let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let o of n){if(!Object.prototype.hasOwnProperty.call(t,o))return!1;if(!et(e[o],t[o]))return!1}return!0}return!1}function N(e){return Boolean(e&&typeof e==="object"&&!Array.isArray(e))}var C=new tt("bunfig",{showTags:!0});async function Ke(e,t,n="replace"){if(!Vn(e))return null;try{let r=await import(e),o=r.default||r;if(typeof o!=="object"||o===null||Array.isArray(o))return null;try{return Ft(t,o,n)}catch{return null}}catch{return null}}function Mo(e,t,n=!1){if(!e)return t;let r=e.toUpperCase().replace(/-/g,"_"),o={...t};function a(s,c=[]){let i={...s};for(let[d,m]of Object.entries(s)){let l=[...c,d],u=(y)=>y.replace(/([A-Z])/g,"_$1").toUpperCase(),p=`${r}_${l.map(u).join("_")}`,f=`${r}_${l.map((y)=>y.toUpperCase()).join("_")}`;if(n)C.info(`Checking environment variable ${p} for config ${e}.${l.join(".")}`);if(typeof m==="object"&&m!==null&&!Array.isArray(m))i[d]=a(m,l);else{let y=_e.env[p]||_e.env[f];if(y!==void 0){if(n)C.info(`Using environment variable ${y?p:f} for config ${e}.${l.join(".")}`);if(typeof m==="number")i[d]=Number(y);else if(typeof m==="boolean")i[d]=y.toLowerCase()==="true";else if(Array.isArray(m))try{let h=JSON.parse(y);if(Array.isArray(h))i[d]=h;else i[d]=y.split(",").map((w)=>w.trim())}catch{i[d]=y.split(",").map((h)=>h.trim())}else i[d]=y}}}return i}return a(o)}async function Ko({name:e="",alias:t,cwd:n,configDir:r,defaultConfig:o,verbose:a=!1,checkEnv:s=!0,arrayStrategy:c="replace"}){let i=s&&typeof o==="object"&&o!==null&&!Array.isArray(o)?Mo(e,o,a):o,d=n||_e.cwd(),m=[".ts",".js",".mjs",".cjs",".json"];if(a)C.info(`Loading configuration for "${e}"${t?` (alias: "${t}")`:""} from ${d}`);let l=[e,`.${e}`].filter(Boolean),u=[`${e}.config`,`.${e}.config`].filter(Boolean),p=t?[t,`.${t}`]:[],f=t?[`${t}.config`,`.${t}.config`]:[],y=Array.from(new Set([d,v(d,"config"),v(d,".config"),r?v(d,r):void 0].filter(Boolean)));for(let h of y){if(a)C.info(`Searching for configuration in: ${h}`);let w=[v(d,"config"),v(d,".config")].concat(r?[v(d,r)]:[]).includes(h)?[...l,...u,...p,...f]:[...u,...l,...f,...p];for(let b of w)for(let _ of m){let A=v(h,`${b}${_}`),k=await Ke(A,i,c);if(k!==null){if(a)C.success(`Configuration loaded from: ${A}`);return k}}}if(e){let h=v(xt(),".config",e),w=["config",`${e}.config`];if(t)w.push(`${t}.config`);if(a)C.info(`Checking user config directory: ${h}`);for(let b of w)for(let _ of m){let A=v(h,`${b}${_}`),k=await Ke(A,i,c);if(k!==null){if(a)C.success(`Configuration loaded from user config directory: ${A}`);return k}}}if(e){let h=v(xt(),".config"),w=[`.${e}.config`];if(t)w.push(`.${t}.config`);if(a)C.info(`Checking user config directory for dotfile configs: ${h}`);for(let b of w)for(let _ of m){let A=v(h,`${b}${_}`),k=await Ke(A,i,c);if(k!==null){if(a)C.success(`Configuration loaded from user config directory dotfile: ${A}`);return k}}}if(e){let h=xt(),w=[`.${e}.config`,`.${e}`];if(t)w.push(`.${t}.config`),w.push(`.${t}`);if(a)C.info(`Checking user home directory for dotfile configs: ${h}`);for(let b of w)for(let _ of m){let A=v(h,`${b}${_}`),k=await Ke(A,i,c);if(k!==null){if(a)C.success(`Configuration loaded from user home directory: ${A}`);return k}}}try{let h=v(d,"package.json");if(Vn(h)){let w=await import(h),b=w[e];if(!b&&t){if(b=w[t],b&&a)C.success(`Using alias "${t}" configuration from package.json`)}if(b&&typeof b==="object"&&!Array.isArray(b))try{if(a)C.success(`Configuration loaded from package.json: ${b===w[e]?e:t}`);return Ft(i,b,c)}catch(_){if(a)C.warn("Failed to merge package.json config:",_)}}}catch(h){if(a)C.warn("Failed to load package.json:",h)}if(a)C.info(`No configuration found for "${e}"${t?` or alias "${t}"`:""}, using default configuration with environment variables`);return i}var dd=v(_e.cwd(),"config"),md=v(_e.cwd(),"src/generated"),Do={verbose:!1,theme:"github-dark",defaultLanguage:"javascript",cache:!0,plugins:[]},Gt=await Ko({name:"syntax",defaultConfig:Do});var Ho={name:"ABNF",scopeName:"source.abnf",keywords:{},patterns:[{include:"#rules"},{include:"#comments"}],repository:{rules:{patterns:[{name:"entity.name.type.abnf",match:"^[a-zA-Z][a-zA-Z0-9-]*(?=\\s*=)"},{name:"keyword.operator.abnf",match:"="}]},comments:{patterns:[{name:"comment.line.semicolon.abnf",match:";.*$"}]}}},Vo={name:"Bash",scopeName:"source.bash",keywords:{if:"keyword.control.bash",then:"keyword.control.bash",else:"keyword.control.bash",elif:"keyword.control.bash",fi:"keyword.control.bash",case:"keyword.control.bash",esac:"keyword.control.bash",for:"keyword.control.bash",while:"keyword.control.bash",until:"keyword.control.bash",do:"keyword.control.bash",done:"keyword.control.bash",in:"keyword.control.bash",select:"keyword.control.bash",function:"storage.type.function.bash",declare:"storage.type.bash",local:"storage.type.bash",export:"storage.type.bash",readonly:"storage.type.bash",typeset:"storage.type.bash",echo:"support.function.builtin.bash",printf:"support.function.builtin.bash",read:"support.function.builtin.bash",cd:"support.function.builtin.bash",pwd:"support.function.builtin.bash",exit:"support.function.builtin.bash",return:"support.function.builtin.bash",source:"support.function.builtin.bash",test:"support.function.builtin.bash",eval:"support.function.builtin.bash",exec:"support.function.builtin.bash",shift:"support.function.builtin.bash",set:"support.function.builtin.bash",unset:"support.function.builtin.bash",alias:"support.function.builtin.bash",unalias:"support.function.builtin.bash",true:"constant.language.bash",false:"constant.language.bash"},patterns:[{include:"#strings"},{include:"#variables"},{include:"#comments"},{include:"#keywords"},{include:"#functions"},{include:"#operators"},{include:"#numbers"}],repository:{comments:{patterns:[{name:"comment.line.number-sign.bash",match:"#.*$"}]},strings:{patterns:[{name:"string.quoted.double.bash",begin:'"',end:'"',patterns:[{name:"constant.character.escape.bash",match:'\\\\[\\\\"`$\\n]'},{include:"#variables"},{name:"variable.other.subshell.bash",begin:"\\$\\(",end:"\\)"},{name:"variable.other.backtick.bash",begin:"`",end:"`"}]},{name:"string.quoted.single.bash",begin:"'",end:"'"},{name:"string.unquoted.heredoc.bash",begin:`<<-?\\s*(['"]?)(\\w+)\\1`,end:"^\\2$"}]},variables:{patterns:[{name:"variable.other.bracket.bash",match:"\\$\\{[^}]+\\}"},{name:"variable.other.normal.bash",match:"\\$[a-zA-Z_][a-zA-Z0-9_]*"},{name:"variable.other.positional.bash",match:"\\$[0-9@*#?$!-]"}]},functions:{patterns:[{name:"entity.name.function.bash",match:"\\b([a-zA-Z_][a-zA-Z0-9_]*)\\s*\\(\\)"}]},keywords:{patterns:[{name:"keyword.control.bash",match:"\\b(if|then|else|elif|fi|case|esac|for|while|until|do|done|in|select)\\b"},{name:"storage.type.bash",match:"\\b(function|declare|local|export|readonly|typeset)\\b"},{name:"support.function.builtin.bash",match:"\\b(echo|printf|read|cd|pwd|exit|return|source|test|eval|exec|shift|set|unset|alias|unalias)\\b"},{name:"constant.language.bash",match:"\\b(true|false)\\b"}]},operators:{patterns:[{name:"keyword.operator.logical.bash",match:"(&&|\\|\\||!)"},{name:"keyword.operator.pipe.bash",match:"\\|"},{name:"keyword.operator.redirect.bash",match:"(>>|>|<<|<|&>|&>>|2>|2>>)"},{name:"keyword.operator.assignment.bash",match:"="}]},numbers:{patterns:[{name:"constant.numeric.bash",match:"\\b[0-9]+\\b"}]}}},Po={name:"BNF",scopeName:"source.bnf",keywords:{},patterns:[{include:"#rules"},{include:"#terminals"},{include:"#nonterminals"}],repository:{rules:{patterns:[{name:"keyword.operator.bnf",match:"::="}]},nonterminals:{patterns:[{name:"entity.name.type.bnf",match:"<[^>]+>"}]},terminals:{patterns:[{name:"string.quoted.double.bnf",begin:'"',end:'"'},{name:"string.quoted.single.bnf",begin:"'",end:"'"}]}}},ea={name:"C",scopeName:"source.c",keywords:{if:"keyword.control.c",else:"keyword.control.c",for:"keyword.control.c",while:"keyword.control.c",do:"keyword.control.c",switch:"keyword.control.c",case:"keyword.control.c",default:"keyword.control.c",break:"keyword.control.c",continue:"keyword.control.c",return:"keyword.control.c",goto:"keyword.control.c",void:"storage.type.c",char:"storage.type.c",short:"storage.type.c",int:"storage.type.c",long:"storage.type.c",float:"storage.type.c",double:"storage.type.c",signed:"storage.type.c",unsigned:"storage.type.c",struct:"storage.type.c",union:"storage.type.c",enum:"storage.type.c",typedef:"storage.type.c",const:"storage.modifier.c",static:"storage.modifier.c",extern:"storage.modifier.c",register:"storage.modifier.c",volatile:"storage.modifier.c",inline:"storage.modifier.c",restrict:"storage.modifier.c",_Atomic:"storage.modifier.c",sizeof:"keyword.operator.sizeof.c",size_t:"support.type.c",FILE:"support.type.c",NULL:"constant.language.c"},patterns:[{include:"#preprocessor"},{include:"#comments"},{include:"#strings"},{include:"#keywords"},{include:"#numbers"},{include:"#functions"},{include:"#operators"}],repository:{preprocessor:{patterns:[{name:"meta.preprocessor.include.c",match:'^\\s*#\\s*include\\s+(<[^>]+>|"[^"]+")',captures:{1:{name:"string.quoted.other.lt-gt.include.c"}}},{name:"meta.preprocessor.macro.c",match:"^\\s*#\\s*(define|undef)\\s+([a-zA-Z_][a-zA-Z0-9_]*)",captures:{1:{name:"keyword.control.directive.c"},2:{name:"entity.name.function.preprocessor.c"}}},{name:"meta.preprocessor.c",match:"^\\s*#\\s*(if|ifdef|ifndef|elif|else|endif|pragma|error|warning|line)\\b",captures:{1:{name:"keyword.control.directive.c"}}}]},comments:{patterns:[{name:"comment.line.double-slash.c",match:"\\/\\/.*$"},{name:"comment.block.c",begin:"\\/\\*",end:"\\*\\/"}]},strings:{patterns:[{name:"string.quoted.double.c",begin:'"',end:'"',patterns:[{name:"constant.character.escape.c",match:"\\\\."}]},{name:"string.quoted.single.c",begin:"'",end:"'",patterns:[{name:"constant.character.escape.c",match:"\\\\."}]}]},keywords:{patterns:[{name:"keyword.control.c",match:"\\b(if|else|for|while|do|switch|case|default|break|continue|return|goto)\\b"},{name:"storage.type.c",match:"\\b(void|char|short|int|long|float|double|signed|unsigned|struct|union|enum|typedef)\\b"},{name:"storage.modifier.c",match:"\\b(const|static|extern|register|volatile|inline|restrict|_Atomic)\\b"},{name:"constant.language.c",match:"\\b(NULL|true|false)\\b"}]},numbers:{patterns:[{name:"constant.numeric.c",match:"\\b(?:0[xX][0-9a-fA-F]+[uUlL]*|0[0-7]+[uUlL]*|\\d+\\.?\\d*(?:[eE][+-]?\\d+)?[fFlL]?)\\b"}]},functions:{patterns:[{name:"entity.name.function.c",match:"\\b([a-zA-Z_][a-zA-Z0-9_]*)\\s*(?=\\()"}]},operators:{patterns:[{name:"keyword.operator.c",match:"(\\+\\+|--|\\+|\\-|\\*|/|%|==|!=|<=|>=|<|>|&&|\\|\\||!|&|\\||\\^|~|<<|>>|\\?|:|=|\\+=|-=|\\*=|/=|%=|&=|\\|=|\\^=|<<=|>>=|->|\\.)"}]}}},ta={name:"Batch",scopeName:"source.cmd",keywords:{if:"keyword.control.cmd",else:"keyword.control.cmd",for:"keyword.control.cmd",do:"keyword.control.cmd",goto:"keyword.control.cmd",call:"keyword.control.cmd",exit:"keyword.control.cmd",echo:"support.function.cmd",set:"support.function.cmd",setlocal:"support.function.cmd",endlocal:"support.function.cmd"},patterns:[{include:"#comments"},{include:"#variables"},{include:"#labels"},{include:"#keywords"}],repository:{comments:{patterns:[{name:"comment.line.rem.cmd",match:"^\\s*[Rr][Ee][Mm]\\b.*$"},{name:"comment.line.colons.cmd",match:"^\\s*::.*$"}]},variables:{patterns:[{name:"variable.other.cmd",match:"%[a-zA-Z_][a-zA-Z0-9_]*%"},{name:"variable.other.cmd",match:"![a-zA-Z_][a-zA-Z0-9_]*!"}]},labels:{patterns:[{name:"entity.name.label.cmd",match:"^:[a-zA-Z_][a-zA-Z0-9_]*"}]},keywords:{patterns:[{name:"keyword.control.cmd",match:"\\b(if|else|for|do|goto|call|exit)\\b"},{name:"support.function.cmd",match:"\\b(echo|set|setlocal|endlocal)\\b"}]}}},na={name:"C++",scopeName:"source.cpp",keywords:{if:"keyword.control.cpp",else:"keyword.control.cpp",for:"keyword.control.cpp",while:"keyword.control.cpp",do:"keyword.control.cpp",switch:"keyword.control.cpp",case:"keyword.control.cpp",default:"keyword.control.cpp",break:"keyword.control.cpp",continue:"keyword.control.cpp",return:"keyword.control.cpp",goto:"keyword.control.cpp",try:"keyword.control.cpp",catch:"keyword.control.cpp",throw:"keyword.control.cpp",void:"storage.type.cpp",bool:"storage.type.cpp",char:"storage.type.cpp",short:"storage.type.cpp",int:"storage.type.cpp",long:"storage.type.cpp",float:"storage.type.cpp",double:"storage.type.cpp",signed:"storage.type.cpp",unsigned:"storage.type.cpp",struct:"storage.type.cpp",union:"storage.type.cpp",enum:"storage.type.cpp",class:"storage.type.cpp",typedef:"storage.type.cpp",typename:"storage.type.cpp",auto:"storage.type.cpp",decltype:"storage.type.cpp",const:"storage.modifier.cpp",static:"storage.modifier.cpp",extern:"storage.modifier.cpp",register:"storage.modifier.cpp",volatile:"storage.modifier.cpp",inline:"storage.modifier.cpp",virtual:"storage.modifier.cpp",explicit:"storage.modifier.cpp",friend:"storage.modifier.cpp",mutable:"storage.modifier.cpp",constexpr:"storage.modifier.cpp",consteval:"storage.modifier.cpp",constinit:"storage.modifier.cpp",public:"storage.modifier.access.cpp",private:"storage.modifier.access.cpp",protected:"storage.modifier.access.cpp",new:"keyword.operator.new.cpp",delete:"keyword.operator.delete.cpp",sizeof:"keyword.operator.sizeof.cpp",alignof:"keyword.operator.alignof.cpp",typeid:"keyword.operator.typeid.cpp",static_cast:"keyword.operator.cast.cpp",dynamic_cast:"keyword.operator.cast.cpp",const_cast:"keyword.operator.cast.cpp",reinterpret_cast:"keyword.operator.cast.cpp",namespace:"keyword.other.namespace.cpp",using:"keyword.other.using.cpp",template:"keyword.other.template.cpp",this:"variable.language.cpp",nullptr:"constant.language.cpp",true:"constant.language.cpp",false:"constant.language.cpp",operator:"keyword.operator.cpp",concept:"keyword.other.concept.cpp",requires:"keyword.other.requires.cpp",co_await:"keyword.control.cpp",co_return:"keyword.control.cpp",co_yield:"keyword.control.cpp"},patterns:[{include:"#preprocessor"},{include:"#comments"},{include:"#strings"},{include:"#keywords"},{include:"#numbers"},{include:"#functions"},{include:"#operators"}],repository:{preprocessor:{patterns:[{name:"meta.preprocessor.include.cpp",match:'^\\s*#\\s*include\\s+(<[^>]+>|"[^"]+")',captures:{1:{name:"string.quoted.other.lt-gt.include.cpp"}}},{name:"meta.preprocessor.macro.cpp",match:"^\\s*#\\s*(define|undef)\\s+([a-zA-Z_][a-zA-Z0-9_]*)",captures:{1:{name:"keyword.control.directive.cpp"},2:{name:"entity.name.function.preprocessor.cpp"}}},{name:"meta.preprocessor.cpp",match:"^\\s*#\\s*(if|ifdef|ifndef|elif|else|endif|pragma|error|warning|line)\\b",captures:{1:{name:"keyword.control.directive.cpp"}}}]},comments:{patterns:[{name:"comment.line.double-slash.cpp",match:"\\/\\/.*$"},{name:"comment.block.cpp",begin:"\\/\\*",end:"\\*\\/"}]},strings:{patterns:[{name:"string.quoted.raw.cpp",begin:'R"([a-zA-Z0-9_]*)\\(',end:'\\)\\1"'},{name:"string.quoted.double.cpp",begin:'"',end:'"',patterns:[{name:"constant.character.escape.cpp",match:"\\\\."}]},{name:"string.quoted.single.cpp",begin:"'",end:"'",patterns:[{name:"constant.character.escape.cpp",match:"\\\\."}]}]},keywords:{patterns:[{name:"keyword.control.cpp",match:"\\b(if|else|for|while|do|switch|case|default|break|continue|return|goto|try|catch|throw|co_await|co_return|co_yield)\\b"},{name:"storage.type.cpp",match:"\\b(void|bool|char|short|int|long|float|double|signed|unsigned|struct|union|enum|class|typedef|typename|auto|decltype)\\b"},{name:"storage.modifier.cpp",match:"\\b(const|static|extern|register|volatile|inline|virtual|explicit|friend|mutable|constexpr|consteval|constinit)\\b"},{name:"storage.modifier.access.cpp",match:"\\b(public|private|protected)\\b"},{name:"constant.language.cpp",match:"\\b(true|false|nullptr)\\b"},{name:"keyword.other.cpp",match:"\\b(namespace|using|template|operator|concept|requires)\\b"}]},numbers:{patterns:[{name:"constant.numeric.cpp",match:"\\b(?:0[xX][0-9a-fA-F]+[uUlL]*|0[bB][01]+[uUlL]*|0[0-7]+[uUlL]*|\\d+\\.?\\d*(?:[eE][+-]?\\d+)?[fFlL]?)\\b"}]},functions:{patterns:[{name:"entity.name.function.cpp",match:"\\b([a-zA-Z_][a-zA-Z0-9_]*)\\s*(?=\\()"}]},operators:{patterns:[{name:"keyword.operator.cpp",match:"(\\+\\+|--|\\+|\\-|\\*|/|%|==|!=|<=|>=|<|>|&&|\\|\\||!|&|\\||\\^|~|<<|>>|\\?|:|=|\\+=|-=|\\*=|/=|%=|&=|\\|=|\\^=|<<=|>>=|->|\\.|::)"}]}}},ra={name:"C#",scopeName:"source.cs",keywords:{if:"keyword.control.cs",else:"keyword.control.cs",for:"keyword.control.cs",foreach:"keyword.control.cs",while:"keyword.control.cs",do:"keyword.control.cs",switch:"keyword.control.cs",case:"keyword.control.cs",default:"keyword.control.cs",break:"keyword.control.cs",continue:"keyword.control.cs",return:"keyword.control.cs",goto:"keyword.control.cs",try:"keyword.control.cs",catch:"keyword.control.cs",finally:"keyword.control.cs",throw:"keyword.control.cs",yield:"keyword.control.cs",await:"keyword.control.cs",class:"keyword.other.class.cs",struct:"keyword.other.struct.cs",interface:"keyword.other.interface.cs",enum:"keyword.other.enum.cs",delegate:"keyword.other.delegate.cs",record:"keyword.other.record.cs",void:"keyword.type.cs",bool:"keyword.type.cs",byte:"keyword.type.cs",sbyte:"keyword.type.cs",char:"keyword.type.cs",decimal:"keyword.type.cs",double:"keyword.type.cs",float:"keyword.type.cs",int:"keyword.type.cs",uint:"keyword.type.cs",long:"keyword.type.cs",ulong:"keyword.type.cs",short:"keyword.type.cs",ushort:"keyword.type.cs",object:"keyword.type.cs",string:"keyword.type.cs",var:"keyword.type.cs",dynamic:"keyword.type.cs",public:"storage.modifier.cs",private:"storage.modifier.cs",protected:"storage.modifier.cs",internal:"storage.modifier.cs",static:"storage.modifier.cs",readonly:"storage.modifier.cs",const:"storage.modifier.cs",virtual:"storage.modifier.cs",override:"storage.modifier.cs",abstract:"storage.modifier.cs",sealed:"storage.modifier.cs",partial:"storage.modifier.cs",async:"storage.modifier.cs",extern:"storage.modifier.cs",volatile:"storage.modifier.cs",namespace:"keyword.other.namespace.cs",using:"keyword.other.using.cs",new:"keyword.operator.new.cs",this:"variable.language.cs",base:"variable.language.cs",true:"constant.language.cs",false:"constant.language.cs",null:"constant.language.cs",typeof:"keyword.operator.cs",sizeof:"keyword.operator.cs",is:"keyword.operator.cs",as:"keyword.operator.cs",in:"keyword.operator.cs",out:"keyword.operator.cs",ref:"keyword.operator.cs",params:"keyword.other.cs",operator:"keyword.other.cs",implicit:"keyword.other.cs",explicit:"keyword.other.cs",get:"keyword.other.cs",set:"keyword.other.cs",value:"keyword.other.cs",add:"keyword.other.cs",remove:"keyword.other.cs",event:"keyword.other.cs",lock:"keyword.control.cs",checked:"keyword.control.cs",unchecked:"keyword.control.cs",unsafe:"keyword.other.cs",fixed:"keyword.other.cs",stackalloc:"keyword.operator.cs",nameof:"keyword.operator.cs",when:"keyword.control.cs"},patterns:[{include:"#comments"},{include:"#strings"},{include:"#attributes"},{include:"#keywords"},{include:"#numbers"},{include:"#functions"},{include:"#operators"}],repository:{comments:{patterns:[{name:"comment.line.double-slash.cs",match:"\\/\\/.*$"},{name:"comment.block.documentation.cs",begin:"\\/\\/\\/",end:"$"},{name:"comment.block.cs",begin:"\\/\\*",end:"\\*\\/"}]},strings:{patterns:[{name:"string.quoted.verbatim.cs",begin:'@"',end:'"',patterns:[{name:"constant.character.escape.cs",match:'""'}]},{name:"string.quoted.interpolated.cs",begin:'\\$"',end:'"',patterns:[{name:"meta.interpolation.cs",begin:"\\{",end:"\\}",patterns:[{include:"$self"}]},{name:"constant.character.escape.cs",match:"\\\\."}]},{name:"string.quoted.double.cs",begin:'"',end:'"',patterns:[{name:"constant.character.escape.cs",match:"\\\\."}]},{name:"string.quoted.single.cs",begin:"'",end:"'",patterns:[{name:"constant.character.escape.cs",match:"\\\\."}]}]},attributes:{patterns:[{name:"meta.attribute.cs",begin:"\\[",end:"\\]",patterns:[{name:"entity.name.type.attribute.cs",match:"[A-Z][a-zA-Z0-9]*"}]}]},keywords:{patterns:[{name:"keyword.control.cs",match:"\\b(if|else|for|foreach|while|do|switch|case|default|break|continue|return|goto|try|catch|finally|throw|yield|await|lock|checked|unchecked|when)\\b"},{name:"keyword.other.cs",match:"\\b(class|struct|interface|enum|delegate|record|namespace|using|operator|implicit|explicit|get|set|value|add|remove|event|params|unsafe|fixed)\\b"},{name:"keyword.type.cs",match:"\\b(void|bool|byte|sbyte|char|decimal|double|float|int|uint|long|ulong|short|ushort|object|string|var|dynamic)\\b"},{name:"storage.modifier.cs",match:"\\b(public|private|protected|internal|static|readonly|const|virtual|override|abstract|sealed|partial|async|extern|volatile)\\b"},{name:"constant.language.cs",match:"\\b(true|false|null)\\b"},{name:"variable.language.cs",match:"\\b(this|base)\\b"},{name:"keyword.operator.cs",match:"\\b(new|typeof|sizeof|is|as|in|out|ref|stackalloc|nameof)\\b"}]},numbers:{patterns:[{name:"constant.numeric.cs",match:"\\b(?:0[xX][0-9a-fA-F_]+|0[bB][01_]+|\\d+[._]?\\d*(?:[eE][+-]?\\d+)?)[fFdDmMlLuU]*\\b"}]},functions:{patterns:[{name:"entity.name.function.cs",match:"\\b([a-zA-Z_][a-zA-Z0-9_]*)\\s*(?=\\()"}]},operators:{patterns:[{name:"keyword.operator.cs",match:"(\\+\\+|--|\\+|\\-|\\*|/|%|==|!=|<=|>=|<|>|&&|\\|\\||!|&|\\||\\^|~|<<|>>|\\?\\?|\\?|:|=|\\+=|-=|\\*=|/=|%=|&=|\\|=|\\^=|<<=|>>=|=>|\\.|->)"}]}}},oa={name:"CSS",scopeName:"source.css",patterns:[{include:"#comments"},{include:"#at-rules"},{include:"#selectors"},{include:"#properties"},{include:"#functions"},{include:"#variables"},{include:"#values"},{include:"#strings"},{include:"#numbers"},{include:"#colors"},{include:"#punctuation"}],repository:{comments:{patterns:[{name:"comment.block.css",begin:"\\/\\*",end:"\\*\\/"}]},"at-rules":{patterns:[{name:"keyword.control.at-rule.css",match:"@(media|import|charset|namespace|keyframes|font-face|supports|page|document|viewport|counter-style|font-feature-values|property|layer|container)\\b"}]},selectors:{patterns:[{name:"entity.name.tag.css",match:"\\b(a|abbr|address|article|aside|audio|b|blockquote|body|button|canvas|caption|cite|code|div|em|embed|fieldset|figcaption|figure|footer|form|h1|h2|h3|h4|h5|h6|header|html|i|iframe|img|input|label|legend|li|main|nav|ol|p|pre|section|select|span|strong|table|tbody|td|textarea|tfoot|th|thead|tr|ul|video)\\b"},{name:"entity.other.attribute-name.class.css",match:"\\.[a-zA-Z_-][a-zA-Z0-9_-]*"},{name:"entity.other.attribute-name.id.css",match:"#[a-zA-Z_-][a-zA-Z0-9_-]*"},{name:"entity.other.attribute-name.pseudo-class.css",match:":[a-zA-Z_-][a-zA-Z0-9_-]*"},{name:"entity.other.attribute-name.pseudo-element.css",match:"::[a-zA-Z_-][a-zA-Z0-9_-]*"}]},properties:{patterns:[{name:"support.type.property-name.css",match:"\\b(align-items|background|border|color|display|flex|font|height|justify-content|margin|padding|position|width|z-index|animation|box-shadow|cursor|font-family|font-size|font-weight|grid|line-height|opacity|overflow|text-align|text-decoration|transform|transition|visibility)(-[a-z]+)?\\b"}]},values:{patterns:[{name:"support.constant.property-value.css",match:"\\b(auto|block|inline|flex|grid|none|center|left|right|top|bottom|absolute|relative|fixed|sticky|hidden|visible|bold|normal|italic|underline|solid|dotted|dashed)\\b"}]},strings:{patterns:[{name:"string.quoted.double.css",begin:'"',end:'"'},{name:"string.quoted.single.css",begin:"'",end:"'"}]},numbers:{patterns:[{name:"constant.numeric.css",match:"\\b\\d+(\\.\\d+)?(px|em|rem|%|vh|vw|vmin|vmax|ch|ex|cm|mm|in|pt|pc|deg|rad|turn|s|ms)?\\b"}]},colors:{patterns:[{name:"constant.other.color.css",match:"#[0-9a-fA-F]{3,8}\\b"},{name:"support.function.color.css",match:"\\b(rgb|rgba|hsl|hsla|hwb|lab|lch|oklab|oklch|color)\\s*\\("}]},functions:{patterns:[{name:"support.function.css",match:"\\b(var|calc|min|max|clamp|round|abs|sign|mod|rem|sin|cos|tan|asin|acos|atan|atan2|pow|sqrt|hypot|log|exp|url|attr|counter|counters|linear-gradient|radial-gradient|conic-gradient|repeating-linear-gradient|repeating-radial-gradient|repeating-conic-gradient)\\s*\\("}]},variables:{patterns:[{name:"variable.other.custom-property.css",match:"--[a-zA-Z0-9_-]+"}]},punctuation:{patterns:[{name:"punctuation.css",match:"[{}();:,]"}]}}},aa={name:"CSV",scopeName:"text.csv",keywords:{},patterns:[{include:"#quoted"}],repository:{quoted:{patterns:[{name:"string.quoted.double.csv",begin:'"',end:'"',patterns:[{name:"constant.character.escape.csv",match:'""'}]}]}}},sa={name:"Dart",scopeName:"source.dart",keywords:{import:"keyword.other.dart",library:"keyword.other.dart",part:"keyword.other.dart",class:"keyword.other.dart",enum:"keyword.other.dart",extends:"keyword.other.dart",implements:"keyword.other.dart",with:"keyword.other.dart",mixin:"keyword.other.dart",if:"keyword.control.dart",else:"keyword.control.dart",for:"keyword.control.dart",while:"keyword.control.dart",do:"keyword.control.dart",switch:"keyword.control.dart",case:"keyword.control.dart",default:"keyword.control.dart",break:"keyword.control.dart",continue:"keyword.control.dart",return:"keyword.control.dart",try:"keyword.control.dart",catch:"keyword.control.dart",finally:"keyword.control.dart",throw:"keyword.control.dart",var:"storage.type.dart",final:"storage.type.dart",const:"storage.type.dart",late:"storage.modifier.dart",static:"storage.modifier.dart",async:"storage.modifier.dart",await:"keyword.control.dart",true:"constant.language.dart",false:"constant.language.dart",null:"constant.language.dart",this:"variable.language.dart",super:"variable.language.dart"},patterns:[{include:"#comments"},{include:"#strings"},{include:"#keywords"},{include:"#numbers"}],repository:{comments:{patterns:[{name:"comment.line.double-slash.dart",match:"\\/\\/.*$"},{name:"comment.block.dart",begin:"\\/\\*",end:"\\*\\/"}]},strings:{patterns:[{name:"string.quoted.triple.dart",begin:'"""',end:'"""'},{name:"string.quoted.double.dart",begin:'"',end:'"',patterns:[{name:"constant.character.escape.dart",match:"\\\\."},{name:"variable.other.dart",match:"\\$[a-zA-Z_][a-zA-Z0-9_]*"},{name:"meta.embedded.line.dart",begin:"\\$\\{",end:"\\}"}]},{name:"string.quoted.single.dart",begin:"'",end:"'"}]},keywords:{patterns:[{name:"keyword.control.dart",match:"\\b(if|else|for|while|do|switch|case|default|break|continue|return|try|catch|finally|throw|await)\\b"},{name:"keyword.other.dart",match:"\\b(import|library|part|class|enum|extends|implements|with|mixin)\\b"},{name:"storage.type.dart",match:"\\b(var|final|const)\\b"},{name:"constant.language.dart",match:"\\b(true|false|null)\\b"}]},numbers:{patterns:[{name:"constant.numeric.dart",match:"\\b\\d+\\.?\\d*\\b"}]}}},ia={name:"Diff",scopeName:"source.diff",keywords:{},patterns:[{include:"#file-header"},{include:"#hunk-header"},{include:"#added-line"},{include:"#removed-line"},{include:"#context-line"},{include:"#metadata"}],repository:{"file-header":{patterns:[{name:"meta.diff.header.from-file",match:"^(---\\s+)(.*)$",captures:{1:{name:"punctuation.definition.from-file.diff"},2:{name:"meta.diff.header.from-path"}}},{name:"meta.diff.header.to-file",match:"^(\\+\\+\\+\\s+)(.*)$",captures:{1:{name:"punctuation.definition.to-file.diff"},2:{name:"meta.diff.header.to-path"}}},{name:"meta.diff.header.git",match:"^diff --git.*$"}]},"hunk-header":{patterns:[{name:"meta.diff.range.unified",match:"^(@@)\\s+(-\\d+,\\d+\\s+\\+\\d+,\\d+)\\s+(@@)(.*)$",captures:{1:{name:"punctuation.definition.range.diff"},2:{name:"meta.diff.range.context"},3:{name:"punctuation.definition.range.diff"},4:{name:"entity.name.function.diff"}}}]},"added-line":{patterns:[{name:"markup.inserted.diff",match:"^\\+.*$"}]},"removed-line":{patterns:[{name:"markup.deleted.diff",match:"^-.*$"}]},"context-line":{patterns:[{name:"meta.diff.context",match:"^ .*$"}]},metadata:{patterns:[{name:"meta.diff.index",match:"^index [0-9a-f]+\\.\\.[0-9a-f]+.*$"},{name:"meta.diff.mode",match:"^(new|deleted) file mode \\d+$"}]}}},ca={name:"Dockerfile",scopeName:"source.dockerfile",keywords:{FROM:"keyword.control.dockerfile",RUN:"keyword.control.dockerfile",CMD:"keyword.control.dockerfile",LABEL:"keyword.control.dockerfile",EXPOSE:"keyword.control.dockerfile",ENV:"keyword.control.dockerfile",ADD:"keyword.control.dockerfile",COPY:"keyword.control.dockerfile",ENTRYPOINT:"keyword.control.dockerfile",VOLUME:"keyword.control.dockerfile",USER:"keyword.control.dockerfile",WORKDIR:"keyword.control.dockerfile",ARG:"keyword.control.dockerfile",ONBUILD:"keyword.control.dockerfile",STOPSIGNAL:"keyword.control.dockerfile",HEALTHCHECK:"keyword.control.dockerfile",SHELL:"keyword.control.dockerfile",MAINTAINER:"keyword.control.dockerfile",AS:"keyword.other.dockerfile"},patterns:[{include:"#comments"},{include:"#instructions"},{include:"#strings"},{include:"#variables"}],repository:{comments:{patterns:[{name:"comment.line.number-sign.dockerfile",match:"#.*$"}]},instructions:{patterns:[{name:"keyword.control.dockerfile",match:"^\\s*(FROM|RUN|CMD|LABEL|EXPOSE|ENV|ADD|COPY|ENTRYPOINT|VOLUME|USER|WORKDIR|ARG|ONBUILD|STOPSIGNAL|HEALTHCHECK|SHELL|MAINTAINER)\\b"},{name:"keyword.other.dockerfile",match:"\\b(AS)\\b"}]},strings:{patterns:[{name:"string.quoted.double.dockerfile",begin:'"',end:'"',patterns:[{name:"constant.character.escape.dockerfile",match:"\\\\."}]},{name:"string.quoted.single.dockerfile",begin:"'",end:"'",patterns:[{name:"constant.character.escape.dockerfile",match:"\\\\."}]}]},variables:{patterns:[{name:"variable.other.dockerfile",match:"\\$\\{?[a-zA-Z_][a-zA-Z0-9_]*\\}?"}]}}},da={name:"Go",scopeName:"source.go",keywords:{break:"keyword.control.go",case:"keyword.control.go",chan:"keyword.control.go",const:"keyword.control.go",continue:"keyword.control.go",default:"keyword.control.go",defer:"keyword.control.go",else:"keyword.control.go",fallthrough:"keyword.control.go",for:"keyword.control.go",func:"keyword.control.go",go:"keyword.control.go",goto:"keyword.control.go",if:"keyword.control.go",import:"keyword.control.go",interface:"keyword.control.go",map:"keyword.control.go",package:"keyword.control.go",range:"keyword.control.go",return:"keyword.control.go",select:"keyword.control.go",struct:"keyword.control.go",switch:"keyword.control.go",type:"keyword.control.go",var:"keyword.control.go",bool:"storage.type.go",byte:"storage.type.go",complex64:"storage.type.go",complex128:"storage.type.go",error:"storage.type.go",float32:"storage.type.go",float64:"storage.type.go",int:"storage.type.go",int8:"storage.type.go",int16:"storage.type.go",int32:"storage.type.go",int64:"storage.type.go",rune:"storage.type.go",string:"storage.type.go",uint:"storage.type.go",uint8:"storage.type.go",uint16:"storage.type.go",uint32:"storage.type.go",uint64:"storage.type.go",uintptr:"storage.type.go",true:"constant.language.go",false:"constant.language.go",nil:"constant.language.go",iota:"constant.language.go",append:"support.function.builtin.go",cap:"support.function.builtin.go",close:"support.function.builtin.go",complex:"support.function.builtin.go",copy:"support.function.builtin.go",delete:"support.function.builtin.go",imag:"support.function.builtin.go",len:"support.function.builtin.go",make:"support.function.builtin.go",new:"support.function.builtin.go",panic:"support.function.builtin.go",print:"support.function.builtin.go",println:"support.function.builtin.go",real:"support.function.builtin.go",recover:"support.function.builtin.go"},patterns:[{include:"#comments"},{include:"#strings"},{include:"#keywords"},{include:"#numbers"},{include:"#functions"},{include:"#operators"}],repository:{comments:{patterns:[{name:"comment.line.double-slash.go",match:"\\/\\/.*$"},{name:"comment.block.go",begin:"\\/\\*",end:"\\*\\/"}]},strings:{patterns:[{name:"string.quoted.raw.go",begin:"`",end:"`"},{name:"string.quoted.double.go",begin:'"',end:'"',patterns:[{name:"constant.character.escape.go",match:"\\\\."}]},{name:"string.quoted.single.go",begin:"'",end:"'",patterns:[{name:"constant.character.escape.go",match:"\\\\."}]}]},keywords:{patterns:[{name:"keyword.control.go",match:"\\b(break|case|chan|const|continue|default|defer|else|fallthrough|for|func|go|goto|if|import|interface|map|package|range|return|select|struct|switch|type|var)\\b"},{name:"storage.type.go",match:"\\b(bool|byte|complex64|complex128|error|float32|float64|int|int8|int16|int32|int64|rune|string|uint|uint8|uint16|uint32|uint64|uintptr)\\b"},{name:"constant.language.go",match:"\\b(true|false|nil|iota)\\b"},{name:"support.function.builtin.go",match:"\\b(append|cap|close|complex|copy|delete|imag|len|make|new|panic|print|println|real|recover)\\b"}]},numbers:{patterns:[{name:"constant.numeric.go",match:"\\b(?:0[xX][0-9a-fA-F]+|0[oO][0-7]+|0[bB][01]+|\\d+\\.?\\d*(?:[eE][+-]?\\d+)?)[i]?\\b"}]},functions:{patterns:[{name:"entity.name.function.go",match:"\\b([a-zA-Z_][a-zA-Z0-9_]*)\\s*(?=\\()"}]},operators:{patterns:[{name:"keyword.operator.go",match:"(\\+\\+|--|\\+|\\-|\\*|/|%|==|!=|<=|>=|<-|<|>|&&|\\|\\||!|&|\\||\\^|&\\^|<<|>>|:=|=|\\+=|-=|\\*=|/=|%=|&=|\\|=|\\^=|&\\^=|<<=|>>=|\\.\\.\\.)"}]}}},ma={name:"GraphQL",scopeName:"source.graphql",keywords:{query:"keyword.operation.graphql",mutation:"keyword.operation.graphql",subscription:"keyword.operation.graphql",fragment:"keyword.operation.graphql",type:"keyword.type.graphql",interface:"keyword.type.graphql",union:"keyword.type.graphql",enum:"keyword.type.graphql",input:"keyword.type.graphql",scalar:"keyword.type.graphql",schema:"keyword.type.graphql",extend:"keyword.type.graphql",implements:"keyword.type.graphql",on:"keyword.other.graphql",true:"constant.language.graphql",false:"constant.language.graphql",null:"constant.language.graphql"},patterns:[{include:"#comments"},{include:"#strings"},{include:"#keywords"},{include:"#directives"}],repository:{comments:{patterns:[{name:"comment.line.number-sign.graphql",match:"#.*$"}]},strings:{patterns:[{name:"string.quoted.triple.graphql",begin:'"""',end:'"""'},{name:"string.quoted.double.graphql",begin:'"',end:'"',patterns:[{name:"constant.character.escape.graphql",match:"\\\\."}]}]},keywords:{patterns:[{name:"keyword.operation.graphql",match:"\\b(query|mutation|subscription|fragment)\\b"},{name:"keyword.type.graphql",match:"\\b(type|interface|union|enum|input|scalar|schema|extend|implements)\\b"},{name:"constant.language.graphql",match:"\\b(true|false|null)\\b"}]},directives:{patterns:[{name:"entity.name.function.directive.graphql",match:"@[a-zA-Z_][a-zA-Z0-9_]*"}]}}},la={name:"HTML",scopeName:"text.html.basic",patterns:[{include:"#doctype"},{include:"#comments"},{include:"#tags"},{include:"#entities"}],repository:{doctype:{patterns:[{name:"meta.tag.sgml.doctype.html",match:"<!DOCTYPE[^>]*>"}]},comments:{patterns:[{name:"comment.block.html",begin:"<!--",end:"-->"}]},tags:{patterns:[{name:"meta.tag.html",begin:"(<)(script|style|template)\\b",beginCaptures:{1:{name:"punctuation.definition.tag.begin.html"},2:{name:"entity.name.tag.html"}},end:"(</)(\\2)(>)",endCaptures:{1:{name:"punctuation.definition.tag.begin.html"},2:{name:"entity.name.tag.html"},3:{name:"punctuation.definition.tag.end.html"}},patterns:[{include:"#tag-stuff"}]},{name:"meta.tag.html",begin:"(<)([a-zA-Z0-9:-]+)",beginCaptures:{1:{name:"punctuation.definition.tag.begin.html"},2:{name:"entity.name.tag.html"}},end:"(/>)|(>)",endCaptures:{1:{name:"punctuation.definition.tag.end.html"},2:{name:"punctuation.definition.tag.end.html"}},patterns:[{include:"#tag-stuff"}]},{name:"meta.tag.html",begin:"(</)([a-zA-Z0-9:-]+)",beginCaptures:{1:{name:"punctuation.definition.tag.begin.html"},2:{name:"entity.name.tag.html"}},end:"(>)",endCaptures:{1:{name:"punctuation.definition.tag.end.html"}}}]},"tag-stuff":{patterns:[{name:"entity.other.attribute-name.html",match:"\\b(data-[a-zA-Z0-9-]+|aria-[a-zA-Z0-9-]+|on[a-z]+|[a-zA-Z-:]+)"},{name:"string.quoted.double.html",begin:'"',end:'"'},{name:"string.quoted.single.html",begin:"'",end:"'"}]},entities:{patterns:[{name:"constant.character.entity.html",match:"&[a-zA-Z0-9]+;"},{name:"constant.character.entity.html",match:"&#[0-9]+;"}]}}},pa={name:"IDL",scopeName:"source.idl",keywords:{interface:"keyword.other.idl",module:"keyword.other.idl",struct:"keyword.other.idl",union:"keyword.other.idl",enum:"keyword.other.idl",typedef:"keyword.other.idl",exception:"keyword.other.idl",readonly:"storage.modifier.idl",attribute:"storage.modifier.idl",const:"storage.modifier.idl",in:"keyword.other.idl",out:"keyword.other.idl",inout:"keyword.other.idl",void:"storage.type.idl",boolean:"storage.type.idl",byte:"storage.type.idl",short:"storage.type.idl",long:"storage.type.idl",float:"storage.type.idl",double:"storage.type.idl",char:"storage.type.idl",string:"storage.type.idl",TRUE:"constant.language.idl",FALSE:"constant.language.idl"},patterns:[{include:"#comments"},{include:"#strings"},{include:"#keywords"},{include:"#numbers"}],repository:{comments:{patterns:[{name:"comment.line.double-slash.idl",match:"\\/\\/.*$"},{name:"comment.block.idl",begin:"\\/\\*",end:"\\*\\/"}]},strings:{patterns:[{name:"string.quoted.double.idl",begin:'"',end:'"',patterns:[{name:"constant.character.escape.idl",match:"\\\\."}]}]},keywords:{patterns:[{name:"keyword.other.idl",match:"\\b(interface|module|struct|union|enum|typedef|exception|in|out|inout)\\b"},{name:"storage.modifier.idl",match:"\\b(readonly|attribute|const)\\b"},{name:"storage.type.idl",match:"\\b(void|boolean|byte|short|long|float|double|char|string)\\b"},{name:"constant.language.idl",match:"\\b(TRUE|FALSE)\\b"}]},numbers:{patterns:[{name:"constant.numeric.idl",match:"\\b\\d+\\.?\\d*(?:[eE][+-]?\\d+)?\\b"}]}}},ua={name:"Java",scopeName:"source.java",keywords:{if:"keyword.control.java",else:"keyword.control.java",for:"keyword.control.java",while:"keyword.control.java",do:"keyword.control.java",switch:"keyword.control.java",case:"keyword.control.java",default:"keyword.control.java",break:"keyword.control.java",continue:"keyword.control.java",return:"keyword.control.java",try:"keyword.control.java",catch:"keyword.control.java",finally:"keyword.control.java",throw:"keyword.control.java",throws:"keyword.control.java",assert:"keyword.control.java",class:"storage.type.java",interface:"storage.type.java",enum:"storage.type.java",record:"storage.type.java",void:"storage.type.java",boolean:"storage.type.primitive.java",byte:"storage.type.primitive.java",char:"storage.type.primitive.java",short:"storage.type.primitive.java",int:"storage.type.primitive.java",long:"storage.type.primitive.java",float:"storage.type.primitive.java",double:"storage.type.primitive.java",public:"storage.modifier.java",private:"storage.modifier.java",protected:"storage.modifier.java",static:"storage.modifier.java",final:"storage.modifier.java",abstract:"storage.modifier.java",native:"storage.modifier.java",synchronized:"storage.modifier.java",transient:"storage.modifier.java",volatile:"storage.modifier.java",strictfp:"storage.modifier.java",sealed:"storage.modifier.java","non-sealed":"storage.modifier.java",true:"constant.language.java",false:"constant.language.java",null:"constant.language.java",this:"variable.language.java",super:"variable.language.java",package:"keyword.other.package.java",import:"keyword.other.import.java",extends:"keyword.other.extends.java",implements:"keyword.other.implements.java",new:"keyword.operator.new.java",instanceof:"keyword.operator.instanceof.java",var:"storage.type.java"},patterns:[{include:"#comments"},{include:"#annotations"},{include:"#strings"},{include:"#keywords"},{include:"#numbers"},{include:"#functions"},{include:"#operators"}],repository:{comments:{patterns:[{name:"comment.line.double-slash.java",match:"\\/\\/.*$"},{name:"comment.block.documentation.java",begin:"\\/\\*\\*",end:"\\*\\/",patterns:[{name:"keyword.other.documentation.java",match:"@(?:param|return|throws|author|version|see|since|deprecated)\\b"}]},{name:"comment.block.java",begin:"\\/\\*",end:"\\*\\/"}]},annotations:{patterns:[{name:"storage.type.annotation.java",match:"@[A-Z][a-zA-Z0-9]*"}]},strings:{patterns:[{name:"string.quoted.triple.java",begin:'"""',end:'"""',patterns:[{name:"constant.character.escape.java",match:"\\\\."}]},{name:"string.quoted.double.java",begin:'"',end:'"',patterns:[{name:"constant.character.escape.java",match:"\\\\."}]},{name:"string.quoted.single.java",begin:"'",end:"'",patterns:[{name:"constant.character.escape.java",match:"\\\\."}]}]},keywords:{patterns:[{name:"keyword.control.java",match:"\\b(if|else|for|while|do|switch|case|default|break|continue|return|try|catch|finally|throw|throws|assert)\\b"},{name:"storage.type.java",match:"\\b(class|interface|enum|record|void|var)\\b"},{name:"storage.type.primitive.java",match:"\\b(boolean|byte|char|short|int|long|float|double)\\b"},{name:"storage.modifier.java",match:"\\b(public|private|protected|static|final|abstract|native|synchronized|transient|volatile|strictfp|sealed|non-sealed)\\b"},{name:"constant.language.java",match:"\\b(true|false|null)\\b"},{name:"keyword.other.java",match:"\\b(package|import|extends|implements|new|instanceof)\\b"}]},numbers:{patterns:[{name:"constant.numeric.java",match:"\\b(?:0[xX][0-9a-fA-F_]+[lL]?|0[bB][01_]+[lL]?|0[0-7_]+[lL]?|\\d+[._]?\\d*(?:[eE][+-]?\\d+)?[fFdDlL]?)\\b"}]},functions:{patterns:[{name:"entity.name.function.java",match:"\\b([a-zA-Z_$][a-zA-Z0-9_$]*)\\s*(?=\\()"}]},operators:{patterns:[{name:"keyword.operator.java",match:"(\\+\\+|--|\\+|\\-|\\*|/|%|==|!=|<=|>=|<|>|&&|\\|\\||!|\\?|:|=|\\+=|-=|\\*=|/=|%=|&=|\\|=|\\^=|<<=|>>=|>>>=|&|\\||\\^|~|<<|>>|>>>)"}]}}},ya={name:"JavaScript",scopeName:"source.js",keywords:{if:"keyword.control.js",else:"keyword.control.js",switch:"keyword.control.js",case:"keyword.control.js",default:"keyword.control.js",for:"keyword.control.js",while:"keyword.control.js",do:"keyword.control.js",break:"keyword.control.js",continue:"keyword.control.js",return:"keyword.control.js",try:"keyword.control.js",catch:"keyword.control.js",finally:"keyword.control.js",throw:"keyword.control.js",async:"keyword.control.js",await:"keyword.control.js",yield:"keyword.control.js",const:"storage.type.js",let:"storage.type.js",var:"storage.type.js",function:"storage.type.js",class:"storage.type.js",extends:"storage.type.js",static:"storage.type.js",get:"storage.type.js",set:"storage.type.js",new:"keyword.operator.new.js",delete:"keyword.operator.new.js",typeof:"keyword.operator.new.js",instanceof:"keyword.operator.new.js",void:"keyword.operator.new.js",in:"keyword.operator.new.js",of:"keyword.operator.new.js",true:"constant.language.js",false:"constant.language.js",null:"constant.language.js",undefined:"constant.language.js",NaN:"constant.language.js",Infinity:"constant.language.js",this:"constant.language.js",super:"constant.language.js",arguments:"constant.language.js",import:"keyword.other.js",export:"keyword.other.js",from:"keyword.other.js",as:"keyword.other.js",with:"keyword.other.js",debugger:"keyword.other.js"},patterns:[{include:"#comments"},{include:"#strings"},{include:"#jsx"},{include:"#regex"},{include:"#keywords"},{include:"#numbers"},{include:"#functions"},{include:"#operators"},{include:"#punctuation"}],repository:{comments:{patterns:[{name:"comment.line.double-slash.js",match:"\\/\\/.*$"},{name:"comment.block.js",begin:"\\/\\*",end:"\\*\\/"}]},strings:{patterns:[{name:"string.quoted.double.js",begin:'"',end:'"',patterns:[{name:"constant.character.escape.js",match:"\\\\."}]},{name:"string.quoted.single.js",begin:"'",end:"'",patterns:[{name:"constant.character.escape.js",match:"\\\\."}]},{name:"string.template.js",begin:"`",end:"`",patterns:[{name:"meta.template.expression.js",begin:"\\$\\{",end:"\\}",patterns:[{include:"$self"}]},{name:"constant.character.escape.js",match:"\\\\."}]}]},jsx:{patterns:[{name:"meta.tag.jsx",begin:"<([A-Z][a-zA-Z0-9]*|[a-z][a-zA-Z0-9-]*)",beginCaptures:{0:{name:"punctuation.definition.tag.begin.jsx"},1:{name:"entity.name.tag.jsx"}},end:"(/?>)",endCaptures:{1:{name:"punctuation.definition.tag.end.jsx"}},patterns:[{name:"entity.other.attribute-name.jsx",match:"[a-zA-Z_:][a-zA-Z0-9_:.-]*"},{name:"meta.embedded.expression.jsx",begin:"\\{",end:"\\}",patterns:[{include:"$self"}]},{name:"string.quoted.double.jsx",begin:'"',end:'"'},{name:"string.quoted.single.jsx",begin:"'",end:"'"}]},{name:"meta.tag.jsx",begin:"(</)([A-Z][a-zA-Z0-9]*|[a-z][a-zA-Z0-9-]*)",beginCaptures:{1:{name:"punctuation.definition.tag.begin.jsx"},2:{name:"entity.name.tag.jsx"}},end:"(>)",endCaptures:{1:{name:"punctuation.definition.tag.end.jsx"}}}]},regex:{patterns:[{name:"string.regexp.js",begin:"(?<=[=(,\\[!&|?{};:])\\s*(\\/)",beginCaptures:{1:{name:"punctuation.definition.string.begin.js"}},end:"(\\/)[gimsuvy]*",endCaptures:{1:{name:"punctuation.definition.string.end.js"}},patterns:[{name:"constant.character.escape.js",match:"\\\\."}]}]},numbers:{patterns:[{name:"constant.numeric.js",match:"\\b(0[xX][0-9a-fA-F_]+|0[bB][01_]+|0[oO][0-7_]+|\\d+(_\\d+)*(\\.\\d+(_\\d+)?)?([eE][+-]?\\d+)?)[nN]?\\b"}]},keywords:{patterns:[{name:"keyword.control.js",match:"\\b(if|else|switch|case|default|for|while|do|break|continue|return|try|catch|finally|throw|async|await|yield)\\b"},{name:"storage.type.js",match:"\\b(const|let|var|function|class|extends|static|async|get|set)\\b"},{name:"keyword.operator.new.js",match:"\\b(new|delete|typeof|instanceof|void|in|of)\\b"},{name:"constant.language.js",match:"\\b(true|false|null|undefined|NaN|Infinity|this|super|arguments)\\b"},{name:"keyword.other.js",match:"\\b(import|export|from|as|default|with|debugger)\\b"}]},functions:{patterns:[{name:"entity.name.function.js",match:"\\b([a-zA-Z_$][a-zA-Z0-9_$]*)\\s*(?=\\()"}]},operators:{patterns:[{name:"keyword.operator.js",match:"(\\+\\+|--|\\+|\\-|\\*|\\/|%|===|==|!==|!=|<=|>=|<|>|&&|\\|\\||!|\\?|:|=>|\\.\\.\\.|&|\\||\\^|~|<<|>>|>>>)"}]},punctuation:{patterns:[{name:"punctuation.js",match:"[{}()\\[\\];,.]"}]}}},ha={name:"JSON",scopeName:"source.json",patterns:[{include:"#value"}],repository:{value:{patterns:[{include:"#constant"},{include:"#number"},{include:"#string"},{include:"#array"},{include:"#object"}]},constant:{patterns:[{name:"constant.language.json",match:"\\b(true|false|null)\\b"}]},number:{patterns:[{name:"constant.numeric.json",match:"-?(0|[1-9]\\d*)(\\.\\d+)?([eE][+-]?\\d+)?"}]},string:{patterns:[{name:"string.quoted.double.json",begin:'"',end:'"',patterns:[{name:"constant.character.escape.json",match:'\\\\(["\\\\/bfnrt]|u[0-9a-fA-F]{4})'},{name:"invalid.illegal.unrecognized-string-escape.json",match:"\\\\."}]}]},array:{patterns:[{name:"meta.structure.array.json",begin:"\\[",beginCaptures:{0:{name:"punctuation.definition.array.begin.json"}},end:"\\]",endCaptures:{0:{name:"punctuation.definition.array.end.json"}},patterns:[{include:"#value"},{name:"punctuation.separator.array.json",match:","}]}]},object:{patterns:[{name:"meta.structure.dictionary.json",begin:"\\{",beginCaptures:{0:{name:"punctuation.definition.dictionary.begin.json"}},end:"\\}",endCaptures:{0:{name:"punctuation.definition.dictionary.end.json"}},patterns:[{name:"meta.structure.dictionary.key.json",begin:'"',beginCaptures:{0:{name:"punctuation.support.type.property-name.begin.json"}},end:'"',endCaptures:{0:{name:"punctuation.support.type.property-name.end.json"}},patterns:[{name:"constant.character.escape.json",match:'\\\\(["\\\\/bfnrt]|u[0-9a-fA-F]{4})'}]},{name:"punctuation.separator.dictionary.key-value.json",match:":"},{name:"punctuation.separator.dictionary.pair.json",match:","},{include:"#value"}]}]}}},wa={name:"JSON5",scopeName:"source.json5",keywords:{true:"constant.language.json5",false:"constant.language.json5",null:"constant.language.json5",Infinity:"constant.language.json5",NaN:"constant.language.json5"},patterns:[{include:"#comments"},{include:"#strings"},{include:"#numbers"},{include:"#constants"},{include:"#keys"}],repository:{comments:{patterns:[{name:"comment.line.double-slash.json5",match:"\\/\\/.*$"},{name:"comment.block.json5",begin:"\\/\\*",end:"\\*\\/"}]},strings:{patterns:[{name:"string.quoted.single.json5",begin:"'",end:"'",patterns:[{name:"constant.character.escape.json5",match:"\\\\."}]},{name:"string.quoted.double.json5",begin:'"',end:'"',patterns:[{name:"constant.character.escape.json5",match:"\\\\."}]}]},numbers:{patterns:[{name:"constant.numeric.json5",match:"\\b(?:0[xX][0-9a-fA-F]+|[+-]?(?:\\d+\\.?\\d*|\\.\\d+)(?:[eE][+-]?\\d+)?)\\b"}]},constants:{patterns:[{name:"constant.language.json5",match:"\\b(true|false|null|Infinity|NaN)\\b"}]},keys:{patterns:[{name:"support.type.property-name.json5",match:"\\b[a-zA-Z_$][a-zA-Z0-9_$]*\\s*(?=:)"},{name:"support.type.property-name.json5",begin:'"',end:'"(?=\\s*:)'},{name:"support.type.property-name.json5",begin:"'",end:"'(?=\\s*:)"}]}}},fa={name:"JSONC",scopeName:"source.jsonc",keywords:{true:"constant.language.json",false:"constant.language.json",null:"constant.language.json"},patterns:[{include:"#comments"},{include:"#value"}],repository:{comments:{patterns:[{name:"comment.line.double-slash.jsonc",match:"\\/\\/.*$"},{name:"comment.block.jsonc",begin:"\\/\\*",end:"\\*\\/"}]},value:{patterns:[{include:"#constant"},{include:"#number"},{include:"#string"},{include:"#array"},{include:"#object"}]},constant:{patterns:[{name:"constant.language.json",match:"\\b(true|false|null)\\b"}]},number:{patterns:[{name:"constant.numeric.json",match:"-?(?:0|[1-9]\\d*)(?:\\.\\d+)?(?:[eE][+-]?\\d+)?"}]},string:{patterns:[{name:"string.quoted.double.json",begin:'"',end:'"',patterns:[{name:"constant.character.escape.json",match:'\\\\(?:["\\\\/bfnrt]|u[0-9a-fA-F]{4})'},{name:"invalid.illegal.unrecognized-string-escape.json",match:"\\\\."}]}]},array:{patterns:[{name:"meta.structure.array.json",begin:"\\[",end:"\\]",patterns:[{include:"#value"},{include:"#comments"}]}]},object:{patterns:[{name:"meta.structure.dictionary.json",begin:"\\{",end:"\\}",patterns:[{include:"#comments"},{include:"#objectkey"},{include:"#value"}]}]},objectkey:{patterns:[{name:"support.type.property-name.json",begin:'"',end:'"',patterns:[{name:"constant.character.escape.json",match:'\\\\(?:["\\\\/bfnrt]|u[0-9a-fA-F]{4})'}]}]}}},ba={name:"Kotlin",scopeName:"source.kotlin",keywords:{package:"keyword.other.kotlin",import:"keyword.other.kotlin",class:"keyword.other.kotlin",interface:"keyword.other.kotlin",object:"keyword.other.kotlin",data:"keyword.other.kotlin",sealed:"keyword.other.kotlin",enum:"keyword.other.kotlin",fun:"keyword.other.kotlin",val:"keyword.other.kotlin",var:"keyword.other.kotlin",if:"keyword.control.kotlin",else:"keyword.control.kotlin",when:"keyword.control.kotlin",for:"keyword.control.kotlin",while:"keyword.control.kotlin",do:"keyword.control.kotlin",return:"keyword.control.kotlin",break:"keyword.control.kotlin",continue:"keyword.control.kotlin",throw:"keyword.control.kotlin",try:"keyword.control.kotlin",catch:"keyword.control.kotlin",finally:"keyword.control.kotlin",public:"storage.modifier.kotlin",private:"storage.modifier.kotlin",protected:"storage.modifier.kotlin",internal:"storage.modifier.kotlin",open:"storage.modifier.kotlin",abstract:"storage.modifier.kotlin",override:"storage.modifier.kotlin",suspend:"storage.modifier.kotlin",inline:"storage.modifier.kotlin",true:"constant.language.kotlin",false:"constant.language.kotlin",null:"constant.language.kotlin",this:"variable.language.kotlin",super:"variable.language.kotlin",it:"variable.language.kotlin"},patterns:[{include:"#comments"},{include:"#strings"},{include:"#keywords"},{include:"#numbers"},{include:"#functions"}],repository:{comments:{patterns:[{name:"comment.line.double-slash.kotlin",match:"\\/\\/.*$"},{name:"comment.block.kotlin",begin:"\\/\\*",end:"\\*\\/"}]},strings:{patterns:[{name:"string.quoted.triple.kotlin",begin:'"""',end:'"""',patterns:[{name:"meta.template.expression.kotlin",begin:"\\$\\{",end:"\\}"},{name:"variable.other.kotlin",match:"\\$[a-zA-Z_][a-zA-Z0-9_]*"}]},{name:"string.quoted.double.kotlin",begin:'"',end:'"',patterns:[{name:"constant.character.escape.kotlin",match:"\\\\."},{name:"variable.other.kotlin",match:"\\$[a-zA-Z_][a-zA-Z0-9_]*"},{name:"meta.template.expression.kotlin",begin:"\\$\\{",end:"\\}"}]}]},keywords:{patterns:[{name:"keyword.control.kotlin",match:"\\b(if|else|when|for|while|do|return|break|continue|throw|try|catch|finally)\\b"},{name:"keyword.other.kotlin",match:"\\b(package|import|class|interface|object|data|sealed|enum|fun|val|var)\\b"},{name:"storage.modifier.kotlin",match:"\\b(public|private|protected|internal|open|abstract|override|suspend|inline)\\b"},{name:"constant.language.kotlin",match:"\\b(true|false|null)\\b"}]},numbers:{patterns:[{name:"constant.numeric.kotlin",match:"\\b(?:0[xX][0-9a-fA-F_]+|0[bB][01_]+|\\d+[._]?\\d*(?:[eE][+-]?\\d+)?)[fFdDlL]?\\b"}]},functions:{patterns:[{name:"entity.name.function.kotlin",match:"\\b([a-zA-Z_][a-zA-Z0-9_]*)\\s*(?=\\()"}]}}},ka={name:"LaTeX",scopeName:"text.tex.latex",keywords:{},patterns:[{include:"#comments"},{include:"#commands"},{include:"#environments"},{include:"#math"}],repository:{comments:{patterns:[{name:"comment.line.percentage.latex",match:"%.*$"}]},commands:{patterns:[{name:"support.function.latex",match:"\\\\[a-zA-Z]+"}]},environments:{patterns:[{name:"meta.environment.latex",begin:"\\\\begin\\{([a-zA-Z]+)\\}",beginCaptures:{0:{name:"support.function.latex"},1:{name:"variable.parameter.latex"}},end:"\\\\end\\{\\1\\}",endCaptures:{0:{name:"support.function.latex"}}}]},math:{patterns:[{name:"string.other.math.latex",begin:"\\$\\$",end:"\\$\\$"},{name:"string.other.math.latex",begin:"\\$",end:"\\$"}]}}},ga={name:"Log",scopeName:"text.log",keywords:{},patterns:[{include:"#log-levels"},{include:"#timestamps"},{include:"#ip-addresses"}],repository:{"log-levels":{patterns:[{name:"markup.error.log",match:"\\b(ERROR|FATAL|CRITICAL)\\b"},{name:"markup.warning.log",match:"\\b(WARN|WARNING)\\b"},{name:"markup.info.log",match:"\\b(INFO|NOTICE)\\b"},{name:"markup.debug.log",match:"\\b(DEBUG|TRACE)\\b"}]},timestamps:{patterns:[{name:"constant.numeric.timestamp.log",match:"\\d{4}-\\d{2}-\\d{2}[T ]\\d{2}:\\d{2}:\\d{2}(?:\\.\\d+)?"}]},"ip-addresses":{patterns:[{name:"constant.numeric.ip.log",match:"\\b(?:\\d{1,3}\\.){3}\\d{1,3}\\b"}]}}},Aa={name:"Lua",scopeName:"source.lua",keywords:{and:"keyword.operator.lua",break:"keyword.control.lua",do:"keyword.control.lua",else:"keyword.control.lua",elseif:"keyword.control.lua",end:"keyword.control.lua",false:"constant.language.lua",for:"keyword.control.lua",function:"keyword.control.lua",if:"keyword.control.lua",in:"keyword.control.lua",local:"storage.modifier.lua",nil:"constant.language.lua",not:"keyword.operator.lua",or:"keyword.operator.lua",repeat:"keyword.control.lua",return:"keyword.control.lua",then:"keyword.control.lua",true:"constant.language.lua",until:"keyword.control.lua",while:"keyword.control.lua"},patterns:[{include:"#comments"},{include:"#strings"},{include:"#keywords"},{include:"#numbers"}],repository:{comments:{patterns:[{name:"comment.block.lua",begin:"--\\[\\[",end:"\\]\\]"},{name:"comment.line.double-dash.lua",match:"--.*$"}]},strings:{patterns:[{name:"string.quoted.other.multiline.lua",begin:"\\[\\[",end:"\\]\\]"},{name:"string.quoted.double.lua",begin:'"',end:'"',patterns:[{name:"constant.character.escape.lua",match:"\\\\."}]},{name:"string.quoted.single.lua",begin:"'",end:"'",patterns:[{name:"constant.character.escape.lua",match:"\\\\."}]}]},keywords:{patterns:[{name:"keyword.control.lua",match:"\\b(break|do|else|elseif|end|for|function|if|in|repeat|return|then|until|while)\\b"},{name:"constant.language.lua",match:"\\b(true|false|nil)\\b"},{name:"storage.modifier.lua",match:"\\b(local)\\b"}]},numbers:{patterns:[{name:"constant.numeric.lua",match:"\\b(?:0[xX][0-9a-fA-F]+|\\d+\\.?\\d*(?:[eE][+-]?\\d+)?)\\b"}]}}},$a={name:"Makefile",scopeName:"source.makefile",keywords:{ifeq:"keyword.control.makefile",ifneq:"keyword.control.makefile",ifdef:"keyword.control.makefile",ifndef:"keyword.control.makefile",else:"keyword.control.makefile",endif:"keyword.control.makefile",include:"keyword.control.makefile",define:"keyword.control.makefile",endef:"keyword.control.makefile"},patterns:[{include:"#comments"},{include:"#targets"},{include:"#variables"},{include:"#directives"}],repository:{comments:{patterns:[{name:"comment.line.number-sign.makefile",match:"#.*$"}]},targets:{patterns:[{name:"entity.name.function.target.makefile",match:"^[a-zA-Z0-9._-]+(?=:)"}]},variables:{patterns:[{name:"variable.other.makefile",match:"\\$[({][a-zA-Z0-9_]+[})]"},{name:"variable.other.makefile",match:"\\$[a-zA-Z0-9_]"}]},directives:{patterns:[{name:"keyword.control.makefile",match:"^\\s*(ifeq|ifneq|ifdef|ifndef|else|endif|include|define|endef)\\b"}]}}},qa={name:"Markdown",scopeName:"text.html.markdown",keywords:{},patterns:[{include:"#heading"},{include:"#code-block"},{include:"#code-inline"},{include:"#bold"},{include:"#italic"},{include:"#strikethrough"},{include:"#link"},{include:"#image"},{include:"#list"},{include:"#blockquote"},{include:"#horizontal-rule"},{include:"#table"}],repository:{heading:{patterns:[{name:"markup.heading.markdown",match:"^(#{1,6})\\s+(.+)$",captures:{1:{name:"markup.heading.marker.markdown"},2:{name:"markup.heading.content.markdown"}}},{name:"markup.heading.setext.markdown",match:"^(=+|-+)$"}]},"code-block":{patterns:[{name:"markup.fenced_code.block.markdown",begin:"^```([a-zA-Z0-9]*)",end:"^```",captures:{1:{name:"entity.name.function.markdown"}},contentName:"markup.raw.code.markdown"},{name:"markup.raw.code.markdown",match:"^( |\\t)(.*)$"}]},"code-inline":{patterns:[{name:"markup.inline.raw.markdown",match:"`[^`]+`"}]},bold:{patterns:[{name:"markup.bold.markdown",match:"(\\*\\*|__)(?=\\S)(.+?[*_]*)(?<=\\S)\\1",captures:{1:{name:"punctuation.definition.bold.markdown"},2:{name:"markup.bold.content.markdown"}}}]},italic:{patterns:[{name:"markup.italic.markdown",match:"(\\*|_)(?=\\S)(.+?)(?<=\\S)\\1",captures:{1:{name:"punctuation.definition.italic.markdown"},2:{name:"markup.italic.content.markdown"}}}]},strikethrough:{patterns:[{name:"markup.strikethrough.markdown",match:"~~(.+?)~~",captures:{1:{name:"markup.strikethrough.content.markdown"}}}]},link:{patterns:[{name:"meta.link.inline.markdown",match:"\\[([^\\]]+)\\]\\(([^)]+)\\)",captures:{1:{name:"string.other.link.title.markdown"},2:{name:"markup.underline.link.markdown"}}},{name:"meta.link.reference.markdown",match:"\\[([^\\]]+)\\]\\[([^\\]]+)\\]",captures:{1:{name:"string.other.link.title.markdown"},2:{name:"constant.other.reference.link.markdown"}}}]},image:{patterns:[{name:"meta.image.inline.markdown",match:"!\\[([^\\]]*)\\]\\(([^)]+)\\)",captures:{1:{name:"string.other.link.description.markdown"},2:{name:"markup.underline.link.image.markdown"}}}]},list:{patterns:[{name:"markup.list.unnumbered.markdown",match:"^\\s*([-*+])\\s+",captures:{1:{name:"punctuation.definition.list.markdown"}}},{name:"markup.list.numbered.markdown",match:"^\\s*(\\d+\\.)\\s+",captures:{1:{name:"punctuation.definition.list.markdown"}}}]},blockquote:{patterns:[{name:"markup.quote.markdown",match:"^\\s*>\\s*(.*)$",captures:{1:{name:"markup.quote.content.markdown"}}}]},"horizontal-rule":{patterns:[{name:"meta.separator.markdown",match:"^\\s*([-*_]){3,}\\s*$"}]},table:{patterns:[{name:"markup.table.markdown",match:"^\\|(.+)\\|$"},{name:"markup.table.delimiter.markdown",match:"^\\|([:\\-\\s|]+)\\|$"}]}}},_a={name:"Nginx",scopeName:"source.nginx",keywords:{},patterns:[{include:"#comments"},{include:"#directives"},{include:"#blocks"},{include:"#variables"},{include:"#strings"}],repository:{comments:{patterns:[{name:"comment.line.number-sign.nginx",match:"#.*$"}]},directives:{patterns:[{name:"keyword.other.directive.nginx",match:"\\b(server|location|listen|root|index|proxy_pass|return|rewrite|try_files|add_header|set|if|access_log|error_log)\\b"}]},blocks:{patterns:[{name:"entity.name.section.nginx",match:"\\b(http|server|location|upstream|events)\\b"}]},variables:{patterns:[{name:"variable.other.nginx",match:"\\$[a-zA-Z_][a-zA-Z0-9_]*"}]},strings:{patterns:[{name:"string.quoted.double.nginx",begin:'"',end:'"'},{name:"string.quoted.single.nginx",begin:"'",end:"'"}]}}},ja={name:"PHP",scopeName:"source.php",keywords:{if:"keyword.control.php",else:"keyword.control.php",elseif:"keyword.control.php",endif:"keyword.control.php",for:"keyword.control.php",foreach:"keyword.control.php",endfor:"keyword.control.php",endforeach:"keyword.control.php",while:"keyword.control.php",endwhile:"keyword.control.php",do:"keyword.control.php",switch:"keyword.control.php",case:"keyword.control.php",default:"keyword.control.php",endswitch:"keyword.control.php",break:"keyword.control.php",continue:"keyword.control.php",return:"keyword.control.php",goto:"keyword.control.php",try:"keyword.control.php",catch:"keyword.control.php",finally:"keyword.control.php",throw:"keyword.control.php",match:"keyword.control.php",function:"storage.type.function.php",class:"storage.type.class.php",interface:"storage.type.interface.php",trait:"storage.type.trait.php",enum:"storage.type.enum.php",namespace:"storage.type.namespace.php",use:"keyword.other.use.php",extends:"storage.modifier.extends.php",implements:"storage.modifier.implements.php",public:"storage.modifier.php",private:"storage.modifier.php",protected:"storage.modifier.php",static:"storage.modifier.php",final:"storage.modifier.php",abstract:"storage.modifier.php",readonly:"storage.modifier.php",true:"constant.language.php",false:"constant.language.php",null:"constant.language.php",TRUE:"constant.language.php",FALSE:"constant.language.php",NULL:"constant.language.php",this:"variable.language.php",parent:"variable.language.php",self:"variable.language.php",new:"keyword.operator.new.php",clone:"keyword.operator.clone.php",instanceof:"keyword.operator.instanceof.php",and:"keyword.operator.logical.php",or:"keyword.operator.logical.php",xor:"keyword.operator.logical.php",echo:"support.function.construct.php",print:"support.function.construct.php",require:"keyword.control.import.php",require_once:"keyword.control.import.php",include:"keyword.control.import.php",include_once:"keyword.control.import.php",die:"keyword.control.php",exit:"keyword.control.php",isset:"support.function.construct.php",empty:"support.function.construct.php",unset:"support.function.construct.php",yield:"keyword.control.php","yield from":"keyword.control.php",declare:"keyword.control.php",const:"storage.type.const.php",var:"storage.type.var.php",global:"storage.modifier.php"},patterns:[{include:"#php-tags"},{include:"#comments"},{include:"#strings"},{include:"#heredoc"},{include:"#keywords"},{include:"#variables"},{include:"#functions"},{include:"#numbers"},{include:"#operators"}],repository:{"php-tags":{patterns:[{name:"meta.embedded.block.php",begin:"<\\?(?:php|=)?",beginCaptures:{0:{name:"punctuation.section.embedded.begin.php"}},end:"\\?>",endCaptures:{0:{name:"punctuation.section.embedded.end.php"}},patterns:[{include:"#comments"},{include:"#strings"},{include:"#heredoc"},{include:"#keywords"},{include:"#variables"},{include:"#functions"},{include:"#numbers"},{include:"#operators"}]}]},comments:{patterns:[{name:"comment.line.double-slash.php",match:"\\/\\/.*$"},{name:"comment.line.number-sign.php",match:"#.*$"},{name:"comment.block.php",begin:"\\/\\*",end:"\\*\\/"}]},strings:{patterns:[{name:"string.quoted.double.php",begin:'"',end:'"',patterns:[{name:"constant.character.escape.php",match:"\\\\."},{name:"variable.other.php",match:"\\$[a-zA-Z_][a-zA-Z0-9_]*"},{name:"meta.embedded.expression.php",begin:"\\{\\$",end:"\\}",patterns:[{include:"#variables"}]}]},{name:"string.quoted.single.php",begin:"'",end:"'",patterns:[{name:"constant.character.escape.php",match:"\\\\['\\\\]"}]}]},heredoc:{patterns:[{name:"string.unquoted.heredoc.php",begin:`<<<(["']?)([a-zA-Z_][a-zA-Z0-9_]*)\\1`,end:"^\\2;?$",patterns:[{name:"variable.other.php",match:"\\$[a-zA-Z_][a-zA-Z0-9_]*"}]}]},keywords:{patterns:[{name:"keyword.control.php",match:"\\b(if|else|elseif|endif|for|foreach|endfor|endforeach|while|endwhile|do|switch|case|default|endswitch|break|continue|return|goto|try|catch|finally|throw|match|die|exit|yield|declare)\\b"},{name:"storage.type.php",match:"\\b(function|class|interface|trait|enum|namespace|const|var)\\b"},{name:"storage.modifier.php",match:"\\b(public|private|protected|static|final|abstract|readonly|global)\\b"},{name:"keyword.other.php",match:"\\b(use|extends|implements)\\b"},{name:"constant.language.php",match:"\\b(true|false|null|TRUE|FALSE|NULL)\\b"},{name:"keyword.control.import.php",match:"\\b(require|require_once|include|include_once)\\b"}]},variables:{patterns:[{name:"variable.language.php",match:"\\$(?:this|GLOBALS|_GET|_POST|_REQUEST|_SESSION|_COOKIE|_SERVER|_FILES|_ENV)\\b"},{name:"variable.other.php",match:"\\$[a-zA-Z_][a-zA-Z0-9_]*"}]},functions:{patterns:[{name:"entity.name.function.php",match:"\\b([a-zA-Z_][a-zA-Z0-9_]*)\\s*(?=\\()"}]},numbers:{patterns:[{name:"constant.numeric.php",match:"\\b(?:0[xX][0-9a-fA-F]+|0[bB][01]+|0[oO][0-7]+|\\d+\\.?\\d*(?:[eE][+-]?\\d+)?)\\b"}]},operators:{patterns:[{name:"keyword.operator.php",match:"(===|!==|==|!=|<=|>=|<>|<|>|\\+\\+|--|\\+|\\-|\\*|/|%|&&|\\|\\||!|\\.|=>|->|::|\\.=|\\+=|-=|\\*=|/=|%=|&=|\\|=|\\^=|<<=|>>=)"}]}}},Ea={name:"PowerShell",scopeName:"source.powershell",keywords:{if:"keyword.control.powershell",else:"keyword.control.powershell",elseif:"keyword.control.powershell",switch:"keyword.control.powershell",for:"keyword.control.powershell",foreach:"keyword.control.powershell",while:"keyword.control.powershell",do:"keyword.control.powershell",until:"keyword.control.powershell",break:"keyword.control.powershell",continue:"keyword.control.powershell",return:"keyword.control.powershell",function:"storage.type.powershell",filter:"storage.type.powershell",param:"storage.type.powershell",begin:"keyword.control.powershell",process:"keyword.control.powershell",end:"keyword.control.powershell",try:"keyword.control.powershell",catch:"keyword.control.powershell",finally:"keyword.control.powershell",throw:"keyword.control.powershell",$true:"constant.language.powershell",$false:"constant.language.powershell",$null:"constant.language.powershell"},patterns:[{include:"#comments"},{include:"#strings"},{include:"#variables"},{include:"#keywords"},{include:"#cmdlets"}],repository:{comments:{patterns:[{name:"comment.line.number-sign.powershell",match:"#.*$"},{name:"comment.block.powershell",begin:"<#",end:"#>"}]},strings:{patterns:[{name:"string.quoted.double.powershell",begin:'"',end:'"',patterns:[{name:"variable.other.powershell",match:"\\$[a-zA-Z_][a-zA-Z0-9_]*"}]},{name:"string.quoted.single.powershell",begin:"'",end:"'"}]},variables:{patterns:[{name:"variable.other.powershell",match:"\\$[a-zA-Z_][a-zA-Z0-9_]*"}]},keywords:{patterns:[{name:"keyword.control.powershell",match:"\\b(if|else|elseif|switch|for|foreach|while|do|until|break|continue|return|begin|process|end|try|catch|finally|throw)\\b"},{name:"storage.type.powershell",match:"\\b(function|filter|param)\\b"},{name:"constant.language.powershell",match:"\\$(?:true|false|null)\\b"}]},cmdlets:{patterns:[{name:"support.function.powershell",match:"\\b[A-Z][a-z]+-[A-Z][a-z]+[a-zA-Z]*\\b"}]}}},za={name:"Protocol Buffers",scopeName:"source.proto",keywords:{syntax:"keyword.other.proto",package:"keyword.other.proto",import:"keyword.other.proto",option:"keyword.other.proto",message:"keyword.other.proto",enum:"keyword.other.proto",service:"keyword.other.proto",rpc:"keyword.other.proto",returns:"keyword.other.proto",repeated:"storage.modifier.proto",optional:"storage.modifier.proto",required:"storage.modifier.proto",true:"constant.language.proto",false:"constant.language.proto"},patterns:[{include:"#comments"},{include:"#strings"},{include:"#keywords"},{include:"#numbers"}],repository:{comments:{patterns:[{name:"comment.line.double-slash.proto",match:"\\/\\/.*$"},{name:"comment.block.proto",begin:"\\/\\*",end:"\\*\\/"}]},strings:{patterns:[{name:"string.quoted.double.proto",begin:'"',end:'"',patterns:[{name:"constant.character.escape.proto",match:"\\\\."}]}]},keywords:{patterns:[{name:"keyword.other.proto",match:"\\b(syntax|package|import|option|message|enum|service|rpc|returns)\\b"},{name:"storage.modifier.proto",match:"\\b(repeated|optional|required)\\b"},{name:"constant.language.proto",match:"\\b(true|false)\\b"}]},numbers:{patterns:[{name:"constant.numeric.proto",match:"\\b\\d+\\b"}]}}},Na={name:"Python",scopeName:"source.python",keywords:{if:"keyword.control.python",elif:"keyword.control.python",else:"keyword.control.python",for:"keyword.control.python",while:"keyword.control.python",break:"keyword.control.python",continue:"keyword.control.python",return:"keyword.control.python",yield:"keyword.control.python",try:"keyword.control.python",except:"keyword.control.python",finally:"keyword.control.python",raise:"keyword.control.python",with:"keyword.control.python",as:"keyword.control.python",pass:"keyword.control.python",match:"keyword.control.python",case:"keyword.control.python",def:"storage.type.function.python",class:"storage.type.class.python",lambda:"storage.type.function.python",async:"storage.modifier.async.python",await:"keyword.control.python",and:"keyword.operator.logical.python",or:"keyword.operator.logical.python",not:"keyword.operator.logical.python",in:"keyword.operator.python",is:"keyword.operator.python",import:"keyword.control.import.python",from:"keyword.control.import.python",True:"constant.language.python",False:"constant.language.python",None:"constant.language.python",self:"variable.language.python",cls:"variable.language.python",print:"support.function.builtin.python",len:"support.function.builtin.python",range:"support.function.builtin.python",str:"support.function.builtin.python",int:"support.function.builtin.python",float:"support.function.builtin.python",list:"support.function.builtin.python",dict:"support.function.builtin.python",tuple:"support.function.builtin.python",set:"support.function.builtin.python",bool:"support.function.builtin.python"},patterns:[{include:"#comments"},{include:"#strings"},{include:"#decorators"},{include:"#keywords"},{include:"#functions"},{include:"#numbers"},{include:"#operators"}],repository:{comments:{patterns:[{name:"comment.line.number-sign.python",match:"#.*$"}]},strings:{patterns:[{name:"string.quoted.docstring.python",begin:'"""',end:'"""'},{name:"string.quoted.docstring.python",begin:"'''",end:"'''"},{name:"string.quoted.double.python",begin:'f"',end:'"',patterns:[{name:"constant.character.escape.python",match:"\\\\."},{name:"meta.embedded.expression.python",begin:"\\{",end:"\\}"}]},{name:"string.quoted.double.python",begin:'"',end:'"',patterns:[{name:"constant.character.escape.python",match:"\\\\."}]},{name:"string.quoted.single.python",begin:"'",end:"'",patterns:[{name:"constant.character.escape.python",match:"\\\\."}]}]},decorators:{patterns:[{name:"entity.name.function.decorator.python",match:"@[a-zA-Z_][a-zA-Z0-9_]*"}]},keywords:{patterns:[{name:"keyword.control.python",match:"\\b(if|elif|else|for|while|break|continue|return|yield|try|except|finally|raise|with|as|pass|match|case|await)\\b"},{name:"storage.type.python",match:"\\b(def|class|lambda|async)\\b"},{name:"keyword.control.import.python",match:"\\b(import|from)\\b"},{name:"constant.language.python",match:"\\b(True|False|None)\\b"}]},functions:{patterns:[{name:"entity.name.function.python",match:"\\b([a-zA-Z_][a-zA-Z0-9_]*)\\s*(?=\\()"}]},numbers:{patterns:[{name:"constant.numeric.python",match:"\\b(?:0[xX][0-9a-fA-F]+|0[oO][0-7]+|0[bB][01]+|(?:[0-9]+\\.?[0-9]*|\\.[0-9]+)(?:[eE][-+]?[0-9]+)?)\\b"}]},operators:{patterns:[{name:"keyword.operator.python",match:"(\\+|-|\\*|/|//|%|\\*\\*|==|!=|<|>|<=|>=|=|\\+=|-=|\\*=|/=)"}]}}},Za={name:"R",scopeName:"source.r",keywords:{if:"keyword.control.r",else:"keyword.control.r",for:"keyword.control.r",while:"keyword.control.r",repeat:"keyword.control.r",break:"keyword.control.r",next:"keyword.control.r",return:"keyword.control.r",function:"storage.type.r",in:"keyword.operator.r",TRUE:"constant.language.r",FALSE:"constant.language.r",NULL:"constant.language.r",NA:"constant.language.r",NaN:"constant.language.r",Inf:"constant.language.r"},patterns:[{include:"#comments"},{include:"#strings"},{include:"#keywords"},{include:"#numbers"},{include:"#operators"}],repository:{comments:{patterns:[{name:"comment.line.number-sign.r",match:"#.*$"}]},strings:{patterns:[{name:"string.quoted.double.r",begin:'"',end:'"',patterns:[{name:"constant.character.escape.r",match:"\\\\."}]},{name:"string.quoted.single.r",begin:"'",end:"'",patterns:[{name:"constant.character.escape.r",match:"\\\\."}]}]},keywords:{patterns:[{name:"keyword.control.r",match:"\\b(if|else|for|while|repeat|break|next|return|in)\\b"},{name:"storage.type.r",match:"\\b(function)\\b"},{name:"constant.language.r",match:"\\b(TRUE|FALSE|NULL|NA|NaN|Inf)\\b"}]},numbers:{patterns:[{name:"constant.numeric.r",match:"\\b\\d+\\.?\\d*(?:[eE][+-]?\\d+)?[iL]?\\b"}]},operators:{patterns:[{name:"keyword.operator.r",match:"(<-|<<-|->|->>|==|!=|<=|>=|<|>|&&|\\|\\||!|&|\\||%[a-zA-Z]+%|\\+|\\-|\\*|/|\\^|%%|%/%|::|:::)"}]}}},xa={name:"RegExp",scopeName:"source.regexp",keywords:{},patterns:[{include:"#character-class"},{include:"#groups"},{include:"#quantifiers"},{include:"#anchors"}],repository:{"character-class":{patterns:[{name:"constant.character.character-class.regexp",begin:"\\[",end:"\\]",patterns:[{name:"constant.character.escape.regexp",match:"\\\\."}]}]},groups:{patterns:[{name:"meta.group.regexp",begin:"\\(",end:"\\)",patterns:[{include:"$self"}]}]},quantifiers:{patterns:[{name:"keyword.operator.quantifier.regexp",match:"[*+?]|\\{\\d+(,\\d*)?\\}"}]},anchors:{patterns:[{name:"keyword.operator.anchor.regexp",match:"\\^|\\$"}]}}},Ta={name:"Ruby",scopeName:"source.ruby",keywords:{if:"keyword.control.ruby",elsif:"keyword.control.ruby",else:"keyword.control.ruby",unless:"keyword.control.ruby",case:"keyword.control.ruby",when:"keyword.control.ruby",while:"keyword.control.ruby",until:"keyword.control.ruby",for:"keyword.control.ruby",break:"keyword.control.ruby",next:"keyword.control.ruby",redo:"keyword.control.ruby",retry:"keyword.control.ruby",return:"keyword.control.ruby",yield:"keyword.control.ruby",begin:"keyword.control.ruby",rescue:"keyword.control.ruby",ensure:"keyword.control.ruby",raise:"keyword.control.ruby",end:"keyword.control.ruby",then:"keyword.control.ruby",do:"keyword.control.ruby",def:"keyword.control.ruby",class:"keyword.control.ruby",module:"keyword.control.ruby",include:"keyword.other.ruby",extend:"keyword.other.ruby",require:"keyword.other.ruby",require_relative:"keyword.other.ruby",load:"keyword.other.ruby",alias:"keyword.other.ruby",undef:"keyword.other.ruby","defined?":"keyword.other.ruby",super:"variable.language.ruby",self:"variable.language.ruby",true:"constant.language.ruby",false:"constant.language.ruby",nil:"constant.language.ruby",__FILE__:"constant.language.ruby",__LINE__:"constant.language.ruby",__ENCODING__:"constant.language.ruby",and:"keyword.operator.logical.ruby",or:"keyword.operator.logical.ruby",not:"keyword.operator.logical.ruby",private:"keyword.other.ruby",protected:"keyword.other.ruby",public:"keyword.other.ruby",attr_reader:"keyword.other.ruby",attr_writer:"keyword.other.ruby",attr_accessor:"keyword.other.ruby"},patterns:[{include:"#comments"},{include:"#strings"},{include:"#symbols"},{include:"#regex"},{include:"#keywords"},{include:"#numbers"},{include:"#functions"},{include:"#operators"}],repository:{comments:{patterns:[{name:"comment.line.number-sign.ruby",match:"#.*$"},{name:"comment.block.ruby",begin:"^=begin",end:"^=end"}]},strings:{patterns:[{name:"string.quoted.double.ruby",begin:'"',end:'"',patterns:[{name:"constant.character.escape.ruby",match:"\\\\."},{name:"meta.interpolation.ruby",begin:"#\\{",end:"\\}",patterns:[{include:"$self"}]}]},{name:"string.quoted.single.ruby",begin:"'",end:"'",patterns:[{name:"constant.character.escape.ruby",match:"\\\\['\\\\]"}]},{name:"string.quoted.other.ruby",begin:"%[qQ]?[{(\\[]",end:"[})\\]]"}]},symbols:{patterns:[{name:"constant.other.symbol.ruby",match:":[a-zA-Z_][a-zA-Z0-9_]*[?!]?"},{name:"constant.other.symbol.ruby",match:':"[^"]*"'}]},regex:{patterns:[{name:"string.regexp.ruby",begin:"/",end:"/[iomxneus]*",patterns:[{name:"constant.character.escape.ruby",match:"\\\\."}]}]},keywords:{patterns:[{name:"keyword.control.ruby",match:"\\b(if|elsif|else|unless|case|when|while|until|for|break|next|redo|retry|return|yield|begin|rescue|ensure|raise|end|then|do|def|class|module)\\b"},{name:"keyword.other.ruby",match:"\\b(include|extend|require|require_relative|load|alias|undef|defined\\?|private|protected|public|attr_reader|attr_writer|attr_accessor)\\b"},{name:"constant.language.ruby",match:"\\b(true|false|nil|__FILE__|__LINE__|__ENCODING__)\\b"},{name:"variable.language.ruby",match:"\\b(self|super)\\b"}]},numbers:{patterns:[{name:"constant.numeric.ruby",match:"\\b(?:0[xX][0-9a-fA-F]+|0[oO][0-7]+|0[bB][01]+|\\d+\\.?\\d*(?:[eE][+-]?\\d+)?)\\b"}]},functions:{patterns:[{name:"entity.name.function.ruby",match:"\\b([a-zA-Z_][a-zA-Z0-9_]*[?!]?)\\s*(?=\\()"}]},operators:{patterns:[{name:"keyword.operator.ruby",match:"(=>|\\+|\\-|\\*|/|%|\\*\\*|==|!=|<|>|<=|>=|<=>|===|=~|!~|&&|\\|\\||!|&|\\||\\^|~|<<|>>|\\.\\.|\\.\\.\\.)"}]}}},Ra={name:"Rust",scopeName:"source.rust",keywords:{if:"keyword.control.rust",else:"keyword.control.rust",for:"keyword.control.rust",while:"keyword.control.rust",loop:"keyword.control.rust",match:"keyword.control.rust",return:"keyword.control.rust",break:"keyword.control.rust",continue:"keyword.control.rust",yield:"keyword.control.rust",fn:"keyword.other.fn.rust",let:"keyword.other.rust",struct:"keyword.other.rust",enum:"keyword.other.rust",trait:"keyword.other.rust",impl:"keyword.other.rust",type:"keyword.other.rust",mod:"keyword.other.rust",use:"keyword.other.rust",const:"keyword.other.rust",static:"keyword.other.rust",pub:"storage.modifier.rust",mut:"storage.modifier.rust",ref:"storage.modifier.rust",unsafe:"storage.modifier.rust",async:"storage.modifier.rust",await:"keyword.control.rust",move:"storage.modifier.rust",i8:"storage.type.rust",i16:"storage.type.rust",i32:"storage.type.rust",i64:"storage.type.rust",i128:"storage.type.rust",isize:"storage.type.rust",u8:"storage.type.rust",u16:"storage.type.rust",u32:"storage.type.rust",u64:"storage.type.rust",u128:"storage.type.rust",usize:"storage.type.rust",f32:"storage.type.rust",f64:"storage.type.rust",bool:"storage.type.rust",char:"storage.type.rust",str:"storage.type.rust",Self:"storage.type.rust",true:"constant.language.rust",false:"constant.language.rust",self:"variable.language.rust",super:"variable.language.rust",crate:"variable.language.rust",where:"keyword.other.rust",as:"keyword.other.rust",in:"keyword.other.rust",extern:"keyword.other.rust",dyn:"keyword.other.rust"},patterns:[{include:"#comments"},{include:"#attributes"},{include:"#strings"},{include:"#lifetimes"},{include:"#macros"},{include:"#keywords"},{include:"#numbers"},{include:"#functions"},{include:"#operators"}],repository:{comments:{patterns:[{name:"comment.line.documentation.rust",match:"\\/\\/\\/.*$"},{name:"comment.line.double-slash.rust",match:"\\/\\/.*$"},{name:"comment.block.rust",begin:"\\/\\*",end:"\\*\\/"}]},attributes:{patterns:[{name:"meta.attribute.rust",begin:"#!?\\[",end:"\\]",patterns:[{name:"entity.name.function.attribute.rust",match:"[a-zA-Z_][a-zA-Z0-9_]*"}]}]},strings:{patterns:[{name:"string.quoted.byte.raw.rust",begin:'br(#*)"',end:'"\\1'},{name:"string.quoted.raw.rust",begin:'r(#*)"',end:'"\\1'},{name:"string.quoted.double.rust",begin:'"',end:'"',patterns:[{name:"constant.character.escape.rust",match:"\\\\."}]},{name:"string.quoted.single.rust",begin:"'",end:"'",patterns:[{name:"constant.character.escape.rust",match:"\\\\."}]}]},lifetimes:{patterns:[{name:"entity.name.lifetime.rust",match:"'[a-zA-Z_][a-zA-Z0-9_]*\\b"}]},macros:{patterns:[{name:"entity.name.function.macro.rust",match:"\\b([a-zA-Z_][a-zA-Z0-9_]*)!"}]},keywords:{patterns:[{name:"keyword.control.rust",match:"\\b(if|else|for|while|loop|match|return|break|continue|yield|await)\\b"},{name:"keyword.other.rust",match:"\\b(fn|let|struct|enum|trait|impl|type|mod|use|const|static|where|as|in|extern|dyn)\\b"},{name:"storage.modifier.rust",match:"\\b(pub|mut|ref|unsafe|async|move)\\b"},{name:"storage.type.rust",match:"\\b(i8|i16|i32|i64|i128|isize|u8|u16|u32|u64|u128|usize|f32|f64|bool|char|str|Self)\\b"},{name:"constant.language.rust",match:"\\b(true|false)\\b"},{name:"variable.language.rust",match:"\\b(self|super|crate)\\b"}]},numbers:{patterns:[{name:"constant.numeric.rust",match:"\\b(?:0[xX][0-9a-fA-F_]+|0[oO][0-7_]+|0[bB][01_]+|\\d+[._]?\\d*(?:[eE][+-]?\\d+)?)[iu]?(?:8|16|32|64|128|size)?\\b"}]},functions:{patterns:[{name:"entity.name.function.rust",match:"\\b([a-zA-Z_][a-zA-Z0-9_]*)\\s*(?=\\()"}]},operators:{patterns:[{name:"keyword.operator.rust",match:"(->|=>|\\+|\\-|\\*|/|%|==|!=|<=|>=|<|>|&&|\\|\\||!|&|\\||\\^|<<|>>|=|\\+=|-=|\\*=|/=|%=|&=|\\|=|\\^=|<<=|>>=|::|\\.|\\.\\.|\\.\\.\\.=)"}]}}},La={name:"SCSS",scopeName:"source.scss",keywords:{"@import":"keyword.control.at-rule.scss","@use":"keyword.control.at-rule.scss","@forward":"keyword.control.at-rule.scss","@mixin":"keyword.control.at-rule.scss","@include":"keyword.control.at-rule.scss","@function":"keyword.control.at-rule.scss","@return":"keyword.control.at-rule.scss","@extend":"keyword.control.at-rule.scss","@if":"keyword.control.at-rule.scss","@else":"keyword.control.at-rule.scss","@for":"keyword.control.at-rule.scss","@each":"keyword.control.at-rule.scss","@while":"keyword.control.at-rule.scss","@media":"keyword.control.at-rule.scss","@keyframes":"keyword.control.at-rule.scss"},patterns:[{include:"#comments"},{include:"#at-rules"},{include:"#variables"},{include:"#strings"},{include:"#selectors"},{include:"#properties"}],repository:{comments:{patterns:[{name:"comment.line.double-slash.scss",match:"\\/\\/.*$"},{name:"comment.block.scss",begin:"\\/\\*",end:"\\*\\/"}]},"at-rules":{patterns:[{name:"keyword.control.at-rule.scss",match:"@[a-z-]+"}]},variables:{patterns:[{name:"variable.scss",match:"\\$[a-zA-Z_-][a-zA-Z0-9_-]*"}]},strings:{patterns:[{name:"string.quoted.double.scss",begin:'"',end:'"'},{name:"string.quoted.single.scss",begin:"'",end:"'"}]},selectors:{patterns:[{name:"entity.name.tag.scss",match:"\\b[a-z][a-z0-9-]*\\b"},{name:"entity.other.attribute-name.class.scss",match:"\\.[a-zA-Z_-][a-zA-Z0-9_-]*"},{name:"entity.other.attribute-name.id.scss",match:"#[a-zA-Z_-][a-zA-Z0-9_-]*"}]},properties:{patterns:[{name:"support.type.property-name.scss",match:"\\b[a-z-]+(?=\\s*:)"}]}}},Ba={name:"Solidity",scopeName:"source.solidity",keywords:{pragma:"keyword.other.solidity",import:"keyword.other.solidity",contract:"keyword.other.solidity",interface:"keyword.other.solidity",library:"keyword.other.solidity",function:"keyword.other.solidity",modifier:"keyword.other.solidity",event:"keyword.other.solidity",struct:"keyword.other.solidity",enum:"keyword.other.solidity",if:"keyword.control.solidity",else:"keyword.control.solidity",for:"keyword.control.solidity",while:"keyword.control.solidity",do:"keyword.control.solidity",return:"keyword.control.solidity",break:"keyword.control.solidity",continue:"keyword.control.solidity",public:"storage.modifier.solidity",private:"storage.modifier.solidity",internal:"storage.modifier.solidity",external:"storage.modifier.solidity",pure:"storage.modifier.solidity",view:"storage.modifier.solidity",payable:"storage.modifier.solidity",true:"constant.language.solidity",false:"constant.language.solidity"},patterns:[{include:"#comments"},{include:"#strings"},{include:"#keywords"},{include:"#numbers"}],repository:{comments:{patterns:[{name:"comment.line.double-slash.solidity",match:"\\/\\/.*$"},{name:"comment.block.solidity",begin:"\\/\\*",end:"\\*\\/"}]},strings:{patterns:[{name:"string.quoted.double.solidity",begin:'"',end:'"',patterns:[{name:"constant.character.escape.solidity",match:"\\\\."}]}]},keywords:{patterns:[{name:"keyword.other.solidity",match:"\\b(pragma|import|contract|interface|library|function|modifier|event|struct|enum)\\b"},{name:"keyword.control.solidity",match:"\\b(if|else|for|while|do|return|break|continue)\\b"},{name:"storage.modifier.solidity",match:"\\b(public|private|internal|external|pure|view|payable)\\b"},{name:"constant.language.solidity",match:"\\b(true|false)\\b"}]},numbers:{patterns:[{name:"constant.numeric.solidity",match:"\\b(?:0[xX][0-9a-fA-F]+|\\d+)\\b"}]}}},Sa={name:"SQL",scopeName:"source.sql",keywords:{SELECT:"keyword.other.dml.sql",INSERT:"keyword.other.dml.sql",UPDATE:"keyword.other.dml.sql",DELETE:"keyword.other.dml.sql",MERGE:"keyword.other.dml.sql",CREATE:"keyword.other.ddl.sql",ALTER:"keyword.other.ddl.sql",DROP:"keyword.other.ddl.sql",TRUNCATE:"keyword.other.ddl.sql",RENAME:"keyword.other.ddl.sql",FROM:"keyword.other.sql",WHERE:"keyword.other.sql",JOIN:"keyword.other.sql",INNER:"keyword.other.sql",LEFT:"keyword.other.sql",RIGHT:"keyword.other.sql",FULL:"keyword.other.sql",OUTER:"keyword.other.sql",CROSS:"keyword.other.sql",ON:"keyword.other.sql",USING:"keyword.other.sql",GROUP:"keyword.other.sql",BY:"keyword.other.sql",HAVING:"keyword.other.sql",ORDER:"keyword.other.sql",ASC:"keyword.other.sql",DESC:"keyword.other.sql",LIMIT:"keyword.other.sql",OFFSET:"keyword.other.sql",FETCH:"keyword.other.sql",DISTINCT:"keyword.other.sql",ALL:"keyword.other.sql",AS:"keyword.other.sql",INTO:"keyword.other.sql",VALUES:"keyword.other.sql",SET:"keyword.other.sql",AND:"keyword.operator.logical.sql",OR:"keyword.operator.logical.sql",NOT:"keyword.operator.logical.sql",IN:"keyword.operator.logical.sql",BETWEEN:"keyword.operator.logical.sql",LIKE:"keyword.operator.logical.sql",IS:"keyword.operator.logical.sql",NULL:"constant.language.sql",TRUE:"constant.language.sql",FALSE:"constant.language.sql",COUNT:"support.function.aggregate.sql",SUM:"support.function.aggregate.sql",AVG:"support.function.aggregate.sql",MIN:"support.function.aggregate.sql",MAX:"support.function.aggregate.sql",INT:"storage.type.sql",INTEGER:"storage.type.sql",BIGINT:"storage.type.sql",SMALLINT:"storage.type.sql",TINYINT:"storage.type.sql",DECIMAL:"storage.type.sql",NUMERIC:"storage.type.sql",FLOAT:"storage.type.sql",REAL:"storage.type.sql",DOUBLE:"storage.type.sql",VARCHAR:"storage.type.sql",CHAR:"storage.type.sql",TEXT:"storage.type.sql",DATE:"storage.type.sql",TIME:"storage.type.sql",TIMESTAMP:"storage.type.sql",DATETIME:"storage.type.sql",BOOLEAN:"storage.type.sql",BOOL:"storage.type.sql",BLOB:"storage.type.sql",PRIMARY:"keyword.other.sql",KEY:"keyword.other.sql",FOREIGN:"keyword.other.sql",REFERENCES:"keyword.other.sql",UNIQUE:"keyword.other.sql",CHECK:"keyword.other.sql",DEFAULT:"keyword.other.sql",AUTO_INCREMENT:"keyword.other.sql",TABLE:"keyword.other.sql",VIEW:"keyword.other.sql",INDEX:"keyword.other.sql",DATABASE:"keyword.other.sql",SCHEMA:"keyword.other.sql",IF:"keyword.control.sql",EXISTS:"keyword.other.sql",CASCADE:"keyword.other.sql",CONSTRAINT:"keyword.other.sql",UNION:"keyword.other.sql",INTERSECT:"keyword.other.sql",EXCEPT:"keyword.other.sql",CASE:"keyword.control.sql",WHEN:"keyword.control.sql",THEN:"keyword.control.sql",ELSE:"keyword.control.sql",END:"keyword.control.sql"},patterns:[{include:"#comments"},{include:"#strings"},{include:"#keywords"},{include:"#numbers"},{include:"#operators"}],repository:{comments:{patterns:[{name:"comment.line.double-dash.sql",match:"--.*$"},{name:"comment.line.number-sign.sql",match:"#.*$"},{name:"comment.block.sql",begin:"\\/\\*",end:"\\*\\/"}]},strings:{patterns:[{name:"string.quoted.single.sql",begin:"'",end:"'",patterns:[{name:"constant.character.escape.sql",match:"''"}]},{name:"string.quoted.double.sql",begin:'"',end:'"',patterns:[{name:"constant.character.escape.sql",match:'""'}]}]},keywords:{patterns:[{name:"keyword.other.dml.sql",match:"\\b(?i:SELECT|INSERT|UPDATE|DELETE|MERGE)\\b"},{name:"keyword.other.ddl.sql",match:"\\b(?i:CREATE|ALTER|DROP|TRUNCATE|RENAME)\\b"},{name:"keyword.other.sql",match:"\\b(?i:FROM|WHERE|JOIN|INNER|LEFT|RIGHT|FULL|OUTER|CROSS|ON|USING|GROUP|BY|HAVING|ORDER|ASC|DESC|LIMIT|OFFSET|FETCH|DISTINCT|ALL|AS|INTO|VALUES|SET|TABLE|VIEW|INDEX|DATABASE|SCHEMA|EXISTS|CASCADE|CONSTRAINT|UNION|INTERSECT|EXCEPT|PRIMARY|KEY|FOREIGN|REFERENCES|UNIQUE|CHECK|DEFAULT|AUTO_INCREMENT)\\b"},{name:"keyword.operator.logical.sql",match:"\\b(?i:AND|OR|NOT|IN|BETWEEN|LIKE|IS)\\b"},{name:"keyword.control.sql",match:"\\b(?i:IF|CASE|WHEN|THEN|ELSE|END)\\b"},{name:"constant.language.sql",match:"\\b(?i:NULL|TRUE|FALSE)\\b"},{name:"support.function.aggregate.sql",match:"\\b(?i:COUNT|SUM|AVG|MIN|MAX)\\b"},{name:"storage.type.sql",match:"\\b(?i:INT|INTEGER|BIGINT|SMALLINT|TINYINT|DECIMAL|NUMERIC|FLOAT|REAL|DOUBLE|VARCHAR|CHAR|TEXT|DATE|TIME|TIMESTAMP|DATETIME|BOOLEAN|BOOL|BLOB)\\b"}]},numbers:{patterns:[{name:"constant.numeric.sql",match:"\\b\\d+\\.?\\d*(?:[eE][+-]?\\d+)?\\b"}]},operators:{patterns:[{name:"keyword.operator.sql",match:"(=|!=|<>|<|>|<=|>=|\\+|\\-|\\*|/|%|\\|\\|)"}]}}},Ua={name:"STX",scopeName:"text.html.stx",patterns:[{include:"#stx-comments"},{include:"#stx-echo"},{include:"#stx-directives"},{include:"#html"}],repository:{"stx-comments":{patterns:[{name:"comment.block.stx",begin:"\\{\\{--",end:"--\\}\\}"}]},"stx-echo":{patterns:[{name:"meta.embedded.block.stx.unescaped",begin:"(?<!@)\\{\\{\\{",beginCaptures:{0:{name:"punctuation.section.embedded.begin.stx"}},end:"\\}\\}\\}",endCaptures:{0:{name:"punctuation.section.embedded.end.stx"}},contentName:"source.ts.embedded.stx"},{name:"meta.embedded.block.stx.escaped",begin:"(?<![@{])\\{\\{",beginCaptures:{0:{name:"punctuation.section.embedded.begin.stx"}},end:"\\}\\}",endCaptures:{0:{name:"punctuation.section.embedded.end.stx"}},contentName:"source.ts.embedded.stx"},{name:"meta.embedded.block.stx.raw",begin:"(?<!@)\\{!!",beginCaptures:{0:{name:"punctuation.section.embedded.begin.stx"}},end:"!!\\}",endCaptures:{0:{name:"punctuation.section.embedded.end.stx"}},contentName:"source.ts.embedded.stx"}]},"stx-directives":{patterns:[{name:"keyword.control.conditional.stx",match:"@(if|else|elseif|endif|unless|endunless|switch|case|default|endswitch|break)\\b"},{name:"keyword.control.loop.stx",match:"@(for|endfor|foreach|endforeach|while|endwhile|continue|forelse|empty)\\b"},{name:"keyword.control.auth.stx",match:"@(auth|guest|can|cannot|endauth|endguest|endcan|endcannot)\\b"},{name:"keyword.control.component.stx",match:"@(component|endcomponent|slot|endslot|props|inject)\\b"},{name:"keyword.control.layout.stx",match:"@(section|endsection|yield|extends|parent)\\b"},{name:"support.function.include.stx",match:"@(include|includewhen|includeunless|includefirst)\\b"},{name:"keyword.control.stack.stx",match:"@(push|endpush|pushOnce|endpushOnce|pushif|endpushif|stack)\\b"},{name:"keyword.control.once.stx",match:"@(once|endonce)\\b"},{name:"support.function.security.stx",match:"@(csrf|method)\\b"},{name:"keyword.control.environment.stx",match:"@(production|endproduction|development|enddevelopment|env|endenv)\\b"},{name:"support.function.translation.stx",match:"@(translate|endtranslate|t)\\b"},{name:"support.function.webcomponent.stx",match:"@webcomponent\\b"},{name:"support.function.route.stx",match:"@route\\b"},{name:"keyword.control.markdown.stx",begin:"@markdown\\b",beginCaptures:{0:{name:"keyword.control.markdown.stx"}},end:"@endmarkdown\\b",endCaptures:{0:{name:"keyword.control.markdown.stx"}},contentName:"text.html.markdown.embedded.stx"},{name:"support.function.markdown.stx",match:"@markdown-file\\b"},{name:"keyword.control.animation.stx",match:"@(transition|endtransition|motion|endmotion)\\b"},{name:"meta.embedded.block.ts",begin:"@ts\\b",beginCaptures:{0:{name:"keyword.control.stx"}},end:"@endts\\b",endCaptures:{0:{name:"keyword.control.stx"}},contentName:"source.ts"},{name:"meta.embedded.block.js",begin:"@js\\b",beginCaptures:{0:{name:"keyword.control.stx"}},end:"@endjs\\b",endCaptures:{0:{name:"keyword.control.stx"}},contentName:"source.js"},{name:"meta.embedded.block.raw",begin:"@(raw|verbatim)\\b",beginCaptures:{0:{name:"keyword.control.stx"}},end:"@end(raw|verbatim)\\b",endCaptures:{0:{name:"keyword.control.stx"}},contentName:"string.unquoted.raw"},{name:"entity.name.function.stx",match:"@[a-zA-Z_][a-zA-Z0-9_]*"}]},html:{patterns:[{name:"meta.tag.html",begin:"<([a-zA-Z0-9:-]+)",beginCaptures:{0:{name:"punctuation.definition.tag.begin.html"},1:{name:"entity.name.tag.html"}},end:"(/>)|(>)",endCaptures:{1:{name:"punctuation.definition.tag.end.html"},2:{name:"punctuation.definition.tag.end.html"}},patterns:[{name:"entity.other.attribute-name.html",match:"[a-zA-Z-:@]+"},{name:"string.quoted.double.html",begin:'"',end:'"',patterns:[{include:"#stx-echo"}]},{name:"string.quoted.single.html",begin:"'",end:"'",patterns:[{include:"#stx-echo"}]}]},{name:"meta.tag.html",begin:"(</)([a-zA-Z0-9:-]+)",beginCaptures:{1:{name:"punctuation.definition.tag.begin.html"},2:{name:"entity.name.tag.html"}},end:"(>)",endCaptures:{1:{name:"punctuation.definition.tag.end.html"}}},{name:"comment.block.html",begin:"<!--",end:"-->"}]}}},Ga={name:"Swift",scopeName:"source.swift",keywords:{import:"keyword.other.swift",class:"keyword.other.swift",struct:"keyword.other.swift",enum:"keyword.other.swift",protocol:"keyword.other.swift",extension:"keyword.other.swift",func:"keyword.other.swift",var:"keyword.other.swift",let:"keyword.other.swift",if:"keyword.control.swift",else:"keyword.control.swift",guard:"keyword.control.swift",for:"keyword.control.swift",while:"keyword.control.swift",repeat:"keyword.control.swift",switch:"keyword.control.swift",case:"keyword.control.swift",default:"keyword.control.swift",return:"keyword.control.swift",break:"keyword.control.swift",continue:"keyword.control.swift",fallthrough:"keyword.control.swift",defer:"keyword.control.swift",in:"keyword.control.swift",public:"storage.modifier.swift",private:"storage.modifier.swift",fileprivate:"storage.modifier.swift",internal:"storage.modifier.swift",open:"storage.modifier.swift",static:"storage.modifier.swift",final:"storage.modifier.swift",true:"constant.language.swift",false:"constant.language.swift",nil:"constant.language.swift",self:"variable.language.swift",Self:"variable.language.swift"},patterns:[{include:"#comments"},{include:"#strings"},{include:"#keywords"},{include:"#numbers"}],repository:{comments:{patterns:[{name:"comment.line.double-slash.swift",match:"\\/\\/.*$"},{name:"comment.block.swift",begin:"\\/\\*",end:"\\*\\/"}]},strings:{patterns:[{name:"string.quoted.double.swift",begin:'"',end:'"',patterns:[{name:"constant.character.escape.swift",match:"\\\\."},{name:"meta.embedded.line.swift",begin:"\\\\\\(",end:"\\)"}]}]},keywords:{patterns:[{name:"keyword.control.swift",match:"\\b(if|else|guard|for|while|repeat|switch|case|default|return|break|continue|fallthrough|defer|in)\\b"},{name:"keyword.other.swift",match:"\\b(import|class|struct|enum|protocol|extension|func|var|let)\\b"},{name:"constant.language.swift",match:"\\b(true|false|nil)\\b"}]},numbers:{patterns:[{name:"constant.numeric.swift",match:"\\b\\d+\\.?\\d*\\b"}]}}},Oa={name:"Terraform",scopeName:"source.terraform",keywords:{resource:"keyword.other.terraform",data:"keyword.other.terraform",variable:"keyword.other.terraform",output:"keyword.other.terraform",locals:"keyword.other.terraform",module:"keyword.other.terraform",provider:"keyword.other.terraform",terraform:"keyword.other.terraform",for:"keyword.control.terraform",if:"keyword.control.terraform",else:"keyword.control.terraform",in:"keyword.control.terraform",true:"constant.language.terraform",false:"constant.language.terraform",null:"constant.language.terraform"},patterns:[{include:"#comments"},{include:"#strings"},{include:"#keywords"},{include:"#blocks"}],repository:{comments:{patterns:[{name:"comment.line.number-sign.terraform",match:"#.*$"},{name:"comment.line.double-slash.terraform",match:"\\/\\/.*$"},{name:"comment.block.terraform",begin:"\\/\\*",end:"\\*\\/"}]},strings:{patterns:[{name:"string.quoted.double.terraform",begin:'"',end:'"',patterns:[{name:"constant.character.escape.terraform",match:"\\\\."},{name:"meta.interpolation.terraform",begin:"\\$\\{",end:"\\}"}]}]},keywords:{patterns:[{name:"keyword.other.terraform",match:"\\b(resource|data|variable|output|locals|module|provider|terraform)\\b"},{name:"keyword.control.terraform",match:"\\b(for|if|else|in)\\b"},{name:"constant.language.terraform",match:"\\b(true|false|null)\\b"}]},blocks:{patterns:[{name:"entity.name.type.terraform",match:'^\\s*(resource|data|variable|output|module|provider|terraform)\\s+"[^"]+"'}]}}},Ya={name:"Plain Text",scopeName:"text.plain",keywords:{},patterns:[],repository:{}},Xa={name:"TOML",scopeName:"source.toml",keywords:{true:"constant.language.toml",false:"constant.language.toml"},patterns:[{include:"#comments"},{include:"#tables"},{include:"#keys"},{include:"#strings"},{include:"#numbers"},{include:"#dates"},{include:"#booleans"}],repository:{comments:{patterns:[{name:"comment.line.number-sign.toml",match:"#.*$"}]},tables:{patterns:[{name:"entity.name.section.toml",match:"^\\[\\[?[a-zA-Z0-9._-]+\\]\\]?"}]},keys:{patterns:[{name:"variable.other.key.toml",match:"^[a-zA-Z0-9_-]+(?=\\s*=)"}]},strings:{patterns:[{name:"string.quoted.triple.toml",begin:'"""',end:'"""'},{name:"string.quoted.triple.toml",begin:"'''",end:"'''"},{name:"string.quoted.double.toml",begin:'"',end:'"',patterns:[{name:"constant.character.escape.toml",match:"\\\\."}]},{name:"string.quoted.single.toml",begin:"'",end:"'"}]},numbers:{patterns:[{name:"constant.numeric.toml",match:"\\b[+-]?\\d+(?:\\.\\d+)?(?:[eE][+-]?\\d+)?\\b"},{name:"constant.numeric.toml",match:"\\b0[xX][0-9a-fA-F]+\\b"},{name:"constant.numeric.toml",match:"\\b0[oO][0-7]+\\b"},{name:"constant.numeric.toml",match:"\\b0[bB][01]+\\b"}]},dates:{patterns:[{name:"constant.other.date.toml",match:"\\d{4}-\\d{2}-\\d{2}(?:T\\d{2}:\\d{2}:\\d{2}(?:\\.\\d+)?(?:Z|[+-]\\d{2}:\\d{2})?)?"}]},booleans:{patterns:[{name:"constant.language.toml",match:"\\b(true|false)\\b"}]}}},Fa={name:"TypeScript",scopeName:"source.ts",keywords:{if:"keyword.control.ts",else:"keyword.control.ts",switch:"keyword.control.ts",case:"keyword.control.ts",default:"keyword.control.ts",for:"keyword.control.ts",while:"keyword.control.ts",do:"keyword.control.ts",break:"keyword.control.ts",continue:"keyword.control.ts",return:"keyword.control.ts",try:"keyword.control.ts",catch:"keyword.control.ts",finally:"keyword.control.ts",throw:"keyword.control.ts",async:"keyword.control.ts",await:"keyword.control.ts",yield:"keyword.control.ts",const:"storage.type.ts",let:"storage.type.ts",var:"storage.type.ts",function:"storage.type.ts",class:"storage.type.ts",extends:"storage.type.ts",implements:"storage.type.ts",static:"storage.type.ts",type:"storage.type.ts",interface:"storage.type.ts",enum:"storage.type.ts",namespace:"storage.type.ts",module:"storage.type.ts",declare:"storage.type.ts",public:"storage.type.ts",private:"storage.type.ts",protected:"storage.type.ts",readonly:"storage.type.ts",abstract:"storage.type.ts",string:"storage.type.ts",number:"storage.type.ts",boolean:"storage.type.ts",any:"storage.type.ts",void:"storage.type.ts",never:"storage.type.ts",unknown:"storage.type.ts",object:"storage.type.ts",symbol:"storage.type.ts",bigint:"storage.type.ts",get:"storage.type.ts",set:"storage.type.ts",new:"keyword.operator.new.ts",delete:"keyword.operator.new.ts",typeof:"keyword.operator.new.ts",instanceof:"keyword.operator.new.ts",as:"keyword.operator.new.ts",in:"keyword.operator.new.ts",of:"keyword.operator.new.ts",is:"keyword.operator.new.ts",keyof:"keyword.operator.new.ts",infer:"keyword.operator.new.ts",true:"constant.language.ts",false:"constant.language.ts",null:"constant.language.ts",undefined:"constant.language.ts",NaN:"constant.language.ts",Infinity:"constant.language.ts",this:"constant.language.ts",super:"constant.language.ts",arguments:"constant.language.ts",import:"keyword.other.ts",export:"keyword.other.ts",from:"keyword.other.ts",require:"keyword.other.ts",with:"keyword.other.ts",debugger:"keyword.other.ts"},patterns:[{include:"#comments"},{include:"#strings"},{include:"#jsx"},{include:"#regex"},{include:"#keywords"},{include:"#numbers"},{include:"#functions"},{include:"#types"},{include:"#operators"},{include:"#punctuation"}],repository:{comments:{patterns:[{name:"comment.line.double-slash.ts",match:"\\/\\/.*$"},{name:"comment.block.ts",begin:"\\/\\*",end:"\\*\\/"}]},strings:{patterns:[{name:"string.quoted.double.ts",begin:'"',end:'"',patterns:[{name:"constant.character.escape.ts",match:"\\\\."}]},{name:"string.quoted.single.ts",begin:"'",end:"'",patterns:[{name:"constant.character.escape.ts",match:"\\\\."}]},{name:"string.template.ts",begin:"`",end:"`",patterns:[{name:"meta.template.expression.ts",begin:"\\$\\{",end:"\\}",patterns:[{include:"$self"}]},{name:"constant.character.escape.ts",match:"\\\\."}]}]},jsx:{patterns:[{name:"meta.tag.tsx",begin:"<([A-Z][a-zA-Z0-9]*|[a-z][a-zA-Z0-9-]*)",beginCaptures:{0:{name:"punctuation.definition.tag.begin.tsx"},1:{name:"entity.name.tag.tsx"}},end:"(/?>)",endCaptures:{1:{name:"punctuation.definition.tag.end.tsx"}},patterns:[{name:"entity.other.attribute-name.tsx",match:"[a-zA-Z_:][a-zA-Z0-9_:.-]*"},{name:"meta.embedded.expression.tsx",begin:"\\{",end:"\\}",patterns:[{include:"$self"}]},{name:"string.quoted.double.tsx",begin:'"',end:'"'},{name:"string.quoted.single.tsx",begin:"'",end:"'"}]},{name:"meta.tag.tsx",begin:"(</)([A-Z][a-zA-Z0-9]*|[a-z][a-zA-Z0-9-]*)",beginCaptures:{1:{name:"punctuation.definition.tag.begin.tsx"},2:{name:"entity.name.tag.tsx"}},end:"(>)",endCaptures:{1:{name:"punctuation.definition.tag.end.tsx"}}}]},regex:{patterns:[{name:"string.regexp.ts",begin:"(?<=[=(,\\[!&|?{};:])\\s*(\\/)",beginCaptures:{1:{name:"punctuation.definition.string.begin.ts"}},end:"(\\/)[gimsuvy]*",endCaptures:{1:{name:"punctuation.definition.string.end.ts"}},patterns:[{name:"constant.character.escape.ts",match:"\\\\."}]}]},numbers:{patterns:[{name:"constant.numeric.ts",match:"\\b(0[xX][0-9a-fA-F_]+|0[bB][01_]+|0[oO][0-7_]+|\\d+(_\\d+)*(\\.\\d+(_\\d+)?)?([eE][+-]?\\d+)?)[nN]?\\b"}]},types:{patterns:[{name:"storage.type.ts",match:"\\b(string|number|boolean|any|void|never|unknown|object|symbol|bigint)\\b"},{name:"entity.name.type.ts",match:":\\s*([A-Z][a-zA-Z0-9_]*)"},{name:"meta.type.annotation.ts",match:"<[^>]+>"}]},keywords:{patterns:[{name:"keyword.control.ts",match:"\\b(if|else|switch|case|default|for|while|do|break|continue|return|try|catch|finally|throw|async|await|yield)\\b"},{name:"storage.type.ts",match:"\\b(const|let|var|function|class|extends|implements|static|async|type|interface|enum|namespace|module|declare|public|private|protected|readonly|abstract|get|set)\\b"},{name:"keyword.operator.new.ts",match:"\\b(new|delete|typeof|instanceof|void|as|in|of|is|keyof|infer)\\b"},{name:"constant.language.ts",match:"\\b(true|false|null|undefined|NaN|Infinity|this|super|arguments)\\b"},{name:"keyword.other.ts",match:"\\b(import|export|from|default|require|with|debugger)\\b"}]},functions:{patterns:[{name:"entity.name.function.ts",match:"\\b([a-zA-Z_$][a-zA-Z0-9_$]*)\\s*(?=\\()"}]},operators:{patterns:[{name:"keyword.operator.ts",match:"(\\+\\+|--|\\+|\\-|\\*|\\/|%|===|==|!==|!=|<=|>=|<|>|&&|\\|\\||!|\\?|:|=>|\\.\\.\\.|&|\\||\\^|~|<<|>>|>>>)"}]},punctuation:{patterns:[{name:"punctuation.ts",match:"[{}()\\[\\];,.]"}]}}},Ia={name:"Vue",scopeName:"source.vue",keywords:{},patterns:[{include:"#template"},{include:"#script"},{include:"#style"},{include:"#comments"}],repository:{template:{patterns:[{name:"meta.tag.template.vue",begin:"<template>",end:"</template>",patterns:[{name:"entity.other.attribute-name.vue",match:"v-[a-z-]+"},{name:"entity.other.attribute-name.vue",match:"@[a-z]+"},{name:"entity.other.attribute-name.vue",match:":[a-z-]+"},{name:"meta.embedded.expression.vue",begin:"\\{\\{",end:"\\}\\}"}]}]},script:{patterns:[{name:"meta.tag.script.vue",begin:"<script.*?>",end:"</script>"}]},style:{patterns:[{name:"meta.tag.style.vue",begin:"<style.*?>",end:"</style>"}]},comments:{patterns:[{name:"comment.block.html.vue",begin:"<!--",end:"-->"}]}}},Ja={name:"XML",scopeName:"text.xml",keywords:{},patterns:[{include:"#comments"},{include:"#tags"},{include:"#cdata"}],repository:{comments:{patterns:[{name:"comment.block.xml",begin:"<!--",end:"-->"}]},tags:{patterns:[{name:"meta.tag.xml",begin:"</?([a-zA-Z_:][a-zA-Z0-9_:.-]*)",beginCaptures:{1:{name:"entity.name.tag.xml"}},end:"/?>",patterns:[{name:"entity.other.attribute-name.xml",match:"[a-zA-Z_:][a-zA-Z0-9_:.-]*(?==)"},{include:"#strings"}]}]},strings:{patterns:[{name:"string.quoted.double.xml",begin:'"',end:'"'},{name:"string.quoted.single.xml",begin:"'",end:"'"}]},cdata:{patterns:[{name:"string.unquoted.cdata.xml",begin:"<!\\[CDATA\\[",end:"\\]\\]>"}]}}},Ca={name:"YAML",scopeName:"source.yaml",keywords:{true:"constant.language.boolean.yaml",false:"constant.language.boolean.yaml",null:"constant.language.null.yaml",True:"constant.language.boolean.yaml",False:"constant.language.boolean.yaml",TRUE:"constant.language.boolean.yaml",FALSE:"constant.language.boolean.yaml",yes:"constant.language.boolean.yaml",no:"constant.language.boolean.yaml",Yes:"constant.language.boolean.yaml",No:"constant.language.boolean.yaml",YES:"constant.language.boolean.yaml",NO:"constant.language.boolean.yaml",on:"constant.language.boolean.yaml",off:"constant.language.boolean.yaml"},patterns:[{include:"#comments"},{include:"#document-markers"},{include:"#keys"},{include:"#strings"},{include:"#numbers"},{include:"#constants"},{include:"#anchors"},{include:"#tags"}],repository:{comments:{patterns:[{name:"comment.line.number-sign.yaml",match:"#.*$"}]},"document-markers":{patterns:[{name:"entity.other.document.begin.yaml",match:"^---"},{name:"entity.other.document.end.yaml",match:"^\\.\\.\\."}]},keys:{patterns:[{name:"meta.key.yaml",match:"([a-zA-Z0-9_-]+)\\s*:",captures:{1:{name:"entity.name.tag.yaml"}}},{name:"string.quoted.yaml",match:`(["'])([a-zA-Z0-9_-]+)\\1\\s*:`,captures:{2:{name:"entity.name.tag.yaml"}}}]},strings:{patterns:[{name:"string.quoted.double.yaml",begin:'"',end:'"',patterns:[{name:"constant.character.escape.yaml",match:"\\\\."}]},{name:"string.quoted.single.yaml",begin:"'",end:"'",patterns:[{name:"constant.character.escape.yaml",match:"''"}]},{name:"string.unquoted.block.yaml",match:"[|>][-+]?\\s*$"}]},numbers:{patterns:[{name:"constant.numeric.yaml",match:"\\b[-+]?(0x[0-9a-fA-F]+|0o[0-7]+|[0-9]+\\.?[0-9]*([eE][-+]?[0-9]+)?)\\b"}]},constants:{patterns:[{name:"constant.language.yaml",match:"\\b(true|false|null|True|False|TRUE|FALSE|yes|no|Yes|No|YES|NO|on|off)\\b"}]},anchors:{patterns:[{name:"entity.name.type.anchor.yaml",match:"&[a-zA-Z0-9_-]+"},{name:"variable.other.alias.yaml",match:"\\*[a-zA-Z0-9_-]+"}]},tags:{patterns:[{name:"storage.type.tag.yaml",match:"!![a-zA-Z0-9_-]+"},{name:"storage.type.tag.yaml",match:"![a-zA-Z0-9_-]+"}]}}},tr=[{id:"javascript",name:"JavaScript",aliases:["js","jsx"],extensions:[".js",".jsx",".mjs",".cjs"],grammar:ya},{id:"typescript",name:"TypeScript",aliases:["ts","tsx"],extensions:[".ts",".tsx",".mts",".cts"],grammar:Fa},{id:"html",name:"HTML",aliases:["htm"],extensions:[".html",".htm"],grammar:la},{id:"css",name:"CSS",aliases:[],extensions:[".css"],grammar:oa},{id:"json",name:"JSON",aliases:[],extensions:[".json"],grammar:ha},{id:"stx",name:"STX",aliases:[],extensions:[".stx"],grammar:Ua},{id:"bash",name:"Bash",aliases:["sh","shell","zsh","console"],extensions:[".sh",".bash",".zsh"],grammar:Vo},{id:"markdown",name:"Markdown",aliases:["md"],extensions:[".md",".markdown"],grammar:qa},{id:"yaml",name:"YAML",aliases:["yml"],extensions:[".yaml",".yml"],grammar:Ca},{id:"jsonc",name:"JSONC",aliases:[],extensions:[".jsonc"],grammar:fa},{id:"diff",name:"Diff",aliases:["patch"],extensions:[".diff",".patch"],grammar:ia},{id:"python",name:"Python",aliases:["py"],extensions:[".py",".pyw"],grammar:Na},{id:"php",name:"PHP",aliases:[],extensions:[".php",".phtml"],grammar:ja},{id:"java",name:"Java",aliases:[],extensions:[".java"],grammar:ua},{id:"c",name:"C",aliases:["h"],extensions:[".c",".h"],grammar:ea},{id:"cpp",name:"C++",aliases:["cc","cxx","hpp"],extensions:[".cpp",".cc",".cxx",".hpp",".h++"],grammar:na},{id:"rust",name:"Rust",aliases:["rs"],extensions:[".rs"],grammar:Ra},{id:"csharp",name:"C#",aliases:["cs"],extensions:[".cs"],grammar:ra},{id:"dockerfile",name:"Dockerfile",aliases:["docker"],extensions:[".dockerfile"],grammar:ca},{id:"ruby",name:"Ruby",aliases:["rb"],extensions:[".rb"],grammar:Ta},{id:"go",name:"Go",aliases:[],extensions:[".go"],grammar:da},{id:"sql",name:"SQL",aliases:[],extensions:[".sql"],grammar:Sa},{id:"idl",name:"IDL",aliases:[],extensions:[".idl"],grammar:pa},{id:"text",name:"Text",aliases:["txt","plain"],extensions:[".txt",".text"],grammar:Ya},{id:"json5",name:"JSON5",aliases:[],extensions:[".json5"],grammar:wa},{id:"vue",name:"Vue",aliases:[],extensions:[".vue"],grammar:Ia},{id:"toml",name:"TOML",aliases:[],extensions:[".toml"],grammar:Xa},{id:"scss",name:"SCSS",aliases:["sass"],extensions:[".scss",".sass"],grammar:La},{id:"kotlin",name:"Kotlin",aliases:["kt"],extensions:[".kt",".kts"],grammar:ba},{id:"swift",name:"Swift",aliases:[],extensions:[".swift"],grammar:Ga},{id:"dart",name:"Dart",aliases:[],extensions:[".dart"],grammar:sa},{id:"r",name:"R",aliases:[],extensions:[".r",".R"],grammar:Za},{id:"graphql",name:"GraphQL",aliases:["gql"],extensions:[".graphql",".gql"],grammar:ma},{id:"powershell",name:"PowerShell",aliases:["ps1"],extensions:[".ps1",".psm1"],grammar:Ea},{id:"makefile",name:"Makefile",aliases:["make"],extensions:[".make"],grammar:$a},{id:"terraform",name:"Terraform",aliases:["tf","hcl"],extensions:[".tf",".hcl"],grammar:Oa},{id:"bnf",name:"BNF",aliases:[],extensions:[".bnf"],grammar:Po},{id:"regexp",name:"RegExp",aliases:["regex"],extensions:[".regexp",".regex"],grammar:xa},{id:"lua",name:"Lua",aliases:[],extensions:[".lua"],grammar:Aa},{id:"cmd",name:"CMD",aliases:["batch"],extensions:[".cmd",".bat"],grammar:ta},{id:"abnf",name:"ABNF",aliases:[],extensions:[".abnf"],grammar:Ho},{id:"csv",name:"CSV",aliases:[],extensions:[".csv"],grammar:aa},{id:"log",name:"Log",aliases:[],extensions:[".log"],grammar:ga},{id:"nginx",name:"Nginx",aliases:["nginxconf"],extensions:[".conf"],grammar:_a},{id:"xml",name:"XML",aliases:[],extensions:[".xml"],grammar:Ja},{id:"protobuf",name:"Protobuf",aliases:["proto"],extensions:[".proto"],grammar:za},{id:"solidity",name:"Solidity",aliases:["sol"],extensions:[".sol"],grammar:Ba},{id:"latex",name:"LaTeX",aliases:["tex"],extensions:[".tex",".latex"],grammar:ka}];function Qa(e){return tr.find((t)=>t.id===e||t.aliases?.includes(e)||t.extensions?.includes(`.${e}`)||t.extensions?.includes(e))}class Ot{theme;colorCache=new Map;cssCache=null;constructor(e){this.theme=e}render(e,t={}){let{lineNumbers:n=!1,highlightLines:r=[],inline:o=!1,focusLines:a=[],dimLines:s=[],addedLines:c=[],removedLines:i=[],annotations:d=[],showCopyButton:m=!1}=t,l=e.map((y,h)=>{let w=h+1,b=this.getLineClasses(w,{highlightLines:r,focusLines:a,dimLines:s,addedLines:c,removedLines:i}),_=this.renderLine(y,o);if(o)return _;let A=n?`<span class="line-number">${w}</span>`:"",k="";if(c.includes(w))k='<span class="diff-indicator add">+</span>';else if(i.includes(w))k='<span class="diff-indicator remove">-</span>';let g=d.filter((Z)=>Z.line===w).map((Z)=>this.renderAnnotation(Z)).join("");return`<span class="${b}">${k}${A}${_}${g}</span>`}),u=o?`<code class="syntax-inline">${l.join("")}</code>`:`<div class="syntax-wrapper">${m?'<button class="copy-button" data-copy>Copy</button>':""}<pre class="syntax"><code>${l.join(`
1199
- `)}</code></pre></div>`,p=this.generateCSS(t),f=this.renderAnsi(e);return{html:u,css:p,tokens:e,ansi:f}}getLineClasses(e,t){let n=["line"];if(t.highlightLines.includes(e))n.push("highlighted");if(t.focusLines.includes(e))n.push("focus");if(t.dimLines.includes(e))n.push("dim");if(t.addedLines.includes(e))n.push("added");if(t.removedLines.includes(e))n.push("removed");return n.join(" ")}renderAnnotation(e){return`<span class="annotation annotation-${e.type||"info"}">${this.escapeHtml(e.text)}</span>`}renderLine(e,t){return e.tokens.map((n)=>this.renderToken(n)).join("")}renderToken(e){let t=this.getColorForScopes(e.scopes),n=this.escapeHtml(e.content),r=[this.getScopeClass(e.scopes)],o=[];if(t.foreground||t.fontStyle)o.push(this.buildStyle(t));if(e.dimmed)r.push("dimmed");if(e.blurred)r.push("blurred");if(e.highlighted){if(r.push("highlighted-token"),e.highlightColor)o.push(`background-color: ${e.highlightColor}`)}if(e.emphasized)r.push("emphasized");let a=r.join(" "),s=o.join("; ");if(e.link)return`<a href="${e.link}" class="${a}" style="${s}" target="_blank" rel="noopener noreferrer">${n}</a>`;if(!s&&a==="token")return n;return`<span class="${a}" style="${s}">${n}</span>`}getColorForScopes(e){if(!Array.isArray(e)||e.length===0)return{};let t=e.join("|"),n=this.colorCache.get(t);if(n)return n;let r={},o=0;for(let a of this.theme.tokenColors){let s=Array.isArray(a.scope)?a.scope:[a.scope];for(let c of s)for(let i of e)if(this.scopeMatches(i,c)){let d=c.split(".").length;if(d>o)r=a.settings,o=d}}return this.colorCache.set(t,r),r}scopeMatches(e,t){if(typeof e!=="string"||typeof t!=="string")return!1;let n=e.split("."),r=t.split(".");for(let o=0;o<r.length;o++)if(n[o]!==r[o])return!1;return!0}buildStyle(e){let t=[];if(e.foreground)t.push(`color: ${e.foreground}`);if(e.background)t.push(`background-color: ${e.background}`);if(e.fontStyle){if(e.fontStyle.includes("italic"))t.push("font-style: italic");if(e.fontStyle.includes("bold"))t.push("font-weight: bold");if(e.fontStyle.includes("underline"))t.push("text-decoration: underline")}return t.join("; ")}getScopeClass(e){if(e.length===0)return"token";let t=e[e.length-1];if(typeof t!=="string")return"token";return`token ${t.replace(/\./g,"-")}`}escapeHtml(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}generateCSS(e={}){if(this.cssCache)return this.cssCache;let{colors:t}=this.theme;return this.cssCache=`
1200
+ `;i=i.replace(this.ANSI_PATTERN,""),await this.writeToFile(i)}time(e){let t=performance.now();if(this.fancy&&!R()){let n=this.options.showTags!==!1&&this.name?Z.gray(this.formatTag(this.name)):"",r=this.formatConsoleTimestamp(new Date);console.error(this.formatConsoleMessage({timestamp:r,icon:Z.blue("\u25D0"),tag:n,message:`${Z.cyan(e)}...`}))}return async(n)=>{if(!this.enabled)return;let r=performance.now(),o=Math.round(r-t),a=`${e} completed in ${o}ms`,s=new Date,c=this.formatConsoleTimestamp(s),i=`${this.formatFileTimestamp(s)} ${this.environment}.INFO: ${a}`;if(n)i+=` ${JSON.stringify(n)}`;if(i+=`
1201
+ `,i=i.replace(this.ANSI_PATTERN,""),this.fancy&&!R()){let d=this.options.showTags!==!1&&this.name?Z.gray(this.formatTag(this.name)):"";console.error(this.formatConsoleMessage({timestamp:c,icon:Z.green("\u2713"),tag:d,message:`${a}${n?` ${JSON.stringify(n)}`:""}`}))}else if(!R())console.error(i.trim());await this.writeToFile(i)}}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}`,n=new nt(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(n),n}createReadStream(){if(R())throw Error("createReadStream is not supported in browser environments");if(!Rt(this.currentLogFile))throw Error(`Log file does not exist: ${this.currentLogFile}`);return Wn(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 n=this.keys.get(this.currentKeyId);try{let r=le.isBuffer(e)?e:le.from(e,"base64"),o=r.slice(0,16),a=r.slice(-16),s=r.slice(16,-16),c=Uo("aes-256-gcm",n,o);return c.setAuthTag(a),le.concat([c.update(s),c.final()]).toString("utf8")}catch(r){throw Error(`Decryption failed: ${r instanceof Error?r.message:String(r)}`)}}getLevel(){return this.config.level}getLogDirectory(){return this.config.logDirectory}getFormat(){return this.config.format}getRotationConfig(){return this.config.rotation}isBrowserMode(){return R()}isServerMode(){return!R()}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,n=this.formatConsoleTimestamp(t),r=this.formatFileTimestamp(t);if(this.fancy&&!R()){let a=e.split(`
1202
+ `),s=Math.max(...a.map((l)=>l.length))+2,c=`\u250C${"\u2500".repeat(s)}\u2510`,i=`\u2514${"\u2500".repeat(s)}\u2518`,d=a.map((l)=>{let m=" ".repeat(s-l.length-2);return`\u2502 ${l}${m} \u2502`});if(this.options.showTags!==!1&&this.name)console.error(this.formatConsoleMessage({timestamp:n,message:Z.gray(this.formatTag(this.name)),showTimestamp:!1}));console.error(this.formatConsoleMessage({timestamp:n,message:Z.cyan(c)})),d.forEach((l)=>console.error(this.formatConsoleMessage({timestamp:n,message:Z.cyan(l),showTimestamp:!1}))),console.error(this.formatConsoleMessage({timestamp:n,message:Z.cyan(i),showTimestamp:!1}))}else if(!R())console.error(`${r} ${this.environment}.INFO: [BOX] ${e}`);let o=`${r} ${this.environment}.INFO: [BOX] ${e}
1203
+ `.replace(this.ANSI_PATTERN,"");await this.writeToFile(o)}async prompt(e){if(R())return Promise.resolve(!0);return new Promise((t)=>{console.error(`${Z.cyan("?")} ${e} (y/n) `);let n=(r)=>{let o=r.toString().trim().toLowerCase();X.stdin.removeListener("data",n);try{if(typeof X.stdin.setRawMode==="function")X.stdin.setRawMode(!1)}catch{}X.stdin.pause(),console.error(""),t(o==="y"||o==="yes")};try{if(typeof X.stdin.setRawMode==="function")X.stdin.setRawMode(!0)}catch{}X.stdin.resume(),X.stdin.once("data",n)})}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 n=e;if(t&&t.length>0){let o=/%([sdijfo%])/g,a=0;if(n=e.replace(o,(s,c)=>{if(c==="%")return"%";if(a>=t.length)return s;let i=t[a++];switch(c){case"s":return String(i);case"d":case"i":return Number(i).toString();case"j":case"o":return JSON.stringify(i,null,2);default:return s}}),a<t.length)n+=` ${t.slice(a).map((s)=>typeof s==="object"?JSON.stringify(s,null,2):String(s)).join(" ")}`}if(this.fancy&&!R()){let o=this.options.showTags!==!1&&this.name?Z.gray(this.formatTag(this.name)):"",a=Z.blue("\u25D0");console.error(`${a} ${o} ${Z.cyan(n)}`)}let r=`[${new Date().toISOString()}] ${this.environment}.INFO: [START] ${n}
1204
+ `.replace(this.ANSI_PATTERN,"");await this.writeToFile(r)}progress(e,t=""){if(!this.enabled||!this.fancy||R()||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 n=20;return this.activeProgressBar={total:e,current:0,message:t,barLength:n,lastRenderedLine:""},this.renderProgressBar(this.activeProgressBar),{update:(r,o)=>{if(!this.activeProgressBar||!this.enabled||!this.fancy||R())return;if(this.activeProgressBar.current=Math.max(0,Math.min(e,r)),o!==void 0)this.activeProgressBar.message=o;let a=this.activeProgressBar.current===this.activeProgressBar.total;this.renderProgressBar(this.activeProgressBar,a)},finish:(r)=>{if(!this.activeProgressBar||!this.enabled||!this.fancy||R())return;if(this.activeProgressBar.current=this.activeProgressBar.total,r!==void 0)this.activeProgressBar.message=r;this.renderProgressBar(this.activeProgressBar,!0),this.finishProgressBar(this.activeProgressBar)},interrupt:(r,o="info")=>{if(!this.activeProgressBar||!this.enabled||!this.fancy||R())return;X.stdout.write(`${"\r".padEnd(X.stdout.columns||80)}\r`),this.log(o,r),setTimeout(()=>{if(this.activeProgressBar)this.renderProgressBar(this.activeProgressBar)},50)}}}renderProgressBar(e,t=!1){if(!this.enabled||!this.fancy||R()||!X.stdout.isTTY)return;let n=Math.min(100,Math.max(0,Math.round(e.current/e.total*100))),r=Math.round(e.barLength*n/100),o=e.barLength-r,a=Z.green("\u2501".repeat(r)),s=Z.gray("\u2501".repeat(o)),c=`[${a}${s}]`,i=`${n}%`.padStart(4),d=e.message?` ${e.message}`:"",l=t||n===100?Z.green("\u2713"):Z.blue("\u25B6"),m=this.options.showTags!==!1&&this.name?` ${Z.gray(this.formatTag(this.name))}`:"",u=`\r${l}${m} ${c} ${i}${d}`,p=X.stdout.columns||80,h=" ".repeat(Math.max(0,p-u.replace(this.ANSI_PATTERN,"").length));if(e.lastRenderedLine=`${u}${h}`,X.stdout.write(e.lastRenderedLine),t)X.stdout.write(`
1205
+ `)}finishProgressBar(e,t){if(!this.enabled||!this.fancy||R()||!X.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(R()){console.warn("Log clearing is not supported in browser environments.");return}try{console.warn("Clearing logs...",this.config.logDirectory);let t=await ve(this.config.logDirectory),n=[];for(let r of t){if(!(e.name?new RegExp(e.name.replace("*",".*")).test(r):r.startsWith(this.name))||!r.endsWith(".log"))continue;let o=$e(this.config.logDirectory,r);if(e.before)try{if((await Ae(o)).mtime>=e.before)continue}catch(a){console.error(`Failed to get stats for file ${o}:`,a);continue}n.push(o)}if(n.length===0){console.warn("No log files matched the criteria for clearing.");return}console.warn(`Preparing to delete ${n.length} log file(s)...`);for(let r of n)try{await Ke(r),console.warn(`Deleted log file: ${r}`)}catch(o){console.error(`Failed to delete log file ${r}:`,o)}console.warn("Log clearing process finished.")}catch(t){console.error("Error during log clearing process:",t)}}}var bd=new nt("stacks");function He(e,t){if(Array.isArray(t)&&Array.isArray(e)&&t.length===2&&e.length===2&&E(t[0])&&"id"in t[0]&&t[0].id===3&&E(t[1])&&"id"in t[1]&&t[1].id===4)return t;if(E(t)&&E(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(E(e)&&"arr"in e&&Array.isArray(e.arr)&&E(t)&&"arr"in t&&Array.isArray(t.arr))return t;if(t.length>0&&e.length>0&&E(t[0])&&E(e[0])){let r=[...t];for(let o of e)if(E(o)&&"name"in o){if(!r.find((a)=>E(a)&&("name"in a)&&a.name===o.name))r.push(o)}else if(E(o)&&"path"in o){if(!r.find((a)=>E(a)&&("path"in a)&&a.path===o.path))r.push(o)}else if(!r.some((a)=>tt(a,o)))r.push(o);return r}if(t.every((r)=>typeof r==="string")&&e.every((r)=>typeof r==="string")){let r=[...t];for(let o of e)if(!r.includes(o))r.push(o);return r}return t}if(!E(t)||!E(e))return t;let n={...e};for(let r in t)if(Object.prototype.hasOwnProperty.call(t,r)){let o=t[r];if(o===null||o===void 0)continue;else if(E(o)&&E(n[r]))n[r]=He(n[r],o);else if(Array.isArray(o)&&Array.isArray(n[r]))if(o.length>0&&n[r].length>0&&E(o[0])&&E(n[r][0])){let a=[...o];for(let s of n[r])if(E(s)&&"name"in s){if(!a.find((c)=>E(c)&&("name"in c)&&c.name===s.name))a.push(s)}else if(E(s)&&"path"in s){if(!a.find((c)=>E(c)&&("path"in c)&&c.path===s.path))a.push(s)}else if(!a.some((c)=>tt(c,s)))a.push(s);n[r]=a}else if(o.every((a)=>typeof a==="string")&&n[r].every((a)=>typeof a==="string")){let a=[...o];for(let s of n[r])if(!a.includes(s))a.push(s);n[r]=a}else n[r]=o;else n[r]=o}return n}function It(e,t,n="replace"){if(t===null||t===void 0)return e;if(Array.isArray(t))return n==="replace"?t:He(e,t);if(Array.isArray(e))return n==="replace"?t:He(e,t);if(!E(t)||!E(e))return t;let r={...e};for(let o of Object.keys(t)){if(!Object.prototype.hasOwnProperty.call(t,o))continue;let a=t[o],s=r[o];if(a===null||a===void 0)continue;if(Array.isArray(a)||Array.isArray(s))if(n==="replace")r[o]=a;else r[o]=He(s,a);else if(E(a)&&E(s))r[o]=It(s,a,n);else r[o]=a}return r}function tt(e,t){if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!tt(e[n],t[n]))return!1;return!0}if(E(e)&&E(t)){let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let o of n){if(!Object.prototype.hasOwnProperty.call(t,o))return!1;if(!tt(e[o],t[o]))return!1}return!0}return!1}function E(e){return Boolean(e&&typeof e==="object"&&!Array.isArray(e))}var W=new nt("bunfig",{showTags:!0});async function De(e,t,n="replace"){if(!er(e))return null;try{let r=await import(e),o=r.default||r;if(typeof o!=="object"||o===null||Array.isArray(o))return null;try{return It(t,o,n)}catch{return null}}catch{return null}}function Vo(e,t,n=!1){if(!e)return t;let r=e.toUpperCase().replace(/-/g,"_"),o={...t};function a(s,c=[]){let i={...s};for(let[d,l]of Object.entries(s)){let m=[...c,d],u=(y)=>y.replace(/([A-Z])/g,"_$1").toUpperCase(),p=`${r}_${m.map(u).join("_")}`,h=`${r}_${m.map((y)=>y.toUpperCase()).join("_")}`;if(n)W.info(`Checking environment variable ${p} for config ${e}.${m.join(".")}`);if(typeof l==="object"&&l!==null&&!Array.isArray(l))i[d]=a(l,m);else{let y=je.env[p]||je.env[h];if(y!==void 0){if(n)W.info(`Using environment variable ${y?p:h} for config ${e}.${m.join(".")}`);if(typeof l==="number")i[d]=Number(y);else if(typeof l==="boolean")i[d]=y.toLowerCase()==="true";else if(Array.isArray(l))try{let w=JSON.parse(y);if(Array.isArray(w))i[d]=w;else i[d]=y.split(",").map((f)=>f.trim())}catch{i[d]=y.split(",").map((w)=>w.trim())}else i[d]=y}}}return i}return a(o)}async function Po({name:e="",alias:t,cwd:n,configDir:r,defaultConfig:o,verbose:a=!1,checkEnv:s=!0,arrayStrategy:c="replace"}){let i=s&&typeof o==="object"&&o!==null&&!Array.isArray(o)?Vo(e,o,a):o,d=n||je.cwd(),l=[".ts",".js",".mjs",".cjs",".json"];if(a)W.info(`Loading configuration for "${e}"${t?` (alias: "${t}")`:""} from ${d}`);let m=[e,`.${e}`].filter(Boolean),u=[`${e}.config`,`.${e}.config`].filter(Boolean),p=t?[t,`.${t}`]:[],h=t?[`${t}.config`,`.${t}.config`]:[],y=Array.from(new Set([d,v(d,"config"),v(d,".config"),r?v(d,r):void 0].filter(Boolean)));for(let w of y){if(a)W.info(`Searching for configuration in: ${w}`);let f=[v(d,"config"),v(d,".config")].concat(r?[v(d,r)]:[]).includes(w)?[...m,...u,...p,...h]:[...u,...m,...h,...p];for(let b of f)for(let q of l){let g=v(w,`${b}${q}`),k=await De(g,i,c);if(k!==null){if(a)W.success(`Configuration loaded from: ${g}`);return k}}}if(e){let w=v(Zt(),".config",e),f=["config",`${e}.config`];if(t)f.push(`${t}.config`);if(a)W.info(`Checking user config directory: ${w}`);for(let b of f)for(let q of l){let g=v(w,`${b}${q}`),k=await De(g,i,c);if(k!==null){if(a)W.success(`Configuration loaded from user config directory: ${g}`);return k}}}if(e){let w=v(Zt(),".config"),f=[`.${e}.config`];if(t)f.push(`.${t}.config`);if(a)W.info(`Checking user config directory for dotfile configs: ${w}`);for(let b of f)for(let q of l){let g=v(w,`${b}${q}`),k=await De(g,i,c);if(k!==null){if(a)W.success(`Configuration loaded from user config directory dotfile: ${g}`);return k}}}if(e){let w=Zt(),f=[`.${e}.config`,`.${e}`];if(t)f.push(`.${t}.config`),f.push(`.${t}`);if(a)W.info(`Checking user home directory for dotfile configs: ${w}`);for(let b of f)for(let q of l){let g=v(w,`${b}${q}`),k=await De(g,i,c);if(k!==null){if(a)W.success(`Configuration loaded from user home directory: ${g}`);return k}}}try{let w=v(d,"package.json");if(er(w)){let f=await import(w),b=f[e];if(!b&&t){if(b=f[t],b&&a)W.success(`Using alias "${t}" configuration from package.json`)}if(b&&typeof b==="object"&&!Array.isArray(b))try{if(a)W.success(`Configuration loaded from package.json: ${b===f[e]?e:t}`);return It(i,b,c)}catch(q){if(a)W.warn("Failed to merge package.json config:",q)}}}catch(w){if(a)W.warn("Failed to load package.json:",w)}if(a)W.info(`No configuration found for "${e}"${t?` or alias "${t}"`:""}, using default configuration with environment variables`);return i}var kd=v(je.cwd(),"config"),gd=v(je.cwd(),"src/generated"),ea={verbose:!1,theme:"github-dark",defaultLanguage:"javascript",cache:!0,plugins:[]},Ot=await Po({name:"syntax",defaultConfig:ea});var ta={name:"ABNF",scopeName:"source.abnf",keywords:{},patterns:[{include:"#rules"},{include:"#comments"}],repository:{rules:{patterns:[{name:"entity.name.type.abnf",match:"^[a-zA-Z][a-zA-Z0-9-]*(?=\\s*=)"},{name:"keyword.operator.abnf",match:"="}]},comments:{patterns:[{name:"comment.line.semicolon.abnf",match:";.*$"}]}}},na={name:"Bash",scopeName:"source.bash",keywords:{if:"keyword.control.bash",then:"keyword.control.bash",else:"keyword.control.bash",elif:"keyword.control.bash",fi:"keyword.control.bash",case:"keyword.control.bash",esac:"keyword.control.bash",for:"keyword.control.bash",while:"keyword.control.bash",until:"keyword.control.bash",do:"keyword.control.bash",done:"keyword.control.bash",in:"keyword.control.bash",select:"keyword.control.bash",function:"storage.type.function.bash",declare:"storage.type.bash",local:"storage.type.bash",export:"storage.type.bash",readonly:"storage.type.bash",typeset:"storage.type.bash",echo:"support.function.builtin.bash",printf:"support.function.builtin.bash",read:"support.function.builtin.bash",cd:"support.function.builtin.bash",pwd:"support.function.builtin.bash",exit:"support.function.builtin.bash",return:"support.function.builtin.bash",source:"support.function.builtin.bash",test:"support.function.builtin.bash",eval:"support.function.builtin.bash",exec:"support.function.builtin.bash",shift:"support.function.builtin.bash",set:"support.function.builtin.bash",unset:"support.function.builtin.bash",alias:"support.function.builtin.bash",unalias:"support.function.builtin.bash",true:"constant.language.bash",false:"constant.language.bash"},patterns:[{include:"#strings"},{include:"#variables"},{include:"#comments"},{include:"#keywords"},{include:"#functions"},{include:"#operators"},{include:"#numbers"}],repository:{comments:{patterns:[{name:"comment.line.number-sign.bash",match:"#.*$"}]},strings:{patterns:[{name:"string.quoted.double.bash",begin:'"',end:'"',patterns:[{name:"constant.character.escape.bash",match:'\\\\[\\\\"`$\\n]'},{include:"#variables"},{name:"variable.other.subshell.bash",begin:"\\$\\(",end:"\\)"},{name:"variable.other.backtick.bash",begin:"`",end:"`"}]},{name:"string.quoted.single.bash",begin:"'",end:"'"},{name:"string.unquoted.heredoc.bash",begin:`<<-?\\s*(['"]?)(\\w+)\\1`,end:"^\\2$"}]},variables:{patterns:[{name:"variable.other.bracket.bash",match:"\\$\\{[^}]+\\}"},{name:"variable.other.normal.bash",match:"\\$[a-zA-Z_][a-zA-Z0-9_]*"},{name:"variable.other.positional.bash",match:"\\$[0-9@*#?$!-]"}]},functions:{patterns:[{name:"entity.name.function.bash",match:"\\b([a-zA-Z_][a-zA-Z0-9_]*)\\s*\\(\\)"}]},keywords:{patterns:[{name:"keyword.control.bash",match:"\\b(if|then|else|elif|fi|case|esac|for|while|until|do|done|in|select)\\b"},{name:"storage.type.bash",match:"\\b(function|declare|local|export|readonly|typeset)\\b"},{name:"support.function.builtin.bash",match:"\\b(echo|printf|read|cd|pwd|exit|return|source|test|eval|exec|shift|set|unset|alias|unalias)\\b"},{name:"constant.language.bash",match:"\\b(true|false)\\b"}]},operators:{patterns:[{name:"keyword.operator.logical.bash",match:"(&&|\\|\\||!)"},{name:"keyword.operator.pipe.bash",match:"\\|"},{name:"keyword.operator.redirect.bash",match:"(>>|>|<<|<|&>|&>>|2>|2>>)"},{name:"keyword.operator.assignment.bash",match:"="}]},numbers:{patterns:[{name:"constant.numeric.bash",match:"\\b[0-9]+\\b"}]}}},ra={name:"BNF",scopeName:"source.bnf",keywords:{},patterns:[{include:"#rules"},{include:"#terminals"},{include:"#nonterminals"}],repository:{rules:{patterns:[{name:"keyword.operator.bnf",match:"::="}]},nonterminals:{patterns:[{name:"entity.name.type.bnf",match:"<[^>]+>"}]},terminals:{patterns:[{name:"string.quoted.double.bnf",begin:'"',end:'"'},{name:"string.quoted.single.bnf",begin:"'",end:"'"}]}}},oa={name:"C",scopeName:"source.c",keywords:{if:"keyword.control.c",else:"keyword.control.c",for:"keyword.control.c",while:"keyword.control.c",do:"keyword.control.c",switch:"keyword.control.c",case:"keyword.control.c",default:"keyword.control.c",break:"keyword.control.c",continue:"keyword.control.c",return:"keyword.control.c",goto:"keyword.control.c",void:"storage.type.c",char:"storage.type.c",short:"storage.type.c",int:"storage.type.c",long:"storage.type.c",float:"storage.type.c",double:"storage.type.c",signed:"storage.type.c",unsigned:"storage.type.c",struct:"storage.type.c",union:"storage.type.c",enum:"storage.type.c",typedef:"storage.type.c",const:"storage.modifier.c",static:"storage.modifier.c",extern:"storage.modifier.c",register:"storage.modifier.c",volatile:"storage.modifier.c",inline:"storage.modifier.c",restrict:"storage.modifier.c",_Atomic:"storage.modifier.c",sizeof:"keyword.operator.sizeof.c",size_t:"support.type.c",FILE:"support.type.c",NULL:"constant.language.c"},patterns:[{include:"#preprocessor"},{include:"#comments"},{include:"#strings"},{include:"#keywords"},{include:"#numbers"},{include:"#functions"},{include:"#operators"}],repository:{preprocessor:{patterns:[{name:"meta.preprocessor.include.c",match:'^\\s*#\\s*include\\s+(<[^>]+>|"[^"]+")',captures:{1:{name:"string.quoted.other.lt-gt.include.c"}}},{name:"meta.preprocessor.macro.c",match:"^\\s*#\\s*(define|undef)\\s+([a-zA-Z_][a-zA-Z0-9_]*)",captures:{1:{name:"keyword.control.directive.c"},2:{name:"entity.name.function.preprocessor.c"}}},{name:"meta.preprocessor.c",match:"^\\s*#\\s*(if|ifdef|ifndef|elif|else|endif|pragma|error|warning|line)\\b",captures:{1:{name:"keyword.control.directive.c"}}}]},comments:{patterns:[{name:"comment.line.double-slash.c",match:"\\/\\/.*$"},{name:"comment.block.c",begin:"\\/\\*",end:"\\*\\/"}]},strings:{patterns:[{name:"string.quoted.double.c",begin:'"',end:'"',patterns:[{name:"constant.character.escape.c",match:"\\\\."}]},{name:"string.quoted.single.c",begin:"'",end:"'",patterns:[{name:"constant.character.escape.c",match:"\\\\."}]}]},keywords:{patterns:[{name:"keyword.control.c",match:"\\b(if|else|for|while|do|switch|case|default|break|continue|return|goto)\\b"},{name:"storage.type.c",match:"\\b(void|char|short|int|long|float|double|signed|unsigned|struct|union|enum|typedef)\\b"},{name:"storage.modifier.c",match:"\\b(const|static|extern|register|volatile|inline|restrict|_Atomic)\\b"},{name:"constant.language.c",match:"\\b(NULL|true|false)\\b"}]},numbers:{patterns:[{name:"constant.numeric.c",match:"\\b(?:0[xX][0-9a-fA-F]+[uUlL]*|0[0-7]+[uUlL]*|\\d+\\.?\\d*(?:[eE][+-]?\\d+)?[fFlL]?)\\b"}]},functions:{patterns:[{name:"entity.name.function.c",match:"\\b([a-zA-Z_][a-zA-Z0-9_]*)\\s*(?=\\()"}]},operators:{patterns:[{name:"keyword.operator.c",match:"(\\+\\+|--|\\+|\\-|\\*|/|%|==|!=|<=|>=|<|>|&&|\\|\\||!|&|\\||\\^|~|<<|>>|\\?|:|=|\\+=|-=|\\*=|/=|%=|&=|\\|=|\\^=|<<=|>>=|->|\\.)"}]}}},aa={name:"Batch",scopeName:"source.cmd",keywords:{if:"keyword.control.cmd",else:"keyword.control.cmd",for:"keyword.control.cmd",do:"keyword.control.cmd",goto:"keyword.control.cmd",call:"keyword.control.cmd",exit:"keyword.control.cmd",echo:"support.function.cmd",set:"support.function.cmd",setlocal:"support.function.cmd",endlocal:"support.function.cmd"},patterns:[{include:"#comments"},{include:"#variables"},{include:"#labels"},{include:"#keywords"}],repository:{comments:{patterns:[{name:"comment.line.rem.cmd",match:"^\\s*[Rr][Ee][Mm]\\b.*$"},{name:"comment.line.colons.cmd",match:"^\\s*::.*$"}]},variables:{patterns:[{name:"variable.other.cmd",match:"%[a-zA-Z_][a-zA-Z0-9_]*%"},{name:"variable.other.cmd",match:"![a-zA-Z_][a-zA-Z0-9_]*!"}]},labels:{patterns:[{name:"entity.name.label.cmd",match:"^:[a-zA-Z_][a-zA-Z0-9_]*"}]},keywords:{patterns:[{name:"keyword.control.cmd",match:"\\b(if|else|for|do|goto|call|exit)\\b"},{name:"support.function.cmd",match:"\\b(echo|set|setlocal|endlocal)\\b"}]}}},sa={name:"C++",scopeName:"source.cpp",keywords:{if:"keyword.control.cpp",else:"keyword.control.cpp",for:"keyword.control.cpp",while:"keyword.control.cpp",do:"keyword.control.cpp",switch:"keyword.control.cpp",case:"keyword.control.cpp",default:"keyword.control.cpp",break:"keyword.control.cpp",continue:"keyword.control.cpp",return:"keyword.control.cpp",goto:"keyword.control.cpp",try:"keyword.control.cpp",catch:"keyword.control.cpp",throw:"keyword.control.cpp",void:"storage.type.cpp",bool:"storage.type.cpp",char:"storage.type.cpp",short:"storage.type.cpp",int:"storage.type.cpp",long:"storage.type.cpp",float:"storage.type.cpp",double:"storage.type.cpp",signed:"storage.type.cpp",unsigned:"storage.type.cpp",struct:"storage.type.cpp",union:"storage.type.cpp",enum:"storage.type.cpp",class:"storage.type.cpp",typedef:"storage.type.cpp",typename:"storage.type.cpp",auto:"storage.type.cpp",decltype:"storage.type.cpp",const:"storage.modifier.cpp",static:"storage.modifier.cpp",extern:"storage.modifier.cpp",register:"storage.modifier.cpp",volatile:"storage.modifier.cpp",inline:"storage.modifier.cpp",virtual:"storage.modifier.cpp",explicit:"storage.modifier.cpp",friend:"storage.modifier.cpp",mutable:"storage.modifier.cpp",constexpr:"storage.modifier.cpp",consteval:"storage.modifier.cpp",constinit:"storage.modifier.cpp",public:"storage.modifier.access.cpp",private:"storage.modifier.access.cpp",protected:"storage.modifier.access.cpp",new:"keyword.operator.new.cpp",delete:"keyword.operator.delete.cpp",sizeof:"keyword.operator.sizeof.cpp",alignof:"keyword.operator.alignof.cpp",typeid:"keyword.operator.typeid.cpp",static_cast:"keyword.operator.cast.cpp",dynamic_cast:"keyword.operator.cast.cpp",const_cast:"keyword.operator.cast.cpp",reinterpret_cast:"keyword.operator.cast.cpp",namespace:"keyword.other.namespace.cpp",using:"keyword.other.using.cpp",template:"keyword.other.template.cpp",this:"variable.language.cpp",nullptr:"constant.language.cpp",true:"constant.language.cpp",false:"constant.language.cpp",operator:"keyword.operator.cpp",concept:"keyword.other.concept.cpp",requires:"keyword.other.requires.cpp",co_await:"keyword.control.cpp",co_return:"keyword.control.cpp",co_yield:"keyword.control.cpp"},patterns:[{include:"#preprocessor"},{include:"#comments"},{include:"#strings"},{include:"#keywords"},{include:"#numbers"},{include:"#functions"},{include:"#operators"}],repository:{preprocessor:{patterns:[{name:"meta.preprocessor.include.cpp",match:'^\\s*#\\s*include\\s+(<[^>]+>|"[^"]+")',captures:{1:{name:"string.quoted.other.lt-gt.include.cpp"}}},{name:"meta.preprocessor.macro.cpp",match:"^\\s*#\\s*(define|undef)\\s+([a-zA-Z_][a-zA-Z0-9_]*)",captures:{1:{name:"keyword.control.directive.cpp"},2:{name:"entity.name.function.preprocessor.cpp"}}},{name:"meta.preprocessor.cpp",match:"^\\s*#\\s*(if|ifdef|ifndef|elif|else|endif|pragma|error|warning|line)\\b",captures:{1:{name:"keyword.control.directive.cpp"}}}]},comments:{patterns:[{name:"comment.line.double-slash.cpp",match:"\\/\\/.*$"},{name:"comment.block.cpp",begin:"\\/\\*",end:"\\*\\/"}]},strings:{patterns:[{name:"string.quoted.raw.cpp",begin:'R"([a-zA-Z0-9_]*)\\(',end:'\\)\\1"'},{name:"string.quoted.double.cpp",begin:'"',end:'"',patterns:[{name:"constant.character.escape.cpp",match:"\\\\."}]},{name:"string.quoted.single.cpp",begin:"'",end:"'",patterns:[{name:"constant.character.escape.cpp",match:"\\\\."}]}]},keywords:{patterns:[{name:"keyword.control.cpp",match:"\\b(if|else|for|while|do|switch|case|default|break|continue|return|goto|try|catch|throw|co_await|co_return|co_yield)\\b"},{name:"storage.type.cpp",match:"\\b(void|bool|char|short|int|long|float|double|signed|unsigned|struct|union|enum|class|typedef|typename|auto|decltype)\\b"},{name:"storage.modifier.cpp",match:"\\b(const|static|extern|register|volatile|inline|virtual|explicit|friend|mutable|constexpr|consteval|constinit)\\b"},{name:"storage.modifier.access.cpp",match:"\\b(public|private|protected)\\b"},{name:"constant.language.cpp",match:"\\b(true|false|nullptr)\\b"},{name:"keyword.other.cpp",match:"\\b(namespace|using|template|operator|concept|requires)\\b"}]},numbers:{patterns:[{name:"constant.numeric.cpp",match:"\\b(?:0[xX][0-9a-fA-F]+[uUlL]*|0[bB][01]+[uUlL]*|0[0-7]+[uUlL]*|\\d+\\.?\\d*(?:[eE][+-]?\\d+)?[fFlL]?)\\b"}]},functions:{patterns:[{name:"entity.name.function.cpp",match:"\\b([a-zA-Z_][a-zA-Z0-9_]*)\\s*(?=\\()"}]},operators:{patterns:[{name:"keyword.operator.cpp",match:"(\\+\\+|--|\\+|\\-|\\*|/|%|==|!=|<=|>=|<|>|&&|\\|\\||!|&|\\||\\^|~|<<|>>|\\?|:|=|\\+=|-=|\\*=|/=|%=|&=|\\|=|\\^=|<<=|>>=|->|\\.|::)"}]}}},ia={name:"C#",scopeName:"source.cs",keywords:{if:"keyword.control.cs",else:"keyword.control.cs",for:"keyword.control.cs",foreach:"keyword.control.cs",while:"keyword.control.cs",do:"keyword.control.cs",switch:"keyword.control.cs",case:"keyword.control.cs",default:"keyword.control.cs",break:"keyword.control.cs",continue:"keyword.control.cs",return:"keyword.control.cs",goto:"keyword.control.cs",try:"keyword.control.cs",catch:"keyword.control.cs",finally:"keyword.control.cs",throw:"keyword.control.cs",yield:"keyword.control.cs",await:"keyword.control.cs",class:"keyword.other.class.cs",struct:"keyword.other.struct.cs",interface:"keyword.other.interface.cs",enum:"keyword.other.enum.cs",delegate:"keyword.other.delegate.cs",record:"keyword.other.record.cs",void:"keyword.type.cs",bool:"keyword.type.cs",byte:"keyword.type.cs",sbyte:"keyword.type.cs",char:"keyword.type.cs",decimal:"keyword.type.cs",double:"keyword.type.cs",float:"keyword.type.cs",int:"keyword.type.cs",uint:"keyword.type.cs",long:"keyword.type.cs",ulong:"keyword.type.cs",short:"keyword.type.cs",ushort:"keyword.type.cs",object:"keyword.type.cs",string:"keyword.type.cs",var:"keyword.type.cs",dynamic:"keyword.type.cs",public:"storage.modifier.cs",private:"storage.modifier.cs",protected:"storage.modifier.cs",internal:"storage.modifier.cs",static:"storage.modifier.cs",readonly:"storage.modifier.cs",const:"storage.modifier.cs",virtual:"storage.modifier.cs",override:"storage.modifier.cs",abstract:"storage.modifier.cs",sealed:"storage.modifier.cs",partial:"storage.modifier.cs",async:"storage.modifier.cs",extern:"storage.modifier.cs",volatile:"storage.modifier.cs",namespace:"keyword.other.namespace.cs",using:"keyword.other.using.cs",new:"keyword.operator.new.cs",this:"variable.language.cs",base:"variable.language.cs",true:"constant.language.cs",false:"constant.language.cs",null:"constant.language.cs",typeof:"keyword.operator.cs",sizeof:"keyword.operator.cs",is:"keyword.operator.cs",as:"keyword.operator.cs",in:"keyword.operator.cs",out:"keyword.operator.cs",ref:"keyword.operator.cs",params:"keyword.other.cs",operator:"keyword.other.cs",implicit:"keyword.other.cs",explicit:"keyword.other.cs",get:"keyword.other.cs",set:"keyword.other.cs",value:"keyword.other.cs",add:"keyword.other.cs",remove:"keyword.other.cs",event:"keyword.other.cs",lock:"keyword.control.cs",checked:"keyword.control.cs",unchecked:"keyword.control.cs",unsafe:"keyword.other.cs",fixed:"keyword.other.cs",stackalloc:"keyword.operator.cs",nameof:"keyword.operator.cs",when:"keyword.control.cs"},patterns:[{include:"#comments"},{include:"#strings"},{include:"#attributes"},{include:"#keywords"},{include:"#numbers"},{include:"#functions"},{include:"#operators"}],repository:{comments:{patterns:[{name:"comment.line.double-slash.cs",match:"\\/\\/.*$"},{name:"comment.block.documentation.cs",begin:"\\/\\/\\/",end:"$"},{name:"comment.block.cs",begin:"\\/\\*",end:"\\*\\/"}]},strings:{patterns:[{name:"string.quoted.verbatim.cs",begin:'@"',end:'"',patterns:[{name:"constant.character.escape.cs",match:'""'}]},{name:"string.quoted.interpolated.cs",begin:'\\$"',end:'"',patterns:[{name:"meta.interpolation.cs",begin:"\\{",end:"\\}",patterns:[{include:"$self"}]},{name:"constant.character.escape.cs",match:"\\\\."}]},{name:"string.quoted.double.cs",begin:'"',end:'"',patterns:[{name:"constant.character.escape.cs",match:"\\\\."}]},{name:"string.quoted.single.cs",begin:"'",end:"'",patterns:[{name:"constant.character.escape.cs",match:"\\\\."}]}]},attributes:{patterns:[{name:"meta.attribute.cs",begin:"\\[",end:"\\]",patterns:[{name:"entity.name.type.attribute.cs",match:"[A-Z][a-zA-Z0-9]*"}]}]},keywords:{patterns:[{name:"keyword.control.cs",match:"\\b(if|else|for|foreach|while|do|switch|case|default|break|continue|return|goto|try|catch|finally|throw|yield|await|lock|checked|unchecked|when)\\b"},{name:"keyword.other.cs",match:"\\b(class|struct|interface|enum|delegate|record|namespace|using|operator|implicit|explicit|get|set|value|add|remove|event|params|unsafe|fixed)\\b"},{name:"keyword.type.cs",match:"\\b(void|bool|byte|sbyte|char|decimal|double|float|int|uint|long|ulong|short|ushort|object|string|var|dynamic)\\b"},{name:"storage.modifier.cs",match:"\\b(public|private|protected|internal|static|readonly|const|virtual|override|abstract|sealed|partial|async|extern|volatile)\\b"},{name:"constant.language.cs",match:"\\b(true|false|null)\\b"},{name:"variable.language.cs",match:"\\b(this|base)\\b"},{name:"keyword.operator.cs",match:"\\b(new|typeof|sizeof|is|as|in|out|ref|stackalloc|nameof)\\b"}]},numbers:{patterns:[{name:"constant.numeric.cs",match:"\\b(?:0[xX][0-9a-fA-F_]+|0[bB][01_]+|\\d+[._]?\\d*(?:[eE][+-]?\\d+)?)[fFdDmMlLuU]*\\b"}]},functions:{patterns:[{name:"entity.name.function.cs",match:"\\b([a-zA-Z_][a-zA-Z0-9_]*)\\s*(?=\\()"}]},operators:{patterns:[{name:"keyword.operator.cs",match:"(\\+\\+|--|\\+|\\-|\\*|/|%|==|!=|<=|>=|<|>|&&|\\|\\||!|&|\\||\\^|~|<<|>>|\\?\\?|\\?|:|=|\\+=|-=|\\*=|/=|%=|&=|\\|=|\\^=|<<=|>>=|=>|\\.|->)"}]}}},ca={name:"CSS",scopeName:"source.css",patterns:[{include:"#comments"},{include:"#at-rules"},{include:"#selectors"},{include:"#properties"},{include:"#functions"},{include:"#variables"},{include:"#values"},{include:"#strings"},{include:"#numbers"},{include:"#colors"},{include:"#punctuation"}],repository:{comments:{patterns:[{name:"comment.block.css",begin:"\\/\\*",end:"\\*\\/"}]},"at-rules":{patterns:[{name:"keyword.control.at-rule.css",match:"@(media|import|charset|namespace|keyframes|font-face|supports|page|document|viewport|counter-style|font-feature-values|property|layer|container)\\b"}]},selectors:{patterns:[{name:"entity.name.tag.css",match:"\\b(a|abbr|address|article|aside|audio|b|blockquote|body|button|canvas|caption|cite|code|div|em|embed|fieldset|figcaption|figure|footer|form|h1|h2|h3|h4|h5|h6|header|html|i|iframe|img|input|label|legend|li|main|nav|ol|p|pre|section|select|span|strong|table|tbody|td|textarea|tfoot|th|thead|tr|ul|video)\\b"},{name:"entity.other.attribute-name.class.css",match:"\\.[a-zA-Z_-][a-zA-Z0-9_-]*"},{name:"entity.other.attribute-name.id.css",match:"#[a-zA-Z_-][a-zA-Z0-9_-]*"},{name:"entity.other.attribute-name.pseudo-class.css",match:":[a-zA-Z_-][a-zA-Z0-9_-]*"},{name:"entity.other.attribute-name.pseudo-element.css",match:"::[a-zA-Z_-][a-zA-Z0-9_-]*"}]},properties:{patterns:[{name:"support.type.property-name.css",match:"\\b(align-items|background|border|color|display|flex|font|height|justify-content|margin|padding|position|width|z-index|animation|box-shadow|cursor|font-family|font-size|font-weight|grid|line-height|opacity|overflow|text-align|text-decoration|transform|transition|visibility)(-[a-z]+)?\\b"}]},values:{patterns:[{name:"support.constant.property-value.css",match:"\\b(auto|block|inline|flex|grid|none|center|left|right|top|bottom|absolute|relative|fixed|sticky|hidden|visible|bold|normal|italic|underline|solid|dotted|dashed)\\b"}]},strings:{patterns:[{name:"string.quoted.double.css",begin:'"',end:'"'},{name:"string.quoted.single.css",begin:"'",end:"'"}]},numbers:{patterns:[{name:"constant.numeric.css",match:"\\b\\d+(\\.\\d+)?(px|em|rem|%|vh|vw|vmin|vmax|ch|ex|cm|mm|in|pt|pc|deg|rad|turn|s|ms)?\\b"}]},colors:{patterns:[{name:"constant.other.color.css",match:"#[0-9a-fA-F]{3,8}\\b"},{name:"support.function.color.css",match:"\\b(rgb|rgba|hsl|hsla|hwb|lab|lch|oklab|oklch|color)\\s*\\("}]},functions:{patterns:[{name:"support.function.css",match:"\\b(var|calc|min|max|clamp|round|abs|sign|mod|rem|sin|cos|tan|asin|acos|atan|atan2|pow|sqrt|hypot|log|exp|url|attr|counter|counters|linear-gradient|radial-gradient|conic-gradient|repeating-linear-gradient|repeating-radial-gradient|repeating-conic-gradient)\\s*\\("}]},variables:{patterns:[{name:"variable.other.custom-property.css",match:"--[a-zA-Z0-9_-]+"}]},punctuation:{patterns:[{name:"punctuation.css",match:"[{}();:,]"}]}}},da={name:"CSV",scopeName:"text.csv",keywords:{},patterns:[{include:"#quoted"}],repository:{quoted:{patterns:[{name:"string.quoted.double.csv",begin:'"',end:'"',patterns:[{name:"constant.character.escape.csv",match:'""'}]}]}}},la={name:"Dart",scopeName:"source.dart",keywords:{import:"keyword.other.dart",library:"keyword.other.dart",part:"keyword.other.dart",class:"keyword.other.dart",enum:"keyword.other.dart",extends:"keyword.other.dart",implements:"keyword.other.dart",with:"keyword.other.dart",mixin:"keyword.other.dart",if:"keyword.control.dart",else:"keyword.control.dart",for:"keyword.control.dart",while:"keyword.control.dart",do:"keyword.control.dart",switch:"keyword.control.dart",case:"keyword.control.dart",default:"keyword.control.dart",break:"keyword.control.dart",continue:"keyword.control.dart",return:"keyword.control.dart",try:"keyword.control.dart",catch:"keyword.control.dart",finally:"keyword.control.dart",throw:"keyword.control.dart",var:"storage.type.dart",final:"storage.type.dart",const:"storage.type.dart",late:"storage.modifier.dart",static:"storage.modifier.dart",async:"storage.modifier.dart",await:"keyword.control.dart",true:"constant.language.dart",false:"constant.language.dart",null:"constant.language.dart",this:"variable.language.dart",super:"variable.language.dart"},patterns:[{include:"#comments"},{include:"#strings"},{include:"#keywords"},{include:"#numbers"}],repository:{comments:{patterns:[{name:"comment.line.double-slash.dart",match:"\\/\\/.*$"},{name:"comment.block.dart",begin:"\\/\\*",end:"\\*\\/"}]},strings:{patterns:[{name:"string.quoted.triple.dart",begin:'"""',end:'"""'},{name:"string.quoted.double.dart",begin:'"',end:'"',patterns:[{name:"constant.character.escape.dart",match:"\\\\."},{name:"variable.other.dart",match:"\\$[a-zA-Z_][a-zA-Z0-9_]*"},{name:"meta.embedded.line.dart",begin:"\\$\\{",end:"\\}"}]},{name:"string.quoted.single.dart",begin:"'",end:"'"}]},keywords:{patterns:[{name:"keyword.control.dart",match:"\\b(if|else|for|while|do|switch|case|default|break|continue|return|try|catch|finally|throw|await)\\b"},{name:"keyword.other.dart",match:"\\b(import|library|part|class|enum|extends|implements|with|mixin)\\b"},{name:"storage.type.dart",match:"\\b(var|final|const)\\b"},{name:"constant.language.dart",match:"\\b(true|false|null)\\b"}]},numbers:{patterns:[{name:"constant.numeric.dart",match:"\\b\\d+\\.?\\d*\\b"}]}}},ma={name:"Diff",scopeName:"source.diff",keywords:{},patterns:[{include:"#file-header"},{include:"#hunk-header"},{include:"#added-line"},{include:"#removed-line"},{include:"#context-line"},{include:"#metadata"}],repository:{"file-header":{patterns:[{name:"meta.diff.header.from-file",match:"^(---\\s+)(.*)$",captures:{1:{name:"punctuation.definition.from-file.diff"},2:{name:"meta.diff.header.from-path"}}},{name:"meta.diff.header.to-file",match:"^(\\+\\+\\+\\s+)(.*)$",captures:{1:{name:"punctuation.definition.to-file.diff"},2:{name:"meta.diff.header.to-path"}}},{name:"meta.diff.header.git",match:"^diff --git.*$"}]},"hunk-header":{patterns:[{name:"meta.diff.range.unified",match:"^(@@)\\s+(-\\d+,\\d+\\s+\\+\\d+,\\d+)\\s+(@@)(.*)$",captures:{1:{name:"punctuation.definition.range.diff"},2:{name:"meta.diff.range.context"},3:{name:"punctuation.definition.range.diff"},4:{name:"entity.name.function.diff"}}}]},"added-line":{patterns:[{name:"markup.inserted.diff",match:"^\\+.*$"}]},"removed-line":{patterns:[{name:"markup.deleted.diff",match:"^-.*$"}]},"context-line":{patterns:[{name:"meta.diff.context",match:"^ .*$"}]},metadata:{patterns:[{name:"meta.diff.index",match:"^index [0-9a-f]+\\.\\.[0-9a-f]+.*$"},{name:"meta.diff.mode",match:"^(new|deleted) file mode \\d+$"}]}}},pa={name:"Dockerfile",scopeName:"source.dockerfile",keywords:{FROM:"keyword.control.dockerfile",RUN:"keyword.control.dockerfile",CMD:"keyword.control.dockerfile",LABEL:"keyword.control.dockerfile",EXPOSE:"keyword.control.dockerfile",ENV:"keyword.control.dockerfile",ADD:"keyword.control.dockerfile",COPY:"keyword.control.dockerfile",ENTRYPOINT:"keyword.control.dockerfile",VOLUME:"keyword.control.dockerfile",USER:"keyword.control.dockerfile",WORKDIR:"keyword.control.dockerfile",ARG:"keyword.control.dockerfile",ONBUILD:"keyword.control.dockerfile",STOPSIGNAL:"keyword.control.dockerfile",HEALTHCHECK:"keyword.control.dockerfile",SHELL:"keyword.control.dockerfile",MAINTAINER:"keyword.control.dockerfile",AS:"keyword.other.dockerfile"},patterns:[{include:"#comments"},{include:"#instructions"},{include:"#strings"},{include:"#variables"}],repository:{comments:{patterns:[{name:"comment.line.number-sign.dockerfile",match:"#.*$"}]},instructions:{patterns:[{name:"keyword.control.dockerfile",match:"^\\s*(FROM|RUN|CMD|LABEL|EXPOSE|ENV|ADD|COPY|ENTRYPOINT|VOLUME|USER|WORKDIR|ARG|ONBUILD|STOPSIGNAL|HEALTHCHECK|SHELL|MAINTAINER)\\b"},{name:"keyword.other.dockerfile",match:"\\b(AS)\\b"}]},strings:{patterns:[{name:"string.quoted.double.dockerfile",begin:'"',end:'"',patterns:[{name:"constant.character.escape.dockerfile",match:"\\\\."}]},{name:"string.quoted.single.dockerfile",begin:"'",end:"'",patterns:[{name:"constant.character.escape.dockerfile",match:"\\\\."}]}]},variables:{patterns:[{name:"variable.other.dockerfile",match:"\\$\\{?[a-zA-Z_][a-zA-Z0-9_]*\\}?"}]}}},ua={name:"Go",scopeName:"source.go",keywords:{break:"keyword.control.go",case:"keyword.control.go",chan:"keyword.control.go",const:"keyword.control.go",continue:"keyword.control.go",default:"keyword.control.go",defer:"keyword.control.go",else:"keyword.control.go",fallthrough:"keyword.control.go",for:"keyword.control.go",func:"keyword.control.go",go:"keyword.control.go",goto:"keyword.control.go",if:"keyword.control.go",import:"keyword.control.go",interface:"keyword.control.go",map:"keyword.control.go",package:"keyword.control.go",range:"keyword.control.go",return:"keyword.control.go",select:"keyword.control.go",struct:"keyword.control.go",switch:"keyword.control.go",type:"keyword.control.go",var:"keyword.control.go",bool:"storage.type.go",byte:"storage.type.go",complex64:"storage.type.go",complex128:"storage.type.go",error:"storage.type.go",float32:"storage.type.go",float64:"storage.type.go",int:"storage.type.go",int8:"storage.type.go",int16:"storage.type.go",int32:"storage.type.go",int64:"storage.type.go",rune:"storage.type.go",string:"storage.type.go",uint:"storage.type.go",uint8:"storage.type.go",uint16:"storage.type.go",uint32:"storage.type.go",uint64:"storage.type.go",uintptr:"storage.type.go",true:"constant.language.go",false:"constant.language.go",nil:"constant.language.go",iota:"constant.language.go",append:"support.function.builtin.go",cap:"support.function.builtin.go",close:"support.function.builtin.go",complex:"support.function.builtin.go",copy:"support.function.builtin.go",delete:"support.function.builtin.go",imag:"support.function.builtin.go",len:"support.function.builtin.go",make:"support.function.builtin.go",new:"support.function.builtin.go",panic:"support.function.builtin.go",print:"support.function.builtin.go",println:"support.function.builtin.go",real:"support.function.builtin.go",recover:"support.function.builtin.go"},patterns:[{include:"#comments"},{include:"#strings"},{include:"#keywords"},{include:"#numbers"},{include:"#functions"},{include:"#operators"}],repository:{comments:{patterns:[{name:"comment.line.double-slash.go",match:"\\/\\/.*$"},{name:"comment.block.go",begin:"\\/\\*",end:"\\*\\/"}]},strings:{patterns:[{name:"string.quoted.raw.go",begin:"`",end:"`"},{name:"string.quoted.double.go",begin:'"',end:'"',patterns:[{name:"constant.character.escape.go",match:"\\\\."}]},{name:"string.quoted.single.go",begin:"'",end:"'",patterns:[{name:"constant.character.escape.go",match:"\\\\."}]}]},keywords:{patterns:[{name:"keyword.control.go",match:"\\b(break|case|chan|const|continue|default|defer|else|fallthrough|for|func|go|goto|if|import|interface|map|package|range|return|select|struct|switch|type|var)\\b"},{name:"storage.type.go",match:"\\b(bool|byte|complex64|complex128|error|float32|float64|int|int8|int16|int32|int64|rune|string|uint|uint8|uint16|uint32|uint64|uintptr)\\b"},{name:"constant.language.go",match:"\\b(true|false|nil|iota)\\b"},{name:"support.function.builtin.go",match:"\\b(append|cap|close|complex|copy|delete|imag|len|make|new|panic|print|println|real|recover)\\b"}]},numbers:{patterns:[{name:"constant.numeric.go",match:"\\b(?:0[xX][0-9a-fA-F]+|0[oO][0-7]+|0[bB][01]+|\\d+\\.?\\d*(?:[eE][+-]?\\d+)?)[i]?\\b"}]},functions:{patterns:[{name:"entity.name.function.go",match:"\\b([a-zA-Z_][a-zA-Z0-9_]*)\\s*(?=\\()"}]},operators:{patterns:[{name:"keyword.operator.go",match:"(\\+\\+|--|\\+|\\-|\\*|/|%|==|!=|<=|>=|<-|<|>|&&|\\|\\||!|&|\\||\\^|&\\^|<<|>>|:=|=|\\+=|-=|\\*=|/=|%=|&=|\\|=|\\^=|&\\^=|<<=|>>=|\\.\\.\\.)"}]}}},ya={name:"GraphQL",scopeName:"source.graphql",keywords:{query:"keyword.operation.graphql",mutation:"keyword.operation.graphql",subscription:"keyword.operation.graphql",fragment:"keyword.operation.graphql",type:"keyword.type.graphql",interface:"keyword.type.graphql",union:"keyword.type.graphql",enum:"keyword.type.graphql",input:"keyword.type.graphql",scalar:"keyword.type.graphql",schema:"keyword.type.graphql",extend:"keyword.type.graphql",implements:"keyword.type.graphql",on:"keyword.other.graphql",true:"constant.language.graphql",false:"constant.language.graphql",null:"constant.language.graphql"},patterns:[{include:"#comments"},{include:"#strings"},{include:"#keywords"},{include:"#directives"}],repository:{comments:{patterns:[{name:"comment.line.number-sign.graphql",match:"#.*$"}]},strings:{patterns:[{name:"string.quoted.triple.graphql",begin:'"""',end:'"""'},{name:"string.quoted.double.graphql",begin:'"',end:'"',patterns:[{name:"constant.character.escape.graphql",match:"\\\\."}]}]},keywords:{patterns:[{name:"keyword.operation.graphql",match:"\\b(query|mutation|subscription|fragment)\\b"},{name:"keyword.type.graphql",match:"\\b(type|interface|union|enum|input|scalar|schema|extend|implements)\\b"},{name:"constant.language.graphql",match:"\\b(true|false|null)\\b"}]},directives:{patterns:[{name:"entity.name.function.directive.graphql",match:"@[a-zA-Z_][a-zA-Z0-9_]*"}]}}},ha={name:"HTML",scopeName:"text.html.basic",patterns:[{include:"#doctype"},{include:"#comments"},{include:"#tags"},{include:"#entities"}],repository:{doctype:{patterns:[{name:"meta.tag.sgml.doctype.html",match:"<!DOCTYPE[^>]*>"}]},comments:{patterns:[{name:"comment.block.html",begin:"<!--",end:"-->"}]},tags:{patterns:[{name:"meta.tag.html",begin:"(<)(script|style|template)\\b",beginCaptures:{1:{name:"punctuation.definition.tag.begin.html"},2:{name:"entity.name.tag.html"}},end:"(</)(\\2)(>)",endCaptures:{1:{name:"punctuation.definition.tag.begin.html"},2:{name:"entity.name.tag.html"},3:{name:"punctuation.definition.tag.end.html"}},patterns:[{include:"#tag-stuff"}]},{name:"meta.tag.html",begin:"(<)([a-zA-Z0-9:-]+)",beginCaptures:{1:{name:"punctuation.definition.tag.begin.html"},2:{name:"entity.name.tag.html"}},end:"(/>)|(>)",endCaptures:{1:{name:"punctuation.definition.tag.end.html"},2:{name:"punctuation.definition.tag.end.html"}},patterns:[{include:"#tag-stuff"}]},{name:"meta.tag.html",begin:"(</)([a-zA-Z0-9:-]+)",beginCaptures:{1:{name:"punctuation.definition.tag.begin.html"},2:{name:"entity.name.tag.html"}},end:"(>)",endCaptures:{1:{name:"punctuation.definition.tag.end.html"}}}]},"tag-stuff":{patterns:[{name:"entity.other.attribute-name.html",match:"\\b(data-[a-zA-Z0-9-]+|aria-[a-zA-Z0-9-]+|on[a-z]+|[a-zA-Z-:]+)"},{name:"string.quoted.double.html",begin:'"',end:'"'},{name:"string.quoted.single.html",begin:"'",end:"'"}]},entities:{patterns:[{name:"constant.character.entity.html",match:"&[a-zA-Z0-9]+;"},{name:"constant.character.entity.html",match:"&#[0-9]+;"}]}}},wa={name:"IDL",scopeName:"source.idl",keywords:{interface:"keyword.other.idl",module:"keyword.other.idl",struct:"keyword.other.idl",union:"keyword.other.idl",enum:"keyword.other.idl",typedef:"keyword.other.idl",exception:"keyword.other.idl",readonly:"storage.modifier.idl",attribute:"storage.modifier.idl",const:"storage.modifier.idl",in:"keyword.other.idl",out:"keyword.other.idl",inout:"keyword.other.idl",void:"storage.type.idl",boolean:"storage.type.idl",byte:"storage.type.idl",short:"storage.type.idl",long:"storage.type.idl",float:"storage.type.idl",double:"storage.type.idl",char:"storage.type.idl",string:"storage.type.idl",TRUE:"constant.language.idl",FALSE:"constant.language.idl"},patterns:[{include:"#comments"},{include:"#strings"},{include:"#keywords"},{include:"#numbers"}],repository:{comments:{patterns:[{name:"comment.line.double-slash.idl",match:"\\/\\/.*$"},{name:"comment.block.idl",begin:"\\/\\*",end:"\\*\\/"}]},strings:{patterns:[{name:"string.quoted.double.idl",begin:'"',end:'"',patterns:[{name:"constant.character.escape.idl",match:"\\\\."}]}]},keywords:{patterns:[{name:"keyword.other.idl",match:"\\b(interface|module|struct|union|enum|typedef|exception|in|out|inout)\\b"},{name:"storage.modifier.idl",match:"\\b(readonly|attribute|const)\\b"},{name:"storage.type.idl",match:"\\b(void|boolean|byte|short|long|float|double|char|string)\\b"},{name:"constant.language.idl",match:"\\b(TRUE|FALSE)\\b"}]},numbers:{patterns:[{name:"constant.numeric.idl",match:"\\b\\d+\\.?\\d*(?:[eE][+-]?\\d+)?\\b"}]}}},fa={name:"Java",scopeName:"source.java",keywords:{if:"keyword.control.java",else:"keyword.control.java",for:"keyword.control.java",while:"keyword.control.java",do:"keyword.control.java",switch:"keyword.control.java",case:"keyword.control.java",default:"keyword.control.java",break:"keyword.control.java",continue:"keyword.control.java",return:"keyword.control.java",try:"keyword.control.java",catch:"keyword.control.java",finally:"keyword.control.java",throw:"keyword.control.java",throws:"keyword.control.java",assert:"keyword.control.java",class:"storage.type.java",interface:"storage.type.java",enum:"storage.type.java",record:"storage.type.java",void:"storage.type.java",boolean:"storage.type.primitive.java",byte:"storage.type.primitive.java",char:"storage.type.primitive.java",short:"storage.type.primitive.java",int:"storage.type.primitive.java",long:"storage.type.primitive.java",float:"storage.type.primitive.java",double:"storage.type.primitive.java",public:"storage.modifier.java",private:"storage.modifier.java",protected:"storage.modifier.java",static:"storage.modifier.java",final:"storage.modifier.java",abstract:"storage.modifier.java",native:"storage.modifier.java",synchronized:"storage.modifier.java",transient:"storage.modifier.java",volatile:"storage.modifier.java",strictfp:"storage.modifier.java",sealed:"storage.modifier.java","non-sealed":"storage.modifier.java",true:"constant.language.java",false:"constant.language.java",null:"constant.language.java",this:"variable.language.java",super:"variable.language.java",package:"keyword.other.package.java",import:"keyword.other.import.java",extends:"keyword.other.extends.java",implements:"keyword.other.implements.java",new:"keyword.operator.new.java",instanceof:"keyword.operator.instanceof.java",var:"storage.type.java"},patterns:[{include:"#comments"},{include:"#annotations"},{include:"#strings"},{include:"#keywords"},{include:"#numbers"},{include:"#functions"},{include:"#operators"}],repository:{comments:{patterns:[{name:"comment.line.double-slash.java",match:"\\/\\/.*$"},{name:"comment.block.documentation.java",begin:"\\/\\*\\*",end:"\\*\\/",patterns:[{name:"keyword.other.documentation.java",match:"@(?:param|return|throws|author|version|see|since|deprecated)\\b"}]},{name:"comment.block.java",begin:"\\/\\*",end:"\\*\\/"}]},annotations:{patterns:[{name:"storage.type.annotation.java",match:"@[A-Z][a-zA-Z0-9]*"}]},strings:{patterns:[{name:"string.quoted.triple.java",begin:'"""',end:'"""',patterns:[{name:"constant.character.escape.java",match:"\\\\."}]},{name:"string.quoted.double.java",begin:'"',end:'"',patterns:[{name:"constant.character.escape.java",match:"\\\\."}]},{name:"string.quoted.single.java",begin:"'",end:"'",patterns:[{name:"constant.character.escape.java",match:"\\\\."}]}]},keywords:{patterns:[{name:"keyword.control.java",match:"\\b(if|else|for|while|do|switch|case|default|break|continue|return|try|catch|finally|throw|throws|assert)\\b"},{name:"storage.type.java",match:"\\b(class|interface|enum|record|void|var)\\b"},{name:"storage.type.primitive.java",match:"\\b(boolean|byte|char|short|int|long|float|double)\\b"},{name:"storage.modifier.java",match:"\\b(public|private|protected|static|final|abstract|native|synchronized|transient|volatile|strictfp|sealed|non-sealed)\\b"},{name:"constant.language.java",match:"\\b(true|false|null)\\b"},{name:"keyword.other.java",match:"\\b(package|import|extends|implements|new|instanceof)\\b"}]},numbers:{patterns:[{name:"constant.numeric.java",match:"\\b(?:0[xX][0-9a-fA-F_]+[lL]?|0[bB][01_]+[lL]?|0[0-7_]+[lL]?|\\d+[._]?\\d*(?:[eE][+-]?\\d+)?[fFdDlL]?)\\b"}]},functions:{patterns:[{name:"entity.name.function.java",match:"\\b([a-zA-Z_$][a-zA-Z0-9_$]*)\\s*(?=\\()"}]},operators:{patterns:[{name:"keyword.operator.java",match:"(\\+\\+|--|\\+|\\-|\\*|/|%|==|!=|<=|>=|<|>|&&|\\|\\||!|\\?|:|=|\\+=|-=|\\*=|/=|%=|&=|\\|=|\\^=|<<=|>>=|>>>=|&|\\||\\^|~|<<|>>|>>>)"}]}}},ba={name:"JavaScript",scopeName:"source.js",keywords:{if:"keyword.control.js",else:"keyword.control.js",switch:"keyword.control.js",case:"keyword.control.js",default:"keyword.control.js",for:"keyword.control.js",while:"keyword.control.js",do:"keyword.control.js",break:"keyword.control.js",continue:"keyword.control.js",return:"keyword.control.js",try:"keyword.control.js",catch:"keyword.control.js",finally:"keyword.control.js",throw:"keyword.control.js",async:"keyword.control.js",await:"keyword.control.js",yield:"keyword.control.js",const:"storage.type.js",let:"storage.type.js",var:"storage.type.js",function:"storage.type.js",class:"storage.type.js",extends:"storage.type.js",static:"storage.type.js",get:"storage.type.js",set:"storage.type.js",new:"keyword.operator.new.js",delete:"keyword.operator.new.js",typeof:"keyword.operator.new.js",instanceof:"keyword.operator.new.js",void:"keyword.operator.new.js",in:"keyword.operator.new.js",of:"keyword.operator.new.js",true:"constant.language.js",false:"constant.language.js",null:"constant.language.js",undefined:"constant.language.js",NaN:"constant.language.js",Infinity:"constant.language.js",this:"constant.language.js",super:"constant.language.js",arguments:"constant.language.js",import:"keyword.other.js",export:"keyword.other.js",from:"keyword.other.js",as:"keyword.other.js",with:"keyword.other.js",debugger:"keyword.other.js"},patterns:[{include:"#comments"},{include:"#strings"},{include:"#jsx"},{include:"#regex"},{include:"#keywords"},{include:"#numbers"},{include:"#functions"},{include:"#operators"},{include:"#punctuation"}],repository:{comments:{patterns:[{name:"comment.line.double-slash.js",match:"\\/\\/.*$"},{name:"comment.block.js",begin:"\\/\\*",end:"\\*\\/"}]},strings:{patterns:[{name:"string.quoted.double.js",begin:'"',end:'"',patterns:[{name:"constant.character.escape.js",match:"\\\\."}]},{name:"string.quoted.single.js",begin:"'",end:"'",patterns:[{name:"constant.character.escape.js",match:"\\\\."}]},{name:"string.template.js",begin:"`",end:"`",patterns:[{name:"meta.template.expression.js",begin:"\\$\\{",end:"\\}",patterns:[{include:"$self"}]},{name:"constant.character.escape.js",match:"\\\\."}]}]},jsx:{patterns:[{name:"meta.tag.jsx",begin:"<([A-Z][a-zA-Z0-9]*|[a-z][a-zA-Z0-9-]*)",beginCaptures:{0:{name:"punctuation.definition.tag.begin.jsx"},1:{name:"entity.name.tag.jsx"}},end:"(/?>)",endCaptures:{1:{name:"punctuation.definition.tag.end.jsx"}},patterns:[{name:"entity.other.attribute-name.jsx",match:"[a-zA-Z_:][a-zA-Z0-9_:.-]*"},{name:"meta.embedded.expression.jsx",begin:"\\{",end:"\\}",patterns:[{include:"$self"}]},{name:"string.quoted.double.jsx",begin:'"',end:'"'},{name:"string.quoted.single.jsx",begin:"'",end:"'"}]},{name:"meta.tag.jsx",begin:"(</)([A-Z][a-zA-Z0-9]*|[a-z][a-zA-Z0-9-]*)",beginCaptures:{1:{name:"punctuation.definition.tag.begin.jsx"},2:{name:"entity.name.tag.jsx"}},end:"(>)",endCaptures:{1:{name:"punctuation.definition.tag.end.jsx"}}}]},regex:{patterns:[{name:"string.regexp.js",begin:"(?<=[=(,\\[!&|?{};:])\\s*(\\/)",beginCaptures:{1:{name:"punctuation.definition.string.begin.js"}},end:"(\\/)[gimsuvy]*",endCaptures:{1:{name:"punctuation.definition.string.end.js"}},patterns:[{name:"constant.character.escape.js",match:"\\\\."}]}]},numbers:{patterns:[{name:"constant.numeric.js",match:"\\b(0[xX][0-9a-fA-F_]+|0[bB][01_]+|0[oO][0-7_]+|\\d+(_\\d+)*(\\.\\d+(_\\d+)?)?([eE][+-]?\\d+)?)[nN]?\\b"}]},keywords:{patterns:[{name:"keyword.control.js",match:"\\b(if|else|switch|case|default|for|while|do|break|continue|return|try|catch|finally|throw|async|await|yield)\\b"},{name:"storage.type.js",match:"\\b(const|let|var|function|class|extends|static|async|get|set)\\b"},{name:"keyword.operator.new.js",match:"\\b(new|delete|typeof|instanceof|void|in|of)\\b"},{name:"constant.language.js",match:"\\b(true|false|null|undefined|NaN|Infinity|this|super|arguments)\\b"},{name:"keyword.other.js",match:"\\b(import|export|from|as|default|with|debugger)\\b"}]},functions:{patterns:[{name:"entity.name.function.js",match:"\\b([a-zA-Z_$][a-zA-Z0-9_$]*)\\s*(?=\\()"}]},operators:{patterns:[{name:"keyword.operator.js",match:"(\\+\\+|--|\\+|\\-|\\*|\\/|%|===|==|!==|!=|<=|>=|<|>|&&|\\|\\||!|\\?|:|=>|\\.\\.\\.|&|\\||\\^|~|<<|>>|>>>)"}]},punctuation:{patterns:[{name:"punctuation.js",match:"[{}()\\[\\];,.]"}]}}},ka={name:"JSON",scopeName:"source.json",patterns:[{include:"#value"}],repository:{value:{patterns:[{include:"#constant"},{include:"#number"},{include:"#string"},{include:"#array"},{include:"#object"}]},constant:{patterns:[{name:"constant.language.json",match:"\\b(true|false|null)\\b"}]},number:{patterns:[{name:"constant.numeric.json",match:"-?(0|[1-9]\\d*)(\\.\\d+)?([eE][+-]?\\d+)?"}]},string:{patterns:[{name:"string.quoted.double.json",begin:'"',end:'"',patterns:[{name:"constant.character.escape.json",match:'\\\\(["\\\\/bfnrt]|u[0-9a-fA-F]{4})'},{name:"invalid.illegal.unrecognized-string-escape.json",match:"\\\\."}]}]},array:{patterns:[{name:"meta.structure.array.json",begin:"\\[",beginCaptures:{0:{name:"punctuation.definition.array.begin.json"}},end:"\\]",endCaptures:{0:{name:"punctuation.definition.array.end.json"}},patterns:[{include:"#value"},{name:"punctuation.separator.array.json",match:","}]}]},object:{patterns:[{name:"meta.structure.dictionary.json",begin:"\\{",beginCaptures:{0:{name:"punctuation.definition.dictionary.begin.json"}},end:"\\}",endCaptures:{0:{name:"punctuation.definition.dictionary.end.json"}},patterns:[{name:"meta.structure.dictionary.key.json",begin:'"',beginCaptures:{0:{name:"punctuation.support.type.property-name.begin.json"}},end:'"',endCaptures:{0:{name:"punctuation.support.type.property-name.end.json"}},patterns:[{name:"constant.character.escape.json",match:'\\\\(["\\\\/bfnrt]|u[0-9a-fA-F]{4})'}]},{name:"punctuation.separator.dictionary.key-value.json",match:":"},{name:"punctuation.separator.dictionary.pair.json",match:","},{include:"#value"}]}]}}},ga={name:"JSON5",scopeName:"source.json5",keywords:{true:"constant.language.json5",false:"constant.language.json5",null:"constant.language.json5",Infinity:"constant.language.json5",NaN:"constant.language.json5"},patterns:[{include:"#comments"},{include:"#strings"},{include:"#numbers"},{include:"#constants"},{include:"#keys"}],repository:{comments:{patterns:[{name:"comment.line.double-slash.json5",match:"\\/\\/.*$"},{name:"comment.block.json5",begin:"\\/\\*",end:"\\*\\/"}]},strings:{patterns:[{name:"string.quoted.single.json5",begin:"'",end:"'",patterns:[{name:"constant.character.escape.json5",match:"\\\\."}]},{name:"string.quoted.double.json5",begin:'"',end:'"',patterns:[{name:"constant.character.escape.json5",match:"\\\\."}]}]},numbers:{patterns:[{name:"constant.numeric.json5",match:"\\b(?:0[xX][0-9a-fA-F]+|[+-]?(?:\\d+\\.?\\d*|\\.\\d+)(?:[eE][+-]?\\d+)?)\\b"}]},constants:{patterns:[{name:"constant.language.json5",match:"\\b(true|false|null|Infinity|NaN)\\b"}]},keys:{patterns:[{name:"support.type.property-name.json5",match:"\\b[a-zA-Z_$][a-zA-Z0-9_$]*\\s*(?=:)"},{name:"support.type.property-name.json5",begin:'"',end:'"(?=\\s*:)'},{name:"support.type.property-name.json5",begin:"'",end:"'(?=\\s*:)"}]}}},Aa={name:"JSONC",scopeName:"source.jsonc",keywords:{true:"constant.language.json",false:"constant.language.json",null:"constant.language.json"},patterns:[{include:"#comments"},{include:"#value"}],repository:{comments:{patterns:[{name:"comment.line.double-slash.jsonc",match:"\\/\\/.*$"},{name:"comment.block.jsonc",begin:"\\/\\*",end:"\\*\\/"}]},value:{patterns:[{include:"#constant"},{include:"#number"},{include:"#string"},{include:"#array"},{include:"#object"}]},constant:{patterns:[{name:"constant.language.json",match:"\\b(true|false|null)\\b"}]},number:{patterns:[{name:"constant.numeric.json",match:"-?(?:0|[1-9]\\d*)(?:\\.\\d+)?(?:[eE][+-]?\\d+)?"}]},string:{patterns:[{name:"string.quoted.double.json",begin:'"',end:'"',patterns:[{name:"constant.character.escape.json",match:'\\\\(?:["\\\\/bfnrt]|u[0-9a-fA-F]{4})'},{name:"invalid.illegal.unrecognized-string-escape.json",match:"\\\\."}]}]},array:{patterns:[{name:"meta.structure.array.json",begin:"\\[",end:"\\]",patterns:[{include:"#value"},{include:"#comments"}]}]},object:{patterns:[{name:"meta.structure.dictionary.json",begin:"\\{",end:"\\}",patterns:[{include:"#comments"},{include:"#objectkey"},{include:"#value"}]}]},objectkey:{patterns:[{name:"support.type.property-name.json",begin:'"',end:'"',patterns:[{name:"constant.character.escape.json",match:'\\\\(?:["\\\\/bfnrt]|u[0-9a-fA-F]{4})'}]}]}}},$a={name:"Kotlin",scopeName:"source.kotlin",keywords:{package:"keyword.other.kotlin",import:"keyword.other.kotlin",class:"keyword.other.kotlin",interface:"keyword.other.kotlin",object:"keyword.other.kotlin",data:"keyword.other.kotlin",sealed:"keyword.other.kotlin",enum:"keyword.other.kotlin",fun:"keyword.other.kotlin",val:"keyword.other.kotlin",var:"keyword.other.kotlin",if:"keyword.control.kotlin",else:"keyword.control.kotlin",when:"keyword.control.kotlin",for:"keyword.control.kotlin",while:"keyword.control.kotlin",do:"keyword.control.kotlin",return:"keyword.control.kotlin",break:"keyword.control.kotlin",continue:"keyword.control.kotlin",throw:"keyword.control.kotlin",try:"keyword.control.kotlin",catch:"keyword.control.kotlin",finally:"keyword.control.kotlin",public:"storage.modifier.kotlin",private:"storage.modifier.kotlin",protected:"storage.modifier.kotlin",internal:"storage.modifier.kotlin",open:"storage.modifier.kotlin",abstract:"storage.modifier.kotlin",override:"storage.modifier.kotlin",suspend:"storage.modifier.kotlin",inline:"storage.modifier.kotlin",true:"constant.language.kotlin",false:"constant.language.kotlin",null:"constant.language.kotlin",this:"variable.language.kotlin",super:"variable.language.kotlin",it:"variable.language.kotlin"},patterns:[{include:"#comments"},{include:"#strings"},{include:"#keywords"},{include:"#numbers"},{include:"#functions"}],repository:{comments:{patterns:[{name:"comment.line.double-slash.kotlin",match:"\\/\\/.*$"},{name:"comment.block.kotlin",begin:"\\/\\*",end:"\\*\\/"}]},strings:{patterns:[{name:"string.quoted.triple.kotlin",begin:'"""',end:'"""',patterns:[{name:"meta.template.expression.kotlin",begin:"\\$\\{",end:"\\}"},{name:"variable.other.kotlin",match:"\\$[a-zA-Z_][a-zA-Z0-9_]*"}]},{name:"string.quoted.double.kotlin",begin:'"',end:'"',patterns:[{name:"constant.character.escape.kotlin",match:"\\\\."},{name:"variable.other.kotlin",match:"\\$[a-zA-Z_][a-zA-Z0-9_]*"},{name:"meta.template.expression.kotlin",begin:"\\$\\{",end:"\\}"}]}]},keywords:{patterns:[{name:"keyword.control.kotlin",match:"\\b(if|else|when|for|while|do|return|break|continue|throw|try|catch|finally)\\b"},{name:"keyword.other.kotlin",match:"\\b(package|import|class|interface|object|data|sealed|enum|fun|val|var)\\b"},{name:"storage.modifier.kotlin",match:"\\b(public|private|protected|internal|open|abstract|override|suspend|inline)\\b"},{name:"constant.language.kotlin",match:"\\b(true|false|null)\\b"}]},numbers:{patterns:[{name:"constant.numeric.kotlin",match:"\\b(?:0[xX][0-9a-fA-F_]+|0[bB][01_]+|\\d+[._]?\\d*(?:[eE][+-]?\\d+)?)[fFdDlL]?\\b"}]},functions:{patterns:[{name:"entity.name.function.kotlin",match:"\\b([a-zA-Z_][a-zA-Z0-9_]*)\\s*(?=\\()"}]}}},qa={name:"LaTeX",scopeName:"text.tex.latex",keywords:{},patterns:[{include:"#comments"},{include:"#commands"},{include:"#environments"},{include:"#math"}],repository:{comments:{patterns:[{name:"comment.line.percentage.latex",match:"%.*$"}]},commands:{patterns:[{name:"support.function.latex",match:"\\\\[a-zA-Z]+"}]},environments:{patterns:[{name:"meta.environment.latex",begin:"\\\\begin\\{([a-zA-Z]+)\\}",beginCaptures:{0:{name:"support.function.latex"},1:{name:"variable.parameter.latex"}},end:"\\\\end\\{\\1\\}",endCaptures:{0:{name:"support.function.latex"}}}]},math:{patterns:[{name:"string.other.math.latex",begin:"\\$\\$",end:"\\$\\$"},{name:"string.other.math.latex",begin:"\\$",end:"\\$"}]}}},_a={name:"Log",scopeName:"text.log",keywords:{},patterns:[{include:"#log-levels"},{include:"#timestamps"},{include:"#ip-addresses"}],repository:{"log-levels":{patterns:[{name:"markup.error.log",match:"\\b(ERROR|FATAL|CRITICAL)\\b"},{name:"markup.warning.log",match:"\\b(WARN|WARNING)\\b"},{name:"markup.info.log",match:"\\b(INFO|NOTICE)\\b"},{name:"markup.debug.log",match:"\\b(DEBUG|TRACE)\\b"}]},timestamps:{patterns:[{name:"constant.numeric.timestamp.log",match:"\\d{4}-\\d{2}-\\d{2}[T ]\\d{2}:\\d{2}:\\d{2}(?:\\.\\d+)?"}]},"ip-addresses":{patterns:[{name:"constant.numeric.ip.log",match:"\\b(?:\\d{1,3}\\.){3}\\d{1,3}\\b"}]}}},ja={name:"Lua",scopeName:"source.lua",keywords:{and:"keyword.operator.lua",break:"keyword.control.lua",do:"keyword.control.lua",else:"keyword.control.lua",elseif:"keyword.control.lua",end:"keyword.control.lua",false:"constant.language.lua",for:"keyword.control.lua",function:"keyword.control.lua",if:"keyword.control.lua",in:"keyword.control.lua",local:"storage.modifier.lua",nil:"constant.language.lua",not:"keyword.operator.lua",or:"keyword.operator.lua",repeat:"keyword.control.lua",return:"keyword.control.lua",then:"keyword.control.lua",true:"constant.language.lua",until:"keyword.control.lua",while:"keyword.control.lua"},patterns:[{include:"#comments"},{include:"#strings"},{include:"#keywords"},{include:"#numbers"}],repository:{comments:{patterns:[{name:"comment.block.lua",begin:"--\\[\\[",end:"\\]\\]"},{name:"comment.line.double-dash.lua",match:"--.*$"}]},strings:{patterns:[{name:"string.quoted.other.multiline.lua",begin:"\\[\\[",end:"\\]\\]"},{name:"string.quoted.double.lua",begin:'"',end:'"',patterns:[{name:"constant.character.escape.lua",match:"\\\\."}]},{name:"string.quoted.single.lua",begin:"'",end:"'",patterns:[{name:"constant.character.escape.lua",match:"\\\\."}]}]},keywords:{patterns:[{name:"keyword.control.lua",match:"\\b(break|do|else|elseif|end|for|function|if|in|repeat|return|then|until|while)\\b"},{name:"constant.language.lua",match:"\\b(true|false|nil)\\b"},{name:"storage.modifier.lua",match:"\\b(local)\\b"}]},numbers:{patterns:[{name:"constant.numeric.lua",match:"\\b(?:0[xX][0-9a-fA-F]+|\\d+\\.?\\d*(?:[eE][+-]?\\d+)?)\\b"}]}}},za={name:"Makefile",scopeName:"source.makefile",keywords:{ifeq:"keyword.control.makefile",ifneq:"keyword.control.makefile",ifdef:"keyword.control.makefile",ifndef:"keyword.control.makefile",else:"keyword.control.makefile",endif:"keyword.control.makefile",include:"keyword.control.makefile",define:"keyword.control.makefile",endef:"keyword.control.makefile"},patterns:[{include:"#comments"},{include:"#targets"},{include:"#variables"},{include:"#directives"}],repository:{comments:{patterns:[{name:"comment.line.number-sign.makefile",match:"#.*$"}]},targets:{patterns:[{name:"entity.name.function.target.makefile",match:"^[a-zA-Z0-9._-]+(?=:)"}]},variables:{patterns:[{name:"variable.other.makefile",match:"\\$[({][a-zA-Z0-9_]+[})]"},{name:"variable.other.makefile",match:"\\$[a-zA-Z0-9_]"}]},directives:{patterns:[{name:"keyword.control.makefile",match:"^\\s*(ifeq|ifneq|ifdef|ifndef|else|endif|include|define|endef)\\b"}]}}},Ea={name:"Markdown",scopeName:"text.html.markdown",keywords:{},patterns:[{include:"#heading"},{include:"#code-block"},{include:"#code-inline"},{include:"#bold"},{include:"#italic"},{include:"#strikethrough"},{include:"#link"},{include:"#image"},{include:"#list"},{include:"#blockquote"},{include:"#horizontal-rule"},{include:"#table"}],repository:{heading:{patterns:[{name:"markup.heading.markdown",match:"^(#{1,6})\\s+(.+)$",captures:{1:{name:"markup.heading.marker.markdown"},2:{name:"markup.heading.content.markdown"}}},{name:"markup.heading.setext.markdown",match:"^(=+|-+)$"}]},"code-block":{patterns:[{name:"markup.fenced_code.block.markdown",begin:"^```([a-zA-Z0-9]*)",end:"^```",captures:{1:{name:"entity.name.function.markdown"}},contentName:"markup.raw.code.markdown"},{name:"markup.raw.code.markdown",match:"^( |\\t)(.*)$"}]},"code-inline":{patterns:[{name:"markup.inline.raw.markdown",match:"`[^`]+`"}]},bold:{patterns:[{name:"markup.bold.markdown",match:"(\\*\\*|__)(?=\\S)(.+?[*_]*)(?<=\\S)\\1",captures:{1:{name:"punctuation.definition.bold.markdown"},2:{name:"markup.bold.content.markdown"}}}]},italic:{patterns:[{name:"markup.italic.markdown",match:"(\\*|_)(?=\\S)(.+?)(?<=\\S)\\1",captures:{1:{name:"punctuation.definition.italic.markdown"},2:{name:"markup.italic.content.markdown"}}}]},strikethrough:{patterns:[{name:"markup.strikethrough.markdown",match:"~~(.+?)~~",captures:{1:{name:"markup.strikethrough.content.markdown"}}}]},link:{patterns:[{name:"meta.link.inline.markdown",match:"\\[([^\\]]+)\\]\\(([^)]+)\\)",captures:{1:{name:"string.other.link.title.markdown"},2:{name:"markup.underline.link.markdown"}}},{name:"meta.link.reference.markdown",match:"\\[([^\\]]+)\\]\\[([^\\]]+)\\]",captures:{1:{name:"string.other.link.title.markdown"},2:{name:"constant.other.reference.link.markdown"}}}]},image:{patterns:[{name:"meta.image.inline.markdown",match:"!\\[([^\\]]*)\\]\\(([^)]+)\\)",captures:{1:{name:"string.other.link.description.markdown"},2:{name:"markup.underline.link.image.markdown"}}}]},list:{patterns:[{name:"markup.list.unnumbered.markdown",match:"^\\s*([-*+])\\s+",captures:{1:{name:"punctuation.definition.list.markdown"}}},{name:"markup.list.numbered.markdown",match:"^\\s*(\\d+\\.)\\s+",captures:{1:{name:"punctuation.definition.list.markdown"}}}]},blockquote:{patterns:[{name:"markup.quote.markdown",match:"^\\s*>\\s*(.*)$",captures:{1:{name:"markup.quote.content.markdown"}}}]},"horizontal-rule":{patterns:[{name:"meta.separator.markdown",match:"^\\s*([-*_]){3,}\\s*$"}]},table:{patterns:[{name:"markup.table.markdown",match:"^\\|(.+)\\|$"},{name:"markup.table.delimiter.markdown",match:"^\\|([:\\-\\s|]+)\\|$"}]}}},Ta={name:"Nginx",scopeName:"source.nginx",keywords:{},patterns:[{include:"#comments"},{include:"#directives"},{include:"#blocks"},{include:"#variables"},{include:"#strings"}],repository:{comments:{patterns:[{name:"comment.line.number-sign.nginx",match:"#.*$"}]},directives:{patterns:[{name:"keyword.other.directive.nginx",match:"\\b(server|location|listen|root|index|proxy_pass|return|rewrite|try_files|add_header|set|if|access_log|error_log)\\b"}]},blocks:{patterns:[{name:"entity.name.section.nginx",match:"\\b(http|server|location|upstream|events)\\b"}]},variables:{patterns:[{name:"variable.other.nginx",match:"\\$[a-zA-Z_][a-zA-Z0-9_]*"}]},strings:{patterns:[{name:"string.quoted.double.nginx",begin:'"',end:'"'},{name:"string.quoted.single.nginx",begin:"'",end:"'"}]}}},Na={name:"PHP",scopeName:"source.php",keywords:{if:"keyword.control.php",else:"keyword.control.php",elseif:"keyword.control.php",endif:"keyword.control.php",for:"keyword.control.php",foreach:"keyword.control.php",endfor:"keyword.control.php",endforeach:"keyword.control.php",while:"keyword.control.php",endwhile:"keyword.control.php",do:"keyword.control.php",switch:"keyword.control.php",case:"keyword.control.php",default:"keyword.control.php",endswitch:"keyword.control.php",break:"keyword.control.php",continue:"keyword.control.php",return:"keyword.control.php",goto:"keyword.control.php",try:"keyword.control.php",catch:"keyword.control.php",finally:"keyword.control.php",throw:"keyword.control.php",match:"keyword.control.php",function:"storage.type.function.php",class:"storage.type.class.php",interface:"storage.type.interface.php",trait:"storage.type.trait.php",enum:"storage.type.enum.php",namespace:"storage.type.namespace.php",use:"keyword.other.use.php",extends:"storage.modifier.extends.php",implements:"storage.modifier.implements.php",public:"storage.modifier.php",private:"storage.modifier.php",protected:"storage.modifier.php",static:"storage.modifier.php",final:"storage.modifier.php",abstract:"storage.modifier.php",readonly:"storage.modifier.php",true:"constant.language.php",false:"constant.language.php",null:"constant.language.php",TRUE:"constant.language.php",FALSE:"constant.language.php",NULL:"constant.language.php",this:"variable.language.php",parent:"variable.language.php",self:"variable.language.php",new:"keyword.operator.new.php",clone:"keyword.operator.clone.php",instanceof:"keyword.operator.instanceof.php",and:"keyword.operator.logical.php",or:"keyword.operator.logical.php",xor:"keyword.operator.logical.php",echo:"support.function.construct.php",print:"support.function.construct.php",require:"keyword.control.import.php",require_once:"keyword.control.import.php",include:"keyword.control.import.php",include_once:"keyword.control.import.php",die:"keyword.control.php",exit:"keyword.control.php",isset:"support.function.construct.php",empty:"support.function.construct.php",unset:"support.function.construct.php",yield:"keyword.control.php","yield from":"keyword.control.php",declare:"keyword.control.php",const:"storage.type.const.php",var:"storage.type.var.php",global:"storage.modifier.php"},patterns:[{include:"#php-tags"},{include:"#comments"},{include:"#strings"},{include:"#heredoc"},{include:"#keywords"},{include:"#variables"},{include:"#functions"},{include:"#numbers"},{include:"#operators"}],repository:{"php-tags":{patterns:[{name:"meta.embedded.block.php",begin:"<\\?(?:php|=)?",beginCaptures:{0:{name:"punctuation.section.embedded.begin.php"}},end:"\\?>",endCaptures:{0:{name:"punctuation.section.embedded.end.php"}},patterns:[{include:"#comments"},{include:"#strings"},{include:"#heredoc"},{include:"#keywords"},{include:"#variables"},{include:"#functions"},{include:"#numbers"},{include:"#operators"}]}]},comments:{patterns:[{name:"comment.line.double-slash.php",match:"\\/\\/.*$"},{name:"comment.line.number-sign.php",match:"#.*$"},{name:"comment.block.php",begin:"\\/\\*",end:"\\*\\/"}]},strings:{patterns:[{name:"string.quoted.double.php",begin:'"',end:'"',patterns:[{name:"constant.character.escape.php",match:"\\\\."},{name:"variable.other.php",match:"\\$[a-zA-Z_][a-zA-Z0-9_]*"},{name:"meta.embedded.expression.php",begin:"\\{\\$",end:"\\}",patterns:[{include:"#variables"}]}]},{name:"string.quoted.single.php",begin:"'",end:"'",patterns:[{name:"constant.character.escape.php",match:"\\\\['\\\\]"}]}]},heredoc:{patterns:[{name:"string.unquoted.heredoc.php",begin:`<<<(["']?)([a-zA-Z_][a-zA-Z0-9_]*)\\1`,end:"^\\2;?$",patterns:[{name:"variable.other.php",match:"\\$[a-zA-Z_][a-zA-Z0-9_]*"}]}]},keywords:{patterns:[{name:"keyword.control.php",match:"\\b(if|else|elseif|endif|for|foreach|endfor|endforeach|while|endwhile|do|switch|case|default|endswitch|break|continue|return|goto|try|catch|finally|throw|match|die|exit|yield|declare)\\b"},{name:"storage.type.php",match:"\\b(function|class|interface|trait|enum|namespace|const|var)\\b"},{name:"storage.modifier.php",match:"\\b(public|private|protected|static|final|abstract|readonly|global)\\b"},{name:"keyword.other.php",match:"\\b(use|extends|implements)\\b"},{name:"constant.language.php",match:"\\b(true|false|null|TRUE|FALSE|NULL)\\b"},{name:"keyword.control.import.php",match:"\\b(require|require_once|include|include_once)\\b"}]},variables:{patterns:[{name:"variable.language.php",match:"\\$(?:this|GLOBALS|_GET|_POST|_REQUEST|_SESSION|_COOKIE|_SERVER|_FILES|_ENV)\\b"},{name:"variable.other.php",match:"\\$[a-zA-Z_][a-zA-Z0-9_]*"}]},functions:{patterns:[{name:"entity.name.function.php",match:"\\b([a-zA-Z_][a-zA-Z0-9_]*)\\s*(?=\\()"}]},numbers:{patterns:[{name:"constant.numeric.php",match:"\\b(?:0[xX][0-9a-fA-F]+|0[bB][01]+|0[oO][0-7]+|\\d+\\.?\\d*(?:[eE][+-]?\\d+)?)\\b"}]},operators:{patterns:[{name:"keyword.operator.php",match:"(===|!==|==|!=|<=|>=|<>|<|>|\\+\\+|--|\\+|\\-|\\*|/|%|&&|\\|\\||!|\\.|=>|->|::|\\.=|\\+=|-=|\\*=|/=|%=|&=|\\|=|\\^=|<<=|>>=)"}]}}},Za={name:"PowerShell",scopeName:"source.powershell",keywords:{if:"keyword.control.powershell",else:"keyword.control.powershell",elseif:"keyword.control.powershell",switch:"keyword.control.powershell",for:"keyword.control.powershell",foreach:"keyword.control.powershell",while:"keyword.control.powershell",do:"keyword.control.powershell",until:"keyword.control.powershell",break:"keyword.control.powershell",continue:"keyword.control.powershell",return:"keyword.control.powershell",function:"storage.type.powershell",filter:"storage.type.powershell",param:"storage.type.powershell",begin:"keyword.control.powershell",process:"keyword.control.powershell",end:"keyword.control.powershell",try:"keyword.control.powershell",catch:"keyword.control.powershell",finally:"keyword.control.powershell",throw:"keyword.control.powershell",$true:"constant.language.powershell",$false:"constant.language.powershell",$null:"constant.language.powershell"},patterns:[{include:"#comments"},{include:"#strings"},{include:"#variables"},{include:"#keywords"},{include:"#cmdlets"}],repository:{comments:{patterns:[{name:"comment.line.number-sign.powershell",match:"#.*$"},{name:"comment.block.powershell",begin:"<#",end:"#>"}]},strings:{patterns:[{name:"string.quoted.double.powershell",begin:'"',end:'"',patterns:[{name:"variable.other.powershell",match:"\\$[a-zA-Z_][a-zA-Z0-9_]*"}]},{name:"string.quoted.single.powershell",begin:"'",end:"'"}]},variables:{patterns:[{name:"variable.other.powershell",match:"\\$[a-zA-Z_][a-zA-Z0-9_]*"}]},keywords:{patterns:[{name:"keyword.control.powershell",match:"\\b(if|else|elseif|switch|for|foreach|while|do|until|break|continue|return|begin|process|end|try|catch|finally|throw)\\b"},{name:"storage.type.powershell",match:"\\b(function|filter|param)\\b"},{name:"constant.language.powershell",match:"\\$(?:true|false|null)\\b"}]},cmdlets:{patterns:[{name:"support.function.powershell",match:"\\b[A-Z][a-z]+-[A-Z][a-z]+[a-zA-Z]*\\b"}]}}},xa={name:"Protocol Buffers",scopeName:"source.proto",keywords:{syntax:"keyword.other.proto",package:"keyword.other.proto",import:"keyword.other.proto",option:"keyword.other.proto",message:"keyword.other.proto",enum:"keyword.other.proto",service:"keyword.other.proto",rpc:"keyword.other.proto",returns:"keyword.other.proto",repeated:"storage.modifier.proto",optional:"storage.modifier.proto",required:"storage.modifier.proto",true:"constant.language.proto",false:"constant.language.proto"},patterns:[{include:"#comments"},{include:"#strings"},{include:"#keywords"},{include:"#numbers"}],repository:{comments:{patterns:[{name:"comment.line.double-slash.proto",match:"\\/\\/.*$"},{name:"comment.block.proto",begin:"\\/\\*",end:"\\*\\/"}]},strings:{patterns:[{name:"string.quoted.double.proto",begin:'"',end:'"',patterns:[{name:"constant.character.escape.proto",match:"\\\\."}]}]},keywords:{patterns:[{name:"keyword.other.proto",match:"\\b(syntax|package|import|option|message|enum|service|rpc|returns)\\b"},{name:"storage.modifier.proto",match:"\\b(repeated|optional|required)\\b"},{name:"constant.language.proto",match:"\\b(true|false)\\b"}]},numbers:{patterns:[{name:"constant.numeric.proto",match:"\\b\\d+\\b"}]}}},La={name:"Python",scopeName:"source.python",keywords:{if:"keyword.control.python",elif:"keyword.control.python",else:"keyword.control.python",for:"keyword.control.python",while:"keyword.control.python",break:"keyword.control.python",continue:"keyword.control.python",return:"keyword.control.python",yield:"keyword.control.python",try:"keyword.control.python",except:"keyword.control.python",finally:"keyword.control.python",raise:"keyword.control.python",with:"keyword.control.python",as:"keyword.control.python",pass:"keyword.control.python",match:"keyword.control.python",case:"keyword.control.python",def:"storage.type.function.python",class:"storage.type.class.python",lambda:"storage.type.function.python",async:"storage.modifier.async.python",await:"keyword.control.python",and:"keyword.operator.logical.python",or:"keyword.operator.logical.python",not:"keyword.operator.logical.python",in:"keyword.operator.python",is:"keyword.operator.python",import:"keyword.control.import.python",from:"keyword.control.import.python",True:"constant.language.python",False:"constant.language.python",None:"constant.language.python",self:"variable.language.python",cls:"variable.language.python",print:"support.function.builtin.python",len:"support.function.builtin.python",range:"support.function.builtin.python",str:"support.function.builtin.python",int:"support.function.builtin.python",float:"support.function.builtin.python",list:"support.function.builtin.python",dict:"support.function.builtin.python",tuple:"support.function.builtin.python",set:"support.function.builtin.python",bool:"support.function.builtin.python"},patterns:[{include:"#comments"},{include:"#strings"},{include:"#decorators"},{include:"#keywords"},{include:"#functions"},{include:"#numbers"},{include:"#operators"}],repository:{comments:{patterns:[{name:"comment.line.number-sign.python",match:"#.*$"}]},strings:{patterns:[{name:"string.quoted.docstring.python",begin:'"""',end:'"""'},{name:"string.quoted.docstring.python",begin:"'''",end:"'''"},{name:"string.quoted.double.python",begin:'f"',end:'"',patterns:[{name:"constant.character.escape.python",match:"\\\\."},{name:"meta.embedded.expression.python",begin:"\\{",end:"\\}"}]},{name:"string.quoted.double.python",begin:'"',end:'"',patterns:[{name:"constant.character.escape.python",match:"\\\\."}]},{name:"string.quoted.single.python",begin:"'",end:"'",patterns:[{name:"constant.character.escape.python",match:"\\\\."}]}]},decorators:{patterns:[{name:"entity.name.function.decorator.python",match:"@[a-zA-Z_][a-zA-Z0-9_]*"}]},keywords:{patterns:[{name:"keyword.control.python",match:"\\b(if|elif|else|for|while|break|continue|return|yield|try|except|finally|raise|with|as|pass|match|case|await)\\b"},{name:"storage.type.python",match:"\\b(def|class|lambda|async)\\b"},{name:"keyword.control.import.python",match:"\\b(import|from)\\b"},{name:"constant.language.python",match:"\\b(True|False|None)\\b"}]},functions:{patterns:[{name:"entity.name.function.python",match:"\\b([a-zA-Z_][a-zA-Z0-9_]*)\\s*(?=\\()"}]},numbers:{patterns:[{name:"constant.numeric.python",match:"\\b(?:0[xX][0-9a-fA-F]+|0[oO][0-7]+|0[bB][01]+|(?:[0-9]+\\.?[0-9]*|\\.[0-9]+)(?:[eE][-+]?[0-9]+)?)\\b"}]},operators:{patterns:[{name:"keyword.operator.python",match:"(\\+|-|\\*|/|//|%|\\*\\*|==|!=|<|>|<=|>=|=|\\+=|-=|\\*=|/=)"}]}}},Ra={name:"R",scopeName:"source.r",keywords:{if:"keyword.control.r",else:"keyword.control.r",for:"keyword.control.r",while:"keyword.control.r",repeat:"keyword.control.r",break:"keyword.control.r",next:"keyword.control.r",return:"keyword.control.r",function:"storage.type.r",in:"keyword.operator.r",TRUE:"constant.language.r",FALSE:"constant.language.r",NULL:"constant.language.r",NA:"constant.language.r",NaN:"constant.language.r",Inf:"constant.language.r"},patterns:[{include:"#comments"},{include:"#strings"},{include:"#keywords"},{include:"#numbers"},{include:"#operators"}],repository:{comments:{patterns:[{name:"comment.line.number-sign.r",match:"#.*$"}]},strings:{patterns:[{name:"string.quoted.double.r",begin:'"',end:'"',patterns:[{name:"constant.character.escape.r",match:"\\\\."}]},{name:"string.quoted.single.r",begin:"'",end:"'",patterns:[{name:"constant.character.escape.r",match:"\\\\."}]}]},keywords:{patterns:[{name:"keyword.control.r",match:"\\b(if|else|for|while|repeat|break|next|return|in)\\b"},{name:"storage.type.r",match:"\\b(function)\\b"},{name:"constant.language.r",match:"\\b(TRUE|FALSE|NULL|NA|NaN|Inf)\\b"}]},numbers:{patterns:[{name:"constant.numeric.r",match:"\\b\\d+\\.?\\d*(?:[eE][+-]?\\d+)?[iL]?\\b"}]},operators:{patterns:[{name:"keyword.operator.r",match:"(<-|<<-|->|->>|==|!=|<=|>=|<|>|&&|\\|\\||!|&|\\||%[a-zA-Z]+%|\\+|\\-|\\*|/|\\^|%%|%/%|::|:::)"}]}}},Ba={name:"RegExp",scopeName:"source.regexp",keywords:{},patterns:[{include:"#character-class"},{include:"#groups"},{include:"#quantifiers"},{include:"#anchors"}],repository:{"character-class":{patterns:[{name:"constant.character.character-class.regexp",begin:"\\[",end:"\\]",patterns:[{name:"constant.character.escape.regexp",match:"\\\\."}]}]},groups:{patterns:[{name:"meta.group.regexp",begin:"\\(",end:"\\)",patterns:[{include:"$self"}]}]},quantifiers:{patterns:[{name:"keyword.operator.quantifier.regexp",match:"[*+?]|\\{\\d+(,\\d*)?\\}"}]},anchors:{patterns:[{name:"keyword.operator.anchor.regexp",match:"\\^|\\$"}]}}},Ua={name:"Ruby",scopeName:"source.ruby",keywords:{if:"keyword.control.ruby",elsif:"keyword.control.ruby",else:"keyword.control.ruby",unless:"keyword.control.ruby",case:"keyword.control.ruby",when:"keyword.control.ruby",while:"keyword.control.ruby",until:"keyword.control.ruby",for:"keyword.control.ruby",break:"keyword.control.ruby",next:"keyword.control.ruby",redo:"keyword.control.ruby",retry:"keyword.control.ruby",return:"keyword.control.ruby",yield:"keyword.control.ruby",begin:"keyword.control.ruby",rescue:"keyword.control.ruby",ensure:"keyword.control.ruby",raise:"keyword.control.ruby",end:"keyword.control.ruby",then:"keyword.control.ruby",do:"keyword.control.ruby",def:"keyword.control.ruby",class:"keyword.control.ruby",module:"keyword.control.ruby",include:"keyword.other.ruby",extend:"keyword.other.ruby",require:"keyword.other.ruby",require_relative:"keyword.other.ruby",load:"keyword.other.ruby",alias:"keyword.other.ruby",undef:"keyword.other.ruby","defined?":"keyword.other.ruby",super:"variable.language.ruby",self:"variable.language.ruby",true:"constant.language.ruby",false:"constant.language.ruby",nil:"constant.language.ruby",__FILE__:"constant.language.ruby",__LINE__:"constant.language.ruby",__ENCODING__:"constant.language.ruby",and:"keyword.operator.logical.ruby",or:"keyword.operator.logical.ruby",not:"keyword.operator.logical.ruby",private:"keyword.other.ruby",protected:"keyword.other.ruby",public:"keyword.other.ruby",attr_reader:"keyword.other.ruby",attr_writer:"keyword.other.ruby",attr_accessor:"keyword.other.ruby"},patterns:[{include:"#comments"},{include:"#strings"},{include:"#symbols"},{include:"#regex"},{include:"#keywords"},{include:"#numbers"},{include:"#functions"},{include:"#operators"}],repository:{comments:{patterns:[{name:"comment.line.number-sign.ruby",match:"#.*$"},{name:"comment.block.ruby",begin:"^=begin",end:"^=end"}]},strings:{patterns:[{name:"string.quoted.double.ruby",begin:'"',end:'"',patterns:[{name:"constant.character.escape.ruby",match:"\\\\."},{name:"meta.interpolation.ruby",begin:"#\\{",end:"\\}",patterns:[{include:"$self"}]}]},{name:"string.quoted.single.ruby",begin:"'",end:"'",patterns:[{name:"constant.character.escape.ruby",match:"\\\\['\\\\]"}]},{name:"string.quoted.other.ruby",begin:"%[qQ]?[{(\\[]",end:"[})\\]]"}]},symbols:{patterns:[{name:"constant.other.symbol.ruby",match:":[a-zA-Z_][a-zA-Z0-9_]*[?!]?"},{name:"constant.other.symbol.ruby",match:':"[^"]*"'}]},regex:{patterns:[{name:"string.regexp.ruby",begin:"/",end:"/[iomxneus]*",patterns:[{name:"constant.character.escape.ruby",match:"\\\\."}]}]},keywords:{patterns:[{name:"keyword.control.ruby",match:"\\b(if|elsif|else|unless|case|when|while|until|for|break|next|redo|retry|return|yield|begin|rescue|ensure|raise|end|then|do|def|class|module)\\b"},{name:"keyword.other.ruby",match:"\\b(include|extend|require|require_relative|load|alias|undef|defined\\?|private|protected|public|attr_reader|attr_writer|attr_accessor)\\b"},{name:"constant.language.ruby",match:"\\b(true|false|nil|__FILE__|__LINE__|__ENCODING__)\\b"},{name:"variable.language.ruby",match:"\\b(self|super)\\b"}]},numbers:{patterns:[{name:"constant.numeric.ruby",match:"\\b(?:0[xX][0-9a-fA-F]+|0[oO][0-7]+|0[bB][01]+|\\d+\\.?\\d*(?:[eE][+-]?\\d+)?)\\b"}]},functions:{patterns:[{name:"entity.name.function.ruby",match:"\\b([a-zA-Z_][a-zA-Z0-9_]*[?!]?)\\s*(?=\\()"}]},operators:{patterns:[{name:"keyword.operator.ruby",match:"(=>|\\+|\\-|\\*|/|%|\\*\\*|==|!=|<|>|<=|>=|<=>|===|=~|!~|&&|\\|\\||!|&|\\||\\^|~|<<|>>|\\.\\.|\\.\\.\\.)"}]}}},Ga={name:"Rust",scopeName:"source.rust",keywords:{if:"keyword.control.rust",else:"keyword.control.rust",for:"keyword.control.rust",while:"keyword.control.rust",loop:"keyword.control.rust",match:"keyword.control.rust",return:"keyword.control.rust",break:"keyword.control.rust",continue:"keyword.control.rust",yield:"keyword.control.rust",fn:"keyword.other.fn.rust",let:"keyword.other.rust",struct:"keyword.other.rust",enum:"keyword.other.rust",trait:"keyword.other.rust",impl:"keyword.other.rust",type:"keyword.other.rust",mod:"keyword.other.rust",use:"keyword.other.rust",const:"keyword.other.rust",static:"keyword.other.rust",pub:"storage.modifier.rust",mut:"storage.modifier.rust",ref:"storage.modifier.rust",unsafe:"storage.modifier.rust",async:"storage.modifier.rust",await:"keyword.control.rust",move:"storage.modifier.rust",i8:"storage.type.rust",i16:"storage.type.rust",i32:"storage.type.rust",i64:"storage.type.rust",i128:"storage.type.rust",isize:"storage.type.rust",u8:"storage.type.rust",u16:"storage.type.rust",u32:"storage.type.rust",u64:"storage.type.rust",u128:"storage.type.rust",usize:"storage.type.rust",f32:"storage.type.rust",f64:"storage.type.rust",bool:"storage.type.rust",char:"storage.type.rust",str:"storage.type.rust",Self:"storage.type.rust",true:"constant.language.rust",false:"constant.language.rust",self:"variable.language.rust",super:"variable.language.rust",crate:"variable.language.rust",where:"keyword.other.rust",as:"keyword.other.rust",in:"keyword.other.rust",extern:"keyword.other.rust",dyn:"keyword.other.rust"},patterns:[{include:"#comments"},{include:"#attributes"},{include:"#strings"},{include:"#lifetimes"},{include:"#macros"},{include:"#keywords"},{include:"#numbers"},{include:"#functions"},{include:"#operators"}],repository:{comments:{patterns:[{name:"comment.line.documentation.rust",match:"\\/\\/\\/.*$"},{name:"comment.line.double-slash.rust",match:"\\/\\/.*$"},{name:"comment.block.rust",begin:"\\/\\*",end:"\\*\\/"}]},attributes:{patterns:[{name:"meta.attribute.rust",begin:"#!?\\[",end:"\\]",patterns:[{name:"entity.name.function.attribute.rust",match:"[a-zA-Z_][a-zA-Z0-9_]*"}]}]},strings:{patterns:[{name:"string.quoted.byte.raw.rust",begin:'br(#*)"',end:'"\\1'},{name:"string.quoted.raw.rust",begin:'r(#*)"',end:'"\\1'},{name:"string.quoted.double.rust",begin:'"',end:'"',patterns:[{name:"constant.character.escape.rust",match:"\\\\."}]},{name:"string.quoted.single.rust",begin:"'",end:"'",patterns:[{name:"constant.character.escape.rust",match:"\\\\."}]}]},lifetimes:{patterns:[{name:"entity.name.lifetime.rust",match:"'[a-zA-Z_][a-zA-Z0-9_]*\\b"}]},macros:{patterns:[{name:"entity.name.function.macro.rust",match:"\\b([a-zA-Z_][a-zA-Z0-9_]*)!"}]},keywords:{patterns:[{name:"keyword.control.rust",match:"\\b(if|else|for|while|loop|match|return|break|continue|yield|await)\\b"},{name:"keyword.other.rust",match:"\\b(fn|let|struct|enum|trait|impl|type|mod|use|const|static|where|as|in|extern|dyn)\\b"},{name:"storage.modifier.rust",match:"\\b(pub|mut|ref|unsafe|async|move)\\b"},{name:"storage.type.rust",match:"\\b(i8|i16|i32|i64|i128|isize|u8|u16|u32|u64|u128|usize|f32|f64|bool|char|str|Self)\\b"},{name:"constant.language.rust",match:"\\b(true|false)\\b"},{name:"variable.language.rust",match:"\\b(self|super|crate)\\b"}]},numbers:{patterns:[{name:"constant.numeric.rust",match:"\\b(?:0[xX][0-9a-fA-F_]+|0[oO][0-7_]+|0[bB][01_]+|\\d+[._]?\\d*(?:[eE][+-]?\\d+)?)[iu]?(?:8|16|32|64|128|size)?\\b"}]},functions:{patterns:[{name:"entity.name.function.rust",match:"\\b([a-zA-Z_][a-zA-Z0-9_]*)\\s*(?=\\()"}]},operators:{patterns:[{name:"keyword.operator.rust",match:"(->|=>|\\+|\\-|\\*|/|%|==|!=|<=|>=|<|>|&&|\\|\\||!|&|\\||\\^|<<|>>|=|\\+=|-=|\\*=|/=|%=|&=|\\|=|\\^=|<<=|>>=|::|\\.|\\.\\.|\\.\\.\\.=)"}]}}},Oa={name:"SCSS",scopeName:"source.scss",keywords:{"@import":"keyword.control.at-rule.scss","@use":"keyword.control.at-rule.scss","@forward":"keyword.control.at-rule.scss","@mixin":"keyword.control.at-rule.scss","@include":"keyword.control.at-rule.scss","@function":"keyword.control.at-rule.scss","@return":"keyword.control.at-rule.scss","@extend":"keyword.control.at-rule.scss","@if":"keyword.control.at-rule.scss","@else":"keyword.control.at-rule.scss","@for":"keyword.control.at-rule.scss","@each":"keyword.control.at-rule.scss","@while":"keyword.control.at-rule.scss","@media":"keyword.control.at-rule.scss","@keyframes":"keyword.control.at-rule.scss"},patterns:[{include:"#comments"},{include:"#at-rules"},{include:"#variables"},{include:"#strings"},{include:"#selectors"},{include:"#properties"}],repository:{comments:{patterns:[{name:"comment.line.double-slash.scss",match:"\\/\\/.*$"},{name:"comment.block.scss",begin:"\\/\\*",end:"\\*\\/"}]},"at-rules":{patterns:[{name:"keyword.control.at-rule.scss",match:"@[a-z-]+"}]},variables:{patterns:[{name:"variable.scss",match:"\\$[a-zA-Z_-][a-zA-Z0-9_-]*"}]},strings:{patterns:[{name:"string.quoted.double.scss",begin:'"',end:'"'},{name:"string.quoted.single.scss",begin:"'",end:"'"}]},selectors:{patterns:[{name:"entity.name.tag.scss",match:"\\b[a-z][a-z0-9-]*\\b"},{name:"entity.other.attribute-name.class.scss",match:"\\.[a-zA-Z_-][a-zA-Z0-9_-]*"},{name:"entity.other.attribute-name.id.scss",match:"#[a-zA-Z_-][a-zA-Z0-9_-]*"}]},properties:{patterns:[{name:"support.type.property-name.scss",match:"\\b[a-z-]+(?=\\s*:)"}]}}},Sa={name:"Solidity",scopeName:"source.solidity",keywords:{pragma:"keyword.other.solidity",import:"keyword.other.solidity",contract:"keyword.other.solidity",interface:"keyword.other.solidity",library:"keyword.other.solidity",function:"keyword.other.solidity",modifier:"keyword.other.solidity",event:"keyword.other.solidity",struct:"keyword.other.solidity",enum:"keyword.other.solidity",if:"keyword.control.solidity",else:"keyword.control.solidity",for:"keyword.control.solidity",while:"keyword.control.solidity",do:"keyword.control.solidity",return:"keyword.control.solidity",break:"keyword.control.solidity",continue:"keyword.control.solidity",public:"storage.modifier.solidity",private:"storage.modifier.solidity",internal:"storage.modifier.solidity",external:"storage.modifier.solidity",pure:"storage.modifier.solidity",view:"storage.modifier.solidity",payable:"storage.modifier.solidity",true:"constant.language.solidity",false:"constant.language.solidity"},patterns:[{include:"#comments"},{include:"#strings"},{include:"#keywords"},{include:"#numbers"}],repository:{comments:{patterns:[{name:"comment.line.double-slash.solidity",match:"\\/\\/.*$"},{name:"comment.block.solidity",begin:"\\/\\*",end:"\\*\\/"}]},strings:{patterns:[{name:"string.quoted.double.solidity",begin:'"',end:'"',patterns:[{name:"constant.character.escape.solidity",match:"\\\\."}]}]},keywords:{patterns:[{name:"keyword.other.solidity",match:"\\b(pragma|import|contract|interface|library|function|modifier|event|struct|enum)\\b"},{name:"keyword.control.solidity",match:"\\b(if|else|for|while|do|return|break|continue)\\b"},{name:"storage.modifier.solidity",match:"\\b(public|private|internal|external|pure|view|payable)\\b"},{name:"constant.language.solidity",match:"\\b(true|false)\\b"}]},numbers:{patterns:[{name:"constant.numeric.solidity",match:"\\b(?:0[xX][0-9a-fA-F]+|\\d+)\\b"}]}}},Ya={name:"SQL",scopeName:"source.sql",keywords:{SELECT:"keyword.other.dml.sql",INSERT:"keyword.other.dml.sql",UPDATE:"keyword.other.dml.sql",DELETE:"keyword.other.dml.sql",MERGE:"keyword.other.dml.sql",CREATE:"keyword.other.ddl.sql",ALTER:"keyword.other.ddl.sql",DROP:"keyword.other.ddl.sql",TRUNCATE:"keyword.other.ddl.sql",RENAME:"keyword.other.ddl.sql",FROM:"keyword.other.sql",WHERE:"keyword.other.sql",JOIN:"keyword.other.sql",INNER:"keyword.other.sql",LEFT:"keyword.other.sql",RIGHT:"keyword.other.sql",FULL:"keyword.other.sql",OUTER:"keyword.other.sql",CROSS:"keyword.other.sql",ON:"keyword.other.sql",USING:"keyword.other.sql",GROUP:"keyword.other.sql",BY:"keyword.other.sql",HAVING:"keyword.other.sql",ORDER:"keyword.other.sql",ASC:"keyword.other.sql",DESC:"keyword.other.sql",LIMIT:"keyword.other.sql",OFFSET:"keyword.other.sql",FETCH:"keyword.other.sql",DISTINCT:"keyword.other.sql",ALL:"keyword.other.sql",AS:"keyword.other.sql",INTO:"keyword.other.sql",VALUES:"keyword.other.sql",SET:"keyword.other.sql",AND:"keyword.operator.logical.sql",OR:"keyword.operator.logical.sql",NOT:"keyword.operator.logical.sql",IN:"keyword.operator.logical.sql",BETWEEN:"keyword.operator.logical.sql",LIKE:"keyword.operator.logical.sql",IS:"keyword.operator.logical.sql",NULL:"constant.language.sql",TRUE:"constant.language.sql",FALSE:"constant.language.sql",COUNT:"support.function.aggregate.sql",SUM:"support.function.aggregate.sql",AVG:"support.function.aggregate.sql",MIN:"support.function.aggregate.sql",MAX:"support.function.aggregate.sql",INT:"storage.type.sql",INTEGER:"storage.type.sql",BIGINT:"storage.type.sql",SMALLINT:"storage.type.sql",TINYINT:"storage.type.sql",DECIMAL:"storage.type.sql",NUMERIC:"storage.type.sql",FLOAT:"storage.type.sql",REAL:"storage.type.sql",DOUBLE:"storage.type.sql",VARCHAR:"storage.type.sql",CHAR:"storage.type.sql",TEXT:"storage.type.sql",DATE:"storage.type.sql",TIME:"storage.type.sql",TIMESTAMP:"storage.type.sql",DATETIME:"storage.type.sql",BOOLEAN:"storage.type.sql",BOOL:"storage.type.sql",BLOB:"storage.type.sql",PRIMARY:"keyword.other.sql",KEY:"keyword.other.sql",FOREIGN:"keyword.other.sql",REFERENCES:"keyword.other.sql",UNIQUE:"keyword.other.sql",CHECK:"keyword.other.sql",DEFAULT:"keyword.other.sql",AUTO_INCREMENT:"keyword.other.sql",TABLE:"keyword.other.sql",VIEW:"keyword.other.sql",INDEX:"keyword.other.sql",DATABASE:"keyword.other.sql",SCHEMA:"keyword.other.sql",IF:"keyword.control.sql",EXISTS:"keyword.other.sql",CASCADE:"keyword.other.sql",CONSTRAINT:"keyword.other.sql",UNION:"keyword.other.sql",INTERSECT:"keyword.other.sql",EXCEPT:"keyword.other.sql",CASE:"keyword.control.sql",WHEN:"keyword.control.sql",THEN:"keyword.control.sql",ELSE:"keyword.control.sql",END:"keyword.control.sql"},patterns:[{include:"#comments"},{include:"#strings"},{include:"#keywords"},{include:"#numbers"},{include:"#operators"}],repository:{comments:{patterns:[{name:"comment.line.double-dash.sql",match:"--.*$"},{name:"comment.line.number-sign.sql",match:"#.*$"},{name:"comment.block.sql",begin:"\\/\\*",end:"\\*\\/"}]},strings:{patterns:[{name:"string.quoted.single.sql",begin:"'",end:"'",patterns:[{name:"constant.character.escape.sql",match:"''"}]},{name:"string.quoted.double.sql",begin:'"',end:'"',patterns:[{name:"constant.character.escape.sql",match:'""'}]}]},keywords:{patterns:[{name:"keyword.other.dml.sql",match:"\\b(?i:SELECT|INSERT|UPDATE|DELETE|MERGE)\\b"},{name:"keyword.other.ddl.sql",match:"\\b(?i:CREATE|ALTER|DROP|TRUNCATE|RENAME)\\b"},{name:"keyword.other.sql",match:"\\b(?i:FROM|WHERE|JOIN|INNER|LEFT|RIGHT|FULL|OUTER|CROSS|ON|USING|GROUP|BY|HAVING|ORDER|ASC|DESC|LIMIT|OFFSET|FETCH|DISTINCT|ALL|AS|INTO|VALUES|SET|TABLE|VIEW|INDEX|DATABASE|SCHEMA|EXISTS|CASCADE|CONSTRAINT|UNION|INTERSECT|EXCEPT|PRIMARY|KEY|FOREIGN|REFERENCES|UNIQUE|CHECK|DEFAULT|AUTO_INCREMENT)\\b"},{name:"keyword.operator.logical.sql",match:"\\b(?i:AND|OR|NOT|IN|BETWEEN|LIKE|IS)\\b"},{name:"keyword.control.sql",match:"\\b(?i:IF|CASE|WHEN|THEN|ELSE|END)\\b"},{name:"constant.language.sql",match:"\\b(?i:NULL|TRUE|FALSE)\\b"},{name:"support.function.aggregate.sql",match:"\\b(?i:COUNT|SUM|AVG|MIN|MAX)\\b"},{name:"storage.type.sql",match:"\\b(?i:INT|INTEGER|BIGINT|SMALLINT|TINYINT|DECIMAL|NUMERIC|FLOAT|REAL|DOUBLE|VARCHAR|CHAR|TEXT|DATE|TIME|TIMESTAMP|DATETIME|BOOLEAN|BOOL|BLOB)\\b"}]},numbers:{patterns:[{name:"constant.numeric.sql",match:"\\b\\d+\\.?\\d*(?:[eE][+-]?\\d+)?\\b"}]},operators:{patterns:[{name:"keyword.operator.sql",match:"(=|!=|<>|<|>|<=|>=|\\+|\\-|\\*|/|%|\\|\\|)"}]}}},Fa={name:"STX",scopeName:"text.html.stx",patterns:[{include:"#stx-comments"},{include:"#stx-echo"},{include:"#stx-directives"},{include:"#html"}],repository:{"stx-comments":{patterns:[{name:"comment.block.stx",begin:"\\{\\{--",end:"--\\}\\}"}]},"stx-echo":{patterns:[{name:"meta.embedded.block.stx.unescaped",begin:"(?<!@)\\{\\{\\{",beginCaptures:{0:{name:"punctuation.section.embedded.begin.stx"}},end:"\\}\\}\\}",endCaptures:{0:{name:"punctuation.section.embedded.end.stx"}},contentName:"source.ts.embedded.stx"},{name:"meta.embedded.block.stx.escaped",begin:"(?<![@{])\\{\\{",beginCaptures:{0:{name:"punctuation.section.embedded.begin.stx"}},end:"\\}\\}",endCaptures:{0:{name:"punctuation.section.embedded.end.stx"}},contentName:"source.ts.embedded.stx"},{name:"meta.embedded.block.stx.raw",begin:"(?<!@)\\{!!",beginCaptures:{0:{name:"punctuation.section.embedded.begin.stx"}},end:"!!\\}",endCaptures:{0:{name:"punctuation.section.embedded.end.stx"}},contentName:"source.ts.embedded.stx"}]},"stx-directives":{patterns:[{name:"keyword.control.conditional.stx",match:"@(if|else|elseif|endif|unless|endunless|switch|case|default|endswitch|break)\\b"},{name:"keyword.control.loop.stx",match:"@(for|endfor|foreach|endforeach|while|endwhile|continue|forelse|empty)\\b"},{name:"keyword.control.auth.stx",match:"@(auth|guest|can|cannot|endauth|endguest|endcan|endcannot)\\b"},{name:"keyword.control.component.stx",match:"@(component|endcomponent|slot|endslot|props|inject)\\b"},{name:"keyword.control.layout.stx",match:"@(section|endsection|yield|extends|parent)\\b"},{name:"support.function.include.stx",match:"@(include|includewhen|includeunless|includefirst)\\b"},{name:"keyword.control.stack.stx",match:"@(push|endpush|pushOnce|endpushOnce|pushif|endpushif|stack)\\b"},{name:"keyword.control.once.stx",match:"@(once|endonce)\\b"},{name:"support.function.security.stx",match:"@(csrf|method)\\b"},{name:"keyword.control.environment.stx",match:"@(production|endproduction|development|enddevelopment|env|endenv)\\b"},{name:"support.function.translation.stx",match:"@(translate|endtranslate|t)\\b"},{name:"support.function.webcomponent.stx",match:"@webcomponent\\b"},{name:"support.function.route.stx",match:"@route\\b"},{name:"keyword.control.markdown.stx",begin:"@markdown\\b",beginCaptures:{0:{name:"keyword.control.markdown.stx"}},end:"@endmarkdown\\b",endCaptures:{0:{name:"keyword.control.markdown.stx"}},contentName:"text.html.markdown.embedded.stx"},{name:"support.function.markdown.stx",match:"@markdown-file\\b"},{name:"keyword.control.animation.stx",match:"@(transition|endtransition|motion|endmotion)\\b"},{name:"meta.embedded.block.ts",begin:"@ts\\b",beginCaptures:{0:{name:"keyword.control.stx"}},end:"@endts\\b",endCaptures:{0:{name:"keyword.control.stx"}},contentName:"source.ts"},{name:"meta.embedded.block.js",begin:"@js\\b",beginCaptures:{0:{name:"keyword.control.stx"}},end:"@endjs\\b",endCaptures:{0:{name:"keyword.control.stx"}},contentName:"source.js"},{name:"meta.embedded.block.raw",begin:"@(raw|verbatim)\\b",beginCaptures:{0:{name:"keyword.control.stx"}},end:"@end(raw|verbatim)\\b",endCaptures:{0:{name:"keyword.control.stx"}},contentName:"string.unquoted.raw"},{name:"entity.name.function.stx",match:"@[a-zA-Z_][a-zA-Z0-9_]*"}]},html:{patterns:[{name:"meta.tag.html",begin:"<([a-zA-Z0-9:-]+)",beginCaptures:{0:{name:"punctuation.definition.tag.begin.html"},1:{name:"entity.name.tag.html"}},end:"(/>)|(>)",endCaptures:{1:{name:"punctuation.definition.tag.end.html"},2:{name:"punctuation.definition.tag.end.html"}},patterns:[{name:"entity.other.attribute-name.html",match:"[a-zA-Z-:@]+"},{name:"string.quoted.double.html",begin:'"',end:'"',patterns:[{include:"#stx-echo"}]},{name:"string.quoted.single.html",begin:"'",end:"'",patterns:[{include:"#stx-echo"}]}]},{name:"meta.tag.html",begin:"(</)([a-zA-Z0-9:-]+)",beginCaptures:{1:{name:"punctuation.definition.tag.begin.html"},2:{name:"entity.name.tag.html"}},end:"(>)",endCaptures:{1:{name:"punctuation.definition.tag.end.html"}}},{name:"comment.block.html",begin:"<!--",end:"-->"}]}}},Ia={name:"Swift",scopeName:"source.swift",keywords:{import:"keyword.other.swift",class:"keyword.other.swift",struct:"keyword.other.swift",enum:"keyword.other.swift",protocol:"keyword.other.swift",extension:"keyword.other.swift",func:"keyword.other.swift",var:"keyword.other.swift",let:"keyword.other.swift",if:"keyword.control.swift",else:"keyword.control.swift",guard:"keyword.control.swift",for:"keyword.control.swift",while:"keyword.control.swift",repeat:"keyword.control.swift",switch:"keyword.control.swift",case:"keyword.control.swift",default:"keyword.control.swift",return:"keyword.control.swift",break:"keyword.control.swift",continue:"keyword.control.swift",fallthrough:"keyword.control.swift",defer:"keyword.control.swift",in:"keyword.control.swift",public:"storage.modifier.swift",private:"storage.modifier.swift",fileprivate:"storage.modifier.swift",internal:"storage.modifier.swift",open:"storage.modifier.swift",static:"storage.modifier.swift",final:"storage.modifier.swift",true:"constant.language.swift",false:"constant.language.swift",nil:"constant.language.swift",self:"variable.language.swift",Self:"variable.language.swift"},patterns:[{include:"#comments"},{include:"#strings"},{include:"#keywords"},{include:"#numbers"}],repository:{comments:{patterns:[{name:"comment.line.double-slash.swift",match:"\\/\\/.*$"},{name:"comment.block.swift",begin:"\\/\\*",end:"\\*\\/"}]},strings:{patterns:[{name:"string.quoted.double.swift",begin:'"',end:'"',patterns:[{name:"constant.character.escape.swift",match:"\\\\."},{name:"meta.embedded.line.swift",begin:"\\\\\\(",end:"\\)"}]}]},keywords:{patterns:[{name:"keyword.control.swift",match:"\\b(if|else|guard|for|while|repeat|switch|case|default|return|break|continue|fallthrough|defer|in)\\b"},{name:"keyword.other.swift",match:"\\b(import|class|struct|enum|protocol|extension|func|var|let)\\b"},{name:"constant.language.swift",match:"\\b(true|false|nil)\\b"}]},numbers:{patterns:[{name:"constant.numeric.swift",match:"\\b\\d+\\.?\\d*\\b"}]}}},Xa={name:"Terraform",scopeName:"source.terraform",keywords:{resource:"keyword.other.terraform",data:"keyword.other.terraform",variable:"keyword.other.terraform",output:"keyword.other.terraform",locals:"keyword.other.terraform",module:"keyword.other.terraform",provider:"keyword.other.terraform",terraform:"keyword.other.terraform",for:"keyword.control.terraform",if:"keyword.control.terraform",else:"keyword.control.terraform",in:"keyword.control.terraform",true:"constant.language.terraform",false:"constant.language.terraform",null:"constant.language.terraform"},patterns:[{include:"#comments"},{include:"#strings"},{include:"#keywords"},{include:"#blocks"}],repository:{comments:{patterns:[{name:"comment.line.number-sign.terraform",match:"#.*$"},{name:"comment.line.double-slash.terraform",match:"\\/\\/.*$"},{name:"comment.block.terraform",begin:"\\/\\*",end:"\\*\\/"}]},strings:{patterns:[{name:"string.quoted.double.terraform",begin:'"',end:'"',patterns:[{name:"constant.character.escape.terraform",match:"\\\\."},{name:"meta.interpolation.terraform",begin:"\\$\\{",end:"\\}"}]}]},keywords:{patterns:[{name:"keyword.other.terraform",match:"\\b(resource|data|variable|output|locals|module|provider|terraform)\\b"},{name:"keyword.control.terraform",match:"\\b(for|if|else|in)\\b"},{name:"constant.language.terraform",match:"\\b(true|false|null)\\b"}]},blocks:{patterns:[{name:"entity.name.type.terraform",match:'^\\s*(resource|data|variable|output|module|provider|terraform)\\s+"[^"]+"'}]}}},Ja={name:"Plain Text",scopeName:"text.plain",keywords:{},patterns:[],repository:{}},Qa={name:"TOML",scopeName:"source.toml",keywords:{true:"constant.language.toml",false:"constant.language.toml"},patterns:[{include:"#comments"},{include:"#tables"},{include:"#keys"},{include:"#strings"},{include:"#numbers"},{include:"#dates"},{include:"#booleans"}],repository:{comments:{patterns:[{name:"comment.line.number-sign.toml",match:"#.*$"}]},tables:{patterns:[{name:"entity.name.section.toml",match:"^\\[\\[?[a-zA-Z0-9._-]+\\]\\]?"}]},keys:{patterns:[{name:"variable.other.key.toml",match:"^[a-zA-Z0-9_-]+(?=\\s*=)"}]},strings:{patterns:[{name:"string.quoted.triple.toml",begin:'"""',end:'"""'},{name:"string.quoted.triple.toml",begin:"'''",end:"'''"},{name:"string.quoted.double.toml",begin:'"',end:'"',patterns:[{name:"constant.character.escape.toml",match:"\\\\."}]},{name:"string.quoted.single.toml",begin:"'",end:"'"}]},numbers:{patterns:[{name:"constant.numeric.toml",match:"\\b[+-]?\\d+(?:\\.\\d+)?(?:[eE][+-]?\\d+)?\\b"},{name:"constant.numeric.toml",match:"\\b0[xX][0-9a-fA-F]+\\b"},{name:"constant.numeric.toml",match:"\\b0[oO][0-7]+\\b"},{name:"constant.numeric.toml",match:"\\b0[bB][01]+\\b"}]},dates:{patterns:[{name:"constant.other.date.toml",match:"\\d{4}-\\d{2}-\\d{2}(?:T\\d{2}:\\d{2}:\\d{2}(?:\\.\\d+)?(?:Z|[+-]\\d{2}:\\d{2})?)?"}]},booleans:{patterns:[{name:"constant.language.toml",match:"\\b(true|false)\\b"}]}}},Wa={name:"TypeScript",scopeName:"source.ts",keywords:{if:"keyword.control.ts",else:"keyword.control.ts",switch:"keyword.control.ts",case:"keyword.control.ts",default:"keyword.control.ts",for:"keyword.control.ts",while:"keyword.control.ts",do:"keyword.control.ts",break:"keyword.control.ts",continue:"keyword.control.ts",return:"keyword.control.ts",try:"keyword.control.ts",catch:"keyword.control.ts",finally:"keyword.control.ts",throw:"keyword.control.ts",async:"keyword.control.ts",await:"keyword.control.ts",yield:"keyword.control.ts",const:"storage.type.ts",let:"storage.type.ts",var:"storage.type.ts",function:"storage.type.ts",class:"storage.type.ts",extends:"storage.type.ts",implements:"storage.type.ts",static:"storage.type.ts",type:"storage.type.ts",interface:"storage.type.ts",enum:"storage.type.ts",namespace:"storage.type.ts",module:"storage.type.ts",declare:"storage.type.ts",public:"storage.type.ts",private:"storage.type.ts",protected:"storage.type.ts",readonly:"storage.type.ts",abstract:"storage.type.ts",string:"storage.type.ts",number:"storage.type.ts",boolean:"storage.type.ts",any:"storage.type.ts",void:"storage.type.ts",never:"storage.type.ts",unknown:"storage.type.ts",object:"storage.type.ts",symbol:"storage.type.ts",bigint:"storage.type.ts",get:"storage.type.ts",set:"storage.type.ts",new:"keyword.operator.new.ts",delete:"keyword.operator.new.ts",typeof:"keyword.operator.new.ts",instanceof:"keyword.operator.new.ts",as:"keyword.operator.new.ts",in:"keyword.operator.new.ts",of:"keyword.operator.new.ts",is:"keyword.operator.new.ts",keyof:"keyword.operator.new.ts",infer:"keyword.operator.new.ts",true:"constant.language.ts",false:"constant.language.ts",null:"constant.language.ts",undefined:"constant.language.ts",NaN:"constant.language.ts",Infinity:"constant.language.ts",this:"constant.language.ts",super:"constant.language.ts",arguments:"constant.language.ts",import:"keyword.other.ts",export:"keyword.other.ts",from:"keyword.other.ts",require:"keyword.other.ts",with:"keyword.other.ts",debugger:"keyword.other.ts"},patterns:[{include:"#comments"},{include:"#strings"},{include:"#jsx"},{include:"#regex"},{include:"#keywords"},{include:"#numbers"},{include:"#functions"},{include:"#types"},{include:"#operators"},{include:"#punctuation"}],repository:{comments:{patterns:[{name:"comment.line.double-slash.ts",match:"\\/\\/.*$"},{name:"comment.block.ts",begin:"\\/\\*",end:"\\*\\/"}]},strings:{patterns:[{name:"string.quoted.double.ts",begin:'"',end:'"',patterns:[{name:"constant.character.escape.ts",match:"\\\\."}]},{name:"string.quoted.single.ts",begin:"'",end:"'",patterns:[{name:"constant.character.escape.ts",match:"\\\\."}]},{name:"string.template.ts",begin:"`",end:"`",patterns:[{name:"meta.template.expression.ts",begin:"\\$\\{",end:"\\}",patterns:[{include:"$self"}]},{name:"constant.character.escape.ts",match:"\\\\."}]}]},jsx:{patterns:[{name:"meta.tag.tsx",begin:"<([A-Z][a-zA-Z0-9]*|[a-z][a-zA-Z0-9-]*)",beginCaptures:{0:{name:"punctuation.definition.tag.begin.tsx"},1:{name:"entity.name.tag.tsx"}},end:"(/?>)",endCaptures:{1:{name:"punctuation.definition.tag.end.tsx"}},patterns:[{name:"entity.other.attribute-name.tsx",match:"[a-zA-Z_:][a-zA-Z0-9_:.-]*"},{name:"meta.embedded.expression.tsx",begin:"\\{",end:"\\}",patterns:[{include:"$self"}]},{name:"string.quoted.double.tsx",begin:'"',end:'"'},{name:"string.quoted.single.tsx",begin:"'",end:"'"}]},{name:"meta.tag.tsx",begin:"(</)([A-Z][a-zA-Z0-9]*|[a-z][a-zA-Z0-9-]*)",beginCaptures:{1:{name:"punctuation.definition.tag.begin.tsx"},2:{name:"entity.name.tag.tsx"}},end:"(>)",endCaptures:{1:{name:"punctuation.definition.tag.end.tsx"}}}]},regex:{patterns:[{name:"string.regexp.ts",begin:"(?<=[=(,\\[!&|?{};:])\\s*(\\/)",beginCaptures:{1:{name:"punctuation.definition.string.begin.ts"}},end:"(\\/)[gimsuvy]*",endCaptures:{1:{name:"punctuation.definition.string.end.ts"}},patterns:[{name:"constant.character.escape.ts",match:"\\\\."}]}]},numbers:{patterns:[{name:"constant.numeric.ts",match:"\\b(0[xX][0-9a-fA-F_]+|0[bB][01_]+|0[oO][0-7_]+|\\d+(_\\d+)*(\\.\\d+(_\\d+)?)?([eE][+-]?\\d+)?)[nN]?\\b"}]},types:{patterns:[{name:"storage.type.ts",match:"\\b(string|number|boolean|any|void|never|unknown|object|symbol|bigint)\\b"},{name:"entity.name.type.ts",match:":\\s*([A-Z][a-zA-Z0-9_]*)"},{name:"meta.type.annotation.ts",match:"<[^>]+>"}]},keywords:{patterns:[{name:"keyword.control.ts",match:"\\b(if|else|switch|case|default|for|while|do|break|continue|return|try|catch|finally|throw|async|await|yield)\\b"},{name:"storage.type.ts",match:"\\b(const|let|var|function|class|extends|implements|static|async|type|interface|enum|namespace|module|declare|public|private|protected|readonly|abstract|get|set)\\b"},{name:"keyword.operator.new.ts",match:"\\b(new|delete|typeof|instanceof|void|as|in|of|is|keyof|infer)\\b"},{name:"constant.language.ts",match:"\\b(true|false|null|undefined|NaN|Infinity|this|super|arguments)\\b"},{name:"keyword.other.ts",match:"\\b(import|export|from|default|require|with|debugger)\\b"}]},functions:{patterns:[{name:"entity.name.function.ts",match:"\\b([a-zA-Z_$][a-zA-Z0-9_$]*)\\s*(?=\\()"}]},operators:{patterns:[{name:"keyword.operator.ts",match:"(\\+\\+|--|\\+|\\-|\\*|\\/|%|===|==|!==|!=|<=|>=|<|>|&&|\\|\\||!|\\?|:|=>|\\.\\.\\.|&|\\||\\^|~|<<|>>|>>>)"}]},punctuation:{patterns:[{name:"punctuation.ts",match:"[{}()\\[\\];,.]"}]}}},Ca={name:"Vue",scopeName:"source.vue",keywords:{},patterns:[{include:"#template"},{include:"#script"},{include:"#style"},{include:"#comments"}],repository:{template:{patterns:[{name:"meta.tag.template.vue",begin:"<template>",end:"</template>",patterns:[{name:"entity.other.attribute-name.vue",match:"v-[a-z-]+"},{name:"entity.other.attribute-name.vue",match:"@[a-z]+"},{name:"entity.other.attribute-name.vue",match:":[a-z-]+"},{name:"meta.embedded.expression.vue",begin:"\\{\\{",end:"\\}\\}"}]}]},script:{patterns:[{name:"meta.tag.script.vue",begin:"<script.*?>",end:"</script>"}]},style:{patterns:[{name:"meta.tag.style.vue",begin:"<style.*?>",end:"</style>"}]},comments:{patterns:[{name:"comment.block.html.vue",begin:"<!--",end:"-->"}]}}},Ma={name:"XML",scopeName:"text.xml",keywords:{},patterns:[{include:"#comments"},{include:"#tags"},{include:"#cdata"}],repository:{comments:{patterns:[{name:"comment.block.xml",begin:"<!--",end:"-->"}]},tags:{patterns:[{name:"meta.tag.xml",begin:"</?([a-zA-Z_:][a-zA-Z0-9_:.-]*)",beginCaptures:{1:{name:"entity.name.tag.xml"}},end:"/?>",patterns:[{name:"entity.other.attribute-name.xml",match:"[a-zA-Z_:][a-zA-Z0-9_:.-]*(?==)"},{include:"#strings"}]}]},strings:{patterns:[{name:"string.quoted.double.xml",begin:'"',end:'"'},{name:"string.quoted.single.xml",begin:"'",end:"'"}]},cdata:{patterns:[{name:"string.unquoted.cdata.xml",begin:"<!\\[CDATA\\[",end:"\\]\\]>"}]}}},va={name:"YAML",scopeName:"source.yaml",keywords:{true:"constant.language.boolean.yaml",false:"constant.language.boolean.yaml",null:"constant.language.null.yaml",True:"constant.language.boolean.yaml",False:"constant.language.boolean.yaml",TRUE:"constant.language.boolean.yaml",FALSE:"constant.language.boolean.yaml",yes:"constant.language.boolean.yaml",no:"constant.language.boolean.yaml",Yes:"constant.language.boolean.yaml",No:"constant.language.boolean.yaml",YES:"constant.language.boolean.yaml",NO:"constant.language.boolean.yaml",on:"constant.language.boolean.yaml",off:"constant.language.boolean.yaml"},patterns:[{include:"#comments"},{include:"#document-markers"},{include:"#keys"},{include:"#strings"},{include:"#numbers"},{include:"#constants"},{include:"#anchors"},{include:"#tags"}],repository:{comments:{patterns:[{name:"comment.line.number-sign.yaml",match:"#.*$"}]},"document-markers":{patterns:[{name:"entity.other.document.begin.yaml",match:"^---"},{name:"entity.other.document.end.yaml",match:"^\\.\\.\\."}]},keys:{patterns:[{name:"meta.key.yaml",match:"([a-zA-Z0-9_-]+)\\s*:",captures:{1:{name:"entity.name.tag.yaml"}}},{name:"string.quoted.yaml",match:`(["'])([a-zA-Z0-9_-]+)\\1\\s*:`,captures:{2:{name:"entity.name.tag.yaml"}}}]},strings:{patterns:[{name:"string.quoted.double.yaml",begin:'"',end:'"',patterns:[{name:"constant.character.escape.yaml",match:"\\\\."}]},{name:"string.quoted.single.yaml",begin:"'",end:"'",patterns:[{name:"constant.character.escape.yaml",match:"''"}]},{name:"string.unquoted.block.yaml",match:"[|>][-+]?\\s*$"}]},numbers:{patterns:[{name:"constant.numeric.yaml",match:"\\b[-+]?(0x[0-9a-fA-F]+|0o[0-7]+|[0-9]+\\.?[0-9]*([eE][-+]?[0-9]+)?)\\b"}]},constants:{patterns:[{name:"constant.language.yaml",match:"\\b(true|false|null|True|False|TRUE|FALSE|yes|no|Yes|No|YES|NO|on|off)\\b"}]},anchors:{patterns:[{name:"entity.name.type.anchor.yaml",match:"&[a-zA-Z0-9_-]+"},{name:"variable.other.alias.yaml",match:"\\*[a-zA-Z0-9_-]+"}]},tags:{patterns:[{name:"storage.type.tag.yaml",match:"!![a-zA-Z0-9_-]+"},{name:"storage.type.tag.yaml",match:"![a-zA-Z0-9_-]+"}]}}},rr=[{id:"javascript",name:"JavaScript",aliases:["js","jsx"],extensions:[".js",".jsx",".mjs",".cjs"],grammar:ba},{id:"typescript",name:"TypeScript",aliases:["ts","tsx"],extensions:[".ts",".tsx",".mts",".cts"],grammar:Wa},{id:"html",name:"HTML",aliases:["htm"],extensions:[".html",".htm"],grammar:ha},{id:"css",name:"CSS",aliases:[],extensions:[".css"],grammar:ca},{id:"json",name:"JSON",aliases:[],extensions:[".json"],grammar:ka},{id:"stx",name:"STX",aliases:[],extensions:[".stx"],grammar:Fa},{id:"bash",name:"Bash",aliases:["sh","shell","zsh","console"],extensions:[".sh",".bash",".zsh"],grammar:na},{id:"markdown",name:"Markdown",aliases:["md"],extensions:[".md",".markdown"],grammar:Ea},{id:"yaml",name:"YAML",aliases:["yml"],extensions:[".yaml",".yml"],grammar:va},{id:"jsonc",name:"JSONC",aliases:[],extensions:[".jsonc"],grammar:Aa},{id:"diff",name:"Diff",aliases:["patch"],extensions:[".diff",".patch"],grammar:ma},{id:"python",name:"Python",aliases:["py"],extensions:[".py",".pyw"],grammar:La},{id:"php",name:"PHP",aliases:[],extensions:[".php",".phtml"],grammar:Na},{id:"java",name:"Java",aliases:[],extensions:[".java"],grammar:fa},{id:"c",name:"C",aliases:["h"],extensions:[".c",".h"],grammar:oa},{id:"cpp",name:"C++",aliases:["cc","cxx","hpp"],extensions:[".cpp",".cc",".cxx",".hpp",".h++"],grammar:sa},{id:"rust",name:"Rust",aliases:["rs"],extensions:[".rs"],grammar:Ga},{id:"csharp",name:"C#",aliases:["cs"],extensions:[".cs"],grammar:ia},{id:"dockerfile",name:"Dockerfile",aliases:["docker"],extensions:[".dockerfile"],grammar:pa},{id:"ruby",name:"Ruby",aliases:["rb"],extensions:[".rb"],grammar:Ua},{id:"go",name:"Go",aliases:[],extensions:[".go"],grammar:ua},{id:"sql",name:"SQL",aliases:[],extensions:[".sql"],grammar:Ya},{id:"idl",name:"IDL",aliases:[],extensions:[".idl"],grammar:wa},{id:"text",name:"Text",aliases:["txt","plain"],extensions:[".txt",".text"],grammar:Ja},{id:"json5",name:"JSON5",aliases:[],extensions:[".json5"],grammar:ga},{id:"vue",name:"Vue",aliases:[],extensions:[".vue"],grammar:Ca},{id:"toml",name:"TOML",aliases:[],extensions:[".toml"],grammar:Qa},{id:"scss",name:"SCSS",aliases:["sass"],extensions:[".scss",".sass"],grammar:Oa},{id:"kotlin",name:"Kotlin",aliases:["kt"],extensions:[".kt",".kts"],grammar:$a},{id:"swift",name:"Swift",aliases:[],extensions:[".swift"],grammar:Ia},{id:"dart",name:"Dart",aliases:[],extensions:[".dart"],grammar:la},{id:"r",name:"R",aliases:[],extensions:[".r",".R"],grammar:Ra},{id:"graphql",name:"GraphQL",aliases:["gql"],extensions:[".graphql",".gql"],grammar:ya},{id:"powershell",name:"PowerShell",aliases:["ps1"],extensions:[".ps1",".psm1"],grammar:Za},{id:"makefile",name:"Makefile",aliases:["make"],extensions:[".make"],grammar:za},{id:"terraform",name:"Terraform",aliases:["tf","hcl"],extensions:[".tf",".hcl"],grammar:Xa},{id:"bnf",name:"BNF",aliases:[],extensions:[".bnf"],grammar:ra},{id:"regexp",name:"RegExp",aliases:["regex"],extensions:[".regexp",".regex"],grammar:Ba},{id:"lua",name:"Lua",aliases:[],extensions:[".lua"],grammar:ja},{id:"cmd",name:"CMD",aliases:["batch"],extensions:[".cmd",".bat"],grammar:aa},{id:"abnf",name:"ABNF",aliases:[],extensions:[".abnf"],grammar:ta},{id:"csv",name:"CSV",aliases:[],extensions:[".csv"],grammar:da},{id:"log",name:"Log",aliases:[],extensions:[".log"],grammar:_a},{id:"nginx",name:"Nginx",aliases:["nginxconf"],extensions:[".conf"],grammar:Ta},{id:"xml",name:"XML",aliases:[],extensions:[".xml"],grammar:Ma},{id:"protobuf",name:"Protobuf",aliases:["proto"],extensions:[".proto"],grammar:xa},{id:"solidity",name:"Solidity",aliases:["sol"],extensions:[".sol"],grammar:Sa},{id:"latex",name:"LaTeX",aliases:["tex"],extensions:[".tex",".latex"],grammar:qa}];function Ka(e){return rr.find((t)=>t.id===e||t.aliases?.includes(e)||t.extensions?.includes(`.${e}`)||t.extensions?.includes(e))}class St{theme;colorCache=new Map;cssCache=null;constructor(e){this.theme=e}render(e,t={}){let{lineNumbers:n=!1,highlightLines:r=[],inline:o=!1,focusLines:a=[],dimLines:s=[],addedLines:c=[],removedLines:i=[],annotations:d=[],showCopyButton:l=!1}=t,m=e.map((y,w)=>{let f=w+1,b=this.getLineClasses(f,{highlightLines:r,focusLines:a,dimLines:s,addedLines:c,removedLines:i}),q=this.renderLine(y,o);if(o)return q;let g=n?`<span class="line-number">${f}</span>`:"",k="";if(c.includes(f))k='<span class="diff-indicator add">+</span>';else if(i.includes(f))k='<span class="diff-indicator remove">-</span>';let U=d.filter((Y)=>Y.line===f).map((Y)=>this.renderAnnotation(Y)).join("");return`<span class="${b}">${k}${g}${q}${U}</span>`}),u=o?`<code class="syntax-inline">${m.join("")}</code>`:`<div class="syntax-wrapper">${l?'<button class="copy-button" data-copy>Copy</button>':""}<pre class="syntax"><code>${m.join(`
1206
+ `)}</code></pre></div>`,p=this.generateCSS(t),h=this.renderAnsi(e);return{html:u,css:p,tokens:e,ansi:h}}getLineClasses(e,t){let n=["line"];if(t.highlightLines.includes(e))n.push("highlighted");if(t.focusLines.includes(e))n.push("focus");if(t.dimLines.includes(e))n.push("dim");if(t.addedLines.includes(e))n.push("added");if(t.removedLines.includes(e))n.push("removed");return n.join(" ")}renderAnnotation(e){return`<span class="annotation annotation-${e.type||"info"}">${this.escapeHtml(e.text)}</span>`}renderLine(e,t){return e.tokens.map((n)=>this.renderToken(n)).join("")}renderToken(e){let t=this.getColorForScopes(e.scopes),n=this.escapeHtml(e.content),r=[this.getScopeClass(e.scopes)],o=[];if(t.foreground||t.fontStyle)o.push(this.buildStyle(t));if(e.dimmed)r.push("dimmed");if(e.blurred)r.push("blurred");if(e.highlighted){if(r.push("highlighted-token"),e.highlightColor)o.push(`background-color: ${e.highlightColor}`)}if(e.emphasized)r.push("emphasized");let a=r.join(" "),s=o.join("; ");if(e.link)return`<a href="${e.link}" class="${a}" style="${s}" target="_blank" rel="noopener noreferrer">${n}</a>`;if(!s&&a==="token")return n;return`<span class="${a}" style="${s}">${n}</span>`}getColorForScopes(e){if(!Array.isArray(e)||e.length===0)return{};let t=e.join("|"),n=this.colorCache.get(t);if(n)return n;let r={},o=0;for(let a of this.theme.tokenColors){let s=Array.isArray(a.scope)?a.scope:[a.scope];for(let c of s)for(let i of e)if(this.scopeMatches(i,c)){let d=c.split(".").length;if(d>o)r=a.settings,o=d}}return this.colorCache.set(t,r),r}scopeMatches(e,t){if(typeof e!=="string"||typeof t!=="string")return!1;let n=e.split("."),r=t.split(".");for(let o=0;o<r.length;o++)if(n[o]!==r[o])return!1;return!0}buildStyle(e){let t=[];if(e.foreground)t.push(`color: ${e.foreground}`);if(e.background)t.push(`background-color: ${e.background}`);if(e.fontStyle){if(e.fontStyle.includes("italic"))t.push("font-style: italic");if(e.fontStyle.includes("bold"))t.push("font-weight: bold");if(e.fontStyle.includes("underline"))t.push("text-decoration: underline")}return t.join("; ")}getScopeClass(e){if(e.length===0)return"token";let t=e[e.length-1];if(typeof t!=="string")return"token";return`token ${t.replace(/\./g,"-")}`}escapeHtml(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}generateCSS(e={}){if(this.cssCache)return this.cssCache;let{colors:t}=this.theme;return this.cssCache=`
1200
1207
  .syntax-wrapper {
1201
1208
  position: relative;
1202
1209
  }
@@ -1365,17 +1372,17 @@ if (typeof document !== 'undefined') {
1365
1372
  background-color: ${this.theme.type==="dark"?"rgba(110, 118, 129, 0.8)":"rgba(27, 31, 36, 0.35)"};
1366
1373
  }
1367
1374
  `.trim(),this.cssCache}renderAnsi(e){let t={keyword:"\x1B[35m",string:"\x1B[32m",comment:"\x1B[90m",number:"\x1B[36m",function:"\x1B[33m",reset:"\x1B[0m"};return e.map((n)=>n.tokens.map((r)=>{let o=typeof r.type==="string"?r.type.toLowerCase():"text";return`${t[o]||t.reset}${r.content}${t.reset}`}).join("")).join(`
1368
- `)}setTheme(e){this.theme=e,this.colorCache.clear(),this.cssCache=null}}var q=new Uint8Array(256);for(let e=65;e<=90;e++)q[e]=1;for(let e=97;e<=122;e++)q[e]=1;q[95]=1;q[36]=1;for(let e=48;e<=57;e++)q[e]=2;q[43]=4;q[45]=4;q[42]=4;q[47]=4;q[61]=4;q[33]=4;q[60]=4;q[62]=4;q[38]=4;q[124]=4;q[37]=4;q[63]=4;q[58]=4;q[46]=4;q[123]=8;q[125]=8;q[40]=8;q[41]=8;q[91]=8;q[93]=8;q[59]=8;q[44]=8;q[34]=16;q[39]=16;q[96]=16;q[32]=32;q[9]=32;q[10]=32;q[13]=32;class nr{keywordSet=null;isJsOrTs;isHtml;isCss;constructor(e){if(this.isJsOrTs=e.scopeName==="source.js"||e.scopeName==="source.ts",this.isHtml=e.scopeName==="text.html.basic",this.isCss=e.scopeName==="source.css",e.keywords)this.keywordSet=new Set(Object.keys(e.keywords))}tokenize(e){let t=e.split(`
1369
- `),n=[];for(let r=0;r<t.length;r++)n.push(this.tokenizeLine(t[r]));return n}tokenizeLine(e){let t=[],n=0;while(n<e.length){let r=e.charCodeAt(n),o=q[r];if(o&32){n++;continue}if(o&2){let a=n;n=this.scanNumber(e,n),t.push({type:"numeric",content:e.slice(a,n)});continue}if(this.isHtml&&r===60){let a=n;if(n++,e.charCodeAt(n)===47)n++;while(n<e.length&&q[e.charCodeAt(n)]&1)n++;while(n<e.length&&e.charCodeAt(n)!==62)n++;if(e.charCodeAt(n)===62)n++;t.push({type:"tag",content:e.slice(a,n)});continue}if(this.isCss){if(r===46||r===35||o&1){let a=n;while(n<e.length){let i=e.charCodeAt(n);if(i===123||i===58||i===59)break;n++}let s=e.slice(a,n),c=s.includes(":")?"property":"selector";t.push({type:c,content:s});continue}}if(!this.isHtml&&r===47){let a=e.charCodeAt(n+1);if(a===47){t.push({type:"comment",content:e.slice(n)});break}else if(a===42){let s=e.indexOf("*/",n+2);if(s!==-1){t.push({type:"comment",content:e.slice(n,s+2)}),n=s+2;continue}}}if(this.isHtml&&r===60&&e.charCodeAt(n+1)===33){let a=e.indexOf("-->",n+4);if(a!==-1){t.push({type:"comment",content:e.slice(n,a+3)}),n=a+3;continue}}if(o&16){let a=n;if(n=this.scanString(e,n,r),n>a){t.push({type:"string",content:e.slice(a,n)});continue}}if(o&1){let a=n;n=this.scanWord(e,n);let s=e.slice(a,n);if(this.isJsOrTs&&e.charCodeAt(n)===40){t.push({type:"function",content:s});continue}let c=this.keywordSet&&this.keywordSet.has(s)?"keyword":"text";t.push({type:c,content:s});continue}if(this.isJsOrTs&&o&4){let a=n;n=this.scanOperator(e,n,r),t.push({type:"operator",content:e.slice(a,n)});continue}if(o&8){t.push({type:"punctuation",content:e[n]}),n++;continue}t.push({type:"text",content:e[n]}),n++}return{tokens:t}}scanNumber(e,t){let n=t,r=!1,o=!1;if(e[t]==="0"&&t+1<e.length){let a=e.charCodeAt(t+1);if(a===120||a===88){n=t+2;while(n<e.length){let s=e.charCodeAt(n);if(!(s>=48&&s<=57||s>=65&&s<=70||s>=97&&s<=102))break;n++}return n}else if(a===98||a===66){n=t+2;while(n<e.length&&(e[n]==="0"||e[n]==="1"))n++;return n}else if(a===111||a===79){n=t+2;while(n<e.length){let s=e.charCodeAt(n);if(!(s>=48&&s<=55))break;n++}return n}}while(n<e.length){let a=e.charCodeAt(n);if(a>=48&&a<=57)n++;else if(a===46&&!r&&!o)r=!0,n++;else if((a===101||a===69)&&!o){if(o=!0,n++,n<e.length&&(e[n]==="+"||e[n]==="-"))n++}else break}return n}scanString(e,t,n){let r=t+1,o=!1;while(r<e.length){let a=e.charCodeAt(r);if(o)o=!1;else if(a===92)o=!0;else if(a===n)return r+1;r++}return r}scanWord(e,t){let n=t+1;while(n<e.length){let r=e.charCodeAt(n);if(!(q[r]&3))break;n++}return n}scanOperator(e,t,n){if(t+1>=e.length)return t+1;let r=e.charCodeAt(t+1);if(t+2<e.length){let o=e.charCodeAt(t+2);if(n===61&&r===61&&o===61||n===33&&r===61&&o===61||n===62&&r===62&&o===62||n===46&&r===46&&o===46)return t+3}if(n===43&&r===43||n===45&&r===45||n===61&&r===61||n===33&&r===61||n===60&&r===61||n===62&&r===61||n===38&&r===38||n===124&&r===124||n===61&&r===62||n===60&&r===60||n===62&&r===62)return t+2;return t+1}}var Wa={name:"GitHub Dark",type:"dark",colors:{"editor.background":"#0d1117","editor.foreground":"#c9d1d9","editor.lineHighlightBackground":"#161b22","editor.selectionBackground":"#264f78"},tokenColors:[{name:"Comment",scope:["comment","comment.line","comment.block"],settings:{foreground:"#8b949e",fontStyle:"italic"}},{name:"String",scope:["string","string.quoted"],settings:{foreground:"#a5d6ff"}},{name:"Template String",scope:["string.template"],settings:{foreground:"#a5d6ff"}},{name:"Number",scope:["constant.numeric"],settings:{foreground:"#79c0ff"}},{name:"Keyword",scope:["keyword","keyword.control","keyword.operator"],settings:{foreground:"#ff7b72"}},{name:"Storage Type",scope:["storage.type","storage.modifier"],settings:{foreground:"#ff7b72"}},{name:"Function",scope:["entity.name.function","support.function"],settings:{foreground:"#d2a8ff"}},{name:"Class",scope:["entity.name.type","entity.name.class"],settings:{foreground:"#ffa657"}},{name:"Variable",scope:["variable","variable.other"],settings:{foreground:"#ffa657"}},{name:"Constant",scope:["constant.language","constant.character"],settings:{foreground:"#79c0ff"}},{name:"Tag",scope:["entity.name.tag"],settings:{foreground:"#7ee787"}},{name:"Attribute",scope:["entity.other.attribute-name"],settings:{foreground:"#79c0ff"}},{name:"Punctuation",scope:["punctuation"],settings:{foreground:"#c9d1d9"}},{name:"Operator",scope:["keyword.operator"],settings:{foreground:"#ff7b72"}},{name:"CSS Property",scope:["support.type.property-name.css"],settings:{foreground:"#79c0ff"}},{name:"CSS Value",scope:["support.constant.property-value.css"],settings:{foreground:"#a5d6ff"}},{name:"Color",scope:["constant.other.color"],settings:{foreground:"#a5d6ff"}}]},va={name:"GitHub Light",type:"light",colors:{"editor.background":"#ffffff","editor.foreground":"#24292f","editor.lineHighlightBackground":"#f6f8fa","editor.selectionBackground":"#b6d4fe"},tokenColors:[{name:"Comment",scope:["comment","comment.line","comment.block"],settings:{foreground:"#6e7781",fontStyle:"italic"}},{name:"String",scope:["string","string.quoted"],settings:{foreground:"#0a3069"}},{name:"Template String",scope:["string.template"],settings:{foreground:"#0a3069"}},{name:"Number",scope:["constant.numeric"],settings:{foreground:"#0550ae"}},{name:"Keyword",scope:["keyword","keyword.control","keyword.operator"],settings:{foreground:"#cf222e"}},{name:"Storage Type",scope:["storage.type","storage.modifier"],settings:{foreground:"#cf222e"}},{name:"Function",scope:["entity.name.function","support.function"],settings:{foreground:"#8250df"}},{name:"Class",scope:["entity.name.type","entity.name.class"],settings:{foreground:"#953800"}},{name:"Variable",scope:["variable","variable.other"],settings:{foreground:"#953800"}},{name:"Constant",scope:["constant.language","constant.character"],settings:{foreground:"#0550ae"}},{name:"Tag",scope:["entity.name.tag"],settings:{foreground:"#116329"}},{name:"Attribute",scope:["entity.other.attribute-name"],settings:{foreground:"#0550ae"}},{name:"Punctuation",scope:["punctuation"],settings:{foreground:"#24292f"}},{name:"Operator",scope:["keyword.operator"],settings:{foreground:"#cf222e"}},{name:"CSS Property",scope:["support.type.property-name.css"],settings:{foreground:"#0550ae"}},{name:"CSS Value",scope:["support.constant.property-value.css"],settings:{foreground:"#0a3069"}},{name:"Color",scope:["constant.other.color"],settings:{foreground:"#0a3069"}}]},Ma={name:"Nord",type:"dark",colors:{"editor.background":"#2e3440","editor.foreground":"#d8dee9","editor.lineHighlightBackground":"#3b4252","editor.selectionBackground":"#434c5e"},tokenColors:[{name:"Comment",scope:["comment","comment.line","comment.block"],settings:{foreground:"#616e88",fontStyle:"italic"}},{name:"String",scope:["string","string.quoted"],settings:{foreground:"#a3be8c"}},{name:"Template String",scope:["string.template"],settings:{foreground:"#a3be8c"}},{name:"Number",scope:["constant.numeric"],settings:{foreground:"#b48ead"}},{name:"Keyword",scope:["keyword","keyword.control","keyword.operator"],settings:{foreground:"#81a1c1"}},{name:"Storage Type",scope:["storage.type","storage.modifier"],settings:{foreground:"#81a1c1"}},{name:"Function",scope:["entity.name.function","support.function"],settings:{foreground:"#88c0d0"}},{name:"Class",scope:["entity.name.type","entity.name.class"],settings:{foreground:"#8fbcbb"}},{name:"Variable",scope:["variable","variable.other"],settings:{foreground:"#d8dee9"}},{name:"Constant",scope:["constant.language","constant.character"],settings:{foreground:"#b48ead"}},{name:"Tag",scope:["entity.name.tag"],settings:{foreground:"#81a1c1"}},{name:"Attribute",scope:["entity.other.attribute-name"],settings:{foreground:"#8fbcbb"}},{name:"Punctuation",scope:["punctuation"],settings:{foreground:"#eceff4"}},{name:"Operator",scope:["keyword.operator"],settings:{foreground:"#81a1c1"}},{name:"CSS Property",scope:["support.type.property-name.css"],settings:{foreground:"#8fbcbb"}},{name:"CSS Value",scope:["support.constant.property-value.css"],settings:{foreground:"#a3be8c"}},{name:"Color",scope:["constant.other.color"],settings:{foreground:"#b48ead"}}]},rr=[Wa,va,Ma];function Ka(e){let t=e.toLowerCase();return rr.find((n)=>{let r=n.name.toLowerCase(),o=r.replace(/\s+/g,"-");return r===t||o===t})}var $=new Uint8Array(256);for(let e=65;e<=90;e++)$[e]=1;for(let e=97;e<=122;e++)$[e]=1;$[95]=1;$[36]=1;for(let e=48;e<=57;e++)$[e]=2;$[43]=4;$[45]=4;$[42]=4;$[47]=4;$[61]=4;$[33]=4;$[60]=4;$[62]=4;$[38]=4;$[124]=4;$[37]=4;$[63]=4;$[58]=4;$[46]=4;$[123]=8;$[125]=8;$[40]=8;$[41]=8;$[91]=8;$[93]=8;$[59]=8;$[44]=8;$[34]=16;$[39]=16;$[96]=16;$[32]=32;$[9]=32;$[10]=32;$[13]=32;class O{grammar;scopeStack=[];regexCache=new Map;compiledPatterns;numberRegex;isJsOrTs;rootScopes;numericScopes;operatorScopes;commentScopes;blockCommentScopes;stringScopes;templateScopes;functionScopes;static TYPE_TEXT="text";static TYPE_PUNCTUATION="punctuation";static TYPE_NUMERIC="numeric";static TYPE_LINE="line";static TYPE_BLOCK="block";static TYPE_DOUBLE="double";static TYPE_SINGLE="single";static TYPE_TEMPLATE="template";static TYPE_FUNCTION="function";static TYPE_OPERATOR="operator";keywordSet=null;keywordMap=new Map;constructor(e){this.grammar=e,this.compiledPatterns=this.precompilePatterns(e.patterns),this.numberRegex=/^(0x[0-9a-f]+|0b[01]+|0o[0-7]+|\d+(\.\d+)?(e[+-]?\d+)?)/i,this.isJsOrTs=e.scopeName==="source.js"||e.scopeName==="source.ts";let t=this.grammar.scopeName.split(".")[1]||"js";if(this.rootScopes=[this.grammar.scopeName],this.numericScopes=[this.grammar.scopeName,`constant.numeric.${t}`],this.operatorScopes=[this.grammar.scopeName,`keyword.operator.${t}`],this.commentScopes=[this.grammar.scopeName,`comment.line.double-slash.${t}`],this.blockCommentScopes=[this.grammar.scopeName,`comment.block.${t}`],this.stringScopes=[this.grammar.scopeName,`string.quoted.double.${t}`],this.templateScopes=[this.grammar.scopeName,`string.template.${t}`],this.functionScopes=[this.grammar.scopeName,`entity.name.function.${t}`],this.grammar.keywords){this.keywordSet=new Set(Object.keys(this.grammar.keywords));for(let[n,r]of Object.entries(this.grammar.keywords))if(typeof r==="string"){let o=[this.grammar.scopeName,r],a=r.lastIndexOf("."),s=a===-1?r:r.slice(a+1);this.keywordMap.set(n,{scopes:o,type:s})}}}tokenizeLine(e,t,n){this.scopeStack=n?[...n]:[{scopes:[this.grammar.scopeName],rule:null}];let r=[],o=0;while(o<e.length){let a=this.matchNextToken(e,o,t);if(a){if(a.tokens)r.push(...a.tokens);else if(a.token)r.push(a.token);o=a.offset}else{let s=this.scopeStack[this.scopeStack.length-1];r.push({type:O.TYPE_TEXT,content:e[o],scopes:s.scopes,line:t,offset:o}),o++}}return{tokens:r,line:t}}tokenize(e){let t=e.split(`
1370
- `),n=[],r;for(let o=0;o<t.length;o++){let a=this.tokenizeLine(t[o],o+1,r);n.push(a),r=this.scopeStack}return n}matchNextToken(e,t,n){let r=this.scopeStack[this.scopeStack.length-1];if(r.endPattern){r.endPattern.lastIndex=t;let a=r.endPattern.exec(e);if(a&&a.index===t){let s=a[0],c=r.scopes;return this.scopeStack.pop(),{token:{type:O.TYPE_PUNCTUATION,content:s,scopes:c,line:n,offset:t},offset:t+s.length}}}if(r.rule===null){let a=e.charCodeAt(t),s=$[a];if(s&32){let c=t+1;while(c<e.length&&$[e.charCodeAt(c)]&32)c++;return{token:null,offset:c}}if(s&8)return{token:{type:O.TYPE_PUNCTUATION,content:e[t],scopes:this.rootScopes,line:n,offset:t},offset:t+1};if(s&2){let c=t,i=!1,d=!1;if(e[t]==="0"&&t+1<e.length){let m=e.charCodeAt(t+1);if(m===120||m===88){c=t+2;while(c<e.length){let l=e.charCodeAt(c);if(!(l>=48&&l<=57||l>=65&&l<=70||l>=97&&l<=102))break;c++}}else if(m===98||m===66){c=t+2;while(c<e.length&&(e[c]==="0"||e[c]==="1"))c++}else if(m===111||m===79){c=t+2;while(c<e.length){let l=e.charCodeAt(c);if(!(l>=48&&l<=55))break;c++}}}if(c===t)while(c<e.length){let m=e.charCodeAt(c);if(m>=48&&m<=57)c++;else if(m===46&&!i&&!d)i=!0,c++;else if((m===101||m===69)&&!d){if(d=!0,c++,c<e.length&&(e[c]==="+"||e[c]==="-"))c++}else break}if(c>t){let m=e.slice(t,c);return{token:{type:O.TYPE_NUMERIC,content:m,scopes:this.numericScopes,line:n,offset:t},offset:c}}}if(a===47){let c=e.charCodeAt(t+1);if(c===47){let i=e.slice(t);return{token:{type:O.TYPE_LINE,content:i,scopes:this.commentScopes,line:n,offset:t},offset:e.length}}else if(c===42){let i=e.indexOf("*/",t+2);if(i!==-1){let d=e.slice(t,i+2);return{token:{type:O.TYPE_BLOCK,content:d,scopes:this.blockCommentScopes,line:n,offset:t},offset:i+2}}}}if(s&16){let c=a,i=t+1,d=!1;while(i<e.length){let m=e.charCodeAt(i);if(d)d=!1;else if(m===92)d=!0;else if(m===c)break;i++}if(i<e.length){let m=e.slice(t,i+1),l=c===96?O.TYPE_TEMPLATE:c===34?O.TYPE_DOUBLE:O.TYPE_SINGLE,u=c===96?this.templateScopes:this.stringScopes;return{token:{type:l,content:m,scopes:u,line:n,offset:t},offset:i+1}}}if(s&1&&(a!==36||this.isJsOrTs)){let c=t+1;while(c<e.length){let m=e.charCodeAt(c);if(!($[m]&3))break;c++}let i=e.slice(t,c);if(this.keywordSet&&this.keywordSet.has(i)){let m=this.keywordMap.get(i);return{token:{type:m.type,content:i,scopes:m.scopes,line:n,offset:t},offset:c}}let d=c;while(d<e.length&&$[e.charCodeAt(d)]&32)d++;if(e.charCodeAt(d)===40)return{token:{type:O.TYPE_FUNCTION,content:i,scopes:this.functionScopes,line:n,offset:t},offset:c};return{token:{type:O.TYPE_TEXT,content:i,scopes:this.rootScopes,line:n,offset:t},offset:c}}if(this.isJsOrTs&&s&4){let c=1,i=a,d=e.charCodeAt(t+1),m=e.charCodeAt(t+2);if(t+2<e.length){if(i===61&&d===61&&m===61||i===33&&d===61&&m===61||i===62&&d===62&&m===62||i===46&&d===46&&m===46)c=3}if(c===1&&t+1<e.length){if(i===43&&d===43||i===45&&d===45||i===61&&d===61||i===33&&d===61||i===60&&d===61||i===62&&d===61||i===38&&d===38||i===124&&d===124||i===61&&d===62||i===60&&d===60||i===62&&d===62)c=2}let l=e.slice(t,t+c);return{token:{type:O.TYPE_OPERATOR,content:l,scopes:this.operatorScopes,line:n,offset:t},offset:t+c}}}let o=r.rule?.patterns||this.compiledPatterns;for(let a of o){let s=this.matchPattern(a,e,t,n);if(s)return s}return null}precompilePatterns(e){return e.map((t)=>{let n={...t};if(t.match)n._compiledMatch=new RegExp(t.match,"g");if(t.begin)n._compiledBegin=new RegExp(t.begin,"g");if(t.end)n._compiledEnd=new RegExp(t.end,"g");if(t.patterns)n.patterns=this.precompilePatterns(t.patterns);return n})}getRegex(e){let t=this.regexCache.get(e);if(!t)t=new RegExp(e,"g"),this.regexCache.set(e,t);return t}matchPattern(e,t,n,r){if(e.include)return this.handleInclude(e.include,t,n,r);let o=e;if(e.begin){let a=o._compiledBegin||this.getRegex(e.begin);a.lastIndex=n;let s=a.exec(t);if(s&&s.index===n){let c=s[0],i=this.scopeStack[this.scopeStack.length-1],d=e.name?[...i.scopes,e.name]:i.scopes,m=o._compiledEnd||(e.end?this.getRegex(e.end):void 0);if(this.scopeStack.push({scopes:d,rule:e,endPattern:m}),e.beginCaptures){let u=this.applyCaptureGroups(s,e.beginCaptures,i.scopes,r,n);if(u&&u.length>0)return{token:null,tokens:u,offset:n+c.length}}let l=O.TYPE_TEXT;if(e.name&&typeof e.name==="string"){let u=e.name.lastIndexOf(".");l=u===-1?e.name:e.name.slice(u+1)}return{token:{type:l,content:c,scopes:d,line:r,offset:n},offset:n+c.length}}}if(e.match){let a=o._compiledMatch||this.getRegex(e.match);a.lastIndex=n;let s=a.exec(t);if(s&&s.index===n){let c=s[0],i=this.scopeStack[this.scopeStack.length-1];if(e.captures&&!e.name){let l=this.applyCaptureGroups(s,e.captures,i.scopes,r,n);if(l&&l.length>0)return{token:null,tokens:l,offset:n+c.length}}let d=e.name?[...i.scopes,e.name]:i.scopes,m=O.TYPE_TEXT;if(e.name&&typeof e.name==="string"){let l=e.name.lastIndexOf(".");m=l===-1?e.name:e.name.slice(l+1)}return{token:{type:m,content:c,scopes:d,line:r,offset:n},offset:n+c.length}}}return null}applyCaptureGroups(e,t,n,r,o){let a=[],s=0;for(let c=0;c<e.length;c++){let i=e[c];if(i===void 0)continue;let d=c.toString(),m=t[d];if(c===0)continue;let l=e[0].indexOf(i,s);if(l===-1)continue;if(l>s){let f=e[0].substring(s,l);a.push({type:O.TYPE_TEXT,content:f,scopes:n,line:r,offset:o+s})}let u=m&&m.name?[...n,m.name]:n,p=O.TYPE_TEXT;if(m&&m.name){let f=m.name.lastIndexOf(".");p=f===-1?m.name:m.name.slice(f+1)}a.push({type:p,content:i,scopes:u,line:r,offset:o+l}),s=l+i.length}if(s<e[0].length){let c=e[0].substring(s);a.push({type:O.TYPE_TEXT,content:c,scopes:n,line:r,offset:o+s})}return a.length>0?a:null}handleInclude(e,t,n,r){if(e==="$self"){for(let o of this.grammar.patterns){let a=this.matchPattern(o,t,n,r);if(a)return a}return null}if(e.startsWith("#")){let o=e.slice(1),a=this.grammar.repository?.[o];if(a&&a.patterns)for(let s of a.patterns){let c=this.matchPattern(s,t,n,r);if(c)return c}}return null}getTokenType(e){if(!e||typeof e!=="string")return"text";let t=e.split(".");return t[t.length-1]||"text"}getScopeStack(){return this.scopeStack}}class or{config;languages=new Map;themes=new Map;cache=new Map;plugins=[];constructor(e){this.config=e,this.initializeDefaults()}initializeDefaults(){for(let e of tr)if(this.languages.set(e.id,e),e.aliases)for(let t of e.aliases)this.languages.set(t,e);for(let e of rr)this.themes.set(e.name.toLowerCase(),e);if(this.config.plugins)for(let e of this.config.plugins)this.loadPlugin(e)}async loadPlugin(e){if(this.plugins.push(e),e.languages)for(let t of e.languages)await this.loadLanguage(t);if(e.themes)for(let t of e.themes)await this.loadTheme(t)}highlightSync(e,t,n={}){let r=this.getLanguageById(t);if(!r)throw Error(`Language "${t}" not found. Available languages: ${this.getSupportedLanguages().join(", ")}`);let o=this.getCacheKey(e,t,n);if(this.config.cache){let c=this.cache.get(o);if(c){let i=this.resolveTheme(n.theme);return new Ot(i).render(c.tokens,n)}}let a=new O(r.grammar).tokenize(e);for(let c of this.plugins)if(c.transformers)for(let i of c.transformers)a=i.transform(a);if(this.config.cache)this.cache.set(o,{tokens:a,timestamp:Date.now(),hash:o});let s=this.resolveTheme(n.theme);return new Ot(s).render(a,n)}async highlight(e,t,n={}){return this.highlightSync(e,t,n)}highlightFast(e,t){let n=this.getLanguageById(t);if(!n)throw Error(`Language "${t}" not found. Available languages: ${this.getSupportedLanguages().join(", ")}`);return new nr(n.grammar).tokenize(e)}async loadLanguage(e){if(this.languages.set(e.id,e),e.aliases)for(let t of e.aliases)this.languages.set(t,e)}async loadTheme(e){this.themes.set(e.name.toLowerCase(),e)}getSupportedLanguages(){let e=new Set;for(let[t,n]of this.languages.entries())if(t===n.id)e.add(n.id);return Array.from(e)}getSupportedThemes(){return Array.from(this.themes.keys())}getLanguageById(e){return this.languages.get(e)||Qa(e)}resolveTheme(e){if(!e)return this.resolveTheme(this.config.theme);if(typeof e==="string"){let t=this.themes.get(e.toLowerCase());if(!t){let n=e.replace(/-/g," ");t=this.themes.get(n.toLowerCase())}if(!t)t=Ka(e);if(!t)throw Error(`Theme "${e}" not found. Available themes: ${this.getSupportedThemes().join(", ")}`);return t}return e}getCacheKey(e,t,n){let r=JSON.stringify(n);return`${t}:${this.hashCode(e+r)}`}hashCode(e){let t=0;for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);t=(t<<5)-t+r,t=t&t}return t.toString(36)}clearCache(){this.cache.clear()}getCacheSize(){return this.cache.size}}async function It(e={}){let t={...{verbose:!1,theme:"github-dark",cache:!0,plugins:[]},...e};return new or(t)}class ar{entries=[];timers=new Map;enabled;constructor(e=!1){this.enabled=e}start(e){if(!this.enabled)return;this.timers.set(e,performance.now())}end(e){if(!this.enabled)return;let t=this.timers.get(e);if(!t)return;let n=performance.now()-t;this.timers.delete(e),this.entries.push({name:e,duration:n,timestamp:Date.now()})}async measure(e,t){this.start(e);try{let n=await t();return this.end(e),n}catch(n){throw this.end(e),n}}getEntries(){return[...this.entries]}getStats(){let e=new Map;for(let n of this.entries){let r=e.get(n.name)||[];r.push(n.duration),e.set(n.name,r)}let t={};for(let[n,r]of e){let o=r.reduce((a,s)=>a+s,0);t[n]={count:r.length,total:o,avg:o/r.length,min:Math.min(...r),max:Math.max(...r)}}return t}clear(){this.entries=[],this.timers.clear()}enable(){this.enabled=!0}disable(){this.enabled=!1}report(){let e=this.getStats();console.log(`
1375
+ `)}setTheme(e){this.theme=e,this.colorCache.clear(),this.cssCache=null}}var $=new Uint8Array(256);for(let e=65;e<=90;e++)$[e]=1;for(let e=97;e<=122;e++)$[e]=1;$[95]=1;$[36]=1;for(let e=48;e<=57;e++)$[e]=2;$[43]=4;$[45]=4;$[42]=4;$[47]=4;$[61]=4;$[33]=4;$[60]=4;$[62]=4;$[38]=4;$[124]=4;$[37]=4;$[63]=4;$[58]=4;$[46]=4;$[123]=8;$[125]=8;$[40]=8;$[41]=8;$[91]=8;$[93]=8;$[59]=8;$[44]=8;$[34]=16;$[39]=16;$[96]=16;$[32]=32;$[9]=32;$[10]=32;$[13]=32;class or{keywordSet=null;isJsOrTs;isHtml;isCss;constructor(e){if(this.isJsOrTs=e.scopeName==="source.js"||e.scopeName==="source.ts",this.isHtml=e.scopeName==="text.html.basic",this.isCss=e.scopeName==="source.css",e.keywords)this.keywordSet=new Set(Object.keys(e.keywords))}tokenize(e){let t=e.split(`
1376
+ `),n=[];for(let r=0;r<t.length;r++)n.push(this.tokenizeLine(t[r]));return n}tokenizeLine(e){let t=[],n=0;while(n<e.length){let r=e.charCodeAt(n),o=$[r];if(o&32){n++;continue}if(o&2){let a=n;n=this.scanNumber(e,n),t.push({type:"numeric",content:e.slice(a,n)});continue}if(this.isHtml&&r===60){let a=n;if(n++,e.charCodeAt(n)===47)n++;while(n<e.length&&$[e.charCodeAt(n)]&1)n++;while(n<e.length&&e.charCodeAt(n)!==62)n++;if(e.charCodeAt(n)===62)n++;t.push({type:"tag",content:e.slice(a,n)});continue}if(this.isCss){if(r===46||r===35||o&1){let a=n;while(n<e.length){let i=e.charCodeAt(n);if(i===123||i===58||i===59)break;n++}let s=e.slice(a,n),c=s.includes(":")?"property":"selector";t.push({type:c,content:s});continue}}if(!this.isHtml&&r===47){let a=e.charCodeAt(n+1);if(a===47){t.push({type:"comment",content:e.slice(n)});break}else if(a===42){let s=e.indexOf("*/",n+2);if(s!==-1){t.push({type:"comment",content:e.slice(n,s+2)}),n=s+2;continue}}}if(this.isHtml&&r===60&&e.charCodeAt(n+1)===33){let a=e.indexOf("-->",n+4);if(a!==-1){t.push({type:"comment",content:e.slice(n,a+3)}),n=a+3;continue}}if(o&16){let a=n;if(n=this.scanString(e,n,r),n>a){t.push({type:"string",content:e.slice(a,n)});continue}}if(o&1){let a=n;n=this.scanWord(e,n);let s=e.slice(a,n);if(this.isJsOrTs&&e.charCodeAt(n)===40){t.push({type:"function",content:s});continue}let c=this.keywordSet&&this.keywordSet.has(s)?"keyword":"text";t.push({type:c,content:s});continue}if(this.isJsOrTs&&o&4){let a=n;n=this.scanOperator(e,n,r),t.push({type:"operator",content:e.slice(a,n)});continue}if(o&8){t.push({type:"punctuation",content:e[n]}),n++;continue}t.push({type:"text",content:e[n]}),n++}return{tokens:t}}scanNumber(e,t){let n=t,r=!1,o=!1;if(e[t]==="0"&&t+1<e.length){let a=e.charCodeAt(t+1);if(a===120||a===88){n=t+2;while(n<e.length){let s=e.charCodeAt(n);if(!(s>=48&&s<=57||s>=65&&s<=70||s>=97&&s<=102))break;n++}return n}else if(a===98||a===66){n=t+2;while(n<e.length&&(e[n]==="0"||e[n]==="1"))n++;return n}else if(a===111||a===79){n=t+2;while(n<e.length){let s=e.charCodeAt(n);if(!(s>=48&&s<=55))break;n++}return n}}while(n<e.length){let a=e.charCodeAt(n);if(a>=48&&a<=57)n++;else if(a===46&&!r&&!o)r=!0,n++;else if((a===101||a===69)&&!o){if(o=!0,n++,n<e.length&&(e[n]==="+"||e[n]==="-"))n++}else break}return n}scanString(e,t,n){let r=t+1,o=!1;while(r<e.length){let a=e.charCodeAt(r);if(o)o=!1;else if(a===92)o=!0;else if(a===n)return r+1;r++}return r}scanWord(e,t){let n=t+1;while(n<e.length){let r=e.charCodeAt(n);if(!($[r]&3))break;n++}return n}scanOperator(e,t,n){if(t+1>=e.length)return t+1;let r=e.charCodeAt(t+1);if(t+2<e.length){let o=e.charCodeAt(t+2);if(n===61&&r===61&&o===61||n===33&&r===61&&o===61||n===62&&r===62&&o===62||n===46&&r===46&&o===46)return t+3}if(n===43&&r===43||n===45&&r===45||n===61&&r===61||n===33&&r===61||n===60&&r===61||n===62&&r===61||n===38&&r===38||n===124&&r===124||n===61&&r===62||n===60&&r===60||n===62&&r===62)return t+2;return t+1}}var Da={name:"GitHub Dark",type:"dark",colors:{"editor.background":"#0d1117","editor.foreground":"#c9d1d9","editor.lineHighlightBackground":"#161b22","editor.selectionBackground":"#264f78"},tokenColors:[{name:"Comment",scope:["comment","comment.line","comment.block"],settings:{foreground:"#8b949e",fontStyle:"italic"}},{name:"String",scope:["string","string.quoted"],settings:{foreground:"#a5d6ff"}},{name:"Template String",scope:["string.template"],settings:{foreground:"#a5d6ff"}},{name:"Number",scope:["constant.numeric"],settings:{foreground:"#79c0ff"}},{name:"Keyword",scope:["keyword","keyword.control","keyword.operator"],settings:{foreground:"#ff7b72"}},{name:"Storage Type",scope:["storage.type","storage.modifier"],settings:{foreground:"#ff7b72"}},{name:"Function",scope:["entity.name.function","support.function"],settings:{foreground:"#d2a8ff"}},{name:"Class",scope:["entity.name.type","entity.name.class"],settings:{foreground:"#ffa657"}},{name:"Variable",scope:["variable","variable.other"],settings:{foreground:"#ffa657"}},{name:"Constant",scope:["constant.language","constant.character"],settings:{foreground:"#79c0ff"}},{name:"Tag",scope:["entity.name.tag"],settings:{foreground:"#7ee787"}},{name:"Attribute",scope:["entity.other.attribute-name"],settings:{foreground:"#79c0ff"}},{name:"Punctuation",scope:["punctuation"],settings:{foreground:"#c9d1d9"}},{name:"Operator",scope:["keyword.operator"],settings:{foreground:"#ff7b72"}},{name:"CSS Property",scope:["support.type.property-name.css"],settings:{foreground:"#79c0ff"}},{name:"CSS Value",scope:["support.constant.property-value.css"],settings:{foreground:"#a5d6ff"}},{name:"Color",scope:["constant.other.color"],settings:{foreground:"#a5d6ff"}}]},Ha={name:"GitHub Light",type:"light",colors:{"editor.background":"#ffffff","editor.foreground":"#24292f","editor.lineHighlightBackground":"#f6f8fa","editor.selectionBackground":"#b6d4fe"},tokenColors:[{name:"Comment",scope:["comment","comment.line","comment.block"],settings:{foreground:"#6e7781",fontStyle:"italic"}},{name:"String",scope:["string","string.quoted"],settings:{foreground:"#0a3069"}},{name:"Template String",scope:["string.template"],settings:{foreground:"#0a3069"}},{name:"Number",scope:["constant.numeric"],settings:{foreground:"#0550ae"}},{name:"Keyword",scope:["keyword","keyword.control","keyword.operator"],settings:{foreground:"#cf222e"}},{name:"Storage Type",scope:["storage.type","storage.modifier"],settings:{foreground:"#cf222e"}},{name:"Function",scope:["entity.name.function","support.function"],settings:{foreground:"#8250df"}},{name:"Class",scope:["entity.name.type","entity.name.class"],settings:{foreground:"#953800"}},{name:"Variable",scope:["variable","variable.other"],settings:{foreground:"#953800"}},{name:"Constant",scope:["constant.language","constant.character"],settings:{foreground:"#0550ae"}},{name:"Tag",scope:["entity.name.tag"],settings:{foreground:"#116329"}},{name:"Attribute",scope:["entity.other.attribute-name"],settings:{foreground:"#0550ae"}},{name:"Punctuation",scope:["punctuation"],settings:{foreground:"#24292f"}},{name:"Operator",scope:["keyword.operator"],settings:{foreground:"#cf222e"}},{name:"CSS Property",scope:["support.type.property-name.css"],settings:{foreground:"#0550ae"}},{name:"CSS Value",scope:["support.constant.property-value.css"],settings:{foreground:"#0a3069"}},{name:"Color",scope:["constant.other.color"],settings:{foreground:"#0a3069"}}]},Va={name:"Nord",type:"dark",colors:{"editor.background":"#2e3440","editor.foreground":"#d8dee9","editor.lineHighlightBackground":"#3b4252","editor.selectionBackground":"#434c5e"},tokenColors:[{name:"Comment",scope:["comment","comment.line","comment.block"],settings:{foreground:"#616e88",fontStyle:"italic"}},{name:"String",scope:["string","string.quoted"],settings:{foreground:"#a3be8c"}},{name:"Template String",scope:["string.template"],settings:{foreground:"#a3be8c"}},{name:"Number",scope:["constant.numeric"],settings:{foreground:"#b48ead"}},{name:"Keyword",scope:["keyword","keyword.control","keyword.operator"],settings:{foreground:"#81a1c1"}},{name:"Storage Type",scope:["storage.type","storage.modifier"],settings:{foreground:"#81a1c1"}},{name:"Function",scope:["entity.name.function","support.function"],settings:{foreground:"#88c0d0"}},{name:"Class",scope:["entity.name.type","entity.name.class"],settings:{foreground:"#8fbcbb"}},{name:"Variable",scope:["variable","variable.other"],settings:{foreground:"#d8dee9"}},{name:"Constant",scope:["constant.language","constant.character"],settings:{foreground:"#b48ead"}},{name:"Tag",scope:["entity.name.tag"],settings:{foreground:"#81a1c1"}},{name:"Attribute",scope:["entity.other.attribute-name"],settings:{foreground:"#8fbcbb"}},{name:"Punctuation",scope:["punctuation"],settings:{foreground:"#eceff4"}},{name:"Operator",scope:["keyword.operator"],settings:{foreground:"#81a1c1"}},{name:"CSS Property",scope:["support.type.property-name.css"],settings:{foreground:"#8fbcbb"}},{name:"CSS Value",scope:["support.constant.property-value.css"],settings:{foreground:"#a3be8c"}},{name:"Color",scope:["constant.other.color"],settings:{foreground:"#b48ead"}}]},ar=[Da,Ha,Va];function Pa(e){let t=e.toLowerCase();return ar.find((n)=>{let r=n.name.toLowerCase(),o=r.replace(/\s+/g,"-");return r===t||o===t})}var A=new Uint8Array(256);for(let e=65;e<=90;e++)A[e]=1;for(let e=97;e<=122;e++)A[e]=1;A[95]=1;A[36]=1;for(let e=48;e<=57;e++)A[e]=2;A[43]=4;A[45]=4;A[42]=4;A[47]=4;A[61]=4;A[33]=4;A[60]=4;A[62]=4;A[38]=4;A[124]=4;A[37]=4;A[63]=4;A[58]=4;A[46]=4;A[123]=8;A[125]=8;A[40]=8;A[41]=8;A[91]=8;A[93]=8;A[59]=8;A[44]=8;A[34]=16;A[39]=16;A[96]=16;A[32]=32;A[9]=32;A[10]=32;A[13]=32;class O{grammar;scopeStack=[];regexCache=new Map;compiledPatterns;numberRegex;isJsOrTs;rootScopes;numericScopes;operatorScopes;commentScopes;blockCommentScopes;stringScopes;templateScopes;functionScopes;static TYPE_TEXT="text";static TYPE_PUNCTUATION="punctuation";static TYPE_NUMERIC="numeric";static TYPE_LINE="line";static TYPE_BLOCK="block";static TYPE_DOUBLE="double";static TYPE_SINGLE="single";static TYPE_TEMPLATE="template";static TYPE_FUNCTION="function";static TYPE_OPERATOR="operator";keywordSet=null;keywordMap=new Map;constructor(e){this.grammar=e,this.compiledPatterns=this.precompilePatterns(e.patterns),this.numberRegex=/^(0x[0-9a-f]+|0b[01]+|0o[0-7]+|\d+(\.\d+)?(e[+-]?\d+)?)/i,this.isJsOrTs=e.scopeName==="source.js"||e.scopeName==="source.ts";let t=this.grammar.scopeName.split(".")[1]||"js";if(this.rootScopes=[this.grammar.scopeName],this.numericScopes=[this.grammar.scopeName,`constant.numeric.${t}`],this.operatorScopes=[this.grammar.scopeName,`keyword.operator.${t}`],this.commentScopes=[this.grammar.scopeName,`comment.line.double-slash.${t}`],this.blockCommentScopes=[this.grammar.scopeName,`comment.block.${t}`],this.stringScopes=[this.grammar.scopeName,`string.quoted.double.${t}`],this.templateScopes=[this.grammar.scopeName,`string.template.${t}`],this.functionScopes=[this.grammar.scopeName,`entity.name.function.${t}`],this.grammar.keywords){this.keywordSet=new Set(Object.keys(this.grammar.keywords));for(let[n,r]of Object.entries(this.grammar.keywords))if(typeof r==="string"){let o=[this.grammar.scopeName,r],a=r.lastIndexOf("."),s=a===-1?r:r.slice(a+1);this.keywordMap.set(n,{scopes:o,type:s})}}}tokenizeLine(e,t,n){this.scopeStack=n?[...n]:[{scopes:[this.grammar.scopeName],rule:null}];let r=[],o=0;while(o<e.length){let a=this.matchNextToken(e,o,t);if(a){if(a.tokens)r.push(...a.tokens);else if(a.token)r.push(a.token);o=a.offset}else{let s=this.scopeStack[this.scopeStack.length-1];r.push({type:O.TYPE_TEXT,content:e[o],scopes:s.scopes,line:t,offset:o}),o++}}return{tokens:r,line:t}}tokenize(e){let t=e.split(`
1377
+ `),n=[],r;for(let o=0;o<t.length;o++){let a=this.tokenizeLine(t[o],o+1,r);n.push(a),r=this.scopeStack}return n}matchNextToken(e,t,n){let r=this.scopeStack[this.scopeStack.length-1];if(r.endPattern){r.endPattern.lastIndex=t;let a=r.endPattern.exec(e);if(a&&a.index===t){let s=a[0],c=r.scopes;return this.scopeStack.pop(),{token:{type:O.TYPE_PUNCTUATION,content:s,scopes:c,line:n,offset:t},offset:t+s.length}}}if(r.rule===null){let a=e.charCodeAt(t),s=A[a];if(s&32){let c=t+1;while(c<e.length&&A[e.charCodeAt(c)]&32)c++;return{token:null,offset:c}}if(s&8)return{token:{type:O.TYPE_PUNCTUATION,content:e[t],scopes:this.rootScopes,line:n,offset:t},offset:t+1};if(s&2){let c=t,i=!1,d=!1;if(e[t]==="0"&&t+1<e.length){let l=e.charCodeAt(t+1);if(l===120||l===88){c=t+2;while(c<e.length){let m=e.charCodeAt(c);if(!(m>=48&&m<=57||m>=65&&m<=70||m>=97&&m<=102))break;c++}}else if(l===98||l===66){c=t+2;while(c<e.length&&(e[c]==="0"||e[c]==="1"))c++}else if(l===111||l===79){c=t+2;while(c<e.length){let m=e.charCodeAt(c);if(!(m>=48&&m<=55))break;c++}}}if(c===t)while(c<e.length){let l=e.charCodeAt(c);if(l>=48&&l<=57)c++;else if(l===46&&!i&&!d)i=!0,c++;else if((l===101||l===69)&&!d){if(d=!0,c++,c<e.length&&(e[c]==="+"||e[c]==="-"))c++}else break}if(c>t){let l=e.slice(t,c);return{token:{type:O.TYPE_NUMERIC,content:l,scopes:this.numericScopes,line:n,offset:t},offset:c}}}if(a===47){let c=e.charCodeAt(t+1);if(c===47){let i=e.slice(t);return{token:{type:O.TYPE_LINE,content:i,scopes:this.commentScopes,line:n,offset:t},offset:e.length}}else if(c===42){let i=e.indexOf("*/",t+2);if(i!==-1){let d=e.slice(t,i+2);return{token:{type:O.TYPE_BLOCK,content:d,scopes:this.blockCommentScopes,line:n,offset:t},offset:i+2}}}}if(s&16){let c=a,i=t+1,d=!1;while(i<e.length){let l=e.charCodeAt(i);if(d)d=!1;else if(l===92)d=!0;else if(l===c)break;i++}if(i<e.length){let l=e.slice(t,i+1),m=c===96?O.TYPE_TEMPLATE:c===34?O.TYPE_DOUBLE:O.TYPE_SINGLE,u=c===96?this.templateScopes:this.stringScopes;return{token:{type:m,content:l,scopes:u,line:n,offset:t},offset:i+1}}}if(s&1&&(a!==36||this.isJsOrTs)){let c=t+1;while(c<e.length){let l=e.charCodeAt(c);if(!(A[l]&3))break;c++}let i=e.slice(t,c);if(this.keywordSet&&this.keywordSet.has(i)){let l=this.keywordMap.get(i);return{token:{type:l.type,content:i,scopes:l.scopes,line:n,offset:t},offset:c}}let d=c;while(d<e.length&&A[e.charCodeAt(d)]&32)d++;if(e.charCodeAt(d)===40)return{token:{type:O.TYPE_FUNCTION,content:i,scopes:this.functionScopes,line:n,offset:t},offset:c};return{token:{type:O.TYPE_TEXT,content:i,scopes:this.rootScopes,line:n,offset:t},offset:c}}if(this.isJsOrTs&&s&4){let c=1,i=a,d=e.charCodeAt(t+1),l=e.charCodeAt(t+2);if(t+2<e.length){if(i===61&&d===61&&l===61||i===33&&d===61&&l===61||i===62&&d===62&&l===62||i===46&&d===46&&l===46)c=3}if(c===1&&t+1<e.length){if(i===43&&d===43||i===45&&d===45||i===61&&d===61||i===33&&d===61||i===60&&d===61||i===62&&d===61||i===38&&d===38||i===124&&d===124||i===61&&d===62||i===60&&d===60||i===62&&d===62)c=2}let m=e.slice(t,t+c);return{token:{type:O.TYPE_OPERATOR,content:m,scopes:this.operatorScopes,line:n,offset:t},offset:t+c}}}let o=r.rule?.patterns||this.compiledPatterns;for(let a of o){let s=this.matchPattern(a,e,t,n);if(s)return s}return null}precompilePatterns(e){return e.map((t)=>{let n={...t};if(t.match)n._compiledMatch=new RegExp(t.match,"g");if(t.begin)n._compiledBegin=new RegExp(t.begin,"g");if(t.end)n._compiledEnd=new RegExp(t.end,"g");if(t.patterns)n.patterns=this.precompilePatterns(t.patterns);return n})}getRegex(e){let t=this.regexCache.get(e);if(!t)t=new RegExp(e,"g"),this.regexCache.set(e,t);return t}matchPattern(e,t,n,r){if(e.include)return this.handleInclude(e.include,t,n,r);let o=e;if(e.begin){let a=o._compiledBegin||this.getRegex(e.begin);a.lastIndex=n;let s=a.exec(t);if(s&&s.index===n){let c=s[0],i=this.scopeStack[this.scopeStack.length-1],d=e.name?[...i.scopes,e.name]:i.scopes,l=o._compiledEnd||(e.end?this.getRegex(e.end):void 0);if(this.scopeStack.push({scopes:d,rule:e,endPattern:l}),e.beginCaptures){let u=this.applyCaptureGroups(s,e.beginCaptures,i.scopes,r,n);if(u&&u.length>0)return{token:null,tokens:u,offset:n+c.length}}let m=O.TYPE_TEXT;if(e.name&&typeof e.name==="string"){let u=e.name.lastIndexOf(".");m=u===-1?e.name:e.name.slice(u+1)}return{token:{type:m,content:c,scopes:d,line:r,offset:n},offset:n+c.length}}}if(e.match){let a=o._compiledMatch||this.getRegex(e.match);a.lastIndex=n;let s=a.exec(t);if(s&&s.index===n){let c=s[0],i=this.scopeStack[this.scopeStack.length-1];if(e.captures&&!e.name){let m=this.applyCaptureGroups(s,e.captures,i.scopes,r,n);if(m&&m.length>0)return{token:null,tokens:m,offset:n+c.length}}let d=e.name?[...i.scopes,e.name]:i.scopes,l=O.TYPE_TEXT;if(e.name&&typeof e.name==="string"){let m=e.name.lastIndexOf(".");l=m===-1?e.name:e.name.slice(m+1)}return{token:{type:l,content:c,scopes:d,line:r,offset:n},offset:n+c.length}}}return null}applyCaptureGroups(e,t,n,r,o){let a=[],s=0;for(let c=0;c<e.length;c++){let i=e[c];if(i===void 0)continue;let d=c.toString(),l=t[d];if(c===0)continue;let m=e[0].indexOf(i,s);if(m===-1)continue;if(m>s){let h=e[0].substring(s,m);a.push({type:O.TYPE_TEXT,content:h,scopes:n,line:r,offset:o+s})}let u=l&&l.name?[...n,l.name]:n,p=O.TYPE_TEXT;if(l&&l.name){let h=l.name.lastIndexOf(".");p=h===-1?l.name:l.name.slice(h+1)}a.push({type:p,content:i,scopes:u,line:r,offset:o+m}),s=m+i.length}if(s<e[0].length){let c=e[0].substring(s);a.push({type:O.TYPE_TEXT,content:c,scopes:n,line:r,offset:o+s})}return a.length>0?a:null}handleInclude(e,t,n,r){if(e==="$self"){for(let o of this.grammar.patterns){let a=this.matchPattern(o,t,n,r);if(a)return a}return null}if(e.startsWith("#")){let o=e.slice(1),a=this.grammar.repository?.[o];if(a&&a.patterns)for(let s of a.patterns){let c=this.matchPattern(s,t,n,r);if(c)return c}}return null}getTokenType(e){if(!e||typeof e!=="string")return"text";let t=e.split(".");return t[t.length-1]||"text"}getScopeStack(){return this.scopeStack}}class sr{config;languages=new Map;themes=new Map;cache=new Map;plugins=[];constructor(e){this.config=e,this.initializeDefaults()}initializeDefaults(){for(let e of rr)if(this.languages.set(e.id,e),e.aliases)for(let t of e.aliases)this.languages.set(t,e);for(let e of ar)this.themes.set(e.name.toLowerCase(),e);if(this.config.plugins)for(let e of this.config.plugins)this.loadPlugin(e)}async loadPlugin(e){if(this.plugins.push(e),e.languages)for(let t of e.languages)await this.loadLanguage(t);if(e.themes)for(let t of e.themes)await this.loadTheme(t)}highlightSync(e,t,n={}){let r=this.getLanguageById(t);if(!r)throw Error(`Language "${t}" not found. Available languages: ${this.getSupportedLanguages().join(", ")}`);let o=this.getCacheKey(e,t,n);if(this.config.cache){let c=this.cache.get(o);if(c){let i=this.resolveTheme(n.theme);return new St(i).render(c.tokens,n)}}let a=new O(r.grammar).tokenize(e);for(let c of this.plugins)if(c.transformers)for(let i of c.transformers)a=i.transform(a);if(this.config.cache)this.cache.set(o,{tokens:a,timestamp:Date.now(),hash:o});let s=this.resolveTheme(n.theme);return new St(s).render(a,n)}async highlight(e,t,n={}){return this.highlightSync(e,t,n)}highlightFast(e,t){let n=this.getLanguageById(t);if(!n)throw Error(`Language "${t}" not found. Available languages: ${this.getSupportedLanguages().join(", ")}`);return new or(n.grammar).tokenize(e)}async loadLanguage(e){if(this.languages.set(e.id,e),e.aliases)for(let t of e.aliases)this.languages.set(t,e)}async loadTheme(e){this.themes.set(e.name.toLowerCase(),e)}getSupportedLanguages(){let e=new Set;for(let[t,n]of this.languages.entries())if(t===n.id)e.add(n.id);return Array.from(e)}getSupportedThemes(){return Array.from(this.themes.keys())}getLanguageById(e){return this.languages.get(e)||Ka(e)}resolveTheme(e){if(!e)return this.resolveTheme(this.config.theme);if(typeof e==="string"){let t=this.themes.get(e.toLowerCase());if(!t){let n=e.replace(/-/g," ");t=this.themes.get(n.toLowerCase())}if(!t)t=Pa(e);if(!t)throw Error(`Theme "${e}" not found. Available themes: ${this.getSupportedThemes().join(", ")}`);return t}return e}getCacheKey(e,t,n){let r=JSON.stringify(n);return`${t}:${this.hashCode(e+r)}`}hashCode(e){let t=0;for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);t=(t<<5)-t+r,t=t&t}return t.toString(36)}clearCache(){this.cache.clear()}getCacheSize(){return this.cache.size}}async function Xt(e={}){let t={...{verbose:!1,theme:"github-dark",cache:!0,plugins:[]},...e};return new sr(t)}class ir{entries=[];timers=new Map;enabled;constructor(e=!1){this.enabled=e}start(e){if(!this.enabled)return;this.timers.set(e,performance.now())}end(e){if(!this.enabled)return;let t=this.timers.get(e);if(!t)return;let n=performance.now()-t;this.timers.delete(e),this.entries.push({name:e,duration:n,timestamp:Date.now()})}async measure(e,t){this.start(e);try{let n=await t();return this.end(e),n}catch(n){throw this.end(e),n}}getEntries(){return[...this.entries]}getStats(){let e=new Map;for(let n of this.entries){let r=e.get(n.name)||[];r.push(n.duration),e.set(n.name,r)}let t={};for(let[n,r]of e){let o=r.reduce((a,s)=>a+s,0);t[n]={count:r.length,total:o,avg:o/r.length,min:Math.min(...r),max:Math.max(...r)}}return t}clear(){this.entries=[],this.timers.clear()}enable(){this.enabled=!0}disable(){this.enabled=!1}report(){let e=this.getStats();console.log(`
1371
1378
  === Performance Report ===
1372
- `);for(let[t,n]of Object.entries(e))console.log(`${t}:`),console.log(` Count: ${n.count}`),console.log(` Total: ${n.total.toFixed(2)}ms`),console.log(` Avg: ${n.avg.toFixed(2)}ms`),console.log(` Min: ${n.min.toFixed(2)}ms`),console.log(` Max: ${n.max.toFixed(2)}ms`),console.log()}}var ld=new ar(!1);async function sr(e,t,n={}){return(await It({theme:n.theme||Gt.theme,cache:Gt.cache,verbose:Gt.verbose})).highlight(e,t,n)}var je=null;function yd(){je=null}async function ir(){if(je)return je;return je=await It({theme:"github-light",cache:!0}),je}var Da={js:"javascript",ts:"typescript",jsx:"javascript",tsx:"typescript",htm:"html",sh:"bash",shell:"bash",zsh:"bash"};function Jt(e){let t=e.toLowerCase().trim();return Da[t]||t}function cr(e){let t=Jt(e);return["javascript","typescript","html","css","json","stx","bash"].includes(t)}function nt(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function Ha(e,t){let n=/<span[^>]*class="token[^"]*"[^>]*>([^<]*)<\/span>/g,r=[],o;while((o=n.exec(t))!==null){let i=o[1].replace(/&amp;/g,"&").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#0*39;/g,"'");if(i)r.push({text:i,span:o[0]})}if(r.length===0)return t;let a="",s=0,c=e.match(/^(\s*)/);if(c&&c[1])a+=c[1],s=c[1].length;for(let i=0;i<r.length;i++){let{text:d,span:m}=r[i],l=e.indexOf(d,s);if(l===-1){a+=m;continue}if(l>s){let u=e.substring(s,l);if(/^\s+$/.test(u))a+=u}a+=m,s=l+d.length}return a}async function Ct(e,t,n="github-light"){let r=Jt(t);if(!cr(r))return e.split(`
1373
- `).map((a)=>`<span class="line">${nt(a)}</span>`).join(`
1379
+ `);for(let[t,n]of Object.entries(e))console.log(`${t}:`),console.log(` Count: ${n.count}`),console.log(` Total: ${n.total.toFixed(2)}ms`),console.log(` Avg: ${n.avg.toFixed(2)}ms`),console.log(` Min: ${n.min.toFixed(2)}ms`),console.log(` Max: ${n.max.toFixed(2)}ms`),console.log()}}var Ad=new ir(!1);async function cr(e,t,n={}){return(await Xt({theme:n.theme||Ot.theme,cache:Ot.cache,verbose:Ot.verbose})).highlight(e,t,n)}var ze=null;function _d(){ze=null}async function dr(){if(ze)return ze;return ze=await Xt({theme:"github-light",cache:!0}),ze}var es={js:"javascript",ts:"typescript",jsx:"javascript",tsx:"typescript",htm:"html",sh:"bash",shell:"bash",zsh:"bash"};function Jt(e){let t=e.toLowerCase().trim();return es[t]||t}function lr(e){let t=Jt(e);return["javascript","typescript","html","css","json","stx","bash"].includes(t)}function rt(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function ts(e,t){let n=/<span[^>]*class="token[^"]*"[^>]*>([^<]*)<\/span>/g,r=[],o;while((o=n.exec(t))!==null){let i=o[1].replace(/&amp;/g,"&").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#0*39;/g,"'");if(i)r.push({text:i,span:o[0]})}if(r.length===0)return t;let a="",s=0,c=e.match(/^(\s*)/);if(c&&c[1])a+=c[1],s=c[1].length;for(let i=0;i<r.length;i++){let{text:d,span:l}=r[i],m=e.indexOf(d,s);if(m===-1){a+=l;continue}if(m>s){let u=e.substring(s,m);if(/^\s+$/.test(u))a+=u}a+=l,s=m+d.length}return a}async function Qt(e,t,n="github-light"){let r=Jt(t);if(!lr(r))return e.split(`
1380
+ `).map((a)=>`<span class="line">${rt(a)}</span>`).join(`
1374
1381
  `);try{let o=e.split(`
1375
- `);return(await Promise.all(o.map(async(s)=>{if(!s.trim())return`<span class="line">${s}</span>`;let i=(await sr(s,r,{theme:n})).html;if(i=i.replace(/<div[^>]*class="syntax-wrapper"[^>]*>/g,""),i=i.replace(/<\/div>\s*$/g,""),i=i.replace(/<pre[^>]*>/g,""),i=i.replace(/<\/pre>/g,""),i=i.replace(/<code[^>]*>/g,""),i=i.replace(/<\/code>/g,""),i=Ha(s,i.trim()),!i.startsWith('<span class="line">'))i=`<span class="line">${i}</span>`;return i}))).join(`
1382
+ `);return(await Promise.all(o.map(async(s)=>{if(!s.trim())return`<span class="line">${s}</span>`;let i=(await cr(s,r,{theme:n})).html;if(i=i.replace(/<div[^>]*class="syntax-wrapper"[^>]*>/g,""),i=i.replace(/<\/div>\s*$/g,""),i=i.replace(/<pre[^>]*>/g,""),i=i.replace(/<\/pre>/g,""),i=i.replace(/<code[^>]*>/g,""),i=i.replace(/<\/code>/g,""),i=ts(s,i.trim()),!i.startsWith('<span class="line">'))i=`<span class="line">${i}</span>`;return i}))).join(`
1376
1383
  `)}catch(o){return console.warn(`Failed to highlight code for language "${t}":`,o),e.split(`
1377
- `).map((s)=>`<span class="line">${nt(s)}</span>`).join(`
1378
- `)}}function hd(e,t){let n=Jt(t);if(!cr(n))return nt(e);return nt(e)}function dr(){return`
1384
+ `).map((s)=>`<span class="line">${rt(s)}</span>`).join(`
1385
+ `)}}function jd(e,t){let n=Jt(t);if(!lr(n))return rt(e);return rt(e)}function mr(){return`
1379
1386
  /* Basic syntax highlighting styles for ts-syntax-highlighter */
1380
1387
  /* The actual theme colors are injected by ts-syntax-highlighter */
1381
1388
 
@@ -1485,7 +1492,7 @@ code {
1485
1492
  color: #9ca3af;
1486
1493
  }
1487
1494
  }
1488
- `}async function wd(){await ir()}async function fd(){return ir()}import{join as mr}from"path";var Va=mr(import.meta.dir,"templates"),rt=new Map;async function Pa(e){if(rt.has(e))return rt.get(e);let t=mr(Va,`${e}.stx`),n=Bun.file(t);if(!await n.exists())throw Error(`Template not found: ${e}`);let r=await n.text();return rt.set(e,r),r}function es(e,t){let n=e;for(let[r,o]of Object.entries(t)){let a=new RegExp(`{{\\s*${r}\\s*}}`,"g");n=n.replace(a,o??"")}return n}async function ee(e,t){let n=await Pa(e);return es(n,t)}function lr(){rt.clear()}function Qt(){return`
1495
+ `}async function zd(){await dr()}async function Ed(){return dr()}import{join as pr}from"path";import{renderString as ns}from"@stacksjs/stx";var rs=pr(import.meta.dir,"templates"),ot=new Map;async function os(e){if(ot.has(e))return ot.get(e);let t=pr(rs,`${e}.stx`),n=Bun.file(t);if(!await n.exists())throw Error(`Template not found: ${e}`);let r=await n.text();return ot.set(e,r),r}async function as(e,t){return ns(e,t)}async function ee(e,t){let n=await os(e);return as(n,t)}function ur(){ot.clear()}function Wt(){return`
1489
1496
  /* VitePress Theme for BunPress */
1490
1497
  /**
1491
1498
  * VitePress Theme for BunPress
@@ -3374,7 +3381,7 @@ mjx-container > svg {
3374
3381
  border-radius: 0;
3375
3382
  border: none;
3376
3383
  }
3377
- `}function ts(){return`/**
3384
+ `}function ss(){return`/**
3378
3385
  * VitePress Theme for BunPress
3379
3386
  * Colors: Solid
3380
3387
  * -------------------------------------------------------------------------- */
@@ -3934,7 +3941,7 @@ mjx-container > svg {
3934
3941
 
3935
3942
  .bpi-corner-down-left {
3936
3943
  --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cg fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2'%3E%3Cpath d='M20 4v7a4 4 0 0 1-4 4H4'/%3E%3Cpath d='m9 10l-5 5l5 5'/%3E%3C/g%3E%3C/svg%3E");
3937
- }`}function ns(){return`/**
3944
+ }`}function is(){return`/**
3938
3945
  * VitePress Theme for BunPress - Base Styles
3939
3946
  * -------------------------------------------------------------------------- */
3940
3947
 
@@ -4778,7 +4785,7 @@ mjx-container > svg {
4778
4785
  .bp-doc .custom-block .bp-code-group .tabs {
4779
4786
  margin: 0;
4780
4787
  border-radius: 8px 8px 0 0;
4781
- }`}function rs(){return`/**
4788
+ }`}function cs(){return`/**
4782
4789
  * VitePress Theme for BunPress - Custom Blocks
4783
4790
  * -------------------------------------------------------------------------- */
4784
4791
 
@@ -5129,7 +5136,7 @@ mjx-container > svg {
5129
5136
 
5130
5137
  .github-alert-caution .github-alert-icon {
5131
5138
  fill: var(--bp-c-caution-1);
5132
- }`}function os(){return`/**
5139
+ }`}function ds(){return`/**
5133
5140
  * VitePress Theme for BunPress - Code Groups
5134
5141
  * -------------------------------------------------------------------------- */
5135
5142
 
@@ -5257,7 +5264,7 @@ mjx-container > svg {
5257
5264
  margin: 0;
5258
5265
  border-radius: 0;
5259
5266
  border: none;
5260
- }`}var as={name:"vitepress",getCSS:Qt,getVars:ts,getBase:ns,getCustomBlocks:rs,getCodeGroups:os},pr=as;function ur(){return`
5267
+ }`}var ls={name:"vitepress",getCSS:Wt,getVars:ss,getBase:is,getCustomBlocks:cs,getCodeGroups:ds},yr=ls;function hr(){return`
5261
5268
  /* Bun Theme for BunPress */
5262
5269
  /* Colors extracted from bun.sh */
5263
5270
  /**
@@ -7266,7 +7273,7 @@ p {
7266
7273
  .interactive-hover:hover {
7267
7274
  transform: scale(1.06);
7268
7275
  }
7269
- `}function ss(){return`/**
7276
+ `}function ms(){return`/**
7270
7277
  * Bun Theme for BunPress
7271
7278
  * Colors extracted from bun.sh
7272
7279
  * -------------------------------------------------------------------------- */
@@ -7820,7 +7827,7 @@ p {
7820
7827
 
7821
7828
  .bpi-search {
7822
7829
  --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cg fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.6'%3E%3Cpath d='m21 21l-4.34-4.34'/%3E%3Ccircle cx='11' cy='11' r='8' stroke-width='1.4'/%3E%3C/g%3E%3C/svg%3E");
7823
- }`}function is(){return`/**
7830
+ }`}function ps(){return`/**
7824
7831
  * Bun Theme for BunPress - Base Styles
7825
7832
  * -------------------------------------------------------------------------- */
7826
7833
 
@@ -8619,7 +8626,7 @@ p {
8619
8626
  .bp-doc .custom-block .bp-code-group .tabs {
8620
8627
  margin: 0;
8621
8628
  border-radius: 5px 5px 0 0;
8622
- }`}function cs(){return`/**
8629
+ }`}function us(){return`/**
8623
8630
  * Bun Theme for BunPress - Custom Blocks
8624
8631
  * -------------------------------------------------------------------------- */
8625
8632
 
@@ -8983,7 +8990,7 @@ p {
8983
8990
 
8984
8991
  .github-alert-caution .github-alert-icon {
8985
8992
  fill: var(--bp-c-caution-1);
8986
- }`}function ds(){return`/**
8993
+ }`}function ys(){return`/**
8987
8994
  * Bun Theme for BunPress - Code Groups
8988
8995
  * -------------------------------------------------------------------------- */
8989
8996
 
@@ -9113,7 +9120,7 @@ p {
9113
9120
  margin: 0;
9114
9121
  border-radius: 0;
9115
9122
  border: none;
9116
- }`}function ms(){return`/**
9123
+ }`}function hs(){return`/**
9117
9124
  * Bun Theme for BunPress - Extra Bun-specific styles
9118
9125
  * -------------------------------------------------------------------------- */
9119
9126
 
@@ -9267,10 +9274,10 @@ p {
9267
9274
 
9268
9275
  .interactive-hover:hover {
9269
9276
  transform: scale(1.06);
9270
- }`}var ls={name:"bun",getCSS:ur,getVars:ss,getBase:is,getCustomBlocks:cs,getCodeGroups:ds,getExtras:ms},yr=ls;var ps={vitepress:pr,bun:yr};function hr(e="vitepress"){let t=ps[e];if(!t)return console.warn(`[BunPress] Unknown theme: ${e}, falling back to vitepress`),Qt();return t.getCSS()}var Wt={enabled:!0,position:["sidebar"],title:"Table of Contents",maxDepth:6,minDepth:2,className:"table-of-contents",smoothScroll:!0,activeHighlight:!0,collapsible:!0,exclude:[]};function us(e){return e.toLowerCase().trim().replace(/<[^>]*>/g,"").replace(/what's new\?\s*\(v2\.0\)/g,"whats-new-v2-0").replace(/features\s*&\s*benefits/g,"features-benefits").replace(/vue\.js\s*\+\s*typescript\s*=\s*\u2764\uFE0F/g,"vue-js-typescript").replace(/\//g,"-").replace(/\./g,"-").replace(/[^\w\s-]/g,"").replace(/[\s_]+/g,"-").replace(/-+/g,"-").replace(/^-+|-+$/g,"")}function wr(e,t){let n=us(e),r=n,o=1;while(t.has(n))n=`${r}-${o}`,o++;return t.add(n),n}function vt(e){let t=[],n=new Set,r=/^(#{1,6})\s+(.+)$/gm,o;while((o=r.exec(e))!==null){let a=o[1].length,s=o[2].trim();if(!s)continue;if(s.includes("toc-ignore"))continue;let c=s.replace(/\s*<!-- toc-ignore -->\s*/g,"").trim();c=c.replace(/`([^`]+)`/g,"<code>$1</code>");let i=c.includes("<code>"),d=wr(c.replace(/<[^>]*>/g,""),n);t.push({level:a,text:c,id:d,children:[],hasCode:i})}return t}function Mt(e){let t=[],n=[];for(let r of e){while(n.length>0&&n[n.length-1].level>=r.level)n.pop();if(n.length===0)t.push(r);else n[n.length-1].children.push(r);n.push(r)}return t}function Kt(e,t){let{minDepth:n=2,maxDepth:r=6,exclude:o=[]}=t,a=(s)=>{let c=[];for(let i of s){if(o.some((m)=>{if(m.startsWith("/")&&m.endsWith("/"))return new RegExp(m.slice(1,-1)).test(i.text);else return i.text===m}))continue;if(i.level>r)continue;let d=a(i.children);if(i.level>=n&&i.level<=r)c.push({...i,children:d});else c.push(...d)}return c};return a(e)}function ot(e){let{items:t,title:n,config:r}=e,{className:o,collapsible:a}=r,s=(c,i=0)=>{if(c.length===0)return"";let d=i===0?"toc-list":"toc-sublist",m=i===0?"toc-item":"toc-subitem";return`<ul class="${d}">
9271
- ${c.map((l)=>{let u=l.children.length>0,p=u&&a?"toc-expand":"",f=u?s(l.children,i+1):"",y=50,h=l.text.length>50?`${l.text.substring(0,50)}...`:l.text,w=l.text.length>50?"toc-truncate":"",b=l.hasCode?"toc-code":"";return`<li class="${m} ${p} ${w} ${b}">
9272
- <a href="#${l.id}" class="toc-link" title="${l.text.replace(/<[^>]*>/g,"")}">${h}</a>
9273
- ${f}
9277
+ }`}var ws={name:"bun",getCSS:hr,getVars:ms,getBase:ps,getCustomBlocks:us,getCodeGroups:ys,getExtras:hs},wr=ws;var fs={vitepress:yr,bun:wr};function fr(e="vitepress"){let t=fs[e];if(!t)return console.warn(`[BunPress] Unknown theme: ${e}, falling back to vitepress`),Wt();return t.getCSS()}var Ct={enabled:!0,position:["sidebar"],title:"Table of Contents",maxDepth:6,minDepth:2,className:"table-of-contents",smoothScroll:!0,activeHighlight:!0,collapsible:!0,exclude:[]};function Mt(e){return e.toLowerCase().trim().replace(/<[^>]*>/g,"").replace(/what's new\?\s*\(v2\.0\)/g,"whats-new-v2-0").replace(/features\s*&\s*benefits/g,"features-benefits").replace(/vue\.js\s*\+\s*typescript\s*=\s*\u2764\uFE0F/g,"vue-js-typescript").replace(/\//g,"-").replace(/\./g,"-").replace(/[^\w\s-]/g,"").replace(/[\s_]+/g,"-").replace(/-+/g,"-").replace(/^-+|-+$/g,"")}function br(e,t){let n=Mt(e),r=n,o=1;while(t.has(n))n=`${r}-${o}`,o++;return t.add(n),n}function vt(e){let t=[],n=new Set,r=/^(#{1,6})\s+(.+)$/gm,o;while((o=r.exec(e))!==null){let a=o[1].length,s=o[2].trim();if(!s)continue;if(s.includes("toc-ignore"))continue;let c=s.replace(/\s*<!-- toc-ignore -->\s*/g,"").trim();c=c.replace(/`([^`]+)`/g,"<code>$1</code>");let i=c.includes("<code>"),d=br(c.replace(/<[^>]*>/g,""),n);t.push({level:a,text:c,id:d,children:[],hasCode:i})}return t}function Kt(e){let t=[],n=[];for(let r of e){while(n.length>0&&n[n.length-1].level>=r.level)n.pop();if(n.length===0)t.push(r);else n[n.length-1].children.push(r);n.push(r)}return t}function Dt(e,t){let{minDepth:n=2,maxDepth:r=6,exclude:o=[]}=t,a=(s)=>{let c=[];for(let i of s){if(o.some((l)=>{if(l.startsWith("/")&&l.endsWith("/"))return new RegExp(l.slice(1,-1)).test(i.text);else return i.text===l}))continue;if(i.level>r)continue;let d=a(i.children);if(i.level>=n&&i.level<=r)c.push({...i,children:d});else c.push(...d)}return c};return a(e)}function at(e){let{items:t,title:n,config:r}=e,{className:o,collapsible:a}=r,s=(c,i=0)=>{if(c.length===0)return"";let d=i===0?"toc-list":"toc-sublist",l=i===0?"toc-item":"toc-subitem";return`<ul class="${d}">
9278
+ ${c.map((m)=>{let u=m.children.length>0,p=u&&a?"toc-expand":"",h=u?s(m.children,i+1):"",y=50,w=m.text.length>50?`${m.text.substring(0,50)}...`:m.text,f=m.text.length>50?"toc-truncate":"",b=m.hasCode?"toc-code":"";return`<li class="${l} ${p} ${f} ${b}">
9279
+ <a href="#${m.id}" class="toc-link" title="${m.text.replace(/<[^>]*>/g,"")}">${w}</a>
9280
+ ${h}
9274
9281
  </li>`}).join(`
9275
9282
  `)}
9276
9283
  </ul>`};return`<nav class="${o}" role="navigation" aria-label="${n}">
@@ -9278,7 +9285,7 @@ ${f}
9278
9285
  <h2 class="toc-title">${n}</h2>
9279
9286
  ${s(t)}
9280
9287
  </div>
9281
- </nav>`}function at(e){return ot(e).replace("table-of-contents","table-of-contents toc-inline inline-toc")}function ys(e){return ot(e).replace("table-of-contents","table-of-contents toc-sidebar sidebar-toc")}function hs(e){return ot(e).replace("table-of-contents","table-of-contents toc-floating floating-toc")}function ws(e,t={}){let n={...t};if(typeof n.position==="string")n.position=[n.position];let r={...Wt,...n},o=vt(e),a=Mt(o),s=Kt(a,r);return{title:r.title,items:s,config:r}}function Ed(e,t={}){let n=ws(e,t);return(Array.isArray(t.position)?t.position:[t.position||"sidebar"]).map((o)=>{let a;switch(o){case"inline":a=at(n);break;case"sidebar":a=ys(n);break;case"floating":a=hs(n);break;default:a=ot(n)}return{position:o,data:n,html:a}})}function zd(e,t){let n=at(t);return e.replace(/\[\[toc\]\]/gi,n)}function Nd(e){let t=new Set;return e.replace(/<h([1-6])>(.*?)<\/h[1-6]>/gi,(n,r,o)=>{let a=wr(o.replace(/<[^>]*>/g,""),t);return`<h${r} id="${a}"><a href="#${a}" class="heading-anchor">#</a>${o}</h${r}>`})}function Zd(){return`
9288
+ </nav>`}function st(e){return at(e).replace("table-of-contents","table-of-contents toc-inline inline-toc")}function bs(e){return at(e).replace("table-of-contents","table-of-contents toc-sidebar sidebar-toc")}function ks(e){return at(e).replace("table-of-contents","table-of-contents toc-floating floating-toc")}function gs(e,t={}){let n={...t};if(typeof n.position==="string")n.position=[n.position];let r={...Ct,...n},o=vt(e),a=Kt(o),s=Dt(a,r);return{title:r.title,items:s,config:r}}function Od(e,t={}){let n=gs(e,t);return(Array.isArray(t.position)?t.position:[t.position||"sidebar"]).map((o)=>{let a;switch(o){case"inline":a=st(n);break;case"sidebar":a=bs(n);break;case"floating":a=ks(n);break;default:a=at(n)}return{position:o,data:n,html:a}})}function Sd(e,t){let n=st(t);return e.replace(/\[\[toc\]\]/gi,n)}function Yd(e){let t=new Set;return e.replace(/<h([1-6])>(.*?)<\/h[1-6]>/gi,(n,r,o)=>{let a=br(o.replace(/<[^>]*>/g,""),t);return`<h${r} id="${a}"><a href="#${a}" class="heading-anchor">#</a>${o}</h${r}>`})}function Fd(){return`
9282
9289
  .table-of-contents {
9283
9290
  position: sticky;
9284
9291
  top: 60px; /* Match navbar height */
@@ -9408,7 +9415,7 @@ html {
9408
9415
  max-width: 250px;
9409
9416
  }
9410
9417
  }
9411
- `}function xd(){return`
9418
+ `}function Id(){return`
9412
9419
  function initToc() {
9413
9420
  const tocLinks = document.querySelectorAll('.toc-link')
9414
9421
 
@@ -9505,11 +9512,12 @@ function initToc() {
9505
9512
  // Initialize TOC when DOM is ready
9506
9513
  if (document.readyState === 'loading') {
9507
9514
  document.addEventListener('DOMContentLoaded', initToc)
9508
- } else {
9515
+ }
9516
+ else {
9509
9517
  initToc()
9510
9518
  }
9511
- `}async function bs(e,t){let n=e.themeConfig?.sidebar||e.markdown?.sidebar;if(!n)return"";let r=[];if(Array.isArray(n))r=n;else if(typeof n==="object"){let a=Object.keys(n).find((s)=>t.startsWith(s))||"/";r=n[a]||[]}let o=await Promise.all(r.map(async(a)=>{let s=a.items?a.items.map((c)=>{let i=c.link||"/",d=i===t||c.link===t;return`<li><a href="${i}" style="display: block; padding: 6px 24px; color: var(--bp-c-text-2); text-decoration: none; font-size: 14px; transition: color 0.25s; ${d?"color: var(--bp-c-brand-1); font-weight: 500;":""}" onmouseover="this.style.color='var(--bp-c-brand-1)'" onmouseout="this.style.color='${d?"var(--bp-c-brand-1)":"var(--bp-c-text-2)"}'">${c.text}</a></li>`}).join(""):"";return await ee("sidebar-section",{title:a.text,items:s})}));return await ee("sidebar",{sections:o.join("")})}async function ks(e){let t=/<h([2-6])([^>]*)>(.*?)<\/h\1>/g,n=[],r;while((r=t.exec(e))!==null){let a=Number.parseInt(r[1]),s=r[2],c=r[3];c=c.replace(/<[^>]*>/g,"");let i=s.match(/id="([^"]*)"/),d=i?i[1]:c.toLowerCase().replace(/\s+/g,"-").replace(/[^\w-]/g,"");n.push({level:a,text:c,id:d})}if(n.length===0)return"";let o=n.map((a)=>{let s=a.level>2?`level-${a.level}`:"";return`<a href="#${a.id}" class="${s}">${a.text}</a>`}).join(`
9512
- `);return await ee("page-toc",{items:o})}function gs(e){return e.replace(/<h([1-6])([^>]*)>(.*?)<\/h\1>/g,(t,n,r,o)=>{if(r.includes("id="))return t;let a=o.match(/\s*\{#([\w-]+)\}\s*$/),s,c=o;if(a)s=a[1],c=o.replace(/\s*\{#[\w-]+\}\s*$/,"");else s=o.replace(/<[^>]*>/g,"").toLowerCase().replace(/\//g,"-").replace(/\s+/g,"-").replace(/[^\w-]/g,"").replace(/-+/g,"-").replace(/^-+|-+$/g,"");return`<h${n}${r} id="${s}">${c}</h${n}>`})}function As(e){let t=e.themeConfig?.nav||e.nav;if(!t||t.length===0)return"";let n=(o)=>{return o||"/"};return t.map((o)=>{if(o.items&&o.items.length>0)return`<div class="relative group">
9519
+ `}async function $s(e,t){let n=e.themeConfig?.sidebar||e.markdown?.sidebar;if(!n)return"";let r=[];if(Array.isArray(n))r=n;else if(typeof n==="object"){let a=Object.keys(n).find((s)=>t.startsWith(s))||"/";r=n[a]||[]}let o=await Promise.all(r.map(async(a)=>{let s=a.items?a.items.map((c)=>{let i=c.link||"/",d=i===t||c.link===t;return`<li><a href="${i}" style="display: block; padding: 6px 24px; color: var(--bp-c-text-2); text-decoration: none; font-size: 14px; transition: color 0.25s; ${d?"color: var(--bp-c-brand-1); font-weight: 500;":""}" onmouseover="this.style.color='var(--bp-c-brand-1)'" onmouseout="this.style.color='${d?"var(--bp-c-brand-1)":"var(--bp-c-text-2)"}'">${c.text}</a></li>`}).join(""):"";return await ee("sidebar-section",{title:a.text,items:s})}));return await ee("sidebar",{sections:o.join("")})}async function qs(e){let t=/<h([2-6])([^>]*)>(.*?)<\/h\1>/g,n=[],r;while((r=t.exec(e))!==null){let a=Number.parseInt(r[1]),s=r[2],c=r[3];c=c.replace(/<[^>]*>/g,"");let i=s.match(/id="([^"]*)"/),d=i?i[1]:c.toLowerCase().replace(/\s+/g,"-").replace(/[^\w-]/g,"");n.push({level:a,text:c,id:d})}if(n.length===0)return"";let o=n.map((a)=>{let s=a.level>2?`level-${a.level}`:"";return`<a href="#${a.id}" class="${s}">${a.text}</a>`}).join(`
9520
+ `);return await ee("page-toc",{items:o})}function _s(e){return e.replace(/<h([1-6])([^>]*)>(.*?)<\/h\1>/g,(t,n,r,o)=>{if(r.includes("id="))return t;let a=o.match(/\s*\{#([\w-]+)\}\s*$/),s,c=o;if(a)s=a[1],c=o.replace(/\s*\{#[\w-]+\}\s*$/,"");else s=o.replace(/<[^>]*>/g,"").toLowerCase().replace(/\//g,"-").replace(/\s+/g,"-").replace(/[^\w-]/g,"").replace(/-+/g,"-").replace(/^-+|-+$/g,"");return`<h${n}${r} id="${s}">${c}</h${n}>`})}function js(e){let t=e.themeConfig?.nav||e.nav;if(!t||t.length===0)return"";let n=(o)=>{return o||"/"};return t.map((o)=>{if(o.items&&o.items.length>0)return`<div class="relative group">
9513
9521
  <button class="text-[14px] font-medium text-[#213547] hover:text-[#5672cd] transition-colors cursor-pointer flex items-center gap-1">
9514
9522
  ${o.text}
9515
9523
  <svg class="w-3 h-3" fill="none" stroke="currentColor" viewBox="0 0 24 24">
@@ -9519,24 +9527,34 @@ if (document.readyState === 'loading') {
9519
9527
  <div class="hidden group-hover:block absolute top-full right-0 bg-white border border-[#e2e2e3] rounded-lg shadow-lg min-w-[160px] py-2 mt-2">
9520
9528
  ${o.items.map((a)=>`<a href="${n(a.link)}" class="block px-4 py-2 text-[13px] text-[#213547] hover:bg-[#f6f6f7] hover:text-[#5672cd] transition-colors">${a.text}</a>`).join("")}
9521
9529
  </div>
9522
- </div>`;else return`<a href="${n(o.link)}" class="text-[14px] font-medium text-[#213547] hover:text-[#5672cd] transition-colors">${o.text}</a>`}).join("")}function $s(e,t){let n=e.sitemap?.baseUrl;if(!n)return"";return`<link rel="canonical" href="${n.replace(/\/$/,"")}${t==="/index"?"/":t}">`}function qs(e,t,n,r){let o=n.sitemap?.baseUrl;if(!o)return"";let c=`${o.replace(/\/$/,"")}${r==="/index"?"/":r}`,i=n.title||n.markdown?.title||e,d=n.markdown?.meta?.["og:image"]||n.markdown?.meta?.ogImage,m=['<meta property="og:type" content="website">',`<meta property="og:url" content="${c}">`,`<meta property="og:title" content="${e}">`,`<meta property="og:description" content="${t}">`,`<meta property="og:site_name" content="${i}">`];if(d)m.push(`<meta property="og:image" content="${d}">`);return m.join(`
9523
- `)}function _s(e,t,n){let r=n.markdown?.meta?.["twitter:card"]||n.markdown?.meta?.twitterCard||"summary",o=n.markdown?.meta?.["twitter:site"]||n.markdown?.meta?.twitterSite,a=n.markdown?.meta?.["twitter:image"]||n.markdown?.meta?.twitterImage,s=[`<meta name="twitter:card" content="${r}">`,`<meta name="twitter:title" content="${e}">`,`<meta name="twitter:description" content="${t}">`];if(o)s.push(`<meta name="twitter:site" content="${o}">`);if(a)s.push(`<meta name="twitter:image" content="${a}">`);return s.join(`
9524
- `)}function js(e,t,n,r){let o=n.sitemap?.baseUrl;if(!o)return"";let a=o.replace(/\/$/,""),s=r==="/index"?"/":r,c=`${a}${s}`;if(s==="/"){let l={"@context":"https://schema.org","@type":"WebSite",name:n.title||n.markdown?.title||e,description:t,url:a};return`<script type="application/ld+json">
9525
- ${JSON.stringify(l,null,2)}
9526
- </script>`}let i={"@context":"https://schema.org","@type":"TechArticle",headline:e,description:t,url:c},d=s.split("/").filter(Boolean),m=d.map((l,u)=>{let p=u+1,f=`${a}/${d.slice(0,p).join("/")}`;return{"@type":"ListItem",position:p,name:l.replace(/-/g," ").replace(/\b\w/g,(y)=>y.toUpperCase()),item:f}});if(m.length>0){let l={"@context":"https://schema.org","@type":"BreadcrumbList",itemListElement:m};return`<script type="application/ld+json">
9530
+ </div>`;else return`<a href="${n(o.link)}" class="text-[14px] font-medium text-[#213547] hover:text-[#5672cd] transition-colors">${o.text}</a>`}).join("")}function zs(e,t){let n=e.sitemap?.baseUrl;if(!n)return"";return`<link rel="canonical" href="${n.replace(/\/$/,"")}${t==="/index"?"/":t}">`}function Es(e,t,n,r){let o=n.sitemap?.baseUrl;if(!o)return"";let c=`${o.replace(/\/$/,"")}${r==="/index"?"/":r}`,i=n.title||n.markdown?.title||e,d=n.markdown?.meta?.["og:image"]||n.markdown?.meta?.ogImage,l=['<meta property="og:type" content="website">',`<meta property="og:url" content="${c}">`,`<meta property="og:title" content="${e}">`,`<meta property="og:description" content="${t}">`,`<meta property="og:site_name" content="${i}">`];if(d)l.push(`<meta property="og:image" content="${d}">`);return l.join(`
9531
+ `)}function Ts(e,t,n){let r=n.markdown?.meta?.["twitter:card"]||n.markdown?.meta?.twitterCard||"summary",o=n.markdown?.meta?.["twitter:site"]||n.markdown?.meta?.twitterSite,a=n.markdown?.meta?.["twitter:image"]||n.markdown?.meta?.twitterImage,s=[`<meta name="twitter:card" content="${r}">`,`<meta name="twitter:title" content="${e}">`,`<meta name="twitter:description" content="${t}">`];if(o)s.push(`<meta name="twitter:site" content="${o}">`);if(a)s.push(`<meta name="twitter:image" content="${a}">`);return s.join(`
9532
+ `)}function Ns(e,t,n,r){let o=n.sitemap?.baseUrl;if(!o)return"";let a=o.replace(/\/$/,""),s=r==="/index"?"/":r,c=`${a}${s}`;if(s==="/"){let m={"@context":"https://schema.org","@type":"WebSite",name:n.title||n.markdown?.title||e,description:t,url:a};return`<script type="application/ld+json">
9533
+ ${JSON.stringify(m,null,2)}
9534
+ </script>`}let i={"@context":"https://schema.org","@type":"TechArticle",headline:e,description:t,url:c},d=s.split("/").filter(Boolean),l=d.map((m,u)=>{let p=u+1,h=`${a}/${d.slice(0,p).join("/")}`;return{"@type":"ListItem",position:p,name:m.replace(/-/g," ").replace(/\b\w/g,(y)=>y.toUpperCase()),item:h}});if(l.length>0){let m={"@context":"https://schema.org","@type":"BreadcrumbList",itemListElement:l};return`<script type="application/ld+json">
9527
9535
  ${JSON.stringify(i,null,2)}
9528
9536
  </script>
9529
9537
  <script type="application/ld+json">
9530
- ${JSON.stringify(l,null,2)}
9538
+ ${JSON.stringify(m,null,2)}
9531
9539
  </script>`}return`<script type="application/ld+json">
9532
9540
  ${JSON.stringify(i,null,2)}
9533
- </script>`}async function gr(e,t,n,r=!1){let o=t.title||t.themeConfig?.siteTitle||t.markdown?.title||"BunPress Documentation",a=t.description||t.markdown?.meta?.description||"Documentation built with BunPress",s=t.theme||"vitepress",c=hr(s),i=dr(),d=`${c}
9541
+ </script>`}async function $r(e,t,n,r="doc"){let o=t.title||t.themeConfig?.siteTitle||t.markdown?.title||"BunPress Documentation",a=t.description||t.markdown?.meta?.description||"Documentation built with BunPress",s=t.theme||"vitepress",c=fr(s),i=mr(),d=zs(t,n),l=Es(o,a,t,n),m=Ts(o,a,t),u=Ns(o,a,t,n),h=[Object.entries(t.markdown?.meta||{}).filter(([F])=>!F.startsWith("og:")&&!F.startsWith("twitter:")&&F!=="description"&&F!=="ogImage"&&F!=="twitterCard"&&F!=="twitterSite"&&F!=="twitterImage").map(([F,me])=>`<meta name="${F}" content="${me}">`).join(`
9542
+ `),d,l,m].filter(Boolean).join(`
9543
+ `),y=xs(t),w=Ls(t),f=t.markdown?.scripts?.map((F)=>`<script>${F}</script>`).join(`
9544
+ `)||"",b=[u,y,w,f].filter(Boolean).join(`
9545
+ `),q=js(t);if(r==="home"){let F=await Ht(e),me=`${c}
9534
9546
  ${i}
9535
- ${t.markdown?.css||""}`,m=$s(t,n),l=qs(o,a,t,n),u=_s(o,a,t),p=js(o,a,t,n),y=[Object.entries(t.markdown?.meta||{}).filter(([g])=>!g.startsWith("og:")&&!g.startsWith("twitter:")&&g!=="description"&&g!=="ogImage"&&g!=="twitterCard"&&g!=="twitterSite"&&g!=="twitterImage").map(([g,Z])=>`<meta name="${g}" content="${Z}">`).join(`
9536
- `),m,l,u].filter(Boolean).join(`
9537
- `),h=Es(t),w=zs(t),b=t.markdown?.scripts?.map((g)=>`<script>${g}</script>`).join(`
9538
- `)||"",_=[p,h,w,b].filter(Boolean).join(`
9539
- `);if(r)return await ee("layout-home",{title:o,description:a,meta:y,customCSS:d,content:e,scripts:_});let A=gs(e),k=await ks(A);return await ee("layout-doc",{title:o,description:a,meta:y,customCSS:d,nav:As(t),sidebar:await bs(t,n),content:A,pageTOC:k,scripts:_})}function Es(e){if(!e.fathom?.enabled||!e.fathom?.siteId)return"";let t=e.fathom.scriptUrl||"https://cdn.usefathom.com/script.js",n=e.fathom.defer!==!1,r=e.fathom.honorDNT||!1,o=e.fathom.auto!==!1,a=e.fathom.canonical,s=e.fathom.spa||!1,c=[`data-site="${e.fathom.siteId}"`,r?'data-honor-dnt="true"':"",!o?'data-auto="false"':"",a?`data-canonical="${a}"`:"",s?'data-spa="auto"':""].filter(Boolean).join(" ");return`<script src="${t}" ${c}${n?" defer":""}></script>`}function zs(e){let t=e.analytics||e.selfHostedAnalytics;if(!t?.enabled||!t?.siteId)return"";let n=Ar(t.siteId),r=t.apiEndpoint?Ar(t.apiEndpoint):"",o=t.honorDNT?`var dnt=n.doNotTrack||w.doNotTrack||n.msDoNotTrack;if(dnt==="1"||dnt==="yes"||dnt===true){l('DNT enabled, skipping');return;}`:"",a=t.trackHashChanges?"w.addEventListener('hashchange',function(){pv();});":"",s=t.trackOutboundLinks?"d.addEventListener('click',function(e){try{var a=e.target.closest('a');if(a&&a.hostname&&a.hostname!==location.hostname){t('outbound',{url:a.href,text:(a.textContent||'').slice(0,100)});}}catch(err){l('Outbound error',err);}});":"",c=r?` data-api="${r}"`:"";return`<!-- ts-analytics: privacy-first analytics -->
9547
+ ${F}
9548
+ ${t.markdown?.css||""}`;return await ee("layout-home",{title:o,description:a,meta:h,customCSS:me,content:e,scripts:b})}if(r==="page"){let F=await Ht(`${e}
9549
+ ${q}`),me=`${c}
9550
+ ${i}
9551
+ ${F}
9552
+ ${t.markdown?.css||""}`;return await ee("layout-page",{title:o,description:a,meta:h,customCSS:me,nav:q,content:e,scripts:b})}let g=_s(e),k=await qs(g),U=await $s(t,n),Y=await Ht(`${g}
9553
+ ${q}
9554
+ ${U}`),ce=`${c}
9555
+ ${i}
9556
+ ${Y}
9557
+ ${t.markdown?.css||""}`;return await ee("layout-doc",{title:o,description:a,meta:h,customCSS:ce,nav:q,sidebar:U,content:g,pageTOC:k,scripts:b})}var ct=null,qr=!1;async function Zs(){if(qr)return ct;qr=!0;try{ct=await import("@cwcss/crosswind")}catch{ct=null}return ct}async function Ht(e){let t=await Zs();if(!t)return"";let r=new t.Scanner([]).scanContent(e);if(r.size===0)return"";let o=new t.CSSGenerator(t.defaultConfig);for(let a of r)o.generate(a);return o.toCSS(!1,!1)}function xs(e){if(!e.fathom?.enabled||!e.fathom?.siteId)return"";let t=e.fathom.scriptUrl||"https://cdn.usefathom.com/script.js",n=e.fathom.defer!==!1,r=e.fathom.honorDNT||!1,o=e.fathom.auto!==!1,a=e.fathom.canonical,s=e.fathom.spa||!1,c=[`data-site="${e.fathom.siteId}"`,r?'data-honor-dnt="true"':"",!o?'data-auto="false"':"",a?`data-canonical="${a}"`:"",s?'data-spa="auto"':""].filter(Boolean).join(" ");return`<script src="${t}" ${c}${n?" defer":""}></script>`}function Ls(e){let t=e.analytics||e.selfHostedAnalytics;if(!t?.enabled||!t?.siteId)return"";let n=_r(t.siteId),r=t.apiEndpoint?_r(t.apiEndpoint):"",o=t.honorDNT?`var dnt=n.doNotTrack||w.doNotTrack||n.msDoNotTrack;if(dnt==="1"||dnt==="yes"||dnt===true){l('DNT enabled, skipping');return;}`:"",a=t.trackHashChanges?"w.addEventListener('hashchange',function(){pv();});":"",s=t.trackOutboundLinks?"d.addEventListener('click',function(e){try{var a=e.target.closest('a');if(a&&a.hostname&&a.hostname!==location.hostname){t('outbound',{url:a.href,text:(a.textContent||'').slice(0,100)});}}catch(err){l('Outbound error',err);}});":"",c=r?` data-api="${r}"`:"";return`<!-- ts-analytics: privacy-first analytics -->
9540
9558
  <script data-site="${n}"${c} defer>
9541
9559
  (function(){
9542
9560
  'use strict';
@@ -9567,7 +9585,8 @@ x.onerror=function(){l('XHR error');};
9567
9585
  x.send(payload);
9568
9586
  l('Sent via XHR',data.e);
9569
9587
  return true;
9570
- }catch(e){l('XHR failed',e);}
9588
+ }
9589
+ catch(e){l('XHR failed',e);}
9571
9590
  }
9572
9591
  return sent;
9573
9592
  }
@@ -9576,7 +9595,8 @@ try{
9576
9595
  var data={s:site,sid:sid,e:e,p:p||{},u:location.href,r:d.referrer||'',t:d.title||'',sw:screen.width,sh:screen.height,ts:Date.now()};
9577
9596
  if(vid)data.vid=vid;
9578
9597
  send(api+'/collect',data);
9579
- }catch(err){l('Track error',err);}
9598
+ }
9599
+ catch(err){l('Track error',err);}
9580
9600
  }
9581
9601
  var pvSent={};function pv(){var p=location.pathname;if(pvSent[p]&&Date.now()-pvSent[p]<1000)return;pvSent[p]=Date.now();l('Pageview',p);t('pageview',{path:p});}
9582
9602
  ${a}
@@ -9590,43 +9610,47 @@ w.addEventListener('visibilitychange',function(){if(d.visibilityState==='hidden'
9590
9610
  ss.setItem('_tsa_start',Date.now());
9591
9611
  w.bunpressAnalytics={track:function(name,props){t('event',{name:name,properties:props});},debug:function(v){debug=v!==false;w.ANALYTICS_DEBUG=debug;}};
9592
9612
  l('Initialized',site);
9593
- }catch(err){if(w.console)console.error('[Analytics] Init error:',err);}
9613
+ }
9614
+ catch(err){if(w.console)console.error('[Analytics] Init error:',err);}
9594
9615
  })();
9595
- </script>`}function Ar(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Ns(e){let t=/^---\n([\s\S]*?)\n---\n?/,n=e.match(t);if(!n)return{frontmatter:{},content:e};let r=n[1],o=e.slice(n[0].length);try{return{frontmatter:fs.parse(r),content:o}}catch(a){return console.error("Failed to parse frontmatter YAML:",a),{frontmatter:{},content:e}}}async function Zs(e){if(!e)return"";let t=e.name?`<h1 class="text-[32px] leading-[40px] md:text-[48px] md:leading-[56px] font-bold tracking-tight text-[#5672cd] mb-3">${e.name}</h1>`:"",n=e.text?`<p class="text-[32px] leading-[40px] md:text-[56px] md:leading-[64px] font-bold tracking-tight text-[#213547]">${e.text}</p>`:"",r=e.tagline?`<p class="mt-4 text-[16px] md:text-[18px] leading-[28px] text-[#476582] font-medium">${e.tagline}</p>`:"",o="";if(e.actions)o=`<div class="mt-8 flex flex-wrap items-center gap-3">${e.actions.map((s)=>{let c=s.theme==="brand";return`<a href="${s.link}" class="inline-block ${c?"bg-[#5672cd] text-white px-4 py-2 rounded-[20px] font-medium text-[14px] transition-colors hover:bg-[#4558b8]":"bg-[#f6f6f7] text-[#213547] px-4 py-2 rounded-[20px] font-medium text-[14px] border border-[#e2e2e3] transition-colors hover:bg-[#e7e7e8] hover:border-[#d0d0d1]"}">${s.text}</a>`}).join("")}</div>`;return await ee("hero",{name:t,text:n,tagline:r,actions:o})}async function xs(e){if(!e||e.length===0)return"";let t=e.map((n)=>`
9616
+ </script>`}function _r(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Rs(e){let t=e.replace(/\r\n/g,`
9617
+ `),n=/^---\n([\s\S]*?)\n---\n?/,r=t.match(n);if(!r)return{frontmatter:{},content:t};let o=r[1],a=t.slice(r[0].length);try{return{frontmatter:As.parse(o),content:a}}catch(s){return console.error("Failed to parse frontmatter YAML:",s),{frontmatter:{},content:e}}}async function Bs(e){if(!e)return"";let t=e.name?`<h1 class="text-[32px] leading-[40px] md:text-[48px] md:leading-[56px] font-bold tracking-tight text-[#5672cd] mb-3">${e.name}</h1>`:"",n=e.text?`<p class="text-[32px] leading-[40px] md:text-[56px] md:leading-[64px] font-bold tracking-tight text-[#213547]">${e.text}</p>`:"",r=e.tagline?`<p class="mt-4 text-[16px] md:text-[18px] leading-[28px] text-[#476582] font-medium">${e.tagline}</p>`:"",o="";if(e.actions)o=`<div class="mt-8 flex flex-wrap items-center gap-3">${e.actions.map((s)=>{let c=s.theme==="brand";return`<a href="${s.link}" class="inline-block ${c?"bg-[#5672cd] text-white px-4 py-2 rounded-[20px] font-medium text-[14px] transition-colors hover:bg-[#4558b8]":"bg-[#f6f6f7] text-[#213547] px-4 py-2 rounded-[20px] font-medium text-[14px] border border-[#e2e2e3] transition-colors hover:bg-[#e7e7e8] hover:border-[#d0d0d1]"}">${s.text}</a>`}).join("")}</div>`;return await ee("hero",{name:t,text:n,tagline:r,actions:o})}async function Us(e){if(!e||e.length===0)return"";let t=e.map((n)=>`
9596
9618
  <div class="relative bg-[#f6f6f7] p-6 rounded-xl border border-[#e2e2e3] hover:border-[#5672cd] transition-colors">
9597
9619
  ${n.icon?`<div class="text-[40px] mb-3">${n.icon}</div>`:""}
9598
9620
  <h3 class="text-[18px] font-semibold text-[#213547] mb-2 leading-[24px]">${n.title||""}</h3>
9599
9621
  <p class="text-[14px] text-[#476582] leading-[22px]">${n.details||""}</p>
9600
9622
  </div>
9601
- `).join("");return await ee("features",{items:t})}function M(e){return e.replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>").replace(/__(.+?)__/g,"<strong>$1</strong>").replace(/~~(.+?)~~/g,"<del>$1</del>").replace(/==(.+?)==/g,"<mark>$1</mark>").replace(/\^(.+?)\^/g,"<sup>$1</sup>").replace(/`(.+?)`/g,"<code>$1</code>").replace(/(?<!\*)\*(?!\*)(.+?)(?<!\*)\*(?!\*)/g,"<em>$1</em>").replace(/(?<!_)_(?!_)(.+?)(?<!_)_(?!_)/g,"<em>$1</em>").replace(/(?<!~)~(?!~)(.+?)(?<!~)~(?!~)/g,"<sub>$1</sub>").replace(/!\[([^\]]*)\]\(\s*([^\s")]+)(?:\s+"([^"]+)")?\)/g,(t,n,r,o)=>{if(o)return`<figure class="image-figure"><img src="${r}" alt="${n}"><figcaption>${o}</figcaption></figure>`;else return`<img src="${r}" alt="${n}">`}).replace(/\[(.+?)\]\((.+?)\)/g,'<a href="$2">$1</a>')}function Ts(e){let t={smile:"\uD83D\uDE04",laughing:"\uD83D\uDE06",blush:"\uD83D\uDE0A",heart_eyes:"\uD83D\uDE0D",kissing_heart:"\uD83D\uDE18",relaxed:"\u263A\uFE0F",wink:"\uD83D\uDE09",grin:"\uD83D\uDE01",joy:"\uD83D\uDE02",sweat_smile:"\uD83D\uDE05",rofl:"\uD83E\uDD23",thinking:"\uD83E\uDD14",zipper_mouth:"\uD83E\uDD10",neutral_face:"\uD83D\uDE10",expressionless:"\uD83D\uDE11",confused:"\uD83D\uDE15",worried:"\uD83D\uDE1F",slightly_frowning_face:"\uD83D\uDE41",frowning_face:"\u2639\uFE0F",persevere:"\uD83D\uDE23",disappointed:"\uD83D\uDE1E",sweat:"\uD83D\uDE13",tired_face:"\uD83D\uDE2B",cry:"\uD83D\uDE22",sob:"\uD83D\uDE2D",triumph:"\uD83D\uDE24",angry:"\uD83D\uDE20",rage:"\uD83D\uDE21",no_mouth:"\uD83D\uDE36",sleeping:"\uD83D\uDE34","+1":"\uD83D\uDC4D",thumbsup:"\uD83D\uDC4D","-1":"\uD83D\uDC4E",thumbsdown:"\uD83D\uDC4E",clap:"\uD83D\uDC4F",raised_hands:"\uD83D\uDE4C",pray:"\uD83D\uDE4F",wave:"\uD83D\uDC4B",ok_hand:"\uD83D\uDC4C",point_up:"\u261D\uFE0F",point_down:"\uD83D\uDC47",point_left:"\uD83D\uDC48",point_right:"\uD83D\uDC49",muscle:"\uD83D\uDCAA",heart:"\u2764\uFE0F",blue_heart:"\uD83D\uDC99",green_heart:"\uD83D\uDC9A",yellow_heart:"\uD83D\uDC9B",purple_heart:"\uFFFDpurple",broken_heart:"\uD83D\uDC94",sparkling_heart:"\uD83D\uDC96",star:"\u2B50",star2:"\uD83C\uDF1F",sparkles:"\u2728",boom:"\uD83D\uDCA5",fire:"\uD83D\uDD25",tada:"\uD83C\uDF89",confetti_ball:"\uD83C\uDF8A",rocket:"\uD83D\uDE80",zap:"\u26A1",bulb:"\uD83D\uDCA1",bell:"\uD83D\uDD14",mega:"\uD83D\uDCE3",loudspeaker:"\uD83D\uDCE2",warning:"\u26A0\uFE0F",white_check_mark:"\u2705",x:"\u274C",heavy_check_mark:"\u2714\uFE0F",heavy_multiplication_x:"\u2716\uFE0F",question:"\u2753",grey_question:"\u2754",exclamation:"\u2757",grey_exclamation:"\u2755",heavy_plus_sign:"\u2795",heavy_minus_sign:"\u2796",pencil2:"\u270F\uFE0F",memo:"\uD83D\uDCDD",book:"\uD83D\uDCD6",books:"\uD83D\uDCDA",bookmark:"\uD83D\uDD16",mag:"\uD83D\uDD0D",mag_right:"\uD83D\uDD0E",lock:"\uD83D\uDD12",unlock:"\uD83D\uDD13",key:"\uD83D\uDD11",link:"\uD83D\uDD17",computer:"\uD83D\uDCBB",email:"\uD83D\uDCE7",inbox_tray:"\uD83D\uDCE5",outbox_tray:"\uD83D\uDCE4",package:"\uD83D\uDCE6",file_folder:"\uD83D\uDCC1",open_file_folder:"\uD83D\uDCC2",page_facing_up:"\uD83D\uDCC4",calendar:"\uD83D\uDCC5",chart_with_upwards_trend:"\uD83D\uDCC8",chart_with_downwards_trend:"\uD83D\uDCC9",bar_chart:"\uD83D\uDCCA",clipboard:"\uD83D\uDCCB",pushpin:"\uD83D\uDCCC",round_pushpin:"\uD83D\uDCCD",paperclip:"\uD83D\uDCCE",straight_ruler:"\uD83D\uDCCF",wrench:"\uD83D\uDD27",hammer:"\uD83D\uDD28",gear:"\u2699\uFE0F",nut_and_bolt:"\uD83D\uDD29",seedling:"\uD83C\uDF31",evergreen_tree:"\uD83C\uDF32",deciduous_tree:"\uD83C\uDF33",palm_tree:"\uD83C\uDF34",cactus:"\uD83C\uDF35",herb:"\uD83C\uDF3F",shamrock:"\u2618\uFE0F",four_leaf_clover:"\uD83C\uDF40",bug:"\uD83D\uDC1B",bee:"\uD83D\uDC1D",bird:"\uD83D\uDC26",dog:"\uD83D\uDC36",cat:"\uD83D\uDC31",penguin:"\uD83D\uDC27",turtle:"\uD83D\uDC22",fish:"\uD83D\uDC1F",coffee:"\u2615",tea:"\uD83C\uDF75",beer:"\uD83C\uDF7A",beers:"\uD83C\uDF7B",wine_glass:"\uD83C\uDF77",pizza:"\uD83C\uDF55",hamburger:"\uD83C\uDF54",fries:"\uD83C\uDF5F",cake:"\uD83C\uDF70",birthday:"\uD83C\uDF82",cookie:"\uD83C\uDF6A",doughnut:"\uD83C\uDF69",apple:"\uD83C\uDF4E",green_apple:"\uD83C\uDF4F",banana:"\uD83C\uDF4C",strawberry:"\uD83C\uDF53",house:"\uD83C\uDFE0",office:"\uD83C\uDFE2",hospital:"\uD83C\uDFE5",school:"\uD83C\uDFEB",car:"\uD83D\uDE97",taxi:"\uD83D\uDE95",bus:"\uD83D\uDE8C",train:"\uD83D\uDE82",airplane:"\u2708\uFE0F",ship:"\uD83D\uDEA2",bike:"\uD83D\uDEB2",soccer:"\u26BD",basketball:"\uD83C\uDFC0",football:"\uD83C\uDFC8",baseball:"\u26BE",tennis:"\uD83C\uDFBE",trophy:"\uD83C\uDFC6",medal:"\uD83C\uDFC5",dart:"\uD83C\uDFAF",game_die:"\uD83C\uDFB2",musical_note:"\uD83C\uDFB5",notes:"\uD83C\uDFB6",art:"\uD83C\uDFA8",camera:"\uD83D\uDCF7",movie_camera:"\uD83C\uDFA5",checkered_flag:"\uD83C\uDFC1",triangular_flag_on_post:"\uD83D\uDEA9",flag_us:"\uD83C\uDDFA\uD83C\uDDF8",flag_gb:"\uD83C\uDDEC\uD83C\uDDE7",flag_fr:"\uD83C\uDDEB\uD83C\uDDF7",flag_de:"\uD83C\uDDE9\uD83C\uDDEA",flag_jp:"\uD83C\uDDEF\uD83C\uDDF5",flag_cn:"\uD83C\uDDE8\uD83C\uDDF3"};return e.replace(/:(\w+):/g,(n,r)=>{return t[r]||n})}function Rs(e){let t=/<Badge([^/>]+)\/>/gi;return e.replace(t,(n,r)=>{let o=r.match(/type="(info|tip|warning|danger)"/i),a=r.match(/text="([^"]+)"/),s=o?o[1].toLowerCase():"info",c=a?a[1]:"",i={info:{bg:"#e0f2fe",text:"#0c4a6e",border:"#0ea5e9"},tip:{bg:"#dcfce7",text:"#14532d",border:"#22c55e"},warning:{bg:"#fef3c7",text:"#78350f",border:"#f59e0b"},danger:{bg:"#fee2e2",text:"#7f1d1d",border:"#ef4444"}},d=i[s]||i.info;return`<span class="badge badge-${s}" style="display: inline-block; padding: 2px 8px; font-size: 0.85em; font-weight: 600; border-radius: 4px; background: ${d.bg}; color: ${d.text}; border: 1px solid ${d.border}; margin: 0 4px; vertical-align: middle;">${c}</span>`})}function Ls(e){return e.replace(/<a\s+href="([^"]+)"([^>]*)>/g,(t,n,r)=>{if(r.includes("target="))return t;if(n.startsWith("http://")||n.startsWith("https://"))return`<a href="${n}" target="_blank" rel="noreferrer noopener"${r}>`;return t})}function Bs(e){return e.replace(/<a\s+href="([^"]+)"\s+target="_blank"[^>]*>([^<]+)<\/a>/g,(t,n,r)=>{if(t.includes("external-link-icon"))return t;let o='<svg class="external-link-icon" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display: inline-block; margin-left: 4px; vertical-align: middle;"><path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"></path><polyline points="15 3 21 3 21 9"></polyline><line x1="10" y1="14" x2="21" y2="3"></line></svg>';return t.replace("</a>",`${o}</a>`)})}function Ss(e){return e.replace(/<img([^>]+)>/g,(t,n)=>{if(n.includes("loading="))return t;return`<img ${n} loading="lazy" decoding="async">`})}function Us(e,t){if(!e.includes("[[toc]]"))return{content:e,tocHtml:null};let n=vt(e),r={...Wt,...t},o=Kt(n,r),s={items:Mt(o),title:r.title||"Table of Contents",config:r},c=at(s),i="<!--INLINE_TOC_PLACEHOLDER-->";return{content:e.replace(/\[\[toc\]\]/g,i),tocHtml:c}}function Gs(e,t){return e.replace(/<!--INLINE_TOC_PLACEHOLDER-->/g,t)}async function Os(e){let t=/^>\s*\[!(NOTE|TIP|IMPORTANT|WARNING|CAUTION)\]\s*\n((?:>\s*.*\n?)*)/gm,n=Array.from(e.matchAll(t)),r=e;for(let o of n.reverse()){let[a,s,c]=o,i=c.split(`
9602
- `).map((l)=>l.replace(/^>\s*/,"")).filter((l)=>l.trim()).map((l)=>`<p>${M(l)}</p>`).join(`
9603
- `),d=s.toLowerCase(),m=await ee(`blocks/alerts/${d}`,{content:i});r=r.slice(0,o.index)+m+r.slice(o.index+a.length)}return r}async function Ys(e,t){let n=/^<<<\s+@\/([^\s[{#]+)(?:\{(\d+)-(\d+)\}|#(\w+))?\s*(?:\[[^\]]+\]\s*)?$/gm,r=Array.from(e.matchAll(n)),o=e;for(let a of r.reverse()){let[s,c,i,d,m]=a;try{let{join:l}=await import("path"),u=l(t,c),p=Bun.file(u);if(!await p.exists()){console.warn(`Code import: File not found: ${u}`);continue}let y=(await p.text()).split(`
9604
- `),h=c.split(".").pop()||"",b={js:"javascript",ts:"typescript",jsx:"jsx",tsx:"tsx",py:"python",rb:"ruby",go:"go",rs:"rust",java:"java",cpp:"cpp",c:"c",cs:"csharp",php:"php",sh:"bash",bash:"bash",yaml:"yaml",yml:"yaml",json:"json",md:"markdown",html:"html",css:"css",scss:"scss",vue:"vue"}[h]||h;if(i&&d){let k=Number.parseInt(i)-1,g=Number.parseInt(d);y=y.slice(k,g)}else if(m){let k=y.findIndex((Z)=>Z.includes(`#region ${m}`)||Z.includes(`// region ${m}`)||Z.includes(`# region ${m}`)),g=y.findIndex((Z,K)=>K>k&&(Z.includes("#endregion")||Z.includes("// endregion")||Z.includes("# endregion")));if(k!==-1&&g!==-1)y=y.slice(k+1,g);else console.warn(`Code import: Region '${m}' not found in ${c}`)}let _=y.join(`
9605
- `),A=`\`\`\`${b}
9606
- ${_}
9607
- \`\`\``;o=o.slice(0,a.index)+A+o.slice(a.index+s.length)}catch(l){console.error(`Error importing code from ${c}:`,l)}}return o}async function $r(e,t,n=new Set){let r=/<!--@include:\s*([^\s{]+)(?:\{(\d+)-(\d+)\}|\{#([\w-]+)\})?\s*-->/g,o=Array.from(e.matchAll(r)),a=e;for(let s of o.reverse()){let[c,i,d,m,l]=s;try{let{join:u,resolve:p}=await import("path"),f=p(u(t,i));if(n.has(f)){console.warn(`Markdown include: Circular reference detected for ${i}`);continue}let y=Bun.file(f);if(!await y.exists()){console.warn(`Markdown include: File not found: ${f}`);continue}let w=(await y.text()).split(`
9608
- `);if(d&&m){let A=Number.parseInt(d)-1,k=Number.parseInt(m);w=w.slice(A,k)}else if(l){let A=w.findIndex((g)=>g.includes(`<!-- #region ${l} -->`)||g.includes(`<!-- region ${l} -->`)),k=w.findIndex((g,Z)=>Z>A&&(g.includes("<!-- #endregion -->")||g.includes("<!-- endregion -->")));if(A!==-1&&k!==-1)w=w.slice(A+1,k);else{console.warn(`Markdown include: Region '${l}' not found in ${i}`);continue}}let b=w.join(`
9609
- `),_=new Set(n);_.add(f),b=await $r(b,t,_),a=a.slice(0,s.index)+b+a.slice(s.index+c.length)}catch(u){console.error(`Error including markdown from ${i}:`,u)}}return a}async function Xs(e){let t=/^:::\s+code-group[ \t]*\n((?:(?!^:::)[\s\S])*)^:::$/gm,n=Array.from(e.matchAll(t)),r=e;for(let o of n.reverse()){let[a,s]=o,c=/^```(\w+)[ \t]+\[([^\]]+)\][ \t]*\n((?:(?!^```)[\s\S])*)^```$/gm,i=Array.from(s.matchAll(c));if(i.length===0)continue;let d=`code-group-${Math.random().toString(36).substr(2,9)}`,m=i.map((p,f)=>{let y=p[2];return`<button class="code-group-tab ${f===0?"active":""}" onclick="switchCodeTab('${d}', ${f})">${y}</button>`}).join(""),l=await Promise.all(i.map(async(p,f)=>{let y=p[1],h=p[3],w=f===0,b=qe.markdown?.syntaxHighlightTheme||"github-light",_=await Ct(h,y,b);return`<div class="code-group-panel ${w?"active":""}" data-panel="${f}">
9610
- <pre data-lang="${y}"><code class="language-${y}">${_}</code></pre>
9623
+ `).join("");return await ee("features",{items:t})}function jr(e){return e.replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>").replace(/__(.+?)__/g,"<strong>$1</strong>").replace(/~~(.+?)~~/g,"<del>$1</del>").replace(/==(.+?)==/g,"<mark>$1</mark>").replace(/\^(.+?)\^/g,"<sup>$1</sup>").replace(/`(.+?)`/g,"<code>$1</code>").replace(/(?<!\*)\*(?!\*)(.+?)(?<!\*)\*(?!\*)/g,"<em>$1</em>").replace(/(?<!_)_(?!_)(.+?)(?<!_)_(?!_)/g,"<em>$1</em>").replace(/(?<!~)~(?!~)(.+?)(?<!~)~(?!~)/g,"<sub>$1</sub>").replace(/!\[([^\]]*)\]\(\s*([^\s")]+)(?:\s+"([^"]+)")?\)/g,(t,n,r,o)=>{if(o)return`<figure class="image-figure"><img src="${r}" alt="${n}"><figcaption>${o}</figcaption></figure>`;else return`<img src="${r}" alt="${n}">`}).replace(/\[(.+?)\]\((.+?)\)/g,'<a href="$2">$1</a>')}function Gs(e){let t={smile:"\uD83D\uDE04",laughing:"\uD83D\uDE06",blush:"\uD83D\uDE0A",heart_eyes:"\uD83D\uDE0D",kissing_heart:"\uD83D\uDE18",relaxed:"\u263A\uFE0F",wink:"\uD83D\uDE09",grin:"\uD83D\uDE01",joy:"\uD83D\uDE02",sweat_smile:"\uD83D\uDE05",rofl:"\uD83E\uDD23",thinking:"\uD83E\uDD14",zipper_mouth:"\uD83E\uDD10",neutral_face:"\uD83D\uDE10",expressionless:"\uD83D\uDE11",confused:"\uD83D\uDE15",worried:"\uD83D\uDE1F",slightly_frowning_face:"\uD83D\uDE41",frowning_face:"\u2639\uFE0F",persevere:"\uD83D\uDE23",disappointed:"\uD83D\uDE1E",sweat:"\uD83D\uDE13",tired_face:"\uD83D\uDE2B",cry:"\uD83D\uDE22",sob:"\uD83D\uDE2D",triumph:"\uD83D\uDE24",angry:"\uD83D\uDE20",rage:"\uD83D\uDE21",no_mouth:"\uD83D\uDE36",sleeping:"\uD83D\uDE34","+1":"\uD83D\uDC4D",thumbsup:"\uD83D\uDC4D","-1":"\uD83D\uDC4E",thumbsdown:"\uD83D\uDC4E",clap:"\uD83D\uDC4F",raised_hands:"\uD83D\uDE4C",pray:"\uD83D\uDE4F",wave:"\uD83D\uDC4B",ok_hand:"\uD83D\uDC4C",point_up:"\u261D\uFE0F",point_down:"\uD83D\uDC47",point_left:"\uD83D\uDC48",point_right:"\uD83D\uDC49",muscle:"\uD83D\uDCAA",heart:"\u2764\uFE0F",blue_heart:"\uD83D\uDC99",green_heart:"\uD83D\uDC9A",yellow_heart:"\uD83D\uDC9B",purple_heart:"\uD83D\uDC9C",broken_heart:"\uD83D\uDC94",sparkling_heart:"\uD83D\uDC96",star:"\u2B50",star2:"\uD83C\uDF1F",sparkles:"\u2728",boom:"\uD83D\uDCA5",fire:"\uD83D\uDD25",tada:"\uD83C\uDF89",confetti_ball:"\uD83C\uDF8A",rocket:"\uD83D\uDE80",zap:"\u26A1",bulb:"\uD83D\uDCA1",bell:"\uD83D\uDD14",mega:"\uD83D\uDCE3",loudspeaker:"\uD83D\uDCE2",warning:"\u26A0\uFE0F",white_check_mark:"\u2705",check:"\u2705",x:"\u274C",heavy_check_mark:"\u2714\uFE0F",heavy_multiplication_x:"\u2716\uFE0F",question:"\u2753",grey_question:"\u2754",exclamation:"\u2757",grey_exclamation:"\u2755",heavy_plus_sign:"\u2795",heavy_minus_sign:"\u2796",pencil2:"\u270F\uFE0F",memo:"\uD83D\uDCDD",book:"\uD83D\uDCD6",books:"\uD83D\uDCDA",bookmark:"\uD83D\uDD16",mag:"\uD83D\uDD0D",mag_right:"\uD83D\uDD0E",lock:"\uD83D\uDD12",unlock:"\uD83D\uDD13",key:"\uD83D\uDD11",link:"\uD83D\uDD17",computer:"\uD83D\uDCBB",email:"\uD83D\uDCE7",inbox_tray:"\uD83D\uDCE5",outbox_tray:"\uD83D\uDCE4",package:"\uD83D\uDCE6",file_folder:"\uD83D\uDCC1",open_file_folder:"\uD83D\uDCC2",page_facing_up:"\uD83D\uDCC4",calendar:"\uD83D\uDCC5",chart_with_upwards_trend:"\uD83D\uDCC8",chart_with_downwards_trend:"\uD83D\uDCC9",bar_chart:"\uD83D\uDCCA",clipboard:"\uD83D\uDCCB",pushpin:"\uD83D\uDCCC",round_pushpin:"\uD83D\uDCCD",paperclip:"\uD83D\uDCCE",straight_ruler:"\uD83D\uDCCF",wrench:"\uD83D\uDD27",hammer:"\uD83D\uDD28",gear:"\u2699\uFE0F",nut_and_bolt:"\uD83D\uDD29",seedling:"\uD83C\uDF31",evergreen_tree:"\uD83C\uDF32",deciduous_tree:"\uD83C\uDF33",palm_tree:"\uD83C\uDF34",cactus:"\uD83C\uDF35",herb:"\uD83C\uDF3F",shamrock:"\u2618\uFE0F",four_leaf_clover:"\uD83C\uDF40",bug:"\uD83D\uDC1B",bee:"\uD83D\uDC1D",bird:"\uD83D\uDC26",dog:"\uD83D\uDC36",cat:"\uD83D\uDC31",penguin:"\uD83D\uDC27",turtle:"\uD83D\uDC22",fish:"\uD83D\uDC1F",coffee:"\u2615",tea:"\uD83C\uDF75",beer:"\uD83C\uDF7A",beers:"\uD83C\uDF7B",wine_glass:"\uD83C\uDF77",pizza:"\uD83C\uDF55",hamburger:"\uD83C\uDF54",fries:"\uD83C\uDF5F",cake:"\uD83C\uDF70",birthday:"\uD83C\uDF82",cookie:"\uD83C\uDF6A",doughnut:"\uD83C\uDF69",apple:"\uD83C\uDF4E",green_apple:"\uD83C\uDF4F",banana:"\uD83C\uDF4C",strawberry:"\uD83C\uDF53",house:"\uD83C\uDFE0",office:"\uD83C\uDFE2",hospital:"\uD83C\uDFE5",school:"\uD83C\uDFEB",car:"\uD83D\uDE97",taxi:"\uD83D\uDE95",bus:"\uD83D\uDE8C",train:"\uD83D\uDE82",airplane:"\u2708\uFE0F",ship:"\uD83D\uDEA2",bike:"\uD83D\uDEB2",soccer:"\u26BD",basketball:"\uD83C\uDFC0",football:"\uD83C\uDFC8",baseball:"\u26BE",tennis:"\uD83C\uDFBE",trophy:"\uD83C\uDFC6",medal:"\uD83C\uDFC5",dart:"\uD83C\uDFAF",game_die:"\uD83C\uDFB2",musical_note:"\uD83C\uDFB5",notes:"\uD83C\uDFB6",art:"\uD83C\uDFA8",camera:"\uD83D\uDCF7",movie_camera:"\uD83C\uDFA5",checkered_flag:"\uD83C\uDFC1",triangular_flag_on_post:"\uD83D\uDEA9",flag_us:"\uD83C\uDDFA\uD83C\uDDF8",flag_gb:"\uD83C\uDDEC\uD83C\uDDE7",flag_fr:"\uD83C\uDDEB\uD83C\uDDF7",flag_de:"\uD83C\uDDE9\uD83C\uDDEA",flag_jp:"\uD83C\uDDEF\uD83C\uDDF5",flag_cn:"\uD83C\uDDE8\uD83C\uDDF3"};return e.replace(/:(\w+):/g,(n,r)=>{return t[r]||n})}function Os(e){let t=/<Badge([^/>]+)\/>/gi;return e.replace(t,(n,r)=>{let o=r.match(/type="(info|tip|warning|danger)"/i),a=r.match(/text="([^"]+)"/),s=o?o[1].toLowerCase():"info",c=a?a[1]:"",i={info:{bg:"#e0f2fe",text:"#0c4a6e",border:"#0ea5e9"},tip:{bg:"#dcfce7",text:"#14532d",border:"#22c55e"},warning:{bg:"#fef3c7",text:"#78350f",border:"#f59e0b"},danger:{bg:"#fee2e2",text:"#7f1d1d",border:"#ef4444"}},d=i[s]||i.info;return`<span class="badge badge-${s}" style="display: inline-block; padding: 2px 8px; font-size: 0.85em; font-weight: 600; border-radius: 4px; background: ${d.bg}; color: ${d.text}; border: 1px solid ${d.border}; margin: 0 4px; vertical-align: middle;">${c}</span>`})}function Ss(e){return e.replace(/<a\s+href="([^"]+)"([^>]*)>/g,(t,n,r)=>{if(r.includes("target="))return t;if(n.startsWith("http://")||n.startsWith("https://"))return`<a href="${n}" target="_blank" rel="noreferrer noopener"${r}>`;return t})}function Ys(e){return e.replace(/<a\s+href="([^"]+)"\s+target="_blank"[^>]*>[\s\S]+?<\/a>/g,(t,n)=>{if(t.includes("external-link-icon"))return t;let r='<svg class="external-link-icon" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display: inline-block; margin-left: 4px; vertical-align: middle;"><path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"></path><polyline points="15 3 21 3 21 9"></polyline><line x1="10" y1="14" x2="21" y2="3"></line></svg>';return t.replace("</a>",`${r}</a>`)})}function Fs(e){return e.replace(/<img([^>]+)>/g,(t,n)=>{if(n.includes("loading="))return t;return`<img ${n} loading="lazy" decoding="async">`})}function Is(e,t){if(!e.includes("[[toc]]"))return{content:e,tocHtml:null};let n=vt(e),r={...Ct,...t},o=Dt(n,r),s={items:Kt(o),title:r.title||"Table of Contents",config:r},c=st(s),i="<!--INLINE_TOC_PLACEHOLDER-->";return{content:e.replace(/\[\[toc\]\]/g,i),tocHtml:c}}function Xs(e,t){return e.replace(/<!--INLINE_TOC_PLACEHOLDER-->/g,t)}async function Js(e){let t=/^>\s*\[!(NOTE|TIP|IMPORTANT|WARNING|CAUTION)\]\s*\n((?:>\s*.*\n?)*)/gm,n=Array.from(e.matchAll(t)),r=e;for(let o of n.reverse()){let[a,s,c]=o,i=c.split(`
9624
+ `).map((m)=>m.replace(/^>\s*/,"")).filter((m)=>m.trim()).map((m)=>`<p>${jr(m)}</p>`).join(`
9625
+ `),d=s.toLowerCase(),l=await ee(`blocks/alerts/${d}`,{content:i});r=r.slice(0,o.index)+l+r.slice(o.index+a.length)}return r}async function Qs(e,t){let n=/^<<<\s+@\/([^\s[{#]+)(?:\{(\d+)-(\d+)\}|#(\w+))?\s*(?:\[[^\]]+\]\s*)?$/gm,r=Array.from(e.matchAll(n)),o=e;for(let a of r.reverse()){let[s,c,i,d,l]=a;try{let{join:m}=await import("path"),u=m(t,c),p=Bun.file(u);if(!await p.exists()){console.warn(`Code import: File not found: ${u}`);continue}let y=(await p.text()).split(`
9626
+ `),w=c.split(".").pop()||"",b={js:"javascript",ts:"typescript",jsx:"jsx",tsx:"tsx",py:"python",rb:"ruby",go:"go",rs:"rust",java:"java",cpp:"cpp",c:"c",cs:"csharp",php:"php",sh:"bash",bash:"bash",yaml:"yaml",yml:"yaml",json:"json",md:"markdown",html:"html",css:"css",scss:"scss",vue:"vue"}[w]||w;if(i&&d){let k=Number.parseInt(i)-1,U=Number.parseInt(d);y=y.slice(k,U)}else if(l){let k=y.findIndex((Y)=>Y.includes(`#region ${l}`)||Y.includes(`// region ${l}`)||Y.includes(`# region ${l}`)),U=y.findIndex((Y,ce)=>ce>k&&(Y.includes("#endregion")||Y.includes("// endregion")||Y.includes("# endregion")));if(k!==-1&&U!==-1)y=y.slice(k+1,U);else console.warn(`Code import: Region '${l}' not found in ${c}`)}let q=y.join(`
9627
+ `),g=`\`\`\`${b}
9628
+ ${q}
9629
+ \`\`\``;o=o.slice(0,a.index)+g+o.slice(a.index+s.length)}catch(m){console.error(`Error importing code from ${c}:`,m)}}return o}async function zr(e,t,n=new Set){let r=/<!--@include:\s*([^\s{]+)(?:\{(\d+)-(\d+)\}|\{#([\w-]+)\})?\s*-->/g,o=Array.from(e.matchAll(r)),a=e;for(let s of o.reverse()){let[c,i,d,l,m]=s;try{let{join:u,resolve:p}=await import("path"),h=p(u(t,i));if(n.has(h)){console.warn(`Markdown include: Circular reference detected for ${i}`);continue}let y=Bun.file(h);if(!await y.exists()){console.warn(`Markdown include: File not found: ${h}`);continue}let f=(await y.text()).split(`
9630
+ `);if(d&&l){let g=Number.parseInt(d)-1,k=Number.parseInt(l);f=f.slice(g,k)}else if(m){let g=f.findIndex((U)=>U.includes(`<!-- #region ${m} -->`)||U.includes(`<!-- region ${m} -->`)),k=f.findIndex((U,Y)=>Y>g&&(U.includes("<!-- #endregion -->")||U.includes("<!-- endregion -->")));if(g!==-1&&k!==-1)f=f.slice(g+1,k);else{console.warn(`Markdown include: Region '${m}' not found in ${i}`);continue}}let b=f.join(`
9631
+ `),q=new Set(n);q.add(h),b=await zr(b,t,q),a=a.slice(0,s.index)+b+a.slice(s.index+c.length)}catch(u){console.error(`Error including markdown from ${i}:`,u)}}return a}async function Ws(e){let t=/^:::\s+code-group[ \t]*\n((?:(?!^:::)[\s\S])*)^:::$/gm,n=Array.from(e.matchAll(t)),r=e;for(let o of n.reverse()){let[a,s]=o,c=/^```(\w+)[ \t]+\[([^\]]+)\][ \t]*\n((?:(?!^```)[\s\S])*)^```$/gm,i=Array.from(s.matchAll(c));if(i.length===0)continue;let d=`code-group-${Math.random().toString(36).substr(2,9)}`,l=i.map((p,h)=>{let y=p[2];return`<button class="code-group-tab ${h===0?"active":""}" onclick="switchCodeTab('${d}', ${h})">${y}</button>`}).join(""),m=await Promise.all(i.map(async(p,h)=>{let y=p[1],w=p[3],f=h===0,b=ge.markdown?.syntaxHighlightTheme||"github-light",q=await Qt(w,y,b);return`<div class="code-group-panel ${f?"active":""}" data-panel="${h}">
9632
+ <pre data-lang="${y}"><code class="language-${y}">${q}</code></pre>
9611
9633
  </div>`})),u=`<div class="code-group" id="${d}">
9612
9634
  <div class="code-group-tabs">
9613
- ${m}
9635
+ ${l}
9614
9636
  </div>
9615
9637
  <div class="code-group-panels">
9616
- ${l.join(`
9638
+ ${m.join(`
9617
9639
  `)}
9618
9640
  </div>
9619
- </div>`;r=r.slice(0,o.index)+u+r.slice(o.index+a.length)}return r}async function Fs(e){let t=/^:::\s+(info|tip|warning|danger|details|raw)(?: +([^\n\t ][^\n]*))?\n((?:(?!^:::)[\s\S])*)^:::$/gm,n=Array.from(e.matchAll(t)),r=e;for(let o of n.reverse()){let[a,s,c,i]=o,d={info:"INFO",tip:"TIP",warning:"WARNING",danger:"DANGER",details:"Details",raw:""},m=c&&c.trim()||d[s],l=i.trim().split(`
9620
- `).filter((p)=>p.trim()).map((p)=>`<p>${M(p)}</p>`).join(`
9621
- `),u=await ee(`blocks/containers/${s}`,{title:m,content:l});r=r.slice(0,o.index)+u+r.slice(o.index+a.length)}return r}function Is(e){let t=e.match(/^(\w+)/),n=t?t[1]:"",r=e.match(/\{([^}]+)\}/),o=[];if(r){let s=r[1].split(",");for(let c of s){let i=c.trim();if(i.includes("-")){let[d,m]=i.split("-").map(Number);for(let l=d;l<=m;l++)o.push(l)}else o.push(Number(i))}}let a=e.includes(":line-numbers");return{lang:n,highlights:o,showLineNumbers:a}}async function Js(e,t){let n=e[t],r=n.match(/^(`{3,})/),o=r?r[1].length:3,a="`".repeat(o),s=n.substring(o).trim(),{lang:c,highlights:i,showLineNumbers:d}=Is(s),m=[],l=t+1;while(l<e.length){let te=e[l];if(te.match(new RegExp(`^\`{${o},}\\s*$`)))break;m.push(te),l++}let u=new Set,p=new Set,f=new Set,y=new Set,h=new Set,w=m.map((te,D)=>{let U=te;if(U.includes("// [!code focus]"))u.add(D),U=U.replace(/\/\/ \[!code focus\]/,"").trimEnd();if(U.includes("// [!code ++]"))p.add(D),U=U.replace(/\/\/ \[!code \+\+\]/,"").trimEnd();if(U.includes("// [!code --]"))f.add(D),U=U.replace(/\/\/ \[!code --\]/,"").trimEnd();if(U.includes("// [!code error]"))y.add(D),U=U.replace(/\/\/ \[!code error\]/,"").trimEnd();if(U.includes("// [!code warning]"))h.add(D),U=U.replace(/\/\/ \[!code warning\]/,"").trimEnd();return U}),b=u.size>0,_=w.join(`
9622
- `),A=qe.markdown?.syntaxHighlightTheme||"github-light",Z=(await Ct(_,c,A)).split(`
9623
- `).map((te,D)=>{let U=D+1,qr=i.includes(U),Dt=u.has(D),_r=p.has(D),jr=f.has(D),Er=y.has(D),zr=h.has(D),ne=["line"];if(qr)ne.push("highlighted");if(Dt)ne.push("focused");if(b&&!Dt)ne.push("dimmed");if(_r)ne.push("diff-add");if(jr)ne.push("diff-remove");if(Er)ne.push("has-error");if(zr)ne.push("has-warning");if(te.startsWith('<span class="line">')){let Nr=ne.join(" "),Vt=te.replace('<span class="line">',`<span class="${Nr}">`);if(d)return Vt.replace("<span class=",`<span class="line-number">${U}</span><span class=`);return Vt}let Ht=` class="${ne.join(" ")}"`;if(d)return`<span${Ht}><span class="line-number">${U}</span>${te}</span>`;return`<span${Ht}>${te}</span>`}).join(`
9624
- `),K=[];if(d)K.push("line-numbers-mode");if(b)K.push("has-focused-lines");let it=K.length>0?` class="${K.join(" ")}"`:"",ct=c?` data-lang="${c}"`:"";return{html:`<pre${it}${ct}><code class="language-${c}">${Z}</code></pre>`,endIndex:l}}async function Cs(e,t="./docs"){let{frontmatter:n,content:r}=Ns(e);if(n.layout==="home"){let f=await Zs(n.hero),y=await xs(n.features);return{html:f+y,frontmatter:n}}let o=await $r(r,t),{content:a,tocHtml:s}=Us(o,n.toc);o=await Ys(a,t),o=await Xs(o),o=await Os(o),o=await Fs(o),o=Ts(o),o=Rs(o);let c=o.split(`
9625
- `),i=[],d=!1,m=!1,l="ul",u=0;for(let f=0;f<c.length;f++){let y=c[f];if(y.trim().startsWith(":::"))continue;if(y.includes('<div class="custom-block')||y.includes('<details class="custom-block')||y.includes('<div class="github-alert')||y.includes('<div class="code-group'))u=1;if(u>0){i.push(y);let h=(y.match(/<div[^>]*>/g)||[]).length+(y.match(/<details[^>]*>/g)||[]).length,w=(y.match(/<\/div>/g)||[]).length+(y.match(/<\/details>/g)||[]).length;u+=h-w;continue}if(y.startsWith("```")){if(!d){let{html:h,endIndex:w}=await Js(c,f);i.push(h),f=w,d=!1}continue}if(y.startsWith("###### ")){if(m)i.push(l==="ol"?"</ol>":"</ul>"),m=!1;i.push(`<h6>${M(y.substring(7))}</h6>`);continue}if(y.startsWith("##### ")){if(m)i.push(l==="ol"?"</ol>":"</ul>"),m=!1;i.push(`<h5>${M(y.substring(6))}</h5>`);continue}if(y.startsWith("#### ")){if(m)i.push(l==="ol"?"</ol>":"</ul>"),m=!1;i.push(`<h4>${M(y.substring(5))}</h4>`);continue}if(y.startsWith("### ")){if(m)i.push(l==="ol"?"</ol>":"</ul>"),m=!1;i.push(`<h3>${M(y.substring(4))}</h3>`);continue}if(y.startsWith("## ")){if(m)i.push(l==="ol"?"</ol>":"</ul>"),m=!1;i.push(`<h2>${M(y.substring(3))}</h2>`);continue}if(y.startsWith("# ")){if(m)i.push(l==="ol"?"</ol>":"</ul>"),m=!1;i.push(`<h1>${M(y.substring(2))}</h1>`);continue}if(y.match(/^\s*[-*]\s+\[([ xX])\]\s+/)){if(!m)i.push('<ul class="task-list">'),m=!0,l="ul";let w=y.match(/\[[xX]\]/)?'<input type="checkbox" checked disabled class="task-list-checkbox">':'<input type="checkbox" disabled class="task-list-checkbox">',b=y.replace(/^\s*[-*]\s+\[([ xX])\]\s+/,"");i.push(`<li class="task-list-item">${w} ${M(b)}</li>`);continue}if(y.match(/^\s*[-*]\s+/)){if(!m)i.push("<ul>"),m=!0,l="ul";i.push(`<li>${M(y.replace(/^\s*[-*]\s+/,""))}</li>`);continue}if(y.match(/^\s*\d+\.\s+/)){if(!m)i.push("<ol>"),m=!0,l="ol";i.push(`<li>${M(y.replace(/^\s*\d+\.\s+/,""))}</li>`);continue}if(m&&y.trim()!=="")i.push(l==="ol"?"</ol>":"</ul>"),m=!1;if(y.trim().startsWith("|")&&y.trim().endsWith("|")){let h=[],w=f;while(w<c.length&&c[w].trim().startsWith("|"))h.push(c[w].trim()),w++;if(h.length>=2){let b=(g)=>{return M(g.trim())},A=h[1].split("|").filter((g)=>g.trim()).map((g)=>{let Z=g.trim();if(Z.startsWith(":")&&Z.endsWith(":"))return"center";else if(Z.endsWith(":"))return"right";else return"left"});i.push('<div class="table-responsive">'),i.push('<table class="enhanced-table">');let k=h[0].split("|").filter((g)=>g.trim());if(i.push(" <thead>"),i.push(" <tr>"),k.forEach((g,Z)=>{let K=A[Z]||"left";i.push(` <th style="text-align: ${K}">${b(g)}</th>`)}),i.push(" </tr>"),i.push(" </thead>"),h.length>2){i.push(" <tbody>");for(let g=2;g<h.length;g++){let Z=h[g].split("|").filter((K)=>K.trim());i.push(" <tr>"),Z.forEach((K,it)=>{let ct=A[it]||"left";i.push(` <td style="text-align: ${ct}">${b(K)}</td>`)}),i.push(" </tr>")}i.push(" </tbody>")}i.push("</table>"),i.push("</div>"),f=w-1;continue}}if(y.trim()==="")continue;if(y.trim().startsWith("<!--")&&y.trim().endsWith("-->")){i.push(y);continue}y=M(y),i.push(`<p>${y}</p>`)}if(m)i.push(l==="ol"?"</ol>":"</ul>");let p=i.join(`
9626
- `);if(s)p=Gs(p,s);return p=Ls(p),p=Bs(p),p=Ss(p),{html:p,frontmatter:n}}async function Qs(e={}){let t=e.config||qe,n=e.port||3000,r=e.root||"./docs",o=Bun.serve({port:n,async fetch(c){let d=new URL(c.url).pathname;if(d==="/")d="/index";if([".png",".jpg",".jpeg",".gif",".svg",".css",".js",".ico",".woff",".woff2",".ttf"].some((u)=>d.endsWith(u)))try{let u=`${r}/public${d}`,p=Bun.file(u);if(await p.exists())return new Response(p);let f=`${r}${d}`,y=Bun.file(f);if(await y.exists())return new Response(y)}catch{}let l=`${r}${d}.md`;try{let u=Bun.file(l);if(await u.exists()){let p=await u.text(),{html:f,frontmatter:y}=await Cs(p,r),h=y.layout==="home",w=await gr(f,t,d,h);return new Response(w,{headers:{"Content-Type":"text/html; charset=utf-8"}})}}catch{}return new Response(await gr("<h1>404 - Page Not Found</h1><p>The page you are looking for does not exist.</p>",t,d),{status:404,headers:{"Content-Type":"text/html; charset=utf-8"}})}}),a=`http://localhost:${o.port}`,s=()=>o.stop();return console.log(`
9641
+ </div>`;r=r.slice(0,o.index)+u+r.slice(o.index+a.length)}return r}async function Cs(e){let t=/^:::\s+(info|tip|warning|danger|details|raw)(?: +([^\n\t ][^\n]*))?\n((?:(?!^:::)[\s\S])*)^:::$/gm,n=Array.from(e.matchAll(t)),r=e;for(let o of n.reverse()){let[a,s,c,i]=o,d={info:"INFO",tip:"TIP",warning:"WARNING",danger:"DANGER",details:"Details",raw:""},l=c&&c.trim()||d[s],m=i.trim().split(`
9642
+ `).filter((p)=>p.trim()).map((p)=>`<p>${jr(p)}</p>`).join(`
9643
+ `),u=await ee(`blocks/containers/${s}`,{title:l,content:m});r=r.slice(0,o.index)+u+r.slice(o.index+a.length)}return r}function Ms(e){let t=e.match(/^(\w+)/),n=t?t[1]:"",r=e.match(/\{([^}]+)\}/),o=[];if(r){let s=r[1].split(",");for(let c of s){let i=c.trim();if(i.includes("-")){let[d,l]=i.split("-").map(Number);for(let m=d;m<=l;m++)o.push(m)}else o.push(Number(i))}}let a=e.includes(":line-numbers");return{lang:n,highlights:o,showLineNumbers:a}}async function vs(e,t){let n=e[t],r=n.match(/^(`{3,})/),o=r?r[1].length:3,a="`".repeat(o),s=n.substring(o).trim(),{lang:c,highlights:i,showLineNumbers:d}=Ms(s),l=[],m=t+1;while(m<e.length){let te=e[m];if(te.match(new RegExp(`^\`{${o},}\\s*$`)))break;l.push(te),m++}let u=new Set,p=new Set,h=new Set,y=new Set,w=new Set,f=l.map((te,K)=>{let B=te;if(B.includes("// [!code focus]"))u.add(K),B=B.replace(/\/\/ \[!code focus\]/,"").trimEnd();if(B.includes("// [!code ++]"))p.add(K),B=B.replace(/\/\/ \[!code \+\+\]/,"").trimEnd();if(B.includes("// [!code --]"))h.add(K),B=B.replace(/\/\/ \[!code --\]/,"").trimEnd();if(B.includes("// [!code error]"))y.add(K),B=B.replace(/\/\/ \[!code error\]/,"").trimEnd();if(B.includes("// [!code warning]"))w.add(K),B=B.replace(/\/\/ \[!code warning\]/,"").trimEnd();return B}),b=u.size>0,q=f.join(`
9644
+ `),g=ge.markdown?.syntaxHighlightTheme||"github-light",Y=(await Qt(q,c,g)).split(`
9645
+ `).map((te,K)=>{let B=K+1,Er=i.includes(B),Vt=u.has(K),Tr=p.has(K),Nr=h.has(K),Zr=y.has(K),xr=w.has(K),ne=["line"];if(Er)ne.push("highlighted");if(Vt)ne.push("focused");if(b&&!Vt)ne.push("dimmed");if(Tr)ne.push("diff-add");if(Nr)ne.push("diff-remove");if(Zr)ne.push("has-error");if(xr)ne.push("has-warning");if(te.startsWith('<span class="line">')){let Lr=ne.join(" "),en=te.replace('<span class="line">',`<span class="${Lr}">`);if(d)return en.replace("<span class=",`<span class="line-number">${B}</span><span class=`);return en}let Pt=` class="${ne.join(" ")}"`;if(d)return`<span${Pt}><span class="line-number">${B}</span>${te}</span>`;return`<span${Pt}>${te}</span>`}).join(`
9646
+ `),ce=[];if(d)ce.push("line-numbers-mode");if(b)ce.push("has-focused-lines");let F=ce.length>0?` class="${ce.join(" ")}"`:"",me=c?` data-lang="${c}"`:"";return{html:`<pre${F}${me}><code class="language-${c}">${Y}</code></pre>`,endIndex:m}}function Ks(e){let t=new Map;return{content:e.replace(/^(#{1,6})\s+(.*?)\s*\{#([\w-]+)\}\s*$/gm,(r,o,a,s)=>{let c=a.trim().replace(/`([^`]+)`/g,"$1").replace(/\*\*(.+?)\*\*/g,"$1").replace(/__(.+?)__/g,"$1").replace(/\*(.+?)\*/g,"$1").replace(/_(.+?)_/g,"$1").replace(/~~(.+?)~~/g,"$1").trim();return t.set(c,s),`${o} ${a.trim()}`}),customAnchors:t}}async function Ds(e,t){let n=e.split(`
9647
+ `),r=[],o=0,a=0;while(o<n.length){let s=n[o];if(s.match(/^`{3,}/)){let{html:c,endIndex:i}=await vs(n,o),d=`<!--BUNPRESS_CODE_${a++}-->`;t.set(d,c),r.push(""),r.push(d),r.push(""),o=i+1}else r.push(s),o++}return r.join(`
9648
+ `)}function Hs(e){return e=e.replace(/==(.+?)==/g,"<mark>$1</mark>"),e=e.replace(/\^(.+?)\^/g,"<sup>$1</sup>"),e=e.replace(/(?<!~)~(?!~)(.+?)(?<!~)~(?!~)/g,"<sub>$1</sub>"),e}function Vs(e){return e=e.replace(/<table>/g,`<div class="table-responsive">
9649
+ <table class="enhanced-table">`),e=e.replace(/<\/table>/g,`</table>
9650
+ </div>`),e=e.replace(/<(th|td) align="(left|center|right)">/g,(t,n,r)=>{return`<${n} style="text-align: ${r}">`}),e=e.replace(/<(th|td)>/g,(t,n)=>{return`<${n} style="text-align: left">`}),e}function Ps(e,t){let n=new Set;return e.replace(/<h([1-6])([^>]*)>([\s\S]*?)<\/h\1>/g,(r,o,a,s)=>{if(a.includes(" id="))return r;let c=s.replace(/<[^>]+>/g,"").trim(),i=t.get(c);if(!i)i=Mt(c);if(n.has(i)){let d=1;while(n.has(`${i}-${d}`))d++;i=`${i}-${d}`}return n.add(i),`<h${o} id="${i}"${a}>${s}</h${o}>`})}async function ei(e,t="./docs"){let{frontmatter:n,content:r}=Rs(e);if(n.layout==="home"){let h=await Bs(n.hero),y=await Us(n.features);return{html:h+y,frontmatter:n}}let o=ge.markdown?.features,a=(h)=>{if(!o)return!0;let y=o[h];return y===void 0||y===!0||typeof y==="object"&&y!==null},s=a("includes")?await zr(r,t):r;if(s.includes("@if")||s.includes("@foreach")||s.includes("@for (")||s.includes("<script server")||s.includes("@include")||/\{\{(?!\{)\s*\w/.test(s))try{s=await(await import("@stacksjs/stx")).renderString(s,{...n})}catch{}let{content:i,tocHtml:d}=a("inlineToc")?Is(s,n.toc):{content:s,tocHtml:""};s=a("codeImports")?await Qs(i,t):i,s=a("codeGroups")?await Ws(s):s,s=a("githubAlerts")?await Js(s):s,s=a("containers")?await Cs(s):s,s=a("emoji")?Gs(s):s,s=a("badges")?Os(s):s;let{content:l,customAnchors:m}=a("customAnchors")?Ks(s):{content:s,customAnchors:new Map};s=l;let u=new Map;s=a("codeBlocks")?await Ds(s,u):s;let p=Bun.markdown.html(s,{tables:!0,strikethrough:!0,tasklists:!0,autolinks:!0});for(let[h,y]of u)p=p.replace(`<p>${h}</p>`,y),p=p.replace(h,y);if(a("inlineFormatting"))p=Hs(p);if(a("tables"))p=Vs(p);if(p=Ps(p,m),d)p=Xs(p,d);if(a("externalLinks"))p=Ss(p),p=Ys(p);if(a("imageLazyLoading"))p=Fs(p);return{html:p,frontmatter:n}}async function ti(e={}){let t=e.config||ge,n=e.port||3000,r=e.root||"./docs",o=Bun.serve({port:n,async fetch(c){let d=new URL(c.url).pathname;if(d==="/")d="/index";if([".png",".jpg",".jpeg",".gif",".svg",".css",".js",".ico",".woff",".woff2",".ttf"].some((u)=>d.endsWith(u)))try{let u=`${r}/public${d}`,p=Bun.file(u);if(await p.exists())return new Response(p);let h=`${r}${d}`,y=Bun.file(h);if(await y.exists())return new Response(y)}catch{}let m=`${r}${d}.md`;try{let u=Bun.file(m);if(await u.exists()){let p=await u.text(),{html:h,frontmatter:y}=await ei(p,r),w=y.layout||"doc",f=await $r(h,t,d,w);return new Response(f,{headers:{"Content-Type":"text/html; charset=utf-8"}})}}catch{}return new Response(await $r("<h1>404 - Page Not Found</h1><p>The page you are looking for does not exist.</p>",t,d),{status:404,headers:{"Content-Type":"text/html; charset=utf-8"}})}}),a=`http://localhost:${o.port}`,s=()=>o.stop();if(!e.quiet)console.log(`
9627
9651
  \uD83D\uDCDA BunPress documentation server running at ${a}`),console.log(`Press Ctrl+C to stop
9628
- `),{server:o,url:a,stop:s}}async function Fd(e={}){let{stop:t}=await Qs(e),n=e.watch!==void 0?e.watch:!0,r=e.root||"./docs";if(n){console.log(`Watching for changes in ${r} directory...
9629
- `);try{let o=new Map,a=new fr("**/*.{md,stx,ts,js,css,html}");for await(let i of a.scan(r))try{let d=kr(r,i),m=await br(d);o.set(i,m.mtimeMs)}catch{}let s=null,c=()=>{if(s)clearTimeout(s);s=setTimeout(async()=>{console.log("File changed detected, reloading..."),lr(),console.log("Ready for requests")},100)};setInterval(async()=>{try{let i=!1,d=new Set,m=new fr("**/*.{md,stx,ts,js,css,html}");for await(let l of m.scan(r)){d.add(l);try{let u=kr(r,l),p=await br(u),f=o.get(l);if(f===void 0||p.mtimeMs>f)i=!0,o.set(l,p.mtimeMs)}catch{}}for(let l of o.keys())if(!d.has(l))i=!0,o.delete(l);if(i)c()}catch{}},1000)}catch(o){console.error("Error setting up file watcher:",o)}}st.on("SIGINT",()=>{console.log(`
9630
- Shutting down server...`),t(),st.exit(0)}),st.on("SIGTERM",()=>{console.log(`
9631
- Shutting down server...`),t(),st.exit(0)}),await new Promise(()=>{})}
9632
- export{ce as g,zo as h,qe as i,$c as j,yd as k,Jt as l,cr as m,Ct as n,hd as o,dr as p,wd as q,fd as r,Wt as s,us as t,wr as u,vt as v,Mt as w,Kt as x,ot as y,at as z,ys as A,hs as B,ws as C,Ed as D,zd as E,Nd as F,Zd as G,xd as H,gr as I,Cs as J,Qs as K,Fd as L};
9652
+ `);return{server:o,url:a,stop:s}}async function Vd(e={}){let{stop:t}=await ti(e),n=e.watch!==void 0?e.watch:!0,r=e.root||"./docs";if(n){console.log(`Watching for changes in ${r} directory...
9653
+ `);try{let o=new Map,a=new kr("**/*.{md,stx,ts,js,css,html}");for await(let i of a.scan(r))try{let d=Ar(r,i),l=await gr(d);o.set(i,l.mtimeMs)}catch{}let s=null,c=()=>{if(s)clearTimeout(s);s=setTimeout(async()=>{console.log("File changed detected, reloading..."),ur(),console.log("Ready for requests")},100)};setInterval(async()=>{try{let i=!1,d=new Set,l=new kr("**/*.{md,stx,ts,js,css,html}");for await(let m of l.scan(r)){d.add(m);try{let u=Ar(r,m),p=await gr(u),h=o.get(m);if(h===void 0||p.mtimeMs>h)i=!0,o.set(m,p.mtimeMs)}catch{}}for(let m of o.keys())if(!d.has(m))i=!0,o.delete(m);if(i)c()}catch{}},1000)}catch(o){console.error("Error setting up file watcher:",o)}}it.on("SIGINT",()=>{console.log(`
9654
+ Shutting down server...`),t(),it.exit(0)}),it.on("SIGTERM",()=>{console.log(`
9655
+ Shutting down server...`),t(),it.exit(0)}),await new Promise(()=>{})}
9656
+ export{V as g,xo as h,ge as i,Lc as j,_d as k,Jt as l,lr as m,Qt as n,jd as o,mr as p,zd as q,Ed as r,Ct as s,Mt as t,br as u,vt as v,Kt as w,Dt as x,at as y,st as z,bs as A,ks as B,gs as C,Od as D,Sd as E,Yd as F,Fd as G,Id as H,$r as I,ei as J,ti as K,Vd as L};