zaileys 0.28.92-dev → 0.28.94-beta
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/LICENSE +1 -1
- package/README.md +77 -8
- package/dist/Modules/Action.d.ts +14 -0
- package/dist/Modules/Action.js +16 -0
- package/dist/Modules/Client.d.ts +36 -0
- package/dist/Modules/Client.js +274 -0
- package/dist/Modules/Config.d.ts +72 -0
- package/dist/Modules/Config.js +75 -0
- package/dist/Modules/Utils.d.ts +2 -0
- package/dist/Modules/Utils.js +26 -0
- package/dist/Parser/Message.d.ts +18 -0
- package/dist/Parser/Message.js +127 -0
- package/dist/Types/Action.d.ts +9 -0
- package/dist/Types/Action.js +2 -0
- package/dist/Types/General.d.ts +38 -0
- package/dist/Types/General.js +2 -0
- package/dist/Types/Message.d.ts +44 -0
- package/dist/Types/Message.js +2 -0
- package/dist/index.d.ts +3 -183
- package/dist/index.js +6 -102
- package/package.json +52 -41
- package/demo/ai/tools.js +0 -28
- package/demo/ai/you.js +0 -30
- package/demo/index.js +0 -26
- package/demo/package.json +0 -16
- package/demo/pnpm-lock.yaml +0 -1222
- package/demo/screenshot.png +0 -0
- package/dist/index.d.mts +0 -183
- package/dist/index.mjs +0 -102
- package/docs.css +0 -10
package/dist/index.js
CHANGED
|
@@ -1,102 +1,6 @@
|
|
|
1
|
-
"use strict";var ms=Object.create;var Se=Object.defineProperty;var ys=Object.getOwnPropertyDescriptor;var bs=Object.getOwnPropertyNames;var ws=Object.getPrototypeOf,Ss=Object.prototype.hasOwnProperty;var x=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),vs=(e,t)=>{for(var r in t)Se(e,r,{get:t[r],enumerable:!0})},Zt=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of bs(t))!Ss.call(e,i)&&i!==r&&Se(e,i,{get:()=>t[i],enumerable:!(n=ys(t,i))||n.enumerable});return e};var F=(e,t,r)=>(r=e!=null?ms(ws(e)):{},Zt(t||!e||!e.__esModule?Se(r,"default",{value:e,enumerable:!0}):r,e)),Os=e=>Zt(Se({},"__esModule",{value:!0}),e);var Ve=x((Jc,er)=>{"use strict";er.exports=class extends Error{name="AssertError";constructor(t,r){super(t||"Unknown error"),typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,r)}}});var Ue=x((Hc,tr)=>{"use strict";tr.exports=function(...e){try{return JSON.stringify(...e)}catch(t){return"[Cannot display object: "+t.message+"]"}}});var ne=x((Gc,rr)=>{"use strict";var xs=Ve(),Es=Ue(),_s=rr.exports=function(e,...t){if(e)return;if(t.length===1&&t[0]instanceof Error)throw t[0];let r=t.filter(n=>n!=="").map(n=>typeof n=="string"?n:n instanceof Error?n.message:Es(n));throw new xs(r.join(" "),_s)}});var pe=x((Yc,ir)=>{"use strict";var Je=ne(),nr={};ir.exports=function(e,t,r){if(t===!1||t===null||t===void 0)return e;r=r||{},typeof r=="string"&&(r={separator:r});let n=Array.isArray(t);Je(!n||!r.separator,"Separator option is not valid for array-based chain");let i=n?t:t.split(r.separator||"."),o=e;for(let a=0;a<i.length;++a){let f=i[a],s=r.iterables&&nr.iterables(o);if(Array.isArray(o)||s==="set"){let u=Number(f);Number.isInteger(u)&&(f=u<0?o.length+u:u)}if(!o||typeof o=="function"&&r.functions===!1||!s&&o[f]===void 0){Je(!r.strict||a+1===i.length,"Missing segment",f,"in reach path ",t),Je(typeof o=="object"||r.functions===!0||typeof o!="function","Invalid segment",f,"in reach path ",t),o=r.default;break}s?s==="set"?o=[...o][f]:o=o.get(f):o=o[f]}return o};nr.iterables=function(e){if(e instanceof Set)return"set";if(e instanceof Map)return"map"}});var He=x((C,or)=>{"use strict";var sr={};C=or.exports={array:Array.prototype,buffer:Buffer&&Buffer.prototype,date:Date.prototype,error:Error.prototype,generic:Object.prototype,map:Map.prototype,promise:Promise.prototype,regex:RegExp.prototype,set:Set.prototype,url:URL.prototype,weakMap:WeakMap.prototype,weakSet:WeakSet.prototype};sr.typeMap=new Map([["[object Error]",C.error],["[object Map]",C.map],["[object Promise]",C.promise],["[object Set]",C.set],["[object URL]",C.url],["[object WeakMap]",C.weakMap],["[object WeakSet]",C.weakSet]]);C.getInternalProto=function(e){if(Array.isArray(e))return C.array;if(Buffer&&e instanceof Buffer)return C.buffer;if(e instanceof Date)return C.date;if(e instanceof RegExp)return C.regex;if(e instanceof Error)return C.error;let t=Object.prototype.toString.call(e);return sr.typeMap.get(t)||C.generic}});var ve=x(ar=>{"use strict";ar.keys=function(e,t={}){return t.symbols!==!1?Reflect.ownKeys(e):Object.getOwnPropertyNames(e)}});var Oe=x((Qc,lr)=>{"use strict";var Ts=pe(),B=He(),ks=ve(),Y={needsProtoHack:new Set([B.set,B.map,B.weakSet,B.weakMap])};lr.exports=Y.clone=function(e,t={},r=null){if(typeof e!="object"||e===null)return e;let n=Y.clone,i=r;if(t.shallow){if(t.shallow!==!0)return Y.cloneWithShallow(e,t);n=s=>s}else if(i){let s=i.get(e);if(s)return s}else i=new Map;let o=B.getInternalProto(e);switch(o){case B.buffer:return Buffer?.from(e);case B.date:return new Date(e.getTime());case B.regex:case B.url:return new o.constructor(e)}let a=Y.base(e,o,t);if(a===e)return e;if(i&&i.set(e,a),o===B.set)for(let s of e)a.add(n(s,t,i));else if(o===B.map)for(let[s,u]of e)a.set(s,n(u,t,i));let f=ks.keys(e,t);for(let s of f){if(s==="__proto__")continue;if(o===B.array&&s==="length"){a.length=e.length;continue}let u=Object.getOwnPropertyDescriptor(e,s);u?u.get||u.set?Object.defineProperty(a,s,u):u.enumerable?a[s]=n(e[s],t,i):Object.defineProperty(a,s,{enumerable:!1,writable:!0,configurable:!0,value:n(e[s],t,i)}):Object.defineProperty(a,s,{enumerable:!0,writable:!0,configurable:!0,value:n(e[s],t,i)})}return a};Y.cloneWithShallow=function(e,t){let r=t.shallow;t=Object.assign({},t),t.shallow=!1;let n=new Map;for(let i of r){let o=Ts(e,i);(typeof o=="object"||typeof o=="function")&&n.set(o,o)}return Y.clone(e,t,n)};Y.base=function(e,t,r){if(r.prototype===!1)return Y.needsProtoHack.has(t)?new t.constructor:t===B.array?[]:{};let n=Object.getPrototypeOf(e);if(n&&n.isImmutable)return e;if(t===B.array){let i=[];return n!==t&&Object.setPrototypeOf(i,n),i}if(Y.needsProtoHack.has(t)){let i=new n.constructor;return n!==t&&Object.setPrototypeOf(i,n),i}return Object.create(n)}});var Ye=x((Zc,fr)=>{"use strict";var Ge=ne(),cr=Oe(),Ms=ve(),ur={};fr.exports=ur.merge=function(e,t,r){if(Ge(e&&typeof e=="object","Invalid target value: must be an object"),Ge(t==null||typeof t=="object","Invalid source value: must be null, undefined, or an object"),!t)return e;if(r=Object.assign({nullOverride:!0,mergeArrays:!0},r),Array.isArray(t)){Ge(Array.isArray(e),"Cannot merge array onto an object"),r.mergeArrays||(e.length=0);for(let i=0;i<t.length;++i)e.push(cr(t[i],{symbols:r.symbols}));return e}let n=Ms.keys(t,r);for(let i=0;i<n.length;++i){let o=n[i];if(o==="__proto__"||!Object.prototype.propertyIsEnumerable.call(t,o))continue;let a=t[o];if(a&&typeof a=="object"){if(e[o]===a)continue;!e[o]||typeof e[o]!="object"||Array.isArray(e[o])!==Array.isArray(a)||a instanceof Date||Buffer&&Buffer.isBuffer(a)||a instanceof RegExp?e[o]=cr(a,{symbols:r.symbols}):ur.merge(e[o],a,r)}else(a!=null||r.nullOverride)&&(e[o]=a)}return e}});var mr=x((eu,gr)=>{"use strict";var xe=ne(),dr=Oe(),pr=Ye(),hr=pe(),Ee={};gr.exports=function(e,t,r={}){if(xe(e&&typeof e=="object","Invalid defaults value: must be an object"),xe(!t||t===!0||typeof t=="object","Invalid source value: must be true, falsy or an object"),xe(typeof r=="object","Invalid options: must be an object"),!t)return null;if(r.shallow)return Ee.applyToDefaultsWithShallow(e,t,r);let n=dr(e);if(t===!0)return n;let i=r.nullOverride!==void 0?r.nullOverride:!1;return pr(n,t,{nullOverride:i,mergeArrays:!1})};Ee.applyToDefaultsWithShallow=function(e,t,r){let n=r.shallow;xe(Array.isArray(n),"Invalid keys");let i=new Map,o=t===!0?null:new Set;for(let s of n){s=Array.isArray(s)?s:s.split(".");let u=hr(e,s);u&&typeof u=="object"?i.set(u,o&&hr(t,s)||u):o&&o.add(s)}let a=dr(e,{},i);if(!o)return a;for(let s of o)Ee.reachCopy(a,t,s);let f=r.nullOverride!==void 0?r.nullOverride:!1;return pr(a,t,{nullOverride:f,mergeArrays:!1})};Ee.reachCopy=function(e,t,r){for(let o of r){if(!(o in t))return;let a=t[o];if(typeof a!="object"||a===null)return;t=a}let n=t,i=e;for(let o=0;o<r.length-1;++o){let a=r[o];typeof i[a]!="object"&&(i[a]={}),i=i[a]}i[r[r.length-1]]=n}});var br=x((tu,yr)=>{"use strict";var Xe={};yr.exports=Xe.Bench=class{constructor(){this.ts=0,this.reset()}reset(){this.ts=Xe.Bench.now()}elapsed(){return Xe.Bench.now()-this.ts}static now(){let e=process.hrtime();return e[0]*1e3+e[1]/1e6}}});var Qe=x((nu,wr)=>{"use strict";wr.exports=function(){}});var vr=x((iu,Sr)=>{"use strict";var As=Qe();Sr.exports=function(){return new Promise(As)}});var Ze=x((su,Or)=>{"use strict";var J=He(),$={mismatched:null};Or.exports=function(e,t,r){return r=Object.assign({prototype:!0},r),!!$.isDeepEqual(e,t,r,[])};$.isDeepEqual=function(e,t,r,n){if(e===t)return e!==0||1/e===1/t;let i=typeof e;if(i!==typeof t||e===null||t===null)return!1;if(i==="function"){if(!r.deepFunction||e.toString()!==t.toString())return!1}else if(i!=="object")return e!==e&&t!==t;let o=$.getSharedType(e,t,!!r.prototype);switch(o){case J.buffer:return Buffer&&Buffer.prototype.equals.call(e,t);case J.promise:return e===t;case J.regex:case J.url:return e.toString()===t.toString();case $.mismatched:return!1}for(let a=n.length-1;a>=0;--a)if(n[a].isSame(e,t))return!0;n.push(new $.SeenEntry(e,t));try{return!!$.isDeepEqualObj(o,e,t,r,n)}finally{n.pop()}};$.getSharedType=function(e,t,r){if(r)return Object.getPrototypeOf(e)!==Object.getPrototypeOf(t)?$.mismatched:J.getInternalProto(e);let n=J.getInternalProto(e);return n!==J.getInternalProto(t)?$.mismatched:n};$.valueOf=function(e){let t=e.valueOf;if(t===void 0)return e;try{return t.call(e)}catch(r){return r}};$.hasOwnEnumerableProperty=function(e,t){return Object.prototype.propertyIsEnumerable.call(e,t)};$.isSetSimpleEqual=function(e,t){for(let r of Set.prototype.values.call(e))if(!Set.prototype.has.call(t,r))return!1;return!0};$.isDeepEqualObj=function(e,t,r,n,i){let{isDeepEqual:o,valueOf:a,hasOwnEnumerableProperty:f}=$,{keys:s,getOwnPropertySymbols:u}=Object;if(e===J.array)if(n.part){for(let l of t)for(let b of r)if(o(l,b,n,i))return!0}else{if(t.length!==r.length)return!1;for(let l=0;l<t.length;++l)if(!o(t[l],r[l],n,i))return!1;return!0}else if(e===J.set){if(t.size!==r.size)return!1;if(!$.isSetSimpleEqual(t,r)){let l=new Set(Set.prototype.values.call(r));for(let b of Set.prototype.values.call(t)){if(l.delete(b))continue;let w=!1;for(let S of l)if(o(b,S,n,i)){l.delete(S),w=!0;break}if(!w)return!1}}}else if(e===J.map){if(t.size!==r.size)return!1;for(let[l,b]of Map.prototype.entries.call(t))if(b===void 0&&!Map.prototype.has.call(r,l)||!o(b,Map.prototype.get.call(r,l),n,i))return!1}else if(e===J.error&&(t.name!==r.name||t.message!==r.message))return!1;let c=a(t),h=a(r);if((t!==c||r!==h)&&!o(c,h,n,i))return!1;let p=s(t);if(!n.part&&p.length!==s(r).length&&!n.skip)return!1;let d=0;for(let l of p){if(n.skip&&n.skip.includes(l)){r[l]===void 0&&++d;continue}if(!f(r,l)||!o(t[l],r[l],n,i))return!1}if(!n.part&&p.length-d!==s(r).length)return!1;if(n.symbols!==!1){let l=u(t),b=new Set(u(r));for(let w of l){if(!n.skip?.includes(w)){if(f(t,w)){if(!f(r,w)||!o(t[w],r[w],n,i))return!1}else if(f(r,w))return!1}b.delete(w)}for(let w of b)if(f(r,w))return!1}return!0};$.SeenEntry=class{constructor(e,t){this.obj=e,this.ref=t}isSame(e,t){return this.obj===e&&this.ref===t}}});var et=x((au,xr)=>{"use strict";xr.exports=function(e){return e.replace(/[\^\$\.\*\+\-\?\=\!\:\|\\\/\(\)\[\]\{\}\,]/g,"\\$&")}});var _r=x((lu,Er)=>{"use strict";var _e=ne(),Rs=Ze(),js=et(),Ls=ve(),W={};Er.exports=function(e,t,r={}){return typeof t!="object"&&(t=[t]),_e(!Array.isArray(t)||t.length,"Values array cannot be empty"),typeof e=="string"?W.string(e,t,r):Array.isArray(e)?W.array(e,t,r):(_e(typeof e=="object","Reference must be string or an object"),W.object(e,t,r))};W.array=function(e,t,r){if(Array.isArray(t)||(t=[t]),!e.length||r.only&&r.once&&e.length!==t.length)return!1;let n,i=new Map;for(let a of t)if(!r.deep||!a||typeof a!="object"){let f=i.get(a);f?++f.allowed:i.set(a,{allowed:1,hits:0})}else{n=n??W.compare(r);let f=!1;for(let[s,u]of i.entries())if(n(s,a)){++u.allowed,f=!0;break}f||i.set(a,{allowed:1,hits:0})}let o=0;for(let a of e){let f;if(!r.deep||!a||typeof a!="object")f=i.get(a);else{n=n??W.compare(r);for(let[s,u]of i.entries())if(n(s,a)){f=u;break}}if(f&&(++f.hits,++o,r.once&&f.hits>f.allowed))return!1}if(r.only&&o!==e.length)return!1;for(let a of i.values())if(a.hits!==a.allowed&&a.hits<a.allowed&&!r.part)return!1;return!!o};W.object=function(e,t,r){_e(r.once===void 0,"Cannot use option once with object");let n=Ls.keys(e,r);if(!n.length)return!1;if(Array.isArray(t))return W.array(n,t,r);let i=Object.getOwnPropertySymbols(t).filter(s=>t.propertyIsEnumerable(s)),o=[...Object.keys(t),...i],a=W.compare(r),f=new Set(o);for(let s of n){if(!f.has(s)){if(r.only)return!1;continue}if(!a(t[s],e[s]))return!1;f.delete(s)}return f.size?r.part?f.size<o.length:!1:!0};W.string=function(e,t,r){if(e==="")return t.length===1&&t[0]===""||!r.once&&!t.some(s=>s!=="");let n=new Map,i=[];for(let s of t)if(_e(typeof s=="string","Cannot compare string reference to non-string value"),s){let u=n.get(s);u?++u.allowed:(n.set(s,{allowed:1,hits:0}),i.push(js(s)))}else if(r.once||r.only)return!1;if(!i.length)return!0;let o=new RegExp(`(${i.join("|")})`,"g"),a=e.replace(o,(s,u)=>(++n.get(u).hits,""));if(r.only&&a)return!1;let f=!1;for(let s of n.values())if(s.hits&&(f=!0),s.hits!==s.allowed&&(s.hits<s.allowed&&!r.part||r.once))return!1;return!!f};W.compare=function(e){if(!e.deep)return W.shallow;let t=e.only!==void 0,r=e.part!==void 0,n={prototype:t?e.only:r?!e.part:!1,part:t?!e.only:r?e.part:!1};return(i,o)=>Rs(i,o,n)};W.shallow=function(e,t){return e===t}});var kr=x((cu,Tr)=>{"use strict";var qs=ne();Tr.exports=function(e){return qs(/^[ \w\!#\$%&'\(\)\*\+,\-\.\/\:;<\=>\?@\[\]\^`\{\|\}~\"\\]*$/.test(e),"Bad attribute value ("+e+")"),e.replace(/\\/g,"\\\\").replace(/\"/g,'\\"')}});var Ar=x((uu,Mr)=>{"use strict";var Q={};Mr.exports=function(e){if(!e)return"";let t="";for(let r=0;r<e.length;++r){let n=e.charCodeAt(r);Q.isSafe(n)?t+=e[r]:t+=Q.escapeHtmlChar(n)}return t};Q.escapeHtmlChar=function(e){let t=Q.namedHtml.get(e);return t||(e>=256?"&#"+e+";":`&#x${e.toString(16).padStart(2,"0")};`)};Q.isSafe=function(e){return Q.safeCharCodes.has(e)};Q.namedHtml=new Map([[38,"&"],[60,"<"],[62,">"],[34,"""],[160," "],[162,"¢"],[163,"£"],[164,"¤"],[169,"©"],[174,"®"]]);Q.safeCharCodes=function(){let e=new Set;for(let t=32;t<123;++t)(t>=97||t>=65&&t<=90||t>=48&&t<=57||t===32||t===46||t===44||t===45||t===58||t===95)&&e.add(t);return e}()});var jr=x((fu,Rr)=>{"use strict";var Te={};Rr.exports=function(e){return e?e.replace(/[<>&\u2028\u2029]/g,Te.escape):""};Te.escape=function(e){return Te.replacements.get(e)};Te.replacements=new Map([["<","\\u003c"],[">","\\u003e"],["&","\\u0026"],["\u2028","\\u2028"],["\u2029","\\u2029"]])});var Ir=x((hu,qr)=>{"use strict";var Lr={};qr.exports=Lr.flatten=function(e,t){let r=t||[];for(let n of e)Array.isArray(n)?Lr.flatten(n,r):r.push(n);return r}});var $r=x((du,Cr)=>{"use strict";var Pr={};Cr.exports=function(e,t,r={}){if(!e||!t)return r.first?null:[];let n=[],i=Array.isArray(e)?new Set(e):e,o=new Set;for(let a of t)if(Pr.has(i,a)&&!o.has(a)){if(r.first)return a;n.push(a),o.add(a)}return r.first?null:n};Pr.has=function(e,t){return typeof e.has=="function"?e.has(t):e[t]!==void 0}});var Dr=x((pu,Br)=>{"use strict";Br.exports=function(e){return typeof e?.then=="function"}});var Fr=x((gu,Nr)=>{"use strict";var zr={wrapped:Symbol("wrapped")};Nr.exports=function(e){if(e[zr.wrapped])return e;let t=!1,r=function(...n){t||(t=!0,e(...n))};return r[zr.wrapped]=!0,r}});var Kr=x((mu,Wr)=>{"use strict";var Is=pe();Wr.exports=function(e,t,r){return t.replace(/{([^{}]+)}/g,(n,i)=>Is(e,i,r)??"")}});var Ur=x((yu,Vr)=>{"use strict";var Ps={maxTimer:2147483647};Vr.exports=function(e,t,r){if(typeof e=="bigint"&&(e=Number(e)),e>=Number.MAX_SAFE_INTEGER&&(e=1/0),typeof e!="number"&&e!==void 0)throw new TypeError("Timeout must be a number or bigint");return new Promise(n=>{let i=r?r.setTimeout:setTimeout,o=()=>{let a=Math.min(e,Ps.maxTimer);e-=a,i(()=>e>0?o():n(t),a)};e!==1/0&&o()})}});var Jr=x(j=>{"use strict";j.applyToDefaults=mr();j.assert=ne();j.AssertError=Ve();j.Bench=br();j.block=vr();j.clone=Oe();j.contain=_r();j.deepEqual=Ze();j.escapeHeaderAttribute=kr();j.escapeHtml=Ar();j.escapeJson=jr();j.escapeRegex=et();j.flatten=Ir();j.ignore=Qe();j.intersect=$r();j.isPromise=Dr();j.merge=Ye();j.once=Fr();j.reach=pe();j.reachTemplate=Kr();j.stringify=Ue();j.wait=Ur()});var Hr=x(m=>{"use strict";var ie=Jr(),D={codes:new Map([[100,"Continue"],[101,"Switching Protocols"],[102,"Processing"],[200,"OK"],[201,"Created"],[202,"Accepted"],[203,"Non-Authoritative Information"],[204,"No Content"],[205,"Reset Content"],[206,"Partial Content"],[207,"Multi-Status"],[300,"Multiple Choices"],[301,"Moved Permanently"],[302,"Moved Temporarily"],[303,"See Other"],[304,"Not Modified"],[305,"Use Proxy"],[307,"Temporary Redirect"],[400,"Bad Request"],[401,"Unauthorized"],[402,"Payment Required"],[403,"Forbidden"],[404,"Not Found"],[405,"Method Not Allowed"],[406,"Not Acceptable"],[407,"Proxy Authentication Required"],[408,"Request Time-out"],[409,"Conflict"],[410,"Gone"],[411,"Length Required"],[412,"Precondition Failed"],[413,"Request Entity Too Large"],[414,"Request-URI Too Large"],[415,"Unsupported Media Type"],[416,"Requested Range Not Satisfiable"],[417,"Expectation Failed"],[418,"I'm a teapot"],[422,"Unprocessable Entity"],[423,"Locked"],[424,"Failed Dependency"],[425,"Too Early"],[426,"Upgrade Required"],[428,"Precondition Required"],[429,"Too Many Requests"],[431,"Request Header Fields Too Large"],[451,"Unavailable For Legal Reasons"],[500,"Internal Server Error"],[501,"Not Implemented"],[502,"Bad Gateway"],[503,"Service Unavailable"],[504,"Gateway Time-out"],[505,"HTTP Version Not Supported"],[506,"Variant Also Negotiates"],[507,"Insufficient Storage"],[509,"Bandwidth Limit Exceeded"],[510,"Not Extended"],[511,"Network Authentication Required"]])};m.Boom=class extends Error{constructor(e,t={}){if(e instanceof Error)return m.boomify(ie.clone(e),t);let{statusCode:r=500,data:n=null,ctor:i=m.Boom}=t,o=new Error(e||void 0);Error.captureStackTrace(o,i),o.data=n;let a=D.initialize(o,r);return Object.defineProperty(a,"typeof",{value:i}),t.decorate&&Object.assign(a,t.decorate),a}static[Symbol.hasInstance](e){return this===m.Boom?m.isBoom(e):this.prototype.isPrototypeOf(e)}};m.isBoom=function(e,t){return e instanceof Error&&!!e.isBoom&&(!t||e.output.statusCode===t)};m.boomify=function(e,t){return ie.assert(e instanceof Error,"Cannot wrap non-Error object"),t=t||{},t.data!==void 0&&(e.data=t.data),t.decorate&&Object.assign(e,t.decorate),e.isBoom?t.override===!1||!t.statusCode&&!t.message?e:D.initialize(e,t.statusCode??e.output.statusCode,t.message):D.initialize(e,t.statusCode??500,t.message)};m.badRequest=function(e,t){return new m.Boom(e,{statusCode:400,data:t,ctor:m.badRequest})};m.unauthorized=function(e,t,r){let n=new m.Boom(e,{statusCode:401,ctor:m.unauthorized});if(!t)return n;if(typeof t!="string")return n.output.headers["WWW-Authenticate"]=t.join(", "),n;let i=`${t}`;return(r||e)&&(n.output.payload.attributes={}),r&&(typeof r=="string"?(i+=" "+ie.escapeHeaderAttribute(r),n.output.payload.attributes=r):i+=" "+Object.keys(r).map(o=>{let a=r[o]??"";return n.output.payload.attributes[o]=a,`${o}="${ie.escapeHeaderAttribute(a.toString())}"`}).join(", ")),e?(r&&(i+=","),i+=` error="${ie.escapeHeaderAttribute(e)}"`,n.output.payload.attributes.error=e):n.isMissing=!0,n.output.headers["WWW-Authenticate"]=i,n};m.paymentRequired=function(e,t){return new m.Boom(e,{statusCode:402,data:t,ctor:m.paymentRequired})};m.forbidden=function(e,t){return new m.Boom(e,{statusCode:403,data:t,ctor:m.forbidden})};m.notFound=function(e,t){return new m.Boom(e,{statusCode:404,data:t,ctor:m.notFound})};m.methodNotAllowed=function(e,t,r){let n=new m.Boom(e,{statusCode:405,data:t,ctor:m.methodNotAllowed});return typeof r=="string"&&(r=[r]),Array.isArray(r)&&(n.output.headers.Allow=r.join(", ")),n};m.notAcceptable=function(e,t){return new m.Boom(e,{statusCode:406,data:t,ctor:m.notAcceptable})};m.proxyAuthRequired=function(e,t){return new m.Boom(e,{statusCode:407,data:t,ctor:m.proxyAuthRequired})};m.clientTimeout=function(e,t){return new m.Boom(e,{statusCode:408,data:t,ctor:m.clientTimeout})};m.conflict=function(e,t){return new m.Boom(e,{statusCode:409,data:t,ctor:m.conflict})};m.resourceGone=function(e,t){return new m.Boom(e,{statusCode:410,data:t,ctor:m.resourceGone})};m.lengthRequired=function(e,t){return new m.Boom(e,{statusCode:411,data:t,ctor:m.lengthRequired})};m.preconditionFailed=function(e,t){return new m.Boom(e,{statusCode:412,data:t,ctor:m.preconditionFailed})};m.entityTooLarge=function(e,t){return new m.Boom(e,{statusCode:413,data:t,ctor:m.entityTooLarge})};m.uriTooLong=function(e,t){return new m.Boom(e,{statusCode:414,data:t,ctor:m.uriTooLong})};m.unsupportedMediaType=function(e,t){return new m.Boom(e,{statusCode:415,data:t,ctor:m.unsupportedMediaType})};m.rangeNotSatisfiable=function(e,t){return new m.Boom(e,{statusCode:416,data:t,ctor:m.rangeNotSatisfiable})};m.expectationFailed=function(e,t){return new m.Boom(e,{statusCode:417,data:t,ctor:m.expectationFailed})};m.teapot=function(e,t){return new m.Boom(e,{statusCode:418,data:t,ctor:m.teapot})};m.badData=function(e,t){return new m.Boom(e,{statusCode:422,data:t,ctor:m.badData})};m.locked=function(e,t){return new m.Boom(e,{statusCode:423,data:t,ctor:m.locked})};m.failedDependency=function(e,t){return new m.Boom(e,{statusCode:424,data:t,ctor:m.failedDependency})};m.tooEarly=function(e,t){return new m.Boom(e,{statusCode:425,data:t,ctor:m.tooEarly})};m.preconditionRequired=function(e,t){return new m.Boom(e,{statusCode:428,data:t,ctor:m.preconditionRequired})};m.tooManyRequests=function(e,t){return new m.Boom(e,{statusCode:429,data:t,ctor:m.tooManyRequests})};m.illegal=function(e,t){return new m.Boom(e,{statusCode:451,data:t,ctor:m.illegal})};m.internal=function(e,t,r=500){return D.serverError(e,t,r,m.internal)};m.notImplemented=function(e,t){return D.serverError(e,t,501,m.notImplemented)};m.badGateway=function(e,t){return D.serverError(e,t,502,m.badGateway)};m.serverUnavailable=function(e,t){return D.serverError(e,t,503,m.serverUnavailable)};m.gatewayTimeout=function(e,t){return D.serverError(e,t,504,m.gatewayTimeout)};m.badImplementation=function(e,t){let r=D.serverError(e,t,500,m.badImplementation);return r.isDeveloperError=!0,r};D.initialize=function(e,t,r){let n=parseInt(t,10);if(ie.assert(!isNaN(n)&&n>=400,"First argument must be a number (400+):",t),e.isBoom=!0,e.isServer=n>=500,e.hasOwnProperty("data")||(e.data=null),e.output={statusCode:n,payload:{},headers:{}},Object.defineProperty(e,"reformat",{value:D.reformat,configurable:!0}),!r&&!e.message&&(e.reformat(),r=e.output.payload.error),r){let i=Object.getOwnPropertyDescriptor(e,"message")||Object.getOwnPropertyDescriptor(Object.getPrototypeOf(e),"message");ie.assert(!i||i.configurable&&!i.get,"The error is not compatible with boom"),e.message=r+(e.message?": "+e.message:""),e.output.payload.message=e.message}return e.reformat(),e};D.reformat=function(e=!1){this.output.payload.statusCode=this.output.statusCode,this.output.payload.error=D.codes.get(this.output.statusCode)||"Unknown",this.output.statusCode===500&&e!==!0?this.output.payload.message="An internal server error occurred":this.message&&(this.output.payload.message=this.message)};D.serverError=function(e,t,r,n){return t instanceof Error&&!t.isBoom?m.boomify(t,{statusCode:r,message:e}):new m.Boom(e,{statusCode:r,data:t,ctor:n})}});var Gr=x((vu,ke)=>{"use strict";var Cs=function(){"use strict";function e(c,h){return h!=null&&c instanceof h}var t;try{t=Map}catch{t=function(){}}var r;try{r=Set}catch{r=function(){}}var n;try{n=Promise}catch{n=function(){}}function i(c,h,p,d,l){typeof h=="object"&&(p=h.depth,d=h.prototype,l=h.includeNonEnumerable,h=h.circular);var b=[],w=[],S=typeof Buffer<"u";typeof h>"u"&&(h=!0),typeof p>"u"&&(p=1/0);function v(y,E){if(y===null)return null;if(E===0)return y;var O,T;if(typeof y!="object")return y;if(e(y,t))O=new t;else if(e(y,r))O=new r;else if(e(y,n))O=new n(function(U,he){y.then(function(de){U(v(de,E-1))},function(de){he(v(de,E-1))})});else if(i.__isArray(y))O=[];else if(i.__isRegExp(y))O=new RegExp(y.source,u(y)),y.lastIndex&&(O.lastIndex=y.lastIndex);else if(i.__isDate(y))O=new Date(y.getTime());else{if(S&&Buffer.isBuffer(y))return Buffer.allocUnsafe?O=Buffer.allocUnsafe(y.length):O=new Buffer(y.length),y.copy(O),O;e(y,Error)?O=Object.create(y):typeof d>"u"?(T=Object.getPrototypeOf(y),O=Object.create(T)):(O=Object.create(d),T=d)}if(h){var M=b.indexOf(y);if(M!=-1)return w[M];b.push(y),w.push(O)}e(y,t)&&y.forEach(function(U,he){var de=v(he,E-1),gs=v(U,E-1);O.set(de,gs)}),e(y,r)&&y.forEach(function(U){var he=v(U,E-1);O.add(he)});for(var k in y){var _;T&&(_=Object.getOwnPropertyDescriptor(T,k)),!(_&&_.set==null)&&(O[k]=v(y[k],E-1))}if(Object.getOwnPropertySymbols)for(var R=Object.getOwnPropertySymbols(y),k=0;k<R.length;k++){var q=R[k],A=Object.getOwnPropertyDescriptor(y,q);A&&!A.enumerable&&!l||(O[q]=v(y[q],E-1),A.enumerable||Object.defineProperty(O,q,{enumerable:!1}))}if(l)for(var P=Object.getOwnPropertyNames(y),k=0;k<P.length;k++){var I=P[k],A=Object.getOwnPropertyDescriptor(y,I);A&&A.enumerable||(O[I]=v(y[I],E-1),Object.defineProperty(O,I,{enumerable:!1}))}return O}return v(c,p)}i.clonePrototype=function(h){if(h===null)return null;var p=function(){};return p.prototype=h,new p};function o(c){return Object.prototype.toString.call(c)}i.__objToStr=o;function a(c){return typeof c=="object"&&o(c)==="[object Date]"}i.__isDate=a;function f(c){return typeof c=="object"&&o(c)==="[object Array]"}i.__isArray=f;function s(c){return typeof c=="object"&&o(c)==="[object RegExp]"}i.__isRegExp=s;function u(c){var h="";return c.global&&(h+="g"),c.ignoreCase&&(h+="i"),c.multiline&&(h+="m"),h}return i.__getRegExpFlags=u,i}();typeof ke=="object"&&ke.exports&&(ke.exports=Cs)});var Qr=x((Yr,Xr)=>{"use strict";(function(){var e,t,r,n=[].splice,i=function(a,f){if(!(a instanceof f))throw new Error("Bound instance method accessed before binding")},o=[].indexOf;r=Gr(),e=require("events").EventEmitter,Xr.exports=t=function(){class a extends e{constructor(s={}){super(),this.get=this.get.bind(this),this.mget=this.mget.bind(this),this.set=this.set.bind(this),this.mset=this.mset.bind(this),this.del=this.del.bind(this),this.take=this.take.bind(this),this.ttl=this.ttl.bind(this),this.getTtl=this.getTtl.bind(this),this.keys=this.keys.bind(this),this.has=this.has.bind(this),this.getStats=this.getStats.bind(this),this.flushAll=this.flushAll.bind(this),this.flushStats=this.flushStats.bind(this),this.close=this.close.bind(this),this._checkData=this._checkData.bind(this),this._check=this._check.bind(this),this._isInvalidKey=this._isInvalidKey.bind(this),this._wrap=this._wrap.bind(this),this._getValLength=this._getValLength.bind(this),this._error=this._error.bind(this),this._initErrors=this._initErrors.bind(this),this.options=s,this._initErrors(),this.data={},this.options=Object.assign({forceString:!1,objectValueSize:80,promiseValueSize:80,arrayValueSize:40,stdTTL:0,checkperiod:600,useClones:!0,deleteOnExpire:!0,enableLegacyCallbacks:!1,maxKeys:-1},this.options),this.options.enableLegacyCallbacks&&(console.warn("WARNING! node-cache legacy callback support will drop in v6.x"),["get","mget","set","del","ttl","getTtl","keys","has"].forEach(u=>{var c;c=this[u],this[u]=function(...h){var p,d,l,b;if(l=h,[...h]=l,[p]=n.call(h,-1),typeof p=="function")try{b=c(...h),p(null,b)}catch(w){d=w,p(d)}else return c(...h,p)}})),this.stats={hits:0,misses:0,keys:0,ksize:0,vsize:0},this.validKeyTypes=["string","number"],this._checkData()}get(s){var u,c;if(i(this,a),(c=this._isInvalidKey(s))!=null)throw c;if(this.data[s]!=null&&this._check(s,this.data[s]))return this.stats.hits++,u=this._unwrap(this.data[s]),u;this.stats.misses++}mget(s){var u,c,h,p,d,l;if(i(this,a),!Array.isArray(s))throw u=this._error("EKEYSTYPE"),u;for(l={},h=0,d=s.length;h<d;h++){if(p=s[h],(c=this._isInvalidKey(p))!=null)throw c;this.data[p]!=null&&this._check(p,this.data[p])?(this.stats.hits++,l[p]=this._unwrap(this.data[p])):this.stats.misses++}return l}set(s,u,c){var h,p,d;if(i(this,a),this.options.maxKeys>-1&&this.stats.keys>=this.options.maxKeys)throw h=this._error("ECACHEFULL"),h;if(this.options.forceString&&!1==="string"&&(u=JSON.stringify(u)),c==null&&(c=this.options.stdTTL),(p=this._isInvalidKey(s))!=null)throw p;return d=!1,this.data[s]&&(d=!0,this.stats.vsize-=this._getValLength(this._unwrap(this.data[s],!1))),this.data[s]=this._wrap(u,c),this.stats.vsize+=this._getValLength(u),d||(this.stats.ksize+=this._getKeyLength(s),this.stats.keys++),this.emit("set",s,u),!0}mset(s){var u,c,h,p,d,l,b,w,S,v;if(i(this,a),this.options.maxKeys>-1&&this.stats.keys+s.length>=this.options.maxKeys)throw u=this._error("ECACHEFULL"),u;for(h=0,b=s.length;h<b;h++){if(l=s[h],{key:d,val:v,ttl:S}=l,S&&typeof S!="number")throw u=this._error("ETTLTYPE"),u;if((c=this._isInvalidKey(d))!=null)throw c}for(p=0,w=s.length;p<w;p++)l=s[p],{key:d,val:v,ttl:S}=l,this.set(d,v,S);return!0}del(s){var u,c,h,p,d,l;for(i(this,a),Array.isArray(s)||(s=[s]),u=0,h=0,d=s.length;h<d;h++){if(p=s[h],(c=this._isInvalidKey(p))!=null)throw c;this.data[p]!=null&&(this.stats.vsize-=this._getValLength(this._unwrap(this.data[p],!1)),this.stats.ksize-=this._getKeyLength(p),this.stats.keys--,u++,l=this.data[p],delete this.data[p],this.emit("del",p,l.v))}return u}take(s){var u;return i(this,a),u=this.get(s),u!=null&&this.del(s),u}ttl(s,u){var c;if(i(this,a),u||(u=this.options.stdTTL),!s)return!1;if((c=this._isInvalidKey(s))!=null)throw c;return this.data[s]!=null&&this._check(s,this.data[s])?(u>=0?this.data[s]=this._wrap(this.data[s].v,u,!1):this.del(s),!0):!1}getTtl(s){var u,c;if(i(this,a),!!s){if((c=this._isInvalidKey(s))!=null)throw c;if(this.data[s]!=null&&this._check(s,this.data[s]))return u=this.data[s].t,u}}keys(){var s;return i(this,a),s=Object.keys(this.data),s}has(s){var u;return i(this,a),u=this.data[s]!=null&&this._check(s,this.data[s]),u}getStats(){return i(this,a),this.stats}flushAll(s=!0){i(this,a),this.data={},this.stats={hits:0,misses:0,keys:0,ksize:0,vsize:0},this._killCheckPeriod(),this._checkData(s),this.emit("flush")}flushStats(){i(this,a),this.stats={hits:0,misses:0,keys:0,ksize:0,vsize:0},this.emit("flush_stats")}close(){i(this,a),this._killCheckPeriod()}_checkData(s=!0){var u,c,h;i(this,a),c=this.data;for(u in c)h=c[u],this._check(u,h);s&&this.options.checkperiod>0&&(this.checkTimeout=setTimeout(this._checkData,this.options.checkperiod*1e3,s),this.checkTimeout!=null&&this.checkTimeout.unref!=null&&this.checkTimeout.unref())}_killCheckPeriod(){if(this.checkTimeout!=null)return clearTimeout(this.checkTimeout)}_check(s,u){var c;return i(this,a),c=!0,u.t!==0&&u.t<Date.now()&&(this.options.deleteOnExpire&&(c=!1,this.del(s)),this.emit("expired",s,this._unwrap(u))),c}_isInvalidKey(s){var u;if(i(this,a),u=typeof s,o.call(this.validKeyTypes,u)<0)return this._error("EKEYTYPE",{type:typeof s})}_wrap(s,u,c=!0){var h,p,d,l;return i(this,a),this.options.useClones||(c=!1),p=Date.now(),h=0,l=1e3,u===0?h=0:u?h=p+u*l:this.options.stdTTL===0?h=this.options.stdTTL:h=p+this.options.stdTTL*l,d={t:h,v:c?r(s):s}}_unwrap(s,u=!0){return this.options.useClones||(u=!1),s.v!=null?u?r(s.v):s.v:null}_getKeyLength(s){return s.toString().length}_getValLength(s){return i(this,a),typeof s=="string"?s.length:this.options.forceString?JSON.stringify(s).length:Array.isArray(s)?this.options.arrayValueSize*s.length:typeof s=="number"?8:typeof s?.then=="function"?this.options.promiseValueSize:typeof Buffer<"u"&&Buffer!==null&&Buffer.isBuffer(s)?s.length:s!=null&&typeof s=="object"?this.options.objectValueSize*Object.keys(s).length:typeof s=="boolean"?8:0}_error(s,u={}){var c;return i(this,a),c=new Error,c.name=s,c.errorcode=s,c.message=this.ERRORS[s]!=null?this.ERRORS[s](u):"-",c.data=u,c}_initErrors(){var s,u,c;i(this,a),this.ERRORS={},c=this._ERRORS;for(u in c)s=c[u],this.ERRORS[u]=this.createErrorMessage(s)}createErrorMessage(s){return function(u){return s.replace("__key",u.type)}}}return a.prototype._ERRORS={ENOTFOUND:"Key `__key` not found",ECACHEFULL:"Cache max keys amount exceeded",EKEYTYPE:"The key argument has to be of type `string` or `number`. Found: `__key`",EKEYSTYPE:"The keys argument has to be an array.",ETTLTYPE:"The ttl argument has to be a number."},a}.call(this)}).call(Yr)});var tt=x((Zr,en)=>{"use strict";(function(){var e;e=en.exports=Qr(),e.version="5.1.2"}).call(Zr)});var sn=x((Ou,nn)=>{"use strict";nn.exports=rn;var{toString:$s}=Object.prototype,rt=Symbol("circular-ref-tag"),nt=Symbol("pino-raw-err-ref"),tn=Object.create({},{type:{enumerable:!0,writable:!0,value:void 0},message:{enumerable:!0,writable:!0,value:void 0},stack:{enumerable:!0,writable:!0,value:void 0},raw:{enumerable:!1,get:function(){return this[nt]},set:function(e){this[nt]=e}}});Object.defineProperty(tn,nt,{writable:!0,value:{}});function rn(e){if(!(e instanceof Error))return e;e[rt]=void 0;let t=Object.create(tn);t.type=$s.call(e.constructor)==="[object Function]"?e.constructor.name:e.name,t.message=e.message,t.stack=e.stack;for(let r in e)if(t[r]===void 0){let n=e[r];n instanceof Error?n.hasOwnProperty(rt)||(t[r]=rn(n)):t[r]=n}return delete e[rt],t.raw=e,t}});var cn=x((xu,ln)=>{"use strict";ln.exports={mapHttpRequest:Bs,reqSerializer:an};var it=Symbol("pino-raw-req-ref"),on=Object.create({},{id:{enumerable:!0,writable:!0,value:""},method:{enumerable:!0,writable:!0,value:""},url:{enumerable:!0,writable:!0,value:""},query:{enumerable:!0,writable:!0,value:""},params:{enumerable:!0,writable:!0,value:""},headers:{enumerable:!0,writable:!0,value:{}},remoteAddress:{enumerable:!0,writable:!0,value:""},remotePort:{enumerable:!0,writable:!0,value:""},raw:{enumerable:!1,get:function(){return this[it]},set:function(e){this[it]=e}}});Object.defineProperty(on,it,{writable:!0,value:{}});function an(e){let t=e.info||e.socket,r=Object.create(on);return r.id=typeof e.id=="function"?e.id():e.id||(e.info?e.info.id:void 0),r.method=e.method,e.originalUrl?(r.url=e.originalUrl,r.query=e.query,r.params=e.params):r.url=e.path||(e.url?e.url.path||e.url:void 0),r.headers=e.headers,r.remoteAddress=t&&t.remoteAddress,r.remotePort=t&&t.remotePort,r.raw=e.raw||e,r}function Bs(e){return{req:an(e)}}});var dn=x((Eu,hn)=>{"use strict";hn.exports={mapHttpResponse:Ds,resSerializer:fn};var st=Symbol("pino-raw-res-ref"),un=Object.create({},{statusCode:{enumerable:!0,writable:!0,value:0},headers:{enumerable:!0,writable:!0,value:""},raw:{enumerable:!1,get:function(){return this[st]},set:function(e){this[st]=e}}});Object.defineProperty(un,st,{writable:!0,value:{}});function fn(e){let t=Object.create(un);return t.statusCode=e.statusCode,t.headers=e.getHeaders?e.getHeaders():e._headers,t.raw=e,t}function Ds(e){return{res:fn(e)}}});var at=x((_u,pn)=>{"use strict";var ot=sn(),Me=cn(),Ae=dn();pn.exports={err:ot,mapHttpRequest:Me.mapHttpRequest,mapHttpResponse:Ae.mapHttpResponse,req:Me.reqSerializer,res:Ae.resSerializer,wrapErrorSerializer:function(t){return t===ot?t:function(n){return t(ot(n))}},wrapRequestSerializer:function(t){return t===Me.reqSerializer?t:function(n){return t(Me.reqSerializer(n))}},wrapResponseSerializer:function(t){return t===Ae.resSerializer?t:function(n){return t(Ae.resSerializer(n))}}}});var lt=x((Tu,gn)=>{"use strict";function zs(e,t){return t}gn.exports=function(){let t=Error.prepareStackTrace;Error.prepareStackTrace=zs;let r=new Error().stack;if(Error.prepareStackTrace=t,!Array.isArray(r))return;let n=r.slice(2),i=[];for(let o of n)o&&i.push(o.getFileName());return i}});var yn=x((ku,mn)=>{"use strict";mn.exports=Ns;function Ns(e={}){let{ERR_PATHS_MUST_BE_STRINGS:t=()=>"fast-redact - Paths must be (non-empty) strings",ERR_INVALID_PATH:r=n=>`fast-redact \u2013 Invalid path (${n})`}=e;return function({paths:i}){i.forEach(o=>{if(typeof o!="string")throw Error(t());try{if(/〇/.test(o))throw Error();let a=(o[0]==="["?"":".")+o.replace(/^\*/,"\u3007").replace(/\.\*/g,".\u3007").replace(/\[\*\]/g,"[\u3007]");if(/\n|\r|;/.test(a)||/\/\*/.test(a))throw Error();Function(`
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
if (typeof o !== 'object' || o == null) {
|
|
8
|
-
${Gs(n,t)}
|
|
9
|
-
}
|
|
10
|
-
const { censor, secret } = this
|
|
11
|
-
const originalSecret = {}
|
|
12
|
-
const secretKeys = Object.keys(secret)
|
|
13
|
-
for (var i = 0; i < secretKeys.length; i++) {
|
|
14
|
-
originalSecret[secretKeys[i]] = secret[secretKeys[i]]
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
${Us(e,i,o)}
|
|
18
|
-
this.compileRestore()
|
|
19
|
-
${Js(r>0,i,o)}
|
|
20
|
-
this.secret = originalSecret
|
|
21
|
-
${Hs(t)}
|
|
22
|
-
`).bind(a);return f.state=a,t===!1&&(f.restore=s=>a.restore(s)),f}function Us(e,t,r){return Object.keys(e).map(n=>{let{escPath:i,leadingBracket:o,path:a}=e[n],f=o?1:0,s=o?"":".",u=[];for(var c;(c=Ks.exec(n))!==null;){let[,l]=c,{index:b,input:w}=c;b>f&&u.push(w.substring(0,b-(l?0:1)))}var h=u.map(l=>`o${s}${l}`).join(" && ");h.length===0?h+=`o${s}${n} != null`:h+=` && o${s}${n} != null`;let p=`
|
|
23
|
-
switch (true) {
|
|
24
|
-
${u.reverse().map(l=>`
|
|
25
|
-
case o${s}${l} === censor:
|
|
26
|
-
secret[${i}].circle = ${JSON.stringify(l)}
|
|
27
|
-
break
|
|
28
|
-
`).join(`
|
|
29
|
-
`)}
|
|
30
|
-
}
|
|
31
|
-
`,d=r?`val, ${JSON.stringify(a)}`:"val";return`
|
|
32
|
-
if (${h}) {
|
|
33
|
-
const val = o${s}${n}
|
|
34
|
-
if (val === censor) {
|
|
35
|
-
secret[${i}].precensored = true
|
|
36
|
-
} else {
|
|
37
|
-
secret[${i}].val = val
|
|
38
|
-
o${s}${n} = ${t?`censor(${d})`:"censor"}
|
|
39
|
-
${p}
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
`}).join(`
|
|
43
|
-
`)}function Js(e,t,r){return e===!0?`
|
|
44
|
-
{
|
|
45
|
-
const { wildcards, wcLen, groupRedact, nestedRedact } = this
|
|
46
|
-
for (var i = 0; i < wcLen; i++) {
|
|
47
|
-
const { before, beforeStr, after, nested } = wildcards[i]
|
|
48
|
-
if (nested === true) {
|
|
49
|
-
secret[beforeStr] = secret[beforeStr] || []
|
|
50
|
-
nestedRedact(secret[beforeStr], o, before, after, censor, ${t}, ${r})
|
|
51
|
-
} else secret[beforeStr] = groupRedact(o, before, censor, ${t}, ${r})
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
`:""}function Hs(e){return e===!1?"return o":`
|
|
55
|
-
var s = this.serialize(o)
|
|
56
|
-
this.restore(o)
|
|
57
|
-
return s
|
|
58
|
-
`}function Gs(e,t){return e===!0?"throw Error('fast-redact: primitives cannot be redacted')":t===!1?"return o":"return this.serialize(o)"}});var ut=x((ju,_n)=>{"use strict";_n.exports={groupRedact:Xs,groupRestore:Ys,nestedRedact:Zs,nestedRestore:Qs};function Ys({keys:e,values:t,target:r}){if(r==null||typeof r=="string")return;let n=e.length;for(var i=0;i<n;i++){let o=e[i];r[o]=t[i]}}function Xs(e,t,r,n,i){let o=xn(e,t);if(o==null||typeof o=="string")return{keys:null,values:null,target:o,flat:!0};let a=Object.keys(o),f=a.length,s=t.length,u=i?[...t]:void 0,c=new Array(f);for(var h=0;h<f;h++){let p=a[h];c[h]=o[p],i?(u[s]=p,o[p]=r(o[p],u)):n?o[p]=r(o[p]):o[p]=r}return{keys:a,values:c,target:o,flat:!0}}function Qs(e){for(let t=0;t<e.length;t++){let{target:r,path:n,value:i}=e[t],o=r;for(let a=n.length-1;a>0;a--)o=o[n[a]];o[n[0]]=i}}function Zs(e,t,r,n,i,o,a){let f=xn(t,r);if(f==null)return;let s=Object.keys(f),u=s.length;for(var c=0;c<u;c++){let h=s[c];eo(e,f,h,r,n,i,o,a)}return e}function ct(e,t){return e!=null?"hasOwn"in Object?Object.hasOwn(e,t):Object.prototype.hasOwnProperty.call(e,t):!1}function eo(e,t,r,n,i,o,a,f){let s=i.length,u=s-1,c=r;var h=-1,p,d,l,b=null,w=null,S,v,y=!1,E=0,O=0,T=to();if(l=p=t[r],typeof p=="object"){for(;p!=null&&++h<s&&(O+=1,r=i[h],b=l,!(r!=="*"&&!w&&!(typeof p=="object"&&r in p)));)if(!(r==="*"&&(w==="*"&&(y=!0),w=r,h!==u))){if(w){let k=Object.keys(p);for(var M=0;M<k.length;M++){let _=k[M];if(v=p[_],S=r==="*",y)T=X(T,_,O),E=h,l=En(v,E-1,r,n,i,o,a,f,c,p,d,l,S,_,h,u,T,e,t[c],O+1);else if(S||typeof v=="object"&&v!==null&&r in v){if(S?l=v:l=v[r],d=h!==u?l:a?f?o(l,[...n,c,...i]):o(l):o,S){let R=ge(X(T,_,O),l,t[c]);e.push(R),p[_]=d}else if(v[r]!==d)if(d===void 0&&o!==void 0||ct(v,r)&&d===l)T=X(T,_,O);else{T=X(T,_,O);let R=ge(X(T,r,O+1),l,t[c]);e.push(R),v[r]=d}}}w=null}else{if(l=p[r],T=X(T,r,O),d=h!==u?l:a?f?o(l,[...n,c,...i]):o(l):o,!(ct(p,r)&&d===l||d===void 0&&o!==void 0)){let k=ge(T,l,t[c]);e.push(k),p[r]=d}p=p[r]}if(typeof p!="object")break}}}function xn(e,t){for(var r=-1,n=t.length,i=e;i!=null&&++r<n;)i=i[t[r]];return i}function En(e,t,r,n,i,o,a,f,s,u,c,h,p,d,l,b,w,S,v,y){if(t===0&&(p||typeof e=="object"&&e!==null&&r in e)){if(p?h=e:h=e[r],c=l!==b?h:a?f?o(h,[...n,s,...i]):o(h):o,p){let E=ge(w,h,v);S.push(E),u[d]=c}else if(e[r]!==c){if(!(c===void 0&&o!==void 0||ct(e,r)&&c===h)){let E=ge(X(w,r,y+1),h,v);S.push(E),e[r]=c}}}for(let E in e)typeof e[E]=="object"&&(w=X(w,E,y),En(e[E],t-1,r,n,i,o,a,f,s,u,c,h,p,d,l,b,w,S,v,y+1))}function to(){return{parent:null,key:null,children:[],depth:0}}function X(e,t,r){if(e.depth===r)return X(e.parent,t,r);var n={parent:e,key:t,depth:r,children:[]};return e.children.push(n),n}function ge(e,t,r){let n=e,i=[];do i.push(n.key),n=n.parent;while(n.parent!=null);return{path:i,value:t,target:r}}});var kn=x((Lu,Tn)=>{"use strict";var{groupRestore:ro,nestedRestore:no}=ut();Tn.exports=io;function io(){return function(){if(this.restore){this.restore.state.secret=this.secret;return}let{secret:t,wcLen:r}=this,n=Object.keys(t),i=so(t,n),o=r>0,a=o?{secret:t,groupRestore:ro,nestedRestore:no}:{secret:t};this.restore=Function("o",oo(i,n,o)).bind(a),this.restore.state=a}}function so(e,t){return t.map(r=>{let{circle:n,escPath:i,leadingBracket:o}=e[r],f=n?`o.${n} = secret[${i}].val`:`o${o?"":"."}${r} = secret[${i}].val`,s=`secret[${i}].val = undefined`;return`
|
|
59
|
-
if (secret[${i}].val !== undefined) {
|
|
60
|
-
try { ${f} } catch (e) {}
|
|
61
|
-
${s}
|
|
62
|
-
}
|
|
63
|
-
`}).join("")}function oo(e,t,r){return`
|
|
64
|
-
const secret = this.secret
|
|
65
|
-
${r===!0?`
|
|
66
|
-
const keys = Object.keys(secret)
|
|
67
|
-
const len = keys.length
|
|
68
|
-
for (var i = len - 1; i >= ${t.length}; i--) {
|
|
69
|
-
const k = keys[i]
|
|
70
|
-
const o = secret[k]
|
|
71
|
-
if (o) {
|
|
72
|
-
if (o.flat === true) this.groupRestore(o)
|
|
73
|
-
else this.nestedRestore(o)
|
|
74
|
-
secret[k] = null
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
`:""}
|
|
78
|
-
${e}
|
|
79
|
-
return o
|
|
80
|
-
`}});var An=x((qu,Mn)=>{"use strict";Mn.exports=ao;function ao(e){let{secret:t,censor:r,compileRestore:n,serialize:i,groupRedact:o,nestedRedact:a,wildcards:f,wcLen:s}=e,u=[{secret:t,censor:r,compileRestore:n}];return i!==!1&&u.push({serialize:i}),s>0&&u.push({groupRedact:o,nestedRedact:a,wildcards:f,wcLen:s}),Object.assign(...u)}});var Ln=x((Iu,jn)=>{"use strict";var Rn=yn(),lo=Sn(),co=On(),uo=kn(),{groupRedact:fo,nestedRedact:ho}=ut(),po=An(),go=Re(),mo=Rn(),ft=e=>e;ft.restore=ft;var yo="[REDACTED]";ht.rx=go;ht.validator=Rn;jn.exports=ht;function ht(e={}){let t=Array.from(new Set(e.paths||[])),r="serialize"in e&&(e.serialize===!1||typeof e.serialize=="function")?e.serialize:JSON.stringify,n=e.remove;if(n===!0&&r!==JSON.stringify)throw Error("fast-redact \u2013 remove option may only be set when serializer is JSON.stringify");let i=n===!0?void 0:"censor"in e?e.censor:yo,o=typeof i=="function",a=o&&i.length>1;if(t.length===0)return r||ft;mo({paths:t,serialize:r,censor:i});let{wildcards:f,wcLen:s,secret:u}=lo({paths:t,censor:i}),c=uo(),h="strict"in e?e.strict:!0;return co({secret:u,wcLen:s,serialize:r,strict:h,isCensorFct:o,censorFctTakesPath:a},po({secret:u,censor:i,compileRestore:c,serialize:r,groupRedact:fo,nestedRedact:ho,wildcards:f,wcLen:s}))}});var ce=x((Pu,qn)=>{"use strict";var bo=Symbol("pino.setLevel"),wo=Symbol("pino.getLevel"),So=Symbol("pino.levelVal"),vo=Symbol("pino.useLevelLabels"),Oo=Symbol("pino.useOnlyCustomLevels"),xo=Symbol("pino.mixin"),Eo=Symbol("pino.lsCache"),_o=Symbol("pino.chindings"),To=Symbol("pino.parsedChindings"),ko=Symbol("pino.asJson"),Mo=Symbol("pino.write"),Ao=Symbol("pino.redactFmt"),Ro=Symbol("pino.time"),jo=Symbol("pino.timeSliceIndex"),Lo=Symbol("pino.stream"),qo=Symbol("pino.stringify"),Io=Symbol("pino.stringifySafe"),Po=Symbol("pino.stringifiers"),Co=Symbol("pino.end"),$o=Symbol("pino.formatOpts"),Bo=Symbol("pino.messageKey"),Do=Symbol("pino.nestedKey"),zo=Symbol("pino.nestedKeyStr"),No=Symbol("pino.mixinMergeStrategy"),Fo=Symbol("pino.wildcardFirst"),Wo=Symbol.for("pino.serializers"),Ko=Symbol.for("pino.formatters"),Vo=Symbol.for("pino.hooks"),Uo=Symbol.for("pino.metadata");qn.exports={setLevelSym:bo,getLevelSym:wo,levelValSym:So,useLevelLabelsSym:vo,mixinSym:xo,lsCacheSym:Eo,chindingsSym:_o,parsedChindingsSym:To,asJsonSym:ko,writeSym:Mo,serializersSym:Wo,redactFmtSym:Ao,timeSym:Ro,timeSliceIndexSym:jo,streamSym:Lo,stringifySym:qo,stringifySafeSym:Io,stringifiersSym:Po,endSym:Co,formatOptsSym:$o,messageKeySym:Bo,nestedKeySym:Do,wildcardFirstSym:Fo,needsMetadataGsym:Uo,useOnlyCustomLevelsSym:Oo,formattersSym:Ko,hooksSym:Vo,nestedKeyStrSym:zo,mixinMergeStrategySym:No}});var gt=x((Cu,$n)=>{"use strict";var pt=Ln(),{redactFmtSym:Jo,wildcardFirstSym:je}=ce(),{rx:dt,validator:Ho}=pt,In=Ho({ERR_PATHS_MUST_BE_STRINGS:()=>"pino \u2013 redacted paths must be strings",ERR_INVALID_PATH:e=>`pino \u2013 redact paths array contains an invalid path (${e})`}),Pn="[Redacted]",Cn=!1;function Go(e,t){let{paths:r,censor:n}=Yo(e),i=r.reduce((f,s)=>{dt.lastIndex=0;let u=dt.exec(s),c=dt.exec(s),h=u[1]!==void 0?u[1].replace(/^(?:"|'|`)(.*)(?:"|'|`)$/,"$1"):u[0];if(h==="*"&&(h=je),c===null)return f[h]=null,f;if(f[h]===null)return f;let{index:p}=c,d=`${s.substr(p,s.length-1)}`;return f[h]=f[h]||[],h!==je&&f[h].length===0&&f[h].push(...f[je]||[]),h===je&&Object.keys(f).forEach(function(l){f[l]&&f[l].push(d)}),f[h].push(d),f},{}),o={[Jo]:pt({paths:r,censor:n,serialize:t,strict:Cn})},a=(...f)=>t(typeof n=="function"?n(...f):n);return[...Object.keys(i),...Object.getOwnPropertySymbols(i)].reduce((f,s)=>{if(i[s]===null)f[s]=u=>a(u,[s]);else{let u=typeof n=="function"?(c,h)=>n(c,[s,...h]):n;f[s]=pt({paths:i[s],censor:u,serialize:t,strict:Cn})}return f},o)}function Yo(e){if(Array.isArray(e))return e={paths:e,censor:Pn},In(e),e;let{paths:t,censor:r=Pn,remove:n}=e;if(Array.isArray(t)===!1)throw Error("pino \u2013 redact must contain an array of strings");return n===!0&&(r=void 0),In({paths:t,censor:r}),{paths:t,censor:r}}$n.exports=Go});var Dn=x(($u,Bn)=>{"use strict";var Xo=()=>"",Qo=()=>`,"time":${Date.now()}`,Zo=()=>`,"time":${Math.round(Date.now()/1e3)}`,ea=()=>`,"time":"${new Date(Date.now()).toISOString()}"`;Bn.exports={nullTime:Xo,epochTime:Qo,unixTime:Zo,isoTime:ea}});var Nn=x((Bu,zn)=>{"use strict";function ta(e){try{return JSON.stringify(e)}catch{return'"[Circular]"'}}zn.exports=ra;function ra(e,t,r){var n=r&&r.stringify||ta,i=1;if(typeof e=="object"&&e!==null){var o=t.length+i;if(o===1)return e;var a=new Array(o);a[0]=n(e);for(var f=1;f<o;f++)a[f]=n(t[f]);return a.join(" ")}if(typeof e!="string")return e;var s=t.length;if(s===0)return e;for(var u="",c=1-i,h=-1,p=e&&e.length||0,d=0;d<p;){if(e.charCodeAt(d)===37&&d+1<p){switch(h=h>-1?h:0,e.charCodeAt(d+1)){case 100:case 102:if(c>=s||t[c]==null)break;h<d&&(u+=e.slice(h,d)),u+=Number(t[c]),h=d+2,d++;break;case 105:if(c>=s||t[c]==null)break;h<d&&(u+=e.slice(h,d)),u+=Math.floor(Number(t[c])),h=d+2,d++;break;case 79:case 111:case 106:if(c>=s||t[c]===void 0)break;h<d&&(u+=e.slice(h,d));var l=typeof t[c];if(l==="string"){u+="'"+t[c]+"'",h=d+2,d++;break}if(l==="function"){u+=t[c].name||"<anonymous>",h=d+2,d++;break}u+=n(t[c]),h=d+2,d++;break;case 115:if(c>=s)break;h<d&&(u+=e.slice(h,d)),u+=String(t[c]),h=d+2,d++;break;case 37:h<d&&(u+=e.slice(h,d)),u+="%",h=d+2,d++,c--;break}++c}++d}return h===-1?e:(h<p&&(u+=e.slice(h)),u)}});var yt=x((Du,mt)=>{"use strict";if(typeof SharedArrayBuffer<"u"&&typeof Atomics<"u"){let t=function(r){if((r>0&&r<1/0)===!1)throw typeof r!="number"&&typeof r!="bigint"?TypeError("sleep: ms must be a number"):RangeError("sleep: ms must be a number that is greater than 0 but less than Infinity");Atomics.wait(e,0,0,Number(r))},e=new Int32Array(new SharedArrayBuffer(4));mt.exports=t}else{let e=function(t){if((t>0&&t<1/0)===!1)throw typeof t!="number"&&typeof t!="bigint"?TypeError("sleep: ms must be a number"):RangeError("sleep: ms must be a number that is greater than 0 but less than Infinity");let n=Date.now()+Number(t);for(;n>Date.now(););};mt.exports=e}});var Un=x((zu,Vn)=>{"use strict";var K=require("fs"),na=require("events"),ia=require("util").inherits,Fn=require("path"),Wn=yt(),bt=100,sa=16*1024;function Kn(e,t){t._opening=!0,t._writing=!0,t._asyncDrainScheduled=!1;function r(o,a){if(o){t._reopening=!1,t._writing=!1,t._opening=!1,t.sync?process.nextTick(()=>{t.listenerCount("error")>0&&t.emit("error",o)}):t.emit("error",o);return}t.fd=a,t.file=e,t._reopening=!1,t._opening=!1,t._writing=!1,t.sync?process.nextTick(()=>t.emit("ready")):t.emit("ready"),!t._reopening&&!t._writing&&t._len>t.minLength&&!t.destroyed&&ue(t)}let n=t.append?"a":"w",i=t.mode;if(t.sync)try{t.mkdir&&K.mkdirSync(Fn.dirname(e),{recursive:!0});let o=K.openSync(e,n,i);r(null,o)}catch(o){throw r(o),o}else t.mkdir?K.mkdir(Fn.dirname(e),{recursive:!0},o=>{if(o)return r(o);K.open(e,n,i,r)}):K.open(e,n,i,r)}function z(e){if(!(this instanceof z))return new z(e);let{fd:t,dest:r,minLength:n,maxLength:i,maxWrite:o,sync:a,append:f=!0,mode:s,mkdir:u,retryEAGAIN:c}=e||{};if(t=t||r,this._bufs=[],this._len=0,this.fd=-1,this._writing=!1,this._writingBuf="",this._ending=!1,this._reopening=!1,this._asyncDrainScheduled=!1,this._hwm=Math.max(n||0,16387),this.file=null,this.destroyed=!1,this.minLength=n||0,this.maxLength=i||0,this.maxWrite=o||sa,this.sync=a||!1,this.append=f||!1,this.mode=s,this.retryEAGAIN=c||(()=>!0),this.mkdir=u||!1,typeof t=="number")this.fd=t,process.nextTick(()=>this.emit("ready"));else if(typeof t=="string")Kn(t,this);else throw new Error("SonicBoom supports only file descriptors and files");if(this.minLength>=this.maxWrite)throw new Error(`minLength should be smaller than maxWrite (${this.maxWrite})`);this.release=(h,p)=>{if(h){if(h.code==="EAGAIN"&&this.retryEAGAIN(h,this._writingBuf.length,this._len-this._writingBuf.length))if(this.sync)try{Wn(bt),this.release(void 0,0)}catch(l){this.release(l)}else setTimeout(()=>{K.write(this.fd,this._writingBuf,"utf8",this.release)},bt);else this._writing=!1,this.emit("error",h);return}if(this.emit("write",p),this._len-=p,this._writingBuf=this._writingBuf.slice(p),this._writingBuf.length){if(!this.sync){K.write(this.fd,this._writingBuf,"utf8",this.release);return}try{do{let l=K.writeSync(this.fd,this._writingBuf,"utf8");this._len-=l,this._writingBuf=this._writingBuf.slice(l)}while(this._writingBuf)}catch(l){this.release(l);return}}let d=this._len;this._reopening?(this._writing=!1,this._reopening=!1,this.reopen()):d>this.minLength?ue(this):this._ending?d>0?ue(this):(this._writing=!1,Le(this)):(this._writing=!1,this.sync?this._asyncDrainScheduled||(this._asyncDrainScheduled=!0,process.nextTick(oa,this)):this.emit("drain"))},this.on("newListener",function(h){h==="drain"&&(this._asyncDrainScheduled=!1)})}function oa(e){e.listenerCount("drain")>0&&(e._asyncDrainScheduled=!1,e.emit("drain"))}ia(z,na);z.prototype.write=function(e){if(this.destroyed)throw new Error("SonicBoom destroyed");let t=this._len+e.length,r=this._bufs;return this.maxLength&&t>this.maxLength?(this.emit("drop",e),this._len<this._hwm):(r.length===0||r[r.length-1].length+e.length>this.maxWrite?r.push(""+e):r[r.length-1]+=e,this._len=t,!this._writing&&this._len>=this.minLength&&ue(this),this._len<this._hwm)};z.prototype.flush=function(){if(this.destroyed)throw new Error("SonicBoom destroyed");this._writing||this.minLength<=0||(this._bufs.length===0&&this._bufs.push(""),ue(this))};z.prototype.reopen=function(e){if(this.destroyed)throw new Error("SonicBoom destroyed");if(this._opening){this.once("ready",()=>{this.reopen(e)});return}if(this._ending)return;if(!this.file)throw new Error("Unable to reopen a file descriptor, you must pass a file to SonicBoom");if(this._reopening=!0,this._writing)return;let t=this.fd;this.once("ready",()=>{t!==this.fd&&K.close(t,r=>{if(r)return this.emit("error",r)})}),Kn(e||this.file,this)};z.prototype.end=function(){if(this.destroyed)throw new Error("SonicBoom destroyed");if(this._opening){this.once("ready",()=>{this.end()});return}this._ending||(this._ending=!0,!this._writing&&(this._len>0&&this.fd>=0?ue(this):Le(this)))};z.prototype.flushSync=function(){if(this.destroyed)throw new Error("SonicBoom destroyed");if(this.fd<0)throw new Error("sonic boom is not ready yet");for(!this._writing&&this._writingBuf.length>0&&(this._bufs.unshift(this._writingBuf),this._writingBuf="");this._bufs.length;){let e=this._bufs[0];try{this._len-=K.writeSync(this.fd,e,"utf8"),this._bufs.shift()}catch(t){if(t.code!=="EAGAIN"||!this.retryEAGAIN(t,e.length,this._len-e.length))throw t;Wn(bt)}}};z.prototype.destroy=function(){this.destroyed||Le(this)};function ue(e){let t=e.release;if(e._writing=!0,e._writingBuf=e._writingBuf||e._bufs.shift()||"",e.sync)try{let r=K.writeSync(e.fd,e._writingBuf,"utf8");t(null,r)}catch(r){t(r)}else K.write(e.fd,e._writingBuf,"utf8",t)}function Le(e){if(e.fd===-1){e.once("ready",Le.bind(null,e));return}e.destroyed=!0,e._bufs=[],e.fd!==1&&e.fd!==2?K.close(e.fd,t):setImmediate(t);function t(r){if(r){e.emit("error",r);return}e._ending&&!e._writing&&e.emit("finish"),e.emit("close")}}z.SonicBoom=z;z.default=z;Vn.exports=z});var Hn=x((Nu,Jn)=>{"use strict";var{format:wt}=require("util");function aa(){let e={},t=new Map;function r(i,o,a){if(!i)throw new Error("Warning name must not be empty");if(!o)throw new Error("Warning code must not be empty");if(!a)throw new Error("Warning message must not be empty");if(o=o.toUpperCase(),e[o]!==void 0)throw new Error(`The code '${o}' already exist`);function f(s,u,c){let h;return s&&u&&c?h=wt(a,s,u,c):s&&u?h=wt(a,s,u):s?h=wt(a,s):h=a,{code:o,name:i,message:h}}return t.set(o,!1),e[o]=f,e[o]}function n(i,o,a,f){if(e[i]===void 0)throw new Error(`The code '${i}' does not exist`);if(t.get(i)===!0)return;t.set(i,!0);let s=e[i](o,a,f);process.emitWarning(s.message,s.name,s.code)}return{create:r,emit:n,emitted:t}}Jn.exports=aa});var Xn=x((Fu,Yn)=>{"use strict";var St=Hn()();Yn.exports=St;var Gn="PinoWarning";St.create(Gn,"PINODEP008","prettyPrint is deprecated, look at https://github.com/pinojs/pino-pretty for alternatives.");St.create(Gn,"PINODEP009","The use of pino.final is discouraged in Node.js v14+ and not required. It will be removed in the next major version")});var Ot=x((Wu,ti)=>{"use strict";function Qn(e,t,r,n){function i(){let o=t.deref();o!==void 0&&r(o,n)}e[n]=i,process.once(n,i)}var Zn=new FinalizationRegistry(ei),vt=new WeakMap;function ei(e){process.removeListener("exit",e.exit),process.removeListener("beforeExit",e.beforeExit)}function la(e,t){if(e===void 0)throw new Error("the object can't be undefined");let r=new WeakRef(e),n={};vt.set(e,n),Zn.register(e,n),Qn(n,r,t,"exit"),Qn(n,r,t,"beforeExit")}function ca(e){let t=vt.get(e);vt.delete(e),t&&ei(t),Zn.unregister(e)}ti.exports={register:la,unregister:ca}});var ni=x((Ku,ri)=>{"use strict";function ua(e,t,r,n,i){let o=Date.now()+n,a=Atomics.load(e,t);if(a===r){i(null,"ok");return}let f=a,s=u=>{Date.now()>o?i(null,"timed-out"):setTimeout(()=>{f=a,a=Atomics.load(e,t),a===f?s(u>=1e3?1e3:u*2):a===r?i(null,"ok"):i(null,"not-equal")},u)};s(1)}function fa(e,t,r,n,i){let o=Date.now()+n,a=Atomics.load(e,t);if(a!==r){i(null,"ok");return}let f=s=>{Date.now()>o?i(null,"timed-out"):setTimeout(()=>{a=Atomics.load(e,t),a!==r?i(null,"ok"):f(s>=1e3?1e3:s*2)},s)};f(1)}ri.exports={wait:ua,waitDiff:fa}});var si=x((Vu,ii)=>{"use strict";ii.exports={WRITE_INDEX:4,READ_INDEX:8}});var ui=x((Ju,ci)=>{"use strict";var{EventEmitter:ha}=require("events"),{Worker:da}=require("worker_threads"),{join:pa}=require("path"),{pathToFileURL:ga}=require("url"),{wait:ma}=ni(),{WRITE_INDEX:N,READ_INDEX:G}=si(),ya=require("buffer"),ba=require("assert"),g=Symbol("kImpl"),wa=ya.constants.MAX_STRING_LENGTH,Ie=class{constructor(t){this._value=t}deref(){return this._value}},Sa=global.FinalizationRegistry||class{register(){}unregister(){}},va=global.WeakRef||Ie,oi=new Sa(e=>{e.exited||e.terminate()});function Oa(e,t){let{filename:r,workerData:n}=t,o=("__bundlerPathsOverrides"in globalThis?globalThis.__bundlerPathsOverrides:{})["thread-stream-worker"]||pa(__dirname,"lib","worker.js"),a=new da(o,{...t.workerOpts,workerData:{filename:r.indexOf("file://")===0?r:ga(r).href,dataBuf:e[g].dataBuf,stateBuf:e[g].stateBuf,workerData:n}});return a.stream=new Ie(e),a.on("message",xa),a.on("exit",li),oi.register(e,a),a}function ai(e){ba(!e[g].sync),e[g].needDrain&&(e[g].needDrain=!1,e.emit("drain"))}function qe(e){let t=Atomics.load(e[g].state,N),r=e[g].data.length-t;if(r>0){if(e[g].buf.length===0){e[g].flushing=!1,e[g].ending?Tt(e):e[g].needDrain&&process.nextTick(ai,e);return}let n=e[g].buf.slice(0,r),i=Buffer.byteLength(n);i<=r?(e[g].buf=e[g].buf.slice(r),Pe(e,n,qe.bind(null,e))):e.flush(()=>{if(!e.destroyed){for(Atomics.store(e[g].state,G,0),Atomics.store(e[g].state,N,0);i>e[g].data.length;)r=r/2,n=e[g].buf.slice(0,r),i=Buffer.byteLength(n);e[g].buf=e[g].buf.slice(r),Pe(e,n,qe.bind(null,e))}})}else if(r===0){if(t===0&&e[g].buf.length===0)return;e.flush(()=>{Atomics.store(e[g].state,G,0),Atomics.store(e[g].state,N,0),qe(e)})}else throw new Error("overwritten")}function xa(e){let t=this.stream.deref();if(t===void 0){this.exited=!0,this.terminate();return}switch(e.code){case"READY":this.stream=new va(t),t.flush(()=>{t[g].ready=!0,t.emit("ready")});break;case"ERROR":fe(t,e.err);break;default:throw new Error("this should not happen: "+e.code)}}function li(e){let t=this.stream.deref();t!==void 0&&(oi.unregister(t),t.worker.exited=!0,t.worker.off("exit",li),fe(t,e!==0?new Error("The worker thread exited"):null))}var Et=class extends ha{constructor(t={}){if(super(),t.bufferSize<4)throw new Error("bufferSize must at least fit a 4-byte utf-8 char");this[g]={},this[g].stateBuf=new SharedArrayBuffer(128),this[g].state=new Int32Array(this[g].stateBuf),this[g].dataBuf=new SharedArrayBuffer(t.bufferSize||4*1024*1024),this[g].data=Buffer.from(this[g].dataBuf),this[g].sync=t.sync||!1,this[g].ending=!1,this[g].ended=!1,this[g].needDrain=!1,this[g].destroyed=!1,this[g].flushing=!1,this[g].ready=!1,this[g].finished=!1,this[g].errored=null,this[g].closed=!1,this[g].buf="",this.worker=Oa(this,t)}write(t){if(this[g].destroyed)throw new Error("the worker has exited");if(this[g].ending)throw new Error("the worker is ending");if(this[g].flushing&&this[g].buf.length+t.length>=wa)try{xt(this),this[g].flushing=!0}catch(r){return fe(this,r),!1}if(this[g].buf+=t,this[g].sync)try{return xt(this),!0}catch(r){return fe(this,r),!1}return this[g].flushing||(this[g].flushing=!0,setImmediate(qe,this)),this[g].needDrain=this[g].data.length-this[g].buf.length-Atomics.load(this[g].state,N)<=0,!this[g].needDrain}end(){this[g].destroyed||(this[g].ending=!0,Tt(this))}flush(t){if(this[g].destroyed){typeof t=="function"&&process.nextTick(t,new Error("the worker has exited"));return}let r=Atomics.load(this[g].state,N);ma(this[g].state,G,r,1/0,(n,i)=>{if(n){fe(this,n),process.nextTick(t,n);return}if(i==="not-equal"){this.flush(t);return}process.nextTick(t)})}flushSync(){this[g].destroyed||(xt(this),_t(this))}unref(){this.worker.unref()}ref(){this.worker.ref()}get ready(){return this[g].ready}get destroyed(){return this[g].destroyed}get closed(){return this[g].closed}get writable(){return!this[g].destroyed&&!this[g].ending}get writableEnded(){return this[g].ending}get writableFinished(){return this[g].finished}get writableNeedDrain(){return this[g].needDrain}get writableObjectMode(){return!1}get writableErrored(){return this[g].errored}};function fe(e,t){e[g].destroyed||(e[g].destroyed=!0,t&&(e[g].errored=t,e.emit("error",t)),e.worker.exited?setImmediate(()=>{e[g].closed=!0,e.emit("close")}):e.worker.terminate().catch(()=>{}).then(()=>{e[g].closed=!0,e.emit("close")}))}function Pe(e,t,r){let n=Atomics.load(e[g].state,N),i=Buffer.byteLength(t);return e[g].data.write(t,n),Atomics.store(e[g].state,N,n+i),Atomics.notify(e[g].state,N),r(),!0}function Tt(e){if(!(e[g].ended||!e[g].ending||e[g].flushing)){e[g].ended=!0;try{e.flushSync();let t=Atomics.load(e[g].state,G);Atomics.store(e[g].state,N,-1),Atomics.notify(e[g].state,N);let r=0;for(;t!==-1;){if(Atomics.wait(e[g].state,G,t,1e3),t=Atomics.load(e[g].state,G),t===-2)throw new Error("end() failed");if(++r===10)throw new Error("end() took too long (10s)")}process.nextTick(()=>{e[g].finished=!0,e.emit("finish")})}catch(t){fe(e,t)}}}function xt(e){let t=()=>{e[g].ending?Tt(e):e[g].needDrain&&process.nextTick(ai,e)};for(e[g].flushing=!1;e[g].buf.length!==0;){let r=Atomics.load(e[g].state,N),n=e[g].data.length-r;if(n===0){_t(e),Atomics.store(e[g].state,G,0),Atomics.store(e[g].state,N,0);continue}else if(n<0)throw new Error("overwritten");let i=e[g].buf.slice(0,n),o=Buffer.byteLength(i);if(o<=n)e[g].buf=e[g].buf.slice(n),Pe(e,i,t);else{for(_t(e),Atomics.store(e[g].state,G,0),Atomics.store(e[g].state,N,0);o>e[g].buf.length;)n=n/2,i=e[g].buf.slice(0,n),o=Buffer.byteLength(i);e[g].buf=e[g].buf.slice(n),Pe(e,i,t)}}}function _t(e){if(e[g].flushing)throw new Error("unable to flush while flushing");let t=Atomics.load(e[g].state,N),r=0;for(;;){let n=Atomics.load(e[g].state,G);if(n===-2)throw new Error("_flushSync failed");if(n!==t)Atomics.wait(e[g].state,G,n,1e3);else break;if(++r===10)throw new Error("_flushSync took too long (10s)")}}ci.exports=Et});var Mt=x((Hu,hi)=>{"use strict";var{createRequire:Ea}=require("module"),_a=lt(),{join:kt,isAbsolute:Ta}=require("path"),ka=yt(),Ce;global.WeakRef&&global.WeakMap&&global.FinalizationRegistry&&(Ce=Ot());var Ma=ui();function Aa(e){if(Ce)Ce.register(e,fi),e.on("close",function(){Ce.unregister(e)});else{let t=fi.bind(null,e);process.once("beforeExit",t),process.once("exit",t),e.on("close",function(){process.removeListener("beforeExit",t),process.removeListener("exit",t)})}}function Ra(e,t,r){let n=new Ma({filename:e,workerData:t,workerOpts:r});n.on("ready",i),n.on("close",function(){process.removeListener("exit",o)}),process.on("exit",o);function i(){process.removeListener("exit",o),n.unref(),r.autoEnd!==!1&&Aa(n)}function o(){n.closed||(n.flushSync(),ka(100),n.end())}return n}function fi(e){e.ref(),e.flushSync(),e.end(),e.once("close",function(){e.unref()})}function ja(e){let{pipeline:t,targets:r,levels:n,options:i={},worker:o={},caller:a=_a()}=e,f=typeof a=="string"?[a]:a,s="__bundlerPathsOverrides"in globalThis?globalThis.__bundlerPathsOverrides:{},u=e.target;if(u&&r)throw new Error("only one of target or targets can be specified");return r?(u=s["pino-worker"]||kt(__dirname,"worker.js"),i.targets=r.map(h=>({...h,target:c(h.target)}))):t&&(u=s["pino-pipeline-worker"]||kt(__dirname,"worker-pipeline.js"),i.targets=t.map(h=>({...h,target:c(h.target)}))),n&&(i.levels=n),Ra(c(u),i,o);function c(h){if(h=s[h]||h,Ta(h)||h.indexOf("file://")===0)return h;if(h==="pino/file")return kt(__dirname,"..","file.js");let p;for(let d of f)try{p=Ea(d).resolve(h);break}catch{continue}if(!p)throw new Error(`unable to determine transport target for "${h}"`);return p}}hi.exports=ja});var Be=x((Gu,Ei)=>{"use strict";var di=Nn(),{mapHttpRequest:La,mapHttpResponse:qa}=at(),jt=Un(),bi=Xn(),{lsCacheSym:Ia,chindingsSym:Lt,parsedChindingsSym:At,writeSym:pi,serializersSym:qt,formatOptsSym:gi,endSym:Pa,stringifiersSym:It,stringifySym:wi,stringifySafeSym:Pt,wildcardFirstSym:Si,needsMetadataGsym:vi,redactFmtSym:Ca,streamSym:$a,nestedKeySym:Ba,formattersSym:Ct,messageKeySym:Oi,nestedKeyStrSym:Da}=ce(),{isMainThread:za}=require("worker_threads"),Na=Mt();function me(){}function Fa(e,t){if(!t)return r;return function(...i){t.call(this,i,r,e)};function r(n,...i){if(typeof n=="object"){let o=n;n!==null&&(n.method&&n.headers&&n.socket?n=La(n):typeof n.setHeader=="function"&&(n=qa(n)));let a;o===null&&i.length===0?a=[null]:(o=i.shift(),a=i),this[pi](n,di(o,a,this[gi]),e)}else this[pi](null,di(n,i,this[gi]),e)}}function mi(e){let t="",r=0,n=!1,i=255,o=e.length;if(o>100)return JSON.stringify(e);for(var a=0;a<o&&i>=32;a++)i=e.charCodeAt(a),(i===34||i===92)&&(t+=e.slice(r,a)+"\\",r=a,n=!0);return n?t+=e.slice(r):t=e,i<32?JSON.stringify(e):'"'+t+'"'}function Wa(e,t,r,n){let i=this[wi],o=this[Pt],a=this[It],f=this[Pa],s=this[Lt],u=this[qt],c=this[Ct],h=this[Oi],p=this[Ia][r]+n;p=p+s;let d;c.log&&(e=c.log(e));let l=a[Si],b="";for(let S in e)if(d=e[S],Object.prototype.hasOwnProperty.call(e,S)&&d!==void 0){d=u[S]?u[S](d):d;let v=a[S]||l;switch(typeof d){case"undefined":case"function":continue;case"number":Number.isFinite(d)===!1&&(d=null);case"boolean":v&&(d=v(d));break;case"string":d=(v||mi)(d);break;default:d=(v||i)(d,o)}if(d===void 0)continue;b+=',"'+S+'":'+d}let w="";if(t!==void 0){d=u[h]?u[h](t):t;let S=a[h]||l;switch(typeof d){case"function":break;case"number":Number.isFinite(d)===!1&&(d=null);case"boolean":S&&(d=S(d)),w=',"'+h+'":'+d;break;case"string":d=(S||mi)(d),w=',"'+h+'":'+d;break;default:d=(S||i)(d,o),w=',"'+h+'":'+d}}return this[Ba]&&b?p+this[Da]+b.slice(1)+"}"+w+f:p+b+w+f}function Ka(e,t){let r,n=e[Lt],i=e[wi],o=e[Pt],a=e[It],f=a[Si],s=e[qt],u=e[Ct].bindings;t=u(t);for(let c in t)if(r=t[c],(c!=="level"&&c!=="serializers"&&c!=="formatters"&&c!=="customLevels"&&t.hasOwnProperty(c)&&r!==void 0)===!0){if(r=s[c]?s[c](r):r,r=(a[c]||f||i)(r,o),r===void 0)continue;n+=',"'+c+'":'+r}return n}function xi(e,t,r,n){if(t&&typeof t=="function")return t=t.bind(n),Rt(t(e),r,e);try{let i=require("pino-pretty").prettyFactory;return i.asMetaWrapper=Rt,Rt(i(e),r,e)}catch(i){throw i.message.startsWith("Cannot find module 'pino-pretty'")?Error("Missing `pino-pretty` module: `pino-pretty` must be installed separately"):i}}function Rt(e,t,r){r=Object.assign({suppressFlushSyncWarning:!1},r);let n=!1;return{[vi]:!0,lastLevel:0,lastMsg:null,lastObj:null,lastLogger:null,flushSync(){r.suppressFlushSyncWarning||n||(n=!0,yi(t,this),t.write(e(Object.assign({level:40,msg:"pino.final with prettyPrint does not support flushing",time:Date.now()},this.chindings()))))},chindings(){let i=this.lastLogger,o=null;return i?(i.hasOwnProperty(At)?o=i[At]:(o=JSON.parse("{"+i[Lt].substr(1)+"}"),i[At]=o),o):null},write(i){let o=this.lastLogger,a=this.chindings(),f=this.lastTime;typeof f=="number"||(f.match(/^\d+/)?f=parseInt(f):f=f.slice(1,-1));let s=this.lastObj,u=this.lastMsg,c=null,h=o[Ct],p=h.log?h.log(s):s,d=o[Oi];u&&p&&!Object.prototype.hasOwnProperty.call(p,d)&&(p[d]=u);let l=Object.assign({level:this.lastLevel,time:f},p,c),b=o[qt],w=Object.keys(b);for(var S=0;S<w.length;S++){let O=w[S];l[O]!==void 0&&(l[O]=b[O](l[O]))}for(let O in a)l.hasOwnProperty(O)||(l[O]=a[O]);let y=o[It][Ca],E=e(typeof y=="function"?y(l):l);E!==void 0&&(yi(t,this),t.write(E))}}}function Va(e){return e.write!==e.constructor.prototype.write}function $e(e){let t=new jt(e);return t.on("error",r),!e.sync&&za&&Ua(t),t;function r(n){if(n.code==="EPIPE"){t.write=me,t.end=me,t.flushSync=me,t.destroy=me;return}t.removeListener("error",r),t.emit("error",n)}}function Ua(e){if(global.WeakRef&&global.WeakMap&&global.FinalizationRegistry){let t=Ot();t.register(e,Ja),e.on("close",function(){t.unregister(e)})}}function Ja(e,t){e.destroyed||(t==="beforeExit"?(e.flush(),e.on("drain",function(){e.end()})):e.flushSync())}function Ha(e){return function(r,n,i={},o){if(typeof i=="string")o=$e({dest:i,sync:!0}),i={};else if(typeof o=="string"){if(i&&i.transport)throw Error("only one of option.transport or stream can be specified");o=$e({dest:o,sync:!0})}else if(i instanceof jt||i.writable||i._writableState)o=i,i={};else if(i.transport){if(i.transport instanceof jt||i.transport.writable||i.transport._writableState)throw Error("option.transport do not allow stream, please pass to option directly. e.g. pino(transport)");if(i.transport.targets&&i.transport.targets.length&&i.formatters&&typeof i.formatters.level=="function")throw Error("option.transport.targets do not allow custom level formatters");let c;i.customLevels&&(c=i.useOnlyCustomLevels?i.customLevels:Object.assign({},i.levels,i.customLevels)),o=Na({caller:n,...i.transport,levels:c})}if(i=Object.assign({},e,i),i.serializers=Object.assign({},e.serializers,i.serializers),i.formatters=Object.assign({},e.formatters,i.formatters),"onTerminated"in i)throw Error("The onTerminated option has been removed, use pino.final instead");"changeLevelName"in i&&(process.emitWarning("The changeLevelName option is deprecated and will be removed in v7. Use levelKey instead.",{code:"changeLevelName_deprecation"}),i.levelKey=i.changeLevelName,delete i.changeLevelName);let{enabled:a,prettyPrint:f,prettifier:s,messageKey:u}=i;if(a===!1&&(i.level="silent"),o=o||process.stdout,o===process.stdout&&o.fd>=0&&!Va(o)&&(o=$e({fd:o.fd,sync:!0})),f){bi.emit("PINODEP008");let c=Object.assign({messageKey:u},f);o=xi(c,s,o,r)}return{opts:i,stream:o}}}function Ga(e,t){if(Number(process.versions.node.split(".")[0])>=14&&bi.emit("PINODEP009"),typeof e>"u"||typeof e.child!="function")throw Error("expected a pino logger instance");let n=typeof t<"u";if(n&&typeof t!="function")throw Error("if supplied, the handler parameter should be a function");let i=e[$a];if(typeof i.flushSync!="function")throw Error("final requires a stream that has a flushSync method, such as pino.destination");let o=new Proxy(e,{get:(a,f)=>f in a.levels.values?(...s)=>{a[f](...s),i.flushSync()}:a[f]});if(!n){try{i.flushSync()}catch{}return o}return(a=null,...f)=>{try{i.flushSync()}catch{}return t(a,o,...f)}}function Ya(e,t){try{return JSON.stringify(e)}catch{try{return(t||this[Pt])(e)}catch{return'"[unable to serialize, circular reference is too complex to analyze]"'}}}function Xa(e,t,r){return{level:e,bindings:t,log:r}}function yi(e,t){e[vi]===!0&&(e.lastLevel=t.lastLevel,e.lastMsg=t.lastMsg,e.lastObj=t.lastObj,e.lastTime=t.lastTime,e.lastLogger=t.lastLogger)}function Qa(e){let t=Number(e);return typeof e=="string"&&Number.isFinite(t)?t:e}Ei.exports={noop:me,buildSafeSonicBoom:$e,getPrettyStream:xi,asChindings:Ka,asJson:Wa,genLog:Fa,createArgsNormalizer:Ha,final:Ga,stringify:Ya,buildFormatters:Xa,normalizeDestFileDescriptor:Qa}});var De=x((Yu,Ti)=>{"use strict";var{lsCacheSym:Za,levelValSym:$t,useOnlyCustomLevelsSym:el,streamSym:tl,formattersSym:rl,hooksSym:nl}=ce(),{noop:il,genLog:se}=Be(),H={trace:10,debug:20,info:30,warn:40,error:50,fatal:60},_i={fatal:e=>{let t=se(H.fatal,e);return function(...r){let n=this[tl];if(t.call(this,...r),typeof n.flushSync=="function")try{n.flushSync()}catch{}}},error:e=>se(H.error,e),warn:e=>se(H.warn,e),info:e=>se(H.info,e),debug:e=>se(H.debug,e),trace:e=>se(H.trace,e)},Bt=Object.keys(H).reduce((e,t)=>(e[H[t]]=t,e),{}),sl=Object.keys(Bt).reduce((e,t)=>(e[t]='{"level":'+Number(t),e),{});function ol(e){let t=e[rl].level,{labels:r}=e.levels,n={};for(let i in r){let o=t(r[i],Number(i));n[i]=JSON.stringify(o).slice(0,-1)}return e[Za]=n,e}function al(e,t){if(t)return!1;switch(e){case"fatal":case"error":case"warn":case"info":case"debug":case"trace":return!0;default:return!1}}function ll(e){let{labels:t,values:r}=this.levels;if(typeof e=="number"){if(t[e]===void 0)throw Error("unknown level value"+e);e=t[e]}if(r[e]===void 0)throw Error("unknown level "+e);let n=this[$t],i=this[$t]=r[e],o=this[el],a=this[nl].logMethod;for(let f in r){if(i>r[f]){this[f]=il;continue}this[f]=al(f,o)?_i[f](a):se(r[f],a)}this.emit("level-change",e,i,t[n],n)}function cl(e){let{levels:t,levelVal:r}=this;return t&&t.labels?t.labels[r]:""}function ul(e){let{values:t}=this.levels,r=t[e];return r!==void 0&&r>=this[$t]}function fl(e=null,t=!1){let r=e?Object.keys(e).reduce((o,a)=>(o[e[a]]=a,o),{}):null,n=Object.assign(Object.create(Object.prototype,{Infinity:{value:"silent"}}),t?null:Bt,r),i=Object.assign(Object.create(Object.prototype,{silent:{value:1/0}}),t?null:H,e);return{labels:n,values:i}}function hl(e,t,r){if(typeof e=="number"){if(![].concat(Object.keys(t||{}).map(o=>t[o]),r?[]:Object.keys(Bt).map(o=>+o),1/0).includes(e))throw Error(`default level:${e} must be included in custom levels`);return}let n=Object.assign(Object.create(Object.prototype,{silent:{value:1/0}}),r?null:H,t);if(!(e in n))throw Error(`default level:${e} must be included in custom levels`)}function dl(e,t){let{labels:r,values:n}=e;for(let i in t){if(i in n)throw Error("levels cannot be overridden");if(t[i]in r)throw Error("pre-existing level values cannot be used for new levels")}}Ti.exports={initialLsCache:sl,genLsCache:ol,levelMethods:_i,getLevel:cl,setLevel:ll,isLevelEnabled:ul,mappings:fl,levels:H,assertNoLevelCollisions:dl,assertDefaultLevelFound:hl}});var ki=x((Xu,pl)=>{pl.exports={name:"pino",version:"7.11.0",description:"super fast, all natural json logger",main:"pino.js",type:"commonjs",types:"pino.d.ts",browser:"./browser.js",files:["pino.js","file.js","pino.d.ts","bin.js","browser.js","pretty.js","usage.txt","test","docs","example.js","lib"],scripts:{docs:"docsify serve","browser-test":"airtap --local 8080 test/browser*test.js",lint:"eslint .",test:"npm run lint && npm run transpile && tap --ts && jest test/jest && npm run test-types","test-ci":"npm run lint && npm run transpile && tap --ts --no-check-coverage --coverage-report=lcovonly && npm run test-types","test-ci-pnpm":"pnpm run lint && npm run transpile && tap --ts --no-coverage --no-check-coverage && pnpm run test-types","test-ci-yarn-pnp":"yarn run lint && npm run transpile && tap --ts --no-check-coverage --coverage-report=lcovonly","test-types":"tsc && tsd && ts-node test/types/pino.ts",transpile:"node ./test/fixtures/ts/transpile.cjs","cov-ui":"tap --ts --coverage-report=html",bench:"node benchmarks/utils/runbench all","bench-basic":"node benchmarks/utils/runbench basic","bench-object":"node benchmarks/utils/runbench object","bench-deep-object":"node benchmarks/utils/runbench deep-object","bench-multi-arg":"node benchmarks/utils/runbench multi-arg","bench-longs-tring":"node benchmarks/utils/runbench long-string","bench-child":"node benchmarks/utils/runbench child","bench-child-child":"node benchmarks/utils/runbench child-child","bench-child-creation":"node benchmarks/utils/runbench child-creation","bench-formatters":"node benchmarks/utils/runbench formatters","update-bench-doc":"node benchmarks/utils/generate-benchmark-doc > docs/benchmarks.md"},bin:{pino:"./bin.js"},precommit:"test",repository:{type:"git",url:"git+https://github.com/pinojs/pino.git"},keywords:["fast","logger","stream","json"],author:"Matteo Collina <hello@matteocollina.com>",contributors:["David Mark Clements <huperekchuno@googlemail.com>","James Sumners <james.sumners@gmail.com>","Thomas Watson Steen <w@tson.dk> (https://twitter.com/wa7son)"],license:"MIT",bugs:{url:"https://github.com/pinojs/pino/issues"},homepage:"http://getpino.io",devDependencies:{"@types/flush-write-stream":"^1.0.0","@types/node":"^17.0.0","@types/tap":"^15.0.6",airtap:"4.0.4",benchmark:"^2.1.4",bole:"^4.0.0",bunyan:"^1.8.14","docsify-cli":"^4.4.1",eslint:"^7.17.0","eslint-config-standard":"^16.0.3","eslint-plugin-import":"^2.22.1","eslint-plugin-node":"^11.1.0","eslint-plugin-promise":"^5.1.0",execa:"^5.0.0",fastbench:"^1.0.1","flush-write-stream":"^2.0.0","import-fresh":"^3.2.1",jest:"^27.3.1",log:"^6.0.0",loglevel:"^1.6.7","pino-pretty":"^v7.6.0","pre-commit":"^1.2.2",proxyquire:"^2.1.3",pump:"^3.0.0",rimraf:"^3.0.2",semver:"^7.0.0",split2:"^4.0.0",steed:"^1.1.3","strip-ansi":"^6.0.0",tap:"^16.0.0",tape:"^5.0.0",through2:"^4.0.0","ts-node":"^10.7.0",tsd:"^0.20.0",typescript:"^4.4.4",winston:"^3.3.3"},dependencies:{"atomic-sleep":"^1.0.0","fast-redact":"^3.0.0","on-exit-leak-free":"^0.2.0","pino-abstract-transport":"v0.5.0","pino-std-serializers":"^4.0.0","process-warning":"^1.0.0","quick-format-unescaped":"^4.0.3","real-require":"^0.1.0","safe-stable-stringify":"^2.1.0","sonic-boom":"^2.2.1","thread-stream":"^0.15.1"},tsd:{directory:"test/types"}}});var Dt=x((Qu,Mi)=>{"use strict";var{version:gl}=ki();Mi.exports={version:gl}});var Bi=x((ef,$i)=>{"use strict";var{EventEmitter:ml}=require("events"),{lsCacheSym:yl,levelValSym:bl,setLevelSym:Nt,getLevelSym:Ai,chindingsSym:Ft,parsedChindingsSym:wl,mixinSym:Sl,asJsonSym:qi,writeSym:vl,mixinMergeStrategySym:Ol,timeSym:xl,timeSliceIndexSym:El,streamSym:Ii,serializersSym:oe,formattersSym:zt,useOnlyCustomLevelsSym:_l,needsMetadataGsym:Tl,redactFmtSym:kl,stringifySym:Ml,formatOptsSym:Al,stringifiersSym:Rl}=ce(),{getLevel:jl,setLevel:Ll,isLevelEnabled:ql,mappings:Il,initialLsCache:Pl,genLsCache:Cl,assertNoLevelCollisions:$l}=De(),{asChindings:Pi,asJson:Bl,buildFormatters:Ri,stringify:ji}=Be(),{version:Dl}=Dt(),zl=gt(),Nl=class{},Ci={constructor:Nl,child:Fl,bindings:Wl,setBindings:Kl,flush:Hl,isLevelEnabled:ql,version:Dl,get level(){return this[Ai]()},set level(e){this[Nt](e)},get levelVal(){return this[bl]},set levelVal(e){throw Error("levelVal is read-only")},[yl]:Pl,[vl]:Ul,[qi]:Bl,[Ai]:jl,[Nt]:Ll};Object.setPrototypeOf(Ci,ml.prototype);$i.exports=function(){return Object.create(Ci)};var Li=e=>e;function Fl(e,t){if(!e)throw Error("missing bindings for child Pino");t=t||{};let r=this[oe],n=this[zt],i=Object.create(this);if(t.hasOwnProperty("serializers")===!0){i[oe]=Object.create(null);for(let c in r)i[oe][c]=r[c];let s=Object.getOwnPropertySymbols(r);for(var o=0;o<s.length;o++){let c=s[o];i[oe][c]=r[c]}for(let c in t.serializers)i[oe][c]=t.serializers[c];let u=Object.getOwnPropertySymbols(t.serializers);for(var a=0;a<u.length;a++){let c=u[a];i[oe][c]=t.serializers[c]}}else i[oe]=r;if(t.hasOwnProperty("formatters")){let{level:s,bindings:u,log:c}=t.formatters;i[zt]=Ri(s||n.level,u||Li,c||n.log)}else i[zt]=Ri(n.level,Li,n.log);if(t.hasOwnProperty("customLevels")===!0&&($l(this.levels,t.customLevels),i.levels=Il(t.customLevels,i[_l]),Cl(i)),typeof t.redact=="object"&&t.redact!==null||Array.isArray(t.redact)){i.redact=t.redact;let s=zl(i.redact,ji),u={stringify:s[kl]};i[Ml]=ji,i[Rl]=s,i[Al]=u}i[Ft]=Pi(i,e);let f=t.level||this.level;return i[Nt](f),i}function Wl(){let t=`{${this[Ft].substr(1)}}`,r=JSON.parse(t);return delete r.pid,delete r.hostname,r}function Kl(e){let t=Pi(this,e);this[Ft]=t,delete this[wl]}function Vl(e,t){return Object.assign(t,e)}function Ul(e,t,r){let n=this[xl](),i=this[Sl],o=this[Ol]||Vl,a;e==null?a={}:e instanceof Error?(a={err:e},t===void 0&&(t=e.message)):(a=e,t===void 0&&e.err&&(t=e.err.message)),i&&(a=o(a,i(a,r)));let f=this[qi](a,t,r,n),s=this[Ii];s[Tl]===!0&&(s.lastLevel=r,s.lastObj=a,s.lastMsg=t,s.lastTime=n.slice(this[El]),s.lastLogger=this),s.write(f)}function Jl(){}function Hl(){let e=this[Ii];"flush"in e&&e.flush(Jl)}});var Fi=x((Ut,Ni)=>{"use strict";var{hasOwnProperty:ye}=Object.prototype,le=Vt();le.configure=Vt;le.stringify=le;le.default=le;Ut.stringify=le;Ut.configure=Vt;Ni.exports=le;var Gl=/[\u0000-\u001f\u0022\u005c\ud800-\udfff]/;function Z(e){return e.length<5e3&&!Gl.test(e)?`"${e}"`:JSON.stringify(e)}function Wt(e,t){if(e.length>200||t)return e.sort(t);for(let r=1;r<e.length;r++){let n=e[r],i=r;for(;i!==0&&e[i-1]>n;)e[i]=e[i-1],i--;e[i]=n}return e}var Yl=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Object.getPrototypeOf(new Int8Array)),Symbol.toStringTag).get;function Kt(e){return Yl.call(e)!==void 0&&e.length!==0}function Di(e,t,r){e.length<r&&(r=e.length);let n=t===","?"":" ",i=`"0":${n}${e[0]}`;for(let o=1;o<r;o++)i+=`${t}"${o}":${n}${e[o]}`;return i}function Xl(e){if(ye.call(e,"circularValue")){let t=e.circularValue;if(typeof t=="string")return`"${t}"`;if(t==null)return t;if(t===Error||t===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]"'}function Ql(e){let t;if(ye.call(e,"deterministic")&&(t=e.deterministic,typeof t!="boolean"&&typeof t!="function"))throw new TypeError('The "deterministic" argument must be of type boolean or comparator function');return t===void 0?!0:t}function Zl(e,t){let r;if(ye.call(e,t)&&(r=e[t],typeof r!="boolean"))throw new TypeError(`The "${t}" argument must be of type boolean`);return r===void 0?!0:r}function zi(e,t){let r;if(ye.call(e,t)){if(r=e[t],typeof r!="number")throw new TypeError(`The "${t}" argument must be of type number`);if(!Number.isInteger(r))throw new TypeError(`The "${t}" argument must be an integer`);if(r<1)throw new RangeError(`The "${t}" argument must be >= 1`)}return r===void 0?1/0:r}function ae(e){return e===1?"1 item":`${e} items`}function ec(e){let t=new Set;for(let r of e)(typeof r=="string"||typeof r=="number")&&t.add(String(r));return t}function tc(e){if(ye.call(e,"strict")){let t=e.strict;if(typeof t!="boolean")throw new TypeError('The "strict" argument must be of type boolean');if(t)return r=>{let n=`Object can not safely be stringified. Received type ${typeof r}`;throw typeof r!="function"&&(n+=` (${r.toString()})`),new Error(n)}}}function Vt(e){e={...e};let t=tc(e);t&&(e.bigint===void 0&&(e.bigint=!1),"circularValue"in e||(e.circularValue=Error));let r=Xl(e),n=Zl(e,"bigint"),i=Ql(e),o=typeof i=="function"?i:void 0,a=zi(e,"maximumDepth"),f=zi(e,"maximumBreadth");function s(d,l,b,w,S,v){let y=l[d];switch(typeof y=="object"&&y!==null&&typeof y.toJSON=="function"&&(y=y.toJSON(d)),y=w.call(l,d,y),typeof y){case"string":return Z(y);case"object":{if(y===null)return"null";if(b.indexOf(y)!==-1)return r;let E="",O=",",T=v;if(Array.isArray(y)){if(y.length===0)return"[]";if(a<b.length+1)return'"[Array]"';b.push(y),S!==""&&(v+=S,E+=`
|
|
81
|
-
${v}`,O=`,
|
|
82
|
-
${v}`);let A=Math.min(y.length,f),P=0;for(;P<A-1;P++){let U=s(String(P),y,b,w,S,v);E+=U!==void 0?U:"null",E+=O}let I=s(String(P),y,b,w,S,v);if(E+=I!==void 0?I:"null",y.length-1>f){let U=y.length-f-1;E+=`${O}"... ${ae(U)} not stringified"`}return S!==""&&(E+=`
|
|
83
|
-
${T}`),b.pop(),`[${E}]`}let M=Object.keys(y),k=M.length;if(k===0)return"{}";if(a<b.length+1)return'"[Object]"';let _="",R="";S!==""&&(v+=S,O=`,
|
|
84
|
-
${v}`,_=" ");let q=Math.min(k,f);i&&!Kt(y)&&(M=Wt(M,o)),b.push(y);for(let A=0;A<q;A++){let P=M[A],I=s(P,y,b,w,S,v);I!==void 0&&(E+=`${R}${Z(P)}:${_}${I}`,R=O)}if(k>f){let A=k-f;E+=`${R}"...":${_}"${ae(A)} not stringified"`,R=O}return S!==""&&R.length>1&&(E=`
|
|
85
|
-
${v}${E}
|
|
86
|
-
${T}`),b.pop(),`{${E}}`}case"number":return isFinite(y)?String(y):t?t(y):"null";case"boolean":return y===!0?"true":"false";case"undefined":return;case"bigint":if(n)return String(y);default:return t?t(y):void 0}}function u(d,l,b,w,S,v){switch(typeof l=="object"&&l!==null&&typeof l.toJSON=="function"&&(l=l.toJSON(d)),typeof l){case"string":return Z(l);case"object":{if(l===null)return"null";if(b.indexOf(l)!==-1)return r;let y=v,E="",O=",";if(Array.isArray(l)){if(l.length===0)return"[]";if(a<b.length+1)return'"[Array]"';b.push(l),S!==""&&(v+=S,E+=`
|
|
87
|
-
${v}`,O=`,
|
|
88
|
-
${v}`);let k=Math.min(l.length,f),_=0;for(;_<k-1;_++){let q=u(String(_),l[_],b,w,S,v);E+=q!==void 0?q:"null",E+=O}let R=u(String(_),l[_],b,w,S,v);if(E+=R!==void 0?R:"null",l.length-1>f){let q=l.length-f-1;E+=`${O}"... ${ae(q)} not stringified"`}return S!==""&&(E+=`
|
|
89
|
-
${y}`),b.pop(),`[${E}]`}b.push(l);let T="";S!==""&&(v+=S,O=`,
|
|
90
|
-
${v}`,T=" ");let M="";for(let k of w){let _=u(k,l[k],b,w,S,v);_!==void 0&&(E+=`${M}${Z(k)}:${T}${_}`,M=O)}return S!==""&&M.length>1&&(E=`
|
|
91
|
-
${v}${E}
|
|
92
|
-
${y}`),b.pop(),`{${E}}`}case"number":return isFinite(l)?String(l):t?t(l):"null";case"boolean":return l===!0?"true":"false";case"undefined":return;case"bigint":if(n)return String(l);default:return t?t(l):void 0}}function c(d,l,b,w,S){switch(typeof l){case"string":return Z(l);case"object":{if(l===null)return"null";if(typeof l.toJSON=="function"){if(l=l.toJSON(d),typeof l!="object")return c(d,l,b,w,S);if(l===null)return"null"}if(b.indexOf(l)!==-1)return r;let v=S;if(Array.isArray(l)){if(l.length===0)return"[]";if(a<b.length+1)return'"[Array]"';b.push(l),S+=w;let _=`
|
|
93
|
-
${S}`,R=`,
|
|
94
|
-
${S}`,q=Math.min(l.length,f),A=0;for(;A<q-1;A++){let I=c(String(A),l[A],b,w,S);_+=I!==void 0?I:"null",_+=R}let P=c(String(A),l[A],b,w,S);if(_+=P!==void 0?P:"null",l.length-1>f){let I=l.length-f-1;_+=`${R}"... ${ae(I)} not stringified"`}return _+=`
|
|
95
|
-
${v}`,b.pop(),`[${_}]`}let y=Object.keys(l),E=y.length;if(E===0)return"{}";if(a<b.length+1)return'"[Object]"';S+=w;let O=`,
|
|
96
|
-
${S}`,T="",M="",k=Math.min(E,f);Kt(l)&&(T+=Di(l,O,f),y=y.slice(l.length),k-=l.length,M=O),i&&(y=Wt(y,o)),b.push(l);for(let _=0;_<k;_++){let R=y[_],q=c(R,l[R],b,w,S);q!==void 0&&(T+=`${M}${Z(R)}: ${q}`,M=O)}if(E>f){let _=E-f;T+=`${M}"...": "${ae(_)} not stringified"`,M=O}return M!==""&&(T=`
|
|
97
|
-
${S}${T}
|
|
98
|
-
${v}`),b.pop(),`{${T}}`}case"number":return isFinite(l)?String(l):t?t(l):"null";case"boolean":return l===!0?"true":"false";case"undefined":return;case"bigint":if(n)return String(l);default:return t?t(l):void 0}}function h(d,l,b){switch(typeof l){case"string":return Z(l);case"object":{if(l===null)return"null";if(typeof l.toJSON=="function"){if(l=l.toJSON(d),typeof l!="object")return h(d,l,b);if(l===null)return"null"}if(b.indexOf(l)!==-1)return r;let w="",S=l.length!==void 0;if(S&&Array.isArray(l)){if(l.length===0)return"[]";if(a<b.length+1)return'"[Array]"';b.push(l);let T=Math.min(l.length,f),M=0;for(;M<T-1;M++){let _=h(String(M),l[M],b);w+=_!==void 0?_:"null",w+=","}let k=h(String(M),l[M],b);if(w+=k!==void 0?k:"null",l.length-1>f){let _=l.length-f-1;w+=`,"... ${ae(_)} not stringified"`}return b.pop(),`[${w}]`}let v=Object.keys(l),y=v.length;if(y===0)return"{}";if(a<b.length+1)return'"[Object]"';let E="",O=Math.min(y,f);S&&Kt(l)&&(w+=Di(l,",",f),v=v.slice(l.length),O-=l.length,E=","),i&&(v=Wt(v,o)),b.push(l);for(let T=0;T<O;T++){let M=v[T],k=h(M,l[M],b);k!==void 0&&(w+=`${E}${Z(M)}:${k}`,E=",")}if(y>f){let T=y-f;w+=`${E}"...":"${ae(T)} not stringified"`}return b.pop(),`{${w}}`}case"number":return isFinite(l)?String(l):t?t(l):"null";case"boolean":return l===!0?"true":"false";case"undefined":return;case"bigint":if(n)return String(l);default:return t?t(l):void 0}}function p(d,l,b){if(arguments.length>1){let w="";if(typeof b=="number"?w=" ".repeat(Math.min(b,10)):typeof b=="string"&&(w=b.slice(0,10)),l!=null){if(typeof l=="function")return s("",{"":d},[],l,w,"");if(Array.isArray(l))return u("",d,[],ec(l),w,"")}if(w.length!==0)return c("",d,[],w,"")}return h("",d,[])}return p}});var Ui=x((tf,Vi)=>{"use strict";var Jt=Symbol.for("pino.metadata"),{levels:Wi}=De(),Ki=Object.create(Wi);Ki.silent=1/0;var rc=Wi.info;function nc(e,t){let r=0;e=e||[],t=t||{dedupe:!1};let n=Ki;t.levels&&typeof t.levels=="object"&&(n=t.levels);let i={write:o,add:f,flushSync:a,end:s,minLevel:0,streams:[],clone:u,[Jt]:!0};return Array.isArray(e)?e.forEach(f,i):f.call(i,e),e=null,i;function o(c){let h,p=this.lastLevel,{streams:d}=this,l;for(let b=0;b<d.length&&(h=d[b],h.level<=p);b++){if(l=h.stream,l[Jt]){let{lastTime:w,lastMsg:S,lastObj:v,lastLogger:y}=this;l.lastLevel=p,l.lastTime=w,l.lastMsg=S,l.lastObj=v,l.lastLogger=y}(!t.dedupe||h.level===p)&&l.write(c)}}function a(){for(let{stream:c}of this.streams)typeof c.flushSync=="function"&&c.flushSync()}function f(c){if(!c)return i;let h=typeof c.write=="function"||c.stream,p=c.write?c:c.stream;if(!h)throw Error("stream object needs to implement either StreamEntry or DestinationStream interface");let{streams:d}=this,l;typeof c.levelVal=="number"?l=c.levelVal:typeof c.level=="string"?l=n[c.level]:typeof c.level=="number"?l=c.level:l=rc;let b={stream:p,level:l,levelVal:void 0,id:r++};return d.unshift(b),d.sort(ic),this.minLevel=d[0].level,i}function s(){for(let{stream:c}of this.streams)typeof c.flushSync=="function"&&c.flushSync(),c.end()}function u(c){let h=new Array(this.streams.length);for(let p=0;p<h.length;p++)h[p]={level:c,stream:this.streams[p].stream};return{write:o,add:f,minLevel:c,streams:h,clone:u,flushSync:a,[Jt]:!0}}}function ic(e,t){return e.level-t.level}Vi.exports=nc});var ss=x((rf,V)=>{"use strict";var sc=require("os"),es=at(),oc=lt(),ac=gt(),ts=Dn(),lc=Bi(),rs=ce(),{configure:cc}=Fi(),{assertDefaultLevelFound:uc,mappings:ns,genLsCache:fc,levels:hc}=De(),{createArgsNormalizer:dc,asChindings:pc,final:gc,buildSafeSonicBoom:Ji,buildFormatters:mc,stringify:ze,normalizeDestFileDescriptor:Hi,noop:yc}=Be(),{version:bc}=Dt(),{chindingsSym:Gi,redactFmtSym:wc,serializersSym:Yi,timeSym:Sc,timeSliceIndexSym:vc,streamSym:Oc,stringifySym:Xi,stringifySafeSym:Ht,stringifiersSym:Qi,setLevelSym:xc,endSym:Ec,formatOptsSym:_c,messageKeySym:Tc,nestedKeySym:kc,mixinSym:Mc,useOnlyCustomLevelsSym:Ac,formattersSym:Zi,hooksSym:Rc,nestedKeyStrSym:jc,mixinMergeStrategySym:Lc}=rs,{epochTime:is,nullTime:qc}=ts,{pid:Ic}=process,Pc=sc.hostname(),Cc=es.err,$c={level:"info",levels:hc,messageKey:"msg",nestedKey:null,enabled:!0,prettyPrint:!1,base:{pid:Ic,hostname:Pc},serializers:Object.assign(Object.create(null),{err:Cc}),formatters:Object.assign(Object.create(null),{bindings(e){return e},level(e,t){return{level:t}}}),hooks:{logMethod:void 0},timestamp:is,name:void 0,redact:null,customLevels:null,useOnlyCustomLevels:!1,depthLimit:5,edgeLimit:100},Bc=dc($c),Dc=Object.assign(Object.create(null),es);function Gt(...e){let t={},{opts:r,stream:n}=Bc(t,oc(),...e),{redact:i,crlf:o,serializers:a,timestamp:f,messageKey:s,nestedKey:u,base:c,name:h,level:p,customLevels:d,mixin:l,mixinMergeStrategy:b,useOnlyCustomLevels:w,formatters:S,hooks:v,depthLimit:y,edgeLimit:E}=r,O=cc({maximumDepth:y,maximumBreadth:E}),T=mc(S.level,S.bindings,S.log),M=i?ac(i,ze):{},k=ze.bind({[Ht]:O}),_=i?{stringify:M[wc]}:{stringify:k},R="}"+(o?`\r
|
|
99
|
-
`:`
|
|
100
|
-
`),q=pc.bind(null,{[Gi]:"",[Yi]:a,[Qi]:M,[Xi]:ze,[Ht]:O,[Zi]:T}),A="";c!==null&&(h===void 0?A=q(c):A=q(Object.assign({},c,{name:h})));let P=f instanceof Function?f:f?is:qc,I=P().indexOf(":")+1;if(w&&!d)throw Error("customLevels is required if useOnlyCustomLevels is set true");if(l&&typeof l!="function")throw Error(`Unknown mixin type "${typeof l}" - expected "function"`);uc(p,d,w);let U=ns(d,w);return Object.assign(t,{levels:U,[Ac]:w,[Oc]:n,[Sc]:P,[vc]:I,[Xi]:ze,[Ht]:O,[Qi]:M,[Ec]:R,[_c]:_,[Tc]:s,[kc]:u,[jc]:u?`,${JSON.stringify(u)}:{`:"",[Yi]:a,[Mc]:l,[Lc]:b,[Gi]:A,[Zi]:T,[Rc]:v,silent:yc}),Object.setPrototypeOf(t,lc()),fc(t),t[xc](p),t}V.exports=Gt;V.exports.destination=(e=process.stdout.fd)=>typeof e=="object"?(e.dest=Hi(e.dest||process.stdout.fd),Ji(e)):Ji({dest:Hi(e),minLength:0,sync:!0});V.exports.transport=Mt();V.exports.multistream=Ui();V.exports.final=gc;V.exports.levels=ns();V.exports.stdSerializers=Dc;V.exports.stdTimeFunctions=Object.assign({},ts);V.exports.symbols=rs;V.exports.version=bc;V.exports.default=Gt;V.exports.pino=Gt});var Wc={};vs(Wc,{Actions:()=>re,Client:()=>Qt,Logger:()=>be,MESSAGE_TYPE:()=>Xt,Serialize:()=>te,bLog:()=>zc,cLog:()=>Ne,cache:()=>Nc,decodeJid:()=>Fe,logBlock:()=>Yt,sleep:()=>Fc});module.exports=Os(Wc);var re=class{client;constructor(t){this.client=t}getGroupName(t){let r=this.client?.contacts[t]||this.client?.messages["status@broadcast"]?.array?.find(n=>n?.key?.participant===t);return r?.name||r?.subject||(r=this.client?.groupMetadata[t]||{}),r?.name}};var ds=F(Hr()),L=F(require("@whiskeysockets/baileys")),we=F(require("chalk")),Ke=F(tt()),ps=F(ss());var us=F(require("cfonts")),ee=F(require("chalk")),fs=F(require("dayjs")),hs=F(require("ora"));var os=F(tt()),as=F(require("beautify-console-log")),ls=F(require("chalk")),cs=as.default.getInstance();cs.setPadStartText({title:"",logType:"error"}).setPadStartText({title:"",logType:"info"}).setPadStartText({title:"",logType:"log"}).setPadStartText({title:"",logType:"warn"});var zc=cs,Ne=console.log,Nc=new os.default,Yt=(e="succeed")=>ls.default[{succeed:"bgGreen",fail:"bgRed",warn:"bgYellow",info:"bgCyan"}[e]](" "),Fc=e=>new Promise(t=>setTimeout(t,e));var Xt={text:"text",conversation:"text",imageMessage:"image",contactMessage:"contact",locationMessage:"location",extendedTextMessage:"text",documentMessage:"document",audioMessage:"audio",videoMessage:"video",protocolMessage:"protocol",contactsArrayMessage:"contactsArray",highlyStructuredMessage:"highlyStructured",sendPaymentMessage:"sendPayment",liveLocationMessage:"liveLocation",requestPaymentMessage:"requestPayment",declinePaymentRequestMessage:"declinePaymentRequest",cancelPaymentRequestMessage:"cancelPaymentRequest",templateMessage:"template",stickerMessage:"sticker",groupInviteMessage:"groupInvite",templateButtonReplyMessage:"templateButtonReply",productMessage:"product",deviceSentMessage:"deviceSent",listMessage:"list",viewOnceMessage:"viewOnce",orderMessage:"order",listResponseMessage:"listResponse",ephemeralMessage:"ephemeral",invoiceMessage:"invoice",buttonsMessage:"buttons",buttonsResponseMessage:"buttonsResponse",paymentInviteMessage:"paymentInvite",interactiveMessage:"interactive",reactionMessage:"reaction",stickerSyncRmrMessage:"sticker",interactiveResponseMessage:"interactiveResponse",pollCreationMessage:"pollCreation",pollUpdateMessage:"pollUpdate",keepInChatMessage:"keepInChat",documentWithCaptionMessage:"document",requestPhoneNumberMessage:"requestPhoneNumber",viewOnceMessageV2:"viewOnce",encReactionMessage:"reaction",editedMessage:"text",viewOnceMessageV2Extension:"viewOnce",pollCreationMessageV2:"pollCreation",scheduledCallCreationMessage:"scheduledCallCreation",groupMentionedMessage:"groupMentioned",pinInChatMessage:"pinInChat",pollCreationMessageV3:"pollCreation",scheduledCallEditMessage:"scheduledCallEdit",ptvMessage:"ptv",botInvokeMessage:"botInvoke",callLogMesssage:"callLog",encCommentMessage:"encComment",bcallMessage:"bcall",lottieStickerMessage:"lottieSticker",eventMessage:"event",commentMessage:"comment",newsletterAdminInviteMessage:"text",extendedTextMessageWithParentKey:"text",placeholderMessage:"placeholder",encEventUpdateMessage:"encEventUpdate"};var be=class{bannerLogo;copyright;client;actions;spinner;constructor(t){this.client=t,this.bannerLogo=" Zaileys ",this.copyright=`Copyright \xA9 ${new Date().getFullYear()} by zaadevofc`,this.spinner=(0,hs.default)({color:"yellow",spinner:"dots3"}),this.banner(),this.actions=new re(this.client)}banner(){us.default.say(this.bannerLogo,{font:"slick",colors:["#ffce51","blue"],letterSpacing:0}),Ne(" ".repeat(5),ee.default`{yellowBright.italic.bold ${this.copyright} }`),Ne(`
|
|
101
|
-
`+ee.default`{dim =}`.repeat(42)+`
|
|
102
|
-
`)}async msgLogs(t){if(!t)return;let{roomType:r,msgType:n,msgBody:i,msgTimestamp:o,roomId:a,senderId:f,senderName:s}=t,u=a.split("@")[0],c=f.split("@")[0],h=(0,fs.default)(o).format("HH:mm:ss DD/MM/YYYY"),p=this.actions.getGroupName(a),d=ee.default`{dim.bold.underline ${h}}\n`;d+=ee.default`{bgBlue.underline } {yellow.bold [${r=="group"?p:s}]} {cyan >>} {green.bold ${r=="group"?u:c}}\n`,d+=r=="group"?ee.default`{bgBlue.underline } {yellow.bold [${s}]} {cyan >>} {green.bold ${c}}\n`:"",d+=ee.default`{bgBlue } {yellow.bold [${n.toUpperCase()}]} {cyan >>} {bold ${i}}`,console.log(d)}runSpinner(t){this.spinner.start(ee.default`${t}`)}editSpinner(t){this.spinner&&(this.spinner.text=t)}stopSpinner(t="succeed",r){this.spinner&&this.spinner.stopAndPersist({text:r,symbol:Yt(t)})}};var We=F(require("@whiskeysockets/baileys"));var Fe=e=>/:\d+@/gi.test(e)?We.jidNormalizedUser(e):e;function te(e,t,r){if(!r?.message||r?.messageStubType||r?.key?.remoteJid==="status@broadcast")return;let n=s=>{if(s)return Object.keys(s).find(h=>(h==="conversation"||h.endsWith("Message")||h.endsWith("V2")||h.endsWith("V3"))&&h!=="senderKeyDistributionMessage")},i=Fe(e.user?.id),o=()=>r?.key?.remoteJid?.endsWith("@g.us")?"group":r?.key?.remoteJid?.endsWith("@s.whatsapp.net")?"private":r?.key?.remoteJid?.endsWith("@newsletter")?"channel":"private",a={},f=We?.extractMessageContent(r?.message);if(a.roomId=Fe(r?.key?.remoteJid),a.roomType=o(),a.senderId=Fe(r?.participant||r?.key?.participant||r?.key?.remoteJid||r?.message?.participant),a.senderName=r?.pushName||r?.verifiedBizName,a.isMe=!!r?.key?.fromMe||!!i.match(a.senderId),a.isBot=!!r?.key?.id?.startsWith("BAE5"),a.isMedia=!1,a.isEphemeral=!1,a.isAuthor=!!t.authors.some(s=>!!s.toString().match(a.senderId.split("@")[0])),f){a.msgType=n(f);let s=We?.extractMessageContent(f[a?.msgType])||f[a?.msgType];if(a.msgBody=s?.text||s?.caption||f?.conversation||s?.selectedButtonId||s?.singleSelectReply?.selectedRowId||s?.selectedId||s?.contentText||s?.selectedDisplayText||s?.title||s?.name||"",a.msgMentions=s?.contextInfo?.mentionedJid||[],a.msgExpiration=s?.contextInfo?.expiration||0,a.msgTimestamp=typeof r?.messageTimestamp=="number"?r?.messageTimestamp:r?.messageTimestamp?.low?r?.messageTimestamp?.low:r?.messageTimestamp?.high,a.isEphemeral=a.msgExpiration>0,a.isMedia=!!s?.mimetype||!!s?.thumbnailDirectPath,a?.isMedia&&Object.assign(a,{msgMedia:{url:s?.url,mimetype:s?.mimetype,size:s?.fileLength,height:s?.height||0,width:s?.width||0,isAnimated:/webp/i.test(s?.mimetype)?!!s?.isAnimated:!1,isAvatar:!!s?.isAvatar,isAiSticker:!!s?.isAiSticker,isLottie:!!s?.isLottie}}),s?.contextInfo?.quotedMessage){let u=e?.messages?.[a.roomId]?.get(s?.contextInfo?.stanzaId);a.msgQuoted=te(e,t,u)}}return a.payload=()=>r,a.key=()=>r.key,a.msgType=Xt[a?.msgType],a.msgTimestamp=a.msgTimestamp*1e3,a}var Qt=class{client;listeners;pino;authPath;credsPath;storePath;logger;actions;phoneNumber;method;showLogs;markOnline;autoRead;authors;ignoreMe;constructor(t){this.phoneNumber=t.phoneNumber,this.method=t.method,this.showLogs=t.showLogs??!0,this.markOnline=t.markOnline??!0,this.autoRead=t.autoRead??!0,this.authors=t.authors??[],this.ignoreMe=t.ignoreMe??!0,this.pino=(0,ps.default)({enabled:!1}),this.authPath="./.zaileys/zaileys-auth/",this.credsPath=this.authPath+"creds.json",this.storePath=this.authPath+"store.json",this.listeners=new Map,this.initialize()}async initialize(){let{state:t,saveCreds:r}=await L.useMultiFileAuthState(this.authPath),n=L.makeInMemoryStore({});n.readFromFile(this.storePath),this.client=L.default({logger:this.pino,markOnlineOnConnect:this.markOnline,browser:L.Browsers.ubuntu("Safari"),auth:t,qrTimeout:6e4,userDevicesCache:new Ke.default,msgRetryCounterCache:new Ke.default,placeholderResendCache:new Ke.default,getMessage:async i=>n?(await n.loadMessage(i.remoteJid,i.id))?.message||void 0:L.proto.Message.fromObject({})}),this.actions=new re(this.client),this.logger=new be(this.client),this.logger.runSpinner("Initializing zaileys connection..."),n.bind(this.client.ev);for(let i in n)i!="groupMetadata"&&(this.client[i]=n[i]);this.client.ev.on("creds.update",r),await this.pairingCode(),this.handler(),this.client.authState.creds.registered&&setInterval(()=>{n.writeToFile(this.storePath)},5e3)}async pairingCode(){if(!this.client.authState.creds.registered&&this.method==="pairing"){let t=this.phoneNumber.toString().replace(/[^0-9]/g,"");Object.keys(L.PHONENUMBER_MCC).some(n=>t.startsWith(n))||(this.logger.stopSpinner("fail","Invalid phone number, please try again"),process.exit(0)),setTimeout(async()=>{try{let n=await this.client.requestPairingCode(t);n=n?.match(/.{1,4}/g)?.join("-")??"",this.logger.runSpinner(we.default`{blueBright.bold.underline Login with Pairing}`),this.logger.stopSpinner("info",we.default`Generating code: {bgYellowBright.bold.black ${n} }`),this.logger.stopSpinner("info",we.default`Code expired on ${new Date(Date.now()+160*1e3).toLocaleTimeString()}`)}catch(n){this.logger.stopSpinner("fail",n.toString()),process.exit(0)}},1e3)}}handler(){this.client?.ev?.on("connection.update",t=>{let{lastDisconnect:r,connection:n,qr:i,receivedPendingNotifications:o}=t;if(o&&this.client?.ev.flush(),n==="close"){let a=new ds.Boom(r?.error)?.output,f=a?.statusCode;f===L.DisconnectReason.badSession?(this.logger.stopSpinner("fail","Session file corrupted. Please delete session and scan again"),this.initialize()):f===L.DisconnectReason.connectionClosed?(this.logger.stopSpinner("warn","Connection closed. Reconnecting..."),this.initialize()):f===L.DisconnectReason.connectionLost?(this.logger.stopSpinner("warn","Lost connection to server. Reconnecting..."),this.initialize()):f===L.DisconnectReason.connectionReplaced?(this.logger.stopSpinner("fail","Connection replaced. Please close current session"),process.exit(0)):f===L.DisconnectReason.loggedOut?(this.logger.stopSpinner("fail","Device logged out. Please scan again"),process.exit(0)):f===L.DisconnectReason.restartRequired?(this.logger.stopSpinner("info","Restart required. Restarting..."),this.initialize()):f===L.DisconnectReason.timedOut?(this.logger.stopSpinner("warn","Connection timeout. Restarting..."),this.initialize()):f===L.DisconnectReason.multideviceMismatch?(this.logger.stopSpinner("fail","Multi-device mismatch. Please scan again"),process.exit(0)):f===1006?(this.logger.stopSpinner("fail","Error at internal system, trying to reconnect..."),this.initialize()):(this.logger.stopSpinner("warn",`Disconnected: ${a}`),this.initialize())}if(n==="connecting"&&this.logger.editSpinner("Connecting to WhatsApp..."),n==="open"){let a=this.client.authState.creds.me?.name||this.client.authState.creds.me?.verifiedName||this.client.authState.creds.me?.id;this.logger.stopSpinner("succeed","Connected to WhatsApp"),this.logger.stopSpinner("succeed",we.default`Connected as {yellowBright.bold ${a}}\n`)}}),this.client?.ev?.on("messages.upsert",t=>{let r=t.messages.map(n=>{let i=te(this.client,this,n);if(!(i?.isMe&&this.ignoreMe))return i});this.showLogs&&r.map(async n=>await this.logger.msgLogs(n)),r.map(n=>n&&this.emit("message",n))})}emit(t,r){let n=this.listeners.get(t);n&&n(r)}on(t,r){this.listeners.set(t,r)}parseMentions(t){try{return t.match(/@\d+/g).map(n=>n.slice(1)+"@s.whatsapp.net")}catch{return[]}}async send(t,r){let n=await this.client.sendMessage(t.roomId,{text:r,mentions:this.parseMentions(r)});return te(this.client,this,n)}async reply(t,r){let n=await this.client.sendMessage(t?.roomId,{text:r,mentions:this.parseMentions(r)},{quoted:t?.payload()});return te(this.client,this,n)}async edit(t,r,n){let i=await this.client.sendMessage(t?.roomId,{text:n,mentions:this.parseMentions(n),edit:r.key()});return te(this.client,this,i)}async reaction(t,r){let n=await this.client.sendMessage(t?.roomId,{react:{text:r,key:t.key()}});return te(this.client,this,n)}};0&&(module.exports={Actions,Client,Logger,MESSAGE_TYPE,Serialize,bLog,cLog,cache,decodeJid,logBlock,sleep});
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Client = void 0;
|
|
4
|
+
const Client_1 = require("./Modules/Client");
|
|
5
|
+
Object.defineProperty(exports, "Client", { enumerable: true, get: function () { return Client_1.Client; } });
|
|
6
|
+
exports.default = Client_1.Client;
|
package/package.json
CHANGED
|
@@ -1,55 +1,66 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zaileys",
|
|
3
|
-
"
|
|
4
|
-
"
|
|
5
|
-
"main": "dist/index.js",
|
|
6
|
-
"module": "dist/index.mjs",
|
|
7
|
-
"types": "dist/index.d.ts",
|
|
8
|
-
"scripts": {
|
|
9
|
-
"build": "tsup src/index.ts --format cjs,esm --dts --minify --clean",
|
|
10
|
-
"docs": "npx typedoc",
|
|
11
|
-
"dev": "nodemon src/test/index.ts",
|
|
12
|
-
"test": "ts-node src/test"
|
|
13
|
-
},
|
|
14
|
-
"homepage": "https://zaadevofc.github.io/zaileys/",
|
|
15
|
-
"funding": "https://trakteer.id/zaadevofc",
|
|
16
|
-
"bugs": {
|
|
17
|
-
"url": "https://github.com/zaadevofc/zaileys/issues"
|
|
18
|
-
},
|
|
19
|
-
"repository": {
|
|
20
|
-
"url": "git+https://github.com/zaadevofc/zaileys.git"
|
|
21
|
-
},
|
|
3
|
+
"version": "0.28.94-beta",
|
|
4
|
+
"description": "Zaileys - Simplify Typescript/Javascript WhatsApp NodeJS API",
|
|
22
5
|
"keywords": [
|
|
23
6
|
"zaileys",
|
|
24
|
-
"@whiskeysockets/baileys",
|
|
25
7
|
"whatsapp",
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
"
|
|
8
|
+
"wa-simplify",
|
|
9
|
+
"bot-zaileys",
|
|
10
|
+
"whatsapp",
|
|
11
|
+
"js-whatsapp",
|
|
12
|
+
"whatsapp-chat",
|
|
13
|
+
"whatsapp-api",
|
|
14
|
+
"whatsapp-web",
|
|
15
|
+
"whatsapp-group",
|
|
16
|
+
"automation",
|
|
17
|
+
"multi-device"
|
|
29
18
|
],
|
|
30
|
-
"
|
|
31
|
-
|
|
19
|
+
"homepage": "https://github.com/zeative/zaileys",
|
|
20
|
+
"funding": "https://saweria.co/zaadevofc",
|
|
21
|
+
"repository": {
|
|
22
|
+
"url": "git+ssh://git@github.com/zeative/zaileys.git"
|
|
23
|
+
},
|
|
24
|
+
"bugs": {
|
|
25
|
+
"url": "https://github.com/zeative/zaileys/issues"
|
|
26
|
+
},
|
|
27
|
+
"author": {
|
|
28
|
+
"name": "zaadevofc",
|
|
29
|
+
"email": "zaadevofc@gmail.com",
|
|
30
|
+
"url": "https://github.com/zeative"
|
|
31
|
+
},
|
|
32
|
+
"license": "MIT",
|
|
33
|
+
"main": "dist/index.js",
|
|
34
|
+
"types": "dist/index.d.ts",
|
|
35
|
+
"files": [
|
|
36
|
+
"dist/*"
|
|
32
37
|
],
|
|
33
38
|
"engines": {
|
|
34
|
-
"node": ">=
|
|
39
|
+
"node": ">=18"
|
|
40
|
+
},
|
|
41
|
+
"scripts": {
|
|
42
|
+
"build:all": "tsc && typedoc",
|
|
43
|
+
"build:docs": "typedoc",
|
|
44
|
+
"build:tsc": "tsc"
|
|
35
45
|
},
|
|
36
|
-
"author": "zaadevofc",
|
|
37
|
-
"license": "ISC",
|
|
38
46
|
"dependencies": {
|
|
39
|
-
"@whiskeysockets/baileys": "^6.7.
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
"qrcode-terminal": "^0.12.0"
|
|
47
|
+
"@whiskeysockets/baileys": "^6.7.12",
|
|
48
|
+
"awesome-phonenumber": "^7.2.0",
|
|
49
|
+
"consola": "^3.4.0",
|
|
50
|
+
"global": "^4.4.0",
|
|
51
|
+
"jimp": "0.22.12",
|
|
52
|
+
"node-cache": "^5.1.2",
|
|
53
|
+
"pino": "^9.6.0",
|
|
54
|
+
"qrcode-terminal": "^0.12.0",
|
|
55
|
+
"tsc": "^2.0.4",
|
|
56
|
+
"zod": "^3.24.1"
|
|
47
57
|
},
|
|
48
58
|
"devDependencies": {
|
|
49
|
-
"@types/
|
|
50
|
-
"
|
|
51
|
-
"ts-node": "^
|
|
52
|
-
"
|
|
53
|
-
"
|
|
59
|
+
"@types/node": "^16.0.0",
|
|
60
|
+
"ts-node": "^10.8.1",
|
|
61
|
+
"ts-node-dev": "^2.0.0",
|
|
62
|
+
"typedoc": "^0.24.7",
|
|
63
|
+
"typedoc-material-theme": "^1.3.0",
|
|
64
|
+
"typescript": "^4.6.4"
|
|
54
65
|
}
|
|
55
66
|
}
|
package/demo/ai/tools.js
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
export const getYouStream = (data) => {
|
|
2
|
-
const lines = data.split('\n');
|
|
3
|
-
let result = '';
|
|
4
|
-
|
|
5
|
-
lines.forEach(line => {
|
|
6
|
-
if (line.includes('"youChatToken"')) {
|
|
7
|
-
try {
|
|
8
|
-
const tokenData = getYouStream(line.split('data: ')[1]);
|
|
9
|
-
if (tokenData) {
|
|
10
|
-
result += tokenData.youChatToken;
|
|
11
|
-
}
|
|
12
|
-
} catch (error) {
|
|
13
|
-
console.error('Error parsing line:', error);
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
return result;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export const getRandomId = (length = 20) => {
|
|
22
|
-
const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
|
|
23
|
-
let result = 'ZaileysAI-';
|
|
24
|
-
for (let i = 0; i < length; i++) {
|
|
25
|
-
result += characters.charAt(Math.floor(Math.random() * characters.length));
|
|
26
|
-
}
|
|
27
|
-
return result;
|
|
28
|
-
}
|
package/demo/ai/you.js
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { getYouStream } from "./tools.js";
|
|
2
|
-
|
|
3
|
-
export const useYouApi = async (id, prompt) => {
|
|
4
|
-
let headers = {
|
|
5
|
-
"Host": "you.com",
|
|
6
|
-
"User-Agent": "Mozilla/5.0 (X11; Linux x86_64; rv:130.0) Gecko/20100101 Firefox/130.0",
|
|
7
|
-
"Accept": "text/event-stream",
|
|
8
|
-
"Accept-Language": "id,en-US;q=0.7,en;q=0.3",
|
|
9
|
-
"Accept-Encoding": "gzip, deflate, br, zstd",
|
|
10
|
-
"Referer": "https://you.com",
|
|
11
|
-
"Connection": "keep-alive",
|
|
12
|
-
"Cookie": `uuid_guest=5324006f-101c-4ffc-8b04-15631d426195; uuid_guest_backup=5324006f-101c-4ffc-8b04-15631d426195; ab.storage.deviceId.dcee0642-d796-4a7b-9e56-a0108e133b07=g%3Af913005f-dc50-25e6-f236-0bd940d2ffc4%7Ce%3Aundefined%7Cc%3A1726053031730%7Cl%3A1729434738746; DSR=eyJhbGciOiJSUzI1NiIsImtpZCI6IlNLMmpJbnU3SWpjMkp1eFJad1psWHBZRUpQQkFvIiwidHlwIjoiSldUIn0.eyJhbXIiOlsib2F1dGgiXSwiYXV0aDBJZCI6bnVsbCwiZHJuIjoiRFNSIiwiZW1haWwiOiJ6YWFkZXZvZmNAZ21haWwuY29tIiwiZXhwIjoxNzU3NTAyNjUyLCJnaXZlbk5hbWUiOiJaYWFEZXYiLCJpYXQiOjE3MjYwNTMwNTIsImlzcyI6IlAyakludHRSTXVYcHlZWk1iVmNzYzRDOVowUlQiLCJsYXN0TmFtZSI6Ik9mZmljaWFsIiwibmFtZSI6IlphYURldiBPZmZpY2lhbCIsInBpY3R1cmUiOiJodHRwczovL2xoMy5nb29nbGV1c2VyY29udGVudC5jb20vYS9BQ2c4b2NJQXA5dGV3TXd5TG9kazNkVVJkSll6U0JlSnFPT3Q0bjVzeG9hTU1TWUxzOEQ1U0FKeT1zOTYtYyIsInN0eXRjaElkIjoidXNlci1saXZlLTI4OTI2ZWJlLTkxZmItNDk4ZS1hMGQxLTk4ZjYzYTA0YmUwNiIsInN1YiI6IlUyandoakZ3UmM4c0JiREloU3dsMThsWHppQUciLCJ0ZW5hbnRJbnZpdGF0aW9uIjpudWxsLCJ0ZW5hbnRJbnZpdGVyIjpudWxsLCJ1c2VySWQiOiJVMmp3aGpGd1JjOHNCYkRJaFN3bDE4bFh6aUFHIiwidmVyaWZpZWRFbWFpbCI6dHJ1ZX0.hyCsIQkbFzEI3wz0oBssJN0H4--aaotGobzV__4BMrQkARWoRYmVqkbJkX7mRze_fQxuYedcYl1wOiaBeSptI01JiS7GLAJDJWVP0deGyNYp7XUmHMdMdvxEVy4EOwXRPhyd-LccI9A46AX4QWF22vxNdInCDhGfWhUck-snHfLLrjngNjWYKw7FRpr3QtjQP6-hLVwh4SWiJ5UemI6tPwYUJsnroVth-C5uY6qaxP1VX6ky2OuZ7d3vvRKCnrlONU-Ig2tcCtyBNYF24o3xNUBIMXF-xfCS80OdKvcG7jSJWmtqAwslmt4Z9BnOt6byI1okXMiUp2c5BRvpc4ti-w; DS=eyJhbGciOiJSUzI1NiIsImtpZCI6IlNLMmpJbnU3SWpjMkp1eFJad1psWHBZRUpQQkFvIiwidHlwIjoiSldUIn0.eyJhbXIiOlsib2F1dGgiXSwiYXV0aDBJZCI6bnVsbCwiZHJuIjoiRFMiLCJlbWFpbCI6InphYWRldm9mY0BnbWFpbC5jb20iLCJleHAiOjE3MzE4NTM5ODEsImdpdmVuTmFtZSI6IlphYURldiIsImlhdCI6MTcyOTQzNDc4MSwiaXNzIjoiUDJqSW50dFJNdVhweVlaTWJWY3NjNEM5WjBSVCIsImxhc3ROYW1lIjoiT2ZmaWNpYWwiLCJuYW1lIjoiWmFhRGV2IE9mZmljaWFsIiwicGljdHVyZSI6Imh0dHBzOi8vbGgzLmdvb2dsZXVzZXJjb250ZW50LmNvbS9hL0FDZzhvY0lBcDl0ZXdNd3lMb2RrM2RVUmRKWXpTQmVKcU9PdDRuNXN4b2FNTVNZTHM4RDVTQUp5PXM5Ni1jIiwicmV4cCI6IjIwMjUtMTAtMTlUMTQ6MzM6MDFaIiwic3R5dGNoSWQiOiJ1c2VyLWxpdmUtMjg5MjZlYmUtOTFmYi00OThlLWEwZDEtOThmNjNhMDRiZTA2Iiwic3ViIjoiVTJqd2hqRndSYzhzQmJESWhTd2wxOGxYemlBRyIsInRlbmFudEludml0YXRpb24iOm51bGwsInRlbmFudEludml0ZXIiOm51bGwsInVzZXJJZCI6IlUyandoakZ3UmM4c0JiREloU3dsMThsWHppQUciLCJ2ZXJpZmllZEVtYWlsIjp0cnVlfQ.l4yryzwhGqBoqYENiaWvnjEj2d1CIE6wYV90D_5I-THl1z2bdB_Bd5H4PvjZoPFwM36puUwHqwhrl2Y2LSU7CaGXSG5y9Uu3alYonCHxee_s1jyioHE6ee-Wgl1gn2qEvlG3vwHVuDpJiOQ_bYqu7GM7o26mvErSdVlTtVvsTCCf3MLGhrrC2oiIFd6ryj5idymhseYcvCIfag-N8Tu9xFHwz1De27RmBOj876g_8S-wPco12vw0bwt0lVHTz0KszM3RXE6inX2m6oU0bq1btbDe6j6wg5DSoazPNq8skrX-FwXRc63pVl9almydgnH1vWUOjKS0Kf8rmO1NVzvAtQ; ab.storage.userId.dcee0642-d796-4a7b-9e56-a0108e133b07=g%3Auser-live-28926ebe-91fb-498e-a0d1-98f63a04be06%7Ce%3Aundefined%7Cc%3A1726053054898%7Cl%3A1729434738746; ab.storage.sessionId.dcee0642-d796-4a7b-9e56-a0108e133b07=g%3A168e2930-41b0-33f0-916f-6c4d372d52bb%7Ce%3A1729436776249%7Cc%3A1729434738746%7Cl%3A1729434976249; g_state={"i_p":1726060257915,"i_l":1}; safesearch_guest=Moderate; ld_context=%7B%22kind%22%3A%22user%22%2C%22key%22%3A%225324006f-101c-4ffc-8b04-15631d426195%22%2C%22email%22%3A%22zaadevofc%40gmail.com%22%2C%22country%22%3A%22ID%22%2C%22userAgent%22%3A%22Mozilla%2F5.0%20(X11%3B%20Linux%20x86_64%3B%20rv%3A130.0)%20Gecko%2F20100101%20Firefox%2F130.0%22%2C%22secUserAgent%22%3A%22UNKNOWN%22%7D; ai_model=gpt_4o; youchat_personalization=true; youchat_smart_learn=true; total_query_count=7; youpro_subscription=false; you_subscription=freemium; guest_has_seen_legal_disclaimer=true; safesearch_45f9c0d6861f8d65ec5f153416cd0e1bccc2f9946ea6f143707658d8b5765954=Off; region=ALL; __cf_bm=4eNpGtRxqu02MFy66YPqrrWW9LZBRlw9V4gwQxpjiHg-1729434733-1.0.1.1-jpffqDi1oxMuvgt4ZrcHXShNOEQO5nHZSCkbChBmpLKDh4IxWtxNomH9G1Cl7qbBpWwKSjXRLQ_R26Uei5HVW4ojKZZEgHZ3VM9I8ZdrpHA; _cfuvid=QxZxj8TmB7cQa3HiDFlt3rZ0V67ZwsoTTUPxJe9bxfo-1729434733021-0.0.1.1-604800000; daily_query_count=1; daily_query_date=Sun%20Oct%2020%202024; cf_clearance=pNiRXk97aUWys8ULIT9E6j.twoXfZsQtZzYnBD8hMuw-1729434739-1.2.1.1-cPLQKn6xC.NMUl0.gq5AjeDRirKF1.HAs3Bk8ecc8ZbZ6jGTR0JVcYVoeiTI5HyEWClEjryoDDOB8WL88e4gjW1gbPPuVsnX2B8EzGw0Vj3.BWBoEncDXatVxpwX50ghFTXweIMmXTSV6_1c8ad8HwGf0jCPjOK9mpSHGoHUsdMO1iWMBEb7HehwHjLWdwq91gE.GFEr8mZE4RmAl7m8TwG8IzQbPWabzMaarhksXPzfdXTlvgr7V.NqgUDa4WcyoxoKGDOLh2rwXjPTx2wnEmRi.Fg5hz7i4EoFfZpGdvXU3liaDTe4KETrIg.2pmMgl7pnSM3hvnStKH7g1XUAHw`,
|
|
13
|
-
"Sec-Fetch-Dest": "empty",
|
|
14
|
-
"Sec-Fetch-Mode": "cors",
|
|
15
|
-
"Sec-Fetch-Site": "same-origin",
|
|
16
|
-
"Priority": "u=4",
|
|
17
|
-
"Pragma": "no-cache",
|
|
18
|
-
"Cache-Control": "no-cache"
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
let response = await fetch(`https://you.com/api/streamingSearch?page=1&count=10&safeSearch=Off&domain=youchat&use_personalization_extraction=true&queryTraceId=99e1b5ca-4c02-45be-ac38-078d0d6cff66&chatId=99e1b5ca-4c02-45be-ac38-078d0d6cff66&conversationTurnId=f5c21111-043b-4687-a25d-7df84818df2e&pastChatLength=0&selectedChatMode=default&search_additional_sources=false&selectedAiModel=gpt_4o&proChatMode=0&traceId=99e1b5ca-4c02-45be-ac38-078d0d6cff66%7Cf5c21111-043b-4687-a25d-7df84818df2e%7C2024-10-20T14%3A36%3A16.478Z&q=${prompt}&chat=[]`, {
|
|
22
|
-
method: "GET",
|
|
23
|
-
headers
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
let data = await response.text();
|
|
27
|
-
data = getYouStream(data)
|
|
28
|
-
|
|
29
|
-
return data;
|
|
30
|
-
}
|
package/demo/index.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { Client } from 'zaileys';
|
|
2
|
-
import { useYouApi } from './ai/you.js';
|
|
3
|
-
|
|
4
|
-
const wa = new Client({
|
|
5
|
-
phoneNumber: 6287833764462,
|
|
6
|
-
method: 'pairing',
|
|
7
|
-
authors: [6285136635787, 6285852584161]
|
|
8
|
-
});
|
|
9
|
-
|
|
10
|
-
wa.on('message', async (data) => {
|
|
11
|
-
if (!data.isAuthor) return;
|
|
12
|
-
|
|
13
|
-
if (data.msgBody.startsWith('.za')) {
|
|
14
|
-
const prompt = data.msgBody.slice(4)
|
|
15
|
-
const id = `ZaileysAI-${data.roomId}#${data.senderId}`
|
|
16
|
-
|
|
17
|
-
const init = await wa.reply(data, '> _Memahami respon..._')
|
|
18
|
-
const ai = await useYouApi(id, prompt)
|
|
19
|
-
|
|
20
|
-
if (ai) {
|
|
21
|
-
wa.edit(data, init, ai)
|
|
22
|
-
} else {
|
|
23
|
-
wa.edit(data, init, 'Terjadi kesalahan.')
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
})
|
package/demo/package.json
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "demo",
|
|
3
|
-
"version": "1.0.0",
|
|
4
|
-
"main": "index.js",
|
|
5
|
-
"type": "module",
|
|
6
|
-
"scripts": {
|
|
7
|
-
"test": "echo \"Error: no test specified\" && exit 1"
|
|
8
|
-
},
|
|
9
|
-
"keywords": [],
|
|
10
|
-
"author": "",
|
|
11
|
-
"license": "ISC",
|
|
12
|
-
"description": "",
|
|
13
|
-
"dependencies": {
|
|
14
|
-
"zaileys": "0.28.91-dev"
|
|
15
|
-
}
|
|
16
|
-
}
|