#!/usr/bin/env node
import {c,a,e}from'./chunk-XHJ27CER.js';var y=c((q,d)=>{var l=Object.defineProperty,S=Object.getOwnPropertyDescriptor,L=Object.getOwnPropertyNames,$=Object.prototype.hasOwnProperty,P=(t,r)=>{for(var e in r)l(t,e,{get:r[e],enumerable:true});},D=(t,r,e,o)=>{if(r&&typeof r=="object"||typeof r=="function")for(let s of L(r))!$.call(t,s)&&s!==e&&l(t,s,{get:()=>r[s],enumerable:!(o=S(r,s))||o.enumerable});return t},T=t=>D(l({},"__esModule",{value:true}),t),h={};P(h,{ParadigmLogger:()=>g,createCorrelationId:()=>A,log:()=>U,withCorrelation:()=>M});d.exports=T(h);var x={debug:"\x1B[90m",info:"\x1B[36m",warn:"\x1B[33m",error:"\x1B[31m"},E="\x1B[1m",c="\x1B[0m";function I(){let t=new Date,r=String(t.getHours()).padStart(2,"0"),e=String(t.getMinutes()).padStart(2,"0"),o=String(t.getSeconds()).padStart(2,"0"),s=String(t.getMilliseconds()).padStart(3,"0");return `${r}:${e}:${o}.${s}`}function j(t){return !t||Object.keys(t).length===0?"":" "+JSON.stringify(t)}function C(t,r,e,o,s,i){let n=x[t],a=t.toUpperCase().padEnd(5),b=I(),w=j(i?{correlationId:i,...s}:s);return `${n}${b}${c} ${E}${r}${c} ${n}${a}${c} ${o}${w}`}function F(t,r,e,o,s,i){let n={timestamp:new Date().toISOString(),level:t,symbol:r,symbolType:e,message:o,...s};return i&&(n.correlationId=i),JSON.stringify(n)}var B=a("async_hooks"),N=a("crypto"),f=new B.AsyncLocalStorage;function A(){return (0, N.randomUUID)()}function M(t,r){return f.run(t,r)}function R(){return f.getStore()}var u={debug:0,info:1,warn:2,error:3};function V(){let t=typeof process<"u"?process.env:{},r=t.LOG_LEVEL;return r&&u[r]!==void 0?r:t.NODE_ENV==="production"?"info":"debug"}function k(){let t=typeof process<"u"?process.env:{};return t.PARADIGM_LOG_FORMAT==="json"||t.NODE_ENV==="production"?"json":"pretty"}function G(){let r=(typeof process<"u"?process.env:{}).PARADIGM_SYMBOLS;return r?r.split(",").map(e=>e.trim()).filter(Boolean):null}var J=class{constructor(t){this.emit=t,this.startTime=Date.now();}startTime;success(t,r){this.end("info",t,r);}error(t,r){this.end("error",t,r);}end(t,r,e){let o=Date.now()-this.startTime;this.emit(t,r,{...e,duration:`${o}ms`});}},m=class{constructor(t,r,e,o,s,i,n=[]){this.symbol=t,this.symbolType=r,this.minLevel=e,this.symbolFilter=o,this.format=s,this.output=i,this.transports=n;}debug(t,r){this.emit("debug",t,r);}info(t,r){this.emit("info",t,r);}warn(t,r){this.emit("warn",t,r);}error(t,r){this.emit("error",t,r);}start(t,r){return this.emit("info",t,r),new J((e,o,s)=>this.emit(e,o,s))}emit(t,r,e){if(u[t]<u[this.minLevel])return;if(this.symbolFilter){let n=this.symbol.charAt(0);if(!this.symbolFilter.includes(n))return}let o=R(),i=(this.format==="json"?F:C)(t,this.symbol,this.symbolType,r,e,o);if(this.output(i),this.transports.length>0){let n={level:t,symbol:this.symbol,symbolType:this.symbolType,message:r,data:e,correlationId:o,timestamp:new Date().toISOString()};for(let a of this.transports)a.send(n);}}},g=class{level;symbolFilter;format;output;transports;constructor(t){this.level=t?.level??V(),this.symbolFilter=t?.symbols??G(),this.format=t?.format??k(),this.output=t?.output??(r=>console.log(r)),this.transports=t?.transports??[];}addTransport(t){this.transports.push(t);}removeTransport(t){let r=this.transports.indexOf(t);r!==-1&&this.transports.splice(r,1);}component(t){return this.create(t,"component","#")}gate(t){return this.create(t,"gate","^")}signal(t){return this.create(t,"signal","!")}flow(t){return this.create(t,"flow","$")}aspect(t){return this.create(t,"aspect","~")}raw(t){return new m(t,"raw",this.level,this.symbolFilter,this.format,this.output,this.transports)}create(t,r,e){let o=t.startsWith(e)?t:`${e}${t}`;return new m(o,r,this.level,this.symbolFilter,this.format,this.output,this.transports)}},U=new g;});var v=e(y(),1),W=new v.ParadigmLogger({output:t=>process.stderr.write(t+`
`)});export{W as a};