@visulima/pail 4.0.0-alpha.16 → 4.0.0-alpha.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +19 -0
- package/dist/index.browser.js +17 -17
- package/dist/index.server.js +22 -22
- package/dist/packem_shared/PrettyReporter-C9D3lmF2.js +44 -0
- package/dist/packem_shared/abstract-pretty-reporter-CHU4NOsN.js +33 -0
- package/dist/reporter/pretty/index.js +1 -1
- package/dist/reporter/simple/simple-reporter.server.js +1 -1
- package/package.json +23 -23
- package/dist/packem_shared/PrettyReporter-N7FvHzl5.js +0 -44
- package/dist/packem_shared/abstract-pretty-reporter-Bag7lQKf.js +0 -33
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,22 @@
|
|
|
1
|
+
## @visulima/pail [4.0.0-alpha.17](https://github.com/visulima/visulima/compare/@visulima/pail@4.0.0-alpha.16...@visulima/pail@4.0.0-alpha.17) (2026-05-26)
|
|
2
|
+
|
|
3
|
+
### Bug Fixes
|
|
4
|
+
|
|
5
|
+
* **pail,fs:** bind logger.raw and inline picomatch options ([e8b20d2](https://github.com/visulima/visulima/commit/e8b20d2afdbcadf2f531ac3593dc0b7210684955))
|
|
6
|
+
|
|
7
|
+
### Miscellaneous Chores
|
|
8
|
+
|
|
9
|
+
* **ci-stability:** green CI across vis, native, lint, tests, attw ([#651](https://github.com/visulima/visulima/issues/651)) ([d4eb684](https://github.com/visulima/visulima/commit/d4eb684b5f75c818c9251048c605a0ed54a268e3))
|
|
10
|
+
|
|
11
|
+
### Tests
|
|
12
|
+
|
|
13
|
+
* **repo:** add dist runtime + types integration tests ([32ee300](https://github.com/visulima/visulima/commit/32ee300b7184117a0ddf9f9d390f75f8932d5ed9))
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### Dependencies
|
|
17
|
+
|
|
18
|
+
* **@visulima/error:** upgraded to 6.0.0-alpha.28
|
|
19
|
+
|
|
1
20
|
## @visulima/pail [4.0.0-alpha.16](https://github.com/visulima/visulima/compare/@visulima/pail@4.0.0-alpha.15...@visulima/pail@4.0.0-alpha.16) (2026-05-14)
|
|
2
21
|
|
|
3
22
|
### Miscellaneous Chores
|
package/dist/index.browser.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
var ce=Object.defineProperty;var u=(o,e)=>ce(o,"name",{value:e,configurable:!0});import{L as ue,a as ge,E as fe}from"./packem_shared/constants-DKfCaSUR.js";import{t as pe}from"./packem_shared/write-console-log-based-on-level-DfD64owL.js";import{s as se,G as he}from"./packem_shared/index-Bzp4LnJ5.js";import ye from"./packem_shared/JsonReporter-CE-lw7R0.js";import{PailError as Ue,createPailError as We}from"./packem_shared/createPailError-53jAfQ-T.js";var
|
|
2
|
-
${
|
|
3
|
-
${
|
|
4
|
-
${O}`),l.pop(),`[${f}]`}let b=Object.keys(c);const S=b.length;if(S===0)return"{}";if(C<l.length+1)return'"[Object]"';let
|
|
5
|
-
${
|
|
6
|
-
${
|
|
7
|
-
${O}`),l.pop(),`{${f}}`}case"number":return isFinite(c)?String(c):n?n(c):"null";case"boolean":return c===!0?"true":"false";case"undefined":return;case"bigint":if(A)return String(c);default:return n?n(c):void 0}}u(z,"J"),r(z,"stringifyFnReplacer");function G(x,t,l,h,g,
|
|
8
|
-
${
|
|
9
|
-
${
|
|
10
|
-
${c}`),l.pop(),`[${f}]`}l.push(t);let O="";g!==""&&(
|
|
11
|
-
${
|
|
12
|
-
${
|
|
13
|
-
${c}`),l.pop(),`{${f}}`}case"number":return isFinite(t)?String(t):n?n(t):"null";case"boolean":return t===!0?"true":"false";case"undefined":return;case"bigint":if(A)return String(t);default:return n?n(t):void 0}}u(G,"I"),r(G,"stringifyArrayReplacer");function V(x,t,l,h,g){switch(typeof t){case"string":return y(t);case"object":{if(t===null)return"null";if(typeof t.toJSON=="function"){if(t=t.toJSON(x),typeof t!="object")return V(x,t,l,h,g);if(t===null)return"null"}if(l.indexOf(t)!==-1)return p;const
|
|
1
|
+
var ce=Object.defineProperty;var u=(o,e)=>ce(o,"name",{value:e,configurable:!0});import{L as ue,a as ge,E as fe}from"./packem_shared/constants-DKfCaSUR.js";import{t as pe}from"./packem_shared/write-console-log-based-on-level-DfD64owL.js";import{s as se,G as he}from"./packem_shared/index-Bzp4LnJ5.js";import ye from"./packem_shared/JsonReporter-CE-lw7R0.js";import{PailError as Ue,createPailError as We}from"./packem_shared/createPailError-53jAfQ-T.js";var de=Object.defineProperty,k=u((o,e)=>de(o,"name",{value:e,configurable:!0}),"t$2");function le(o){return o&&o.__esModule&&Object.prototype.hasOwnProperty.call(o,"default")?o.default:o}u(le,"getDefaultExportFromCjs");k(le,"getDefaultExportFromCjs");function me(o){return o&&Object.prototype.hasOwnProperty.call(o,"default")?o.default:o}u(me,"getDefaultExportFromNamespaceIfPresent");k(me,"getDefaultExportFromNamespaceIfPresent");function be(o){return o&&Object.prototype.hasOwnProperty.call(o,"default")&&Object.keys(o).length===1?o.default:o}u(be,"getDefaultExportFromNamespaceIfNotNamed");k(be,"getDefaultExportFromNamespaceIfNotNamed");function ve(o){if(Object.prototype.hasOwnProperty.call(o,"__esModule"))return o;var e=o.default;if(typeof e=="function"){var s=k(u(function r(){var a=!1;try{a=this instanceof r}catch{}return a?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)},"a"),"a");s.prototype=e.prototype}else s={};return Object.defineProperty(s,"__esModule",{value:!0}),Object.keys(o).forEach(function(r){var a=Object.getOwnPropertyDescriptor(o,r);Object.defineProperty(s,r,a.get?a:{enumerable:!0,get:k(function(){return o[r]},"get")})}),s}u(ve,"getAugmentedNamespace");k(ve,"getAugmentedNamespace");var U={exports:{}},ie;function $e(){return ie||(ie=1,(function(o,e){var s=Object.defineProperty,r=u((i,n)=>s(i,"name",{value:n,configurable:!0}),"$");const{hasOwnProperty:a}=Object.prototype,v=Q();v.configure=Q,v.stringify=v,v.default=v,e.stringify=v,e.configure=Q,o.exports=v;const P=/[\u0000-\u001f\u0022\u005c\ud800-\udfff]/;function y(i){return i.length<5e3&&!P.test(i)?`"${i}"`:JSON.stringify(i)}u(y,"strEscape"),r(y,"strEscape");function L(i,n){if(i.length>200||n)return i.sort(n);for(let p=1;p<i.length;p++){const A=i[p];let j=p;for(;j!==0&&i[j-1]>A;)i[j]=i[j-1],j--;i[j]=A}return i}u(L,"sort"),r(L,"sort");const N=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Object.getPrototypeOf(new Int8Array)),Symbol.toStringTag).get;function I(i){return N.call(i)!==void 0&&i.length!==0}u(I,"isTypedArrayWithEntries"),r(I,"isTypedArrayWithEntries");function T(i,n,p){i.length<p&&(p=i.length);const A=n===","?"":" ";let j=`"0":${A}${i[0]}`;for(let q=1;q<p;q++)j+=`${n}"${q}":${A}${i[q]}`;return j}u(T,"stringifyTypedArray"),r(T,"stringifyTypedArray");function _(i){if(a.call(i,"circularValue")){const n=i.circularValue;if(typeof n=="string")return`"${n}"`;if(n==null)return n;if(n===Error||n===TypeError)return{toString(){throw new TypeError("Converting circular structure to JSON")}};throw new TypeError('The "circularValue" argument must be of type string or the value null or undefined')}return'"[Circular]"'}u(_,"getCircularValueOption"),r(_,"getCircularValueOption");function H(i){let n;if(a.call(i,"deterministic")&&(n=i.deterministic,typeof n!="boolean"&&typeof n!="function"))throw new TypeError('The "deterministic" argument must be of type boolean or comparator function');return n===void 0?!0:n}u(H,"getDeterministicOption"),r(H,"getDeterministicOption");function Z(i,n){let p;if(a.call(i,n)&&(p=i[n],typeof p!="boolean"))throw new TypeError(`The "${n}" argument must be of type boolean`);return p===void 0?!0:p}u(Z,"getBooleanOption"),r(Z,"getBooleanOption");function W(i,n){let p;if(a.call(i,n)){if(p=i[n],typeof p!="number")throw new TypeError(`The "${n}" argument must be of type number`);if(!Number.isInteger(p))throw new TypeError(`The "${n}" argument must be an integer`);if(p<1)throw new RangeError(`The "${n}" argument must be >= 1`)}return p===void 0?1/0:p}u(W,"getPositiveIntegerOption"),r(W,"getPositiveIntegerOption");function J(i){return i===1?"1 item":`${i} items`}u(J,"getItemCount"),r(J,"getItemCount");function ee(i){const n=new Set;for(const p of i)(typeof p=="string"||typeof p=="number")&&n.add(String(p));return n}u(ee,"getUniqueReplacerSet"),r(ee,"getUniqueReplacerSet");function te(i){if(a.call(i,"strict")){const n=i.strict;if(typeof n!="boolean")throw new TypeError('The "strict" argument must be of type boolean');if(n)return p=>{let A=`Object can not safely be stringified. Received type ${typeof p}`;throw typeof p!="function"&&(A+=` (${p.toString()})`),new Error(A)}}}u(te,"getStrictOption"),r(te,"getStrictOption");function Q(i){i={...i};const n=te(i);n&&(i.bigint===void 0&&(i.bigint=!1),"circularValue"in i||(i.circularValue=Error));const p=_(i),A=Z(i,"bigint"),j=H(i),q=typeof j=="function"?j:void 0,C=W(i,"maximumDepth"),$=W(i,"maximumBreadth");function z(x,t,l,h,g,d){let c=t[x];switch(typeof c=="object"&&c!==null&&typeof c.toJSON=="function"&&(c=c.toJSON(x)),c=h.call(t,x,c),typeof c){case"string":return y(c);case"object":{if(c===null)return"null";if(l.indexOf(c)!==-1)return p;let f="",w=",";const O=d;if(Array.isArray(c)){if(c.length===0)return"[]";if(C<l.length+1)return'"[Array]"';l.push(c),g!==""&&(d+=g,f+=`
|
|
2
|
+
${d}`,w=`,
|
|
3
|
+
${d}`);const M=Math.min(c.length,$);let D=0;for(;D<M-1;D++){const Y=z(String(D),c,l,h,g,d);f+=Y!==void 0?Y:"null",f+=w}const F=z(String(D),c,l,h,g,d);if(f+=F!==void 0?F:"null",c.length-1>$){const Y=c.length-$-1;f+=`${w}"... ${J(Y)} not stringified"`}return g!==""&&(f+=`
|
|
4
|
+
${O}`),l.pop(),`[${f}]`}let b=Object.keys(c);const S=b.length;if(S===0)return"{}";if(C<l.length+1)return'"[Object]"';let m="",E="";g!==""&&(d+=g,w=`,
|
|
5
|
+
${d}`,m=" ");const R=Math.min(S,$);j&&!I(c)&&(b=L(b,q)),l.push(c);for(let M=0;M<R;M++){const D=b[M],F=z(D,c,l,h,g,d);F!==void 0&&(f+=`${E}${y(D)}:${m}${F}`,E=w)}if(S>$){const M=S-$;f+=`${E}"...":${m}"${J(M)} not stringified"`,E=w}return g!==""&&E.length>1&&(f=`
|
|
6
|
+
${d}${f}
|
|
7
|
+
${O}`),l.pop(),`{${f}}`}case"number":return isFinite(c)?String(c):n?n(c):"null";case"boolean":return c===!0?"true":"false";case"undefined":return;case"bigint":if(A)return String(c);default:return n?n(c):void 0}}u(z,"J"),r(z,"stringifyFnReplacer");function G(x,t,l,h,g,d){switch(typeof t=="object"&&t!==null&&typeof t.toJSON=="function"&&(t=t.toJSON(x)),typeof t){case"string":return y(t);case"object":{if(t===null)return"null";if(l.indexOf(t)!==-1)return p;const c=d;let f="",w=",";if(Array.isArray(t)){if(t.length===0)return"[]";if(C<l.length+1)return'"[Array]"';l.push(t),g!==""&&(d+=g,f+=`
|
|
8
|
+
${d}`,w=`,
|
|
9
|
+
${d}`);const S=Math.min(t.length,$);let m=0;for(;m<S-1;m++){const R=G(String(m),t[m],l,h,g,d);f+=R!==void 0?R:"null",f+=w}const E=G(String(m),t[m],l,h,g,d);if(f+=E!==void 0?E:"null",t.length-1>$){const R=t.length-$-1;f+=`${w}"... ${J(R)} not stringified"`}return g!==""&&(f+=`
|
|
10
|
+
${c}`),l.pop(),`[${f}]`}l.push(t);let O="";g!==""&&(d+=g,w=`,
|
|
11
|
+
${d}`,O=" ");let b="";for(const S of h){const m=G(S,t[S],l,h,g,d);m!==void 0&&(f+=`${b}${y(S)}:${O}${m}`,b=w)}return g!==""&&b.length>1&&(f=`
|
|
12
|
+
${d}${f}
|
|
13
|
+
${c}`),l.pop(),`{${f}}`}case"number":return isFinite(t)?String(t):n?n(t):"null";case"boolean":return t===!0?"true":"false";case"undefined":return;case"bigint":if(A)return String(t);default:return n?n(t):void 0}}u(G,"I"),r(G,"stringifyArrayReplacer");function V(x,t,l,h,g){switch(typeof t){case"string":return y(t);case"object":{if(t===null)return"null";if(typeof t.toJSON=="function"){if(t=t.toJSON(x),typeof t!="object")return V(x,t,l,h,g);if(t===null)return"null"}if(l.indexOf(t)!==-1)return p;const d=g;if(Array.isArray(t)){if(t.length===0)return"[]";if(C<l.length+1)return'"[Array]"';l.push(t),g+=h;let m=`
|
|
14
14
|
${g}`;const E=`,
|
|
15
|
-
${g}`,R=Math.min(t.length,$);let M=0;for(;M<R-1;M++){const F=V(String(M),t[M],l,h,g);
|
|
16
|
-
${
|
|
17
|
-
${g}`;let O="",b="",S=Math.min(f,$);I(t)&&(O+=T(t,w,$),c=c.slice(t.length),S-=t.length,b=w),j&&(c=L(c,q)),l.push(t);for(let
|
|
15
|
+
${g}`,R=Math.min(t.length,$);let M=0;for(;M<R-1;M++){const F=V(String(M),t[M],l,h,g);m+=F!==void 0?F:"null",m+=E}const D=V(String(M),t[M],l,h,g);if(m+=D!==void 0?D:"null",t.length-1>$){const F=t.length-$-1;m+=`${E}"... ${J(F)} not stringified"`}return m+=`
|
|
16
|
+
${d}`,l.pop(),`[${m}]`}let c=Object.keys(t);const f=c.length;if(f===0)return"{}";if(C<l.length+1)return'"[Object]"';g+=h;const w=`,
|
|
17
|
+
${g}`;let O="",b="",S=Math.min(f,$);I(t)&&(O+=T(t,w,$),c=c.slice(t.length),S-=t.length,b=w),j&&(c=L(c,q)),l.push(t);for(let m=0;m<S;m++){const E=c[m],R=V(E,t[E],l,h,g);R!==void 0&&(O+=`${b}${y(E)}: ${R}`,b=w)}if(f>$){const m=f-$;O+=`${b}"...": "${J(m)} not stringified"`,b=w}return b!==""&&(O=`
|
|
18
18
|
${g}${O}
|
|
19
|
-
${m}`),l.pop(),`{${O}}`}case"number":return isFinite(t)?String(t):n?n(t):"null";case"boolean":return t===!0?"true":"false";case"undefined":return;case"bigint":if(A)return String(t);default:return n?n(t):void 0}}u(V,"V"),r(V,"stringifyIndent");function B(x,t,l){switch(typeof t){case"string":return y(t);case"object":{if(t===null)return"null";if(typeof t.toJSON=="function"){if(t=t.toJSON(x),typeof t!="object")return B(x,t,l);if(t===null)return"null"}if(l.indexOf(t)!==-1)return p;let h="";const g=t.length!==void 0;if(g&&Array.isArray(t)){if(t.length===0)return"[]";if(C<l.length+1)return'"[Array]"';l.push(t);const O=Math.min(t.length,$);let b=0;for(;b<O-1;b++){const d=B(String(b),t[b],l);h+=d!==void 0?d:"null",h+=","}const S=B(String(b),t[b],l);if(h+=S!==void 0?S:"null",t.length-1>$){const d=t.length-$-1;h+=`,"... ${J(d)} not stringified"`}return l.pop(),`[${h}]`}let m=Object.keys(t);const c=m.length;if(c===0)return"{}";if(C<l.length+1)return'"[Object]"';let f="",w=Math.min(c,$);g&&I(t)&&(h+=T(t,",",$),m=m.slice(t.length),w-=t.length,f=","),j&&(m=L(m,q)),l.push(t);for(let O=0;O<w;O++){const b=m[O],S=B(b,t[b],l);S!==void 0&&(h+=`${f}${y(b)}:${S}`,f=",")}if(c>$){const O=c-$;h+=`${f}"...":"${J(O)} not stringified"`}return l.pop(),`{${h}}`}case"number":return isFinite(t)?String(t):n?n(t):"null";case"boolean":return t===!0?"true":"false";case"undefined":return;case"bigint":if(A)return String(t);default:return n?n(t):void 0}}u(B,"N"),r(B,"stringifySimple");function re(x,t,l){if(arguments.length>1){let h="";if(typeof l=="number"?h=" ".repeat(Math.min(l,10)):typeof l=="string"&&(h=l.slice(0,10)),t!=null){if(typeof t=="function")return z("",{"":x},[],t,h,"");if(Array.isArray(t))return G("",x,[],ee(t),h,"")}if(h.length!==0)return V("",x,[],h,"")}return B("",x,[])}return u(re,"M"),r(re,"stringify"),re}u(Q,"configure"),r(Q,"configure")})(U,U.exports)),U.exports}u($e,"requireSafeStableStringify");var we=$e();const Oe=le(we),Se=Oe.configure;var Le=Object.defineProperty,Te=u((o,e)=>Le(o,"name",{value:e,configurable:!0}),"t$1");let xe=class{static{u(this,"a")}static{Te(this,"RawReporter")}log(e){const{context:s=[],message:r,type:a}=e;pe(a.level)(r,...s)}};var je=Object.defineProperty,Ee=u((o,e)=>je(o,"name",{value:e,configurable:!0}),"a");const oe=Ee(o=>o===void 0?[]:Array.isArray(o)?o:[o],"arrayify");var Me=Object.defineProperty,Ae=u((o,e)=>Me(o,"name",{value:e,configurable:!0}),"g$1");const ne=Ae((o,e)=>{const s={...o};return Object.keys(e).forEach(r=>{s[r]={...s[r],...e[r]}}),s},"mergeTypes");var Pe=Object.defineProperty,K=u((o,e)=>Pe(o,"name",{value:e,configurable:!0}),"d");const Ne=K(o=>{let e=!1;return function(...s){if(!e){e=!0;try{const r=o.apply(this,s);return e=!1,r}catch(r){throw e=!1,r}}}},"preventLoop");class X{static{u(this,"PailBrowserImpl")}static{K(this,"PailBrowserImpl")}timersMap;countMap;seqTimers;lastLog;logLevels;disabled;paused;messageQueue;scopeName;types;longestLabel;processors;generalLogLevel;reporters;throttle;throttleMin;stringify;groups;startTimerMessage;endTimerMessage;rawReporter;force={};constructor(e){this.throttle=e.throttle??1e3,this.throttleMin=e.throttleMin??5;const s=e.parentLongestLabel,r=e.parentTypes,a=e.parentStringify,v=e.parentLogLevels;this.stringify=a??Se({strict:!0}),this.startTimerMessage=e.messages?.timerStart??"Initialized timer...",this.endTimerMessage=e.messages?.timerEnd??"Timer run for:",r&&s?(this.types=r,this.longestLabel=s):(this.types=ne(ue,e.types??{}),this.longestLabel=se(this.types)),this.logLevels=v&&!e.logLevels?v:{...ge,...e.logLevels},this.generalLogLevel=this.#r(e.logLevel),this.reporters=new Set,this.processors=new Set,this.disabled=e.disabled??!1,this.paused=!1,this.messageQueue=[],this.scopeName=oe(e.scope).filter(Boolean),this.timersMap=new Map,this.countMap=new Map,this.groups=[],this.seqTimers=new Set,this.lastLog={},this.logger=Ne(this.logger.bind(this)),this.#e(),Array.isArray(e.reporters)&&this.registerReporters(e.reporters),this.rawReporter=this.extendReporter(e.rawReporter??new xe),Array.isArray(e.processors)&&this.registerProcessors(e.processors)}#e(){for(const e in this.types)this[e]=this.logger.bind(this,e,!1,!1);for(const e in this.types)this.force[e]=this.logger.bind(this,e,!1,!0)}wrapConsole(){for(const e in this.types)console[`__${e}`]||(console[`__${e}`]=console[e]),console[e]=this[e]}restoreConsole(){for(const e in this.types)console[`__${e}`]&&(console[e]=console[`__${e}`],delete console[`__${e}`])}wrapException(){process.on("uncaughtException",e=>{this.error(e)}),process.on("unhandledRejection",e=>{this.error(e)})}disable(){this.disabled=!0}enable(){this.disabled=!1}isEnabled(){return!this.disabled}pause(){this.paused=!0}resume(){this.paused=!1;const e=this.messageQueue.splice(0);for(let s=0;s<e.length;s+=1){const{messageObject:r,raw:a,type:v}=e[s];this.logger(v,a,!1,...r)}}scope(...e){if(e.length===0)throw new Error("No scope name was defined.");return this.scopeName=e.flat(),this}unscope(){this.scopeName=[]}child(e){const s=e?.types!==void 0,r=s?ne(this.types,e.types):this.types,a=e?.reporters??[],v=a.length>0?[...this.reporters,...a]:[...this.reporters],P=e?.processors??[],y=P.length>0?[...this.processors,...P]:[...this.processors],L=e?.logLevels?{...this.logLevels,...e.logLevels}:this.logLevels;let N;if(e?.scope){const _=oe(e.scope).filter(Boolean);N=this.scopeName.length>0?[...this.scopeName,..._]:_}else N=this.scopeName.length>0?this.scopeName:[];const I=e?.messages?{timerEnd:this.endTimerMessage,timerStart:this.startTimerMessage,...e.messages}:{timerEnd:this.endTimerMessage,timerStart:this.startTimerMessage},T={disabled:e?.disabled??this.disabled,logLevel:e?.logLevel??this.generalLogLevel,logLevels:L,messages:I,processors:y,rawReporter:e?.rawReporter??this.rawReporter,reporters:v,scope:N,throttle:e?.throttle??this.throttle,throttleMin:e?.throttleMin??this.throttleMin};return s?(T.parentTypes=r,T.parentLongestLabel=se(r)):(T.parentTypes=this.types,T.parentLongestLabel=this.longestLabel),e?.logLevels||(T.parentLogLevels=this.logLevels),e?.messages||(T.parentMessages={timerEnd:this.endTimerMessage,timerStart:this.startTimerMessage}),T.parentStringify=this.stringify,new X(T)}time(e="default"){this.seqTimers.has(e)?this.logger("warn",!1,!1,{message:`Timer '${e}' already exists`,prefix:e}):(this.seqTimers.add(e),this.timersMap.set(e,Date.now()),this.logger("start",!1,!1,{message:this.startTimerMessage,prefix:e}))}timeLog(e,...s){if(!e&&this.seqTimers.size>0&&(e=[...this.seqTimers].pop()),e&&this.timersMap.has(e)){const r=Date.now()-this.timersMap.get(e);this.logger("info",!1,!1,{context:s,message:r<1e3?`${String(r)} ms`:`${(r/1e3).toFixed(2)} s`,prefix:e})}else this.logger("warn",!1,!1,{context:s,message:"Timer not found",prefix:e})}timeEnd(e){if(!e&&this.seqTimers.size>0&&(e=[...this.seqTimers].pop()),e&&this.timersMap.has(e)){const s=Date.now()-this.timersMap.get(e);this.timersMap.delete(e),this.logger("stop",!1,!1,{message:`${this.endTimerMessage} ${s<1e3?`${String(s)} ms`:`${(s/1e3).toFixed(2)} s`}`,prefix:e})}else this.logger("warn",!1,!1,{message:"Timer not found",prefix:e})}group(e="console.group"){globalThis.window===void 0?this.groups.push(e):console.group(e)}groupEnd(){globalThis.window===void 0?this.groups.pop():console.groupEnd()}count(e="default"){const s=this.countMap.get(e)??0;this.countMap.set(e,s+1),this.logger("log",!1,!1,{message:`${e}: ${String(s+1)}`,prefix:e})}countReset(e="default"){this.countMap.has(e)?this.countMap.delete(e):this.logger("warn",!1,!1,{message:`Count for ${e} does not exist`,prefix:e})}clear(){console.clear()}raw(e,...s){this.disabled||this.logger("log",!0,!1,{context:s,message:e})}extendReporter(e){return typeof e.setLoggerTypes=="function"&&e.setLoggerTypes(this.types),typeof e.setStringify=="function"&&e.setStringify(this.stringify),e}registerReporters(e){for(let s=0;s<e.length;s+=1)this.reporters.add(this.extendReporter(e[s]))}registerProcessors(e){for(let s=0;s<e.length;s+=1){const r=e[s];typeof r.setStringify=="function"&&r.setStringify(this.stringify),this.processors.add(r)}}#t(e,s){if(s)this.rawReporter.log(Object.freeze(e));else for(const r of this.reporters)r.log(Object.freeze(e))}#r(e){return e&&this.logLevels[e]?e:"debug"}#s(e,s,...r){const a={badge:void 0,context:void 0,error:void 0,label:void 0,message:fe,prefix:void 0,repeated:void 0,scope:void 0,suffix:void 0};if(a.type={level:s.logLevel,name:e},a.groups=this.groups,a.scope=this.scopeName,a.date=new Date,r.length>0&&r[0]instanceof Error)a.error=r[0],r.length>1&&(a.context=r.slice(1));else if(r.length>0&&typeof r[0]=="object"&&r[0]!==null&&"message"in r[0]){const{context:v,message:P,prefix:y,suffix:L}=r[0];if(v&&(a.context=v),y&&(a.prefix=y),L&&(a.suffix=L),a.message=P,r.length>1){const N=r.slice(1);a.context?a.context=Array.isArray(a.context)?[...a.context,...N]:[a.context,...N]:a.context=N}}else r.length>1?(a.message=r[0],a.context=r.slice(1)):r.length===1?a.message=r[0]:a.message=void 0;return s.logLevel==="trace"&&(a.traceError=new Error("Trace")),s.badge&&(a.badge=s.badge),s.label&&(a.label=s.label),a}logger(e,s,r,...a){if(this.disabled)return;if(this.paused){this.messageQueue.push({messageObject:a,raw:s,type:e});return}const v=this.types[e],P=this.#r(v.logLevel);if(r||this.logLevels[P]>=this.logLevels[this.generalLogLevel]){let y=this.#s(e,v,...a);const L=K((I=!1)=>{const T=(this.lastLog.count??0)-this.throttleMin;if(this.lastLog.object&&T>0){const _={...this.lastLog.object};T>1&&(_.repeated=T),this.#t(_,s),this.lastLog.count=1}if(I){for(const _ of this.processors)y={..._.process(y)};this.lastLog.object=y,this.#t(y,s)}},"resolveLog");clearTimeout(this.lastLog.timeout);const N=this.lastLog.time&&y.date?new Date(y.date).getTime()-this.lastLog.time.getTime():0;if(this.lastLog.time=new Date(y.date),N<this.throttle)try{if(this.lastLog.object&&JSON.stringify([y.label,y.scope,y.type,y.message,y.prefix,y.suffix,y.context])===JSON.stringify([this.lastLog.object.label,this.lastLog.object.scope,this.lastLog.object.type,this.lastLog.object.message,this.lastLog.object.prefix,this.lastLog.object.suffix,this.lastLog.object.context])&&(this.lastLog.count=(this.lastLog.count??0)+1,this.lastLog.count>this.throttleMin)){this.lastLog.timeout=setTimeout(L,this.throttle);return}}catch{}L(!0)}}}const Re=X;var _e=Object.defineProperty,ae=u((o,e)=>_e(o,"name",{value:e,configurable:!0}),"i");class De{static{u(this,"g")}static{ae(this,"MessageFormatterProcessor")}#e;#t;constructor(e={}){this.#t=e.formatters}setStringify(e){this.#e=e}process(e){const s=he({formatters:this.#t,stringify:ae(r=>this.#e?this.#e(r):JSON.stringify(r),"stringify")});return e.message!==void 0&&(e.message=this.#r(s,e.message,e.context??[])),e}#r(e,s,r=[]){if(typeof s=="string")return e(s,r);if(typeof s=="object"&&s!==null){const a=s,v=Object.keys(a);for(let P=0;P<v.length;P+=1){const y=v[P],L=a[y];(typeof L=="string"||Array.isArray(L)||typeof L=="object")&&(a[y]=this.#r(e,L,r))}}return s}}var Fe=Object.defineProperty,Ie=u((o,e)=>Fe(o,"name",{value:e,configurable:!0}),"e");const Je=Ie(o=>new Re({processors:[new De],reporters:[new ye],...o}),"createPail"),Ge=Je();export{Ue as PailError,Je as createPail,We as createPailError,Ge as pail};
|
|
19
|
+
${d}`),l.pop(),`{${O}}`}case"number":return isFinite(t)?String(t):n?n(t):"null";case"boolean":return t===!0?"true":"false";case"undefined":return;case"bigint":if(A)return String(t);default:return n?n(t):void 0}}u(V,"V"),r(V,"stringifyIndent");function B(x,t,l){switch(typeof t){case"string":return y(t);case"object":{if(t===null)return"null";if(typeof t.toJSON=="function"){if(t=t.toJSON(x),typeof t!="object")return B(x,t,l);if(t===null)return"null"}if(l.indexOf(t)!==-1)return p;let h="";const g=t.length!==void 0;if(g&&Array.isArray(t)){if(t.length===0)return"[]";if(C<l.length+1)return'"[Array]"';l.push(t);const O=Math.min(t.length,$);let b=0;for(;b<O-1;b++){const m=B(String(b),t[b],l);h+=m!==void 0?m:"null",h+=","}const S=B(String(b),t[b],l);if(h+=S!==void 0?S:"null",t.length-1>$){const m=t.length-$-1;h+=`,"... ${J(m)} not stringified"`}return l.pop(),`[${h}]`}let d=Object.keys(t);const c=d.length;if(c===0)return"{}";if(C<l.length+1)return'"[Object]"';let f="",w=Math.min(c,$);g&&I(t)&&(h+=T(t,",",$),d=d.slice(t.length),w-=t.length,f=","),j&&(d=L(d,q)),l.push(t);for(let O=0;O<w;O++){const b=d[O],S=B(b,t[b],l);S!==void 0&&(h+=`${f}${y(b)}:${S}`,f=",")}if(c>$){const O=c-$;h+=`${f}"...":"${J(O)} not stringified"`}return l.pop(),`{${h}}`}case"number":return isFinite(t)?String(t):n?n(t):"null";case"boolean":return t===!0?"true":"false";case"undefined":return;case"bigint":if(A)return String(t);default:return n?n(t):void 0}}u(B,"N"),r(B,"stringifySimple");function re(x,t,l){if(arguments.length>1){let h="";if(typeof l=="number"?h=" ".repeat(Math.min(l,10)):typeof l=="string"&&(h=l.slice(0,10)),t!=null){if(typeof t=="function")return z("",{"":x},[],t,h,"");if(Array.isArray(t))return G("",x,[],ee(t),h,"")}if(h.length!==0)return V("",x,[],h,"")}return B("",x,[])}return u(re,"M"),r(re,"stringify"),re}u(Q,"configure"),r(Q,"configure")})(U,U.exports)),U.exports}u($e,"requireSafeStableStringify");var we=$e();const Oe=le(we),Se=Oe.configure;var Le=Object.defineProperty,Te=u((o,e)=>Le(o,"name",{value:e,configurable:!0}),"t$1");let xe=class{static{u(this,"a")}static{Te(this,"RawReporter")}log(e){const{context:s=[],message:r,type:a}=e;pe(a.level)(r,...s)}};var je=Object.defineProperty,Ee=u((o,e)=>je(o,"name",{value:e,configurable:!0}),"a");const oe=Ee(o=>o===void 0?[]:Array.isArray(o)?o:[o],"arrayify");var Me=Object.defineProperty,Ae=u((o,e)=>Me(o,"name",{value:e,configurable:!0}),"g$1");const ne=Ae((o,e)=>{const s={...o};return Object.keys(e).forEach(r=>{s[r]={...s[r],...e[r]}}),s},"mergeTypes");var Pe=Object.defineProperty,K=u((o,e)=>Pe(o,"name",{value:e,configurable:!0}),"d");const Ne=K(o=>{let e=!1;return function(...s){if(!e){e=!0;try{const r=o.apply(this,s);return e=!1,r}catch(r){throw e=!1,r}}}},"preventLoop");class X{static{u(this,"PailBrowserImpl")}static{K(this,"PailBrowserImpl")}timersMap;countMap;seqTimers;lastLog;logLevels;disabled;paused;messageQueue;scopeName;types;longestLabel;processors;generalLogLevel;reporters;throttle;throttleMin;stringify;groups;startTimerMessage;endTimerMessage;rawReporter;force={};constructor(e){this.throttle=e.throttle??1e3,this.throttleMin=e.throttleMin??5;const s=e.parentLongestLabel,r=e.parentTypes,a=e.parentStringify,v=e.parentLogLevels;this.stringify=a??Se({strict:!0}),this.startTimerMessage=e.messages?.timerStart??"Initialized timer...",this.endTimerMessage=e.messages?.timerEnd??"Timer run for:",r&&s?(this.types=r,this.longestLabel=s):(this.types=ne(ue,e.types??{}),this.longestLabel=se(this.types)),this.logLevels=v&&!e.logLevels?v:{...ge,...e.logLevels},this.generalLogLevel=this.#r(e.logLevel),this.reporters=new Set,this.processors=new Set,this.disabled=e.disabled??!1,this.paused=!1,this.messageQueue=[],this.scopeName=oe(e.scope).filter(Boolean),this.timersMap=new Map,this.countMap=new Map,this.groups=[],this.seqTimers=new Set,this.lastLog={},this.logger=Ne(this.logger.bind(this)),this.#e(),Array.isArray(e.reporters)&&this.registerReporters(e.reporters),this.rawReporter=this.extendReporter(e.rawReporter??new xe),Array.isArray(e.processors)&&this.registerProcessors(e.processors)}#e(){for(const e in this.types)this[e]=this.logger.bind(this,e,!1,!1);for(const e in this.types)this.force[e]=this.logger.bind(this,e,!1,!0);this.raw=this.raw.bind(this)}wrapConsole(){for(const e in this.types)console[`__${e}`]||(console[`__${e}`]=console[e]),console[e]=this[e]}restoreConsole(){for(const e in this.types)console[`__${e}`]&&(console[e]=console[`__${e}`],delete console[`__${e}`])}wrapException(){process.on("uncaughtException",e=>{this.error(e)}),process.on("unhandledRejection",e=>{this.error(e)})}disable(){this.disabled=!0}enable(){this.disabled=!1}isEnabled(){return!this.disabled}pause(){this.paused=!0}resume(){this.paused=!1;const e=this.messageQueue.splice(0);for(let s=0;s<e.length;s+=1){const{messageObject:r,raw:a,type:v}=e[s];this.logger(v,a,!1,...r)}}scope(...e){if(e.length===0)throw new Error("No scope name was defined.");return this.scopeName=e.flat(),this}unscope(){this.scopeName=[]}child(e){const s=e?.types!==void 0,r=s?ne(this.types,e.types):this.types,a=e?.reporters??[],v=a.length>0?[...this.reporters,...a]:[...this.reporters],P=e?.processors??[],y=P.length>0?[...this.processors,...P]:[...this.processors],L=e?.logLevels?{...this.logLevels,...e.logLevels}:this.logLevels;let N;if(e?.scope){const _=oe(e.scope).filter(Boolean);N=this.scopeName.length>0?[...this.scopeName,..._]:_}else N=this.scopeName.length>0?this.scopeName:[];const I=e?.messages?{timerEnd:this.endTimerMessage,timerStart:this.startTimerMessage,...e.messages}:{timerEnd:this.endTimerMessage,timerStart:this.startTimerMessage},T={disabled:e?.disabled??this.disabled,logLevel:e?.logLevel??this.generalLogLevel,logLevels:L,messages:I,processors:y,rawReporter:e?.rawReporter??this.rawReporter,reporters:v,scope:N,throttle:e?.throttle??this.throttle,throttleMin:e?.throttleMin??this.throttleMin};return s?(T.parentTypes=r,T.parentLongestLabel=se(r)):(T.parentTypes=this.types,T.parentLongestLabel=this.longestLabel),e?.logLevels||(T.parentLogLevels=this.logLevels),e?.messages||(T.parentMessages={timerEnd:this.endTimerMessage,timerStart:this.startTimerMessage}),T.parentStringify=this.stringify,new X(T)}time(e="default"){this.seqTimers.has(e)?this.logger("warn",!1,!1,{message:`Timer '${e}' already exists`,prefix:e}):(this.seqTimers.add(e),this.timersMap.set(e,Date.now()),this.logger("start",!1,!1,{message:this.startTimerMessage,prefix:e}))}timeLog(e,...s){if(!e&&this.seqTimers.size>0&&(e=[...this.seqTimers].pop()),e&&this.timersMap.has(e)){const r=Date.now()-this.timersMap.get(e);this.logger("info",!1,!1,{context:s,message:r<1e3?`${String(r)} ms`:`${(r/1e3).toFixed(2)} s`,prefix:e})}else this.logger("warn",!1,!1,{context:s,message:"Timer not found",prefix:e})}timeEnd(e){if(!e&&this.seqTimers.size>0&&(e=[...this.seqTimers].pop()),e&&this.timersMap.has(e)){const s=Date.now()-this.timersMap.get(e);this.timersMap.delete(e),this.logger("stop",!1,!1,{message:`${this.endTimerMessage} ${s<1e3?`${String(s)} ms`:`${(s/1e3).toFixed(2)} s`}`,prefix:e})}else this.logger("warn",!1,!1,{message:"Timer not found",prefix:e})}group(e="console.group"){globalThis.window===void 0?this.groups.push(e):console.group(e)}groupEnd(){globalThis.window===void 0?this.groups.pop():console.groupEnd()}count(e="default"){const s=this.countMap.get(e)??0;this.countMap.set(e,s+1),this.logger("log",!1,!1,{message:`${e}: ${String(s+1)}`,prefix:e})}countReset(e="default"){this.countMap.has(e)?this.countMap.delete(e):this.logger("warn",!1,!1,{message:`Count for ${e} does not exist`,prefix:e})}clear(){console.clear()}raw(e,...s){this.disabled||this.logger("log",!0,!1,{context:s,message:e})}extendReporter(e){return typeof e.setLoggerTypes=="function"&&e.setLoggerTypes(this.types),typeof e.setStringify=="function"&&e.setStringify(this.stringify),e}registerReporters(e){for(let s=0;s<e.length;s+=1)this.reporters.add(this.extendReporter(e[s]))}registerProcessors(e){for(let s=0;s<e.length;s+=1){const r=e[s];typeof r.setStringify=="function"&&r.setStringify(this.stringify),this.processors.add(r)}}#t(e,s){if(s)this.rawReporter.log(Object.freeze(e));else for(const r of this.reporters)r.log(Object.freeze(e))}#r(e){return e&&this.logLevels[e]?e:"debug"}#s(e,s,...r){const a={badge:void 0,context:void 0,error:void 0,label:void 0,message:fe,prefix:void 0,repeated:void 0,scope:void 0,suffix:void 0};if(a.type={level:s.logLevel,name:e},a.groups=this.groups,a.scope=this.scopeName,a.date=new Date,r.length>0&&r[0]instanceof Error)a.error=r[0],r.length>1&&(a.context=r.slice(1));else if(r.length>0&&typeof r[0]=="object"&&r[0]!==null&&"message"in r[0]){const{context:v,message:P,prefix:y,suffix:L}=r[0];if(v&&(a.context=v),y&&(a.prefix=y),L&&(a.suffix=L),a.message=P,r.length>1){const N=r.slice(1);a.context?a.context=Array.isArray(a.context)?[...a.context,...N]:[a.context,...N]:a.context=N}}else r.length>1?(a.message=r[0],a.context=r.slice(1)):r.length===1?a.message=r[0]:a.message=void 0;return s.logLevel==="trace"&&(a.traceError=new Error("Trace")),s.badge&&(a.badge=s.badge),s.label&&(a.label=s.label),a}logger(e,s,r,...a){if(this.disabled)return;if(this.paused){this.messageQueue.push({messageObject:a,raw:s,type:e});return}const v=this.types[e],P=this.#r(v.logLevel);if(r||this.logLevels[P]>=this.logLevels[this.generalLogLevel]){let y=this.#s(e,v,...a);const L=K((I=!1)=>{const T=(this.lastLog.count??0)-this.throttleMin;if(this.lastLog.object&&T>0){const _={...this.lastLog.object};T>1&&(_.repeated=T),this.#t(_,s),this.lastLog.count=1}if(I){for(const _ of this.processors)y={..._.process(y)};this.lastLog.object=y,this.#t(y,s)}},"resolveLog");clearTimeout(this.lastLog.timeout);const N=this.lastLog.time&&y.date?new Date(y.date).getTime()-this.lastLog.time.getTime():0;if(this.lastLog.time=new Date(y.date),N<this.throttle)try{if(this.lastLog.object&&JSON.stringify([y.label,y.scope,y.type,y.message,y.prefix,y.suffix,y.context])===JSON.stringify([this.lastLog.object.label,this.lastLog.object.scope,this.lastLog.object.type,this.lastLog.object.message,this.lastLog.object.prefix,this.lastLog.object.suffix,this.lastLog.object.context])&&(this.lastLog.count=(this.lastLog.count??0)+1,this.lastLog.count>this.throttleMin)){this.lastLog.timeout=setTimeout(L,this.throttle);return}}catch{}L(!0)}}}const Re=X;var _e=Object.defineProperty,ae=u((o,e)=>_e(o,"name",{value:e,configurable:!0}),"i");class De{static{u(this,"g")}static{ae(this,"MessageFormatterProcessor")}#e;#t;constructor(e={}){this.#t=e.formatters}setStringify(e){this.#e=e}process(e){const s=he({formatters:this.#t,stringify:ae(r=>this.#e?this.#e(r):JSON.stringify(r),"stringify")});return e.message!==void 0&&(e.message=this.#r(s,e.message,e.context??[])),e}#r(e,s,r=[]){if(typeof s=="string")return e(s,r);if(typeof s=="object"&&s!==null){const a=s,v=Object.keys(a);for(let P=0;P<v.length;P+=1){const y=v[P],L=a[y];(typeof L=="string"||Array.isArray(L)||typeof L=="object")&&(a[y]=this.#r(e,L,r))}}return s}}var Fe=Object.defineProperty,Ie=u((o,e)=>Fe(o,"name",{value:e,configurable:!0}),"e");const Je=Ie(o=>new Re({processors:[new De],reporters:[new ye],...o}),"createPail"),Ge=Je();export{Ue as PailError,Je as createPail,We as createPailError,Ge as pail};
|
package/dist/index.server.js
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
var Ge=Object.defineProperty;var p=(t,e)=>Ge(t,"name",{value:e,configurable:!0});import{createRequire as ze}from"node:module";import{InteractiveManager as We,InteractiveStreamHook as Me}from"@visulima/interactive-manager";import{L as Ue,s as le,E as Ye,a as Se,p as ce,i as
|
|
2
|
-
${x}`,
|
|
3
|
-
${x}`);const I=Math.min(m.length,O);let H=0;for(;H<I-1;H++){const oe=te(String(H),m,h,w,v,x);S+=oe!==void 0?oe:"null",S+=
|
|
4
|
-
${
|
|
5
|
-
${x}`,L=" ");const V=Math.min(
|
|
1
|
+
var Ge=Object.defineProperty;var p=(t,e)=>Ge(t,"name",{value:e,configurable:!0});import{createRequire as ze}from"node:module";import{InteractiveManager as We,InteractiveStreamHook as Me}from"@visulima/interactive-manager";import{L as Ue,s as le,E as Ye,a as Se,p as ce,i as Ne,A as Qe,u as Ke,O as Xe,b as Ze,o as ne,c as et,d as tt,B as rt,G as ge}from"./packem_shared/abstract-pretty-reporter-CHU4NOsN.js";import De from"@visulima/colorize";import{PailError as Nr,createPailError as Dr}from"./packem_shared/createPailError-53jAfQ-T.js";const Tr=ze(import.meta.url),He=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,{stdout:$e,stderr:ve,env:se}=He,st="\x1B",M="\x1B[",Ce=";";var it=Object.defineProperty,D=p((t,e)=>it(t,"name",{value:e,configurable:!0}),"r$1");const ot=typeof globalThis<"u"&&typeof globalThis.window=="object"&&globalThis.window.document!==void 0,nt=/^(?:msys|cygwin)$/,at=!ot&&(process.platform==="win32"||nt.test(process.env.OSTYPE)),lt=D((t=1)=>`${M}${String(t)}D`,"cursorBackward");D((t=1)=>`${M}${String(t)}B`,"cursorDown");D((t=1)=>`${M}${String(t)}C`,"cursorForward");const ct=`${M}G`;D((t=1)=>lt(t),"cursorLeft");const ft=D((t=1)=>`${M}${String(t)}G`,"cursorHorizontalAbsolute");D((t,e)=>{let r="";return t<0?r+=`${M}${String(-t)}D`:t>0&&(r+=`${M}${String(t)}C`),e<0?r+=`${M}${String(-e)}A`:e>0&&(r+=`${M}${String(e)}B`),r},"cursorMove");D((t=1)=>`${M}${String(t)}E`,"cursorNextLine");D((t=1)=>`${M}${String(t)}F`,"cursorPreviousLine");const ut=D((t,e)=>e===void 0?ft(t+1):`${M}${String(e+1)}${Ce}${String(t+1)}H`,"cursorTo");D((t,e)=>e===void 0?`${M}${String(t)}H`:`${M}${String(t)}${Ce}${String(e)}H`,"cursorPosition");D((t=1)=>`${M}${String(t)}I`,"cursorHorizontalForwardTab");D((t=1)=>`${M}${String(t)}Z`,"cursorBackwardTab");D((t=1)=>`${M}${String(t)}X`,"eraseCharacter");D((t=1)=>`${M}${String(t)}d`,"cursorVerticalAbsolute");const gt=D((t=1)=>`${M}${String(t)}A`,"cursorUp");var ht=(t=>(t[t.Default=0]="Default",t[t.BlinkingBlock=1]="BlinkingBlock",t[t.SteadyBlock=2]="SteadyBlock",t[t.BlinkingUnderline=3]="BlinkingUnderline",t[t.SteadyUnderline=4]="SteadyUnderline",t[t.BlinkingBar=5]="BlinkingBar",t[t.SteadyBar=6]="SteadyBar",t))(ht||{});D(t=>`${M}${String(t)} q`,"setCursorStyle");var dt=Object.defineProperty,we=p((t,e)=>dt(t,"name",{value:e,configurable:!0}),"e"),Z=(t=>(t[t.ToEnd=0]="ToEnd",t[t.ToBeginning=1]="ToBeginning",t[t.EntireScreen=2]="EntireScreen",t[t.EntireScreenAndScrollback=3]="EntireScreenAndScrollback",t))(Z||{});const U=we(t=>{const e=t>=0&&t<=3?t:0;return`${M}${e===0?"":String(e)}J`},"eraseDisplay");var Re=(t=>(t[t.ToEnd=0]="ToEnd",t[t.ToBeginning=1]="ToBeginning",t[t.EntireLine=2]="EntireLine",t))(Re||{});const ue=we(t=>{const e=t>=0&&t<=2?t:0;return`${M}${e===0?"":String(e)}K`},"eraseInLine");U(0);const pt=ue(2);ue(0);ue(1);we(t=>{if(t<=0)return"";let e="";for(let r=0;r<t;r+=1)e+=pt,r<t-1&&(e+=gt());return e+=ct,e},"eraseLines");U(2);U(1);U(3);ut(0,0)+U(Z.ToEnd);`${ue(Re.EntireLine)}${M}`;`${M}${U(Z.EntireScreen)}`;const Oe=at?`${U(Z.EntireScreen)}${M}0f`:`${U(Z.EntireScreen)}${U(Z.EntireScreenAndScrollback)}${M}H${st}c`;var mt=Object.defineProperty,ee=p((t,e)=>mt(t,"name",{value:e,configurable:!0}),"t$2");function Ie(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}p(Ie,"getDefaultExportFromCjs");ee(Ie,"getDefaultExportFromCjs");function bt(t){return t&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}p(bt,"getDefaultExportFromNamespaceIfPresent");ee(bt,"getDefaultExportFromNamespaceIfPresent");function yt(t){return t&&Object.prototype.hasOwnProperty.call(t,"default")&&Object.keys(t).length===1?t.default:t}p(yt,"getDefaultExportFromNamespaceIfNotNamed");ee(yt,"getDefaultExportFromNamespaceIfNotNamed");function $t(t){if(Object.prototype.hasOwnProperty.call(t,"__esModule"))return t;var e=t.default;if(typeof e=="function"){var r=ee(p(function s(){var i=!1;try{i=this instanceof s}catch{}return i?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)},"a"),"a");r.prototype=e.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(t).forEach(function(s){var i=Object.getOwnPropertyDescriptor(t,s);Object.defineProperty(r,s,i.get?i:{enumerable:!0,get:ee(function(){return t[s]},"get")})}),r}p($t,"getAugmentedNamespace");ee($t,"getAugmentedNamespace");var ae={exports:{}},Ee;function vt(){return Ee||(Ee=1,(function(t,e){var r=Object.defineProperty,s=p((f,l)=>r(f,"name",{value:l,configurable:!0}),"$");const{hasOwnProperty:i}=Object.prototype,a=Q();a.configure=Q,a.stringify=a,a.default=a,e.stringify=a,e.configure=Q,t.exports=a;const u=/[\u0000-\u001f\u0022\u005c\ud800-\udfff]/;function n(f){return f.length<5e3&&!u.test(f)?`"${f}"`:JSON.stringify(f)}p(n,"strEscape"),s(n,"strEscape");function g(f,l){if(f.length>200||l)return f.sort(l);for(let $=1;$<f.length;$++){const _=f[$];let T=$;for(;T!==0&&f[T-1]>_;)f[T]=f[T-1],T--;f[T]=_}return f}p(g,"sort"),s(g,"sort");const y=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Object.getPrototypeOf(new Int8Array)),Symbol.toStringTag).get;function c(f){return y.call(f)!==void 0&&f.length!==0}p(c,"isTypedArrayWithEntries"),s(c,"isTypedArrayWithEntries");function d(f,l,$){f.length<$&&($=f.length);const _=l===","?"":" ";let T=`"0":${_}${f[0]}`;for(let B=1;B<$;B++)T+=`${l}"${B}":${_}${f[B]}`;return T}p(d,"stringifyTypedArray"),s(d,"stringifyTypedArray");function b(f){if(i.call(f,"circularValue")){const l=f.circularValue;if(typeof l=="string")return`"${l}"`;if(l==null)return l;if(l===Error||l===TypeError)return{toString(){throw new TypeError("Converting circular structure to JSON")}};throw new TypeError('The "circularValue" argument must be of type string or the value null or undefined')}return'"[Circular]"'}p(b,"getCircularValueOption"),s(b,"getCircularValueOption");function A(f){let l;if(i.call(f,"deterministic")&&(l=f.deterministic,typeof l!="boolean"&&typeof l!="function"))throw new TypeError('The "deterministic" argument must be of type boolean or comparator function');return l===void 0?!0:l}p(A,"getDeterministicOption"),s(A,"getDeterministicOption");function q(f,l){let $;if(i.call(f,l)&&($=f[l],typeof $!="boolean"))throw new TypeError(`The "${l}" argument must be of type boolean`);return $===void 0?!0:$}p(q,"getBooleanOption"),s(q,"getBooleanOption");function z(f,l){let $;if(i.call(f,l)){if($=f[l],typeof $!="number")throw new TypeError(`The "${l}" argument must be of type number`);if(!Number.isInteger($))throw new TypeError(`The "${l}" argument must be an integer`);if($<1)throw new RangeError(`The "${l}" argument must be >= 1`)}return $===void 0?1/0:$}p(z,"getPositiveIntegerOption"),s(z,"getPositiveIntegerOption");function R(f){return f===1?"1 item":`${f} items`}p(R,"getItemCount"),s(R,"getItemCount");function F(f){const l=new Set;for(const $ of f)(typeof $=="string"||typeof $=="number")&&l.add(String($));return l}p(F,"getUniqueReplacerSet"),s(F,"getUniqueReplacerSet");function Y(f){if(i.call(f,"strict")){const l=f.strict;if(typeof l!="boolean")throw new TypeError('The "strict" argument must be of type boolean');if(l)return $=>{let _=`Object can not safely be stringified. Received type ${typeof $}`;throw typeof $!="function"&&(_+=` (${$.toString()})`),new Error(_)}}}p(Y,"getStrictOption"),s(Y,"getStrictOption");function Q(f){f={...f};const l=Y(f);l&&(f.bigint===void 0&&(f.bigint=!1),"circularValue"in f||(f.circularValue=Error));const $=b(f),_=q(f,"bigint"),T=A(f),B=typeof T=="function"?T:void 0,J=z(f,"maximumDepth"),O=z(f,"maximumBreadth");function te(N,o,h,w,v,x){let m=o[N];switch(typeof m=="object"&&m!==null&&typeof m.toJSON=="function"&&(m=m.toJSON(N)),m=w.call(o,N,m),typeof m){case"string":return n(m);case"object":{if(m===null)return"null";if(h.indexOf(m)!==-1)return $;let S="",E=",";const j=x;if(Array.isArray(m)){if(m.length===0)return"[]";if(J<h.length+1)return'"[Array]"';h.push(m),v!==""&&(x+=v,S+=`
|
|
2
|
+
${x}`,E=`,
|
|
3
|
+
${x}`);const I=Math.min(m.length,O);let H=0;for(;H<I-1;H++){const oe=te(String(H),m,h,w,v,x);S+=oe!==void 0?oe:"null",S+=E}const W=te(String(H),m,h,w,v,x);if(S+=W!==void 0?W:"null",m.length-1>O){const oe=m.length-O-1;S+=`${E}"... ${R(oe)} not stringified"`}return v!==""&&(S+=`
|
|
4
|
+
${j}`),h.pop(),`[${S}]`}let k=Object.keys(m);const P=k.length;if(P===0)return"{}";if(J<h.length+1)return'"[Object]"';let L="",C="";v!==""&&(x+=v,E=`,
|
|
5
|
+
${x}`,L=" ");const V=Math.min(P,O);T&&!c(m)&&(k=g(k,B)),h.push(m);for(let I=0;I<V;I++){const H=k[I],W=te(H,m,h,w,v,x);W!==void 0&&(S+=`${C}${n(H)}:${L}${W}`,C=E)}if(P>O){const I=P-O;S+=`${C}"...":${L}"${R(I)} not stringified"`,C=E}return v!==""&&C.length>1&&(S=`
|
|
6
6
|
${x}${S}
|
|
7
|
-
${
|
|
8
|
-
${x}`,
|
|
9
|
-
${x}`);const
|
|
10
|
-
${m}`),h.pop(),`[${S}]`}h.push(o);let
|
|
11
|
-
${x}`,
|
|
7
|
+
${j}`),h.pop(),`{${S}}`}case"number":return isFinite(m)?String(m):l?l(m):"null";case"boolean":return m===!0?"true":"false";case"undefined":return;case"bigint":if(_)return String(m);default:return l?l(m):void 0}}p(te,"J"),s(te,"stringifyFnReplacer");function re(N,o,h,w,v,x){switch(typeof o=="object"&&o!==null&&typeof o.toJSON=="function"&&(o=o.toJSON(N)),typeof o){case"string":return n(o);case"object":{if(o===null)return"null";if(h.indexOf(o)!==-1)return $;const m=x;let S="",E=",";if(Array.isArray(o)){if(o.length===0)return"[]";if(J<h.length+1)return'"[Array]"';h.push(o),v!==""&&(x+=v,S+=`
|
|
8
|
+
${x}`,E=`,
|
|
9
|
+
${x}`);const P=Math.min(o.length,O);let L=0;for(;L<P-1;L++){const V=re(String(L),o[L],h,w,v,x);S+=V!==void 0?V:"null",S+=E}const C=re(String(L),o[L],h,w,v,x);if(S+=C!==void 0?C:"null",o.length-1>O){const V=o.length-O-1;S+=`${E}"... ${R(V)} not stringified"`}return v!==""&&(S+=`
|
|
10
|
+
${m}`),h.pop(),`[${S}]`}h.push(o);let j="";v!==""&&(x+=v,E=`,
|
|
11
|
+
${x}`,j=" ");let k="";for(const P of w){const L=re(P,o[P],h,w,v,x);L!==void 0&&(S+=`${k}${n(P)}:${j}${L}`,k=E)}return v!==""&&k.length>1&&(S=`
|
|
12
12
|
${x}${S}
|
|
13
|
-
${m}`),h.pop(),`{${S}}`}case"number":return isFinite(o)?String(o):l?l(o):"null";case"boolean":return o===!0?"true":"false";case"undefined":return;case"bigint":if(
|
|
13
|
+
${m}`),h.pop(),`{${S}}`}case"number":return isFinite(o)?String(o):l?l(o):"null";case"boolean":return o===!0?"true":"false";case"undefined":return;case"bigint":if(_)return String(o);default:return l?l(o):void 0}}p(re,"I"),s(re,"stringifyArrayReplacer");function K(N,o,h,w,v){switch(typeof o){case"string":return n(o);case"object":{if(o===null)return"null";if(typeof o.toJSON=="function"){if(o=o.toJSON(N),typeof o!="object")return K(N,o,h,w,v);if(o===null)return"null"}if(h.indexOf(o)!==-1)return $;const x=v;if(Array.isArray(o)){if(o.length===0)return"[]";if(J<h.length+1)return'"[Array]"';h.push(o),v+=w;let L=`
|
|
14
14
|
${v}`;const C=`,
|
|
15
15
|
${v}`,V=Math.min(o.length,O);let I=0;for(;I<V-1;I++){const W=K(String(I),o[I],h,w,v);L+=W!==void 0?W:"null",L+=C}const H=K(String(I),o[I],h,w,v);if(L+=H!==void 0?H:"null",o.length-1>O){const W=o.length-O-1;L+=`${C}"... ${R(W)} not stringified"`}return L+=`
|
|
16
|
-
${x}`,h.pop(),`[${L}]`}let m=Object.keys(o);const S=m.length;if(S===0)return"{}";if(J<h.length+1)return'"[Object]"';v+=w;const
|
|
17
|
-
${v}`;let
|
|
18
|
-
${v}${
|
|
19
|
-
${x}`),h.pop(),`{${E}}`}case"number":return isFinite(o)?String(o):l?l(o):"null";case"boolean":return o===!0?"true":"false";case"undefined":return;case"bigint":if(N)return String(o);default:return l?l(o):void 0}}p(K,"V"),s(K,"stringifyIndent");function X(_,o,h){switch(typeof o){case"string":return n(o);case"object":{if(o===null)return"null";if(typeof o.toJSON=="function"){if(o=o.toJSON(_),typeof o!="object")return X(_,o,h);if(o===null)return"null"}if(h.indexOf(o)!==-1)return $;let w="";const v=o.length!==void 0;if(v&&Array.isArray(o)){if(o.length===0)return"[]";if(J<h.length+1)return'"[Array]"';h.push(o);const E=Math.min(o.length,O);let k=0;for(;k<E-1;k++){const L=X(String(k),o[k],h);w+=L!==void 0?L:"null",w+=","}const B=X(String(k),o[k],h);if(w+=B!==void 0?B:"null",o.length-1>O){const L=o.length-O-1;w+=`,"... ${R(L)} not stringified"`}return h.pop(),`[${w}]`}let x=Object.keys(o);const m=x.length;if(m===0)return"{}";if(J<h.length+1)return'"[Object]"';let S="",j=Math.min(m,O);v&&c(o)&&(w+=d(o,",",O),x=x.slice(o.length),j-=o.length,S=","),T&&(x=g(x,P)),h.push(o);for(let E=0;E<j;E++){const k=x[E],B=X(k,o[k],h);B!==void 0&&(w+=`${S}${n(k)}:${B}`,S=",")}if(m>O){const E=m-O;w+=`${S}"...":"${R(E)} not stringified"`}return h.pop(),`{${w}}`}case"number":return isFinite(o)?String(o):l?l(o):"null";case"boolean":return o===!0?"true":"false";case"undefined":return;case"bigint":if(N)return String(o);default:return l?l(o):void 0}}p(X,"N"),s(X,"stringifySimple");function ke(_,o,h){if(arguments.length>1){let w="";if(typeof h=="number"?w=" ".repeat(Math.min(h,10)):typeof h=="string"&&(w=h.slice(0,10)),o!=null){if(typeof o=="function")return te("",{"":_},[],o,w,"");if(Array.isArray(o))return re("",_,[],F(o),w,"")}if(w.length!==0)return K("",_,[],w,"")}return X("",_,[])}return p(ke,"M"),s(ke,"stringify"),ke}p(Q,"configure"),s(Q,"configure")})(ae,ae.exports)),ae.exports}p(Ot,"requireSafeStableStringify");var jt=Ot();const Et=Ie(jt),At=Et.configure;var Pt=Object.defineProperty,Bt=p((t,e)=>Pt(t,"name",{value:e,configurable:!0}),"o$1");const Nt=Bt(t=>{const e=console;return t==="error"?e.__error??console.error:t==="warn"?e.__warn??console.warn:t==="trace"?e.__trace??console.trace:e.__log??console.log},"writeConsoleLogBasedOnLevel");var _t=Object.defineProperty,Dt=p((t,e)=>_t(t,"name",{value:e,configurable:!0}),"t");let Ct=class{static{p(this,"a")}static{Dt(this,"RawReporter")}log(e){const{context:r=[],message:s,type:i}=e;Nt(i.level)(s,...r)}};var Rt=Object.defineProperty,It=p((t,e)=>Rt(t,"name",{value:e,configurable:!0}),"a");const me=It(t=>t===void 0?[]:Array.isArray(t)?t:[t],"arrayify");var Ft=Object.defineProperty,qt=p((t,e)=>Ft(t,"name",{value:e,configurable:!0}),"g$3");const be=qt((t,e)=>{const r={...t};return Object.keys(e).forEach(s=>{r[s]={...r[s],...e[s]}}),r},"mergeTypes");var Jt=Object.defineProperty,ye=p((t,e)=>Jt(t,"name",{value:e,configurable:!0}),"d");const Vt=ye(t=>{let e=!1;return function(...r){if(!e){e=!0;try{const s=t.apply(this,r);return e=!1,s}catch(s){throw e=!1,s}}}},"preventLoop");class xe{static{p(this,"PailBrowserImpl")}static{ye(this,"PailBrowserImpl")}timersMap;countMap;seqTimers;lastLog;logLevels;disabled;paused;messageQueue;scopeName;types;longestLabel;processors;generalLogLevel;reporters;throttle;throttleMin;stringify;groups;startTimerMessage;endTimerMessage;rawReporter;force={};constructor(e){this.throttle=e.throttle??1e3,this.throttleMin=e.throttleMin??5;const r=e.parentLongestLabel,s=e.parentTypes,i=e.parentStringify,a=e.parentLogLevels;this.stringify=i??At({strict:!0}),this.startTimerMessage=e.messages?.timerStart??"Initialized timer...",this.endTimerMessage=e.messages?.timerEnd??"Timer run for:",s&&r?(this.types=s,this.longestLabel=r):(this.types=be(Ue,e.types??{}),this.longestLabel=le(this.types)),this.logLevels=a&&!e.logLevels?a:{...Ye,...e.logLevels},this.generalLogLevel=this.#t(e.logLevel),this.reporters=new Set,this.processors=new Set,this.disabled=e.disabled??!1,this.paused=!1,this.messageQueue=[],this.scopeName=me(e.scope).filter(Boolean),this.timersMap=new Map,this.countMap=new Map,this.groups=[],this.seqTimers=new Set,this.lastLog={},this.logger=Vt(this.logger.bind(this)),this.#r(),Array.isArray(e.reporters)&&this.registerReporters(e.reporters),this.rawReporter=this.extendReporter(e.rawReporter??new Ct),Array.isArray(e.processors)&&this.registerProcessors(e.processors)}#r(){for(const e in this.types)this[e]=this.logger.bind(this,e,!1,!1);for(const e in this.types)this.force[e]=this.logger.bind(this,e,!1,!0)}wrapConsole(){for(const e in this.types)console[`__${e}`]||(console[`__${e}`]=console[e]),console[e]=this[e]}restoreConsole(){for(const e in this.types)console[`__${e}`]&&(console[e]=console[`__${e}`],delete console[`__${e}`])}wrapException(){process.on("uncaughtException",e=>{this.error(e)}),process.on("unhandledRejection",e=>{this.error(e)})}disable(){this.disabled=!0}enable(){this.disabled=!1}isEnabled(){return!this.disabled}pause(){this.paused=!0}resume(){this.paused=!1;const e=this.messageQueue.splice(0);for(let r=0;r<e.length;r+=1){const{messageObject:s,raw:i,type:a}=e[r];this.logger(a,i,!1,...s)}}scope(...e){if(e.length===0)throw new Error("No scope name was defined.");return this.scopeName=e.flat(),this}unscope(){this.scopeName=[]}child(e){const r=e?.types!==void 0,s=r?be(this.types,e.types):this.types,i=e?.reporters??[],a=i.length>0?[...this.reporters,...i]:[...this.reporters],u=e?.processors??[],n=u.length>0?[...this.processors,...u]:[...this.processors],g=e?.logLevels?{...this.logLevels,...e.logLevels}:this.logLevels;let y;if(e?.scope){const b=me(e.scope).filter(Boolean);y=this.scopeName.length>0?[...this.scopeName,...b]:b}else y=this.scopeName.length>0?this.scopeName:[];const c=e?.messages?{timerEnd:this.endTimerMessage,timerStart:this.startTimerMessage,...e.messages}:{timerEnd:this.endTimerMessage,timerStart:this.startTimerMessage},d={disabled:e?.disabled??this.disabled,logLevel:e?.logLevel??this.generalLogLevel,logLevels:g,messages:c,processors:n,rawReporter:e?.rawReporter??this.rawReporter,reporters:a,scope:y,throttle:e?.throttle??this.throttle,throttleMin:e?.throttleMin??this.throttleMin};return r?(d.parentTypes=s,d.parentLongestLabel=le(s)):(d.parentTypes=this.types,d.parentLongestLabel=this.longestLabel),e?.logLevels||(d.parentLogLevels=this.logLevels),e?.messages||(d.parentMessages={timerEnd:this.endTimerMessage,timerStart:this.startTimerMessage}),d.parentStringify=this.stringify,new xe(d)}time(e="default"){this.seqTimers.has(e)?this.logger("warn",!1,!1,{message:`Timer '${e}' already exists`,prefix:e}):(this.seqTimers.add(e),this.timersMap.set(e,Date.now()),this.logger("start",!1,!1,{message:this.startTimerMessage,prefix:e}))}timeLog(e,...r){if(!e&&this.seqTimers.size>0&&(e=[...this.seqTimers].pop()),e&&this.timersMap.has(e)){const s=Date.now()-this.timersMap.get(e);this.logger("info",!1,!1,{context:r,message:s<1e3?`${String(s)} ms`:`${(s/1e3).toFixed(2)} s`,prefix:e})}else this.logger("warn",!1,!1,{context:r,message:"Timer not found",prefix:e})}timeEnd(e){if(!e&&this.seqTimers.size>0&&(e=[...this.seqTimers].pop()),e&&this.timersMap.has(e)){const r=Date.now()-this.timersMap.get(e);this.timersMap.delete(e),this.logger("stop",!1,!1,{message:`${this.endTimerMessage} ${r<1e3?`${String(r)} ms`:`${(r/1e3).toFixed(2)} s`}`,prefix:e})}else this.logger("warn",!1,!1,{message:"Timer not found",prefix:e})}group(e="console.group"){globalThis.window===void 0?this.groups.push(e):console.group(e)}groupEnd(){globalThis.window===void 0?this.groups.pop():console.groupEnd()}count(e="default"){const r=this.countMap.get(e)??0;this.countMap.set(e,r+1),this.logger("log",!1,!1,{message:`${e}: ${String(r+1)}`,prefix:e})}countReset(e="default"){this.countMap.has(e)?this.countMap.delete(e):this.logger("warn",!1,!1,{message:`Count for ${e} does not exist`,prefix:e})}clear(){console.clear()}raw(e,...r){this.disabled||this.logger("log",!0,!1,{context:r,message:e})}extendReporter(e){return typeof e.setLoggerTypes=="function"&&e.setLoggerTypes(this.types),typeof e.setStringify=="function"&&e.setStringify(this.stringify),e}registerReporters(e){for(let r=0;r<e.length;r+=1)this.reporters.add(this.extendReporter(e[r]))}registerProcessors(e){for(let r=0;r<e.length;r+=1){const s=e[r];typeof s.setStringify=="function"&&s.setStringify(this.stringify),this.processors.add(s)}}#e(e,r){if(r)this.rawReporter.log(Object.freeze(e));else for(const s of this.reporters)s.log(Object.freeze(e))}#t(e){return e&&this.logLevels[e]?e:"debug"}#s(e,r,...s){const i={badge:void 0,context:void 0,error:void 0,label:void 0,message:Se,prefix:void 0,repeated:void 0,scope:void 0,suffix:void 0};if(i.type={level:r.logLevel,name:e},i.groups=this.groups,i.scope=this.scopeName,i.date=new Date,s.length>0&&s[0]instanceof Error)i.error=s[0],s.length>1&&(i.context=s.slice(1));else if(s.length>0&&typeof s[0]=="object"&&s[0]!==null&&"message"in s[0]){const{context:a,message:u,prefix:n,suffix:g}=s[0];if(a&&(i.context=a),n&&(i.prefix=n),g&&(i.suffix=g),i.message=u,s.length>1){const y=s.slice(1);i.context?i.context=Array.isArray(i.context)?[...i.context,...y]:[i.context,...y]:i.context=y}}else s.length>1?(i.message=s[0],i.context=s.slice(1)):s.length===1?i.message=s[0]:i.message=void 0;return r.logLevel==="trace"&&(i.traceError=new Error("Trace")),r.badge&&(i.badge=r.badge),r.label&&(i.label=r.label),i}logger(e,r,s,...i){if(this.disabled)return;if(this.paused){this.messageQueue.push({messageObject:i,raw:r,type:e});return}const a=this.types[e],u=this.#t(a.logLevel);if(s||this.logLevels[u]>=this.logLevels[this.generalLogLevel]){let n=this.#s(e,a,...i);const g=ye((c=!1)=>{const d=(this.lastLog.count??0)-this.throttleMin;if(this.lastLog.object&&d>0){const b={...this.lastLog.object};d>1&&(b.repeated=d),this.#e(b,r),this.lastLog.count=1}if(c){for(const b of this.processors)n={...b.process(n)};this.lastLog.object=n,this.#e(n,r)}},"resolveLog");clearTimeout(this.lastLog.timeout);const y=this.lastLog.time&&n.date?new Date(n.date).getTime()-this.lastLog.time.getTime():0;if(this.lastLog.time=new Date(n.date),y<this.throttle)try{if(this.lastLog.object&&JSON.stringify([n.label,n.scope,n.type,n.message,n.prefix,n.suffix,n.context])===JSON.stringify([this.lastLog.object.label,this.lastLog.object.scope,this.lastLog.object.type,this.lastLog.object.message,this.lastLog.object.prefix,this.lastLog.object.suffix,this.lastLog.object.context])&&(this.lastLog.count=(this.lastLog.count??0)+1,this.lastLog.count>this.throttleMin)){this.lastLog.timeout=setTimeout(g,this.throttle);return}}catch{}g(!0)}}}var Gt=Object.defineProperty,zt=p((t,e)=>Gt(t,"name",{value:e,configurable:!0}),"c$1");let Ht=class{static{p(this,"v")}static{zt(this,"RawReporter")}#r;#e;#t;#s=!1;#i;constructor(e={}){this.#r=$e,this.#e=ve,this.#i=e}setStdout(e){this.#r=e}setStderr(e){this.#e=e}setInteractiveManager(e){this.#t=e}setIsInteractive(e){this.#s=e}log(e){const{context:r,groups:s,message:i,type:a}=e,u=[];if(i!==Se){const c=typeof i=="string"?i:ce(i,this.#i);u.push(c)}r&&u.push(...r.map(c=>typeof c=="object"?` ${ce(c,this.#i)}`:` ${String(c)}`));const n=["error","trace","warn"].includes(a.level)?"stderr":"stdout",g=n==="stderr"?this.#e:this.#r,y=s.map(()=>" ").join("");this.#s&&this.#t!==void 0&&g.isTTY?this.#t.update(n,(y+u.join("")).split(`
|
|
20
|
-
`),0):_e(y+u.join(""),g)}};var Wt=Object.defineProperty,Ut=p((t,e)=>Wt(t,"name",{value:e,configurable:!0}),"m$1");class Le extends xe{static{p(this,"c")}constructor(e){const r=e.parentStderr,s=e.parentStdout,{interactive:i,processors:a,rawReporter:u,reporters:n,stderr:g,stdout:y}=e,c=r??g,d=s??y,b=e.parentLongestLabel,A=e.parentTypes,{parentLogLevels:q,parentMessages:z,parentStringify:R}=e,F={disabled:e.disabled,logLevel:e.logLevel,logLevels:e.logLevels,messages:e.messages,processors:[],rawReporter:e.rawReporter,reporters:[],scope:e.scope,throttle:e.throttle,throttleMin:e.throttleMin},Y="types"in e;A&&b&&!Y?(F.parentTypes=A,F.parentLongestLabel=b):Y&&e.types!==void 0&&(F.types=e.types),R&&(F.parentStringify=R),q&&!e.logLevels&&(F.parentLogLevels=q),z&&!e.messages&&(F.parentMessages=z),super(F),this.options=e,this.interactive=i??!1,this.stdout=d,this.stderr=c,this.interactive&&(this.interactiveManager=new We(new Me(this.stdout),new Me(this.stderr))),Array.isArray(n)&&this.registerReporters(n),this.rawReporter=this.extendReporter(u??new Ht),Array.isArray(a)&&this.registerProcessors(a)}options;static{Ut(this,"PailServerImpl")}stdout;stderr;interactiveManager;interactive;scope(...e){if(e.length===0)throw new Error("No scope name was defined.");return this.scopeName=e.flat(),this}child(e){const r=e?.types!==void 0,s=r?be(this.types,e.types):this.types,i=e?.reporters??[],a=i.length>0?[...this.reporters,...i]:[...this.reporters],u=e?.processors??[],n=u.length>0?[...this.processors,...u]:[...this.processors],g=e?.logLevels?{...this.logLevels,...e.logLevels}:this.logLevels;let y;if(e?.scope){const b=me(e.scope).filter(Boolean);y=this.scopeName.length>0?[...this.scopeName,...b]:b}else y=this.scopeName.length>0?this.scopeName:[];const c=e?.messages?{timerEnd:this.endTimerMessage,timerStart:this.startTimerMessage,...e.messages}:{timerEnd:this.endTimerMessage,timerStart:this.startTimerMessage},d={disabled:e?.disabled??this.disabled,interactive:e?.interactive??this.interactive,logLevel:e?.logLevel??this.generalLogLevel,logLevels:g,messages:c,processors:n,rawReporter:e?.rawReporter??this.rawReporter,reporters:a,scope:y,stderr:e?.stderr??this.stderr,stdout:e?.stdout??this.stdout,throttle:e?.throttle??this.throttle,throttleMin:e?.throttleMin??this.throttleMin};return this.#r(d,e,r,s),new Le(d)}#r(e,r,s,i){s?(e.parentTypes=i,e.parentLongestLabel=le(i)):(e.parentTypes=this.types,e.parentLongestLabel=this.longestLabel),r?.logLevels||(e.parentLogLevels=this.logLevels),r?.messages||(e.parentMessages={timerEnd:this.endTimerMessage,timerStart:this.startTimerMessage}),e.parentStringify=this.stringify,r?.stdout||(e.parentStdout=this.stdout),r?.stderr||(e.parentStderr=this.stderr)}getInteractiveManager(){return this.interactiveManager}wrapStd(){this.#e(this.stdout,"log"),this.#e(this.stderr,"log")}restoreStd(){this.#t(this.stdout),this.#t(this.stderr)}wrapAll(){this.wrapConsole(),this.wrapStd()}restoreAll(){this.restoreConsole(),this.restoreStd()}clear(){this.stdout.write(Oe),this.stderr.write(Oe)}extendReporter(e){return typeof e.setStdout=="function"&&e.setStdout(this.stdout),typeof e.setStderr=="function"&&e.setStderr(this.stderr),typeof e.setLoggerTypes=="function"&&e.setLoggerTypes(this.types),typeof e.setStringify=="function"&&e.setStringify(this.stringify),typeof e.setIsInteractive=="function"&&e.setIsInteractive(this.interactive),this.interactive&&typeof e.setInteractiveManager=="function"&&e.setInteractiveManager(this.interactiveManager),e}#e(e,r){e&&(e.__write||(e.__write=e.write),e.write=s=>{this[r](String(s).trim())})}#t(e){e&&e.__write&&(e.write=e.__write,delete e.__write)}}const Yt=Le;var Qt=Object.defineProperty,Kt=p((t,e)=>Qt(t,"name",{value:e,configurable:!0}),"x"),Xt=Object.defineProperty,Fe=Kt((t,e)=>Xt(t,"name",{value:e,configurable:!0}),"h"),Zt=Object.defineProperty,ie=Fe((t,e)=>Zt(t,"name",{value:e,configurable:!0}),"g$1");const Ee=new Map([["aliceblue","#f0f8ff"],["antiquewhite","#faebd7"],["aqua","#00ffff"],["aquamarine","#7fffd4"],["azure","#f0ffff"],["beige","#f5f5dc"],["bisque","#ffe4c4"],["black","#000000"],["blanchedalmond","#ffebcd"],["blue","#0000ff"],["blueviolet","#8a2be2"],["brown","#a52a2a"],["burlywood","#deb887"],["cadetblue","#5f9ea0"],["chartreuse","#7fff00"],["chocolate","#d2691e"],["coral","#ff7f50"],["cornflowerblue","#6495ed"],["cornsilk","#fff8dc"],["crimson","#dc143c"],["cyan","#00ffff"],["darkblue","#00008b"],["darkcyan","#008b8b"],["darkgoldenrod","#b8860b"],["darkgray","#a9a9a9"],["darkgreen","#006400"],["darkgrey","#a9a9a9"],["darkkhaki","#bdb76b"],["darkmagenta","#8b008b"],["darkolivegreen","#556b2f"],["darkorange","#ff8c00"],["darkorchid","#9932cc"],["darkred","#8b0000"],["darksalmon","#e9967a"],["darkseagreen","#8fbc8f"],["darkslateblue","#483d8b"],["darkslategray","#2f4f4f"],["darkslategrey","#2f4f4f"],["darkturquoise","#00ced1"],["darkviolet","#9400d3"],["deeppink","#ff1493"],["deepskyblue","#00bfff"],["dimgray","#696969"],["dimgrey","#696969"],["dodgerblue","#1e90ff"],["firebrick","#b22222"],["floralwhite","#fffaf0"],["forestgreen","#228b22"],["fuchsia","#ff00ff"],["gainsboro","#dcdcdc"],["ghostwhite","#f8f8ff"],["gold","#ffd700"],["goldenrod","#daa520"],["gray","#808080"],["green","#008000"],["greenyellow","#adff2f"],["grey","#808080"],["honeydew","#f0fff0"],["hotpink","#ff69b4"],["indianred","#cd5c5c"],["indigo","#4b0082"],["ivory","#fffff0"],["khaki","#f0e68c"],["lavender","#e6e6fa"],["lavenderblush","#fff0f5"],["lawngreen","#7cfc00"],["lemonchiffon","#fffacd"],["lightblue","#add8e6"],["lightcoral","#f08080"],["lightcyan","#e0ffff"],["lightgoldenrodyellow","#fafad2"],["lightgray","#d3d3d3"],["lightgreen","#90ee90"],["lightgrey","#d3d3d3"],["lightpink","#ffb6c1"],["lightsalmon","#ffa07a"],["lightseagreen","#20b2aa"],["lightskyblue","#87cefa"],["lightslategray","#778899"],["lightslategrey","#778899"],["lightsteelblue","#b0c4de"],["lightyellow","#ffffe0"],["lime","#00ff00"],["limegreen","#32cd32"],["linen","#faf0e6"],["magenta","#ff00ff"],["maroon","#800000"],["mediumaquamarine","#66cdaa"],["mediumblue","#0000cd"],["mediumorchid","#ba55d3"],["mediumpurple","#9370db"],["mediumseagreen","#3cb371"],["mediumslateblue","#7b68ee"],["mediumspringgreen","#00fa9a"],["mediumturquoise","#48d1cc"],["mediumvioletred","#c71585"],["midnightblue","#191970"],["mintcream","#f5fffa"],["mistyrose","#ffe4e1"],["moccasin","#ffe4b5"],["navajowhite","#ffdead"],["navy","#000080"],["oldlace","#fdf5e6"],["olive","#808000"],["olivedrab","#6b8e23"],["orange","#ffa500"],["orangered","#ff4500"],["orchid","#da70d6"],["palegoldenrod","#eee8aa"],["palegreen","#98fb98"],["paleturquoise","#afeeee"],["palevioletred","#db7093"],["papayawhip","#ffefd5"],["peachpuff","#ffdab9"],["peru","#cd853f"],["pink","#ffc0cb"],["plum","#dda0dd"],["powderblue","#b0e0e6"],["purple","#800080"],["rebeccapurple","#663399"],["red","#ff0000"],["rosybrown","#bc8f8f"],["royalblue","#4169e1"],["saddlebrown","#8b4513"],["salmon","#fa8072"],["sandybrown","#f4a460"],["seagreen","#2e8b57"],["seashell","#fff5ee"],["sienna","#a0522d"],["silver","#c0c0c0"],["skyblue","#87ceeb"],["slateblue","#6a5acd"],["slategray","#708090"],["slategrey","#708090"],["snow","#fffafa"],["springgreen","#00ff7f"],["steelblue","#4682b4"],["tan","#d2b48c"],["teal","#008080"],["thistle","#d8bfd8"],["tomato","#ff6347"],["turquoise","#40e0d0"],["violet","#ee82ee"],["wheat","#f5deb3"],["white","#ffffff"],["whitesmoke","#f5f5f5"],["yellow","#ffff00"],["yellowgreen","#9acd32"]]),er=/^#([\dA-F]{2})([\dA-F]{2})([\dA-F]{2})([\dA-F]{2})?$/i,tr=/^#([\dA-F])([\dA-F])([\dA-F])([\dA-F])?$/i,rr=/^rgba?\(\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*,\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*,\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*(,\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*)?\)$/,sr=/^hsla?\(\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*,\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))%\s*,\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))%\s*(,\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*)?\)$/,qe=ie(()=>({__proto__:null,backgroundColor:null,color:null,fontStyle:null,fontWeight:null,textDecorationColor:null,textDecorationLine:[]}),"getDefaultCss"),Ae=/\s+/,fe=ie(t=>{Ee.has(t)&&(t=Ee.get(t));const e=er.exec(t);if(e)return[Number.parseInt(e[1],16),Number.parseInt(e[2],16),Number.parseInt(e[3],16)];const r=tr.exec(t);if(r)return[Number.parseInt(`${r[1]}${r[1]}`,16),Number.parseInt(`${r[2]}${r[2]}`,16),Number.parseInt(`${r[3]}${r[3]}`,16)];const s=rr.exec(t);if(s)return[Math.round(Math.max(0,Math.min(255,Number(s[1])))),Math.round(Math.max(0,Math.min(255,Number(s[2])))),Math.round(Math.max(0,Math.min(255,Number(s[3]))))];const i=sr.exec(t);if(i){let a=Number(i[1])%360;a<0&&(a+=360);const u=Math.max(0,Math.min(100,Number(i[2])))/100,n=Math.max(0,Math.min(100,Number(i[3])))/100,g=(1-Math.abs(2*n-1))*u,y=g*(1-Math.abs(a/60%2-1)),c=n-g/2;let d,b,A;return a<60?{0:d,1:b,2:A}=[g,y,0]:a<120?{0:d,1:b,2:A}=[y,g,0]:a<180?{0:d,1:b,2:A}=[0,g,y]:a<240?{0:d,1:b,2:A}=[0,y,g]:a<300?{0:d,1:b,2:A}=[y,0,g]:{0:d,1:b,2:A}=[g,0,y],[Math.round((d+c)*255),Math.round((b+c)*255),Math.round((A+c)*255)]}return null},"parseCssColor"),he=ie((t,e)=>t?.[0]===e?.[0]&&t?.[1]===e?.[1]&&t?.[2]===e?.[2],"colorEquals"),ir=ie(t=>{const e=qe(),r=[];let s=!1,i=null,a=0,u="";for(const n of t){if(n==="(")a+=1;else if(a>0)n===")"&&(a-=1);else if(s){if(n===";"){const g=u.trim();g!==""&&r.push([i,g]),i=null,u="",s=!1;continue}}else if(n===":"){i=u.trim(),u="",s=!0;continue}u+=n}if(s&&a===0){const n=u.trim();n!==""&&r.push([i,n]),i=null,u=""}for(const{0:n,1:g}of r)switch(n){case"background-color":{g!=null&&(e.backgroundColor=g);break}case"color":{g!=null&&(e.color=g);break}case"font-style":{["italic","oblique","oblique 14deg"].includes(g)&&(e.fontStyle="italic");break}case"font-weight":{g==="bold"&&(e.fontWeight=g);break}case"text-decoration":{e.textDecorationColor=null,e.textDecorationLine=[];const y=g.split(Ae);for(const c of y){const d=fe(c);d!=null?e.textDecorationColor=d:["line-through","overline","underline"].includes(c)&&e.textDecorationLine.push(c)}break}case"text-decoration-color":{const y=fe(g);y!=null&&(e.textDecorationColor=y);break}case"text-decoration-line":{e.textDecorationLine=[];const y=g.split(Ae);for(const c of y)["line-through","overline","underline"].includes(c)&&e.textDecorationLine.push(c);break}}return e},"parseCss"),or=ie((t,e)=>{e=e??qe();let r="";if(!he(t.backgroundColor,e.backgroundColor))if(t.backgroundColor==null)r+="\x1B[49m";else switch(t.backgroundColor){case"black":{r+="\x1B[40m";break}case"blue":{r+="\x1B[44m";break}case"cyan":{r+="\x1B[46m";break}case"green":{r+="\x1B[42m";break}case"magenta":{r+="\x1B[45m";break}case"red":{r+="\x1B[41m";break}case"white":{r+="\x1B[47m";break}case"yellow":{r+="\x1B[43m";break}default:if(Array.isArray(t.backgroundColor)){const{0:s,1:i,2:a}=t.backgroundColor;r+=`\x1B[48;2;${String(s)};${String(i)};${String(a)}m`}else{const s=fe(t.backgroundColor);if(s===null)r+="\x1B[49m";else{const{0:i,1:a,2:u}=s;r+=`\x1B[48;2;${String(i)};${String(a)};${String(u)}m`}}}if(!he(t.color,e.color))if(t.color==null)r+="\x1B[39m";else switch(t.color){case"black":{r+="\x1B[30m";break}case"blue":{r+="\x1B[34m";break}case"cyan":{r+="\x1B[36m";break}case"green":{r+="\x1B[32m";break}case"magenta":{r+="\x1B[35m";break}case"red":{r+="\x1B[31m";break}case"white":{r+="\x1B[37m";break}case"yellow":{r+="\x1B[33m";break}default:if(Array.isArray(t.color)){const{0:s,1:i,2:a}=t.color;r+=`\x1B[38;2;${String(s)};${String(i)};${String(a)}m`}else{const s=fe(t.color);if(s===null)r+="\x1B[39m";else{const{0:i,1:a,2:u}=s;r+=`\x1B[38;2;${String(i)};${String(a)};${String(u)}m`}}}if(t.fontWeight!==e.fontWeight&&(r+=t.fontWeight==="bold"?"\x1B[1m":"\x1B[22m"),t.fontStyle!==e.fontStyle&&(r+=t.fontStyle==="italic"?"\x1B[3m":"\x1B[23m"),!he(t.textDecorationColor,e.textDecorationColor))if(t.textDecorationColor==null)r+="\x1B[59m";else{const{0:s,1:i,2:a}=t.textDecorationColor;r+=`\x1B[58;2;${String(s)};${String(i)};${String(a)}m`}return t.textDecorationLine.includes("line-through")!==e.textDecorationLine.includes("line-through")&&(r+=t.textDecorationLine.includes("line-through")?"\x1B[9m":"\x1B[29m"),t.textDecorationLine.includes("overline")!==e.textDecorationLine.includes("overline")&&(r+=t.textDecorationLine.includes("overline")?"\x1B[53m":"\x1B[55m"),t.textDecorationLine.includes("underline")!==e.textDecorationLine.includes("underline")&&(r+=t.textDecorationLine.includes("underline")?"\x1B[4m":"\x1B[24m"),r},"cssToAnsi");var nr=Object.defineProperty,Te=Fe((t,e)=>nr(t,"name",{value:e,configurable:!0}),"y");const ar=Te(t=>{try{return JSON.stringify(t)}catch{return'"[Circular]"'}},"tryStringify"),Pe="%".codePointAt(0),lr="s".codePointAt(0),cr="d".codePointAt(0),fr="f".codePointAt(0),ur="i".codePointAt(0),gr="O".codePointAt(0),hr="o".codePointAt(0),dr="j".codePointAt(0),pr="c".codePointAt(0),mr=Te((t,e=[],r={})=>{if(typeof t!="string"&&typeof t!="object"||t===null)throw new TypeError(`fmt must be a string or object, got ${t===null?"null":typeof t}`);const s=r.stringify??ar,i=1;if(typeof t=="object"){const c=e.length+i;if(c===1)return"{}";const d=Array.from({length:c});d[0]=s(t);for(let b=1;b<c;b+=1)d[b]=s(e[b-i]);return d.join(" ")}if(e.length===0)return t;let a="",u=1-i,n=-1,g=!1,y;for(let c=0;c<t.length;){if(t.codePointAt(c)===Pe&&c+1<t.length){n=n>-1?n:0;const d=t.codePointAt(c+1);if(d===void 0){u+=1;break}switch(d){case pr:{if(globalThis.window===void 0){const b=ir(e[u]);n<c&&(a+=t.slice(n,c)),a+=or(b,y),a!==""&&(g=!0,y=b)}n=c+2,c+=1;break}case cr:case fr:{if(u>=e.length||e[u]==null)break;n<c&&(a+=t.slice(n,c)),a+=Number(e[u]).toString(),n=c+2,c+=1;break}case ur:{if(u>=e.length||e[u]==null)break;n<c&&(a+=t.slice(n,c)),a+=Math.floor(Number(e[u])).toString(),n=c+2,c+=1;break}case dr:case gr:case hr:{if(u>=e.length||e[u]===void 0)break;n<c&&(a+=t.slice(n,c));const b=e[u],A=typeof b;if(A==="string"){a+=`'${b}'`,n=c+2;break}if(A==="function"){a+=b.name?`[Function: ${b.name}]`:"[Function: <anonymous>]",n=c+2;break}a+=s(b),n=c+2,c+=1;break}case Pe:{n<c&&(a+=t.slice(n,c)),a+="%",n=c+2,c+=1,u-=1;break}case lr:{if(u>=e.length)break;n<c&&(a+=t.slice(n,c)),a+=typeof e[u]=="object"?s(e[u]):String(e[u]),n=c+2,c+=1;break}default:typeof r.formatters?.[d]=="function"&&(n<c&&(a+=t.slice(n,c)),a+=r.formatters[d](e[u]),n=c+2,c+=1)}u+=1}c+=1}return n===-1?t:(n<t.length&&(a+=t.slice(n)),g&&(a+="\x1B[0m"),a)},"format"),br=Te((t={})=>{const e={};return typeof t.formatters=="object"&&Object.entries(t.formatters).forEach(([r,s])=>{if(r.length===0)throw new Error(`Formatter %${r} has no characters`);if(r.length>1)throw new Error(`Formatter %${r} has more than one character`);if(typeof s!="function")throw new TypeError(`Formatter for %${r} is not a function`);const i=r.codePointAt(0);if(i===void 0)throw new Error(`${r}.codePointAt(0) failed to return a value, please report this issue`);e[i]=s}),(r,s=[],i={})=>mr(r,s,{...i,formatters:e})},"build");var yr=Object.defineProperty,Be=p((t,e)=>yr(t,"name",{value:e,configurable:!0}),"i$1");let $r=class{static{p(this,"g")}static{Be(this,"MessageFormatterProcessor")}#r;#e;constructor(e={}){this.#e=e.formatters}setStringify(e){this.#r=e}process(e){const r=br({formatters:this.#e,stringify:Be(s=>this.#r?this.#r(s):JSON.stringify(s),"stringify")});return e.message!==void 0&&(e.message=this.#t(r,e.message,e.context??[])),e}#t(e,r,s=[]){if(typeof r=="string")return e(r,s);if(typeof r=="object"&&r!==null){const i=r,a=Object.keys(i);for(let u=0;u<a.length;u+=1){const n=a[u],g=i[n];(typeof g=="string"||Array.isArray(g)||typeof g=="object")&&(i[n]=this.#t(e,g,s))}}return r}};var vr=Object.defineProperty,Je=p((t,e)=>vr(t,"name",{value:e,configurable:!0}),"M");const{bgGrey:Sr,cyan:wr,green:xr,greenBright:Lr,grey:G,red:de,underline:Ne,white:Tr}=De,kr=/[\\/]pail[\\/]dist/,pe=Je(t=>!kr.test(t),"pailFileFilter");class Mr extends Qe{static{p(this,"PrettyReporter")}static{Je(this,"PrettyReporter")}#r;#e;#t;#s=!1;#i;#o;constructor(e={}){const{error:r,inspect:s,...i}=e;super({uppercase:{label:!0,...i.uppercase},...i}),this.#i={...Ke,...s},this.#o={...r,color:{fileLine:xr,hint:wr,marker:de,message:de,method:Lr,title:de}},this.#r=$e,this.#e=ve}setStdout(e){this.#r=e}setStderr(e){this.#e=e}setInteractiveManager(e){this.#t=e}setIsInteractive(e){this.#s=e}log(e){this._log(this._formatMessage(e),e.type.level)}_formatMessage(e){const{columns:r}=Xe();let s=r;typeof this.styles.messageLength=="number"&&(s=this.styles.messageLength);const{badge:i,context:a,date:u,error:n,file:g,groups:y,label:c,message:d,prefix:b,repeated:A,scope:q,suffix:z,traceError:R,type:F}=e,{color:Y}=this.loggerTypes[F.name],Q=Y?De[Y]:Tr,f=y.map(()=>" ").join(""),l=[];if(y.length>0&&l.push(`${f+G(`[${y.at(-1)??""}]`)} `),u&&l.push(`${G(this.styles.dateFormatter(typeof u=="string"?new Date(u):u))} `),i)l.push(Q(i));else{const T=Ze(this.loggerTypes);T.length>0&&l.push(`${G(".".repeat(T.length))} `)}const $=le(this.loggerTypes);if(c){const T=ne($),P=ne(c);l.push(`${Q(et(c,this.styles))} `,G(".".repeat(Math.max(0,T-P))))}else l.push(G(".".repeat($.length+2)));A&&l.push(`${Sr.white(`[${String(A)}x]`)} `),Array.isArray(q)&&q.length>0&&l.push(` ${G(`[${q.join(" > ")}]`)} `),b&&l.push(`${G(`${Array.isArray(q)&&q.length>0?". ":" "}[${this.styles.underline.prefix?Ne(b):b}]`)} `);const N=ne(l.join(" "));if(g){const T=(g.name??"")+(g.line?`:${String(g.line)}`:""),P=ne(T);if(P+N+2>s)l.push(G(` ${T}`));else{const J=Math.max(0,s-N-P-2);l.push(G(`${".".repeat(J)} ${T}`))}}else l.push(G(".".repeat(Math.max(0,s-N-1))));if(l.length>0&&l.push(`
|
|
16
|
+
${x}`,h.pop(),`[${L}]`}let m=Object.keys(o);const S=m.length;if(S===0)return"{}";if(J<h.length+1)return'"[Object]"';v+=w;const E=`,
|
|
17
|
+
${v}`;let j="",k="",P=Math.min(S,O);c(o)&&(j+=d(o,E,O),m=m.slice(o.length),P-=o.length,k=E),T&&(m=g(m,B)),h.push(o);for(let L=0;L<P;L++){const C=m[L],V=K(C,o[C],h,w,v);V!==void 0&&(j+=`${k}${n(C)}: ${V}`,k=E)}if(S>O){const L=S-O;j+=`${k}"...": "${R(L)} not stringified"`,k=E}return k!==""&&(j=`
|
|
18
|
+
${v}${j}
|
|
19
|
+
${x}`),h.pop(),`{${j}}`}case"number":return isFinite(o)?String(o):l?l(o):"null";case"boolean":return o===!0?"true":"false";case"undefined":return;case"bigint":if(_)return String(o);default:return l?l(o):void 0}}p(K,"V"),s(K,"stringifyIndent");function X(N,o,h){switch(typeof o){case"string":return n(o);case"object":{if(o===null)return"null";if(typeof o.toJSON=="function"){if(o=o.toJSON(N),typeof o!="object")return X(N,o,h);if(o===null)return"null"}if(h.indexOf(o)!==-1)return $;let w="";const v=o.length!==void 0;if(v&&Array.isArray(o)){if(o.length===0)return"[]";if(J<h.length+1)return'"[Array]"';h.push(o);const j=Math.min(o.length,O);let k=0;for(;k<j-1;k++){const L=X(String(k),o[k],h);w+=L!==void 0?L:"null",w+=","}const P=X(String(k),o[k],h);if(w+=P!==void 0?P:"null",o.length-1>O){const L=o.length-O-1;w+=`,"... ${R(L)} not stringified"`}return h.pop(),`[${w}]`}let x=Object.keys(o);const m=x.length;if(m===0)return"{}";if(J<h.length+1)return'"[Object]"';let S="",E=Math.min(m,O);v&&c(o)&&(w+=d(o,",",O),x=x.slice(o.length),E-=o.length,S=","),T&&(x=g(x,B)),h.push(o);for(let j=0;j<E;j++){const k=x[j],P=X(k,o[k],h);P!==void 0&&(w+=`${S}${n(k)}:${P}`,S=",")}if(m>O){const j=m-O;w+=`${S}"...":"${R(j)} not stringified"`}return h.pop(),`{${w}}`}case"number":return isFinite(o)?String(o):l?l(o):"null";case"boolean":return o===!0?"true":"false";case"undefined":return;case"bigint":if(_)return String(o);default:return l?l(o):void 0}}p(X,"N"),s(X,"stringifySimple");function ke(N,o,h){if(arguments.length>1){let w="";if(typeof h=="number"?w=" ".repeat(Math.min(h,10)):typeof h=="string"&&(w=h.slice(0,10)),o!=null){if(typeof o=="function")return te("",{"":N},[],o,w,"");if(Array.isArray(o))return re("",N,[],F(o),w,"")}if(w.length!==0)return K("",N,[],w,"")}return X("",N,[])}return p(ke,"M"),s(ke,"stringify"),ke}p(Q,"configure"),s(Q,"configure")})(ae,ae.exports)),ae.exports}p(vt,"requireSafeStableStringify");var St=vt();const wt=Ie(St),xt=wt.configure;var Lt=Object.defineProperty,Tt=p((t,e)=>Lt(t,"name",{value:e,configurable:!0}),"o$1");const kt=Tt(t=>{const e=console;return t==="error"?e.__error??console.error:t==="warn"?e.__warn??console.warn:t==="trace"?e.__trace??console.trace:e.__log??console.log},"writeConsoleLogBasedOnLevel");var Mt=Object.defineProperty,Ot=p((t,e)=>Mt(t,"name",{value:e,configurable:!0}),"t");let Et=class{static{p(this,"a")}static{Ot(this,"RawReporter")}log(e){const{context:r=[],message:s,type:i}=e;kt(i.level)(s,...r)}};var jt=Object.defineProperty,At=p((t,e)=>jt(t,"name",{value:e,configurable:!0}),"a");const me=At(t=>t===void 0?[]:Array.isArray(t)?t:[t],"arrayify");var Bt=Object.defineProperty,Pt=p((t,e)=>Bt(t,"name",{value:e,configurable:!0}),"g$3");const be=Pt((t,e)=>{const r={...t};return Object.keys(e).forEach(s=>{r[s]={...r[s],...e[s]}}),r},"mergeTypes");var _t=Object.defineProperty,ye=p((t,e)=>_t(t,"name",{value:e,configurable:!0}),"d");const Nt=ye(t=>{let e=!1;return function(...r){if(!e){e=!0;try{const s=t.apply(this,r);return e=!1,s}catch(s){throw e=!1,s}}}},"preventLoop");class xe{static{p(this,"PailBrowserImpl")}static{ye(this,"PailBrowserImpl")}timersMap;countMap;seqTimers;lastLog;logLevels;disabled;paused;messageQueue;scopeName;types;longestLabel;processors;generalLogLevel;reporters;throttle;throttleMin;stringify;groups;startTimerMessage;endTimerMessage;rawReporter;force={};constructor(e){this.throttle=e.throttle??1e3,this.throttleMin=e.throttleMin??5;const r=e.parentLongestLabel,s=e.parentTypes,i=e.parentStringify,a=e.parentLogLevels;this.stringify=i??xt({strict:!0}),this.startTimerMessage=e.messages?.timerStart??"Initialized timer...",this.endTimerMessage=e.messages?.timerEnd??"Timer run for:",s&&r?(this.types=s,this.longestLabel=r):(this.types=be(Ue,e.types??{}),this.longestLabel=le(this.types)),this.logLevels=a&&!e.logLevels?a:{...Ye,...e.logLevels},this.generalLogLevel=this.#t(e.logLevel),this.reporters=new Set,this.processors=new Set,this.disabled=e.disabled??!1,this.paused=!1,this.messageQueue=[],this.scopeName=me(e.scope).filter(Boolean),this.timersMap=new Map,this.countMap=new Map,this.groups=[],this.seqTimers=new Set,this.lastLog={},this.logger=Nt(this.logger.bind(this)),this.#r(),Array.isArray(e.reporters)&&this.registerReporters(e.reporters),this.rawReporter=this.extendReporter(e.rawReporter??new Et),Array.isArray(e.processors)&&this.registerProcessors(e.processors)}#r(){for(const e in this.types)this[e]=this.logger.bind(this,e,!1,!1);for(const e in this.types)this.force[e]=this.logger.bind(this,e,!1,!0);this.raw=this.raw.bind(this)}wrapConsole(){for(const e in this.types)console[`__${e}`]||(console[`__${e}`]=console[e]),console[e]=this[e]}restoreConsole(){for(const e in this.types)console[`__${e}`]&&(console[e]=console[`__${e}`],delete console[`__${e}`])}wrapException(){process.on("uncaughtException",e=>{this.error(e)}),process.on("unhandledRejection",e=>{this.error(e)})}disable(){this.disabled=!0}enable(){this.disabled=!1}isEnabled(){return!this.disabled}pause(){this.paused=!0}resume(){this.paused=!1;const e=this.messageQueue.splice(0);for(let r=0;r<e.length;r+=1){const{messageObject:s,raw:i,type:a}=e[r];this.logger(a,i,!1,...s)}}scope(...e){if(e.length===0)throw new Error("No scope name was defined.");return this.scopeName=e.flat(),this}unscope(){this.scopeName=[]}child(e){const r=e?.types!==void 0,s=r?be(this.types,e.types):this.types,i=e?.reporters??[],a=i.length>0?[...this.reporters,...i]:[...this.reporters],u=e?.processors??[],n=u.length>0?[...this.processors,...u]:[...this.processors],g=e?.logLevels?{...this.logLevels,...e.logLevels}:this.logLevels;let y;if(e?.scope){const b=me(e.scope).filter(Boolean);y=this.scopeName.length>0?[...this.scopeName,...b]:b}else y=this.scopeName.length>0?this.scopeName:[];const c=e?.messages?{timerEnd:this.endTimerMessage,timerStart:this.startTimerMessage,...e.messages}:{timerEnd:this.endTimerMessage,timerStart:this.startTimerMessage},d={disabled:e?.disabled??this.disabled,logLevel:e?.logLevel??this.generalLogLevel,logLevels:g,messages:c,processors:n,rawReporter:e?.rawReporter??this.rawReporter,reporters:a,scope:y,throttle:e?.throttle??this.throttle,throttleMin:e?.throttleMin??this.throttleMin};return r?(d.parentTypes=s,d.parentLongestLabel=le(s)):(d.parentTypes=this.types,d.parentLongestLabel=this.longestLabel),e?.logLevels||(d.parentLogLevels=this.logLevels),e?.messages||(d.parentMessages={timerEnd:this.endTimerMessage,timerStart:this.startTimerMessage}),d.parentStringify=this.stringify,new xe(d)}time(e="default"){this.seqTimers.has(e)?this.logger("warn",!1,!1,{message:`Timer '${e}' already exists`,prefix:e}):(this.seqTimers.add(e),this.timersMap.set(e,Date.now()),this.logger("start",!1,!1,{message:this.startTimerMessage,prefix:e}))}timeLog(e,...r){if(!e&&this.seqTimers.size>0&&(e=[...this.seqTimers].pop()),e&&this.timersMap.has(e)){const s=Date.now()-this.timersMap.get(e);this.logger("info",!1,!1,{context:r,message:s<1e3?`${String(s)} ms`:`${(s/1e3).toFixed(2)} s`,prefix:e})}else this.logger("warn",!1,!1,{context:r,message:"Timer not found",prefix:e})}timeEnd(e){if(!e&&this.seqTimers.size>0&&(e=[...this.seqTimers].pop()),e&&this.timersMap.has(e)){const r=Date.now()-this.timersMap.get(e);this.timersMap.delete(e),this.logger("stop",!1,!1,{message:`${this.endTimerMessage} ${r<1e3?`${String(r)} ms`:`${(r/1e3).toFixed(2)} s`}`,prefix:e})}else this.logger("warn",!1,!1,{message:"Timer not found",prefix:e})}group(e="console.group"){globalThis.window===void 0?this.groups.push(e):console.group(e)}groupEnd(){globalThis.window===void 0?this.groups.pop():console.groupEnd()}count(e="default"){const r=this.countMap.get(e)??0;this.countMap.set(e,r+1),this.logger("log",!1,!1,{message:`${e}: ${String(r+1)}`,prefix:e})}countReset(e="default"){this.countMap.has(e)?this.countMap.delete(e):this.logger("warn",!1,!1,{message:`Count for ${e} does not exist`,prefix:e})}clear(){console.clear()}raw(e,...r){this.disabled||this.logger("log",!0,!1,{context:r,message:e})}extendReporter(e){return typeof e.setLoggerTypes=="function"&&e.setLoggerTypes(this.types),typeof e.setStringify=="function"&&e.setStringify(this.stringify),e}registerReporters(e){for(let r=0;r<e.length;r+=1)this.reporters.add(this.extendReporter(e[r]))}registerProcessors(e){for(let r=0;r<e.length;r+=1){const s=e[r];typeof s.setStringify=="function"&&s.setStringify(this.stringify),this.processors.add(s)}}#e(e,r){if(r)this.rawReporter.log(Object.freeze(e));else for(const s of this.reporters)s.log(Object.freeze(e))}#t(e){return e&&this.logLevels[e]?e:"debug"}#s(e,r,...s){const i={badge:void 0,context:void 0,error:void 0,label:void 0,message:Se,prefix:void 0,repeated:void 0,scope:void 0,suffix:void 0};if(i.type={level:r.logLevel,name:e},i.groups=this.groups,i.scope=this.scopeName,i.date=new Date,s.length>0&&s[0]instanceof Error)i.error=s[0],s.length>1&&(i.context=s.slice(1));else if(s.length>0&&typeof s[0]=="object"&&s[0]!==null&&"message"in s[0]){const{context:a,message:u,prefix:n,suffix:g}=s[0];if(a&&(i.context=a),n&&(i.prefix=n),g&&(i.suffix=g),i.message=u,s.length>1){const y=s.slice(1);i.context?i.context=Array.isArray(i.context)?[...i.context,...y]:[i.context,...y]:i.context=y}}else s.length>1?(i.message=s[0],i.context=s.slice(1)):s.length===1?i.message=s[0]:i.message=void 0;return r.logLevel==="trace"&&(i.traceError=new Error("Trace")),r.badge&&(i.badge=r.badge),r.label&&(i.label=r.label),i}logger(e,r,s,...i){if(this.disabled)return;if(this.paused){this.messageQueue.push({messageObject:i,raw:r,type:e});return}const a=this.types[e],u=this.#t(a.logLevel);if(s||this.logLevels[u]>=this.logLevels[this.generalLogLevel]){let n=this.#s(e,a,...i);const g=ye((c=!1)=>{const d=(this.lastLog.count??0)-this.throttleMin;if(this.lastLog.object&&d>0){const b={...this.lastLog.object};d>1&&(b.repeated=d),this.#e(b,r),this.lastLog.count=1}if(c){for(const b of this.processors)n={...b.process(n)};this.lastLog.object=n,this.#e(n,r)}},"resolveLog");clearTimeout(this.lastLog.timeout);const y=this.lastLog.time&&n.date?new Date(n.date).getTime()-this.lastLog.time.getTime():0;if(this.lastLog.time=new Date(n.date),y<this.throttle)try{if(this.lastLog.object&&JSON.stringify([n.label,n.scope,n.type,n.message,n.prefix,n.suffix,n.context])===JSON.stringify([this.lastLog.object.label,this.lastLog.object.scope,this.lastLog.object.type,this.lastLog.object.message,this.lastLog.object.prefix,this.lastLog.object.suffix,this.lastLog.object.context])&&(this.lastLog.count=(this.lastLog.count??0)+1,this.lastLog.count>this.throttleMin)){this.lastLog.timeout=setTimeout(g,this.throttle);return}}catch{}g(!0)}}}var Dt=Object.defineProperty,Ct=p((t,e)=>Dt(t,"name",{value:e,configurable:!0}),"c$1");let Rt=class{static{p(this,"v")}static{Ct(this,"RawReporter")}#r;#e;#t;#s=!1;#i;constructor(e={}){this.#r=$e,this.#e=ve,this.#i=e}setStdout(e){this.#r=e}setStderr(e){this.#e=e}setInteractiveManager(e){this.#t=e}setIsInteractive(e){this.#s=e}log(e){const{context:r,groups:s,message:i,type:a}=e,u=[];if(i!==Se){const c=typeof i=="string"?i:ce(i,this.#i);u.push(c)}r&&u.push(...r.map(c=>typeof c=="object"?` ${ce(c,this.#i)}`:` ${String(c)}`));const n=["error","trace","warn"].includes(a.level)?"stderr":"stdout",g=n==="stderr"?this.#e:this.#r,y=s.map(()=>" ").join("");this.#s&&this.#t!==void 0&&g.isTTY?this.#t.update(n,(y+u.join("")).split(`
|
|
20
|
+
`),0):Ne(y+u.join(""),g)}};var It=Object.defineProperty,Ft=p((t,e)=>It(t,"name",{value:e,configurable:!0}),"m$1");class Le extends xe{static{p(this,"c")}constructor(e){const r=e.parentStderr,s=e.parentStdout,{interactive:i,processors:a,rawReporter:u,reporters:n,stderr:g,stdout:y}=e,c=r??g,d=s??y,b=e.parentLongestLabel,A=e.parentTypes,{parentLogLevels:q,parentMessages:z,parentStringify:R}=e,F={disabled:e.disabled,logLevel:e.logLevel,logLevels:e.logLevels,messages:e.messages,processors:[],rawReporter:e.rawReporter,reporters:[],scope:e.scope,throttle:e.throttle,throttleMin:e.throttleMin},Y="types"in e;A&&b&&!Y?(F.parentTypes=A,F.parentLongestLabel=b):Y&&e.types!==void 0&&(F.types=e.types),R&&(F.parentStringify=R),q&&!e.logLevels&&(F.parentLogLevels=q),z&&!e.messages&&(F.parentMessages=z),super(F),this.options=e,this.interactive=i??!1,this.stdout=d,this.stderr=c,this.interactive&&(this.interactiveManager=new We(new Me(this.stdout),new Me(this.stderr))),Array.isArray(n)&&this.registerReporters(n),this.rawReporter=this.extendReporter(u??new Rt),Array.isArray(a)&&this.registerProcessors(a)}options;static{Ft(this,"PailServerImpl")}stdout;stderr;interactiveManager;interactive;scope(...e){if(e.length===0)throw new Error("No scope name was defined.");return this.scopeName=e.flat(),this}child(e){const r=e?.types!==void 0,s=r?be(this.types,e.types):this.types,i=e?.reporters??[],a=i.length>0?[...this.reporters,...i]:[...this.reporters],u=e?.processors??[],n=u.length>0?[...this.processors,...u]:[...this.processors],g=e?.logLevels?{...this.logLevels,...e.logLevels}:this.logLevels;let y;if(e?.scope){const b=me(e.scope).filter(Boolean);y=this.scopeName.length>0?[...this.scopeName,...b]:b}else y=this.scopeName.length>0?this.scopeName:[];const c=e?.messages?{timerEnd:this.endTimerMessage,timerStart:this.startTimerMessage,...e.messages}:{timerEnd:this.endTimerMessage,timerStart:this.startTimerMessage},d={disabled:e?.disabled??this.disabled,interactive:e?.interactive??this.interactive,logLevel:e?.logLevel??this.generalLogLevel,logLevels:g,messages:c,processors:n,rawReporter:e?.rawReporter??this.rawReporter,reporters:a,scope:y,stderr:e?.stderr??this.stderr,stdout:e?.stdout??this.stdout,throttle:e?.throttle??this.throttle,throttleMin:e?.throttleMin??this.throttleMin};return this.#r(d,e,r,s),new Le(d)}#r(e,r,s,i){s?(e.parentTypes=i,e.parentLongestLabel=le(i)):(e.parentTypes=this.types,e.parentLongestLabel=this.longestLabel),r?.logLevels||(e.parentLogLevels=this.logLevels),r?.messages||(e.parentMessages={timerEnd:this.endTimerMessage,timerStart:this.startTimerMessage}),e.parentStringify=this.stringify,r?.stdout||(e.parentStdout=this.stdout),r?.stderr||(e.parentStderr=this.stderr)}getInteractiveManager(){return this.interactiveManager}wrapStd(){this.#e(this.stdout,"log"),this.#e(this.stderr,"log")}restoreStd(){this.#t(this.stdout),this.#t(this.stderr)}wrapAll(){this.wrapConsole(),this.wrapStd()}restoreAll(){this.restoreConsole(),this.restoreStd()}clear(){this.stdout.write(Oe),this.stderr.write(Oe)}extendReporter(e){return typeof e.setStdout=="function"&&e.setStdout(this.stdout),typeof e.setStderr=="function"&&e.setStderr(this.stderr),typeof e.setLoggerTypes=="function"&&e.setLoggerTypes(this.types),typeof e.setStringify=="function"&&e.setStringify(this.stringify),typeof e.setIsInteractive=="function"&&e.setIsInteractive(this.interactive),this.interactive&&typeof e.setInteractiveManager=="function"&&e.setInteractiveManager(this.interactiveManager),e}#e(e,r){e&&(e.__write||(e.__write=e.write),e.write=s=>{this[r](String(s).trim())})}#t(e){e&&e.__write&&(e.write=e.__write,delete e.__write)}}const qt=Le;var Jt=Object.defineProperty,Vt=p((t,e)=>Jt(t,"name",{value:e,configurable:!0}),"x"),Gt=Object.defineProperty,Fe=Vt((t,e)=>Gt(t,"name",{value:e,configurable:!0}),"h"),zt=Object.defineProperty,ie=Fe((t,e)=>zt(t,"name",{value:e,configurable:!0}),"g$1");const je=new Map([["aliceblue","#f0f8ff"],["antiquewhite","#faebd7"],["aqua","#00ffff"],["aquamarine","#7fffd4"],["azure","#f0ffff"],["beige","#f5f5dc"],["bisque","#ffe4c4"],["black","#000000"],["blanchedalmond","#ffebcd"],["blue","#0000ff"],["blueviolet","#8a2be2"],["brown","#a52a2a"],["burlywood","#deb887"],["cadetblue","#5f9ea0"],["chartreuse","#7fff00"],["chocolate","#d2691e"],["coral","#ff7f50"],["cornflowerblue","#6495ed"],["cornsilk","#fff8dc"],["crimson","#dc143c"],["cyan","#00ffff"],["darkblue","#00008b"],["darkcyan","#008b8b"],["darkgoldenrod","#b8860b"],["darkgray","#a9a9a9"],["darkgreen","#006400"],["darkgrey","#a9a9a9"],["darkkhaki","#bdb76b"],["darkmagenta","#8b008b"],["darkolivegreen","#556b2f"],["darkorange","#ff8c00"],["darkorchid","#9932cc"],["darkred","#8b0000"],["darksalmon","#e9967a"],["darkseagreen","#8fbc8f"],["darkslateblue","#483d8b"],["darkslategray","#2f4f4f"],["darkslategrey","#2f4f4f"],["darkturquoise","#00ced1"],["darkviolet","#9400d3"],["deeppink","#ff1493"],["deepskyblue","#00bfff"],["dimgray","#696969"],["dimgrey","#696969"],["dodgerblue","#1e90ff"],["firebrick","#b22222"],["floralwhite","#fffaf0"],["forestgreen","#228b22"],["fuchsia","#ff00ff"],["gainsboro","#dcdcdc"],["ghostwhite","#f8f8ff"],["gold","#ffd700"],["goldenrod","#daa520"],["gray","#808080"],["green","#008000"],["greenyellow","#adff2f"],["grey","#808080"],["honeydew","#f0fff0"],["hotpink","#ff69b4"],["indianred","#cd5c5c"],["indigo","#4b0082"],["ivory","#fffff0"],["khaki","#f0e68c"],["lavender","#e6e6fa"],["lavenderblush","#fff0f5"],["lawngreen","#7cfc00"],["lemonchiffon","#fffacd"],["lightblue","#add8e6"],["lightcoral","#f08080"],["lightcyan","#e0ffff"],["lightgoldenrodyellow","#fafad2"],["lightgray","#d3d3d3"],["lightgreen","#90ee90"],["lightgrey","#d3d3d3"],["lightpink","#ffb6c1"],["lightsalmon","#ffa07a"],["lightseagreen","#20b2aa"],["lightskyblue","#87cefa"],["lightslategray","#778899"],["lightslategrey","#778899"],["lightsteelblue","#b0c4de"],["lightyellow","#ffffe0"],["lime","#00ff00"],["limegreen","#32cd32"],["linen","#faf0e6"],["magenta","#ff00ff"],["maroon","#800000"],["mediumaquamarine","#66cdaa"],["mediumblue","#0000cd"],["mediumorchid","#ba55d3"],["mediumpurple","#9370db"],["mediumseagreen","#3cb371"],["mediumslateblue","#7b68ee"],["mediumspringgreen","#00fa9a"],["mediumturquoise","#48d1cc"],["mediumvioletred","#c71585"],["midnightblue","#191970"],["mintcream","#f5fffa"],["mistyrose","#ffe4e1"],["moccasin","#ffe4b5"],["navajowhite","#ffdead"],["navy","#000080"],["oldlace","#fdf5e6"],["olive","#808000"],["olivedrab","#6b8e23"],["orange","#ffa500"],["orangered","#ff4500"],["orchid","#da70d6"],["palegoldenrod","#eee8aa"],["palegreen","#98fb98"],["paleturquoise","#afeeee"],["palevioletred","#db7093"],["papayawhip","#ffefd5"],["peachpuff","#ffdab9"],["peru","#cd853f"],["pink","#ffc0cb"],["plum","#dda0dd"],["powderblue","#b0e0e6"],["purple","#800080"],["rebeccapurple","#663399"],["red","#ff0000"],["rosybrown","#bc8f8f"],["royalblue","#4169e1"],["saddlebrown","#8b4513"],["salmon","#fa8072"],["sandybrown","#f4a460"],["seagreen","#2e8b57"],["seashell","#fff5ee"],["sienna","#a0522d"],["silver","#c0c0c0"],["skyblue","#87ceeb"],["slateblue","#6a5acd"],["slategray","#708090"],["slategrey","#708090"],["snow","#fffafa"],["springgreen","#00ff7f"],["steelblue","#4682b4"],["tan","#d2b48c"],["teal","#008080"],["thistle","#d8bfd8"],["tomato","#ff6347"],["turquoise","#40e0d0"],["violet","#ee82ee"],["wheat","#f5deb3"],["white","#ffffff"],["whitesmoke","#f5f5f5"],["yellow","#ffff00"],["yellowgreen","#9acd32"]]),Ht=/^#([\dA-F]{2})([\dA-F]{2})([\dA-F]{2})([\dA-F]{2})?$/i,Wt=/^#([\dA-F])([\dA-F])([\dA-F])([\dA-F])?$/i,Ut=/^rgba?\(\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*,\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*,\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*(,\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*)?\)$/,Yt=/^hsla?\(\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*,\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))%\s*,\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))%\s*(,\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*)?\)$/,qe=ie(()=>({__proto__:null,backgroundColor:null,color:null,fontStyle:null,fontWeight:null,textDecorationColor:null,textDecorationLine:[]}),"getDefaultCss"),Ae=/\s+/,fe=ie(t=>{je.has(t)&&(t=je.get(t));const e=Ht.exec(t);if(e)return[Number.parseInt(e[1],16),Number.parseInt(e[2],16),Number.parseInt(e[3],16)];const r=Wt.exec(t);if(r)return[Number.parseInt(`${r[1]}${r[1]}`,16),Number.parseInt(`${r[2]}${r[2]}`,16),Number.parseInt(`${r[3]}${r[3]}`,16)];const s=Ut.exec(t);if(s)return[Math.round(Math.max(0,Math.min(255,Number(s[1])))),Math.round(Math.max(0,Math.min(255,Number(s[2])))),Math.round(Math.max(0,Math.min(255,Number(s[3]))))];const i=Yt.exec(t);if(i){let a=Number(i[1])%360;a<0&&(a+=360);const u=Math.max(0,Math.min(100,Number(i[2])))/100,n=Math.max(0,Math.min(100,Number(i[3])))/100,g=(1-Math.abs(2*n-1))*u,y=g*(1-Math.abs(a/60%2-1)),c=n-g/2;let d,b,A;return a<60?{0:d,1:b,2:A}=[g,y,0]:a<120?{0:d,1:b,2:A}=[y,g,0]:a<180?{0:d,1:b,2:A}=[0,g,y]:a<240?{0:d,1:b,2:A}=[0,y,g]:a<300?{0:d,1:b,2:A}=[y,0,g]:{0:d,1:b,2:A}=[g,0,y],[Math.round((d+c)*255),Math.round((b+c)*255),Math.round((A+c)*255)]}return null},"parseCssColor"),he=ie((t,e)=>t?.[0]===e?.[0]&&t?.[1]===e?.[1]&&t?.[2]===e?.[2],"colorEquals"),Qt=ie(t=>{const e=qe(),r=[];let s=!1,i=null,a=0,u="";for(const n of t){if(n==="(")a+=1;else if(a>0)n===")"&&(a-=1);else if(s){if(n===";"){const g=u.trim();g!==""&&r.push([i,g]),i=null,u="",s=!1;continue}}else if(n===":"){i=u.trim(),u="",s=!0;continue}u+=n}if(s&&a===0){const n=u.trim();n!==""&&r.push([i,n]),i=null,u=""}for(const{0:n,1:g}of r)switch(n){case"background-color":{g!=null&&(e.backgroundColor=g);break}case"color":{g!=null&&(e.color=g);break}case"font-style":{["italic","oblique","oblique 14deg"].includes(g)&&(e.fontStyle="italic");break}case"font-weight":{g==="bold"&&(e.fontWeight=g);break}case"text-decoration":{e.textDecorationColor=null,e.textDecorationLine=[];const y=g.split(Ae);for(const c of y){const d=fe(c);d!=null?e.textDecorationColor=d:["line-through","overline","underline"].includes(c)&&e.textDecorationLine.push(c)}break}case"text-decoration-color":{const y=fe(g);y!=null&&(e.textDecorationColor=y);break}case"text-decoration-line":{e.textDecorationLine=[];const y=g.split(Ae);for(const c of y)["line-through","overline","underline"].includes(c)&&e.textDecorationLine.push(c);break}}return e},"parseCss"),Kt=ie((t,e)=>{e=e??qe();let r="";if(!he(t.backgroundColor,e.backgroundColor))if(t.backgroundColor==null)r+="\x1B[49m";else switch(t.backgroundColor){case"black":{r+="\x1B[40m";break}case"blue":{r+="\x1B[44m";break}case"cyan":{r+="\x1B[46m";break}case"green":{r+="\x1B[42m";break}case"magenta":{r+="\x1B[45m";break}case"red":{r+="\x1B[41m";break}case"white":{r+="\x1B[47m";break}case"yellow":{r+="\x1B[43m";break}default:if(Array.isArray(t.backgroundColor)){const{0:s,1:i,2:a}=t.backgroundColor;r+=`\x1B[48;2;${String(s)};${String(i)};${String(a)}m`}else{const s=fe(t.backgroundColor);if(s===null)r+="\x1B[49m";else{const{0:i,1:a,2:u}=s;r+=`\x1B[48;2;${String(i)};${String(a)};${String(u)}m`}}}if(!he(t.color,e.color))if(t.color==null)r+="\x1B[39m";else switch(t.color){case"black":{r+="\x1B[30m";break}case"blue":{r+="\x1B[34m";break}case"cyan":{r+="\x1B[36m";break}case"green":{r+="\x1B[32m";break}case"magenta":{r+="\x1B[35m";break}case"red":{r+="\x1B[31m";break}case"white":{r+="\x1B[37m";break}case"yellow":{r+="\x1B[33m";break}default:if(Array.isArray(t.color)){const{0:s,1:i,2:a}=t.color;r+=`\x1B[38;2;${String(s)};${String(i)};${String(a)}m`}else{const s=fe(t.color);if(s===null)r+="\x1B[39m";else{const{0:i,1:a,2:u}=s;r+=`\x1B[38;2;${String(i)};${String(a)};${String(u)}m`}}}if(t.fontWeight!==e.fontWeight&&(r+=t.fontWeight==="bold"?"\x1B[1m":"\x1B[22m"),t.fontStyle!==e.fontStyle&&(r+=t.fontStyle==="italic"?"\x1B[3m":"\x1B[23m"),!he(t.textDecorationColor,e.textDecorationColor))if(t.textDecorationColor==null)r+="\x1B[59m";else{const{0:s,1:i,2:a}=t.textDecorationColor;r+=`\x1B[58;2;${String(s)};${String(i)};${String(a)}m`}return t.textDecorationLine.includes("line-through")!==e.textDecorationLine.includes("line-through")&&(r+=t.textDecorationLine.includes("line-through")?"\x1B[9m":"\x1B[29m"),t.textDecorationLine.includes("overline")!==e.textDecorationLine.includes("overline")&&(r+=t.textDecorationLine.includes("overline")?"\x1B[53m":"\x1B[55m"),t.textDecorationLine.includes("underline")!==e.textDecorationLine.includes("underline")&&(r+=t.textDecorationLine.includes("underline")?"\x1B[4m":"\x1B[24m"),r},"cssToAnsi");var Xt=Object.defineProperty,Te=Fe((t,e)=>Xt(t,"name",{value:e,configurable:!0}),"y");const Zt=Te(t=>{try{return JSON.stringify(t)}catch{return'"[Circular]"'}},"tryStringify"),Be="%".codePointAt(0),er="s".codePointAt(0),tr="d".codePointAt(0),rr="f".codePointAt(0),sr="i".codePointAt(0),ir="O".codePointAt(0),or="o".codePointAt(0),nr="j".codePointAt(0),ar="c".codePointAt(0),lr=Te((t,e=[],r={})=>{if(typeof t!="string"&&typeof t!="object"||t===null)throw new TypeError(`fmt must be a string or object, got ${t===null?"null":typeof t}`);const s=r.stringify??Zt,i=1;if(typeof t=="object"){const c=e.length+i;if(c===1)return"{}";const d=Array.from({length:c});d[0]=s(t);for(let b=1;b<c;b+=1)d[b]=s(e[b-i]);return d.join(" ")}if(e.length===0)return t;let a="",u=1-i,n=-1,g=!1,y;for(let c=0;c<t.length;){if(t.codePointAt(c)===Be&&c+1<t.length){n=n>-1?n:0;const d=t.codePointAt(c+1);if(d===void 0){u+=1;break}switch(d){case ar:{if(globalThis.window===void 0){const b=Qt(e[u]);n<c&&(a+=t.slice(n,c)),a+=Kt(b,y),a!==""&&(g=!0,y=b)}n=c+2,c+=1;break}case tr:case rr:{if(u>=e.length||e[u]==null)break;n<c&&(a+=t.slice(n,c)),a+=Number(e[u]).toString(),n=c+2,c+=1;break}case sr:{if(u>=e.length||e[u]==null)break;n<c&&(a+=t.slice(n,c)),a+=Math.floor(Number(e[u])).toString(),n=c+2,c+=1;break}case nr:case ir:case or:{if(u>=e.length||e[u]===void 0)break;n<c&&(a+=t.slice(n,c));const b=e[u],A=typeof b;if(A==="string"){a+=`'${b}'`,n=c+2;break}if(A==="function"){a+=b.name?`[Function: ${b.name}]`:"[Function: <anonymous>]",n=c+2;break}a+=s(b),n=c+2,c+=1;break}case Be:{n<c&&(a+=t.slice(n,c)),a+="%",n=c+2,c+=1,u-=1;break}case er:{if(u>=e.length)break;n<c&&(a+=t.slice(n,c)),a+=typeof e[u]=="object"?s(e[u]):String(e[u]),n=c+2,c+=1;break}default:typeof r.formatters?.[d]=="function"&&(n<c&&(a+=t.slice(n,c)),a+=r.formatters[d](e[u]),n=c+2,c+=1)}u+=1}c+=1}return n===-1?t:(n<t.length&&(a+=t.slice(n)),g&&(a+="\x1B[0m"),a)},"format"),cr=Te((t={})=>{const e={};return typeof t.formatters=="object"&&Object.entries(t.formatters).forEach(([r,s])=>{if(r.length===0)throw new Error(`Formatter %${r} has no characters`);if(r.length>1)throw new Error(`Formatter %${r} has more than one character`);if(typeof s!="function")throw new TypeError(`Formatter for %${r} is not a function`);const i=r.codePointAt(0);if(i===void 0)throw new Error(`${r}.codePointAt(0) failed to return a value, please report this issue`);e[i]=s}),(r,s=[],i={})=>lr(r,s,{...i,formatters:e})},"build");var fr=Object.defineProperty,Pe=p((t,e)=>fr(t,"name",{value:e,configurable:!0}),"i$1");let ur=class{static{p(this,"g")}static{Pe(this,"MessageFormatterProcessor")}#r;#e;constructor(e={}){this.#e=e.formatters}setStringify(e){this.#r=e}process(e){const r=cr({formatters:this.#e,stringify:Pe(s=>this.#r?this.#r(s):JSON.stringify(s),"stringify")});return e.message!==void 0&&(e.message=this.#t(r,e.message,e.context??[])),e}#t(e,r,s=[]){if(typeof r=="string")return e(r,s);if(typeof r=="object"&&r!==null){const i=r,a=Object.keys(i);for(let u=0;u<a.length;u+=1){const n=a[u],g=i[n];(typeof g=="string"||Array.isArray(g)||typeof g=="object")&&(i[n]=this.#t(e,g,s))}}return r}};var gr=Object.defineProperty,Je=p((t,e)=>gr(t,"name",{value:e,configurable:!0}),"M");const{bgGrey:hr,cyan:dr,green:pr,greenBright:mr,grey:G,red:de,underline:_e,white:br}=De,yr=/[\\/]pail[\\/]dist/,pe=Je(t=>!yr.test(t),"pailFileFilter");class $r extends Qe{static{p(this,"PrettyReporter")}static{Je(this,"PrettyReporter")}#r;#e;#t;#s=!1;#i;#o;constructor(e={}){const{error:r,inspect:s,...i}=e;super({uppercase:{label:!0,...i.uppercase},...i}),this.#i={...Ke,...s},this.#o={...r,color:{fileLine:pr,hint:dr,marker:de,message:de,method:mr,title:de}},this.#r=$e,this.#e=ve}setStdout(e){this.#r=e}setStderr(e){this.#e=e}setInteractiveManager(e){this.#t=e}setIsInteractive(e){this.#s=e}log(e){this._log(this._formatMessage(e),e.type.level)}_formatMessage(e){const{columns:r}=Xe();let s=r;typeof this.styles.messageLength=="number"&&(s=this.styles.messageLength);const{badge:i,context:a,date:u,error:n,file:g,groups:y,label:c,message:d,prefix:b,repeated:A,scope:q,suffix:z,traceError:R,type:F}=e,{color:Y}=this.loggerTypes[F.name],Q=Y?De[Y]:br,f=y.map(()=>" ").join(""),l=[];if(y.length>0&&l.push(`${f+G(`[${y.at(-1)??""}]`)} `),u&&l.push(`${G(this.styles.dateFormatter(typeof u=="string"?new Date(u):u))} `),i)l.push(Q(i));else{const T=Ze(this.loggerTypes);T.length>0&&l.push(`${G(".".repeat(T.length))} `)}const $=le(this.loggerTypes);if(c){const T=ne($),B=ne(c);l.push(`${Q(et(c,this.styles))} `,G(".".repeat(Math.max(0,T-B))))}else l.push(G(".".repeat($.length+2)));A&&l.push(`${hr.white(`[${String(A)}x]`)} `),Array.isArray(q)&&q.length>0&&l.push(` ${G(`[${q.join(" > ")}]`)} `),b&&l.push(`${G(`${Array.isArray(q)&&q.length>0?". ":" "}[${this.styles.underline.prefix?_e(b):b}]`)} `);const _=ne(l.join(" "));if(g){const T=(g.name??"")+(g.line?`:${String(g.line)}`:""),B=ne(T);if(B+_+2>s)l.push(G(` ${T}`));else{const J=Math.max(0,s-_-B-2);l.push(G(`${".".repeat(J)} ${T}`))}}else l.push(G(".".repeat(Math.max(0,s-_-1))));if(l.length>0&&l.push(`
|
|
21
21
|
|
|
22
|
-
`),d!==Se){const T=typeof d=="string"?d:ce(d,this.#i);l.push(f+tt(T,{trim:!1,width:s-3,wrapMode:rt.STRICT_WIDTH}))}if(a){let T=!1;l.push(...a.map(
|
|
22
|
+
`),d!==Se){const T=typeof d=="string"?d:ce(d,this.#i);l.push(f+tt(T,{trim:!1,width:s-3,wrapMode:rt.STRICT_WIDTH}))}if(a){let T=!1;l.push(...a.map(B=>{if(B instanceof Error)return T=!0,`
|
|
23
23
|
|
|
24
|
-
${ge(
|
|
24
|
+
${ge(B,{...this.#o,filterStacktrace:pe,prefix:f})}`;if(typeof B=="object")return` ${ce(B,this.#i)}`;const J=(T?`
|
|
25
25
|
|
|
26
|
-
`:" ")+String(
|
|
26
|
+
`:" ")+String(B);return T=!1,J}))}return n&&l.push(ge(n,{...this.#o,filterStacktrace:pe,prefix:f})),R&&l.push(`
|
|
27
27
|
|
|
28
28
|
${ge(R,{...this.#o,filterStacktrace:pe,hideErrorCauseCodeView:!0,hideErrorCodeView:!0,hideErrorErrorsCodeView:!0,hideMessage:!0,prefix:f})}`),z&&l.push(`
|
|
29
|
-
`,f+G(this.styles.underline.suffix?
|
|
30
|
-
`),0):
|
|
31
|
-
`,i)}}var
|
|
29
|
+
`,f+G(this.styles.underline.suffix?_e(z):z)),l.join("")}_log(e,r){const s=["error","trace","warn"].includes(r)?"stderr":"stdout",i=s==="stderr"?this.#e:this.#r;this.#s&&this.#t!==void 0&&i.isTTY?this.#t.update(s,e.split(`
|
|
30
|
+
`),0):Ne(`${e}
|
|
31
|
+
`,i)}}var vr=Object.defineProperty,Ve=p((t,e)=>vr(t,"name",{value:e,configurable:!0}),"o");const Sr=Ve(()=>se.NODE_ENV==="debug"||se.DEBUG!==void 0?"debug":se.NODE_ENV==="test"?"warning":"informational","getDefaultLogLevel"),wr=Ve(t=>{let e=Sr();return se.PAIL_LOG_LEVEL!==void 0&&(e=se.PAIL_LOG_LEVEL),new qt({logLevel:e,processors:[new ur],reporters:[new $r],stderr:ve,stdout:$e,...t})},"createPail"),Br=wr();export{Nr as PailError,wr as createPail,Dr as createPailError,Br as pail};
|