@helia/utils 2.2.2 → 2.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.min.js CHANGED
@@ -1,6 +1,6 @@
1
1
  (function (root, factory) {(typeof module === 'object' && module.exports) ? module.exports = factory() : root.HeliaUtils = factory()}(typeof self !== 'undefined' ? self : this, function () {
2
2
  "use strict";var HeliaUtils=(()=>{var ia=Object.create;var dt=Object.defineProperty;var oa=Object.getOwnPropertyDescriptor;var sa=Object.getOwnPropertyNames;var aa=Object.getPrototypeOf,ca=Object.prototype.hasOwnProperty;var Ai=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),I=(r,e)=>{for(var t in e)dt(r,t,{get:e[t],enumerable:!0})},Ci=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of sa(e))!ca.call(r,i)&&i!==t&&dt(r,i,{get:()=>e[i],enumerable:!(n=oa(e,i))||n.enumerable});return r};var Si=(r,e,t)=>(t=r!=null?ia(aa(r)):{},Ci(e||!r||!r.__esModule?dt(t,"default",{value:r,enumerable:!0}):t,r)),ua=r=>Ci(dt({},"__esModule",{value:!0}),r);var zi=Ai((df,rn)=>{"use strict";var ja=Object.prototype.hasOwnProperty,U="~";function We(){}Object.create&&(We.prototype=Object.create(null),new We().__proto__||(U=!1));function Va(r,e,t){this.fn=r,this.context=e,this.once=t||!1}function Fi(r,e,t,n,i){if(typeof t!="function")throw new TypeError("The listener must be a function");var o=new Va(t,n||r,i),s=U?U+e:e;return r._events[s]?r._events[s].fn?r._events[s]=[r._events[s],o]:r._events[s].push(o):(r._events[s]=o,r._eventsCount++),r}function wt(r,e){--r._eventsCount===0?r._events=new We:delete r._events[e]}function N(){this._events=new We,this._eventsCount=0}N.prototype.eventNames=function(){var e=[],t,n;if(this._eventsCount===0)return e;for(n in t=this._events)ja.call(t,n)&&e.push(U?n.slice(1):n);return Object.getOwnPropertySymbols?e.concat(Object.getOwnPropertySymbols(t)):e};N.prototype.listeners=function(e){var t=U?U+e:e,n=this._events[t];if(!n)return[];if(n.fn)return[n.fn];for(var i=0,o=n.length,s=new Array(o);i<o;i++)s[i]=n[i].fn;return s};N.prototype.listenerCount=function(e){var t=U?U+e:e,n=this._events[t];return n?n.fn?1:n.length:0};N.prototype.emit=function(e,t,n,i,o,s){var a=U?U+e:e;if(!this._events[a])return!1;var c=this._events[a],d=arguments.length,l,f;if(c.fn){switch(c.once&&this.removeListener(e,c.fn,void 0,!0),d){case 1:return c.fn.call(c.context),!0;case 2:return c.fn.call(c.context,t),!0;case 3:return c.fn.call(c.context,t,n),!0;case 4:return c.fn.call(c.context,t,n,i),!0;case 5:return c.fn.call(c.context,t,n,i,o),!0;case 6:return c.fn.call(c.context,t,n,i,o,s),!0}for(f=1,l=new Array(d-1);f<d;f++)l[f-1]=arguments[f];c.fn.apply(c.context,l)}else{var m=c.length,y;for(f=0;f<m;f++)switch(c[f].once&&this.removeListener(e,c[f].fn,void 0,!0),d){case 1:c[f].fn.call(c[f].context);break;case 2:c[f].fn.call(c[f].context,t);break;case 3:c[f].fn.call(c[f].context,t,n);break;case 4:c[f].fn.call(c[f].context,t,n,i);break;default:if(!l)for(y=1,l=new Array(d-1);y<d;y++)l[y-1]=arguments[y];c[f].fn.apply(c[f].context,l)}}return!0};N.prototype.on=function(e,t,n){return Fi(this,e,t,n,!1)};N.prototype.once=function(e,t,n){return Fi(this,e,t,n,!0)};N.prototype.removeListener=function(e,t,n,i){var o=U?U+e:e;if(!this._events[o])return this;if(!t)return wt(this,o),this;var s=this._events[o];if(s.fn)s.fn===t&&(!i||s.once)&&(!n||s.context===n)&&wt(this,o);else{for(var a=0,c=[],d=s.length;a<d;a++)(s[a].fn!==t||i&&!s[a].once||n&&s[a].context!==n)&&c.push(s[a]);c.length?this._events[o]=c.length===1?c[0]:c:wt(this,o)}return this};N.prototype.removeAllListeners=function(e){var t;return e?(t=U?U+e:e,this._events[t]&&wt(this,t)):(this._events=new We,this._eventsCount=0),this};N.prototype.off=N.prototype.removeListener;N.prototype.addListener=N.prototype.on;N.prefixed=U;N.EventEmitter=N;typeof rn<"u"&&(rn.exports=N)});var so=Ai((bh,oo)=>{oo.exports=function(r){if(!r)throw Error("hashlru must have a max value, of type number, greater than 0");var e=0,t=Object.create(null),n=Object.create(null);function i(o,s){t[o]=s,e++,e>=r&&(e=0,n=t,t=Object.create(null))}return{has:function(o){return t[o]!==void 0||n[o]!==void 0},remove:function(o){t[o]!==void 0&&(t[o]=void 0),n[o]!==void 0&&(n[o]=void 0)},get:function(o){var s=t[o];if(s!==void 0)return s;if((s=n[o])!==void 0)return i(o,s),s},set:function(o,s){t[o]!==void 0?t[o]=s:i(o,s)},clear:function(){t=Object.create(null),n=Object.create(null)}}}});var $l={};I($l,{AbstractSession:()=>qr,Helia:()=>ki,breadthFirstWalker:()=>ra,depthFirstWalker:()=>ta});var Vr=Symbol.for("@libp2p/content-routing");var J=class extends Error{static name="AbortError";constructor(e="The operation was aborted"){super(e),this.name="AbortError"}};var Te=class extends Error{static name="InvalidParametersError";constructor(e="Invalid parameters"){super(e),this.name="InvalidParametersError"}};var pt=class extends Error{static name="NotFoundError";constructor(e="Not found"){super(e),this.name="NotFoundError"}};var mt=class extends Error{static name="InvalidMultihashError";constructor(e="Invalid Multihash"){super(e),this.name="InvalidMultihashError"}};var Kr=Symbol.for("@libp2p/peer-routing");function Ii(r){return r!=null&&typeof r.start=="function"&&typeof r.stop=="function"}async function he(...r){let e=[];for(let t of r)Ii(t)&&e.push(t);await Promise.all(e.map(async t=>{t.beforeStart!=null&&await t.beforeStart()})),await Promise.all(e.map(async t=>{await t.start()})),await Promise.all(e.map(async t=>{t.afterStart!=null&&await t.afterStart()}))}async function de(...r){let e=[];for(let t of r)Ii(t)&&e.push(t);await Promise.all(e.map(async t=>{t.beforeStop!=null&&await t.beforeStop()})),await Promise.all(e.map(async t=>{await t.stop()})),await Promise.all(e.map(async t=>{t.afterStop!=null&&await t.afterStop()}))}var V=class extends EventTarget{#e=new Map;constructor(){super()}listenerCount(e){let t=this.#e.get(e);return t==null?0:t.length}addEventListener(e,t,n){super.addEventListener(e,t,n);let i=this.#e.get(e);i==null&&(i=[],this.#e.set(e,i)),i.push({callback:t,once:(n!==!0&&n!==!1&&n?.once)??!1})}removeEventListener(e,t,n){super.removeEventListener(e.toString(),t??null,n);let i=this.#e.get(e);i!=null&&(i=i.filter(({callback:o})=>o!==t),this.#e.set(e,i))}dispatchEvent(e){let t=super.dispatchEvent(e),n=this.#e.get(e.type);return n==null||(n=n.filter(({once:i})=>!i),this.#e.set(e.type,n)),t}safeDispatchEvent(e,t={}){return this.dispatchEvent(new CustomEvent(e,t))}};var Yr={};I(Yr,{base32:()=>me,base32hex:()=>ba,base32hexpad:()=>Ea,base32hexpadupper:()=>va,base32hexupper:()=>xa,base32pad:()=>ya,base32padupper:()=>wa,base32upper:()=>ga,base32z:()=>_a});var Vl=new Uint8Array(0);function Ti(r,e){if(r===e)return!0;if(r.byteLength!==e.byteLength)return!1;for(let t=0;t<r.byteLength;t++)if(r[t]!==e[t])return!1;return!0}function Y(r){if(r instanceof Uint8Array&&r.constructor.name==="Uint8Array")return r;if(r instanceof ArrayBuffer)return new Uint8Array(r);if(ArrayBuffer.isView(r))return new Uint8Array(r.buffer,r.byteOffset,r.byteLength);throw new Error("Unknown type, must be binary type")}function Li(r){return new TextEncoder().encode(r)}function Pi(r){return new TextDecoder().decode(r)}function la(r,e){if(r.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),n=0;n<t.length;n++)t[n]=255;for(var i=0;i<r.length;i++){var o=r.charAt(i),s=o.charCodeAt(0);if(t[s]!==255)throw new TypeError(o+" is ambiguous");t[s]=i}var a=r.length,c=r.charAt(0),d=Math.log(a)/Math.log(256),l=Math.log(256)/Math.log(a);function f(b){if(b instanceof Uint8Array||(ArrayBuffer.isView(b)?b=new Uint8Array(b.buffer,b.byteOffset,b.byteLength):Array.isArray(b)&&(b=Uint8Array.from(b))),!(b instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(b.length===0)return"";for(var _=0,w=0,x=0,A=b.length;x!==A&&b[x]===0;)x++,_++;for(var C=(A-x)*l+1>>>0,D=new Uint8Array(C);x!==A;){for(var L=b[x],se=0,R=C-1;(L!==0||se<w)&&R!==-1;R--,se++)L+=256*D[R]>>>0,D[R]=L%a>>>0,L=L/a>>>0;if(L!==0)throw new Error("Non-zero carry");w=se,x++}for(var Q=C-w;Q!==C&&D[Q]===0;)Q++;for(var be=c.repeat(_);Q<C;++Q)be+=r.charAt(D[Q]);return be}function m(b){if(typeof b!="string")throw new TypeError("Expected String");if(b.length===0)return new Uint8Array;var _=0;if(b[_]!==" "){for(var w=0,x=0;b[_]===c;)w++,_++;for(var A=(b.length-_)*d+1>>>0,C=new Uint8Array(A);b[_];){var D=t[b.charCodeAt(_)];if(D===255)return;for(var L=0,se=A-1;(D!==0||L<x)&&se!==-1;se--,L++)D+=a*C[se]>>>0,C[se]=D%256>>>0,D=D/256>>>0;if(D!==0)throw new Error("Non-zero carry");x=L,_++}if(b[_]!==" "){for(var R=A-x;R!==A&&C[R]===0;)R++;for(var Q=new Uint8Array(w+(A-R)),be=w;R!==A;)Q[be++]=C[R++];return Q}}}function y(b){var _=m(b);if(_)return _;throw new Error(`Non-${e} character`)}return{encode:f,decodeUnsafe:m,decode:y}}var fa=la,ha=fa,Ni=ha;var Wr=class{name;prefix;baseEncode;constructor(e,t,n){this.name=e,this.prefix=t,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},Gr=class{name;prefix;baseDecode;prefixCodePoint;constructor(e,t,n){this.name=e,this.prefix=t;let i=t.codePointAt(0);if(i===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=i,this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return Di(this,e)}},Qr=class{decoders;constructor(e){this.decoders=e}or(e){return Di(this,e)}decode(e){let t=e[0],n=this.decoders[t];if(n!=null)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}};function Di(r,e){return new Qr({...r.decoders??{[r.prefix]:r},...e.decoders??{[e.prefix]:e}})}var Jr=class{name;prefix;baseEncode;baseDecode;encoder;decoder;constructor(e,t,n,i){this.name=e,this.prefix=t,this.baseEncode=n,this.baseDecode=i,this.encoder=new Wr(e,t,n),this.decoder=new Gr(e,t,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}};function Le({name:r,prefix:e,encode:t,decode:n}){return new Jr(r,e,t,n)}function pe({name:r,prefix:e,alphabet:t}){let{encode:n,decode:i}=Ni(t,r);return Le({prefix:e,name:r,encode:n,decode:o=>Y(i(o))})}function da(r,e,t,n){let i=r.length;for(;r[i-1]==="=";)--i;let o=new Uint8Array(i*t/8|0),s=0,a=0,c=0;for(let d=0;d<i;++d){let l=e[r[d]];if(l===void 0)throw new SyntaxError(`Non-${n} character`);a=a<<t|l,s+=t,s>=8&&(s-=8,o[c++]=255&a>>s)}if(s>=t||(255&a<<8-s)!==0)throw new SyntaxError("Unexpected end of data");return o}function pa(r,e,t){let n=e[e.length-1]==="=",i=(1<<t)-1,o="",s=0,a=0;for(let c=0;c<r.length;++c)for(a=a<<8|r[c],s+=8;s>t;)s-=t,o+=e[i&a>>s];if(s!==0&&(o+=e[i&a<<t-s]),n)for(;(o.length*t&7)!==0;)o+="=";return o}function ma(r){let e={};for(let t=0;t<r.length;++t)e[r[t]]=t;return e}function S({name:r,prefix:e,bitsPerChar:t,alphabet:n}){let i=ma(n);return Le({prefix:e,name:r,encode(o){return pa(o,n,t)},decode(o){return da(o,i,t,r)}})}var me=S({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),ga=S({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),ya=S({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),wa=S({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),ba=S({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),xa=S({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),Ea=S({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),va=S({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),_a=S({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var Xr={};I(Xr,{base58btc:()=>K,base58flickr:()=>ka});var K=pe({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),ka=pe({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var Zr={};I(Zr,{base64:()=>ge,base64pad:()=>Aa,base64url:()=>Ca,base64urlpad:()=>Sa});var ge=S({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),Aa=S({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Ca=S({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),Sa=S({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});function Ia(r,e){if(typeof r=="string")return Ta(r);if(typeof r=="number")return Na(r,e);throw Error(`Value provided to ms() must be a string or number. value=${JSON.stringify(r)}`)}var gt=Ia;function Ta(r){if(typeof r!="string"||r.length===0||r.length>100)throw Error(`Value provided to ms.parse() must be a string with length between 1 and 99. value=${JSON.stringify(r)}`);let e=/^(?<value>-?\d*\.?\d+) *(?<unit>milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|months?|mo|years?|yrs?|y)?$/i.exec(r);if(!e?.groups)return NaN;let{value:t,unit:n="ms"}=e.groups,i=parseFloat(t),o=n.toLowerCase();switch(o){case"years":case"year":case"yrs":case"yr":case"y":return i*315576e5;case"months":case"month":case"mo":return i*26298e5;case"weeks":case"week":case"w":return i*6048e5;case"days":case"day":case"d":return i*864e5;case"hours":case"hour":case"hrs":case"hr":case"h":return i*36e5;case"minutes":case"minute":case"mins":case"min":case"m":return i*6e4;case"seconds":case"second":case"secs":case"sec":case"s":return i*1e3;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return i;default:throw Error(`Unknown unit "${o}" provided to ms.parse(). value=${JSON.stringify(r)}`)}}function La(r){let e=Math.abs(r);return e>=315576e5?`${Math.round(r/315576e5)}y`:e>=26298e5?`${Math.round(r/26298e5)}mo`:e>=6048e5?`${Math.round(r/6048e5)}w`:e>=864e5?`${Math.round(r/864e5)}d`:e>=36e5?`${Math.round(r/36e5)}h`:e>=6e4?`${Math.round(r/6e4)}m`:e>=1e3?`${Math.round(r/1e3)}s`:`${r}ms`}function Pa(r){let e=Math.abs(r);return e>=315576e5?xe(r,e,315576e5,"year"):e>=26298e5?xe(r,e,26298e5,"month"):e>=6048e5?xe(r,e,6048e5,"week"):e>=864e5?xe(r,e,864e5,"day"):e>=36e5?xe(r,e,36e5,"hour"):e>=6e4?xe(r,e,6e4,"minute"):e>=1e3?xe(r,e,1e3,"second"):`${r} ms`}function Na(r,e){if(typeof r!="number"||!Number.isFinite(r))throw Error("Value provided to ms.format() must be of type number.");return e?.long?Pa(r):La(r)}function xe(r,e,t,n){let i=e>=t*1.5;return`${Math.round(r/t)} ${n}${i?"s":""}`}function en(r){t.debug=t,t.default=t,t.coerce=c,t.disable=o,t.enable=i,t.enabled=s,t.humanize=gt,t.destroy=d,Object.keys(r).forEach(l=>{t[l]=r[l]}),t.names=[],t.skips=[],t.formatters={};function e(l){let f=0;for(let m=0;m<l.length;m++)f=(f<<5)-f+l.charCodeAt(m),f|=0;return t.colors[Math.abs(f)%t.colors.length]}t.selectColor=e;function t(l,f){let m,y=null,b,_;function w(...x){if(!w.enabled)return;let A=w,C=Number(new Date),D=C-(m||C);A.diff=D,A.prev=m,A.curr=C,m=C,x[0]=t.coerce(x[0]),typeof x[0]!="string"&&x.unshift("%O");let L=0;x[0]=x[0].replace(/%([a-zA-Z%])/g,(R,Q)=>{if(R==="%%")return"%";L++;let be=t.formatters[Q];if(typeof be=="function"){let na=x[L];R=be.call(A,na),x.splice(L,1),L--}return R}),t.formatArgs.call(A,x),f?.onLog!=null&&f.onLog(...x),(A.log||t.log).apply(A,x)}return w.namespace=l,w.useColors=t.useColors(),w.color=t.selectColor(l),w.extend=n,w.destroy=t.destroy,Object.defineProperty(w,"enabled",{enumerable:!0,configurable:!1,get:()=>y!==null?y:(b!==t.namespaces&&(b=t.namespaces,_=t.enabled(l)),_),set:x=>{y=x}}),typeof t.init=="function"&&t.init(w),w}function n(l,f){let m=t(this.namespace+(typeof f>"u"?":":f)+l);return m.log=this.log,m}function i(l){t.save(l),t.namespaces=l,t.names=[],t.skips=[];let f,m=(typeof l=="string"?l:"").split(/[\s,]+/),y=m.length;for(f=0;f<y;f++)m[f]&&(l=m[f].replace(/\*/g,".*?"),l[0]==="-"?t.skips.push(new RegExp("^"+l.substr(1)+"$")):t.names.push(new RegExp("^"+l+"$")))}function o(){let l=[...t.names.map(a),...t.skips.map(a).map(f=>"-"+f)].join(",");return t.enable(""),l}function s(l){if(l[l.length-1]==="*")return!0;let f,m;for(f=0,m=t.skips.length;f<m;f++)if(t.skips[f].test(l))return!1;for(f=0,m=t.names.length;f<m;f++)if(t.names[f].test(l))return!0;return!1}function a(l){return l.toString().substring(2,l.toString().length-2).replace(/\.\*\?$/,"*")}function c(l){return l instanceof Error?l.stack??l.message:l}function d(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return t.setupFormatters(t.formatters),t.enable(t.load()),t}var yt=za(),Da=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function Ra(){return typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs)?!0:typeof navigator<"u"&&navigator.userAgent?.toLowerCase().match(/(edge|trident)\/(\d+)/)!=null?!1:typeof document<"u"&&document.documentElement?.style?.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent?.toLowerCase().match(/firefox\/(\d+)/)!=null&&parseInt(RegExp.$1,10)>=31||typeof navigator<"u"&&navigator.userAgent?.toLowerCase().match(/applewebkit\/(\d+)/)}function Ua(r){if(r[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+r[0]+(this.useColors?"%c ":" ")+"+"+gt(this.diff),!this.useColors)return;let e="color: "+this.color;r.splice(1,0,e,"color: inherit");let t=0,n=0;r[0].replace(/%[a-zA-Z%]/g,i=>{i!=="%%"&&(t++,i==="%c"&&(n=t))}),r.splice(n,0,e)}var Ba=console.debug??console.log??(()=>{});function $a(r){try{r?yt?.setItem("debug",r):yt?.removeItem("debug")}catch{}}function Fa(){let r;try{r=yt?.getItem("debug")}catch{}return!r&&typeof globalThis.process<"u"&&"env"in globalThis.process&&(r=globalThis.process.env.DEBUG),r}function za(){try{return localStorage}catch{}}function Ma(r){r.j=function(e){try{return JSON.stringify(e)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}}}var Ri=en({formatArgs:Ua,save:$a,load:Fa,useColors:Ra,setupFormatters:Ma,colors:Da,storage:yt,log:Ba});var B=Ri;B.formatters.b=r=>r==null?"undefined":K.baseEncode(r);B.formatters.t=r=>r==null?"undefined":me.baseEncode(r);B.formatters.m=r=>r==null?"undefined":ge.baseEncode(r);B.formatters.p=r=>r==null?"undefined":r.toString();B.formatters.c=r=>r==null?"undefined":r.toString();B.formatters.k=r=>r==null?"undefined":r.toString();B.formatters.a=r=>r==null?"undefined":r.toString();function tn(r){let e=Ui(r.message),t=Ui(r.stack);return e!=null&&t!=null?t.includes(e)?t:`${e}
3
- ${t}`:t??e??r.toString()}function Oa(r){return r?.name==="AggregateError"}B.formatters.e=r=>{if(r==null)return"undefined";if(Oa(r)){let e=" ",t=tn(r);return r.errors.length>0?t+=`
3
+ ${t}`:t??e??r.toString()}function Oa(r){return r instanceof AggregateError||r?.name==="AggregateError"&&Array.isArray(r.errors)}B.formatters.e=r=>{if(r==null)return"undefined";if(Oa(r)){let e=" ",t=tn(r);return r.errors.length>0?t+=`
4
4
  ${e}${r.errors.map(n=>` ${tn(n).split(`
5
5
  `).join(`
6
6
  ${e}`)}`).join(`