@libp2p/interop 7.0.0 → 7.0.1
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 +5 -5
- package/dist/src/pubsub/floodsub.js +2 -2
- package/dist/src/pubsub/floodsub.js.map +1 -1
- package/dist/src/pubsub/gossipsub.js +2 -2
- package/dist/src/pubsub/gossipsub.js.map +1 -1
- package/dist/src/pubsub/hybrid.js +2 -2
- package/dist/src/pubsub/hybrid.js.map +1 -1
- package/dist/src/pubsub/utils.d.ts +6 -2
- package/dist/src/pubsub/utils.d.ts.map +1 -1
- package/dist/src/pubsub/utils.js +14 -18
- package/dist/src/pubsub/utils.js.map +1 -1
- package/package.json +2 -1
- package/src/pubsub/floodsub.ts +2 -2
- package/src/pubsub/gossipsub.ts +2 -2
- package/src/pubsub/hybrid.ts +2 -2
- package/src/pubsub/utils.ts +16 -20
package/dist/index.min.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
(function (root, factory) {(typeof module === 'object' && module.exports) ? module.exports = factory() : root.Libp2PInterop = factory()}(typeof self !== 'undefined' ? self : this, function () {
|
|
2
|
-
"use strict";var Libp2PInterop=(()=>{var
|
|
3
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var c={bold:["1","22"],dim:["2","22"],italic:["3","23"],underline:["4","24"],inverse:["7","27"],hidden:["8","28"],strike:["9","29"],black:["30","39"],red:["31","39"],green:["32","39"],yellow:["33","39"],blue:["34","39"],magenta:["35","39"],cyan:["36","39"],white:["37","39"],brightblack:["30;1","39"],brightred:["31;1","39"],brightgreen:["32;1","39"],brightyellow:["33;1","39"],brightblue:["34;1","39"],brightmagenta:["35;1","39"],brightcyan:["36;1","39"],brightwhite:["37;1","39"],grey:["90","39"]},u={special:"cyan",number:"yellow",bigint:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",symbol:"green",date:"magenta",regexp:"red"},d="\u2026";function w(l,h){var b=c[u[h]]||c[h];return b?"\x1B[".concat(b[0],"m").concat(String(l),"\x1B[").concat(b[1],"m"):String(l)}function
|
|
4
|
-
`)}function No(l,h){var b=l.getAttributeNames(),P=l.tagName.toLowerCase(),D=h.stylize("<".concat(P),"special"),R=h.stylize(">","special"),K=h.stylize("</".concat(P,">"),"special");h.truncate-=P.length*2+5;var Y="";b.length>0&&(Y+=" ",Y+=N(b.map(function(Ee){return[Ee,l.getAttribute(Ee)]}),h,kc," ")),h.truncate-=Y.length;var he=h.truncate,ue=Vr(l.children,h);return ue&&ue.length>he&&(ue="".concat(d,"(").concat(l.children.length,")")),"".concat(D).concat(Y).concat(R).concat(ue).concat(K)}var Lc=typeof Symbol=="function"&&typeof Symbol.for=="function",ur=Lc?Symbol.for("chai/inspect"):"@@chai/inspect",gt=!1;try{var Po=ke("util");gt=Po.inspect?Po.inspect.custom:!1}catch{gt=!1}function Oo(){this.key="chai/loupe__"+Math.random()+Date.now()}Oo.prototype={get:function(h){return h[this.key]},has:function(h){return this.key in h},set:function(h,b){Object.isExtensible(h)&&Object.defineProperty(h,this.key,{value:b,configurable:!0})}};var fr=new(typeof WeakMap=="function"?WeakMap:Oo),lr={},Mo={undefined:function(h,b){return b.stylize("undefined","undefined")},null:function(h,b){return b.stylize(null,"null")},boolean:function(h,b){return b.stylize(h,"boolean")},Boolean:function(h,b){return b.stylize(h,"boolean")},number:Oe,Number:Oe,bigint:xe,BigInt:xe,string:T,String:T,function:re,Function:re,symbol:x,Symbol:x,Array:q,Date:U,Map:mt,Set:Fr,RegExp:et,Promise:z,WeakSet:function(h,b){return b.stylize("WeakSet{\u2026}","special")},WeakMap:function(h,b){return b.stylize("WeakMap{\u2026}","special")},Arguments:le,Int8Array:C,Uint8Array:C,Uint8ClampedArray:C,Int16Array:C,Uint16Array:C,Int32Array:C,Uint32Array:C,Float32Array:C,Float64Array:C,Generator:function(){return""},DataView:function(){return""},ArrayBuffer:function(){return""},Error:Be,HTMLCollection:Vr,NodeList:Vr},Uc=function(h,b,P){return ur in h&&typeof h[ur]=="function"?h[ur](b):gt&> in h&&typeof h[gt]=="function"?h[gt](b.depth,b):"inspect"in h&&typeof h.inspect=="function"?h.inspect(b.depth,b):"constructor"in h&&fr.has(h.constructor)?fr.get(h.constructor)(h,b):lr[P]?lr[P](h,b):""},Rc=Object.prototype.toString;function hr(l,h){h=B(h),h.inspect=hr;var b=h,P=b.customInspect,D=l===null?"null":e(l);if(D==="object"&&(D=Rc.call(l).slice(8,-1)),Mo[D])return Mo[D](l,h);if(P&&l){var R=Uc(l,h,D);if(R)return typeof R=="string"?R:hr(R,h)}var K=l?Object.getPrototypeOf(l):!1;return K===Object.prototype||K===null?L(l,h):l&&typeof HTMLElement=="function"&&l instanceof HTMLElement?No(l,h):"constructor"in l?l.constructor!==Object?ie(l,h):L(l,h):l===Object(l)?L(l,h):h.stylize(String(l),D)}function zc(l,h){return fr.has(l)?!1:(fr.set(l,h),!0)}function Fc(l,h){return l in lr?!1:(lr[l]=h,!0)}var Vc=ur;r.custom=Vc,r.default=hr,r.inspect=hr,r.registerConstructor=zc,r.registerStringTag=Fc,Object.defineProperty(r,"__esModule",{value:!0})})});var nt=O((Zh,Qo)=>{Qo.exports={includeStack:!1,showDiff:!0,truncateThreshold:40,useProxy:!0,proxyExcludedKeys:["then","catch","inspect","toJSON"]}});var yr=O((Hh,Yo)=>{var Yh=Zr(),cu=Xo(),Zo=nt();Yo.exports=uu;function uu(r,e,t,o){var n={colors:o,depth:typeof t>"u"?2:t,showHidden:e,truncate:Zo.truncateThreshold?Zo.truncateThreshold:1/0};return cu.inspect(r,n)}});var Yr=O((ed,ei)=>{var fu=yr(),Ho=nt();ei.exports=function(e){var t=fu(e),o=Object.prototype.toString.call(e);if(Ho.truncateThreshold&&t.length>=Ho.truncateThreshold){if(o==="[object Function]")return!e.name||e.name===""?"[Function]":"[Function: "+e.name+"]";if(o==="[object Array]")return"[ Array("+e.length+") ]";if(o==="[object Object]"){var n=Object.keys(e),i=n.length>2?n.splice(0,2).join(", ")+", ...":n.join(", ");return"{ Object ("+i+") }"}else return t}else return t}});var ri=O((td,ti)=>{var Hr=Ae(),lu=Qr(),en=Yr();ti.exports=function(e,t){var o=Hr(e,"negate"),n=Hr(e,"object"),i=t[3],s=lu(e,t),a=o?t[2]:t[1],c=Hr(e,"message");return typeof a=="function"&&(a=a()),a=a||"",a=a.replace(/#\{this\}/g,function(){return en(n)}).replace(/#\{act\}/g,function(){return en(s)}).replace(/#\{exp\}/g,function(){return en(i)}),c?c+": "+a:a}});var Ve=O((rd,ni)=>{ni.exports=function(e,t,o){var n=e.__flags||(e.__flags=Object.create(null));t.__flags||(t.__flags=Object.create(null)),o=arguments.length===3?o:!0;for(var i in n)(o||i!=="object"&&i!=="ssfi"&&i!=="lockSsfi"&&i!="message")&&(t.__flags[i]=n[i])}});var yi=O((nd,nn)=>{"use strict";var oi=Ut();function hi(){this._key="chai/deep-eql__"+Math.random()+Date.now()}hi.prototype={get:function(e){return e[this._key]},set:function(e,t){Object.isExtensible(e)&&Object.defineProperty(e,this._key,{value:t,configurable:!0})}};var rn=typeof WeakMap=="function"?WeakMap:hi;function ii(r,e,t){if(!t||wt(r)||wt(e))return null;var o=t.get(r);if(o){var n=o.get(e);if(typeof n=="boolean")return n}return null}function mr(r,e,t,o){if(!(!t||wt(r)||wt(e))){var n=t.get(r);n?n.set(e,o):(n=new rn,n.set(e,o),t.set(r,n))}}nn.exports=gr;nn.exports.MemoizeMap=rn;function gr(r,e,t){if(t&&t.comparator)return si(r,e,t);var o=di(r,e);return o!==null?o:si(r,e,t)}function di(r,e){return r===e?r!==0||1/r===1/e:r!==r&&e!==e?!0:wt(r)||wt(e)?!1:null}function si(r,e,t){t=t||{},t.memoize=t.memoize===!1?!1:t.memoize||new rn;var o=t&&t.comparator,n=ii(r,e,t.memoize);if(n!==null)return n;var i=ii(e,r,t.memoize);if(i!==null)return i;if(o){var s=o(r,e);if(s===!1||s===!0)return mr(r,e,t.memoize,s),s;var a=di(r,e);if(a!==null)return a}var c=oi(r);if(c!==oi(e))return mr(r,e,t.memoize,!1),!1;mr(r,e,t.memoize,!0);var u=hu(r,e,c,t);return mr(r,e,t.memoize,u),u}function hu(r,e,t,o){switch(t){case"String":case"Number":case"Boolean":case"Date":return gr(r.valueOf(),e.valueOf());case"Promise":case"Symbol":case"function":case"WeakMap":case"WeakSet":return r===e;case"Error":return pi(r,e,["name","message","code"],o);case"Arguments":case"Int8Array":case"Uint8Array":case"Uint8ClampedArray":case"Int16Array":case"Uint16Array":case"Int32Array":case"Uint32Array":case"Float32Array":case"Float64Array":case"Array":return ot(r,e,o);case"RegExp":return du(r,e);case"Generator":return pu(r,e,o);case"DataView":return ot(new Uint8Array(r.buffer),new Uint8Array(e.buffer),o);case"ArrayBuffer":return ot(new Uint8Array(r),new Uint8Array(e),o);case"Set":return ai(r,e,o);case"Map":return ai(r,e,o);case"Temporal.PlainDate":case"Temporal.PlainTime":case"Temporal.PlainDateTime":case"Temporal.Instant":case"Temporal.ZonedDateTime":case"Temporal.PlainYearMonth":case"Temporal.PlainMonthDay":return r.equals(e);case"Temporal.Duration":return r.total("nanoseconds")===e.total("nanoseconds");case"Temporal.TimeZone":case"Temporal.Calendar":return r.toString()===e.toString();default:return mu(r,e,o)}}function du(r,e){return r.toString()===e.toString()}function ai(r,e,t){if(r.size!==e.size)return!1;if(r.size===0)return!0;var o=[],n=[];return r.forEach(function(s,a){o.push([s,a])}),e.forEach(function(s,a){n.push([s,a])}),ot(o.sort(),n.sort(),t)}function ot(r,e,t){var o=r.length;if(o!==e.length)return!1;if(o===0)return!0;for(var n=-1;++n<o;)if(gr(r[n],e[n],t)===!1)return!1;return!0}function pu(r,e,t){return ot(tn(r),tn(e),t)}function yu(r){return typeof Symbol<"u"&&typeof r=="object"&&typeof Symbol.iterator<"u"&&typeof r[Symbol.iterator]=="function"}function ci(r){if(yu(r))try{return tn(r[Symbol.iterator]())}catch{return[]}return[]}function tn(r){for(var e=r.next(),t=[e.value];e.done===!1;)e=r.next(),t.push(e.value);return t}function ui(r){var e=[];for(var t in r)e.push(t);return e}function fi(r){for(var e=[],t=Object.getOwnPropertySymbols(r),o=0;o<t.length;o+=1){var n=t[o];Object.getOwnPropertyDescriptor(r,n).enumerable&&e.push(n)}return e}function pi(r,e,t,o){var n=t.length;if(n===0)return!0;for(var i=0;i<n;i+=1)if(gr(r[t[i]],e[t[i]],o)===!1)return!1;return!0}function mu(r,e,t){var o=ui(r),n=ui(e),i=fi(r),s=fi(e);if(o=o.concat(i),n=n.concat(s),o.length&&o.length===n.length)return ot(li(o).sort(),li(n).sort())===!1?!1:pi(r,e,o,t);var a=ci(r),c=ci(e);return a.length&&a.length===c.length?(a.sort(),c.sort(),ot(a,c,t)):o.length===0&&a.length===0&&n.length===0&&c.length===0}function wt(r){return r===null||typeof r!="object"}function li(r){return r.map(function(t){return typeof t=="symbol"?t.toString():t})}});var Rt=O((od,mi)=>{var gu=nt();mi.exports=function(){return gu.useProxy&&typeof Proxy<"u"&&typeof Reflect<"u"}});var wi=O((id,bi)=>{var bu=$e(),gi=Ae(),wu=Rt(),vu=Ve();bi.exports=function(e,t,o){o=o===void 0?function(){}:o,Object.defineProperty(e,t,{get:function n(){!wu()&&!gi(this,"lockSsfi")&&gi(this,"ssfi",n);var i=o.call(this);if(i!==void 0)return i;var s=new bu.Assertion;return vu(this,s),s},configurable:!0})}});var zt=O((sd,vi)=>{var xu=Object.getOwnPropertyDescriptor(function(){},"length");vi.exports=function(e,t,o){return xu.configurable&&Object.defineProperty(e,"length",{get:function(){throw Error(o?"Invalid Chai property: "+t+'.length. Due to a compatibility issue, "length" cannot directly follow "'+t+'". Use "'+t+'.lengthOf" instead.':"Invalid Chai property: "+t+'.length. See docs for proper usage of "'+t+'".')}}),e}});var Ei=O((ad,xi)=>{xi.exports=function(e){var t=Object.getOwnPropertyNames(e);function o(i){t.indexOf(i)===-1&&t.push(i)}for(var n=Object.getPrototypeOf(e);n!==null;)Object.getOwnPropertyNames(n).forEach(o),n=Object.getPrototypeOf(n);return t}});var Ft=O((cd,Ti)=>{var Eu=nt(),Ai=Ae(),Au=Ei(),Su=Rt();var Si=["__flags","__methods","_obj","assert"];Ti.exports=function(e,t){return Su()?new Proxy(e,{get:function o(n,i){if(typeof i=="string"&&Eu.proxyExcludedKeys.indexOf(i)===-1&&!Reflect.has(n,i)){if(t)throw Error("Invalid Chai property: "+t+"."+i+'. See docs for proper usage of "'+t+'".');var s=null,a=4;throw Au(n).forEach(function(c){if(!Object.prototype.hasOwnProperty(c)&&Si.indexOf(c)===-1){var u=Tu(i,c,a);u<a&&(s=c,a=u)}}),Error(s!==null?"Invalid Chai property: "+i+'. Did you mean "'+s+'"?':"Invalid Chai property: "+i)}return Si.indexOf(i)===-1&&!Ai(n,"lockSsfi")&&Ai(n,"ssfi",o),Reflect.get(n,i)}}):e};function Tu(r,e,t){if(Math.abs(r.length-e.length)>=t)return t;for(var o=[],n=0;n<=r.length;n++)o[n]=Array(e.length+1).fill(0),o[n][0]=n;for(var i=0;i<e.length;i++)o[0][i]=i;for(var n=1;n<=r.length;n++)for(var s=r.charCodeAt(n-1),i=1;i<=e.length;i++){if(Math.abs(n-i)>=t){o[n][i]=t;continue}o[n][i]=Math.min(o[n-1][i]+1,o[n][i-1]+1,o[n-1][i-1]+(s===e.charCodeAt(i-1)?0:1))}return o[r.length][e.length]}});var Oi=O((ud,Pi)=>{var Nu=zt(),Pu=$e(),Ni=Ae(),Ou=Ft(),Mu=Ve();Pi.exports=function(e,t,o){var n=function(){Ni(this,"lockSsfi")||Ni(this,"ssfi",n);var i=o.apply(this,arguments);if(i!==void 0)return i;var s=new Pu.Assertion;return Mu(this,s),s};Nu(n,t,!1),e[t]=Ou(n,t)}});var Ii=O((fd,Mi)=>{var Iu=$e(),Vt=Ae(),Du=Rt(),_u=Ve();Mi.exports=function(e,t,o){var n=Object.getOwnPropertyDescriptor(e,t),i=function(){};n&&typeof n.get=="function"&&(i=n.get),Object.defineProperty(e,t,{get:function s(){!Du()&&!Vt(this,"lockSsfi")&&Vt(this,"ssfi",s);var a=Vt(this,"lockSsfi");Vt(this,"lockSsfi",!0);var c=o(i).call(this);if(Vt(this,"lockSsfi",a),c!==void 0)return c;var u=new Iu.Assertion;return _u(this,u),u},configurable:!0})}});var _i=O((ld,Di)=>{var Cu=zt(),ju=$e(),$t=Ae(),qu=Ft(),Bu=Ve();Di.exports=function(e,t,o){var n=e[t],i=function(){throw new Error(t+" is not a function")};n&&typeof n=="function"&&(i=n);var s=function(){$t(this,"lockSsfi")||$t(this,"ssfi",s);var a=$t(this,"lockSsfi");$t(this,"lockSsfi",!0);var c=o(i).apply(this,arguments);if($t(this,"lockSsfi",a),c!==void 0)return c;var u=new ju.Assertion;return Bu(this,u),u};Cu(s,t,!1),e[t]=qu(s,t)}});var ki=O((hd,Bi)=>{var ku=zt(),Lu=$e(),Ci=Ae(),Uu=Ft(),ji=Ve();var Ru=typeof Object.setPrototypeOf=="function",qi=function(){},zu=Object.getOwnPropertyNames(qi).filter(function(r){var e=Object.getOwnPropertyDescriptor(qi,r);return typeof e!="object"?!0:!e.configurable}),Fu=Function.prototype.call,Vu=Function.prototype.apply;Bi.exports=function(e,t,o,n){typeof n!="function"&&(n=function(){});var i={method:o,chainingBehavior:n};e.__methods||(e.__methods={}),e.__methods[t]=i,Object.defineProperty(e,t,{get:function(){i.chainingBehavior.call(this);var a=function(){Ci(this,"lockSsfi")||Ci(this,"ssfi",a);var d=i.method.apply(this,arguments);if(d!==void 0)return d;var w=new Lu.Assertion;return ji(this,w),w};if(ku(a,t,!0),Ru){var c=Object.create(this);c.call=Fu,c.apply=Vu,Object.setPrototypeOf(a,c)}else{var u=Object.getOwnPropertyNames(e);u.forEach(function(d){if(zu.indexOf(d)===-1){var w=Object.getOwnPropertyDescriptor(e,d);Object.defineProperty(a,d,w)}})}return ji(this,a),Uu(a)},configurable:!0})}});var zi=O((dd,Ri)=>{var Li=$e(),Ui=Ve();Ri.exports=function(e,t,o,n){var i=e.__methods[t],s=i.chainingBehavior;i.chainingBehavior=function(){var u=n(s).call(this);if(u!==void 0)return u;var d=new Li.Assertion;return Ui(this,d),d};var a=i.method;i.method=function(){var u=o(a).apply(this,arguments);if(u!==void 0)return u;var d=new Li.Assertion;return Ui(this,d),d}}});var $i=O((pd,Vi)=>{var Fi=yr();Vi.exports=function(e,t){return Fi(e)<Fi(t)?-1:1}});var on=O((yd,Wi)=>{Wi.exports=function(e){return typeof Object.getOwnPropertySymbols!="function"?[]:Object.getOwnPropertySymbols(e).filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})}});var Ki=O((md,Gi)=>{var $u=on();Gi.exports=function(e){return Object.keys(e).concat($u(e))}});var an=O((gd,Ji)=>{"use strict";function Wu(r,e){return e instanceof Error&&r===e}function Gu(r,e){return e instanceof Error?r.constructor===e.constructor||r instanceof e.constructor:e.prototype instanceof Error||e===Error?r.constructor===e||r instanceof e:!1}function Ku(r,e){var t=typeof r=="string"?r:r.message;return e instanceof RegExp?e.test(t):typeof e=="string"?t.indexOf(e)!==-1:!1}var Ju=/\s*function(?:\s|\s*\/\*[^(?:*\/)]+\*\/\s*)*([^\(\/]+)/;function sn(r){var e="";if(typeof r.name>"u"){var t=String(r).match(Ju);t&&(e=t[1])}else e=r.name;return e}function Xu(r){var e=r;return r instanceof Error?e=sn(r.constructor):typeof r=="function"&&(e=sn(r).trim()||sn(new r)),e}function Qu(r){var e="";return r&&r.message?e=r.message:typeof r=="string"&&(e=r),e}Ji.exports={compatibleInstance:Wu,compatibleConstructor:Gu,compatibleMessage:Ku,getMessage:Qu,getConstructorName:Xu}});var Qi=O((bd,Xi)=>{function Zu(r){return r!==r}Xi.exports=Number.isNaN||Zu});var Hi=O((wd,Yi)=>{var Yu=Ut(),Zi=Ae();function Hu(r){var e=Yu(r),t=["Array","Object","function"];return t.indexOf(e)!==-1}Yi.exports=function(e,t){var o=Zi(e,"operator"),n=Zi(e,"negate"),i=t[3],s=n?t[2]:t[1];if(o)return o;if(typeof s=="function"&&(s=s()),s=s||"",!!s&&!/\shave\s/.test(s)){var a=Hu(i);return/\snot\s/.test(s)?a?"notDeepStrictEqual":"notStrictEqual":a?"deepStrictEqual":"strictEqual"}}});var ts=O(J=>{var es=Ro();J.test=Vo();J.type=Ut();J.expectTypes=Wo();J.getMessage=ri();J.getActual=Qr();J.inspect=yr();J.objDisplay=Yr();J.flag=Ae();J.transferFlags=Ve();J.eql=yi();J.getPathInfo=es.getPathInfo;J.hasProperty=es.hasProperty;J.getName=Zr();J.addProperty=wi();J.addMethod=Oi();J.overwriteProperty=Ii();J.overwriteMethod=_i();J.addChainableMethod=ki();J.overwriteChainableMethod=zi();J.compareByInspect=$i();J.getOwnEnumerablePropertySymbols=on();J.getOwnEnumerableProperties=Ki();J.checkError=an();J.proxify=Ft();J.addLengthGuard=zt();J.isProxyEnabled=Rt();J.isNaN=Qi();J.getOperator=Hi()});var ns=O((xd,rs)=>{var vt=nt();rs.exports=function(r,e){var t=r.AssertionError,o=e.flag;r.Assertion=n;function n(i,s,a,c){return o(this,"ssfi",a||n),o(this,"lockSsfi",c),o(this,"object",i),o(this,"message",s),e.proxify(this)}Object.defineProperty(n,"includeStack",{get:function(){return console.warn("Assertion.includeStack is deprecated, use chai.config.includeStack instead."),vt.includeStack},set:function(i){console.warn("Assertion.includeStack is deprecated, use chai.config.includeStack instead."),vt.includeStack=i}}),Object.defineProperty(n,"showDiff",{get:function(){return console.warn("Assertion.showDiff is deprecated, use chai.config.showDiff instead."),vt.showDiff},set:function(i){console.warn("Assertion.showDiff is deprecated, use chai.config.showDiff instead."),vt.showDiff=i}}),n.addProperty=function(i,s){e.addProperty(this.prototype,i,s)},n.addMethod=function(i,s){e.addMethod(this.prototype,i,s)},n.addChainableMethod=function(i,s,a){e.addChainableMethod(this.prototype,i,s,a)},n.overwriteProperty=function(i,s){e.overwriteProperty(this.prototype,i,s)},n.overwriteMethod=function(i,s){e.overwriteMethod(this.prototype,i,s)},n.overwriteChainableMethod=function(i,s,a){e.overwriteChainableMethod(this.prototype,i,s,a)},n.prototype.assert=function(i,s,a,c,u,d){var w=e.test(this,arguments);if(d!==!1&&(d=!0),c===void 0&&u===void 0&&(d=!1),vt.showDiff!==!0&&(d=!1),!w){s=e.getMessage(this,arguments);var B=e.getActual(this,arguments),k={actual:B,expected:c,showDiff:d},N=e.getOperator(this,arguments);throw N&&(k.operator=N),new t(s,k,vt.includeStack?this.assert:o(this,"ssfi"))}};Object.defineProperty(n.prototype,"_obj",{get:function(){return o(this,"object")},set:function(i){o(this,"object",i)}})}});var is=O((Ed,os)=>{os.exports=function(r,e){var t=r.Assertion,o=r.AssertionError,n=e.flag;["to","be","been","is","and","has","have","with","that","which","at","of","same","but","does","still","also"].forEach(function(f){t.addProperty(f)}),t.addProperty("not",function(){n(this,"negate",!0)}),t.addProperty("deep",function(){n(this,"deep",!0)}),t.addProperty("nested",function(){n(this,"nested",!0)}),t.addProperty("own",function(){n(this,"own",!0)}),t.addProperty("ordered",function(){n(this,"ordered",!0)}),t.addProperty("any",function(){n(this,"any",!0),n(this,"all",!1)}),t.addProperty("all",function(){n(this,"all",!0),n(this,"any",!1)});function i(f,p){p&&n(this,"message",p),f=f.toLowerCase();var g=n(this,"object"),v=~["a","e","i","o","u"].indexOf(f.charAt(0))?"an ":"a ";this.assert(f===e.type(g).toLowerCase(),"expected #{this} to be "+v+f,"expected #{this} not to be "+v+f)}t.addChainableMethod("an",i),t.addChainableMethod("a",i);function s(f,p){return e.isNaN(f)&&e.isNaN(p)||f===p}function a(){n(this,"contains",!0)}function c(f,p){p&&n(this,"message",p);var g=n(this,"object"),v=e.type(g).toLowerCase(),A=n(this,"message"),T=n(this,"negate"),x=n(this,"ssfi"),m=n(this,"deep"),M=m?"deep ":"";A=A?A+": ":"";var j=!1;switch(v){case"string":j=g.indexOf(f)!==-1;break;case"weakset":if(m)throw new o(A+"unable to use .deep.include with WeakSet",void 0,x);j=g.has(f);break;case"map":var F=m?e.eql:s;g.forEach(function(G){j=j||F(G,f)});break;case"set":m?g.forEach(function(G){j=j||e.eql(G,f)}):j=g.has(f);break;case"array":m?j=g.some(function(G){return e.eql(G,f)}):j=g.indexOf(f)!==-1;break;default:if(f!==Object(f))throw new o(A+"the given combination of arguments ("+v+" and "+e.type(f).toLowerCase()+") is invalid for this assertion. You can use an array, a map, an object, a set, a string, or a weakset instead of a "+e.type(f).toLowerCase(),void 0,x);var X=Object.keys(f),z=null,L=0;if(X.forEach(function(G){var ie=new t(g);if(e.transferFlags(this,ie,!0),n(ie,"lockSsfi",!0),!T||X.length===1){ie.property(G,f[G]);return}try{ie.property(G,f[G])}catch(le){if(!e.checkError.compatibleConstructor(le,o))throw le;z===null&&(z=le),L++}},this),T&&X.length>1&&L===X.length)throw z;return}this.assert(j,"expected #{this} to "+M+"include "+e.inspect(f),"expected #{this} to not "+M+"include "+e.inspect(f))}t.addChainableMethod("include",c,a),t.addChainableMethod("contain",c,a),t.addChainableMethod("contains",c,a),t.addChainableMethod("includes",c,a),t.addProperty("ok",function(){this.assert(n(this,"object"),"expected #{this} to be truthy","expected #{this} to be falsy")}),t.addProperty("true",function(){this.assert(n(this,"object")===!0,"expected #{this} to be true","expected #{this} to be false",!n(this,"negate"))}),t.addProperty("false",function(){this.assert(n(this,"object")===!1,"expected #{this} to be false","expected #{this} to be true",!!n(this,"negate"))}),t.addProperty("null",function(){this.assert(n(this,"object")===null,"expected #{this} to be null","expected #{this} not to be null")}),t.addProperty("undefined",function(){this.assert(n(this,"object")===void 0,"expected #{this} to be undefined","expected #{this} not to be undefined")}),t.addProperty("NaN",function(){this.assert(e.isNaN(n(this,"object")),"expected #{this} to be NaN","expected #{this} not to be NaN")});function u(){var f=n(this,"object");this.assert(f!=null,"expected #{this} to exist","expected #{this} to not exist")}t.addProperty("exist",u),t.addProperty("exists",u),t.addProperty("empty",function(){var f=n(this,"object"),p=n(this,"ssfi"),g=n(this,"message"),v;switch(g=g?g+": ":"",e.type(f).toLowerCase()){case"array":case"string":v=f.length;break;case"map":case"set":v=f.size;break;case"weakmap":case"weakset":throw new o(g+".empty was passed a weak collection",void 0,p);case"function":var A=g+".empty was passed a function "+e.getName(f);throw new o(A.trim(),void 0,p);default:if(f!==Object(f))throw new o(g+".empty was passed non-string primitive "+e.inspect(f),void 0,p);v=Object.keys(f).length}this.assert(v===0,"expected #{this} to be empty","expected #{this} not to be empty")});function d(){var f=n(this,"object"),p=e.type(f);this.assert(p==="Arguments","expected #{this} to be arguments but got "+p,"expected #{this} to not be arguments")}t.addProperty("arguments",d),t.addProperty("Arguments",d);function w(f,p){p&&n(this,"message",p);var g=n(this,"object");if(n(this,"deep")){var v=n(this,"lockSsfi");n(this,"lockSsfi",!0),this.eql(f),n(this,"lockSsfi",v)}else this.assert(f===g,"expected #{this} to equal #{exp}","expected #{this} to not equal #{exp}",f,this._obj,!0)}t.addMethod("equal",w),t.addMethod("equals",w),t.addMethod("eq",w);function B(f,p){p&&n(this,"message",p),this.assert(e.eql(f,n(this,"object")),"expected #{this} to deeply equal #{exp}","expected #{this} to not deeply equal #{exp}",f,this._obj,!0)}t.addMethod("eql",B),t.addMethod("eqls",B);function k(f,p){p&&n(this,"message",p);var g=n(this,"object"),v=n(this,"doLength"),A=n(this,"message"),T=A?A+": ":"",x=n(this,"ssfi"),m=e.type(g).toLowerCase(),M=e.type(f).toLowerCase(),j,F=!0;if(v&&m!=="map"&&m!=="set"&&new t(g,A,x,!0).to.have.property("length"),!v&&m==="date"&&M!=="date")j=T+"the argument to above must be a date";else if(M!=="number"&&(v||m==="number"))j=T+"the argument to above must be a number";else if(!v&&m!=="date"&&m!=="number"){var X=m==="string"?"'"+g+"'":g;j=T+"expected "+X+" to be a number or a date"}else F=!1;if(F)throw new o(j,void 0,x);if(v){var z="length",L;m==="map"||m==="set"?(z="size",L=g.size):L=g.length,this.assert(L>f,"expected #{this} to have a "+z+" above #{exp} but got #{act}","expected #{this} to not have a "+z+" above #{exp}",f,L)}else this.assert(g>f,"expected #{this} to be above #{exp}","expected #{this} to be at most #{exp}",f)}t.addMethod("above",k),t.addMethod("gt",k),t.addMethod("greaterThan",k);function N(f,p){p&&n(this,"message",p);var g=n(this,"object"),v=n(this,"doLength"),A=n(this,"message"),T=A?A+": ":"",x=n(this,"ssfi"),m=e.type(g).toLowerCase(),M=e.type(f).toLowerCase(),j,F=!0;if(v&&m!=="map"&&m!=="set"&&new t(g,A,x,!0).to.have.property("length"),!v&&m==="date"&&M!=="date")j=T+"the argument to least must be a date";else if(M!=="number"&&(v||m==="number"))j=T+"the argument to least must be a number";else if(!v&&m!=="date"&&m!=="number"){var X=m==="string"?"'"+g+"'":g;j=T+"expected "+X+" to be a number or a date"}else F=!1;if(F)throw new o(j,void 0,x);if(v){var z="length",L;m==="map"||m==="set"?(z="size",L=g.size):L=g.length,this.assert(L>=f,"expected #{this} to have a "+z+" at least #{exp} but got #{act}","expected #{this} to have a "+z+" below #{exp}",f,L)}else this.assert(g>=f,"expected #{this} to be at least #{exp}","expected #{this} to be below #{exp}",f)}t.addMethod("least",N),t.addMethod("gte",N),t.addMethod("greaterThanOrEqual",N);function E(f,p){p&&n(this,"message",p);var g=n(this,"object"),v=n(this,"doLength"),A=n(this,"message"),T=A?A+": ":"",x=n(this,"ssfi"),m=e.type(g).toLowerCase(),M=e.type(f).toLowerCase(),j,F=!0;if(v&&m!=="map"&&m!=="set"&&new t(g,A,x,!0).to.have.property("length"),!v&&m==="date"&&M!=="date")j=T+"the argument to below must be a date";else if(M!=="number"&&(v||m==="number"))j=T+"the argument to below must be a number";else if(!v&&m!=="date"&&m!=="number"){var X=m==="string"?"'"+g+"'":g;j=T+"expected "+X+" to be a number or a date"}else F=!1;if(F)throw new o(j,void 0,x);if(v){var z="length",L;m==="map"||m==="set"?(z="size",L=g.size):L=g.length,this.assert(L<f,"expected #{this} to have a "+z+" below #{exp} but got #{act}","expected #{this} to not have a "+z+" below #{exp}",f,L)}else this.assert(g<f,"expected #{this} to be below #{exp}","expected #{this} to be at least #{exp}",f)}t.addMethod("below",E),t.addMethod("lt",E),t.addMethod("lessThan",E);function I(f,p){p&&n(this,"message",p);var g=n(this,"object"),v=n(this,"doLength"),A=n(this,"message"),T=A?A+": ":"",x=n(this,"ssfi"),m=e.type(g).toLowerCase(),M=e.type(f).toLowerCase(),j,F=!0;if(v&&m!=="map"&&m!=="set"&&new t(g,A,x,!0).to.have.property("length"),!v&&m==="date"&&M!=="date")j=T+"the argument to most must be a date";else if(M!=="number"&&(v||m==="number"))j=T+"the argument to most must be a number";else if(!v&&m!=="date"&&m!=="number"){var X=m==="string"?"'"+g+"'":g;j=T+"expected "+X+" to be a number or a date"}else F=!1;if(F)throw new o(j,void 0,x);if(v){var z="length",L;m==="map"||m==="set"?(z="size",L=g.size):L=g.length,this.assert(L<=f,"expected #{this} to have a "+z+" at most #{exp} but got #{act}","expected #{this} to have a "+z+" above #{exp}",f,L)}else this.assert(g<=f,"expected #{this} to be at most #{exp}","expected #{this} to be above #{exp}",f)}t.addMethod("most",I),t.addMethod("lte",I),t.addMethod("lessThanOrEqual",I),t.addMethod("within",function(f,p,g){g&&n(this,"message",g);var v=n(this,"object"),A=n(this,"doLength"),T=n(this,"message"),x=T?T+": ":"",m=n(this,"ssfi"),M=e.type(v).toLowerCase(),j=e.type(f).toLowerCase(),F=e.type(p).toLowerCase(),X,z=!0,L=j==="date"&&F==="date"?f.toISOString()+".."+p.toISOString():f+".."+p;if(A&&M!=="map"&&M!=="set"&&new t(v,T,m,!0).to.have.property("length"),!A&&M==="date"&&(j!=="date"||F!=="date"))X=x+"the arguments to within must be dates";else if((j!=="number"||F!=="number")&&(A||M==="number"))X=x+"the arguments to within must be numbers";else if(!A&&M!=="date"&&M!=="number"){var G=M==="string"?"'"+v+"'":v;X=x+"expected "+G+" to be a number or a date"}else z=!1;if(z)throw new o(X,void 0,m);if(A){var ie="length",le;M==="map"||M==="set"?(ie="size",le=v.size):le=v.length,this.assert(le>=f&&le<=p,"expected #{this} to have a "+ie+" within "+L,"expected #{this} to not have a "+ie+" within "+L)}else this.assert(v>=f&&v<=p,"expected #{this} to be within "+L,"expected #{this} to not be within "+L)});function q(f,p){p&&n(this,"message",p);var g=n(this,"object"),v=n(this,"ssfi"),A=n(this,"message");try{var T=g instanceof f}catch(m){throw m instanceof TypeError?(A=A?A+": ":"",new o(A+"The instanceof assertion needs a constructor but "+e.type(f)+" was given.",void 0,v)):m}var x=e.getName(f);x===null&&(x="an unnamed constructor"),this.assert(T,"expected #{this} to be an instance of "+x,"expected #{this} to not be an instance of "+x)}t.addMethod("instanceof",q),t.addMethod("instanceOf",q);function $(f,p,g){g&&n(this,"message",g);var v=n(this,"nested"),A=n(this,"own"),T=n(this,"message"),x=n(this,"object"),m=n(this,"ssfi"),M=typeof f;if(T=T?T+": ":"",v){if(M!=="string")throw new o(T+"the argument to property must be a string when using nested syntax",void 0,m)}else if(M!=="string"&&M!=="number"&&M!=="symbol")throw new o(T+"the argument to property must be a string, number, or symbol",void 0,m);if(v&&A)throw new o(T+'The "nested" and "own" flags cannot be combined.',void 0,m);if(x==null)throw new o(T+"Target cannot be null or undefined.",void 0,m);var j=n(this,"deep"),F=n(this,"negate"),X=v?e.getPathInfo(x,f):null,z=v?X.value:x[f],L="";j&&(L+="deep "),A&&(L+="own "),v&&(L+="nested "),L+="property ";var G;A?G=Object.prototype.hasOwnProperty.call(x,f):v?G=X.exists:G=e.hasProperty(x,f),(!F||arguments.length===1)&&this.assert(G,"expected #{this} to have "+L+e.inspect(f),"expected #{this} to not have "+L+e.inspect(f)),arguments.length>1&&this.assert(G&&(j?e.eql(p,z):p===z),"expected #{this} to have "+L+e.inspect(f)+" of #{exp}, but got #{act}","expected #{this} to not have "+L+e.inspect(f)+" of #{act}",p,z),n(this,"object",z)}t.addMethod("property",$);function Q(f,p,g){n(this,"own",!0),$.apply(this,arguments)}t.addMethod("ownProperty",Q),t.addMethod("haveOwnProperty",Q);function te(f,p,g){typeof p=="string"&&(g=p,p=null),g&&n(this,"message",g);var v=n(this,"object"),A=Object.getOwnPropertyDescriptor(Object(v),f);A&&p?this.assert(e.eql(p,A),"expected the own property descriptor for "+e.inspect(f)+" on #{this} to match "+e.inspect(p)+", got "+e.inspect(A),"expected the own property descriptor for "+e.inspect(f)+" on #{this} to not match "+e.inspect(p),p,A,!0):this.assert(A,"expected #{this} to have an own property descriptor for "+e.inspect(f),"expected #{this} to not have an own property descriptor for "+e.inspect(f)),n(this,"object",A)}t.addMethod("ownPropertyDescriptor",te),t.addMethod("haveOwnPropertyDescriptor",te);function y(){n(this,"doLength",!0)}function S(f,p){p&&n(this,"message",p);var g=n(this,"object"),v=e.type(g).toLowerCase(),A=n(this,"message"),T=n(this,"ssfi"),x="length",m;switch(v){case"map":case"set":x="size",m=g.size;break;default:new t(g,A,T,!0).to.have.property("length"),m=g.length}this.assert(m==f,"expected #{this} to have a "+x+" of #{exp} but got #{act}","expected #{this} to not have a "+x+" of #{act}",f,m)}t.addChainableMethod("length",S,y),t.addChainableMethod("lengthOf",S,y);function C(f,p){p&&n(this,"message",p);var g=n(this,"object");this.assert(f.exec(g),"expected #{this} to match "+f,"expected #{this} not to match "+f)}t.addMethod("match",C),t.addMethod("matches",C),t.addMethod("string",function(f,p){p&&n(this,"message",p);var g=n(this,"object"),v=n(this,"message"),A=n(this,"ssfi");new t(g,v,A,!0).is.a("string"),this.assert(~g.indexOf(f),"expected #{this} to contain "+e.inspect(f),"expected #{this} to not contain "+e.inspect(f))});function U(f){var p=n(this,"object"),g=e.type(p),v=e.type(f),A=n(this,"ssfi"),T=n(this,"deep"),x,m="",M,j=!0,F=n(this,"message");F=F?F+": ":"";var X=F+"when testing keys against an object or an array you must give a single Array|Object|String argument or multiple String arguments";if(g==="Map"||g==="Set")m=T?"deeply ":"",M=[],p.forEach(function(ce,Be){M.push(Be)}),v!=="Array"&&(f=Array.prototype.slice.call(arguments));else{switch(M=e.getOwnEnumerableProperties(p),v){case"Array":if(arguments.length>1)throw new o(X,void 0,A);break;case"Object":if(arguments.length>1)throw new o(X,void 0,A);f=Object.keys(f);break;default:f=Array.prototype.slice.call(arguments)}f=f.map(function(ce){return typeof ce=="symbol"?ce:String(ce)})}if(!f.length)throw new o(F+"keys required",void 0,A);var z=f.length,L=n(this,"any"),G=n(this,"all"),ie=f;if(!L&&!G&&(G=!0),L&&(j=ie.some(function(ce){return M.some(function(Be){return T?e.eql(ce,Be):ce===Be})})),G&&(j=ie.every(function(ce){return M.some(function(Be){return T?e.eql(ce,Be):ce===Be})}),n(this,"contains")||(j=j&&f.length==M.length)),z>1){f=f.map(function(ce){return e.inspect(ce)});var le=f.pop();G&&(x=f.join(", ")+", and "+le),L&&(x=f.join(", ")+", or "+le)}else x=e.inspect(f[0]);x=(z>1?"keys ":"key ")+x,x=(n(this,"contains")?"contain ":"have ")+x,this.assert(j,"expected #{this} to "+m+x,"expected #{this} to not "+m+x,ie.slice(0).sort(e.compareByInspect),M.sort(e.compareByInspect),!0)}t.addMethod("keys",U),t.addMethod("key",U);function re(f,p,g){g&&n(this,"message",g);var v=n(this,"object"),A=n(this,"ssfi"),T=n(this,"message"),x=n(this,"negate")||!1;new t(v,T,A,!0).is.a("function"),(f instanceof RegExp||typeof f=="string")&&(p=f,f=null);var m;try{v()}catch(ce){m=ce}var M=f===void 0&&p===void 0,j=Boolean(f&&p),F=!1,X=!1;if(M||!M&&!x){var z="an error";f instanceof Error?z="#{exp}":f&&(z=e.checkError.getConstructorName(f)),this.assert(m,"expected #{this} to throw "+z,"expected #{this} to not throw an error but #{act} was thrown",f&&f.toString(),m instanceof Error?m.toString():typeof m=="string"?m:m&&e.checkError.getConstructorName(m))}if(f&&m){if(f instanceof Error){var L=e.checkError.compatibleInstance(m,f);L===x&&(j&&x?F=!0:this.assert(x,"expected #{this} to throw #{exp} but #{act} was thrown","expected #{this} to not throw #{exp}"+(m&&!x?" but #{act} was thrown":""),f.toString(),m.toString()))}var G=e.checkError.compatibleConstructor(m,f);G===x&&(j&&x?F=!0:this.assert(x,"expected #{this} to throw #{exp} but #{act} was thrown","expected #{this} to not throw #{exp}"+(m?" but #{act} was thrown":""),f instanceof Error?f.toString():f&&e.checkError.getConstructorName(f),m instanceof Error?m.toString():m&&e.checkError.getConstructorName(m)))}if(m&&p!==void 0&&p!==null){var ie="including";p instanceof RegExp&&(ie="matching");var le=e.checkError.compatibleMessage(m,p);le===x&&(j&&x?X=!0:this.assert(x,"expected #{this} to throw error "+ie+" #{exp} but got #{act}","expected #{this} to throw error not "+ie+" #{exp}",p,e.checkError.getMessage(m)))}F&&X&&this.assert(x,"expected #{this} to throw #{exp} but #{act} was thrown","expected #{this} to not throw #{exp}"+(m?" but #{act} was thrown":""),f instanceof Error?f.toString():f&&e.checkError.getConstructorName(f),m instanceof Error?m.toString():m&&e.checkError.getConstructorName(m)),n(this,"object",m)}t.addMethod("throw",re),t.addMethod("throws",re),t.addMethod("Throw",re);function De(f,p){p&&n(this,"message",p);var g=n(this,"object"),v=n(this,"itself"),A=typeof g=="function"&&!v?g.prototype[f]:g[f];this.assert(typeof A=="function","expected #{this} to respond to "+e.inspect(f),"expected #{this} to not respond to "+e.inspect(f))}t.addMethod("respondTo",De),t.addMethod("respondsTo",De),t.addProperty("itself",function(){n(this,"itself",!0)});function fe(f,p){p&&n(this,"message",p);var g=n(this,"object"),v=f(g);this.assert(v,"expected #{this} to satisfy "+e.objDisplay(f),"expected #{this} to not satisfy"+e.objDisplay(f),!n(this,"negate"),v)}t.addMethod("satisfy",fe),t.addMethod("satisfies",fe);function mt(f,p,g){g&&n(this,"message",g);var v=n(this,"object"),A=n(this,"message"),T=n(this,"ssfi");if(new t(v,A,T,!0).is.a("number"),typeof f!="number"||typeof p!="number"){A=A?A+": ":"";var x=p===void 0?", and a delta is required":"";throw new o(A+"the arguments to closeTo or approximately must be numbers"+x,void 0,T)}this.assert(Math.abs(v-f)<=p,"expected #{this} to be close to "+f+" +/- "+p,"expected #{this} not to be close to "+f+" +/- "+p)}t.addMethod("closeTo",mt),t.addMethod("approximately",mt);function ge(f,p,g,v,A){if(!v){if(f.length!==p.length)return!1;p=p.slice()}return f.every(function(T,x){if(A)return g?g(T,p[x]):T===p[x];if(!g){var m=p.indexOf(T);return m===-1?!1:(v||p.splice(m,1),!0)}return p.some(function(M,j){return g(T,M)?(v||p.splice(j,1),!0):!1})})}t.addMethod("members",function(f,p){p&&n(this,"message",p);var g=n(this,"object"),v=n(this,"message"),A=n(this,"ssfi");new t(g,v,A,!0).to.be.an("array"),new t(f,v,A,!0).to.be.an("array");var T=n(this,"contains"),x=n(this,"ordered"),m,M,j;T?(m=x?"an ordered superset":"a superset",M="expected #{this} to be "+m+" of #{exp}",j="expected #{this} to not be "+m+" of #{exp}"):(m=x?"ordered members":"members",M="expected #{this} to have the same "+m+" as #{exp}",j="expected #{this} to not have the same "+m+" as #{exp}");var F=n(this,"deep")?e.eql:void 0;this.assert(ge(f,g,F,T,x),M,j,f,g,!0)});function Oe(f,p){p&&n(this,"message",p);var g=n(this,"object"),v=n(this,"message"),A=n(this,"ssfi"),T=n(this,"contains"),x=n(this,"deep");new t(f,v,A,!0).to.be.an("array"),T?this.assert(f.some(function(m){return g.indexOf(m)>-1}),"expected #{this} to contain one of #{exp}","expected #{this} to not contain one of #{exp}",f,g):x?this.assert(f.some(function(m){return e.eql(g,m)}),"expected #{this} to deeply equal one of #{exp}","expected #{this} to deeply equal one of #{exp}",f,g):this.assert(f.indexOf(g)>-1,"expected #{this} to be one of #{exp}","expected #{this} to not be one of #{exp}",f,g)}t.addMethod("oneOf",Oe);function xe(f,p,g){g&&n(this,"message",g);var v=n(this,"object"),A=n(this,"message"),T=n(this,"ssfi");new t(v,A,T,!0).is.a("function");var x;p?(new t(f,A,T,!0).to.have.property(p),x=f[p]):(new t(f,A,T,!0).is.a("function"),x=f()),v();var m=p==null?f():f[p],M=p==null?x:"."+p;n(this,"deltaMsgObj",M),n(this,"initialDeltaValue",x),n(this,"finalDeltaValue",m),n(this,"deltaBehavior","change"),n(this,"realDelta",m!==x),this.assert(x!==m,"expected "+M+" to change","expected "+M+" to not change")}t.addMethod("change",xe),t.addMethod("changes",xe);function et(f,p,g){g&&n(this,"message",g);var v=n(this,"object"),A=n(this,"message"),T=n(this,"ssfi");new t(v,A,T,!0).is.a("function");var x;p?(new t(f,A,T,!0).to.have.property(p),x=f[p]):(new t(f,A,T,!0).is.a("function"),x=f()),new t(x,A,T,!0).is.a("number"),v();var m=p==null?f():f[p],M=p==null?x:"."+p;n(this,"deltaMsgObj",M),n(this,"initialDeltaValue",x),n(this,"finalDeltaValue",m),n(this,"deltaBehavior","increase"),n(this,"realDelta",m-x),this.assert(m-x>0,"expected "+M+" to increase","expected "+M+" to not increase")}t.addMethod("increase",et),t.addMethod("increases",et);function cr(f,p,g){g&&n(this,"message",g);var v=n(this,"object"),A=n(this,"message"),T=n(this,"ssfi");new t(v,A,T,!0).is.a("function");var x;p?(new t(f,A,T,!0).to.have.property(p),x=f[p]):(new t(f,A,T,!0).is.a("function"),x=f()),new t(x,A,T,!0).is.a("number"),v();var m=p==null?f():f[p],M=p==null?x:"."+p;n(this,"deltaMsgObj",M),n(this,"initialDeltaValue",x),n(this,"finalDeltaValue",m),n(this,"deltaBehavior","decrease"),n(this,"realDelta",x-m),this.assert(m-x<0,"expected "+M+" to decrease","expected "+M+" to not decrease")}t.addMethod("decrease",cr),t.addMethod("decreases",cr);function Fr(f,p){p&&n(this,"message",p);var g=n(this,"deltaMsgObj"),v=n(this,"initialDeltaValue"),A=n(this,"finalDeltaValue"),T=n(this,"deltaBehavior"),x=n(this,"realDelta"),m;T==="change"?m=Math.abs(A-v)===Math.abs(f):m=x===Math.abs(f),this.assert(m,"expected "+g+" to "+T+" by "+f,"expected "+g+" to not "+T+" by "+f)}t.addMethod("by",Fr),t.addProperty("extensible",function(){var f=n(this,"object"),p=f===Object(f)&&Object.isExtensible(f);this.assert(p,"expected #{this} to be extensible","expected #{this} to not be extensible")}),t.addProperty("sealed",function(){var f=n(this,"object"),p=f===Object(f)?Object.isSealed(f):!0;this.assert(p,"expected #{this} to be sealed","expected #{this} to not be sealed")}),t.addProperty("frozen",function(){var f=n(this,"object"),p=f===Object(f)?Object.isFrozen(f):!0;this.assert(p,"expected #{this} to be frozen","expected #{this} to not be frozen")}),t.addProperty("finite",function(f){var p=n(this,"object");this.assert(typeof p=="number"&&isFinite(p),"expected #{this} to be a finite number","expected #{this} to not be a finite number")})}});var as=O((Ad,ss)=>{ss.exports=function(r,e){r.expect=function(t,o){return new r.Assertion(t,o)},r.expect.fail=function(t,o,n,i){throw arguments.length<2&&(n=t,t=void 0),n=n||"expect.fail()",new r.AssertionError(n,{actual:t,expected:o,operator:i},r.expect.fail)}}});var us=O((Sd,cs)=>{cs.exports=function(r,e){var t=r.Assertion;function o(){function n(){return this instanceof String||this instanceof Number||this instanceof Boolean||typeof Symbol=="function"&&this instanceof Symbol||typeof BigInt=="function"&&this instanceof BigInt?new t(this.valueOf(),null,n):new t(this,null,n)}function i(a){Object.defineProperty(this,"should",{value:a,enumerable:!0,configurable:!0,writable:!0})}Object.defineProperty(Object.prototype,"should",{set:i,get:n,configurable:!0});var s={};return s.fail=function(a,c,u,d){throw arguments.length<2&&(u=a,a=void 0),u=u||"should.fail()",new r.AssertionError(u,{actual:a,expected:c,operator:d},s.fail)},s.equal=function(a,c,u){new t(a,u).to.equal(c)},s.Throw=function(a,c,u,d){new t(a,d).to.Throw(c,u)},s.exist=function(a,c){new t(a,c).to.exist},s.not={},s.not.equal=function(a,c,u){new t(a,u).to.not.equal(c)},s.not.Throw=function(a,c,u,d){new t(a,d).to.not.Throw(c,u)},s.not.exist=function(a,c){new t(a,c).to.not.exist},s.throw=s.Throw,s.not.throw=s.not.Throw,s}r.should=o,r.Should=o}});var ls=O((Td,fs)=>{fs.exports=function(r,e){var t=r.Assertion,o=e.flag;var n=r.assert=function(i,s){var a=new t(null,null,r.assert,!0);a.assert(i,s,"[ negation message unavailable ]")};n.fail=function(i,s,a,c){throw arguments.length<2&&(a=i,i=void 0),a=a||"assert.fail()",new r.AssertionError(a,{actual:i,expected:s,operator:c},n.fail)},n.isOk=function(i,s){new t(i,s,n.isOk,!0).is.ok},n.isNotOk=function(i,s){new t(i,s,n.isNotOk,!0).is.not.ok},n.equal=function(i,s,a){var c=new t(i,a,n.equal,!0);c.assert(s==o(c,"object"),"expected #{this} to equal #{exp}","expected #{this} to not equal #{act}",s,i,!0)},n.notEqual=function(i,s,a){var c=new t(i,a,n.notEqual,!0);c.assert(s!=o(c,"object"),"expected #{this} to not equal #{exp}","expected #{this} to equal #{act}",s,i,!0)},n.strictEqual=function(i,s,a){new t(i,a,n.strictEqual,!0).to.equal(s)},n.notStrictEqual=function(i,s,a){new t(i,a,n.notStrictEqual,!0).to.not.equal(s)},n.deepEqual=n.deepStrictEqual=function(i,s,a){new t(i,a,n.deepEqual,!0).to.eql(s)},n.notDeepEqual=function(i,s,a){new t(i,a,n.notDeepEqual,!0).to.not.eql(s)},n.isAbove=function(i,s,a){new t(i,a,n.isAbove,!0).to.be.above(s)},n.isAtLeast=function(i,s,a){new t(i,a,n.isAtLeast,!0).to.be.least(s)},n.isBelow=function(i,s,a){new t(i,a,n.isBelow,!0).to.be.below(s)},n.isAtMost=function(i,s,a){new t(i,a,n.isAtMost,!0).to.be.most(s)},n.isTrue=function(i,s){new t(i,s,n.isTrue,!0).is.true},n.isNotTrue=function(i,s){new t(i,s,n.isNotTrue,!0).to.not.equal(!0)},n.isFalse=function(i,s){new t(i,s,n.isFalse,!0).is.false},n.isNotFalse=function(i,s){new t(i,s,n.isNotFalse,!0).to.not.equal(!1)},n.isNull=function(i,s){new t(i,s,n.isNull,!0).to.equal(null)},n.isNotNull=function(i,s){new t(i,s,n.isNotNull,!0).to.not.equal(null)},n.isNaN=function(i,s){new t(i,s,n.isNaN,!0).to.be.NaN},n.isNotNaN=function(i,s){new t(i,s,n.isNotNaN,!0).not.to.be.NaN},n.exists=function(i,s){new t(i,s,n.exists,!0).to.exist},n.notExists=function(i,s){new t(i,s,n.notExists,!0).to.not.exist},n.isUndefined=function(i,s){new t(i,s,n.isUndefined,!0).to.equal(void 0)},n.isDefined=function(i,s){new t(i,s,n.isDefined,!0).to.not.equal(void 0)},n.isFunction=function(i,s){new t(i,s,n.isFunction,!0).to.be.a("function")},n.isNotFunction=function(i,s){new t(i,s,n.isNotFunction,!0).to.not.be.a("function")},n.isObject=function(i,s){new t(i,s,n.isObject,!0).to.be.a("object")},n.isNotObject=function(i,s){new t(i,s,n.isNotObject,!0).to.not.be.a("object")},n.isArray=function(i,s){new t(i,s,n.isArray,!0).to.be.an("array")},n.isNotArray=function(i,s){new t(i,s,n.isNotArray,!0).to.not.be.an("array")},n.isString=function(i,s){new t(i,s,n.isString,!0).to.be.a("string")},n.isNotString=function(i,s){new t(i,s,n.isNotString,!0).to.not.be.a("string")},n.isNumber=function(i,s){new t(i,s,n.isNumber,!0).to.be.a("number")},n.isNotNumber=function(i,s){new t(i,s,n.isNotNumber,!0).to.not.be.a("number")},n.isFinite=function(i,s){new t(i,s,n.isFinite,!0).to.be.finite},n.isBoolean=function(i,s){new t(i,s,n.isBoolean,!0).to.be.a("boolean")},n.isNotBoolean=function(i,s){new t(i,s,n.isNotBoolean,!0).to.not.be.a("boolean")},n.typeOf=function(i,s,a){new t(i,a,n.typeOf,!0).to.be.a(s)},n.notTypeOf=function(i,s,a){new t(i,a,n.notTypeOf,!0).to.not.be.a(s)},n.instanceOf=function(i,s,a){new t(i,a,n.instanceOf,!0).to.be.instanceOf(s)},n.notInstanceOf=function(i,s,a){new t(i,a,n.notInstanceOf,!0).to.not.be.instanceOf(s)},n.include=function(i,s,a){new t(i,a,n.include,!0).include(s)},n.notInclude=function(i,s,a){new t(i,a,n.notInclude,!0).not.include(s)},n.deepInclude=function(i,s,a){new t(i,a,n.deepInclude,!0).deep.include(s)},n.notDeepInclude=function(i,s,a){new t(i,a,n.notDeepInclude,!0).not.deep.include(s)},n.nestedInclude=function(i,s,a){new t(i,a,n.nestedInclude,!0).nested.include(s)},n.notNestedInclude=function(i,s,a){new t(i,a,n.notNestedInclude,!0).not.nested.include(s)},n.deepNestedInclude=function(i,s,a){new t(i,a,n.deepNestedInclude,!0).deep.nested.include(s)},n.notDeepNestedInclude=function(i,s,a){new t(i,a,n.notDeepNestedInclude,!0).not.deep.nested.include(s)},n.ownInclude=function(i,s,a){new t(i,a,n.ownInclude,!0).own.include(s)},n.notOwnInclude=function(i,s,a){new t(i,a,n.notOwnInclude,!0).not.own.include(s)},n.deepOwnInclude=function(i,s,a){new t(i,a,n.deepOwnInclude,!0).deep.own.include(s)},n.notDeepOwnInclude=function(i,s,a){new t(i,a,n.notDeepOwnInclude,!0).not.deep.own.include(s)},n.match=function(i,s,a){new t(i,a,n.match,!0).to.match(s)},n.notMatch=function(i,s,a){new t(i,a,n.notMatch,!0).to.not.match(s)},n.property=function(i,s,a){new t(i,a,n.property,!0).to.have.property(s)},n.notProperty=function(i,s,a){new t(i,a,n.notProperty,!0).to.not.have.property(s)},n.propertyVal=function(i,s,a,c){new t(i,c,n.propertyVal,!0).to.have.property(s,a)},n.notPropertyVal=function(i,s,a,c){new t(i,c,n.notPropertyVal,!0).to.not.have.property(s,a)},n.deepPropertyVal=function(i,s,a,c){new t(i,c,n.deepPropertyVal,!0).to.have.deep.property(s,a)},n.notDeepPropertyVal=function(i,s,a,c){new t(i,c,n.notDeepPropertyVal,!0).to.not.have.deep.property(s,a)},n.ownProperty=function(i,s,a){new t(i,a,n.ownProperty,!0).to.have.own.property(s)},n.notOwnProperty=function(i,s,a){new t(i,a,n.notOwnProperty,!0).to.not.have.own.property(s)},n.ownPropertyVal=function(i,s,a,c){new t(i,c,n.ownPropertyVal,!0).to.have.own.property(s,a)},n.notOwnPropertyVal=function(i,s,a,c){new t(i,c,n.notOwnPropertyVal,!0).to.not.have.own.property(s,a)},n.deepOwnPropertyVal=function(i,s,a,c){new t(i,c,n.deepOwnPropertyVal,!0).to.have.deep.own.property(s,a)},n.notDeepOwnPropertyVal=function(i,s,a,c){new t(i,c,n.notDeepOwnPropertyVal,!0).to.not.have.deep.own.property(s,a)},n.nestedProperty=function(i,s,a){new t(i,a,n.nestedProperty,!0).to.have.nested.property(s)},n.notNestedProperty=function(i,s,a){new t(i,a,n.notNestedProperty,!0).to.not.have.nested.property(s)},n.nestedPropertyVal=function(i,s,a,c){new t(i,c,n.nestedPropertyVal,!0).to.have.nested.property(s,a)},n.notNestedPropertyVal=function(i,s,a,c){new t(i,c,n.notNestedPropertyVal,!0).to.not.have.nested.property(s,a)},n.deepNestedPropertyVal=function(i,s,a,c){new t(i,c,n.deepNestedPropertyVal,!0).to.have.deep.nested.property(s,a)},n.notDeepNestedPropertyVal=function(i,s,a,c){new t(i,c,n.notDeepNestedPropertyVal,!0).to.not.have.deep.nested.property(s,a)},n.lengthOf=function(i,s,a){new t(i,a,n.lengthOf,!0).to.have.lengthOf(s)},n.hasAnyKeys=function(i,s,a){new t(i,a,n.hasAnyKeys,!0).to.have.any.keys(s)},n.hasAllKeys=function(i,s,a){new t(i,a,n.hasAllKeys,!0).to.have.all.keys(s)},n.containsAllKeys=function(i,s,a){new t(i,a,n.containsAllKeys,!0).to.contain.all.keys(s)},n.doesNotHaveAnyKeys=function(i,s,a){new t(i,a,n.doesNotHaveAnyKeys,!0).to.not.have.any.keys(s)},n.doesNotHaveAllKeys=function(i,s,a){new t(i,a,n.doesNotHaveAllKeys,!0).to.not.have.all.keys(s)},n.hasAnyDeepKeys=function(i,s,a){new t(i,a,n.hasAnyDeepKeys,!0).to.have.any.deep.keys(s)},n.hasAllDeepKeys=function(i,s,a){new t(i,a,n.hasAllDeepKeys,!0).to.have.all.deep.keys(s)},n.containsAllDeepKeys=function(i,s,a){new t(i,a,n.containsAllDeepKeys,!0).to.contain.all.deep.keys(s)},n.doesNotHaveAnyDeepKeys=function(i,s,a){new t(i,a,n.doesNotHaveAnyDeepKeys,!0).to.not.have.any.deep.keys(s)},n.doesNotHaveAllDeepKeys=function(i,s,a){new t(i,a,n.doesNotHaveAllDeepKeys,!0).to.not.have.all.deep.keys(s)},n.throws=function(i,s,a,c){(typeof s=="string"||s instanceof RegExp)&&(a=s,s=null);var u=new t(i,c,n.throws,!0).to.throw(s,a);return o(u,"object")},n.doesNotThrow=function(i,s,a,c){(typeof s=="string"||s instanceof RegExp)&&(a=s,s=null),new t(i,c,n.doesNotThrow,!0).to.not.throw(s,a)},n.operator=function(i,s,a,c){var u;switch(s){case"==":u=i==a;break;case"===":u=i===a;break;case">":u=i>a;break;case">=":u=i>=a;break;case"<":u=i<a;break;case"<=":u=i<=a;break;case"!=":u=i!=a;break;case"!==":u=i!==a;break;default:throw c=c&&c+": ",new r.AssertionError(c+'Invalid operator "'+s+'"',void 0,n.operator)}var d=new t(u,c,n.operator,!0);d.assert(o(d,"object")===!0,"expected "+e.inspect(i)+" to be "+s+" "+e.inspect(a),"expected "+e.inspect(i)+" to not be "+s+" "+e.inspect(a))},n.closeTo=function(i,s,a,c){new t(i,c,n.closeTo,!0).to.be.closeTo(s,a)},n.approximately=function(i,s,a,c){new t(i,c,n.approximately,!0).to.be.approximately(s,a)},n.sameMembers=function(i,s,a){new t(i,a,n.sameMembers,!0).to.have.same.members(s)},n.notSameMembers=function(i,s,a){new t(i,a,n.notSameMembers,!0).to.not.have.same.members(s)},n.sameDeepMembers=function(i,s,a){new t(i,a,n.sameDeepMembers,!0).to.have.same.deep.members(s)},n.notSameDeepMembers=function(i,s,a){new t(i,a,n.notSameDeepMembers,!0).to.not.have.same.deep.members(s)},n.sameOrderedMembers=function(i,s,a){new t(i,a,n.sameOrderedMembers,!0).to.have.same.ordered.members(s)},n.notSameOrderedMembers=function(i,s,a){new t(i,a,n.notSameOrderedMembers,!0).to.not.have.same.ordered.members(s)},n.sameDeepOrderedMembers=function(i,s,a){new t(i,a,n.sameDeepOrderedMembers,!0).to.have.same.deep.ordered.members(s)},n.notSameDeepOrderedMembers=function(i,s,a){new t(i,a,n.notSameDeepOrderedMembers,!0).to.not.have.same.deep.ordered.members(s)},n.includeMembers=function(i,s,a){new t(i,a,n.includeMembers,!0).to.include.members(s)},n.notIncludeMembers=function(i,s,a){new t(i,a,n.notIncludeMembers,!0).to.not.include.members(s)},n.includeDeepMembers=function(i,s,a){new t(i,a,n.includeDeepMembers,!0).to.include.deep.members(s)},n.notIncludeDeepMembers=function(i,s,a){new t(i,a,n.notIncludeDeepMembers,!0).to.not.include.deep.members(s)},n.includeOrderedMembers=function(i,s,a){new t(i,a,n.includeOrderedMembers,!0).to.include.ordered.members(s)},n.notIncludeOrderedMembers=function(i,s,a){new t(i,a,n.notIncludeOrderedMembers,!0).to.not.include.ordered.members(s)},n.includeDeepOrderedMembers=function(i,s,a){new t(i,a,n.includeDeepOrderedMembers,!0).to.include.deep.ordered.members(s)},n.notIncludeDeepOrderedMembers=function(i,s,a){new t(i,a,n.notIncludeDeepOrderedMembers,!0).to.not.include.deep.ordered.members(s)},n.oneOf=function(i,s,a){new t(i,a,n.oneOf,!0).to.be.oneOf(s)},n.changes=function(i,s,a,c){arguments.length===3&&typeof s=="function"&&(c=a,a=null),new t(i,c,n.changes,!0).to.change(s,a)},n.changesBy=function(i,s,a,c,u){if(arguments.length===4&&typeof s=="function"){var d=c;c=a,u=d}else arguments.length===3&&(c=a,a=null);new t(i,u,n.changesBy,!0).to.change(s,a).by(c)},n.doesNotChange=function(i,s,a,c){return arguments.length===3&&typeof s=="function"&&(c=a,a=null),new t(i,c,n.doesNotChange,!0).to.not.change(s,a)},n.changesButNotBy=function(i,s,a,c,u){if(arguments.length===4&&typeof s=="function"){var d=c;c=a,u=d}else arguments.length===3&&(c=a,a=null);new t(i,u,n.changesButNotBy,!0).to.change(s,a).but.not.by(c)},n.increases=function(i,s,a,c){return arguments.length===3&&typeof s=="function"&&(c=a,a=null),new t(i,c,n.increases,!0).to.increase(s,a)},n.increasesBy=function(i,s,a,c,u){if(arguments.length===4&&typeof s=="function"){var d=c;c=a,u=d}else arguments.length===3&&(c=a,a=null);new t(i,u,n.increasesBy,!0).to.increase(s,a).by(c)},n.doesNotIncrease=function(i,s,a,c){return arguments.length===3&&typeof s=="function"&&(c=a,a=null),new t(i,c,n.doesNotIncrease,!0).to.not.increase(s,a)},n.increasesButNotBy=function(i,s,a,c,u){if(arguments.length===4&&typeof s=="function"){var d=c;c=a,u=d}else arguments.length===3&&(c=a,a=null);new t(i,u,n.increasesButNotBy,!0).to.increase(s,a).but.not.by(c)},n.decreases=function(i,s,a,c){return arguments.length===3&&typeof s=="function"&&(c=a,a=null),new t(i,c,n.decreases,!0).to.decrease(s,a)},n.decreasesBy=function(i,s,a,c,u){if(arguments.length===4&&typeof s=="function"){var d=c;c=a,u=d}else arguments.length===3&&(c=a,a=null);new t(i,u,n.decreasesBy,!0).to.decrease(s,a).by(c)},n.doesNotDecrease=function(i,s,a,c){return arguments.length===3&&typeof s=="function"&&(c=a,a=null),new t(i,c,n.doesNotDecrease,!0).to.not.decrease(s,a)},n.doesNotDecreaseBy=function(i,s,a,c,u){if(arguments.length===4&&typeof s=="function"){var d=c;c=a,u=d}else arguments.length===3&&(c=a,a=null);return new t(i,u,n.doesNotDecreaseBy,!0).to.not.decrease(s,a).by(c)},n.decreasesButNotBy=function(i,s,a,c,u){if(arguments.length===4&&typeof s=="function"){var d=c;c=a,u=d}else arguments.length===3&&(c=a,a=null);new t(i,u,n.decreasesButNotBy,!0).to.decrease(s,a).but.not.by(c)};n.ifError=function(i){if(i)throw i},n.isExtensible=function(i,s){new t(i,s,n.isExtensible,!0).to.be.extensible},n.isNotExtensible=function(i,s){new t(i,s,n.isNotExtensible,!0).to.not.be.extensible},n.isSealed=function(i,s){new t(i,s,n.isSealed,!0).to.be.sealed},n.isNotSealed=function(i,s){new t(i,s,n.isNotSealed,!0).to.not.be.sealed},n.isFrozen=function(i,s){new t(i,s,n.isFrozen,!0).to.be.frozen},n.isNotFrozen=function(i,s){new t(i,s,n.isNotFrozen,!0).to.not.be.frozen},n.isEmpty=function(i,s){new t(i,s,n.isEmpty,!0).to.be.empty},n.isNotEmpty=function(i,s){new t(i,s,n.isNotEmpty,!0).to.not.be.empty};(function i(s,a){return n[a]=n[s],i})("isOk","ok")("isNotOk","notOk")("throws","throw")("throws","Throw")("isExtensible","extensible")("isNotExtensible","notExtensible")("isSealed","sealed")("isNotSealed","notSealed")("isFrozen","frozen")("isNotFrozen","notFrozen")("isEmpty","empty")("isNotEmpty","notEmpty")}});var $e=O(we=>{var hs=[];we.version="4.3.3";we.AssertionError=Gr();var ds=ts();we.use=function(r){return~hs.indexOf(r)||(r(we,ds),hs.push(r)),we};we.util=ds;var ef=nt();we.config=ef;var tf=ns();we.use(tf);var rf=is();we.use(rf);var nf=as();we.use(nf);var of=us();we.use(of);var sf=ls();we.use(sf)});var ys=O((Pd,ps)=>{ps.exports=$e()});var ms=O((Ud,Le)=>{"use strict";var st=an();Le.exports=(r,e)=>{let t=r.Assertion,o=r.assert,n=e.proxify;e.checkError&&(st=e.checkError);function i(y){return typeof y.catch!="function"&&typeof y.always=="function"&&typeof y.done=="function"&&typeof y.fail=="function"&&typeof y.pipe=="function"&&typeof y.progress=="function"&&typeof y.state=="function"}function s(y){if(typeof y._obj.then!="function")throw new TypeError(e.inspect(y._obj)+" is not a thenable.");if(i(y._obj))throw new TypeError("Chai as Promised is incompatible with thenables of jQuery<3.0.0, sorry! Please upgrade jQuery or use another Promises/A+ compatible library (see http://promisesaplus.com/).")}function a(y){return n===void 0?y:n(y)}function c(y,S){e.addMethod(t.prototype,y,function(){return s(this),S.apply(this,arguments)})}function u(y,S){e.addProperty(t.prototype,y,function(){return s(this),a(S.apply(this,arguments))})}function d(y,S){y.then(()=>S(),S)}function w(y,S,C){y.assert(!0,null,S,C.expected,C.actual)}function B(y,S,C){y.assert(!1,S,null,C.expected,C.actual)}function k(y){return typeof y.then=="function"?y:y._obj}function N(y){return y instanceof Error?y.toString():st.getConstructorName(y)}let E=Object.getOwnPropertyNames(t.prototype),I={};for(let y of E)I[y]=Object.getOwnPropertyDescriptor(t.prototype,y);u("fulfilled",function(){let y=k(this).then(S=>(w(this,"expected promise not to be fulfilled but it was fulfilled with #{act}",{actual:S}),S),S=>(B(this,"expected promise to be fulfilled but it was rejected with #{act}",{actual:N(S)}),S));return Le.exports.transferPromiseness(this,y),this}),u("rejected",function(){let y=k(this).then(S=>(B(this,"expected promise to be rejected but it was fulfilled with #{act}",{actual:S}),S),S=>(w(this,"expected promise not to be rejected but it was rejected with #{act}",{actual:N(S)}),S));return Le.exports.transferPromiseness(this,y),this}),c("rejectedWith",function(y,S,C){let U=null,re=e.flag(this,"negate")||!1;if(y===void 0&&S===void 0&&C===void 0)return this.rejected;C!==void 0&&e.flag(this,"message",C),y instanceof RegExp||typeof y=="string"?(S=y,y=null):y&&y instanceof Error?U=y.toString():typeof y=="function"?U=st.getConstructorName(y):y=null;let De=Boolean(y&&S),fe="including";S instanceof RegExp&&(fe="matching");let mt=k(this).then(ge=>{let Oe=null,xe=null;return y?(Oe="expected promise to be rejected with #{exp} but it was fulfilled with #{act}",xe=U):S&&(Oe=`expected promise to be rejected with an error ${fe} #{exp} but it was fulfilled with #{act}`,xe=S),B(this,Oe,{expected:xe,actual:ge}),ge},ge=>{let Oe=y&&(y instanceof Error?st.compatibleInstance(ge,y):st.compatibleConstructor(ge,y)),xe=S&&st.compatibleMessage(ge,S),et=N(ge);return re&&De?Oe&&xe&&this.assert(!0,null,"expected promise not to be rejected with #{exp} but it was rejected with #{act}",U,et):(y&&this.assert(Oe,"expected promise to be rejected with #{exp} but it was rejected with #{act}","expected promise not to be rejected with #{exp} but it was rejected with #{act}",U,et),S&&this.assert(xe,`expected promise to be rejected with an error ${fe} #{exp} but got #{act}`,`expected promise not to be rejected with an error ${fe} #{exp}`,S,st.getMessage(ge))),ge});return Le.exports.transferPromiseness(this,mt),this}),u("eventually",function(){return e.flag(this,"eventually",!0),this}),c("notify",function(y){return d(k(this),y),this}),c("become",function(y,S){return this.eventually.deep.equal(y,S)}),E.filter(y=>y!=="assert"&&typeof I[y].value=="function").forEach(y=>{t.overwriteMethod(y,S=>function(){return Q(S,this,arguments)})}),E.filter(y=>y!=="_obj"&&typeof I[y].get=="function").forEach(y=>{t.prototype.__methods.hasOwnProperty(y)?t.overwriteChainableMethod(y,C=>function(){return Q(C,this,arguments)},C=>function(){return Q(C,this)}):t.overwriteProperty(y,C=>function(){return a(Q(C,this))})});function Q(y,S,C){if(!e.flag(S,"eventually"))return y.apply(S,C),S;let U=k(S).then(re=>(S._obj=re,e.flag(S,"eventually",!1),C&&Le.exports.transformAsserterArgs(C))).then(re=>(y.apply(S,re),S._obj));return Le.exports.transferPromiseness(S,U),S}let te=Object.getOwnPropertyNames(o).filter(y=>typeof o[y]=="function");o.isFulfilled=(y,S)=>new t(y,S).to.be.fulfilled,o.isRejected=(y,S,C,U)=>new t(y,U).to.be.rejectedWith(S,C,U),o.becomes=(y,S,C)=>o.eventually.deepEqual(y,S,C),o.doesNotBecome=(y,S,C)=>o.eventually.notDeepEqual(y,S,C),o.eventually={},te.forEach(y=>{o.eventually[y]=function(S){let C=Array.prototype.slice.call(arguments,1),U,re=arguments[o[y].length-1];typeof re=="string"&&(U=fe=>{throw new r.AssertionError(`${re}
|
|
2
|
+
"use strict";var Libp2PInterop=(()=>{var eu=Object.create;var hr=Object.defineProperty;var tu=Object.getOwnPropertyDescriptor;var ru=Object.getOwnPropertyNames;var nu=Object.getPrototypeOf,ou=Object.prototype.hasOwnProperty;var ke=(r=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(r,{get:(e,t)=>(typeof require<"u"?require:e)[t]}):r)(function(r){if(typeof require<"u")return require.apply(this,arguments);throw new Error('Dynamic require of "'+r+'" is not supported')});var O=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),be=(r,e)=>{for(var t in e)hr(r,t,{get:e[t],enumerable:!0})},jo=(r,e,t,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of ru(e))!ou.call(r,n)&&n!==t&&hr(r,n,{get:()=>e[n],enumerable:!(o=tu(e,n))||o.enumerable});return r};var oe=(r,e,t)=>(t=r!=null?eu(nu(r)):{},jo(e||!r||!r.__esModule?hr(t,"default",{value:r,enumerable:!0}):t,r)),iu=r=>jo(hr({},"__esModule",{value:!0}),r);var Gr=O((Yh,Bo)=>{function qo(){var r=[].slice.call(arguments);function e(t,o){Object.keys(o).forEach(function(n){~r.indexOf(n)||(t[n]=o[n])})}return function(){for(var o=[].slice.call(arguments),n=0,i={};n<o.length;n++)e(i,o[n]);return i}}Bo.exports=rt;function rt(r,e,t){var o=qo("name","message","stack","constructor","toJSON"),n=o(e||{});this.message=r||"Unspecified AssertionError",this.showDiff=!1;for(var i in n)this[i]=n[i];if(t=t||rt,Error.captureStackTrace)Error.captureStackTrace(this,t);else try{throw new Error}catch(s){this.stack=s.stack}}rt.prototype=Object.create(Error.prototype);rt.prototype.name="AssertionError";rt.prototype.constructor=rt;rt.prototype.toJSON=function(r){var e=qo("constructor","toJSON","stack"),t=e({name:this.name},this);return r!==!1&&this.stack&&(t.stack=this.stack),t}});var Fo=O((Hh,zo)=>{"use strict";function Lo(r,e){return typeof r>"u"||r===null?!1:e in Object(r)}function Uo(r){var e=r.replace(/([^\\])\[/g,"$1.["),t=e.match(/(\\\.|[^.]+?)+/g);return t.map(function(n){if(n==="constructor"||n==="__proto__"||n==="prototype")return{};var i=/^\[(\d+)\]$/,s=i.exec(n),a=null;return s?a={i:parseFloat(s[1])}:a={p:n.replace(/\\([.[\]])/g,"$1")},a})}function ko(r,e,t){var o=r,n=null;t=typeof t>"u"?e.length:t;for(var i=0;i<t;i++){var s=e[i];o&&(typeof s.p>"u"?o=o[s.i]:o=o[s.p],i===t-1&&(n=o))}return n}function su(r,e,t){for(var o=r,n=t.length,i=null,s=0;s<n;s++){var a=null,c=null;if(i=t[s],s===n-1)a=typeof i.p>"u"?i.i:i.p,o[a]=e;else if(typeof i.p<"u"&&o[i.p])o=o[i.p];else if(typeof i.i<"u"&&o[i.i])o=o[i.i];else{var u=t[s+1];a=typeof i.p>"u"?i.i:i.p,c=typeof u.p>"u"?[]:{},o[a]=c,o=o[a]}}}function Ro(r,e){var t=Uo(e),o=t[t.length-1],n={parent:t.length>1?ko(r,t,t.length-1):r,name:o.p||o.i,value:ko(r,t)};return n.exists=Lo(n.parent,n.name),n}function au(r,e){var t=Ro(r,e);return t.value}function cu(r,e,t){var o=Uo(e);return su(r,t,o),r}zo.exports={hasProperty:Lo,getPathInfo:Ro,getPathValue:au,setPathValue:cu}});var Ae=O((ed,Vo)=>{Vo.exports=function(e,t,o){var n=e.__flags||(e.__flags=Object.create(null));if(arguments.length===3)n[t]=o;else return n[t]}});var Wo=O((td,$o)=>{var uu=Ae();$o.exports=function(e,t){var o=uu(e,"negate"),n=t[0];return o?!n:n}});var Ut=O((Kr,Jr)=>{(function(r,e){typeof Kr=="object"&&typeof Jr<"u"?Jr.exports=e():typeof define=="function"&&define.amd?define(e):r.typeDetect=e()})(Kr,function(){"use strict";var r=typeof Promise=="function",e=typeof self=="object"?self:globalThis,t=typeof Symbol<"u",o=typeof Map<"u",n=typeof Set<"u",i=typeof WeakMap<"u",s=typeof WeakSet<"u",a=typeof DataView<"u",c=t&&typeof Symbol.iterator<"u",u=t&&typeof Symbol.toStringTag<"u",d=n&&typeof Set.prototype.entries=="function",w=o&&typeof Map.prototype.entries=="function",q=d&&Object.getPrototypeOf(new Set().entries()),k=w&&Object.getPrototypeOf(new Map().entries()),N=c&&typeof Array.prototype[Symbol.iterator]=="function",E=N&&Object.getPrototypeOf([][Symbol.iterator]()),I=c&&typeof String.prototype[Symbol.iterator]=="function",B=I&&Object.getPrototypeOf(""[Symbol.iterator]()),$=8,Q=-1;function te(y){var S=typeof y;if(S!=="object")return S;if(y===null)return"null";if(y===e)return"global";if(Array.isArray(y)&&(u===!1||!(Symbol.toStringTag in y)))return"Array";if(typeof window=="object"&&window!==null){if(typeof window.location=="object"&&y===window.location)return"Location";if(typeof window.document=="object"&&y===window.document)return"Document";if(typeof window.navigator=="object"){if(typeof window.navigator.mimeTypes=="object"&&y===window.navigator.mimeTypes)return"MimeTypeArray";if(typeof window.navigator.plugins=="object"&&y===window.navigator.plugins)return"PluginArray"}if((typeof window.HTMLElement=="function"||typeof window.HTMLElement=="object")&&y instanceof window.HTMLElement){if(y.tagName==="BLOCKQUOTE")return"HTMLQuoteElement";if(y.tagName==="TD")return"HTMLTableDataCellElement";if(y.tagName==="TH")return"HTMLTableHeaderCellElement"}}var C=u&&y[Symbol.toStringTag];if(typeof C=="string")return C;var U=Object.getPrototypeOf(y);return U===RegExp.prototype?"RegExp":U===Date.prototype?"Date":r&&U===Promise.prototype?"Promise":n&&U===Set.prototype?"Set":o&&U===Map.prototype?"Map":s&&U===WeakSet.prototype?"WeakSet":i&&U===WeakMap.prototype?"WeakMap":a&&U===DataView.prototype?"DataView":o&&U===k?"Map Iterator":n&&U===q?"Set Iterator":N&&U===E?"Array Iterator":I&&U===B?"String Iterator":U===null?"Object":Object.prototype.toString.call(y).slice($,Q)}return te})});var Ko=O((rd,Go)=>{var fu=Gr(),Xr=Ae(),lu=Ut();Go.exports=function(e,t){var o=Xr(e,"message"),n=Xr(e,"ssfi");o=o?o+": ":"",e=Xr(e,"object"),t=t.map(function(a){return a.toLowerCase()}),t.sort();var i=t.map(function(a,c){var u=~["a","e","i","o","u"].indexOf(a.charAt(0))?"an":"a",d=t.length>1&&c===t.length-1?"or ":"";return d+u+" "+a}).join(", "),s=lu(e).toLowerCase();if(!t.some(function(a){return s===a}))throw new fu(o+"object tested must be "+i+", but "+s+" given",void 0,n)}});var Qr=O((nd,Jo)=>{Jo.exports=function(e,t){return t.length>4?t[4]:e._obj}});var Zr=O((od,Xo)=>{"use strict";var hu=Function.prototype.toString,du=/\s*function(?:\s|\s*\/\*[^(?:*\/)]+\*\/\s*)*([^\s\(\/]+)/;function pu(r){if(typeof r!="function")return null;var e="";if(typeof Function.prototype.name>"u"&&typeof r.name>"u"){var t=hu.call(r).match(du);t&&(e=t[1])}else e=r.name;return e}Xo.exports=pu});var Zo=O((dr,Qo)=>{(function(r,e){typeof dr=="object"&&typeof Qo<"u"?e(dr):typeof define=="function"&&define.amd?define(["exports"],e):(r=typeof globalThis<"u"?globalThis:r||self,e(r.loupe={}))})(dr,function(r){"use strict";function e(l){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?e=function(h){return typeof h}:e=function(h){return h&&typeof Symbol=="function"&&h.constructor===Symbol&&h!==Symbol.prototype?"symbol":typeof h},e(l)}function t(l,h){return o(l)||n(l,h)||i(l,h)||a()}function o(l){if(Array.isArray(l))return l}function n(l,h){if(!(typeof Symbol>"u"||!(Symbol.iterator in Object(l)))){var b=[],P=!0,D=!1,R=void 0;try{for(var K=l[Symbol.iterator](),Y;!(P=(Y=K.next()).done)&&(b.push(Y.value),!(h&&b.length===h));P=!0);}catch(he){D=!0,R=he}finally{try{!P&&K.return!=null&&K.return()}finally{if(D)throw R}}return b}}function i(l,h){if(l){if(typeof l=="string")return s(l,h);var b=Object.prototype.toString.call(l).slice(8,-1);if(b==="Object"&&l.constructor&&(b=l.constructor.name),b==="Map"||b==="Set")return Array.from(l);if(b==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(b))return s(l,h)}}function s(l,h){(h==null||h>l.length)&&(h=l.length);for(var b=0,P=new Array(h);b<h;b++)P[b]=l[b];return P}function a(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
3
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var c={bold:["1","22"],dim:["2","22"],italic:["3","23"],underline:["4","24"],inverse:["7","27"],hidden:["8","28"],strike:["9","29"],black:["30","39"],red:["31","39"],green:["32","39"],yellow:["33","39"],blue:["34","39"],magenta:["35","39"],cyan:["36","39"],white:["37","39"],brightblack:["30;1","39"],brightred:["31;1","39"],brightgreen:["32;1","39"],brightyellow:["33;1","39"],brightblue:["34;1","39"],brightmagenta:["35;1","39"],brightcyan:["36;1","39"],brightwhite:["37;1","39"],grey:["90","39"]},u={special:"cyan",number:"yellow",bigint:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",symbol:"green",date:"magenta",regexp:"red"},d="\u2026";function w(l,h){var b=c[u[h]]||c[h];return b?"\x1B[".concat(b[0],"m").concat(String(l),"\x1B[").concat(b[1],"m"):String(l)}function q(){var l=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},h=l.showHidden,b=h===void 0?!1:h,P=l.depth,D=P===void 0?2:P,R=l.colors,K=R===void 0?!1:R,Y=l.customInspect,he=Y===void 0?!0:Y,ue=l.showProxy,Ee=ue===void 0?!1:ue,tt=l.maxArrayLength,$r=tt===void 0?1/0:tt,kt=l.breakLength,bt=kt===void 0?1/0:kt,Lt=l.seen,Zc=Lt===void 0?[]:Lt,_o=l.truncate,Yc=_o===void 0?1/0:_o,Co=l.stylize,Hc=Co===void 0?String:Co,Wr={showHidden:Boolean(b),depth:Number(D),colors:Boolean(K),customInspect:Boolean(he),showProxy:Boolean(Ee),maxArrayLength:Number($r),breakLength:Number(bt),truncate:Number(Yc),seen:Zc,stylize:Hc};return Wr.colors&&(Wr.stylize=w),Wr}function k(l,h){var b=arguments.length>2&&arguments[2]!==void 0?arguments[2]:d;l=String(l);var P=b.length,D=l.length;return P>h&&D>P?b:D>h&&D>P?"".concat(l.slice(0,h-P)).concat(b):l}function N(l,h,b){var P=arguments.length>3&&arguments[3]!==void 0?arguments[3]:", ";b=b||h.inspect;var D=l.length;if(D===0)return"";for(var R=h.truncate,K="",Y="",he="",ue=0;ue<D;ue+=1){var Ee=ue+1===l.length,tt=ue+2===l.length;he="".concat(d,"(").concat(l.length-ue,")");var $r=l[ue];h.truncate=R-K.length-(Ee?0:P.length);var kt=Y||b($r,h)+(Ee?"":P),bt=K.length+kt.length,Lt=bt+he.length;if(Ee&&bt>R&&K.length+he.length<=R||!Ee&&!tt&&Lt>R||(Y=Ee?"":b(l[ue+1],h)+(tt?"":P),!Ee&&tt&&Lt>R&&bt+Y.length>R))break;if(K+=kt,!Ee&&!tt&&bt+Y.length>=R){he="".concat(d,"(").concat(l.length-ue-1,")");break}he=""}return"".concat(K).concat(he)}function E(l){return l.match(/^[a-zA-Z_][a-zA-Z_0-9]*$/)?l:JSON.stringify(l).replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'")}function I(l,h){var b=t(l,2),P=b[0],D=b[1];return h.truncate-=2,typeof P=="string"?P=E(P):typeof P!="number"&&(P="[".concat(h.inspect(P,h),"]")),h.truncate-=P.length,D=h.inspect(D,h),"".concat(P,": ").concat(D)}function B(l,h){var b=Object.keys(l).slice(l.length);if(!l.length&&!b.length)return"[]";h.truncate-=4;var P=N(l,h);h.truncate-=P.length;var D="";return b.length&&(D=N(b.map(function(R){return[R,l[R]]}),h,I)),"[ ".concat(P).concat(D?", ".concat(D):""," ]")}var $=Function.prototype.toString,Q=/\s*function(?:\s|\s*\/\*[^(?:*\/)]+\*\/\s*)*([^\s\(\/]+)/;function te(l){if(typeof l!="function")return null;var h="";if(typeof Function.prototype.name>"u"&&typeof l.name>"u"){var b=$.call(l).match(Q);b&&(h=b[1])}else h=l.name;return h}var y=te,S=function(h){return typeof Buffer=="function"&&h instanceof Buffer?"Buffer":h[Symbol.toStringTag]?h[Symbol.toStringTag]:y(h.constructor)};function C(l,h){var b=S(l);h.truncate-=b.length+4;var P=Object.keys(l).slice(l.length);if(!l.length&&!P.length)return"".concat(b,"[]");for(var D="",R=0;R<l.length;R++){var K="".concat(h.stylize(k(l[R],h.truncate),"number")).concat(R===l.length-1?"":", ");if(h.truncate-=K.length,l[R]!==l.length&&h.truncate<=3){D+="".concat(d,"(").concat(l.length-l[R]+1,")");break}D+=K}var Y="";return P.length&&(Y=N(P.map(function(he){return[he,l[he]]}),h,I)),"".concat(b,"[ ").concat(D).concat(Y?", ".concat(Y):""," ]")}function U(l,h){var b=l.toJSON();if(b===null)return"Invalid Date";var P=b.split("T"),D=P[0];return h.stylize("".concat(D,"T").concat(k(P[1],h.truncate-D.length-1)),"date")}function re(l,h){var b=y(l);return b?h.stylize("[Function ".concat(k(b,h.truncate-11),"]"),"special"):h.stylize("[Function]","special")}function De(l,h){var b=t(l,2),P=b[0],D=b[1];return h.truncate-=4,P=h.inspect(P,h),h.truncate-=P.length,D=h.inspect(D,h),"".concat(P," => ").concat(D)}function fe(l){var h=[];return l.forEach(function(b,P){h.push([P,b])}),h}function mt(l,h){var b=l.size-1;return b<=0?"Map{}":(h.truncate-=7,"Map{ ".concat(N(fe(l),h,De)," }"))}var ge=Number.isNaN||function(l){return l!==l};function Oe(l,h){return ge(l)?h.stylize("NaN","number"):l===1/0?h.stylize("Infinity","number"):l===-1/0?h.stylize("-Infinity","number"):l===0?h.stylize(1/l===1/0?"+0":"-0","number"):h.stylize(k(l,h.truncate),"number")}function xe(l,h){var b=k(l.toString(),h.truncate-1);return b!==d&&(b+="n"),h.stylize(b,"bigint")}function et(l,h){var b=l.toString().split("/")[2],P=h.truncate-(2+b.length),D=l.source;return h.stylize("/".concat(k(D,P),"/").concat(b),"regexp")}function ar(l){var h=[];return l.forEach(function(b){h.push(b)}),h}function Fr(l,h){return l.size===0?"Set{}":(h.truncate-=7,"Set{ ".concat(N(ar(l),h)," }"))}var f=new RegExp("['\\u0000-\\u001f\\u007f-\\u009f\\u00ad\\u0600-\\u0604\\u070f\\u17b4\\u17b5\\u200c-\\u200f\\u2028-\\u202f\\u2060-\\u206f\\ufeff\\ufff0-\\uffff]","g"),p={"\b":"\\b"," ":"\\t","\n":"\\n","\f":"\\f","\r":"\\r","'":"\\'","\\":"\\\\"},g=16,v=4;function A(l){return p[l]||"\\u".concat("0000".concat(l.charCodeAt(0).toString(g)).slice(-v))}function T(l,h){return f.test(l)&&(l=l.replace(f,A)),h.stylize("'".concat(k(l,h.truncate-2),"'"),"string")}function x(l){return"description"in Symbol.prototype?l.description?"Symbol(".concat(l.description,")"):"Symbol()":l.toString()}var m=function(){return"Promise{\u2026}"};try{var M=process.binding("util"),j=M.getPromiseDetails,F=M.kPending,X=M.kRejected;Array.isArray(j(Promise.resolve()))&&(m=function(h,b){var P=j(h),D=t(P,2),R=D[0],K=D[1];return R===F?"Promise{<pending>}":"Promise".concat(R===X?"!":"","{").concat(b.inspect(K,b),"}")})}catch{}var z=m;function L(l,h){var b=Object.getOwnPropertyNames(l),P=Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(l):[];if(b.length===0&&P.length===0)return"{}";if(h.truncate-=4,h.seen=h.seen||[],h.seen.indexOf(l)>=0)return"[Circular]";h.seen.push(l);var D=N(b.map(function(Y){return[Y,l[Y]]}),h,I),R=N(P.map(function(Y){return[Y,l[Y]]}),h,I);h.seen.pop();var K="";return D&&R&&(K=", "),"{ ".concat(D).concat(K).concat(R," }")}var G=typeof Symbol<"u"&&Symbol.toStringTag?Symbol.toStringTag:!1;function ie(l,h){var b="";return G&&G in l&&(b=l[G]),b=b||y(l.constructor),(!b||b==="_class")&&(b="<Anonymous Class>"),h.truncate-=b.length,"".concat(b).concat(L(l,h))}function le(l,h){return l.length===0?"Arguments[]":(h.truncate-=13,"Arguments[ ".concat(N(l,h)," ]"))}var ce=["stack","line","column","name","message","fileName","lineNumber","columnNumber","number","description"];function Be(l,h){var b=Object.getOwnPropertyNames(l).filter(function(K){return ce.indexOf(K)===-1}),P=l.name;h.truncate-=P.length;var D="";typeof l.message=="string"?D=k(l.message,h.truncate):b.unshift("message"),D=D?": ".concat(D):"",h.truncate-=D.length+5;var R=N(b.map(function(K){return[K,l[K]]}),h,I);return"".concat(P).concat(D).concat(R?" { ".concat(R," }"):"")}function $c(l,h){var b=t(l,2),P=b[0],D=b[1];return h.truncate-=3,D?"".concat(h.stylize(P,"yellow"),"=").concat(h.stylize('"'.concat(D,'"'),"string")):"".concat(h.stylize(P,"yellow"))}function Vr(l,h){return N(l,h,Oo,`
|
|
4
|
+
`)}function Oo(l,h){var b=l.getAttributeNames(),P=l.tagName.toLowerCase(),D=h.stylize("<".concat(P),"special"),R=h.stylize(">","special"),K=h.stylize("</".concat(P,">"),"special");h.truncate-=P.length*2+5;var Y="";b.length>0&&(Y+=" ",Y+=N(b.map(function(Ee){return[Ee,l.getAttribute(Ee)]}),h,$c," ")),h.truncate-=Y.length;var he=h.truncate,ue=Vr(l.children,h);return ue&&ue.length>he&&(ue="".concat(d,"(").concat(l.children.length,")")),"".concat(D).concat(Y).concat(R).concat(ue).concat(K)}var Wc=typeof Symbol=="function"&&typeof Symbol.for=="function",cr=Wc?Symbol.for("chai/inspect"):"@@chai/inspect",gt=!1;try{var Mo=ke("util");gt=Mo.inspect?Mo.inspect.custom:!1}catch{gt=!1}function Io(){this.key="chai/loupe__"+Math.random()+Date.now()}Io.prototype={get:function(h){return h[this.key]},has:function(h){return this.key in h},set:function(h,b){Object.isExtensible(h)&&Object.defineProperty(h,this.key,{value:b,configurable:!0})}};var ur=new(typeof WeakMap=="function"?WeakMap:Io),fr={},Do={undefined:function(h,b){return b.stylize("undefined","undefined")},null:function(h,b){return b.stylize(null,"null")},boolean:function(h,b){return b.stylize(h,"boolean")},Boolean:function(h,b){return b.stylize(h,"boolean")},number:Oe,Number:Oe,bigint:xe,BigInt:xe,string:T,String:T,function:re,Function:re,symbol:x,Symbol:x,Array:B,Date:U,Map:mt,Set:Fr,RegExp:et,Promise:z,WeakSet:function(h,b){return b.stylize("WeakSet{\u2026}","special")},WeakMap:function(h,b){return b.stylize("WeakMap{\u2026}","special")},Arguments:le,Int8Array:C,Uint8Array:C,Uint8ClampedArray:C,Int16Array:C,Uint16Array:C,Int32Array:C,Uint32Array:C,Float32Array:C,Float64Array:C,Generator:function(){return""},DataView:function(){return""},ArrayBuffer:function(){return""},Error:Be,HTMLCollection:Vr,NodeList:Vr},Gc=function(h,b,P){return cr in h&&typeof h[cr]=="function"?h[cr](b):gt&> in h&&typeof h[gt]=="function"?h[gt](b.depth,b):"inspect"in h&&typeof h.inspect=="function"?h.inspect(b.depth,b):"constructor"in h&&ur.has(h.constructor)?ur.get(h.constructor)(h,b):fr[P]?fr[P](h,b):""},Kc=Object.prototype.toString;function lr(l,h){h=q(h),h.inspect=lr;var b=h,P=b.customInspect,D=l===null?"null":e(l);if(D==="object"&&(D=Kc.call(l).slice(8,-1)),Do[D])return Do[D](l,h);if(P&&l){var R=Gc(l,h,D);if(R)return typeof R=="string"?R:lr(R,h)}var K=l?Object.getPrototypeOf(l):!1;return K===Object.prototype||K===null?L(l,h):l&&typeof HTMLElement=="function"&&l instanceof HTMLElement?Oo(l,h):"constructor"in l?l.constructor!==Object?ie(l,h):L(l,h):l===Object(l)?L(l,h):h.stylize(String(l),D)}function Jc(l,h){return ur.has(l)?!1:(ur.set(l,h),!0)}function Xc(l,h){return l in fr?!1:(fr[l]=h,!0)}var Qc=cr;r.custom=Qc,r.default=lr,r.inspect=lr,r.registerConstructor=Jc,r.registerStringTag=Xc,Object.defineProperty(r,"__esModule",{value:!0})})});var nt=O((id,Yo)=>{Yo.exports={includeStack:!1,showDiff:!0,truncateThreshold:40,useProxy:!0,proxyExcludedKeys:["then","catch","inspect","toJSON"]}});var pr=O((ad,ei)=>{var sd=Zr(),yu=Zo(),Ho=nt();ei.exports=mu;function mu(r,e,t,o){var n={colors:o,depth:typeof t>"u"?2:t,showHidden:e,truncate:Ho.truncateThreshold?Ho.truncateThreshold:1/0};return yu.inspect(r,n)}});var Yr=O((cd,ri)=>{var gu=pr(),ti=nt();ri.exports=function(e){var t=gu(e),o=Object.prototype.toString.call(e);if(ti.truncateThreshold&&t.length>=ti.truncateThreshold){if(o==="[object Function]")return!e.name||e.name===""?"[Function]":"[Function: "+e.name+"]";if(o==="[object Array]")return"[ Array("+e.length+") ]";if(o==="[object Object]"){var n=Object.keys(e),i=n.length>2?n.splice(0,2).join(", ")+", ...":n.join(", ");return"{ Object ("+i+") }"}else return t}else return t}});var oi=O((ud,ni)=>{var Hr=Ae(),bu=Qr(),en=Yr();ni.exports=function(e,t){var o=Hr(e,"negate"),n=Hr(e,"object"),i=t[3],s=bu(e,t),a=o?t[2]:t[1],c=Hr(e,"message");return typeof a=="function"&&(a=a()),a=a||"",a=a.replace(/#\{this\}/g,function(){return en(n)}).replace(/#\{act\}/g,function(){return en(s)}).replace(/#\{exp\}/g,function(){return en(i)}),c?c+": "+a:a}});var Ve=O((fd,ii)=>{ii.exports=function(e,t,o){var n=e.__flags||(e.__flags=Object.create(null));t.__flags||(t.__flags=Object.create(null)),o=arguments.length===3?o:!0;for(var i in n)(o||i!=="object"&&i!=="ssfi"&&i!=="lockSsfi"&&i!="message")&&(t.__flags[i]=n[i])}});var gi=O((ld,nn)=>{"use strict";var si=Ut();function pi(){this._key="chai/deep-eql__"+Math.random()+Date.now()}pi.prototype={get:function(e){return e[this._key]},set:function(e,t){Object.isExtensible(e)&&Object.defineProperty(e,this._key,{value:t,configurable:!0})}};var rn=typeof WeakMap=="function"?WeakMap:pi;function ai(r,e,t){if(!t||wt(r)||wt(e))return null;var o=t.get(r);if(o){var n=o.get(e);if(typeof n=="boolean")return n}return null}function yr(r,e,t,o){if(!(!t||wt(r)||wt(e))){var n=t.get(r);n?n.set(e,o):(n=new rn,n.set(e,o),t.set(r,n))}}nn.exports=mr;nn.exports.MemoizeMap=rn;function mr(r,e,t){if(t&&t.comparator)return ci(r,e,t);var o=yi(r,e);return o!==null?o:ci(r,e,t)}function yi(r,e){return r===e?r!==0||1/r===1/e:r!==r&&e!==e?!0:wt(r)||wt(e)?!1:null}function ci(r,e,t){t=t||{},t.memoize=t.memoize===!1?!1:t.memoize||new rn;var o=t&&t.comparator,n=ai(r,e,t.memoize);if(n!==null)return n;var i=ai(e,r,t.memoize);if(i!==null)return i;if(o){var s=o(r,e);if(s===!1||s===!0)return yr(r,e,t.memoize,s),s;var a=yi(r,e);if(a!==null)return a}var c=si(r);if(c!==si(e))return yr(r,e,t.memoize,!1),!1;yr(r,e,t.memoize,!0);var u=wu(r,e,c,t);return yr(r,e,t.memoize,u),u}function wu(r,e,t,o){switch(t){case"String":case"Number":case"Boolean":case"Date":return mr(r.valueOf(),e.valueOf());case"Promise":case"Symbol":case"function":case"WeakMap":case"WeakSet":return r===e;case"Error":return mi(r,e,["name","message","code"],o);case"Arguments":case"Int8Array":case"Uint8Array":case"Uint8ClampedArray":case"Int16Array":case"Uint16Array":case"Int32Array":case"Uint32Array":case"Float32Array":case"Float64Array":case"Array":return ot(r,e,o);case"RegExp":return vu(r,e);case"Generator":return xu(r,e,o);case"DataView":return ot(new Uint8Array(r.buffer),new Uint8Array(e.buffer),o);case"ArrayBuffer":return ot(new Uint8Array(r),new Uint8Array(e),o);case"Set":return ui(r,e,o);case"Map":return ui(r,e,o);case"Temporal.PlainDate":case"Temporal.PlainTime":case"Temporal.PlainDateTime":case"Temporal.Instant":case"Temporal.ZonedDateTime":case"Temporal.PlainYearMonth":case"Temporal.PlainMonthDay":return r.equals(e);case"Temporal.Duration":return r.total("nanoseconds")===e.total("nanoseconds");case"Temporal.TimeZone":case"Temporal.Calendar":return r.toString()===e.toString();default:return Au(r,e,o)}}function vu(r,e){return r.toString()===e.toString()}function ui(r,e,t){if(r.size!==e.size)return!1;if(r.size===0)return!0;var o=[],n=[];return r.forEach(function(s,a){o.push([s,a])}),e.forEach(function(s,a){n.push([s,a])}),ot(o.sort(),n.sort(),t)}function ot(r,e,t){var o=r.length;if(o!==e.length)return!1;if(o===0)return!0;for(var n=-1;++n<o;)if(mr(r[n],e[n],t)===!1)return!1;return!0}function xu(r,e,t){return ot(tn(r),tn(e),t)}function Eu(r){return typeof Symbol<"u"&&typeof r=="object"&&typeof Symbol.iterator<"u"&&typeof r[Symbol.iterator]=="function"}function fi(r){if(Eu(r))try{return tn(r[Symbol.iterator]())}catch{return[]}return[]}function tn(r){for(var e=r.next(),t=[e.value];e.done===!1;)e=r.next(),t.push(e.value);return t}function li(r){var e=[];for(var t in r)e.push(t);return e}function hi(r){for(var e=[],t=Object.getOwnPropertySymbols(r),o=0;o<t.length;o+=1){var n=t[o];Object.getOwnPropertyDescriptor(r,n).enumerable&&e.push(n)}return e}function mi(r,e,t,o){var n=t.length;if(n===0)return!0;for(var i=0;i<n;i+=1)if(mr(r[t[i]],e[t[i]],o)===!1)return!1;return!0}function Au(r,e,t){var o=li(r),n=li(e),i=hi(r),s=hi(e);if(o=o.concat(i),n=n.concat(s),o.length&&o.length===n.length)return ot(di(o).sort(),di(n).sort())===!1?!1:mi(r,e,o,t);var a=fi(r),c=fi(e);return a.length&&a.length===c.length?(a.sort(),c.sort(),ot(a,c,t)):o.length===0&&a.length===0&&n.length===0&&c.length===0}function wt(r){return r===null||typeof r!="object"}function di(r){return r.map(function(t){return typeof t=="symbol"?t.toString():t})}});var Rt=O((hd,bi)=>{var Su=nt();bi.exports=function(){return Su.useProxy&&typeof Proxy<"u"&&typeof Reflect<"u"}});var xi=O((dd,vi)=>{var Tu=$e(),wi=Ae(),Nu=Rt(),Pu=Ve();vi.exports=function(e,t,o){o=o===void 0?function(){}:o,Object.defineProperty(e,t,{get:function n(){!Nu()&&!wi(this,"lockSsfi")&&wi(this,"ssfi",n);var i=o.call(this);if(i!==void 0)return i;var s=new Tu.Assertion;return Pu(this,s),s},configurable:!0})}});var zt=O((pd,Ei)=>{var Ou=Object.getOwnPropertyDescriptor(function(){},"length");Ei.exports=function(e,t,o){return Ou.configurable&&Object.defineProperty(e,"length",{get:function(){throw Error(o?"Invalid Chai property: "+t+'.length. Due to a compatibility issue, "length" cannot directly follow "'+t+'". Use "'+t+'.lengthOf" instead.':"Invalid Chai property: "+t+'.length. See docs for proper usage of "'+t+'".')}}),e}});var Si=O((yd,Ai)=>{Ai.exports=function(e){var t=Object.getOwnPropertyNames(e);function o(i){t.indexOf(i)===-1&&t.push(i)}for(var n=Object.getPrototypeOf(e);n!==null;)Object.getOwnPropertyNames(n).forEach(o),n=Object.getPrototypeOf(n);return t}});var Ft=O((md,Pi)=>{var Mu=nt(),Ti=Ae(),Iu=Si(),Du=Rt();var Ni=["__flags","__methods","_obj","assert"];Pi.exports=function(e,t){return Du()?new Proxy(e,{get:function o(n,i){if(typeof i=="string"&&Mu.proxyExcludedKeys.indexOf(i)===-1&&!Reflect.has(n,i)){if(t)throw Error("Invalid Chai property: "+t+"."+i+'. See docs for proper usage of "'+t+'".');var s=null,a=4;throw Iu(n).forEach(function(c){if(!Object.prototype.hasOwnProperty(c)&&Ni.indexOf(c)===-1){var u=_u(i,c,a);u<a&&(s=c,a=u)}}),Error(s!==null?"Invalid Chai property: "+i+'. Did you mean "'+s+'"?':"Invalid Chai property: "+i)}return Ni.indexOf(i)===-1&&!Ti(n,"lockSsfi")&&Ti(n,"ssfi",o),Reflect.get(n,i)}}):e};function _u(r,e,t){if(Math.abs(r.length-e.length)>=t)return t;for(var o=[],n=0;n<=r.length;n++)o[n]=Array(e.length+1).fill(0),o[n][0]=n;for(var i=0;i<e.length;i++)o[0][i]=i;for(var n=1;n<=r.length;n++)for(var s=r.charCodeAt(n-1),i=1;i<=e.length;i++){if(Math.abs(n-i)>=t){o[n][i]=t;continue}o[n][i]=Math.min(o[n-1][i]+1,o[n][i-1]+1,o[n-1][i-1]+(s===e.charCodeAt(i-1)?0:1))}return o[r.length][e.length]}});var Ii=O((gd,Mi)=>{var Cu=zt(),ju=$e(),Oi=Ae(),qu=Ft(),Bu=Ve();Mi.exports=function(e,t,o){var n=function(){Oi(this,"lockSsfi")||Oi(this,"ssfi",n);var i=o.apply(this,arguments);if(i!==void 0)return i;var s=new ju.Assertion;return Bu(this,s),s};Cu(n,t,!1),e[t]=qu(n,t)}});var _i=O((bd,Di)=>{var ku=$e(),Vt=Ae(),Lu=Rt(),Uu=Ve();Di.exports=function(e,t,o){var n=Object.getOwnPropertyDescriptor(e,t),i=function(){};n&&typeof n.get=="function"&&(i=n.get),Object.defineProperty(e,t,{get:function s(){!Lu()&&!Vt(this,"lockSsfi")&&Vt(this,"ssfi",s);var a=Vt(this,"lockSsfi");Vt(this,"lockSsfi",!0);var c=o(i).call(this);if(Vt(this,"lockSsfi",a),c!==void 0)return c;var u=new ku.Assertion;return Uu(this,u),u},configurable:!0})}});var ji=O((wd,Ci)=>{var Ru=zt(),zu=$e(),$t=Ae(),Fu=Ft(),Vu=Ve();Ci.exports=function(e,t,o){var n=e[t],i=function(){throw new Error(t+" is not a function")};n&&typeof n=="function"&&(i=n);var s=function(){$t(this,"lockSsfi")||$t(this,"ssfi",s);var a=$t(this,"lockSsfi");$t(this,"lockSsfi",!0);var c=o(i).apply(this,arguments);if($t(this,"lockSsfi",a),c!==void 0)return c;var u=new zu.Assertion;return Vu(this,u),u};Ru(s,t,!1),e[t]=Fu(s,t)}});var Ui=O((vd,Li)=>{var $u=zt(),Wu=$e(),qi=Ae(),Gu=Ft(),Bi=Ve();var Ku=typeof Object.setPrototypeOf=="function",ki=function(){},Ju=Object.getOwnPropertyNames(ki).filter(function(r){var e=Object.getOwnPropertyDescriptor(ki,r);return typeof e!="object"?!0:!e.configurable}),Xu=Function.prototype.call,Qu=Function.prototype.apply;Li.exports=function(e,t,o,n){typeof n!="function"&&(n=function(){});var i={method:o,chainingBehavior:n};e.__methods||(e.__methods={}),e.__methods[t]=i,Object.defineProperty(e,t,{get:function(){i.chainingBehavior.call(this);var a=function(){qi(this,"lockSsfi")||qi(this,"ssfi",a);var d=i.method.apply(this,arguments);if(d!==void 0)return d;var w=new Wu.Assertion;return Bi(this,w),w};if($u(a,t,!0),Ku){var c=Object.create(this);c.call=Xu,c.apply=Qu,Object.setPrototypeOf(a,c)}else{var u=Object.getOwnPropertyNames(e);u.forEach(function(d){if(Ju.indexOf(d)===-1){var w=Object.getOwnPropertyDescriptor(e,d);Object.defineProperty(a,d,w)}})}return Bi(this,a),Gu(a)},configurable:!0})}});var Vi=O((xd,Fi)=>{var Ri=$e(),zi=Ve();Fi.exports=function(e,t,o,n){var i=e.__methods[t],s=i.chainingBehavior;i.chainingBehavior=function(){var u=n(s).call(this);if(u!==void 0)return u;var d=new Ri.Assertion;return zi(this,d),d};var a=i.method;i.method=function(){var u=o(a).apply(this,arguments);if(u!==void 0)return u;var d=new Ri.Assertion;return zi(this,d),d}}});var Gi=O((Ed,Wi)=>{var $i=pr();Wi.exports=function(e,t){return $i(e)<$i(t)?-1:1}});var on=O((Ad,Ki)=>{Ki.exports=function(e){return typeof Object.getOwnPropertySymbols!="function"?[]:Object.getOwnPropertySymbols(e).filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})}});var Xi=O((Sd,Ji)=>{var Zu=on();Ji.exports=function(e){return Object.keys(e).concat(Zu(e))}});var an=O((Td,Qi)=>{"use strict";function Yu(r,e){return e instanceof Error&&r===e}function Hu(r,e){return e instanceof Error?r.constructor===e.constructor||r instanceof e.constructor:e.prototype instanceof Error||e===Error?r.constructor===e||r instanceof e:!1}function ef(r,e){var t=typeof r=="string"?r:r.message;return e instanceof RegExp?e.test(t):typeof e=="string"?t.indexOf(e)!==-1:!1}var tf=/\s*function(?:\s|\s*\/\*[^(?:*\/)]+\*\/\s*)*([^\(\/]+)/;function sn(r){var e="";if(typeof r.name>"u"){var t=String(r).match(tf);t&&(e=t[1])}else e=r.name;return e}function rf(r){var e=r;return r instanceof Error?e=sn(r.constructor):typeof r=="function"&&(e=sn(r).trim()||sn(new r)),e}function nf(r){var e="";return r&&r.message?e=r.message:typeof r=="string"&&(e=r),e}Qi.exports={compatibleInstance:Yu,compatibleConstructor:Hu,compatibleMessage:ef,getMessage:nf,getConstructorName:rf}});var Yi=O((Nd,Zi)=>{function of(r){return r!==r}Zi.exports=Number.isNaN||of});var ts=O((Pd,es)=>{var sf=Ut(),Hi=Ae();function af(r){var e=sf(r),t=["Array","Object","function"];return t.indexOf(e)!==-1}es.exports=function(e,t){var o=Hi(e,"operator"),n=Hi(e,"negate"),i=t[3],s=n?t[2]:t[1];if(o)return o;if(typeof s=="function"&&(s=s()),s=s||"",!!s&&!/\shave\s/.test(s)){var a=af(i);return/\snot\s/.test(s)?a?"notDeepStrictEqual":"notStrictEqual":a?"deepStrictEqual":"strictEqual"}}});var ns=O(J=>{var rs=Fo();J.test=Wo();J.type=Ut();J.expectTypes=Ko();J.getMessage=oi();J.getActual=Qr();J.inspect=pr();J.objDisplay=Yr();J.flag=Ae();J.transferFlags=Ve();J.eql=gi();J.getPathInfo=rs.getPathInfo;J.hasProperty=rs.hasProperty;J.getName=Zr();J.addProperty=xi();J.addMethod=Ii();J.overwriteProperty=_i();J.overwriteMethod=ji();J.addChainableMethod=Ui();J.overwriteChainableMethod=Vi();J.compareByInspect=Gi();J.getOwnEnumerablePropertySymbols=on();J.getOwnEnumerableProperties=Xi();J.checkError=an();J.proxify=Ft();J.addLengthGuard=zt();J.isProxyEnabled=Rt();J.isNaN=Yi();J.getOperator=ts()});var is=O((Md,os)=>{var vt=nt();os.exports=function(r,e){var t=r.AssertionError,o=e.flag;r.Assertion=n;function n(i,s,a,c){return o(this,"ssfi",a||n),o(this,"lockSsfi",c),o(this,"object",i),o(this,"message",s),e.proxify(this)}Object.defineProperty(n,"includeStack",{get:function(){return console.warn("Assertion.includeStack is deprecated, use chai.config.includeStack instead."),vt.includeStack},set:function(i){console.warn("Assertion.includeStack is deprecated, use chai.config.includeStack instead."),vt.includeStack=i}}),Object.defineProperty(n,"showDiff",{get:function(){return console.warn("Assertion.showDiff is deprecated, use chai.config.showDiff instead."),vt.showDiff},set:function(i){console.warn("Assertion.showDiff is deprecated, use chai.config.showDiff instead."),vt.showDiff=i}}),n.addProperty=function(i,s){e.addProperty(this.prototype,i,s)},n.addMethod=function(i,s){e.addMethod(this.prototype,i,s)},n.addChainableMethod=function(i,s,a){e.addChainableMethod(this.prototype,i,s,a)},n.overwriteProperty=function(i,s){e.overwriteProperty(this.prototype,i,s)},n.overwriteMethod=function(i,s){e.overwriteMethod(this.prototype,i,s)},n.overwriteChainableMethod=function(i,s,a){e.overwriteChainableMethod(this.prototype,i,s,a)},n.prototype.assert=function(i,s,a,c,u,d){var w=e.test(this,arguments);if(d!==!1&&(d=!0),c===void 0&&u===void 0&&(d=!1),vt.showDiff!==!0&&(d=!1),!w){s=e.getMessage(this,arguments);var q=e.getActual(this,arguments),k={actual:q,expected:c,showDiff:d},N=e.getOperator(this,arguments);throw N&&(k.operator=N),new t(s,k,vt.includeStack?this.assert:o(this,"ssfi"))}};Object.defineProperty(n.prototype,"_obj",{get:function(){return o(this,"object")},set:function(i){o(this,"object",i)}})}});var as=O((Id,ss)=>{ss.exports=function(r,e){var t=r.Assertion,o=r.AssertionError,n=e.flag;["to","be","been","is","and","has","have","with","that","which","at","of","same","but","does","still","also"].forEach(function(f){t.addProperty(f)}),t.addProperty("not",function(){n(this,"negate",!0)}),t.addProperty("deep",function(){n(this,"deep",!0)}),t.addProperty("nested",function(){n(this,"nested",!0)}),t.addProperty("own",function(){n(this,"own",!0)}),t.addProperty("ordered",function(){n(this,"ordered",!0)}),t.addProperty("any",function(){n(this,"any",!0),n(this,"all",!1)}),t.addProperty("all",function(){n(this,"all",!0),n(this,"any",!1)});function i(f,p){p&&n(this,"message",p),f=f.toLowerCase();var g=n(this,"object"),v=~["a","e","i","o","u"].indexOf(f.charAt(0))?"an ":"a ";this.assert(f===e.type(g).toLowerCase(),"expected #{this} to be "+v+f,"expected #{this} not to be "+v+f)}t.addChainableMethod("an",i),t.addChainableMethod("a",i);function s(f,p){return e.isNaN(f)&&e.isNaN(p)||f===p}function a(){n(this,"contains",!0)}function c(f,p){p&&n(this,"message",p);var g=n(this,"object"),v=e.type(g).toLowerCase(),A=n(this,"message"),T=n(this,"negate"),x=n(this,"ssfi"),m=n(this,"deep"),M=m?"deep ":"";A=A?A+": ":"";var j=!1;switch(v){case"string":j=g.indexOf(f)!==-1;break;case"weakset":if(m)throw new o(A+"unable to use .deep.include with WeakSet",void 0,x);j=g.has(f);break;case"map":var F=m?e.eql:s;g.forEach(function(G){j=j||F(G,f)});break;case"set":m?g.forEach(function(G){j=j||e.eql(G,f)}):j=g.has(f);break;case"array":m?j=g.some(function(G){return e.eql(G,f)}):j=g.indexOf(f)!==-1;break;default:if(f!==Object(f))throw new o(A+"the given combination of arguments ("+v+" and "+e.type(f).toLowerCase()+") is invalid for this assertion. You can use an array, a map, an object, a set, a string, or a weakset instead of a "+e.type(f).toLowerCase(),void 0,x);var X=Object.keys(f),z=null,L=0;if(X.forEach(function(G){var ie=new t(g);if(e.transferFlags(this,ie,!0),n(ie,"lockSsfi",!0),!T||X.length===1){ie.property(G,f[G]);return}try{ie.property(G,f[G])}catch(le){if(!e.checkError.compatibleConstructor(le,o))throw le;z===null&&(z=le),L++}},this),T&&X.length>1&&L===X.length)throw z;return}this.assert(j,"expected #{this} to "+M+"include "+e.inspect(f),"expected #{this} to not "+M+"include "+e.inspect(f))}t.addChainableMethod("include",c,a),t.addChainableMethod("contain",c,a),t.addChainableMethod("contains",c,a),t.addChainableMethod("includes",c,a),t.addProperty("ok",function(){this.assert(n(this,"object"),"expected #{this} to be truthy","expected #{this} to be falsy")}),t.addProperty("true",function(){this.assert(n(this,"object")===!0,"expected #{this} to be true","expected #{this} to be false",!n(this,"negate"))}),t.addProperty("false",function(){this.assert(n(this,"object")===!1,"expected #{this} to be false","expected #{this} to be true",!!n(this,"negate"))}),t.addProperty("null",function(){this.assert(n(this,"object")===null,"expected #{this} to be null","expected #{this} not to be null")}),t.addProperty("undefined",function(){this.assert(n(this,"object")===void 0,"expected #{this} to be undefined","expected #{this} not to be undefined")}),t.addProperty("NaN",function(){this.assert(e.isNaN(n(this,"object")),"expected #{this} to be NaN","expected #{this} not to be NaN")});function u(){var f=n(this,"object");this.assert(f!=null,"expected #{this} to exist","expected #{this} to not exist")}t.addProperty("exist",u),t.addProperty("exists",u),t.addProperty("empty",function(){var f=n(this,"object"),p=n(this,"ssfi"),g=n(this,"message"),v;switch(g=g?g+": ":"",e.type(f).toLowerCase()){case"array":case"string":v=f.length;break;case"map":case"set":v=f.size;break;case"weakmap":case"weakset":throw new o(g+".empty was passed a weak collection",void 0,p);case"function":var A=g+".empty was passed a function "+e.getName(f);throw new o(A.trim(),void 0,p);default:if(f!==Object(f))throw new o(g+".empty was passed non-string primitive "+e.inspect(f),void 0,p);v=Object.keys(f).length}this.assert(v===0,"expected #{this} to be empty","expected #{this} not to be empty")});function d(){var f=n(this,"object"),p=e.type(f);this.assert(p==="Arguments","expected #{this} to be arguments but got "+p,"expected #{this} to not be arguments")}t.addProperty("arguments",d),t.addProperty("Arguments",d);function w(f,p){p&&n(this,"message",p);var g=n(this,"object");if(n(this,"deep")){var v=n(this,"lockSsfi");n(this,"lockSsfi",!0),this.eql(f),n(this,"lockSsfi",v)}else this.assert(f===g,"expected #{this} to equal #{exp}","expected #{this} to not equal #{exp}",f,this._obj,!0)}t.addMethod("equal",w),t.addMethod("equals",w),t.addMethod("eq",w);function q(f,p){p&&n(this,"message",p),this.assert(e.eql(f,n(this,"object")),"expected #{this} to deeply equal #{exp}","expected #{this} to not deeply equal #{exp}",f,this._obj,!0)}t.addMethod("eql",q),t.addMethod("eqls",q);function k(f,p){p&&n(this,"message",p);var g=n(this,"object"),v=n(this,"doLength"),A=n(this,"message"),T=A?A+": ":"",x=n(this,"ssfi"),m=e.type(g).toLowerCase(),M=e.type(f).toLowerCase(),j,F=!0;if(v&&m!=="map"&&m!=="set"&&new t(g,A,x,!0).to.have.property("length"),!v&&m==="date"&&M!=="date")j=T+"the argument to above must be a date";else if(M!=="number"&&(v||m==="number"))j=T+"the argument to above must be a number";else if(!v&&m!=="date"&&m!=="number"){var X=m==="string"?"'"+g+"'":g;j=T+"expected "+X+" to be a number or a date"}else F=!1;if(F)throw new o(j,void 0,x);if(v){var z="length",L;m==="map"||m==="set"?(z="size",L=g.size):L=g.length,this.assert(L>f,"expected #{this} to have a "+z+" above #{exp} but got #{act}","expected #{this} to not have a "+z+" above #{exp}",f,L)}else this.assert(g>f,"expected #{this} to be above #{exp}","expected #{this} to be at most #{exp}",f)}t.addMethod("above",k),t.addMethod("gt",k),t.addMethod("greaterThan",k);function N(f,p){p&&n(this,"message",p);var g=n(this,"object"),v=n(this,"doLength"),A=n(this,"message"),T=A?A+": ":"",x=n(this,"ssfi"),m=e.type(g).toLowerCase(),M=e.type(f).toLowerCase(),j,F=!0;if(v&&m!=="map"&&m!=="set"&&new t(g,A,x,!0).to.have.property("length"),!v&&m==="date"&&M!=="date")j=T+"the argument to least must be a date";else if(M!=="number"&&(v||m==="number"))j=T+"the argument to least must be a number";else if(!v&&m!=="date"&&m!=="number"){var X=m==="string"?"'"+g+"'":g;j=T+"expected "+X+" to be a number or a date"}else F=!1;if(F)throw new o(j,void 0,x);if(v){var z="length",L;m==="map"||m==="set"?(z="size",L=g.size):L=g.length,this.assert(L>=f,"expected #{this} to have a "+z+" at least #{exp} but got #{act}","expected #{this} to have a "+z+" below #{exp}",f,L)}else this.assert(g>=f,"expected #{this} to be at least #{exp}","expected #{this} to be below #{exp}",f)}t.addMethod("least",N),t.addMethod("gte",N),t.addMethod("greaterThanOrEqual",N);function E(f,p){p&&n(this,"message",p);var g=n(this,"object"),v=n(this,"doLength"),A=n(this,"message"),T=A?A+": ":"",x=n(this,"ssfi"),m=e.type(g).toLowerCase(),M=e.type(f).toLowerCase(),j,F=!0;if(v&&m!=="map"&&m!=="set"&&new t(g,A,x,!0).to.have.property("length"),!v&&m==="date"&&M!=="date")j=T+"the argument to below must be a date";else if(M!=="number"&&(v||m==="number"))j=T+"the argument to below must be a number";else if(!v&&m!=="date"&&m!=="number"){var X=m==="string"?"'"+g+"'":g;j=T+"expected "+X+" to be a number or a date"}else F=!1;if(F)throw new o(j,void 0,x);if(v){var z="length",L;m==="map"||m==="set"?(z="size",L=g.size):L=g.length,this.assert(L<f,"expected #{this} to have a "+z+" below #{exp} but got #{act}","expected #{this} to not have a "+z+" below #{exp}",f,L)}else this.assert(g<f,"expected #{this} to be below #{exp}","expected #{this} to be at least #{exp}",f)}t.addMethod("below",E),t.addMethod("lt",E),t.addMethod("lessThan",E);function I(f,p){p&&n(this,"message",p);var g=n(this,"object"),v=n(this,"doLength"),A=n(this,"message"),T=A?A+": ":"",x=n(this,"ssfi"),m=e.type(g).toLowerCase(),M=e.type(f).toLowerCase(),j,F=!0;if(v&&m!=="map"&&m!=="set"&&new t(g,A,x,!0).to.have.property("length"),!v&&m==="date"&&M!=="date")j=T+"the argument to most must be a date";else if(M!=="number"&&(v||m==="number"))j=T+"the argument to most must be a number";else if(!v&&m!=="date"&&m!=="number"){var X=m==="string"?"'"+g+"'":g;j=T+"expected "+X+" to be a number or a date"}else F=!1;if(F)throw new o(j,void 0,x);if(v){var z="length",L;m==="map"||m==="set"?(z="size",L=g.size):L=g.length,this.assert(L<=f,"expected #{this} to have a "+z+" at most #{exp} but got #{act}","expected #{this} to have a "+z+" above #{exp}",f,L)}else this.assert(g<=f,"expected #{this} to be at most #{exp}","expected #{this} to be above #{exp}",f)}t.addMethod("most",I),t.addMethod("lte",I),t.addMethod("lessThanOrEqual",I),t.addMethod("within",function(f,p,g){g&&n(this,"message",g);var v=n(this,"object"),A=n(this,"doLength"),T=n(this,"message"),x=T?T+": ":"",m=n(this,"ssfi"),M=e.type(v).toLowerCase(),j=e.type(f).toLowerCase(),F=e.type(p).toLowerCase(),X,z=!0,L=j==="date"&&F==="date"?f.toISOString()+".."+p.toISOString():f+".."+p;if(A&&M!=="map"&&M!=="set"&&new t(v,T,m,!0).to.have.property("length"),!A&&M==="date"&&(j!=="date"||F!=="date"))X=x+"the arguments to within must be dates";else if((j!=="number"||F!=="number")&&(A||M==="number"))X=x+"the arguments to within must be numbers";else if(!A&&M!=="date"&&M!=="number"){var G=M==="string"?"'"+v+"'":v;X=x+"expected "+G+" to be a number or a date"}else z=!1;if(z)throw new o(X,void 0,m);if(A){var ie="length",le;M==="map"||M==="set"?(ie="size",le=v.size):le=v.length,this.assert(le>=f&&le<=p,"expected #{this} to have a "+ie+" within "+L,"expected #{this} to not have a "+ie+" within "+L)}else this.assert(v>=f&&v<=p,"expected #{this} to be within "+L,"expected #{this} to not be within "+L)});function B(f,p){p&&n(this,"message",p);var g=n(this,"object"),v=n(this,"ssfi"),A=n(this,"message");try{var T=g instanceof f}catch(m){throw m instanceof TypeError?(A=A?A+": ":"",new o(A+"The instanceof assertion needs a constructor but "+e.type(f)+" was given.",void 0,v)):m}var x=e.getName(f);x===null&&(x="an unnamed constructor"),this.assert(T,"expected #{this} to be an instance of "+x,"expected #{this} to not be an instance of "+x)}t.addMethod("instanceof",B),t.addMethod("instanceOf",B);function $(f,p,g){g&&n(this,"message",g);var v=n(this,"nested"),A=n(this,"own"),T=n(this,"message"),x=n(this,"object"),m=n(this,"ssfi"),M=typeof f;if(T=T?T+": ":"",v){if(M!=="string")throw new o(T+"the argument to property must be a string when using nested syntax",void 0,m)}else if(M!=="string"&&M!=="number"&&M!=="symbol")throw new o(T+"the argument to property must be a string, number, or symbol",void 0,m);if(v&&A)throw new o(T+'The "nested" and "own" flags cannot be combined.',void 0,m);if(x==null)throw new o(T+"Target cannot be null or undefined.",void 0,m);var j=n(this,"deep"),F=n(this,"negate"),X=v?e.getPathInfo(x,f):null,z=v?X.value:x[f],L="";j&&(L+="deep "),A&&(L+="own "),v&&(L+="nested "),L+="property ";var G;A?G=Object.prototype.hasOwnProperty.call(x,f):v?G=X.exists:G=e.hasProperty(x,f),(!F||arguments.length===1)&&this.assert(G,"expected #{this} to have "+L+e.inspect(f),"expected #{this} to not have "+L+e.inspect(f)),arguments.length>1&&this.assert(G&&(j?e.eql(p,z):p===z),"expected #{this} to have "+L+e.inspect(f)+" of #{exp}, but got #{act}","expected #{this} to not have "+L+e.inspect(f)+" of #{act}",p,z),n(this,"object",z)}t.addMethod("property",$);function Q(f,p,g){n(this,"own",!0),$.apply(this,arguments)}t.addMethod("ownProperty",Q),t.addMethod("haveOwnProperty",Q);function te(f,p,g){typeof p=="string"&&(g=p,p=null),g&&n(this,"message",g);var v=n(this,"object"),A=Object.getOwnPropertyDescriptor(Object(v),f);A&&p?this.assert(e.eql(p,A),"expected the own property descriptor for "+e.inspect(f)+" on #{this} to match "+e.inspect(p)+", got "+e.inspect(A),"expected the own property descriptor for "+e.inspect(f)+" on #{this} to not match "+e.inspect(p),p,A,!0):this.assert(A,"expected #{this} to have an own property descriptor for "+e.inspect(f),"expected #{this} to not have an own property descriptor for "+e.inspect(f)),n(this,"object",A)}t.addMethod("ownPropertyDescriptor",te),t.addMethod("haveOwnPropertyDescriptor",te);function y(){n(this,"doLength",!0)}function S(f,p){p&&n(this,"message",p);var g=n(this,"object"),v=e.type(g).toLowerCase(),A=n(this,"message"),T=n(this,"ssfi"),x="length",m;switch(v){case"map":case"set":x="size",m=g.size;break;default:new t(g,A,T,!0).to.have.property("length"),m=g.length}this.assert(m==f,"expected #{this} to have a "+x+" of #{exp} but got #{act}","expected #{this} to not have a "+x+" of #{act}",f,m)}t.addChainableMethod("length",S,y),t.addChainableMethod("lengthOf",S,y);function C(f,p){p&&n(this,"message",p);var g=n(this,"object");this.assert(f.exec(g),"expected #{this} to match "+f,"expected #{this} not to match "+f)}t.addMethod("match",C),t.addMethod("matches",C),t.addMethod("string",function(f,p){p&&n(this,"message",p);var g=n(this,"object"),v=n(this,"message"),A=n(this,"ssfi");new t(g,v,A,!0).is.a("string"),this.assert(~g.indexOf(f),"expected #{this} to contain "+e.inspect(f),"expected #{this} to not contain "+e.inspect(f))});function U(f){var p=n(this,"object"),g=e.type(p),v=e.type(f),A=n(this,"ssfi"),T=n(this,"deep"),x,m="",M,j=!0,F=n(this,"message");F=F?F+": ":"";var X=F+"when testing keys against an object or an array you must give a single Array|Object|String argument or multiple String arguments";if(g==="Map"||g==="Set")m=T?"deeply ":"",M=[],p.forEach(function(ce,Be){M.push(Be)}),v!=="Array"&&(f=Array.prototype.slice.call(arguments));else{switch(M=e.getOwnEnumerableProperties(p),v){case"Array":if(arguments.length>1)throw new o(X,void 0,A);break;case"Object":if(arguments.length>1)throw new o(X,void 0,A);f=Object.keys(f);break;default:f=Array.prototype.slice.call(arguments)}f=f.map(function(ce){return typeof ce=="symbol"?ce:String(ce)})}if(!f.length)throw new o(F+"keys required",void 0,A);var z=f.length,L=n(this,"any"),G=n(this,"all"),ie=f;if(!L&&!G&&(G=!0),L&&(j=ie.some(function(ce){return M.some(function(Be){return T?e.eql(ce,Be):ce===Be})})),G&&(j=ie.every(function(ce){return M.some(function(Be){return T?e.eql(ce,Be):ce===Be})}),n(this,"contains")||(j=j&&f.length==M.length)),z>1){f=f.map(function(ce){return e.inspect(ce)});var le=f.pop();G&&(x=f.join(", ")+", and "+le),L&&(x=f.join(", ")+", or "+le)}else x=e.inspect(f[0]);x=(z>1?"keys ":"key ")+x,x=(n(this,"contains")?"contain ":"have ")+x,this.assert(j,"expected #{this} to "+m+x,"expected #{this} to not "+m+x,ie.slice(0).sort(e.compareByInspect),M.sort(e.compareByInspect),!0)}t.addMethod("keys",U),t.addMethod("key",U);function re(f,p,g){g&&n(this,"message",g);var v=n(this,"object"),A=n(this,"ssfi"),T=n(this,"message"),x=n(this,"negate")||!1;new t(v,T,A,!0).is.a("function"),(f instanceof RegExp||typeof f=="string")&&(p=f,f=null);var m;try{v()}catch(ce){m=ce}var M=f===void 0&&p===void 0,j=Boolean(f&&p),F=!1,X=!1;if(M||!M&&!x){var z="an error";f instanceof Error?z="#{exp}":f&&(z=e.checkError.getConstructorName(f)),this.assert(m,"expected #{this} to throw "+z,"expected #{this} to not throw an error but #{act} was thrown",f&&f.toString(),m instanceof Error?m.toString():typeof m=="string"?m:m&&e.checkError.getConstructorName(m))}if(f&&m){if(f instanceof Error){var L=e.checkError.compatibleInstance(m,f);L===x&&(j&&x?F=!0:this.assert(x,"expected #{this} to throw #{exp} but #{act} was thrown","expected #{this} to not throw #{exp}"+(m&&!x?" but #{act} was thrown":""),f.toString(),m.toString()))}var G=e.checkError.compatibleConstructor(m,f);G===x&&(j&&x?F=!0:this.assert(x,"expected #{this} to throw #{exp} but #{act} was thrown","expected #{this} to not throw #{exp}"+(m?" but #{act} was thrown":""),f instanceof Error?f.toString():f&&e.checkError.getConstructorName(f),m instanceof Error?m.toString():m&&e.checkError.getConstructorName(m)))}if(m&&p!==void 0&&p!==null){var ie="including";p instanceof RegExp&&(ie="matching");var le=e.checkError.compatibleMessage(m,p);le===x&&(j&&x?X=!0:this.assert(x,"expected #{this} to throw error "+ie+" #{exp} but got #{act}","expected #{this} to throw error not "+ie+" #{exp}",p,e.checkError.getMessage(m)))}F&&X&&this.assert(x,"expected #{this} to throw #{exp} but #{act} was thrown","expected #{this} to not throw #{exp}"+(m?" but #{act} was thrown":""),f instanceof Error?f.toString():f&&e.checkError.getConstructorName(f),m instanceof Error?m.toString():m&&e.checkError.getConstructorName(m)),n(this,"object",m)}t.addMethod("throw",re),t.addMethod("throws",re),t.addMethod("Throw",re);function De(f,p){p&&n(this,"message",p);var g=n(this,"object"),v=n(this,"itself"),A=typeof g=="function"&&!v?g.prototype[f]:g[f];this.assert(typeof A=="function","expected #{this} to respond to "+e.inspect(f),"expected #{this} to not respond to "+e.inspect(f))}t.addMethod("respondTo",De),t.addMethod("respondsTo",De),t.addProperty("itself",function(){n(this,"itself",!0)});function fe(f,p){p&&n(this,"message",p);var g=n(this,"object"),v=f(g);this.assert(v,"expected #{this} to satisfy "+e.objDisplay(f),"expected #{this} to not satisfy"+e.objDisplay(f),!n(this,"negate"),v)}t.addMethod("satisfy",fe),t.addMethod("satisfies",fe);function mt(f,p,g){g&&n(this,"message",g);var v=n(this,"object"),A=n(this,"message"),T=n(this,"ssfi");if(new t(v,A,T,!0).is.a("number"),typeof f!="number"||typeof p!="number"){A=A?A+": ":"";var x=p===void 0?", and a delta is required":"";throw new o(A+"the arguments to closeTo or approximately must be numbers"+x,void 0,T)}this.assert(Math.abs(v-f)<=p,"expected #{this} to be close to "+f+" +/- "+p,"expected #{this} not to be close to "+f+" +/- "+p)}t.addMethod("closeTo",mt),t.addMethod("approximately",mt);function ge(f,p,g,v,A){if(!v){if(f.length!==p.length)return!1;p=p.slice()}return f.every(function(T,x){if(A)return g?g(T,p[x]):T===p[x];if(!g){var m=p.indexOf(T);return m===-1?!1:(v||p.splice(m,1),!0)}return p.some(function(M,j){return g(T,M)?(v||p.splice(j,1),!0):!1})})}t.addMethod("members",function(f,p){p&&n(this,"message",p);var g=n(this,"object"),v=n(this,"message"),A=n(this,"ssfi");new t(g,v,A,!0).to.be.an("array"),new t(f,v,A,!0).to.be.an("array");var T=n(this,"contains"),x=n(this,"ordered"),m,M,j;T?(m=x?"an ordered superset":"a superset",M="expected #{this} to be "+m+" of #{exp}",j="expected #{this} to not be "+m+" of #{exp}"):(m=x?"ordered members":"members",M="expected #{this} to have the same "+m+" as #{exp}",j="expected #{this} to not have the same "+m+" as #{exp}");var F=n(this,"deep")?e.eql:void 0;this.assert(ge(f,g,F,T,x),M,j,f,g,!0)});function Oe(f,p){p&&n(this,"message",p);var g=n(this,"object"),v=n(this,"message"),A=n(this,"ssfi"),T=n(this,"contains"),x=n(this,"deep");new t(f,v,A,!0).to.be.an("array"),T?this.assert(f.some(function(m){return g.indexOf(m)>-1}),"expected #{this} to contain one of #{exp}","expected #{this} to not contain one of #{exp}",f,g):x?this.assert(f.some(function(m){return e.eql(g,m)}),"expected #{this} to deeply equal one of #{exp}","expected #{this} to deeply equal one of #{exp}",f,g):this.assert(f.indexOf(g)>-1,"expected #{this} to be one of #{exp}","expected #{this} to not be one of #{exp}",f,g)}t.addMethod("oneOf",Oe);function xe(f,p,g){g&&n(this,"message",g);var v=n(this,"object"),A=n(this,"message"),T=n(this,"ssfi");new t(v,A,T,!0).is.a("function");var x;p?(new t(f,A,T,!0).to.have.property(p),x=f[p]):(new t(f,A,T,!0).is.a("function"),x=f()),v();var m=p==null?f():f[p],M=p==null?x:"."+p;n(this,"deltaMsgObj",M),n(this,"initialDeltaValue",x),n(this,"finalDeltaValue",m),n(this,"deltaBehavior","change"),n(this,"realDelta",m!==x),this.assert(x!==m,"expected "+M+" to change","expected "+M+" to not change")}t.addMethod("change",xe),t.addMethod("changes",xe);function et(f,p,g){g&&n(this,"message",g);var v=n(this,"object"),A=n(this,"message"),T=n(this,"ssfi");new t(v,A,T,!0).is.a("function");var x;p?(new t(f,A,T,!0).to.have.property(p),x=f[p]):(new t(f,A,T,!0).is.a("function"),x=f()),new t(x,A,T,!0).is.a("number"),v();var m=p==null?f():f[p],M=p==null?x:"."+p;n(this,"deltaMsgObj",M),n(this,"initialDeltaValue",x),n(this,"finalDeltaValue",m),n(this,"deltaBehavior","increase"),n(this,"realDelta",m-x),this.assert(m-x>0,"expected "+M+" to increase","expected "+M+" to not increase")}t.addMethod("increase",et),t.addMethod("increases",et);function ar(f,p,g){g&&n(this,"message",g);var v=n(this,"object"),A=n(this,"message"),T=n(this,"ssfi");new t(v,A,T,!0).is.a("function");var x;p?(new t(f,A,T,!0).to.have.property(p),x=f[p]):(new t(f,A,T,!0).is.a("function"),x=f()),new t(x,A,T,!0).is.a("number"),v();var m=p==null?f():f[p],M=p==null?x:"."+p;n(this,"deltaMsgObj",M),n(this,"initialDeltaValue",x),n(this,"finalDeltaValue",m),n(this,"deltaBehavior","decrease"),n(this,"realDelta",x-m),this.assert(m-x<0,"expected "+M+" to decrease","expected "+M+" to not decrease")}t.addMethod("decrease",ar),t.addMethod("decreases",ar);function Fr(f,p){p&&n(this,"message",p);var g=n(this,"deltaMsgObj"),v=n(this,"initialDeltaValue"),A=n(this,"finalDeltaValue"),T=n(this,"deltaBehavior"),x=n(this,"realDelta"),m;T==="change"?m=Math.abs(A-v)===Math.abs(f):m=x===Math.abs(f),this.assert(m,"expected "+g+" to "+T+" by "+f,"expected "+g+" to not "+T+" by "+f)}t.addMethod("by",Fr),t.addProperty("extensible",function(){var f=n(this,"object"),p=f===Object(f)&&Object.isExtensible(f);this.assert(p,"expected #{this} to be extensible","expected #{this} to not be extensible")}),t.addProperty("sealed",function(){var f=n(this,"object"),p=f===Object(f)?Object.isSealed(f):!0;this.assert(p,"expected #{this} to be sealed","expected #{this} to not be sealed")}),t.addProperty("frozen",function(){var f=n(this,"object"),p=f===Object(f)?Object.isFrozen(f):!0;this.assert(p,"expected #{this} to be frozen","expected #{this} to not be frozen")}),t.addProperty("finite",function(f){var p=n(this,"object");this.assert(typeof p=="number"&&isFinite(p),"expected #{this} to be a finite number","expected #{this} to not be a finite number")})}});var us=O((Dd,cs)=>{cs.exports=function(r,e){r.expect=function(t,o){return new r.Assertion(t,o)},r.expect.fail=function(t,o,n,i){throw arguments.length<2&&(n=t,t=void 0),n=n||"expect.fail()",new r.AssertionError(n,{actual:t,expected:o,operator:i},r.expect.fail)}}});var ls=O((_d,fs)=>{fs.exports=function(r,e){var t=r.Assertion;function o(){function n(){return this instanceof String||this instanceof Number||this instanceof Boolean||typeof Symbol=="function"&&this instanceof Symbol||typeof BigInt=="function"&&this instanceof BigInt?new t(this.valueOf(),null,n):new t(this,null,n)}function i(a){Object.defineProperty(this,"should",{value:a,enumerable:!0,configurable:!0,writable:!0})}Object.defineProperty(Object.prototype,"should",{set:i,get:n,configurable:!0});var s={};return s.fail=function(a,c,u,d){throw arguments.length<2&&(u=a,a=void 0),u=u||"should.fail()",new r.AssertionError(u,{actual:a,expected:c,operator:d},s.fail)},s.equal=function(a,c,u){new t(a,u).to.equal(c)},s.Throw=function(a,c,u,d){new t(a,d).to.Throw(c,u)},s.exist=function(a,c){new t(a,c).to.exist},s.not={},s.not.equal=function(a,c,u){new t(a,u).to.not.equal(c)},s.not.Throw=function(a,c,u,d){new t(a,d).to.not.Throw(c,u)},s.not.exist=function(a,c){new t(a,c).to.not.exist},s.throw=s.Throw,s.not.throw=s.not.Throw,s}r.should=o,r.Should=o}});var ds=O((Cd,hs)=>{hs.exports=function(r,e){var t=r.Assertion,o=e.flag;var n=r.assert=function(i,s){var a=new t(null,null,r.assert,!0);a.assert(i,s,"[ negation message unavailable ]")};n.fail=function(i,s,a,c){throw arguments.length<2&&(a=i,i=void 0),a=a||"assert.fail()",new r.AssertionError(a,{actual:i,expected:s,operator:c},n.fail)},n.isOk=function(i,s){new t(i,s,n.isOk,!0).is.ok},n.isNotOk=function(i,s){new t(i,s,n.isNotOk,!0).is.not.ok},n.equal=function(i,s,a){var c=new t(i,a,n.equal,!0);c.assert(s==o(c,"object"),"expected #{this} to equal #{exp}","expected #{this} to not equal #{act}",s,i,!0)},n.notEqual=function(i,s,a){var c=new t(i,a,n.notEqual,!0);c.assert(s!=o(c,"object"),"expected #{this} to not equal #{exp}","expected #{this} to equal #{act}",s,i,!0)},n.strictEqual=function(i,s,a){new t(i,a,n.strictEqual,!0).to.equal(s)},n.notStrictEqual=function(i,s,a){new t(i,a,n.notStrictEqual,!0).to.not.equal(s)},n.deepEqual=n.deepStrictEqual=function(i,s,a){new t(i,a,n.deepEqual,!0).to.eql(s)},n.notDeepEqual=function(i,s,a){new t(i,a,n.notDeepEqual,!0).to.not.eql(s)},n.isAbove=function(i,s,a){new t(i,a,n.isAbove,!0).to.be.above(s)},n.isAtLeast=function(i,s,a){new t(i,a,n.isAtLeast,!0).to.be.least(s)},n.isBelow=function(i,s,a){new t(i,a,n.isBelow,!0).to.be.below(s)},n.isAtMost=function(i,s,a){new t(i,a,n.isAtMost,!0).to.be.most(s)},n.isTrue=function(i,s){new t(i,s,n.isTrue,!0).is.true},n.isNotTrue=function(i,s){new t(i,s,n.isNotTrue,!0).to.not.equal(!0)},n.isFalse=function(i,s){new t(i,s,n.isFalse,!0).is.false},n.isNotFalse=function(i,s){new t(i,s,n.isNotFalse,!0).to.not.equal(!1)},n.isNull=function(i,s){new t(i,s,n.isNull,!0).to.equal(null)},n.isNotNull=function(i,s){new t(i,s,n.isNotNull,!0).to.not.equal(null)},n.isNaN=function(i,s){new t(i,s,n.isNaN,!0).to.be.NaN},n.isNotNaN=function(i,s){new t(i,s,n.isNotNaN,!0).not.to.be.NaN},n.exists=function(i,s){new t(i,s,n.exists,!0).to.exist},n.notExists=function(i,s){new t(i,s,n.notExists,!0).to.not.exist},n.isUndefined=function(i,s){new t(i,s,n.isUndefined,!0).to.equal(void 0)},n.isDefined=function(i,s){new t(i,s,n.isDefined,!0).to.not.equal(void 0)},n.isFunction=function(i,s){new t(i,s,n.isFunction,!0).to.be.a("function")},n.isNotFunction=function(i,s){new t(i,s,n.isNotFunction,!0).to.not.be.a("function")},n.isObject=function(i,s){new t(i,s,n.isObject,!0).to.be.a("object")},n.isNotObject=function(i,s){new t(i,s,n.isNotObject,!0).to.not.be.a("object")},n.isArray=function(i,s){new t(i,s,n.isArray,!0).to.be.an("array")},n.isNotArray=function(i,s){new t(i,s,n.isNotArray,!0).to.not.be.an("array")},n.isString=function(i,s){new t(i,s,n.isString,!0).to.be.a("string")},n.isNotString=function(i,s){new t(i,s,n.isNotString,!0).to.not.be.a("string")},n.isNumber=function(i,s){new t(i,s,n.isNumber,!0).to.be.a("number")},n.isNotNumber=function(i,s){new t(i,s,n.isNotNumber,!0).to.not.be.a("number")},n.isFinite=function(i,s){new t(i,s,n.isFinite,!0).to.be.finite},n.isBoolean=function(i,s){new t(i,s,n.isBoolean,!0).to.be.a("boolean")},n.isNotBoolean=function(i,s){new t(i,s,n.isNotBoolean,!0).to.not.be.a("boolean")},n.typeOf=function(i,s,a){new t(i,a,n.typeOf,!0).to.be.a(s)},n.notTypeOf=function(i,s,a){new t(i,a,n.notTypeOf,!0).to.not.be.a(s)},n.instanceOf=function(i,s,a){new t(i,a,n.instanceOf,!0).to.be.instanceOf(s)},n.notInstanceOf=function(i,s,a){new t(i,a,n.notInstanceOf,!0).to.not.be.instanceOf(s)},n.include=function(i,s,a){new t(i,a,n.include,!0).include(s)},n.notInclude=function(i,s,a){new t(i,a,n.notInclude,!0).not.include(s)},n.deepInclude=function(i,s,a){new t(i,a,n.deepInclude,!0).deep.include(s)},n.notDeepInclude=function(i,s,a){new t(i,a,n.notDeepInclude,!0).not.deep.include(s)},n.nestedInclude=function(i,s,a){new t(i,a,n.nestedInclude,!0).nested.include(s)},n.notNestedInclude=function(i,s,a){new t(i,a,n.notNestedInclude,!0).not.nested.include(s)},n.deepNestedInclude=function(i,s,a){new t(i,a,n.deepNestedInclude,!0).deep.nested.include(s)},n.notDeepNestedInclude=function(i,s,a){new t(i,a,n.notDeepNestedInclude,!0).not.deep.nested.include(s)},n.ownInclude=function(i,s,a){new t(i,a,n.ownInclude,!0).own.include(s)},n.notOwnInclude=function(i,s,a){new t(i,a,n.notOwnInclude,!0).not.own.include(s)},n.deepOwnInclude=function(i,s,a){new t(i,a,n.deepOwnInclude,!0).deep.own.include(s)},n.notDeepOwnInclude=function(i,s,a){new t(i,a,n.notDeepOwnInclude,!0).not.deep.own.include(s)},n.match=function(i,s,a){new t(i,a,n.match,!0).to.match(s)},n.notMatch=function(i,s,a){new t(i,a,n.notMatch,!0).to.not.match(s)},n.property=function(i,s,a){new t(i,a,n.property,!0).to.have.property(s)},n.notProperty=function(i,s,a){new t(i,a,n.notProperty,!0).to.not.have.property(s)},n.propertyVal=function(i,s,a,c){new t(i,c,n.propertyVal,!0).to.have.property(s,a)},n.notPropertyVal=function(i,s,a,c){new t(i,c,n.notPropertyVal,!0).to.not.have.property(s,a)},n.deepPropertyVal=function(i,s,a,c){new t(i,c,n.deepPropertyVal,!0).to.have.deep.property(s,a)},n.notDeepPropertyVal=function(i,s,a,c){new t(i,c,n.notDeepPropertyVal,!0).to.not.have.deep.property(s,a)},n.ownProperty=function(i,s,a){new t(i,a,n.ownProperty,!0).to.have.own.property(s)},n.notOwnProperty=function(i,s,a){new t(i,a,n.notOwnProperty,!0).to.not.have.own.property(s)},n.ownPropertyVal=function(i,s,a,c){new t(i,c,n.ownPropertyVal,!0).to.have.own.property(s,a)},n.notOwnPropertyVal=function(i,s,a,c){new t(i,c,n.notOwnPropertyVal,!0).to.not.have.own.property(s,a)},n.deepOwnPropertyVal=function(i,s,a,c){new t(i,c,n.deepOwnPropertyVal,!0).to.have.deep.own.property(s,a)},n.notDeepOwnPropertyVal=function(i,s,a,c){new t(i,c,n.notDeepOwnPropertyVal,!0).to.not.have.deep.own.property(s,a)},n.nestedProperty=function(i,s,a){new t(i,a,n.nestedProperty,!0).to.have.nested.property(s)},n.notNestedProperty=function(i,s,a){new t(i,a,n.notNestedProperty,!0).to.not.have.nested.property(s)},n.nestedPropertyVal=function(i,s,a,c){new t(i,c,n.nestedPropertyVal,!0).to.have.nested.property(s,a)},n.notNestedPropertyVal=function(i,s,a,c){new t(i,c,n.notNestedPropertyVal,!0).to.not.have.nested.property(s,a)},n.deepNestedPropertyVal=function(i,s,a,c){new t(i,c,n.deepNestedPropertyVal,!0).to.have.deep.nested.property(s,a)},n.notDeepNestedPropertyVal=function(i,s,a,c){new t(i,c,n.notDeepNestedPropertyVal,!0).to.not.have.deep.nested.property(s,a)},n.lengthOf=function(i,s,a){new t(i,a,n.lengthOf,!0).to.have.lengthOf(s)},n.hasAnyKeys=function(i,s,a){new t(i,a,n.hasAnyKeys,!0).to.have.any.keys(s)},n.hasAllKeys=function(i,s,a){new t(i,a,n.hasAllKeys,!0).to.have.all.keys(s)},n.containsAllKeys=function(i,s,a){new t(i,a,n.containsAllKeys,!0).to.contain.all.keys(s)},n.doesNotHaveAnyKeys=function(i,s,a){new t(i,a,n.doesNotHaveAnyKeys,!0).to.not.have.any.keys(s)},n.doesNotHaveAllKeys=function(i,s,a){new t(i,a,n.doesNotHaveAllKeys,!0).to.not.have.all.keys(s)},n.hasAnyDeepKeys=function(i,s,a){new t(i,a,n.hasAnyDeepKeys,!0).to.have.any.deep.keys(s)},n.hasAllDeepKeys=function(i,s,a){new t(i,a,n.hasAllDeepKeys,!0).to.have.all.deep.keys(s)},n.containsAllDeepKeys=function(i,s,a){new t(i,a,n.containsAllDeepKeys,!0).to.contain.all.deep.keys(s)},n.doesNotHaveAnyDeepKeys=function(i,s,a){new t(i,a,n.doesNotHaveAnyDeepKeys,!0).to.not.have.any.deep.keys(s)},n.doesNotHaveAllDeepKeys=function(i,s,a){new t(i,a,n.doesNotHaveAllDeepKeys,!0).to.not.have.all.deep.keys(s)},n.throws=function(i,s,a,c){(typeof s=="string"||s instanceof RegExp)&&(a=s,s=null);var u=new t(i,c,n.throws,!0).to.throw(s,a);return o(u,"object")},n.doesNotThrow=function(i,s,a,c){(typeof s=="string"||s instanceof RegExp)&&(a=s,s=null),new t(i,c,n.doesNotThrow,!0).to.not.throw(s,a)},n.operator=function(i,s,a,c){var u;switch(s){case"==":u=i==a;break;case"===":u=i===a;break;case">":u=i>a;break;case">=":u=i>=a;break;case"<":u=i<a;break;case"<=":u=i<=a;break;case"!=":u=i!=a;break;case"!==":u=i!==a;break;default:throw c=c&&c+": ",new r.AssertionError(c+'Invalid operator "'+s+'"',void 0,n.operator)}var d=new t(u,c,n.operator,!0);d.assert(o(d,"object")===!0,"expected "+e.inspect(i)+" to be "+s+" "+e.inspect(a),"expected "+e.inspect(i)+" to not be "+s+" "+e.inspect(a))},n.closeTo=function(i,s,a,c){new t(i,c,n.closeTo,!0).to.be.closeTo(s,a)},n.approximately=function(i,s,a,c){new t(i,c,n.approximately,!0).to.be.approximately(s,a)},n.sameMembers=function(i,s,a){new t(i,a,n.sameMembers,!0).to.have.same.members(s)},n.notSameMembers=function(i,s,a){new t(i,a,n.notSameMembers,!0).to.not.have.same.members(s)},n.sameDeepMembers=function(i,s,a){new t(i,a,n.sameDeepMembers,!0).to.have.same.deep.members(s)},n.notSameDeepMembers=function(i,s,a){new t(i,a,n.notSameDeepMembers,!0).to.not.have.same.deep.members(s)},n.sameOrderedMembers=function(i,s,a){new t(i,a,n.sameOrderedMembers,!0).to.have.same.ordered.members(s)},n.notSameOrderedMembers=function(i,s,a){new t(i,a,n.notSameOrderedMembers,!0).to.not.have.same.ordered.members(s)},n.sameDeepOrderedMembers=function(i,s,a){new t(i,a,n.sameDeepOrderedMembers,!0).to.have.same.deep.ordered.members(s)},n.notSameDeepOrderedMembers=function(i,s,a){new t(i,a,n.notSameDeepOrderedMembers,!0).to.not.have.same.deep.ordered.members(s)},n.includeMembers=function(i,s,a){new t(i,a,n.includeMembers,!0).to.include.members(s)},n.notIncludeMembers=function(i,s,a){new t(i,a,n.notIncludeMembers,!0).to.not.include.members(s)},n.includeDeepMembers=function(i,s,a){new t(i,a,n.includeDeepMembers,!0).to.include.deep.members(s)},n.notIncludeDeepMembers=function(i,s,a){new t(i,a,n.notIncludeDeepMembers,!0).to.not.include.deep.members(s)},n.includeOrderedMembers=function(i,s,a){new t(i,a,n.includeOrderedMembers,!0).to.include.ordered.members(s)},n.notIncludeOrderedMembers=function(i,s,a){new t(i,a,n.notIncludeOrderedMembers,!0).to.not.include.ordered.members(s)},n.includeDeepOrderedMembers=function(i,s,a){new t(i,a,n.includeDeepOrderedMembers,!0).to.include.deep.ordered.members(s)},n.notIncludeDeepOrderedMembers=function(i,s,a){new t(i,a,n.notIncludeDeepOrderedMembers,!0).to.not.include.deep.ordered.members(s)},n.oneOf=function(i,s,a){new t(i,a,n.oneOf,!0).to.be.oneOf(s)},n.changes=function(i,s,a,c){arguments.length===3&&typeof s=="function"&&(c=a,a=null),new t(i,c,n.changes,!0).to.change(s,a)},n.changesBy=function(i,s,a,c,u){if(arguments.length===4&&typeof s=="function"){var d=c;c=a,u=d}else arguments.length===3&&(c=a,a=null);new t(i,u,n.changesBy,!0).to.change(s,a).by(c)},n.doesNotChange=function(i,s,a,c){return arguments.length===3&&typeof s=="function"&&(c=a,a=null),new t(i,c,n.doesNotChange,!0).to.not.change(s,a)},n.changesButNotBy=function(i,s,a,c,u){if(arguments.length===4&&typeof s=="function"){var d=c;c=a,u=d}else arguments.length===3&&(c=a,a=null);new t(i,u,n.changesButNotBy,!0).to.change(s,a).but.not.by(c)},n.increases=function(i,s,a,c){return arguments.length===3&&typeof s=="function"&&(c=a,a=null),new t(i,c,n.increases,!0).to.increase(s,a)},n.increasesBy=function(i,s,a,c,u){if(arguments.length===4&&typeof s=="function"){var d=c;c=a,u=d}else arguments.length===3&&(c=a,a=null);new t(i,u,n.increasesBy,!0).to.increase(s,a).by(c)},n.doesNotIncrease=function(i,s,a,c){return arguments.length===3&&typeof s=="function"&&(c=a,a=null),new t(i,c,n.doesNotIncrease,!0).to.not.increase(s,a)},n.increasesButNotBy=function(i,s,a,c,u){if(arguments.length===4&&typeof s=="function"){var d=c;c=a,u=d}else arguments.length===3&&(c=a,a=null);new t(i,u,n.increasesButNotBy,!0).to.increase(s,a).but.not.by(c)},n.decreases=function(i,s,a,c){return arguments.length===3&&typeof s=="function"&&(c=a,a=null),new t(i,c,n.decreases,!0).to.decrease(s,a)},n.decreasesBy=function(i,s,a,c,u){if(arguments.length===4&&typeof s=="function"){var d=c;c=a,u=d}else arguments.length===3&&(c=a,a=null);new t(i,u,n.decreasesBy,!0).to.decrease(s,a).by(c)},n.doesNotDecrease=function(i,s,a,c){return arguments.length===3&&typeof s=="function"&&(c=a,a=null),new t(i,c,n.doesNotDecrease,!0).to.not.decrease(s,a)},n.doesNotDecreaseBy=function(i,s,a,c,u){if(arguments.length===4&&typeof s=="function"){var d=c;c=a,u=d}else arguments.length===3&&(c=a,a=null);return new t(i,u,n.doesNotDecreaseBy,!0).to.not.decrease(s,a).by(c)},n.decreasesButNotBy=function(i,s,a,c,u){if(arguments.length===4&&typeof s=="function"){var d=c;c=a,u=d}else arguments.length===3&&(c=a,a=null);new t(i,u,n.decreasesButNotBy,!0).to.decrease(s,a).but.not.by(c)};n.ifError=function(i){if(i)throw i},n.isExtensible=function(i,s){new t(i,s,n.isExtensible,!0).to.be.extensible},n.isNotExtensible=function(i,s){new t(i,s,n.isNotExtensible,!0).to.not.be.extensible},n.isSealed=function(i,s){new t(i,s,n.isSealed,!0).to.be.sealed},n.isNotSealed=function(i,s){new t(i,s,n.isNotSealed,!0).to.not.be.sealed},n.isFrozen=function(i,s){new t(i,s,n.isFrozen,!0).to.be.frozen},n.isNotFrozen=function(i,s){new t(i,s,n.isNotFrozen,!0).to.not.be.frozen},n.isEmpty=function(i,s){new t(i,s,n.isEmpty,!0).to.be.empty},n.isNotEmpty=function(i,s){new t(i,s,n.isNotEmpty,!0).to.not.be.empty};(function i(s,a){return n[a]=n[s],i})("isOk","ok")("isNotOk","notOk")("throws","throw")("throws","Throw")("isExtensible","extensible")("isNotExtensible","notExtensible")("isSealed","sealed")("isNotSealed","notSealed")("isFrozen","frozen")("isNotFrozen","notFrozen")("isEmpty","empty")("isNotEmpty","notEmpty")}});var $e=O(we=>{var ps=[];we.version="4.3.3";we.AssertionError=Gr();var ys=ns();we.use=function(r){return~ps.indexOf(r)||(r(we,ys),ps.push(r)),we};we.util=ys;var cf=nt();we.config=cf;var uf=is();we.use(uf);var ff=as();we.use(ff);var lf=us();we.use(lf);var hf=ls();we.use(hf);var df=ds();we.use(df)});var gs=O((qd,ms)=>{ms.exports=$e()});var bs=O((Kd,Le)=>{"use strict";var st=an();Le.exports=(r,e)=>{let t=r.Assertion,o=r.assert,n=e.proxify;e.checkError&&(st=e.checkError);function i(y){return typeof y.catch!="function"&&typeof y.always=="function"&&typeof y.done=="function"&&typeof y.fail=="function"&&typeof y.pipe=="function"&&typeof y.progress=="function"&&typeof y.state=="function"}function s(y){if(typeof y._obj.then!="function")throw new TypeError(e.inspect(y._obj)+" is not a thenable.");if(i(y._obj))throw new TypeError("Chai as Promised is incompatible with thenables of jQuery<3.0.0, sorry! Please upgrade jQuery or use another Promises/A+ compatible library (see http://promisesaplus.com/).")}function a(y){return n===void 0?y:n(y)}function c(y,S){e.addMethod(t.prototype,y,function(){return s(this),S.apply(this,arguments)})}function u(y,S){e.addProperty(t.prototype,y,function(){return s(this),a(S.apply(this,arguments))})}function d(y,S){y.then(()=>S(),S)}function w(y,S,C){y.assert(!0,null,S,C.expected,C.actual)}function q(y,S,C){y.assert(!1,S,null,C.expected,C.actual)}function k(y){return typeof y.then=="function"?y:y._obj}function N(y){return y instanceof Error?y.toString():st.getConstructorName(y)}let E=Object.getOwnPropertyNames(t.prototype),I={};for(let y of E)I[y]=Object.getOwnPropertyDescriptor(t.prototype,y);u("fulfilled",function(){let y=k(this).then(S=>(w(this,"expected promise not to be fulfilled but it was fulfilled with #{act}",{actual:S}),S),S=>(q(this,"expected promise to be fulfilled but it was rejected with #{act}",{actual:N(S)}),S));return Le.exports.transferPromiseness(this,y),this}),u("rejected",function(){let y=k(this).then(S=>(q(this,"expected promise to be rejected but it was fulfilled with #{act}",{actual:S}),S),S=>(w(this,"expected promise not to be rejected but it was rejected with #{act}",{actual:N(S)}),S));return Le.exports.transferPromiseness(this,y),this}),c("rejectedWith",function(y,S,C){let U=null,re=e.flag(this,"negate")||!1;if(y===void 0&&S===void 0&&C===void 0)return this.rejected;C!==void 0&&e.flag(this,"message",C),y instanceof RegExp||typeof y=="string"?(S=y,y=null):y&&y instanceof Error?U=y.toString():typeof y=="function"?U=st.getConstructorName(y):y=null;let De=Boolean(y&&S),fe="including";S instanceof RegExp&&(fe="matching");let mt=k(this).then(ge=>{let Oe=null,xe=null;return y?(Oe="expected promise to be rejected with #{exp} but it was fulfilled with #{act}",xe=U):S&&(Oe=`expected promise to be rejected with an error ${fe} #{exp} but it was fulfilled with #{act}`,xe=S),q(this,Oe,{expected:xe,actual:ge}),ge},ge=>{let Oe=y&&(y instanceof Error?st.compatibleInstance(ge,y):st.compatibleConstructor(ge,y)),xe=S&&st.compatibleMessage(ge,S),et=N(ge);return re&&De?Oe&&xe&&this.assert(!0,null,"expected promise not to be rejected with #{exp} but it was rejected with #{act}",U,et):(y&&this.assert(Oe,"expected promise to be rejected with #{exp} but it was rejected with #{act}","expected promise not to be rejected with #{exp} but it was rejected with #{act}",U,et),S&&this.assert(xe,`expected promise to be rejected with an error ${fe} #{exp} but got #{act}`,`expected promise not to be rejected with an error ${fe} #{exp}`,S,st.getMessage(ge))),ge});return Le.exports.transferPromiseness(this,mt),this}),u("eventually",function(){return e.flag(this,"eventually",!0),this}),c("notify",function(y){return d(k(this),y),this}),c("become",function(y,S){return this.eventually.deep.equal(y,S)}),E.filter(y=>y!=="assert"&&typeof I[y].value=="function").forEach(y=>{t.overwriteMethod(y,S=>function(){return Q(S,this,arguments)})}),E.filter(y=>y!=="_obj"&&typeof I[y].get=="function").forEach(y=>{t.prototype.__methods.hasOwnProperty(y)?t.overwriteChainableMethod(y,C=>function(){return Q(C,this,arguments)},C=>function(){return Q(C,this)}):t.overwriteProperty(y,C=>function(){return a(Q(C,this))})});function Q(y,S,C){if(!e.flag(S,"eventually"))return y.apply(S,C),S;let U=k(S).then(re=>(S._obj=re,e.flag(S,"eventually",!1),C&&Le.exports.transformAsserterArgs(C))).then(re=>(y.apply(S,re),S._obj));return Le.exports.transferPromiseness(S,U),S}let te=Object.getOwnPropertyNames(o).filter(y=>typeof o[y]=="function");o.isFulfilled=(y,S)=>new t(y,S).to.be.fulfilled,o.isRejected=(y,S,C,U)=>new t(y,U).to.be.rejectedWith(S,C,U),o.becomes=(y,S,C)=>o.eventually.deepEqual(y,S,C),o.doesNotBecome=(y,S,C)=>o.eventually.notDeepEqual(y,S,C),o.eventually={},te.forEach(y=>{o.eventually[y]=function(S){let C=Array.prototype.slice.call(arguments,1),U,re=arguments[o[y].length-1];typeof re=="string"&&(U=fe=>{throw new r.AssertionError(`${re}
|
|
5
5
|
|
|
6
|
-
Original reason: ${e.inspect(fe)}`)});let De=S.then(fe=>o[y].apply(o,[fe].concat(C)),U);return De.notify=fe=>{d(De,fe)},De}})};Le.exports.transferPromiseness=(r,e)=>{r.then=e.then.bind(e)};Le.exports.transformAsserterArgs=r=>r});var
|
|
7
|
-
`)===-1:!1},r.string.reverseOf=function(s,a){return!t(s)||!t(a)?!1:s.split("").reverse().join("")===a},r.string.palindrome=function(s){if(!t(s))return!1;for(var a=s.length,c=0;c<Math.floor(a/2);c++)if(s[c]!==s[a-1-c])return!1;return!0},r.string.entriesCount=function(s,a,c){var u=0;if(t(s)&&t(a))for(var d=0,w=s.length;d<w;){var B=s.indexOf(a,d);if(B===-1)break;u++,d=B+1}return u===c},r.string.indexOf=function(s,a,c){var u=!t(s)||!t(a)?-1:s.indexOf(a);return u===c};var o=function(s){var a=this._obj;return this.assert(r.string.startsWith(a,s),"expected "+this._obj+" to start with "+s,"expected "+this._obj+" not to start with "+s)};r.Assertion.addChainableMethod("startsWith",o),r.Assertion.addChainableMethod("startWith",o);var n=function(s){var a=this._obj;return this.assert(r.string.endsWith(a,s),"expected "+this._obj+" to end with "+s,"expected "+this._obj+" not to end with "+s)};r.Assertion.addChainableMethod("endsWith",n),r.Assertion.addChainableMethod("endWith",n),r.Assertion.addChainableMethod("equalIgnoreCase",function(s){var a=this._obj;return this.assert(r.string.equalIgnoreCase(a,s),"expected "+this._obj+" to equal "+s+" ignoring case","expected "+this._obj+" not to equal "+s+" ignoring case")}),r.Assertion.addChainableMethod("equalIgnoreSpaces",function(s){var a=this._obj;return this.assert(r.string.equalIgnoreSpaces(a,s),"expected "+this._obj+" to equal "+s+" ignoring spaces","expected "+this._obj+" not to equal "+s+" ignoring spaces")}),r.Assertion.addChainableMethod("containIgnoreSpaces",function(s){var a=this._obj;return this.assert(r.string.containIgnoreSpaces(a,s),"expected "+this._obj+" to contain "+s+" ignoring spaces","expected "+this._obj+" not to contain "+s+" ignoring spaces")}),r.Assertion.addChainableMethod("containIgnoreCase",function(s){var a=this._obj;return this.assert(r.string.containIgnoreCase(a,s),"expected "+this._obj+" to contain "+s+" ignoring case","expected "+this._obj+" not to contain "+s+" ignoring case")}),r.Assertion.addChainableMethod("singleLine",function(){var s=this._obj;return this.assert(r.string.singleLine(s),"expected "+this._obj+" to be a single line","expected "+this._obj+" not to be a single line")}),r.Assertion.addChainableMethod("reverseOf",function(s){var a=this._obj;return this.assert(r.string.reverseOf(a,s),"expected "+this._obj+" to be the reverse of "+s,"expected "+this._obj+" not to be the reverse of "+s)}),r.Assertion.addChainableMethod("palindrome",function(){var s=this._obj;return this.assert(r.string.palindrome(s),"expected "+this._obj+" to be a palindrome","expected "+this._obj+" not to be a palindrome")}),r.Assertion.addChainableMethod("entriesCount",function(s,a){var c=this._obj;return this.assert(r.string.entriesCount(c,s,a),"expected "+this._obj+" to have "+s+" "+a+" time(s)","expected "+this._obj+" to not have "+s+" "+a+" time(s)")}),r.Assertion.addChainableMethod("indexOf",function(s,a){var c=this._obj;return this.assert(r.string.indexOf(c,s,a),"expected "+this._obj+" to have "+s+" on index "+a,"expected "+this._obj+" to not have "+s+" on index "+a)});var i=r.assert;i.startsWith=function(s,a,c){new r.Assertion(s,c).to.startsWith(a)},i.notStartsWith=function(s,a,c){new r.Assertion(s,c).to.not.startsWith(a)},i.endsWith=function(s,a,c){new r.Assertion(s,c).to.endsWith(a)},i.notEndsWith=function(s,a,c){new r.Assertion(s,c).to.not.endsWith(a)},i.equalIgnoreCase=function(s,a,c){new r.Assertion(s,c).to.be.equalIgnoreCase(a)},i.notEqualIgnoreCase=function(s,a,c){new r.Assertion(s,c).to.not.be.equalIgnoreCase(a)},i.equalIgnoreSpaces=function(s,a,c){new r.Assertion(s,c).to.be.equalIgnoreSpaces(a)},i.notEqualIgnoreSpaces=function(s,a,c){new r.Assertion(s,c).to.not.be.equalIgnoreSpaces(a)},i.containIgnoreSpaces=function(s,a,c){new r.Assertion(s,c).to.be.containIgnoreSpaces(a)},i.notContainIgnoreSpaces=function(s,a,c){new r.Assertion(s,c).to.not.be.containIgnoreSpaces(a)},i.containIgnoreCase=function(s,a,c){new r.Assertion(s,c).to.be.containIgnoreCase(a)},i.notContainIgnoreCase=function(s,a,c){new r.Assertion(s,c).to.not.be.containIgnoreCase(a)},i.singleLine=function(s,a,c){new r.Assertion(s,c).to.be.singleLine()},i.notSingleLine=function(s,a,c){new r.Assertion(s,c).to.not.be.singleLine()},i.reverseOf=function(s,a,c){new r.Assertion(s,c).to.be.reverseOf(a)},i.notReverseOf=function(s,a,c){new r.Assertion(s,c).to.not.be.reverseOf(a)},i.palindrome=function(s,a,c){new r.Assertion(s,c).to.be.palindrome()},i.notPalindrome=function(s,a,c){new r.Assertion(s,c).to.not.be.palindrome()},i.entriesCount=function(s,a,c,u){new r.Assertion(s,u).to.have.entriesCount(a,c)},i.indexOf=function(s,a,c,u){new r.Assertion(s,u).to.have.indexOf(a,c)}})});var Hs=O((ey,Ys)=>{function Ne(r,e){typeof e=="boolean"&&(e={forever:e}),this._originalTimeouts=JSON.parse(JSON.stringify(r)),this._timeouts=r,this._options=e||{},this._maxRetryTime=e&&e.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._timer=null,this._options.forever&&(this._cachedTimeouts=this._timeouts.slice(0))}Ys.exports=Ne;Ne.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts.slice(0)};Ne.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timer&&clearTimeout(this._timer),this._timeouts=[],this._cachedTimeouts=null};Ne.prototype.retry=function(r){if(this._timeout&&clearTimeout(this._timeout),!r)return!1;var e=new Date().getTime();if(r&&e-this._operationStart>=this._maxRetryTime)return this._errors.push(r),this._errors.unshift(new Error("RetryOperation timeout occurred")),!1;this._errors.push(r);var t=this._timeouts.shift();if(t===void 0)if(this._cachedTimeouts)this._errors.splice(0,this._errors.length-1),t=this._cachedTimeouts.slice(-1);else return!1;var o=this;return this._timer=setTimeout(function(){o._attempts++,o._operationTimeoutCb&&(o._timeout=setTimeout(function(){o._operationTimeoutCb(o._attempts)},o._operationTimeout),o._options.unref&&o._timeout.unref()),o._fn(o._attempts)},t),this._options.unref&&this._timer.unref(),!0};Ne.prototype.attempt=function(r,e){this._fn=r,e&&(e.timeout&&(this._operationTimeout=e.timeout),e.cb&&(this._operationTimeoutCb=e.cb));var t=this;this._operationTimeoutCb&&(this._timeout=setTimeout(function(){t._operationTimeoutCb()},t._operationTimeout)),this._operationStart=new Date().getTime(),this._fn(this._attempts)};Ne.prototype.try=function(r){console.log("Using RetryOperation.try() is deprecated"),this.attempt(r)};Ne.prototype.start=function(r){console.log("Using RetryOperation.start() is deprecated"),this.attempt(r)};Ne.prototype.start=Ne.prototype.try;Ne.prototype.errors=function(){return this._errors};Ne.prototype.attempts=function(){return this._attempts};Ne.prototype.mainError=function(){if(this._errors.length===0)return null;for(var r={},e=null,t=0,o=0;o<this._errors.length;o++){var n=this._errors[o],i=n.message,s=(r[i]||0)+1;r[i]=s,s>=t&&(e=n,t=s)}return e}});var ea=O(ut=>{var El=Hs();ut.operation=function(r){var e=ut.timeouts(r);return new El(e,{forever:r&&(r.forever||r.retries===1/0),unref:r&&r.unref,maxRetryTime:r&&r.maxRetryTime})};ut.timeouts=function(r){if(r instanceof Array)return[].concat(r);var e={retries:10,factor:2,minTimeout:1*1e3,maxTimeout:1/0,randomize:!1};for(var t in r)e[t]=r[t];if(e.minTimeout>e.maxTimeout)throw new Error("minTimeout is greater than maxTimeout");for(var o=[],n=0;n<e.retries;n++)o.push(this.createTimeout(n,e));return r&&r.forever&&!o.length&&o.push(this.createTimeout(n,e)),o.sort(function(i,s){return i-s}),o};ut.createTimeout=function(r,e){var t=e.randomize?Math.random()+1:1,o=Math.round(t*Math.max(e.minTimeout,1)*Math.pow(e.factor,r));return o=Math.min(o,e.maxTimeout),o};ut.wrap=function(r,e,t){if(e instanceof Array&&(t=e,e=null),!t){t=[];for(var o in r)typeof r[o]=="function"&&t.push(o)}for(var n=0;n<t.length;n++){var i=t[n],s=r[i];r[i]=function(c){var u=ut.operation(e),d=Array.prototype.slice.call(arguments,1),w=d.pop();d.push(function(B){u.retry(B)||(B&&(arguments[0]=u.mainError()),w.apply(this,arguments))}),u.attempt(function(){c.apply(r,d)})}.bind(r,s),r[i].options=e}}});var ra=O((ry,ta)=>{ta.exports=ea()});var ma=O((am,ya)=>{ya.exports=Jn;var pa=128,Ll=127,Ul=~Ll,Rl=Math.pow(2,31);function Jn(r,e,t){if(Number.MAX_SAFE_INTEGER&&r>Number.MAX_SAFE_INTEGER)throw Jn.bytes=0,new RangeError("Could not encode varint");e=e||[],t=t||0;for(var o=t;r>=Rl;)e[t++]=r&255|pa,r/=128;for(;r&Ul;)e[t++]=r&255|pa,r>>>=7;return e[t]=r|0,Jn.bytes=t-o+1,e}});var wa=O((cm,ba)=>{ba.exports=Xn;var zl=128,ga=127;function Xn(r,o){var t=0,o=o||0,n=0,i=o,s,a=r.length;do{if(i>=a||n>49)throw Xn.bytes=0,new RangeError("Could not decode varint");s=r[i++],t+=n<28?(s&ga)<<n:(s&ga)*Math.pow(2,n),n+=7}while(s>=zl);return Xn.bytes=i-o,t}});var xa=O((um,va)=>{var Fl=Math.pow(2,7),Vl=Math.pow(2,14),$l=Math.pow(2,21),Wl=Math.pow(2,28),Gl=Math.pow(2,35),Kl=Math.pow(2,42),Jl=Math.pow(2,49),Xl=Math.pow(2,56),Ql=Math.pow(2,63);va.exports=function(r){return r<Fl?1:r<Vl?2:r<$l?3:r<Wl?4:r<Gl?5:r<Kl?6:r<Jl?7:r<Xl?8:r<Ql?9:10}});var Tr=O((fm,Ea)=>{Ea.exports={encode:ma(),decode:wa(),encodingLength:xa()}});var no=O((Sm,Ca)=>{"use strict";function _a(r,e){for(let t in e)Object.defineProperty(r,t,{value:e[t],enumerable:!0,configurable:!0});return r}function lh(r,e,t){if(!r||typeof r=="string")throw new TypeError("Please pass an Error to err-code");t||(t={}),typeof e=="object"&&(t=e,e=""),e&&(t.code=e);try{return _a(r,t)}catch{t.message=r.message,t.stack=r.stack;let n=function(){};return n.prototype=Object.create(Object.getPrototypeOf(r)),_a(new n,t)}}Ca.exports=lh});var Ua=O((_m,La)=>{"use strict";La.exports=mh;function mh(r,e){for(var t=new Array(arguments.length-1),o=0,n=2,i=!0;n<arguments.length;)t[o++]=arguments[n++];return new Promise(function(a,c){t[o]=function(d){if(i)if(i=!1,d)c(d);else{for(var w=new Array(arguments.length-1),B=0;B<w.length;)w[B++]=arguments[B];a.apply(null,w)}};try{r.apply(e||null,t)}catch(u){i&&(i=!1,c(u))}})}});var Va=O(Fa=>{"use strict";var Ir=Fa;Ir.length=function(e){var t=e.length;if(!t)return 0;for(var o=0;--t%4>1&&e.charAt(t)==="=";)++o;return Math.ceil(e.length*3)/4-o};var _t=new Array(64),za=new Array(123);for(Me=0;Me<64;)za[_t[Me]=Me<26?Me+65:Me<52?Me+71:Me<62?Me-4:Me-59|43]=Me++;var Me;Ir.encode=function(e,t,o){for(var n=null,i=[],s=0,a=0,c;t<o;){var u=e[t++];switch(a){case 0:i[s++]=_t[u>>2],c=(u&3)<<4,a=1;break;case 1:i[s++]=_t[c|u>>4],c=(u&15)<<2,a=2;break;case 2:i[s++]=_t[c|u>>6],i[s++]=_t[u&63],a=0;break}s>8191&&((n||(n=[])).push(String.fromCharCode.apply(String,i)),s=0)}return a&&(i[s++]=_t[c],i[s++]=61,a===1&&(i[s++]=61)),n?(s&&n.push(String.fromCharCode.apply(String,i.slice(0,s))),n.join("")):String.fromCharCode.apply(String,i.slice(0,s))};var Ra="invalid encoding";Ir.decode=function(e,t,o){for(var n=o,i=0,s,a=0;a<e.length;){var c=e.charCodeAt(a++);if(c===61&&i>1)break;if((c=za[c])===void 0)throw Error(Ra);switch(i){case 0:s=c,i=1;break;case 1:t[o++]=s<<2|(c&48)>>4,s=c,i=2;break;case 2:t[o++]=(s&15)<<4|(c&60)>>2,s=c,i=3;break;case 3:t[o++]=(s&3)<<6|c,i=0;break}}if(i===1)throw Error(Ra);return o-n};Ir.test=function(e){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e)}});var Wa=O((jm,$a)=>{"use strict";$a.exports=Dr;function Dr(){this._listeners={}}Dr.prototype.on=function(e,t,o){return(this._listeners[e]||(this._listeners[e]=[])).push({fn:t,ctx:o||this}),this};Dr.prototype.off=function(e,t){if(e===void 0)this._listeners={};else if(t===void 0)this._listeners[e]=[];else for(var o=this._listeners[e],n=0;n<o.length;)o[n].fn===t?o.splice(n,1):++n;return this};Dr.prototype.emit=function(e){var t=this._listeners[e];if(t){for(var o=[],n=1;n<arguments.length;)o.push(arguments[n++]);for(n=0;n<t.length;)t[n].fn.apply(t[n++].ctx,o)}return this}});var Ya=O((qm,Za)=>{"use strict";Za.exports=Ga(Ga);function Ga(r){return typeof Float32Array<"u"?function(){var e=new Float32Array([-0]),t=new Uint8Array(e.buffer),o=t[3]===128;function n(c,u,d){e[0]=c,u[d]=t[0],u[d+1]=t[1],u[d+2]=t[2],u[d+3]=t[3]}function i(c,u,d){e[0]=c,u[d]=t[3],u[d+1]=t[2],u[d+2]=t[1],u[d+3]=t[0]}r.writeFloatLE=o?n:i,r.writeFloatBE=o?i:n;function s(c,u){return t[0]=c[u],t[1]=c[u+1],t[2]=c[u+2],t[3]=c[u+3],e[0]}function a(c,u){return t[3]=c[u],t[2]=c[u+1],t[1]=c[u+2],t[0]=c[u+3],e[0]}r.readFloatLE=o?s:a,r.readFloatBE=o?a:s}():function(){function e(o,n,i,s){var a=n<0?1:0;if(a&&(n=-n),n===0)o(1/n>0?0:2147483648,i,s);else if(isNaN(n))o(2143289344,i,s);else if(n>34028234663852886e22)o((a<<31|2139095040)>>>0,i,s);else if(n<11754943508222875e-54)o((a<<31|Math.round(n/1401298464324817e-60))>>>0,i,s);else{var c=Math.floor(Math.log(n)/Math.LN2),u=Math.round(n*Math.pow(2,-c)*8388608)&8388607;o((a<<31|c+127<<23|u)>>>0,i,s)}}r.writeFloatLE=e.bind(null,Ka),r.writeFloatBE=e.bind(null,Ja);function t(o,n,i){var s=o(n,i),a=(s>>31)*2+1,c=s>>>23&255,u=s&8388607;return c===255?u?NaN:a*(1/0):c===0?a*1401298464324817e-60*u:a*Math.pow(2,c-150)*(u+8388608)}r.readFloatLE=t.bind(null,Xa),r.readFloatBE=t.bind(null,Qa)}(),typeof Float64Array<"u"?function(){var e=new Float64Array([-0]),t=new Uint8Array(e.buffer),o=t[7]===128;function n(c,u,d){e[0]=c,u[d]=t[0],u[d+1]=t[1],u[d+2]=t[2],u[d+3]=t[3],u[d+4]=t[4],u[d+5]=t[5],u[d+6]=t[6],u[d+7]=t[7]}function i(c,u,d){e[0]=c,u[d]=t[7],u[d+1]=t[6],u[d+2]=t[5],u[d+3]=t[4],u[d+4]=t[3],u[d+5]=t[2],u[d+6]=t[1],u[d+7]=t[0]}r.writeDoubleLE=o?n:i,r.writeDoubleBE=o?i:n;function s(c,u){return t[0]=c[u],t[1]=c[u+1],t[2]=c[u+2],t[3]=c[u+3],t[4]=c[u+4],t[5]=c[u+5],t[6]=c[u+6],t[7]=c[u+7],e[0]}function a(c,u){return t[7]=c[u],t[6]=c[u+1],t[5]=c[u+2],t[4]=c[u+3],t[3]=c[u+4],t[2]=c[u+5],t[1]=c[u+6],t[0]=c[u+7],e[0]}r.readDoubleLE=o?s:a,r.readDoubleBE=o?a:s}():function(){function e(o,n,i,s,a,c){var u=s<0?1:0;if(u&&(s=-s),s===0)o(0,a,c+n),o(1/s>0?0:2147483648,a,c+i);else if(isNaN(s))o(0,a,c+n),o(2146959360,a,c+i);else if(s>17976931348623157e292)o(0,a,c+n),o((u<<31|2146435072)>>>0,a,c+i);else{var d;if(s<22250738585072014e-324)d=s/5e-324,o(d>>>0,a,c+n),o((u<<31|d/4294967296)>>>0,a,c+i);else{var w=Math.floor(Math.log(s)/Math.LN2);w===1024&&(w=1023),d=s*Math.pow(2,-w),o(d*4503599627370496>>>0,a,c+n),o((u<<31|w+1023<<20|d*1048576&1048575)>>>0,a,c+i)}}}r.writeDoubleLE=e.bind(null,Ka,0,4),r.writeDoubleBE=e.bind(null,Ja,4,0);function t(o,n,i,s,a){var c=o(s,a+n),u=o(s,a+i),d=(u>>31)*2+1,w=u>>>20&2047,B=4294967296*(u&1048575)+c;return w===2047?B?NaN:d*(1/0):w===0?d*5e-324*B:d*Math.pow(2,w-1075)*(B+4503599627370496)}r.readDoubleLE=t.bind(null,Xa,0,4),r.readDoubleBE=t.bind(null,Qa,4,0)}(),r}function Ka(r,e,t){e[t]=r&255,e[t+1]=r>>>8&255,e[t+2]=r>>>16&255,e[t+3]=r>>>24}function Ja(r,e,t){e[t]=r>>>24,e[t+1]=r>>>16&255,e[t+2]=r>>>8&255,e[t+3]=r&255}function Xa(r,e){return(r[e]|r[e+1]<<8|r[e+2]<<16|r[e+3]<<24)>>>0}function Qa(r,e){return(r[e]<<24|r[e+1]<<16|r[e+2]<<8|r[e+3])>>>0}});var Ha=O((exports,module)=>{"use strict";module.exports=inquire;function inquire(moduleName){try{var mod=eval("quire".replace(/^/,"re"))(moduleName);if(mod&&(mod.length||Object.keys(mod).length))return mod}catch(r){}return null}});var tc=O(ec=>{"use strict";var so=ec;so.length=function(e){for(var t=0,o=0,n=0;n<e.length;++n)o=e.charCodeAt(n),o<128?t+=1:o<2048?t+=2:(o&64512)===55296&&(e.charCodeAt(n+1)&64512)===56320?(++n,t+=4):t+=3;return t};so.read=function(e,t,o){var n=o-t;if(n<1)return"";for(var i=null,s=[],a=0,c;t<o;)c=e[t++],c<128?s[a++]=c:c>191&&c<224?s[a++]=(c&31)<<6|e[t++]&63:c>239&&c<365?(c=((c&7)<<18|(e[t++]&63)<<12|(e[t++]&63)<<6|e[t++]&63)-65536,s[a++]=55296+(c>>10),s[a++]=56320+(c&1023)):s[a++]=(c&15)<<12|(e[t++]&63)<<6|e[t++]&63,a>8191&&((i||(i=[])).push(String.fromCharCode.apply(String,s)),a=0);return i?(a&&i.push(String.fromCharCode.apply(String,s.slice(0,a))),i.join("")):String.fromCharCode.apply(String,s.slice(0,a))};so.write=function(e,t,o){for(var n=o,i,s,a=0;a<e.length;++a)i=e.charCodeAt(a),i<128?t[o++]=i:i<2048?(t[o++]=i>>6|192,t[o++]=i&63|128):(i&64512)===55296&&((s=e.charCodeAt(a+1))&64512)===56320?(i=65536+((i&1023)<<10)+(s&1023),++a,t[o++]=i>>18|240,t[o++]=i>>12&63|128,t[o++]=i>>6&63|128,t[o++]=i&63|128):(t[o++]=i>>12|224,t[o++]=i>>6&63|128,t[o++]=i&63|128);return o-n}});var nc=O((km,rc)=>{"use strict";rc.exports=gh;function gh(r,e,t){var o=t||8192,n=o>>>1,i=null,s=o;return function(c){if(c<1||c>n)return r(c);s+c>o&&(i=r(o),s=0);var u=e.call(i,s,s+=c);return s&7&&(s=(s|7)+1),u}}});var ic=O((Lm,oc)=>{"use strict";oc.exports=se;var nr=ht();function se(r,e){this.lo=r>>>0,this.hi=e>>>0}var lt=se.zero=new se(0,0);lt.toNumber=function(){return 0};lt.zzEncode=lt.zzDecode=function(){return this};lt.length=function(){return 1};var bh=se.zeroHash="\0\0\0\0\0\0\0\0";se.fromNumber=function(e){if(e===0)return lt;var t=e<0;t&&(e=-e);var o=e>>>0,n=(e-o)/4294967296>>>0;return t&&(n=~n>>>0,o=~o>>>0,++o>4294967295&&(o=0,++n>4294967295&&(n=0))),new se(o,n)};se.from=function(e){if(typeof e=="number")return se.fromNumber(e);if(nr.isString(e))if(nr.Long)e=nr.Long.fromString(e);else return se.fromNumber(parseInt(e,10));return e.low||e.high?new se(e.low>>>0,e.high>>>0):lt};se.prototype.toNumber=function(e){if(!e&&this.hi>>>31){var t=~this.lo+1>>>0,o=~this.hi>>>0;return t||(o=o+1>>>0),-(t+o*4294967296)}return this.lo+this.hi*4294967296};se.prototype.toLong=function(e){return nr.Long?new nr.Long(this.lo|0,this.hi|0,Boolean(e)):{low:this.lo|0,high:this.hi|0,unsigned:Boolean(e)}};var Xe=String.prototype.charCodeAt;se.fromHash=function(e){return e===bh?lt:new se((Xe.call(e,0)|Xe.call(e,1)<<8|Xe.call(e,2)<<16|Xe.call(e,3)<<24)>>>0,(Xe.call(e,4)|Xe.call(e,5)<<8|Xe.call(e,6)<<16|Xe.call(e,7)<<24)>>>0)};se.prototype.toHash=function(){return String.fromCharCode(this.lo&255,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,this.hi&255,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)};se.prototype.zzEncode=function(){var e=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^e)>>>0,this.lo=(this.lo<<1^e)>>>0,this};se.prototype.zzDecode=function(){var e=-(this.lo&1);return this.lo=((this.lo>>>1|this.hi<<31)^e)>>>0,this.hi=(this.hi>>>1^e)>>>0,this};se.prototype.length=function(){var e=this.lo,t=(this.lo>>>28|this.hi<<4)>>>0,o=this.hi>>>24;return o===0?t===0?e<16384?e<128?1:2:e<2097152?3:4:t<16384?t<128?5:6:t<2097152?7:8:o<128?9:10}});var ht=O(ao=>{"use strict";var _=ao;_.asPromise=Ua();_.base64=Va();_.EventEmitter=Wa();_.float=Ya();_.inquire=Ha();_.utf8=tc();_.pool=nc();_.LongBits=ic();_.isNode=Boolean(typeof globalThis<"u"&&globalThis&&globalThis.process&&globalThis.process.versions&&globalThis.process.versions.node);_.global=_.isNode&&globalThis||typeof window<"u"&&window||typeof self<"u"&&self||ao;_.emptyArray=Object.freeze?Object.freeze([]):[];_.emptyObject=Object.freeze?Object.freeze({}):{};_.isInteger=Number.isInteger||function(e){return typeof e=="number"&&isFinite(e)&&Math.floor(e)===e};_.isString=function(e){return typeof e=="string"||e instanceof String};_.isObject=function(e){return e&&typeof e=="object"};_.isset=_.isSet=function(e,t){var o=e[t];return o!=null&&e.hasOwnProperty(t)?typeof o!="object"||(Array.isArray(o)?o.length:Object.keys(o).length)>0:!1};_.Buffer=function(){try{var r=_.inquire("buffer").Buffer;return r.prototype.utf8Write?r:null}catch{return null}}();_._Buffer_from=null;_._Buffer_allocUnsafe=null;_.newBuffer=function(e){return typeof e=="number"?_.Buffer?_._Buffer_allocUnsafe(e):new _.Array(e):_.Buffer?_._Buffer_from(e):typeof Uint8Array>"u"?e:new Uint8Array(e)};_.Array=typeof Uint8Array<"u"?Uint8Array:Array;_.Long=_.global.dcodeIO&&_.global.dcodeIO.Long||_.global.Long||_.inquire("long");_.key2Re=/^true|false|0|1$/;_.key32Re=/^-?(?:0|[1-9][0-9]*)$/;_.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/;_.longToHash=function(e){return e?_.LongBits.from(e).toHash():_.LongBits.zeroHash};_.longFromHash=function(e,t){var o=_.LongBits.fromHash(e);return _.Long?_.Long.fromBits(o.lo,o.hi,t):o.toNumber(Boolean(t))};function sc(r,e,t){for(var o=Object.keys(e),n=0;n<o.length;++n)(r[o[n]]===void 0||!t)&&(r[o[n]]=e[o[n]]);return r}_.merge=sc;_.lcFirst=function(e){return e.charAt(0).toLowerCase()+e.substring(1)};function ac(r){function e(t,o){if(!(this instanceof e))return new e(t,o);Object.defineProperty(this,"message",{get:function(){return t}}),Error.captureStackTrace?Error.captureStackTrace(this,e):Object.defineProperty(this,"stack",{value:new Error().stack||""}),o&&sc(this,o)}return e.prototype=Object.create(Error.prototype,{constructor:{value:e,writable:!0,enumerable:!1,configurable:!0},name:{get:function(){return r},set:void 0,enumerable:!1,configurable:!0},toString:{value:function(){return this.name+": "+this.message},writable:!0,enumerable:!1,configurable:!0}}),e}_.newError=ac;_.ProtocolError=ac("ProtocolError");_.oneOfGetter=function(e){for(var t={},o=0;o<e.length;++o)t[e[o]]=1;return function(){for(var n=Object.keys(this),i=n.length-1;i>-1;--i)if(t[n[i]]===1&&this[n[i]]!==void 0&&this[n[i]]!==null)return n[i]}};_.oneOfSetter=function(e){return function(t){for(var o=0;o<e.length;++o)e[o]!==t&&delete this[e[o]]}};_.toJSONOptions={longs:String,enums:String,bytes:String,json:!0};_._configure=function(){var r=_.Buffer;if(!r){_._Buffer_from=_._Buffer_allocUnsafe=null;return}_._Buffer_from=r.from!==Uint8Array.from&&r.from||function(t,o){return new r(t,o)},_._Buffer_allocUnsafe=r.allocUnsafe||function(t){return new r(t)}}});var fo=O((Rm,hc)=>{"use strict";hc.exports=ne;var Ce=ht(),uo,fc=Ce.LongBits,wh=Ce.utf8;function Ie(r,e){return RangeError("index out of range: "+r.pos+" + "+(e||1)+" > "+r.len)}function ne(r){this.buf=r,this.pos=0,this.len=r.length}var cc=typeof Uint8Array<"u"?function(e){if(e instanceof Uint8Array||Array.isArray(e))return new ne(e);throw Error("illegal buffer")}:function(e){if(Array.isArray(e))return new ne(e);throw Error("illegal buffer")},lc=function(){return Ce.Buffer?function(t){return(ne.create=function(n){return Ce.Buffer.isBuffer(n)?new uo(n):cc(n)})(t)}:cc};ne.create=lc();ne.prototype._slice=Ce.Array.prototype.subarray||Ce.Array.prototype.slice;ne.prototype.uint32=function(){var e=4294967295;return function(){if(e=(this.buf[this.pos]&127)>>>0,this.buf[this.pos++]<128||(e=(e|(this.buf[this.pos]&127)<<7)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&127)<<14)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&127)<<21)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&15)<<28)>>>0,this.buf[this.pos++]<128))return e;if((this.pos+=5)>this.len)throw this.pos=this.len,Ie(this,10);return e}}();ne.prototype.int32=function(){return this.uint32()|0};ne.prototype.sint32=function(){var e=this.uint32();return e>>>1^-(e&1)|0};function co(){var r=new fc(0,0),e=0;if(this.len-this.pos>4){for(;e<4;++e)if(r.lo=(r.lo|(this.buf[this.pos]&127)<<e*7)>>>0,this.buf[this.pos++]<128)return r;if(r.lo=(r.lo|(this.buf[this.pos]&127)<<28)>>>0,r.hi=(r.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return r;e=0}else{for(;e<3;++e){if(this.pos>=this.len)throw Ie(this);if(r.lo=(r.lo|(this.buf[this.pos]&127)<<e*7)>>>0,this.buf[this.pos++]<128)return r}return r.lo=(r.lo|(this.buf[this.pos++]&127)<<e*7)>>>0,r}if(this.len-this.pos>4){for(;e<5;++e)if(r.hi=(r.hi|(this.buf[this.pos]&127)<<e*7+3)>>>0,this.buf[this.pos++]<128)return r}else for(;e<5;++e){if(this.pos>=this.len)throw Ie(this);if(r.hi=(r.hi|(this.buf[this.pos]&127)<<e*7+3)>>>0,this.buf[this.pos++]<128)return r}throw Error("invalid varint encoding")}ne.prototype.bool=function(){return this.uint32()!==0};function _r(r,e){return(r[e-4]|r[e-3]<<8|r[e-2]<<16|r[e-1]<<24)>>>0}ne.prototype.fixed32=function(){if(this.pos+4>this.len)throw Ie(this,4);return _r(this.buf,this.pos+=4)};ne.prototype.sfixed32=function(){if(this.pos+4>this.len)throw Ie(this,4);return _r(this.buf,this.pos+=4)|0};function uc(){if(this.pos+8>this.len)throw Ie(this,8);return new fc(_r(this.buf,this.pos+=4),_r(this.buf,this.pos+=4))}ne.prototype.float=function(){if(this.pos+4>this.len)throw Ie(this,4);var e=Ce.float.readFloatLE(this.buf,this.pos);return this.pos+=4,e};ne.prototype.double=function(){if(this.pos+8>this.len)throw Ie(this,4);var e=Ce.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,e};ne.prototype.bytes=function(){var e=this.uint32(),t=this.pos,o=this.pos+e;if(o>this.len)throw Ie(this,e);return this.pos+=e,Array.isArray(this.buf)?this.buf.slice(t,o):t===o?new this.buf.constructor(0):this._slice.call(this.buf,t,o)};ne.prototype.string=function(){var e=this.bytes();return wh.read(e,0,e.length)};ne.prototype.skip=function(e){if(typeof e=="number"){if(this.pos+e>this.len)throw Ie(this,e);this.pos+=e}else do if(this.pos>=this.len)throw Ie(this);while(this.buf[this.pos++]&128);return this};ne.prototype.skipType=function(r){switch(r){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(r=this.uint32()&7)!==4;)this.skipType(r);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+r+" at offset "+this.pos)}return this};ne._configure=function(r){uo=r,ne.create=lc(),uo._configure();var e=Ce.Long?"toLong":"toNumber";Ce.merge(ne.prototype,{int64:function(){return co.call(this)[e](!1)},uint64:function(){return co.call(this)[e](!0)},sint64:function(){return co.call(this).zzDecode()[e](!1)},fixed64:function(){return uc.call(this)[e](!0)},sfixed64:function(){return uc.call(this)[e](!1)}})}});var mc=O((zm,yc)=>{"use strict";yc.exports=dt;var pc=fo();(dt.prototype=Object.create(pc.prototype)).constructor=dt;var dc=ht();function dt(r){pc.call(this,r)}dt._configure=function(){dc.Buffer&&(dt.prototype._slice=dc.Buffer.prototype.slice)};dt.prototype.string=function(){var e=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+e,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+e,this.len))};dt._configure()});var bo=O((Fm,vc)=>{"use strict";vc.exports=V;var Pe=ht(),lo,Cr=Pe.LongBits,gc=Pe.base64,bc=Pe.utf8;function or(r,e,t){this.fn=r,this.len=e,this.next=void 0,this.val=t}function po(){}function vh(r){this.head=r.head,this.tail=r.tail,this.len=r.len,this.next=r.states}function V(){this.len=0,this.head=new or(po,0,0),this.tail=this.head,this.states=null}var wc=function(){return Pe.Buffer?function(){return(V.create=function(){return new lo})()}:function(){return new V}};V.create=wc();V.alloc=function(e){return new Pe.Array(e)};Pe.Array!==Array&&(V.alloc=Pe.pool(V.alloc,Pe.Array.prototype.subarray));V.prototype._push=function(e,t,o){return this.tail=this.tail.next=new or(e,t,o),this.len+=t,this};function yo(r,e,t){e[t]=r&255}function xh(r,e,t){for(;r>127;)e[t++]=r&127|128,r>>>=7;e[t]=r}function mo(r,e){this.len=r,this.next=void 0,this.val=e}mo.prototype=Object.create(or.prototype);mo.prototype.fn=xh;V.prototype.uint32=function(e){return this.len+=(this.tail=this.tail.next=new mo((e=e>>>0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this};V.prototype.int32=function(e){return e<0?this._push(go,10,Cr.fromNumber(e)):this.uint32(e)};V.prototype.sint32=function(e){return this.uint32((e<<1^e>>31)>>>0)};function go(r,e,t){for(;r.hi;)e[t++]=r.lo&127|128,r.lo=(r.lo>>>7|r.hi<<25)>>>0,r.hi>>>=7;for(;r.lo>127;)e[t++]=r.lo&127|128,r.lo=r.lo>>>7;e[t++]=r.lo}V.prototype.uint64=function(e){var t=Cr.from(e);return this._push(go,t.length(),t)};V.prototype.int64=V.prototype.uint64;V.prototype.sint64=function(e){var t=Cr.from(e).zzEncode();return this._push(go,t.length(),t)};V.prototype.bool=function(e){return this._push(yo,1,e?1:0)};function ho(r,e,t){e[t]=r&255,e[t+1]=r>>>8&255,e[t+2]=r>>>16&255,e[t+3]=r>>>24}V.prototype.fixed32=function(e){return this._push(ho,4,e>>>0)};V.prototype.sfixed32=V.prototype.fixed32;V.prototype.fixed64=function(e){var t=Cr.from(e);return this._push(ho,4,t.lo)._push(ho,4,t.hi)};V.prototype.sfixed64=V.prototype.fixed64;V.prototype.float=function(e){return this._push(Pe.float.writeFloatLE,4,e)};V.prototype.double=function(e){return this._push(Pe.float.writeDoubleLE,8,e)};var Eh=Pe.Array.prototype.set?function(e,t,o){t.set(e,o)}:function(e,t,o){for(var n=0;n<e.length;++n)t[o+n]=e[n]};V.prototype.bytes=function(e){var t=e.length>>>0;if(!t)return this._push(yo,1,0);if(Pe.isString(e)){var o=V.alloc(t=gc.length(e));gc.decode(e,o,0),e=o}return this.uint32(t)._push(Eh,t,e)};V.prototype.string=function(e){var t=bc.length(e);return t?this.uint32(t)._push(bc.write,t,e):this._push(yo,1,0)};V.prototype.fork=function(){return this.states=new vh(this),this.head=this.tail=new or(po,0,0),this.len=0,this};V.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new or(po,0,0),this.len=0),this};V.prototype.ldelim=function(){var e=this.head,t=this.tail,o=this.len;return this.reset().uint32(o),o&&(this.tail.next=e.next,this.tail=t,this.len+=o),this};V.prototype.finish=function(){for(var e=this.head.next,t=this.constructor.alloc(this.len),o=0;e;)e.fn(e.val,t,o),o+=e.len,e=e.next;return t};V._configure=function(r){lo=r,V.create=wc(),lo._configure()}});var Ac=O((Vm,Ec)=>{"use strict";Ec.exports=je;var xc=bo();(je.prototype=Object.create(xc.prototype)).constructor=je;var Qe=ht();function je(){xc.call(this)}je._configure=function(){je.alloc=Qe._Buffer_allocUnsafe,je.writeBytesBuffer=Qe.Buffer&&Qe.Buffer.prototype instanceof Uint8Array&&Qe.Buffer.prototype.set.name==="set"?function(e,t,o){t.set(e,o)}:function(e,t,o){if(e.copy)e.copy(t,o,0,e.length);else for(var n=0;n<e.length;)t[o++]=e[n++]}};je.prototype.bytes=function(e){Qe.isString(e)&&(e=Qe._Buffer_from(e,"base64"));var t=e.length>>>0;return this.uint32(t),t&&this._push(je.writeBytesBuffer,t,e),this};function Ah(r,e,t){r.length<40?Qe.utf8.write(r,e,t):e.utf8Write?e.utf8Write(r,t):e.write(r,t)}je.prototype.string=function(e){var t=Qe.Buffer.byteLength(e);return this.uint32(t),t&&this._push(Ah,t,e),this};je._configure()});var Fh={};be(Fh,{connectInteropTests:()=>hn,dhtInteropTests:()=>kn,interopTests:()=>zh,pubsubInteropTests:()=>zn,relayInteropTests:()=>To,streamInteropTests:()=>Wn});var Se=oe(ys(),1),Od=Se.default.expect,Md=Se.default.version,Id=Se.default.Assertion,Dd=Se.default.AssertionError,_d=Se.default.util,Cd=Se.default.config,jd=Se.default.use,qd=Se.default.should,Bd=Se.default.assert,kd=Se.default.core,We=Se.default;var Ts=oe(ms(),1),Ns=oe(bs(),1),Ps=oe(ws(),1),Os=oe(Es(),1),Ms=oe(Ss(),1);We.use(Ts.default);We.use(Ns.default);We.use(Ps.default);We.use(Os.default);We.use(Ms.default);var W=We.expect,Wd=We.assert;var Ge=oe(ke("path"),1),Is=ke("url"),ff={},xt=Ge.default.dirname((0,Is.fileURLToPath)(ff.url)),cf={ed25519:Ge.default.join(xt,"go.ed25519.key"),rsa:Ge.default.join(xt,"go.rsa.key"),secp256k1:Ge.default.join(xt,"go.secp256k1.key")},uf={ed25519:Ge.default.join(xt,"js.ed25519.key"),rsa:Ge.default.join(xt,"js.rsa.key"),secp256k1:Ge.default.join(xt,"js.secp256k1.key")},ln={go:cf,js:uf};function hn(r){let e=["ed25519","rsa","secp256k1"],t=["js","go"];for(let o of e)for(let n of t)for(let i of t)lf(`noise/${o}`,r,{type:n,noise:!0,key:ln.go[o]},{type:i,noise:!0,key:ln.js[o]})}function lf(r,e,t,o){describe(`connect using ${r}`,()=>{let n;before(async function(){this.timeout(20*1e3),n=await Promise.all([e.spawn(t),e.spawn(o)])}),after(async function(){n!=null&&await Promise.all(n.map(async i=>{await i.stop()}))}),it(`${t.type} peer to ${o.type} peer`,async function(){this.timeout(10*1e3);let i=await n[0].client.identify(),s=await n[1].client.identify(),a=await n[0].client.listPeers();W(a).to.have.lengthOf(0);let c=await n[1].client.listPeers();W(c).to.have.lengthOf(0),await n[0].client.connect(s.peerId,s.addrs),await new Promise(w=>setTimeout(w,1e3));let u=await n[0].client.listPeers();W(u).to.have.length.greaterThanOrEqual(1),W(u[0].toString()).to.equal(s.peerId.toString());let d=await n[1].client.listPeers();W(d).to.have.length.greaterThanOrEqual(1),W(d[0].toString()).to.equal(i.peerId.toString())})})}var gn={};be(gn,{identity:()=>gf});function hf(r,e){if(r.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),o=0;o<t.length;o++)t[o]=255;for(var n=0;n<r.length;n++){var i=r.charAt(n),s=i.charCodeAt(0);if(t[s]!==255)throw new TypeError(i+" is ambiguous");t[s]=n}var a=r.length,c=r.charAt(0),u=Math.log(a)/Math.log(256),d=Math.log(256)/Math.log(a);function w(N){if(N instanceof Uint8Array||(ArrayBuffer.isView(N)?N=new Uint8Array(N.buffer,N.byteOffset,N.byteLength):Array.isArray(N)&&(N=Uint8Array.from(N))),!(N instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(N.length===0)return"";for(var E=0,I=0,q=0,$=N.length;q!==$&&N[q]===0;)q++,E++;for(var Q=($-q)*d+1>>>0,te=new Uint8Array(Q);q!==$;){for(var y=N[q],S=0,C=Q-1;(y!==0||S<I)&&C!==-1;C--,S++)y+=256*te[C]>>>0,te[C]=y%a>>>0,y=y/a>>>0;if(y!==0)throw new Error("Non-zero carry");I=S,q++}for(var U=Q-I;U!==Q&&te[U]===0;)U++;for(var re=c.repeat(E);U<Q;++U)re+=r.charAt(te[U]);return re}function B(N){if(typeof N!="string")throw new TypeError("Expected String");if(N.length===0)return new Uint8Array;var E=0;if(N[E]!==" "){for(var I=0,q=0;N[E]===c;)I++,E++;for(var $=(N.length-E)*u+1>>>0,Q=new Uint8Array($);N[E];){var te=t[N.charCodeAt(E)];if(te===255)return;for(var y=0,S=$-1;(te!==0||y<q)&&S!==-1;S--,y++)te+=a*Q[S]>>>0,Q[S]=te%256>>>0,te=te/256>>>0;if(te!==0)throw new Error("Non-zero carry");q=y,E++}if(N[E]!==" "){for(var C=$-q;C!==$&&Q[C]===0;)C++;for(var U=new Uint8Array(I+($-C)),re=I;C!==$;)U[re++]=Q[C++];return U}}}function k(N){var E=B(N);if(E)return E;throw new Error(`Non-${e} character`)}return{encode:w,decodeUnsafe:B,decode:k}}var df=hf,pf=df,Ds=pf;var Yd=new Uint8Array(0);var _s=(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},Te=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")};var Cs=r=>new TextEncoder().encode(r),js=r=>new TextDecoder().decode(r);var dn=class{constructor(e,t,o){this.name=e,this.prefix=t,this.baseEncode=o}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},pn=class{constructor(e,t,o){if(this.name=e,this.prefix=t,t.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=t.codePointAt(0),this.baseDecode=o}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 Bs(this,e)}},yn=class{constructor(e){this.decoders=e}or(e){return Bs(this,e)}decode(e){let t=e[0],o=this.decoders[t];if(o)return o.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}},Bs=(r,e)=>new yn({...r.decoders||{[r.prefix]:r},...e.decoders||{[e.prefix]:e}}),mn=class{constructor(e,t,o,n){this.name=e,this.prefix=t,this.baseEncode=o,this.baseDecode=n,this.encoder=new dn(e,t,o),this.decoder=new pn(e,t,n)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}},Et=({name:r,prefix:e,encode:t,decode:o})=>new mn(r,e,t,o),Ke=({prefix:r,name:e,alphabet:t})=>{let{encode:o,decode:n}=Ds(t,e);return Et({prefix:r,name:e,encode:o,decode:i=>Te(n(i))})},yf=(r,e,t,o)=>{let n={};for(let d=0;d<e.length;++d)n[e[d]]=d;let i=r.length;for(;r[i-1]==="=";)--i;let s=new Uint8Array(i*t/8|0),a=0,c=0,u=0;for(let d=0;d<i;++d){let w=n[r[d]];if(w===void 0)throw new SyntaxError(`Non-${o} character`);c=c<<t|w,a+=t,a>=8&&(a-=8,s[u++]=255&c>>a)}if(a>=t||255&c<<8-a)throw new SyntaxError("Unexpected end of data");return s},mf=(r,e,t)=>{let o=e[e.length-1]==="=",n=(1<<t)-1,i="",s=0,a=0;for(let c=0;c<r.length;++c)for(a=a<<8|r[c],s+=8;s>t;)s-=t,i+=e[n&a>>s];if(s&&(i+=e[n&a<<t-s]),o)for(;i.length*t&7;)i+="=";return i},ee=({name:r,prefix:e,bitsPerChar:t,alphabet:o})=>Et({prefix:e,name:r,encode(n){return mf(n,o,t)},decode(n){return yf(n,o,t,r)}});var gf=Et({prefix:"\0",name:"identity",encode:r=>js(r),decode:r=>Cs(r)});var bn={};be(bn,{base2:()=>bf});var bf=ee({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var wn={};be(wn,{base8:()=>wf});var wf=ee({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var vn={};be(vn,{base10:()=>vf});var vf=Ke({prefix:"9",name:"base10",alphabet:"0123456789"});var xn={};be(xn,{base16:()=>xf,base16upper:()=>Ef});var xf=ee({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),Ef=ee({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var En={};be(En,{base32:()=>Ue,base32hex:()=>Nf,base32hexpad:()=>Of,base32hexpadupper:()=>Mf,base32hexupper:()=>Pf,base32pad:()=>Sf,base32padupper:()=>Tf,base32upper:()=>Af,base32z:()=>If});var Ue=ee({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),Af=ee({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),Sf=ee({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),Tf=ee({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),Nf=ee({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),Pf=ee({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),Of=ee({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),Mf=ee({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),If=ee({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var An={};be(An,{base36:()=>Df,base36upper:()=>_f});var Df=Ke({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),_f=Ke({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var Sn={};be(Sn,{base58btc:()=>de,base58flickr:()=>Cf});var de=Ke({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),Cf=Ke({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var Tn={};be(Tn,{base64:()=>jf,base64pad:()=>qf,base64url:()=>Bf,base64urlpad:()=>kf});var jf=ee({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),qf=ee({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Bf=ee({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),kf=ee({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var Nn={};be(Nn,{base256emoji:()=>Ff});var ks=Array.from("\u{1F680}\u{1FA90}\u2604\u{1F6F0}\u{1F30C}\u{1F311}\u{1F312}\u{1F313}\u{1F314}\u{1F315}\u{1F316}\u{1F317}\u{1F318}\u{1F30D}\u{1F30F}\u{1F30E}\u{1F409}\u2600\u{1F4BB}\u{1F5A5}\u{1F4BE}\u{1F4BF}\u{1F602}\u2764\u{1F60D}\u{1F923}\u{1F60A}\u{1F64F}\u{1F495}\u{1F62D}\u{1F618}\u{1F44D}\u{1F605}\u{1F44F}\u{1F601}\u{1F525}\u{1F970}\u{1F494}\u{1F496}\u{1F499}\u{1F622}\u{1F914}\u{1F606}\u{1F644}\u{1F4AA}\u{1F609}\u263A\u{1F44C}\u{1F917}\u{1F49C}\u{1F614}\u{1F60E}\u{1F607}\u{1F339}\u{1F926}\u{1F389}\u{1F49E}\u270C\u2728\u{1F937}\u{1F631}\u{1F60C}\u{1F338}\u{1F64C}\u{1F60B}\u{1F497}\u{1F49A}\u{1F60F}\u{1F49B}\u{1F642}\u{1F493}\u{1F929}\u{1F604}\u{1F600}\u{1F5A4}\u{1F603}\u{1F4AF}\u{1F648}\u{1F447}\u{1F3B6}\u{1F612}\u{1F92D}\u2763\u{1F61C}\u{1F48B}\u{1F440}\u{1F62A}\u{1F611}\u{1F4A5}\u{1F64B}\u{1F61E}\u{1F629}\u{1F621}\u{1F92A}\u{1F44A}\u{1F973}\u{1F625}\u{1F924}\u{1F449}\u{1F483}\u{1F633}\u270B\u{1F61A}\u{1F61D}\u{1F634}\u{1F31F}\u{1F62C}\u{1F643}\u{1F340}\u{1F337}\u{1F63B}\u{1F613}\u2B50\u2705\u{1F97A}\u{1F308}\u{1F608}\u{1F918}\u{1F4A6}\u2714\u{1F623}\u{1F3C3}\u{1F490}\u2639\u{1F38A}\u{1F498}\u{1F620}\u261D\u{1F615}\u{1F33A}\u{1F382}\u{1F33B}\u{1F610}\u{1F595}\u{1F49D}\u{1F64A}\u{1F639}\u{1F5E3}\u{1F4AB}\u{1F480}\u{1F451}\u{1F3B5}\u{1F91E}\u{1F61B}\u{1F534}\u{1F624}\u{1F33C}\u{1F62B}\u26BD\u{1F919}\u2615\u{1F3C6}\u{1F92B}\u{1F448}\u{1F62E}\u{1F646}\u{1F37B}\u{1F343}\u{1F436}\u{1F481}\u{1F632}\u{1F33F}\u{1F9E1}\u{1F381}\u26A1\u{1F31E}\u{1F388}\u274C\u270A\u{1F44B}\u{1F630}\u{1F928}\u{1F636}\u{1F91D}\u{1F6B6}\u{1F4B0}\u{1F353}\u{1F4A2}\u{1F91F}\u{1F641}\u{1F6A8}\u{1F4A8}\u{1F92C}\u2708\u{1F380}\u{1F37A}\u{1F913}\u{1F619}\u{1F49F}\u{1F331}\u{1F616}\u{1F476}\u{1F974}\u25B6\u27A1\u2753\u{1F48E}\u{1F4B8}\u2B07\u{1F628}\u{1F31A}\u{1F98B}\u{1F637}\u{1F57A}\u26A0\u{1F645}\u{1F61F}\u{1F635}\u{1F44E}\u{1F932}\u{1F920}\u{1F927}\u{1F4CC}\u{1F535}\u{1F485}\u{1F9D0}\u{1F43E}\u{1F352}\u{1F617}\u{1F911}\u{1F30A}\u{1F92F}\u{1F437}\u260E\u{1F4A7}\u{1F62F}\u{1F486}\u{1F446}\u{1F3A4}\u{1F647}\u{1F351}\u2744\u{1F334}\u{1F4A3}\u{1F438}\u{1F48C}\u{1F4CD}\u{1F940}\u{1F922}\u{1F445}\u{1F4A1}\u{1F4A9}\u{1F450}\u{1F4F8}\u{1F47B}\u{1F910}\u{1F92E}\u{1F3BC}\u{1F975}\u{1F6A9}\u{1F34E}\u{1F34A}\u{1F47C}\u{1F48D}\u{1F4E3}\u{1F942}"),Lf=ks.reduce((r,e,t)=>(r[t]=e,r),[]),Uf=ks.reduce((r,e,t)=>(r[e.codePointAt(0)]=t,r),[]);function Rf(r){return r.reduce((e,t)=>(e+=Lf[t],e),"")}function zf(r){let e=[];for(let t of r){let o=Uf[t.codePointAt(0)];if(o===void 0)throw new Error(`Non-base256emoji character: ${t}`);e.push(o)}return new Uint8Array(e)}var Ff=Et({prefix:"\u{1F680}",name:"base256emoji",encode:Rf,decode:zf});var Dn={};be(Dn,{sha256:()=>al,sha512:()=>cl});var In=oe(ke("crypto"),1);var Vf=Rs,Ls=128,$f=127,Wf=~$f,Gf=Math.pow(2,31);function Rs(r,e,t){e=e||[],t=t||0;for(var o=t;r>=Gf;)e[t++]=r&255|Ls,r/=128;for(;r&Wf;)e[t++]=r&255|Ls,r>>>=7;return e[t]=r|0,Rs.bytes=t-o+1,e}var Kf=Pn,Jf=128,Us=127;function Pn(r,o){var t=0,o=o||0,n=0,i=o,s,a=r.length;do{if(i>=a)throw Pn.bytes=0,new RangeError("Could not decode varint");s=r[i++],t+=n<28?(s&Us)<<n:(s&Us)*Math.pow(2,n),n+=7}while(s>=Jf);return Pn.bytes=i-o,t}var Xf=Math.pow(2,7),Qf=Math.pow(2,14),Zf=Math.pow(2,21),Yf=Math.pow(2,28),Hf=Math.pow(2,35),el=Math.pow(2,42),tl=Math.pow(2,49),rl=Math.pow(2,56),nl=Math.pow(2,63),ol=function(r){return r<Xf?1:r<Qf?2:r<Zf?3:r<Yf?4:r<Hf?5:r<el?6:r<tl?7:r<rl?8:r<nl?9:10},il={encode:Vf,decode:Kf,encodingLength:ol},sl=il,Wt=sl;var Gt=(r,e=0)=>[Wt.decode(r,e),Wt.decode.bytes],At=(r,e,t=0)=>(Wt.encode(r,e,t),e),St=r=>Wt.encodingLength(r);var at=(r,e)=>{let t=e.byteLength,o=St(r),n=o+St(t),i=new Uint8Array(n+t);return At(r,i,0),At(t,i,o),i.set(e,n),new Tt(r,t,e,i)},wr=r=>{let e=Te(r),[t,o]=Gt(e),[n,i]=Gt(e.subarray(o)),s=e.subarray(o+i);if(s.byteLength!==n)throw new Error("Incorrect length");return new Tt(t,n,s,e)},zs=(r,e)=>{if(r===e)return!0;{let t=e;return r.code===t.code&&r.size===t.size&&t.bytes instanceof Uint8Array&&_s(r.bytes,t.bytes)}},Tt=class{constructor(e,t,o,n){this.code=e,this.size=t,this.digest=o,this.bytes=n}};var Mn=({name:r,code:e,encode:t})=>new On(r,e,t),On=class{constructor(e,t,o){this.name=e,this.code=t,this.encode=o}digest(e){if(e instanceof Uint8Array){let t=this.encode(e);return t instanceof Uint8Array?at(this.code,t):t.then(o=>at(this.code,o))}else throw Error("Unknown type, must be binary type")}};var al=Mn({name:"sha2-256",code:18,encode:r=>Te(In.default.createHash("sha256").update(r).digest())}),cl=Mn({name:"sha2-512",code:19,encode:r=>Te(In.default.createHash("sha512").update(r).digest())});var _n={};be(_n,{identity:()=>ll});var Vs=0,ul="identity",$s=Te,fl=r=>at(Vs,$s(r)),ll={code:Vs,name:ul,encode:$s,digest:fl};var vp=new TextEncoder,xp=new TextDecoder;var Ws=(r,e)=>{let{bytes:t,version:o}=r;switch(o){case 0:return yl(t,Cn(r),e||de.encoder);default:return ml(t,Cn(r),e||Ue.encoder)}};var Gs=new WeakMap,Cn=r=>{let e=Gs.get(r);if(e==null){let t=new Map;return Gs.set(r,t),t}return e},Z=class{constructor(e,t,o,n){this.code=t,this.version=e,this.multihash=o,this.bytes=n,this["/"]=n}get asCID(){return this}get byteOffset(){return this.bytes.byteOffset}get byteLength(){return this.bytes.byteLength}toV0(){switch(this.version){case 0:return this;case 1:{let{code:e,multihash:t}=this;if(e!==Kt)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(t.code!==gl)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return Z.createV0(t)}default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}toV1(){switch(this.version){case 0:{let{code:e,digest:t}=this.multihash,o=at(e,t);return Z.createV1(this.code,o)}case 1:return this;default:throw Error(`Can not convert CID version ${this.version} to version 1. This is a bug please report`)}}equals(e){return Z.equals(this,e)}static equals(e,t){let o=t;return o&&e.code===o.code&&e.version===o.version&&zs(e.multihash,o.multihash)}toString(e){return Ws(this,e)}toJSON(){return{"/":Ws(this)}}link(){return this}get[Symbol.toStringTag](){return"CID"}[Symbol.for("nodejs.util.inspect.custom")](){return`CID(${this.toString()})`}static asCID(e){if(e==null)return null;let t=e;if(t instanceof Z)return t;if(t["/"]!=null&&t["/"]===t.bytes||t.asCID===t){let{version:o,code:n,multihash:i,bytes:s}=t;return new Z(o,n,i,s||Ks(o,n,i.bytes))}else if(t[bl]===!0){let{version:o,multihash:n,code:i}=t,s=wr(n);return Z.create(o,i,s)}else return null}static create(e,t,o){if(typeof t!="number")throw new Error("String codecs are no longer supported");if(!(o.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(e){case 0:{if(t!==Kt)throw new Error(`Version 0 CID must use dag-pb (code: ${Kt}) block encoding`);return new Z(e,t,o,o.bytes)}case 1:{let n=Ks(e,t,o.bytes);return new Z(e,t,o,n)}default:throw new Error("Invalid version")}}static createV0(e){return Z.create(0,Kt,e)}static createV1(e,t){return Z.create(1,e,t)}static decode(e){let[t,o]=Z.decodeFirst(e);if(o.length)throw new Error("Incorrect length");return t}static decodeFirst(e){let t=Z.inspectBytes(e),o=t.size-t.multihashSize,n=Te(e.subarray(o,o+t.multihashSize));if(n.byteLength!==t.multihashSize)throw new Error("Incorrect length");let i=n.subarray(t.multihashSize-t.digestSize),s=new Tt(t.multihashCode,t.digestSize,i,n);return[t.version===0?Z.createV0(s):Z.createV1(t.codec,s),e.subarray(t.size)]}static inspectBytes(e){let t=0,o=()=>{let[w,B]=Gt(e.subarray(t));return t+=B,w},n=o(),i=Kt;if(n===18?(n=0,t=0):i=o(),n!==0&&n!==1)throw new RangeError(`Invalid CID version ${n}`);let s=t,a=o(),c=o(),u=t+c,d=u-s;return{version:n,codec:i,multihashCode:a,digestSize:c,multihashSize:d,size:u}}static parse(e,t){let[o,n]=pl(e,t),i=Z.decode(n);if(i.version===0&&e[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return Cn(i).set(o,e),i}},pl=(r,e)=>{switch(r[0]){case"Q":{let t=e||de;return[de.prefix,t.decode(`${de.prefix}${r}`)]}case de.prefix:{let t=e||de;return[de.prefix,t.decode(r)]}case Ue.prefix:{let t=e||Ue;return[Ue.prefix,t.decode(r)]}default:{if(e==null)throw Error("To parse non base32 or base58btc encoded CID multibase decoder must be provided");return[r[0],e.decode(r)]}}},yl=(r,e,t)=>{let{prefix:o}=t;if(o!==de.prefix)throw Error(`Cannot string encode V0 in ${t.name} encoding`);let n=e.get(o);if(n==null){let i=t.encode(r).slice(1);return e.set(o,i),i}else return n},ml=(r,e,t)=>{let{prefix:o}=t,n=e.get(o);if(n==null){let i=t.encode(r);return e.set(o,i),i}else return n},Kt=112,gl=18,Ks=(r,e,t)=>{let o=St(r),n=o+St(e),i=new Uint8Array(n+t.byteLength);return At(r,i,0),At(e,i,o),i.set(t,n),i},bl=Symbol.for("@ipld/js-cid/CID");var Jt={...gn,...bn,...wn,...vn,...xn,...En,...An,...Sn,...Tn,...Nn},Dp={...Dn,..._n};function ct(r){return globalThis.Buffer!=null?new Uint8Array(r.buffer,r.byteOffset,r.byteLength):r}function Re(r=0){return globalThis.Buffer?.alloc!=null?ct(globalThis.Buffer.alloc(r)):new Uint8Array(r)}function ze(r=0){return globalThis.Buffer?.allocUnsafe!=null?ct(globalThis.Buffer.allocUnsafe(r)):new Uint8Array(r)}function Xs(r,e,t,o){return{name:r,prefix:e,encoder:{name:r,prefix:e,encode:t},decoder:{decode:o}}}var Js=Xs("utf8","u",r=>"u"+new TextDecoder("utf8").decode(r),r=>new TextEncoder().encode(r.substring(1))),jn=Xs("ascii","a",r=>{let e="a";for(let t=0;t<r.length;t++)e+=String.fromCharCode(r[t]);return e},r=>{r=r.substring(1);let e=ze(r.length);for(let t=0;t<r.length;t++)e[t]=r.charCodeAt(t);return e}),wl={utf8:Js,"utf-8":Js,hex:Jt.base16,latin1:jn,ascii:jn,binary:jn,...Jt},vr=wl;function ae(r,e="utf8"){let t=vr[e];if(t==null)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?ct(globalThis.Buffer.from(r,"utf-8")):t.decoder.decode(`${t.prefix}${r}`)}function pe(r,e){e==null&&(e=r.reduce((n,i)=>n+i.length,0));let t=ze(e),o=0;for(let n of r)t.set(n,o),o+=n.length;return ct(t)}var xr={key:pe([ae("/pk/"),ae("muft89xjpybos8eas1vaq2xrbsx2vkll7is4ocy7pia5fsjlt3c2","base36")]),value:ae("080012a60230820122300d06092a864886f70d01010105000382010f003082010a0282010100c2588f998971dac9e3eef76a311bf9159505aff69ea3b664c55a36aa28ee08de1127228a4d431bb9c0840240c75f6e98a0843a78d945491a3ea5e1f7cee2bc71383510db5290702383975b7bffae9fb40c84cc1220fb4a7db862fffb0de42f8fd8fb33a17deb20f30e2d0f194791fe69355a392f77df35f101e08a2fc95b2c018768938814fcb52482f899f5e90a1905e8abbcdbb1647ad80a5b0417e1ce8320d64197a6ba3848926375c63adebabdf6eb82109bcadfee13b62bf922bbb6f74c1a26c9bc6122d1436787e0e6de3c152b1959701092abef84599f73eaedb2fcef9f87293e1bbe8e0fef3f1a7fd2e8b94c7e633f88473644a63cb948e4d25c54490203010001","hex")};function Qs(r){let e=["js","go"];for(let t of e)for(let o of e)vl(r,{type:t,dht:!0},{type:o,dht:!0})}function vl(r,e,t){describe("dht.contentFetching",()=>{let o;before(async function(){this.timeout(20*1e3),o=await Promise.all([r.spawn(e),r.spawn(t)]);let n=await o[0].client.identify();await o[1].client.connect(n.peerId,n.addrs),await new Promise(i=>setTimeout(i,1e3))}),after(async function(){o!=null&&await Promise.all(o.map(async n=>{await n.stop()}))}),it(`${e.type} peer to ${t.type} peer`,async function(){this.timeout(10*1e3),await o[0].client.dht.put(xr.key,xr.value);let n=await o[1].client.dht.get(xr.key);W(n).to.equalBytes(xr.value)})})}async function Xt(r){let e=[];for await(let t of r)e.push(t);return e}function Zs(r){let e=["js","go"];for(let t of e)for(let o of e)t==="go"&&o==="go"||xl(r,{type:t,dht:!0},{type:o,dht:!0})}function xl(r,e,t){describe("dht.contentRouting",()=>{let o,n;before(async function(){this.timeout(20*1e3),o=await Promise.all([r.spawn(e),r.spawn(t),r.spawn(t)]),n=await Promise.all(o.map(async i=>await i.client.identify())),await o[0].client.connect(n[1].peerId,n[1].addrs),await o[0].client.connect(n[2].peerId,n[2].addrs),await new Promise(i=>setTimeout(i,1e3))}),after(async function(){o!=null&&await Promise.all(o.map(async i=>{await i.stop()}))}),it(`${e.type} peer to ${t.type} peer`,async function(){let i=Z.parse("QmVzw6MPsF96TyXBSRs1ptLoVMWRv5FCYJZZGJSVB2Hp39");await o[0].client.dht.provide(i);let s=await Xt(o[1].client.dht.findProviders(i,1));W(s).to.exist(),W(s.length).to.be.greaterThan(0)})})}var oa=oe(ra(),1),Al=new Set(["Failed to fetch","NetworkError when attempting to fetch resource.","The Internet connection appears to be offline.","Network request failed","fetch failed"]),qn=class extends Error{constructor(e){super(),e instanceof Error?(this.originalError=e,{message:e}=e):(this.originalError=new Error(e),this.originalError.stack=this.stack),this.name="AbortError",this.message=e}},Sl=(r,e,t)=>{let o=t.retries-(e-1);return r.attemptNumber=e,r.retriesLeft=o,r},Tl=r=>Al.has(r),na=r=>globalThis.DOMException===void 0?new Error(r):new DOMException(r);async function Bn(r,e){return new Promise((t,o)=>{e={onFailedAttempt(){},retries:10,...e};let n=oa.default.operation(e);n.attempt(async i=>{try{t(await r(i))}catch(s){if(!(s instanceof Error)){o(new TypeError(`Non-error was thrown: "${s}". You should only throw errors.`));return}if(s instanceof qn)n.stop(),o(s.originalError);else if(s instanceof TypeError&&!Tl(s.message))n.stop(),o(s);else{Sl(s,i,e);try{await e.onFailedAttempt(s)}catch(a){o(a);return}n.retry(s)||o(n.mainError())}}}),e.signal&&!e.signal.aborted&&e.signal.addEventListener("abort",()=>{n.stop();let i=e.signal.reason===void 0?na("The operation was aborted."):e.signal.reason;o(i instanceof Error?i:na(i))},{once:!0})})}function ia(r){let e=["js","go"];for(let t of e)for(let o of e)Nl(r,{type:t,dht:!0},{type:o,dht:!0})}function Nl(r,e,t){describe("dht.peerRouting",()=>{let o;before(async function(){this.timeout(20*1e3),o=await Promise.all([r.spawn(e),r.spawn(t),r.spawn(t)])}),after(async function(){o!=null&&await Promise.all(o.map(async n=>{await n.stop()}))}),it(`${e.type} peer to ${t.type} peer`,async function(){let n=await o[1].client.identify(),i=await o[2].client.identify();await o[0].client.connect(n.peerId,n.addrs),await o[0].client.connect(i.peerId,i.addrs);let s=await Bn(async()=>await o[1].client.dht.findPeer(i.peerId),{retries:10});W(i.addrs.map(a=>a.toString())).to.include.deep.members(s.multiaddrs.map(a=>a.toString()))})})}async function kn(r){Qs(r),Zs(r),ia(r)}async function ft(r){for await(let e of r)return e}var Er=class extends Error{constructor(e){super(e),this.name="TimeoutError"}},Ln=class extends Error{constructor(e){super(),this.name="AbortError",this.message=e}},sa=r=>globalThis.DOMException===void 0?new Ln(r):new DOMException(r),aa=r=>{let e=r.reason===void 0?sa("This operation was aborted."):r.reason;return e instanceof Error?e:sa(e)};function Un(r,e){let{milliseconds:t,fallback:o,message:n,customTimers:i={setTimeout,clearTimeout}}=e,s,a=new Promise((c,u)=>{if(typeof t!="number"||Math.sign(t)!==1)throw new TypeError(`Expected \`milliseconds\` to be a positive number, got \`${t}\``);if(t===Number.POSITIVE_INFINITY){c(r);return}if(e.signal){let{signal:w}=e;w.aborted&&u(aa(w)),w.addEventListener("abort",()=>{u(aa(w))})}let d=new Er;s=i.setTimeout.call(void 0,()=>{if(o){try{c(o())}catch(w){u(w)}return}typeof r.cancel=="function"&&r.cancel(),n===!1?c():n instanceof Error?u(n):(d.message=n??`Promise timed out after ${t} milliseconds`,u(d))},t),(async()=>{try{c(await r)}catch(w){u(w)}finally{i.clearTimeout.call(void 0,s)}})()});return a.clear=()=>{i.clearTimeout.call(void 0,s),s=void 0},a}var Rn=Symbol("resolveValue");async function Qt(r,e={}){let{interval:t=20,timeout:o=Number.POSITIVE_INFINITY,before:n=!0}=e,i,s=new Promise((a,c)=>{let u=async()=>{try{let d=await r();if(typeof d=="object"&&d[Rn])a(d[Rn]);else{if(typeof d!="boolean")throw new TypeError("Expected condition to return a boolean");d===!0?a():i=setTimeout(u,t)}}catch(d){c(d)}};n?u():i=setTimeout(u,t)});if(o===Number.POSITIVE_INFINITY)return s;try{return await Un(s,typeof o=="number"?{milliseconds:o}:o)}finally{clearTimeout(i)}}Qt.resolveWith=r=>({[Rn]:r});async function Pt(r,e,t){await e.client.pubsub.subscribe(r),await t.client.pubsub.subscribe(r);let o=await e.client.identify(),n=await t.client.identify();await Promise.all([await Qt(async()=>(await e.client.pubsub.getSubscribers(r)).map(s=>s.toString()).includes(n.peerId.toString()),{interval:500}),await Qt(async()=>(await t.client.pubsub.getSubscribers(r)).map(s=>s.toString()).includes(o.peerId.toString()),{interval:500})])}function ca(r){let e=["js","go"];for(let t of e)for(let o of e)Pl(r,{type:t,pubsub:!0,pubsubRouter:"floodsub"},{type:o,pubsub:!0,pubsubRouter:"floodsub"})}function Pl(r,e,t){describe("pubsub.floodSub",()=>{let o;before(async function(){this.timeout(20*1e3),o=await Promise.all([r.spawn(e),r.spawn(t)]);let[n,i]=o,s=await i.client.identify();await n.client.connect(s.peerId,s.addrs)}),after(async function(){o!=null&&await Promise.all(o.map(async n=>{await n.stop()}))}),it(`${e.type} peer to ${t.type} peer`,async function(){let n="test-topic",i=ae("test-data"),[s,a]=o,c=await a.client.pubsub.subscribe(n),u=async()=>{let w=await ft(c.messages());W(w).to.exist(),W(w).to.have.property("data").that.equalBytes(i)},d=async()=>{await Pt(n,s,a),await s.client.pubsub.publish(n,i)};return await Promise.all([u(),d()])})})}function ua(r){let e=["js","go"];for(let t of e)for(let o of e)Ol(r,{type:t,pubsub:!0,pubsubRouter:"gossipsub"},{type:o,pubsub:!0,pubsubRouter:"gossipsub"})}function Ol(r,e,t){describe("pubsub.gossipsub",()=>{let o;before(async function(){this.timeout(20*1e3),o=await Promise.all([r.spawn(e),r.spawn(t)]);let[n,i]=o,s=await i.client.identify();await n.client.connect(s.peerId,s.addrs)}),after(async function(){o!=null&&await Promise.all(o.map(async n=>{await n.stop()}))}),it(`${e.type} peer to ${t.type} peer`,async function(){let n="test-topic",i=ae("test-data"),[s,a]=o,c=await a.client.pubsub.subscribe(n),u=async()=>{let w=await ft(c.messages());W(w).to.exist(),W(w).to.have.property("data").that.equalBytes(i)},d=async()=>{await Pt(n,s,a),await s.client.pubsub.publish(n,i)};return await Promise.all([u(),d()])})})}function fa(r){let e=["js","go"];for(let t of e)for(let o of e)Ml(r,{type:t,pubsub:!0,pubsubRouter:"floodsub"},{type:o,pubsub:!0,pubsubRouter:"gossipsub"})}function Ml(r,e,t){describe("pubsub.hybrid",()=>{let o;before(async function(){this.timeout(20*1e3),o=await Promise.all([r.spawn(e),r.spawn(t)]);let[n,i]=o,s=await i.client.identify();await n.client.connect(s.peerId,s.addrs)}),after(async function(){o!=null&&await Promise.all(o.map(async n=>{await n.stop()}))}),it(`${e.type} peer to ${t.type} peer`,async function(){let n="test-topic",i=ae("test-data"),[s,a]=o,c=await a.client.pubsub.subscribe(n),u=async()=>{let w=await ft(c.messages());W(w).to.exist(),W(w).to.have.property("data").that.equalBytes(i)},d=async()=>{await Pt(n,s,a),await s.client.pubsub.publish(n,i)};return await Promise.all([u(),d()])})})}async function zn(r){ca(r),ua(r),fa(r)}var Ar=class{constructor(e){if(!(e>0)||e-1&e)throw new Error("Max size for a FixedFIFO should be a power of two");this.buffer=new Array(e),this.mask=e-1,this.top=0,this.btm=0,this.next=null}push(e){return this.buffer[this.top]!==void 0?!1:(this.buffer[this.top]=e,this.top=this.top+1&this.mask,!0)}shift(){let e=this.buffer[this.btm];if(e!==void 0)return this.buffer[this.btm]=void 0,this.btm=this.btm+1&this.mask,e}isEmpty(){return this.buffer[this.btm]===void 0}},Ot=class{constructor(e={}){this.hwm=e.splitLimit??16,this.head=new Ar(this.hwm),this.tail=this.head,this.size=0}calculateSize(e){return e?.byteLength!=null?e.byteLength:1}push(e){if(e?.value!=null&&(this.size+=this.calculateSize(e.value)),!this.head.push(e)){let t=this.head;this.head=t.next=new Ar(2*this.head.buffer.length),this.head.push(e)}}shift(){let e=this.tail.shift();if(e===void 0&&this.tail.next!=null){let t=this.tail.next;this.tail.next=null,this.tail=t,e=this.tail.shift()}return e?.value!=null&&(this.size-=this.calculateSize(e.value)),e}isEmpty(){return this.head.isEmpty()}};function Mt(r={}){return Il(t=>{let o=t.shift();if(o==null)return{done:!0};if(o.error!=null)throw o.error;return{done:o.done===!0,value:o.value}},r)}function Il(r,e){e=e??{};let t=e.onEnd,o=new Ot,n,i,s,a=async()=>o.isEmpty()?s?{done:!0}:await new Promise((E,I)=>{i=q=>{i=null,o.push(q);try{E(r(o))}catch($){I($)}return n}}):r(o),c=E=>i!=null?i(E):(o.push(E),n),u=E=>(o=new Ot,i!=null?i({error:E}):(o.push({error:E}),n)),d=E=>{if(s)return n;if(e?.objectMode!==!0&&E?.byteLength==null)throw new Error("objectMode was not true but tried to push non-Uint8Array value");return c({done:!1,value:E})},w=E=>s?n:(s=!0,E!=null?u(E):c({done:!0})),B=()=>(o=new Ot,w(),{done:!0}),k=E=>(w(E),{done:!0});if(n={[Symbol.asyncIterator](){return this},next:a,return:B,throw:k,push:d,end:w,get readableLength(){return o.size}},t==null)return n;let N=n;return n={[Symbol.asyncIterator](){return this},next(){return N.next()},throw(E){return N.throw(E),t!=null&&(t(E),t=void 0),{done:!0}},return(){return N.return(),t!=null&&(t(),t=void 0),{done:!0}},push:d,end(E){return N.end(E),t!=null&&(t(E),t=void 0),n},get readableLength(){return N.readableLength}},n}async function*Fn(...r){let e=Mt({objectMode:!0});Promise.resolve().then(async()=>{try{await Promise.all(r.map(async t=>{for await(let o of t)e.push(o)})),e.end()}catch(t){e.end(t)}}),yield*e}var Dl=(...r)=>{let e;for(;r.length>0;)e=r.shift()(e);return e},la=r=>r!=null&&(typeof r[Symbol.asyncIterator]=="function"||typeof r[Symbol.iterator]=="function"||typeof r.next=="function"),Vn=r=>r!=null&&typeof r.sink=="function"&&la(r.source),_l=r=>e=>{let t=r.sink(e);if(t.then!=null){let o=Mt({objectMode:!0});return t.then(()=>{o.end()},i=>{o.end(i)}),Fn(o,async function*(){yield*r.source,o.end()}())}return r.source};function Zt(r,...e){if(Vn(r)){let o=r;r=()=>o.source}else if(la(r)){let o=r;r=()=>o}let t=[r,...e];if(t.length>1&&Vn(t[t.length-1])&&(t[t.length-1]=t[t.length-1].sink),t.length>2)for(let o=1;o<t.length-1;o++)Vn(t[o])&&(t[o]=_l(t[o]));return Dl(...t)}function Yt(){let r={};return r.promise=new Promise((e,t)=>{r.resolve=e,r.reject=t}),r}function $n(r,e){let t=["js","go"];for(let o of t)for(let n of t)Cl(r,e,{type:o,muxer:e},{type:n,muxer:e})}function Cl(r,e,t,o){describe(`echo streams - ${e}`,()=>{let n;before(async function(){this.timeout(20*1e3),n=await Promise.all([r.spawn(t),r.spawn(o)]);let i=await n[0].client.identify();await n[1].client.connect(i.peerId,i.addrs),await new Promise(s=>setTimeout(s,1e3))}),after(async function(){n!=null&&await Promise.all(n.map(async i=>{await i.stop()}))}),it(`${t.type} sender to ${o.type} listener`,async function(){this.timeout(10*1e3);let i=await n[1].client.identify(),s="/echo/1.0.0",a=[ae("hello world")];await n[1].client.registerStreamHandler(s,async w=>{await Zt(w,async function*(B){for await(let k of B)yield k.subarray()},w)});let c=await n[0].client.openStream(i.peerId,s),u=Yt(),d=await Zt(a,async function*(w){yield*w,await u.promise},c,async function*(w){for await(let B of w)yield B.subarray(),u.resolve()},async w=>await Xt(w));W(d).to.deep.equal(a)})})}async function Wn(r){$n(r,"mplex"),$n(r,"yamux")}var Je=ke("node:net");function Sr(r){return Boolean((0,Je.isIP)(r))}function ye(r,e="utf8"){let t=vr[e];if(t==null)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(r.buffer,r.byteOffset,r.byteLength).toString("utf8"):t.encoder.encode(r).substring(1)}var ha=Je.isIPv4,jl=Je.isIPv6,Gn=function(r){let e=0;if(r=r.toString().trim(),ha(r)){let t=new Uint8Array(e+4);return r.split(/\./g).forEach(o=>{t[e++]=parseInt(o,10)&255}),t}if(jl(r)){let t=r.split(":",8),o;for(o=0;o<t.length;o++){let i=ha(t[o]),s;i&&(s=Gn(t[o]),t[o]=ye(s.slice(0,2),"base16")),s!=null&&++o<8&&t.splice(o,0,ye(s.slice(2,4),"base16"))}if(t[0]==="")for(;t.length<8;)t.unshift("0");else if(t[t.length-1]==="")for(;t.length<8;)t.push("0");else if(t.length<8){for(o=0;o<t.length&&t[o]!=="";o++);let i=[o,1];for(o=9-t.length;o>0;o--)i.push("0");t.splice.apply(t,i)}let n=new Uint8Array(e+16);for(o=0;o<t.length;o++){let i=parseInt(t[o],16);n[e++]=i>>8&255,n[e++]=i&255}return n}throw new Error("invalid ip address")},da=function(r,e=0,t){e=~~e,t=t??r.length-e;let o=new DataView(r.buffer);if(t===4){let n=[];for(let i=0;i<t;i++)n.push(r[e+i]);return n.join(".")}if(t===16){let n=[];for(let i=0;i<t;i+=2)n.push(o.getUint16(e+i).toString(16));return n.join(":").replace(/(^|:)0(:0)*:0(:|$)/,"$1::$3").replace(/:{3,4}/,"::")}return""};var Ht={},Kn={},Bl=[[4,32,"ip4"],[6,16,"tcp"],[33,16,"dccp"],[41,128,"ip6"],[42,-1,"ip6zone"],[43,8,"ipcidr"],[53,-1,"dns",!0],[54,-1,"dns4",!0],[55,-1,"dns6",!0],[56,-1,"dnsaddr",!0],[132,16,"sctp"],[273,16,"udp"],[275,0,"p2p-webrtc-star"],[276,0,"p2p-webrtc-direct"],[277,0,"p2p-stardust"],[280,0,"webrtc"],[290,0,"p2p-circuit"],[301,0,"udt"],[302,0,"utp"],[400,-1,"unix",!1,!0],[421,-1,"ipfs"],[421,-1,"p2p"],[443,0,"https"],[444,96,"onion"],[445,296,"onion3"],[446,-1,"garlic64"],[448,0,"tls"],[460,0,"quic"],[461,0,"quic-v1"],[465,0,"webtransport"],[466,-1,"certhash"],[477,0,"ws"],[478,0,"wss"],[479,0,"p2p-websocket-star"],[480,0,"http"],[777,-1,"memory"]];Bl.forEach(r=>{let e=kl(...r);Kn[e.code]=e,Ht[e.name]=e});function kl(r,e,t,o,n){return{code:r,size:e,name:t,resolvable:Boolean(o),path:Boolean(n)}}function H(r){if(typeof r=="number"){if(Kn[r]!=null)return Kn[r];throw new Error(`no protocol with code: ${r}`)}else if(typeof r=="string"){if(Ht[r]!=null)return Ht[r];throw new Error(`no protocol with name: ${r}`)}throw new Error(`invalid protocol id type: ${typeof r}`)}var _e=oe(Tr(),1);function Pa(r,e){switch(H(r).code){case 4:case 41:return Yl(e);case 42:return Ta(e);case 6:case 273:case 33:case 132:return Ma(e).toString();case 53:case 54:case 55:case 56:case 400:case 777:return Ta(e);case 421:return rh(e);case 444:return Na(e);case 445:return Na(e);case 466:return th(e);default:return ye(e,"base16")}}function Oa(r,e){switch(H(r).code){case 4:return Aa(e);case 41:return Aa(e);case 42:return Sa(e);case 6:case 273:case 33:case 132:return Zn(parseInt(e,10));case 53:case 54:case 55:case 56:case 400:case 777:return Sa(e);case 421:return Hl(e);case 444:return nh(e);case 445:return oh(e);case 466:return eh(e);default:return ae(e,"base16")}}var Qn=Object.values(Jt).map(r=>r.decoder),Zl=function(){let r=Qn[0].or(Qn[1]);return Qn.slice(2).forEach(e=>r=r.or(e)),r}();function Aa(r){if(!Sr(r))throw new Error("invalid ip address");return Gn(r)}function Yl(r){let e=da(r,0,r.length);if(e==null)throw new Error("ipBuff is required");if(!Sr(e))throw new Error("invalid ip address");return e}function Zn(r){let e=new ArrayBuffer(2);return new DataView(e).setUint16(0,r),new Uint8Array(e)}function Ma(r){return new DataView(r.buffer).getUint16(r.byteOffset)}function Sa(r){let e=ae(r),t=Uint8Array.from(_e.default.encode(e.length));return pe([t,e],t.length+e.length)}function Ta(r){let e=_e.default.decode(r);if(r=r.slice(_e.default.decode.bytes),r.length!==e)throw new Error("inconsistent lengths");return ye(r)}function Hl(r){let e;r[0]==="Q"||r[0]==="1"?e=wr(de.decode(`z${r}`)).bytes:e=Z.parse(r).multihash.bytes;let t=Uint8Array.from(_e.default.encode(e.length));return pe([t,e],t.length+e.length)}function eh(r){let e=Zl.decode(r),t=Uint8Array.from(_e.default.encode(e.length));return pe([t,e],t.length+e.length)}function th(r){let e=_e.default.decode(r),t=r.slice(_e.default.decode.bytes);if(t.length!==e)throw new Error("inconsistent lengths");return"u"+ye(t,"base64url")}function rh(r){let e=_e.default.decode(r),t=r.slice(_e.default.decode.bytes);if(t.length!==e)throw new Error("inconsistent lengths");return ye(t,"base58btc")}function nh(r){let e=r.split(":");if(e.length!==2)throw new Error(`failed to parse onion addr: ["'${e.join('", "')}'"]' does not contain a port number`);if(e[0].length!==16)throw new Error(`failed to parse onion addr: ${e[0]} not a Tor onion address.`);let t=Ue.decode("b"+e[0]),o=parseInt(e[1],10);if(o<1||o>65536)throw new Error("Port number is not in range(1, 65536)");let n=Zn(o);return pe([t,n],t.length+n.length)}function oh(r){let e=r.split(":");if(e.length!==2)throw new Error(`failed to parse onion addr: ["'${e.join('", "')}'"]' does not contain a port number`);if(e[0].length!==56)throw new Error(`failed to parse onion addr: ${e[0]} not a Tor onion3 address.`);let t=Ue.decode(`b${e[0]}`),o=parseInt(e[1],10);if(o<1||o>65536)throw new Error("Port number is not in range(1, 65536)");let n=Zn(o);return pe([t,n],t.length+n.length)}function Na(r){let e=r.slice(0,r.length-2),t=r.slice(r.length-2),o=ye(e,"base32"),n=Ma(t);return`${o}:${n}`}var It=oe(Tr(),1);function ih(r){let e=[],t=r.split("/").slice(1);if(t.length===1&&t[0]==="")return[];for(let o=0;o<t.length;o++){let n=t[o],i=H(n);if(i.size===0){e.push([n]);continue}if(o++,o>=t.length)throw Da("invalid address: "+r);if(i.path===!0){e.push([n,ro(t.slice(o).join("/"))]);break}e.push([n,t[o]])}return e}function sh(r){let e=[];return r.map(t=>{let o=Or(t);return e.push(o.name),t.length>1&&t[1]!=null&&e.push(t[1]),null}),ro(e.join("/"))}function ah(r){return r.map(e=>{Array.isArray(e)||(e=[e]);let t=Or(e);return e.length>1?[t.code,Oa(t.code,e[1])]:[t.code]})}function Yn(r){return r.map(e=>{let t=Or(e);return e[1]!=null?[t.code,Pa(t.code,e[1])]:[t.code]})}function Hn(r){return Pr(pe(r.map(e=>{let t=Or(e),o=Uint8Array.from(It.default.encode(t.code));return e.length>1&&e[1]!=null&&(o=pe([o,e[1]])),o})))}function eo(r,e){return r.size>0?r.size/8:r.size===0?0:It.default.decode(e)+(It.default.decode.bytes??0)}function Nr(r){let e=[],t=0;for(;t<r.length;){let o=It.default.decode(r,t),n=It.default.decode.bytes??0,i=H(o),s=eo(i,r.slice(t+n));if(s===0){e.push([o]),t+=n;continue}let a=r.slice(t+n,t+n+s);if(t+=s+n,t>r.length)throw Da("Invalid address Uint8Array: "+ye(r,"base16"));e.push([o,a])}return e}function to(r){let e=Nr(r),t=Yn(e);return sh(t)}function ch(r){r=ro(r);let e=ih(r),t=ah(e);return Hn(t)}function Ia(r){return ch(r)}function Pr(r){let e=uh(r);if(e!=null)throw e;return Uint8Array.from(r)}function uh(r){try{Nr(r)}catch(e){return e}}function ro(r){return"/"+r.trim().split("/").filter(e=>e).join("/")}function Da(r){return new Error("Error parsing address: "+r)}function Or(r){return H(r[0])}var io=oe(Tr(),1);var qa=oe(no(),1);function Mr(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}var Dt=function(r,e,t,o){if(t==="a"&&!o)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!o:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?o:t==="a"?o.call(r):o?o.value:e.get(r)},oo=function(r,e,t,o,n){if(o==="m")throw new TypeError("Private method is not writable");if(o==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return o==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},er,tr,rr,ja,hh=Symbol.for("nodejs.util.inspect.custom"),dh=[H("dns").code,H("dns4").code,H("dns6").code,H("dnsaddr").code],ph=new Map,Ba=Symbol.for("@multiformats/js-multiaddr/multiaddr");function yh(r){return Boolean(r?.[Ba])}var Fe=class{constructor(e){if(er.set(this,void 0),tr.set(this,void 0),rr.set(this,void 0),this[ja]=!0,e==null&&(e=""),e instanceof Uint8Array)this.bytes=Pr(e);else if(typeof e=="string"){if(e.length>0&&e.charAt(0)!=="/")throw new Error(`multiaddr "${e}" must start with a "/"`);this.bytes=Ia(e)}else if(yh(e))this.bytes=Pr(e.bytes);else throw new Error("addr must be a string, Buffer, or another Multiaddr")}toString(){return Dt(this,er,"f")==null&&oo(this,er,to(this.bytes),"f"),Dt(this,er,"f")}toJSON(){return this.toString()}toOptions(){let e,t,o,n,i="",s=H("tcp"),a=H("udp"),c=H("ip4"),u=H("ip6"),d=H("dns6"),w=H("ip6zone");for(let[k,N]of this.stringTuples())k===w.code&&(i=`%${N??""}`),dh.includes(k)&&(t=s.name,n=443,o=`${N??""}${i}`,e=k===d.code?6:4),(k===s.code||k===a.code)&&(t=H(k).name,n=parseInt(N??"")),(k===c.code||k===u.code)&&(t=H(k).name,o=`${N??""}${i}`,e=k===u.code?6:4);if(e==null||t==null||o==null||n==null)throw new Error('multiaddr must have a valid format: "/{ip4, ip6, dns4, dns6, dnsaddr}/{address}/{tcp, udp}/{port}".');return{family:e,host:o,transport:t,port:n}}protos(){return this.protoCodes().map(e=>Object.assign({},H(e)))}protoCodes(){let e=[],t=this.bytes,o=0;for(;o<t.length;){let n=io.default.decode(t,o),i=io.default.decode.bytes??0,s=H(n),a=eo(s,t.slice(o+i));o+=a+i,e.push(n)}return e}protoNames(){return this.protos().map(e=>e.name)}tuples(){return Dt(this,tr,"f")==null&&oo(this,tr,Nr(this.bytes),"f"),Dt(this,tr,"f")}stringTuples(){return Dt(this,rr,"f")==null&&oo(this,rr,Yn(this.tuples()),"f"),Dt(this,rr,"f")}encapsulate(e){return e=new Fe(e),new Fe(this.toString()+e.toString())}decapsulate(e){let t=e.toString(),o=this.toString(),n=o.lastIndexOf(t);if(n<0)throw new Error(`Address ${this.toString()} does not contain subaddress: ${e.toString()}`);return new Fe(o.slice(0,n))}decapsulateCode(e){let t=this.tuples();for(let o=t.length-1;o>=0;o--)if(t[o][0]===e)return new Fe(Hn(t.slice(0,o)));return this}getPeerId(){try{let t=this.stringTuples().filter(o=>o[0]===Ht.ipfs.code).pop();if(t?.[1]!=null){let o=t[1];return o[0]==="Q"||o[0]==="1"?ye(de.decode(`z${o}`),"base58btc"):ye(Z.parse(o).multihash.bytes,"base58btc")}return null}catch{return null}}getPath(){let e=null;try{e=this.stringTuples().filter(t=>H(t[0]).path===!0)[0][1],e==null&&(e=null)}catch{e=null}return e}equals(e){return Mr(this.bytes,e.bytes)}async resolve(e){let t=this.protos().find(i=>i.resolvable);if(t==null)return[this];let o=ph.get(t.name);if(o==null)throw(0,qa.default)(new Error(`no available resolver for ${t.name}`),"ERR_NO_AVAILABLE_RESOLVER");return(await o(this,e)).map(i=>new Fe(i))}nodeAddress(){let e=this.toOptions();if(e.transport!=="tcp"&&e.transport!=="udp")throw new Error(`multiaddr must have a valid format - no protocol with name: "${e.transport}". Must have a valid transport protocol: "{tcp, udp}"`);return{family:e.family,address:e.host,port:e.port}}isThinWaistAddress(e){let t=(e??this).protos();return!(t.length!==2||t[0].code!==4&&t[0].code!==41||t[1].code!==6&&t[1].code!==273)}[(er=new WeakMap,tr=new WeakMap,rr=new WeakMap,ja=Ba,hh)](){return`Multiaddr(${to(this.bytes)})`}};function ka(r){return new Fe(r)}var wo=oe(fo(),1),Sc=oe(mc(),1),Tc=oe(ht(),1),vo=oe(bo(),1),Nc=oe(Ac(),1);function Sh(){Tc.default._configure(),wo.default._configure(Sc.default),vo.default._configure(Nc.default)}Sh();var Pc=["uint64","int64","sint64","fixed64","sfixed64"];function Th(r){for(let e of Pc){if(r[e]==null)continue;let t=r[e];r[e]=function(){return BigInt(t.call(this).toString())}}return r}function xo(r){return Th(new wo.default(r))}function Nh(r){for(let e of Pc){if(r[e]==null)continue;let t=r[e];r[e]=function(o){return t.call(this,o.toString())}}return r}function Eo(){return Nh(vo.default.create())}function Ze(r,e){let t=xo(r instanceof Uint8Array?r:r.subarray());return e.decode(t)}function Ye(r,e){let t=Eo();return e.encode(r,t,{lengthDelimited:!1}),t.finish()}var Ct;(function(r){r[r.VARINT=0]="VARINT",r[r.BIT64=1]="BIT64",r[r.LENGTH_DELIMITED=2]="LENGTH_DELIMITED",r[r.START_GROUP=3]="START_GROUP",r[r.END_GROUP=4]="END_GROUP",r[r.BIT32=5]="BIT32"})(Ct||(Ct={}));function jr(r,e,t,o){return{name:r,type:e,encode:t,decode:o}}function ir(r){function e(n){if(r[n.toString()]==null)throw new Error("Invalid enum value");return r[n]}let t=function(i,s){let a=e(i);s.int32(a)},o=function(i){let s=i.int32();return e(s)};return jr("enum",Ct.VARINT,t,o)}function He(r,e){return jr("message",Ct.LENGTH_DELIMITED,r,e)}var jt;(function(r){let e;(function(n){n.RESERVE="RESERVE",n.CONNECT="CONNECT",n.STATUS="STATUS"})(e=r.Type||(r.Type={}));let t;(function(n){n[n.RESERVE=0]="RESERVE",n[n.CONNECT=1]="CONNECT",n[n.STATUS=2]="STATUS"})(t||(t={})),function(n){n.codec=()=>ir(t)}(e=r.Type||(r.Type={}));let o;r.codec=()=>(o==null&&(o=He((n,i,s={})=>{s.lengthDelimited!==!1&&i.fork(),n.type!=null&&(i.uint32(8),r.Type.codec().encode(n.type,i)),n.peer!=null&&(i.uint32(18),qt.codec().encode(n.peer,i)),n.reservation!=null&&(i.uint32(26),qr.codec().encode(n.reservation,i)),n.limit!=null&&(i.uint32(34),Bt.codec().encode(n.limit,i)),n.status!=null&&(i.uint32(40),qe.codec().encode(n.status,i)),s.lengthDelimited!==!1&&i.ldelim()},(n,i)=>{let s={},a=i==null?n.len:n.pos+i;for(;n.pos<a;){let c=n.uint32();switch(c>>>3){case 1:s.type=r.Type.codec().decode(n);break;case 2:s.peer=qt.codec().decode(n,n.uint32());break;case 3:s.reservation=qr.codec().decode(n,n.uint32());break;case 4:s.limit=Bt.codec().decode(n,n.uint32());break;case 5:s.status=qe.codec().decode(n);break;default:n.skipType(c&7);break}}return s})),o),r.encode=n=>Ye(n,r.codec()),r.decode=n=>Ze(n,r.codec())})(jt||(jt={}));var Oc;(function(r){let e;(function(n){n.CONNECT="CONNECT",n.STATUS="STATUS"})(e=r.Type||(r.Type={}));let t;(function(n){n[n.CONNECT=0]="CONNECT",n[n.STATUS=1]="STATUS"})(t||(t={})),function(n){n.codec=()=>ir(t)}(e=r.Type||(r.Type={}));let o;r.codec=()=>(o==null&&(o=He((n,i,s={})=>{s.lengthDelimited!==!1&&i.fork(),n.type!=null&&(i.uint32(8),r.Type.codec().encode(n.type,i)),n.peer!=null&&(i.uint32(18),qt.codec().encode(n.peer,i)),n.limit!=null&&(i.uint32(26),Bt.codec().encode(n.limit,i)),n.status!=null&&(i.uint32(32),qe.codec().encode(n.status,i)),s.lengthDelimited!==!1&&i.ldelim()},(n,i)=>{let s={},a=i==null?n.len:n.pos+i;for(;n.pos<a;){let c=n.uint32();switch(c>>>3){case 1:s.type=r.Type.codec().decode(n);break;case 2:s.peer=qt.codec().decode(n,n.uint32());break;case 3:s.limit=Bt.codec().decode(n,n.uint32());break;case 4:s.status=qe.codec().decode(n);break;default:n.skipType(c&7);break}}return s})),o),r.encode=n=>Ye(n,r.codec()),r.decode=n=>Ze(n,r.codec())})(Oc||(Oc={}));var qt;(function(r){let e;r.codec=()=>(e==null&&(e=He((t,o,n={})=>{if(n.lengthDelimited!==!1&&o.fork(),t.id!=null&&t.id.byteLength>0&&(o.uint32(10),o.bytes(t.id)),t.addrs!=null)for(let i of t.addrs)o.uint32(18),o.bytes(i);n.lengthDelimited!==!1&&o.ldelim()},(t,o)=>{let n={id:new Uint8Array(0),addrs:[]},i=o==null?t.len:t.pos+o;for(;t.pos<i;){let s=t.uint32();switch(s>>>3){case 1:n.id=t.bytes();break;case 2:n.addrs.push(t.bytes());break;default:t.skipType(s&7);break}}return n})),e),r.encode=t=>Ye(t,r.codec()),r.decode=t=>Ze(t,r.codec())})(qt||(qt={}));var qr;(function(r){let e;r.codec=()=>(e==null&&(e=He((t,o,n={})=>{if(n.lengthDelimited!==!1&&o.fork(),t.expire!=null&&t.expire!==0n&&(o.uint32(8),o.uint64(t.expire)),t.addrs!=null)for(let i of t.addrs)o.uint32(18),o.bytes(i);t.voucher!=null&&(o.uint32(26),o.bytes(t.voucher)),n.lengthDelimited!==!1&&o.ldelim()},(t,o)=>{let n={expire:0n,addrs:[]},i=o==null?t.len:t.pos+o;for(;t.pos<i;){let s=t.uint32();switch(s>>>3){case 1:n.expire=t.uint64();break;case 2:n.addrs.push(t.bytes());break;case 3:n.voucher=t.bytes();break;default:t.skipType(s&7);break}}return n})),e),r.encode=t=>Ye(t,r.codec()),r.decode=t=>Ze(t,r.codec())})(qr||(qr={}));var Bt;(function(r){let e;r.codec=()=>(e==null&&(e=He((t,o,n={})=>{n.lengthDelimited!==!1&&o.fork(),t.duration!=null&&(o.uint32(8),o.uint32(t.duration)),t.data!=null&&(o.uint32(16),o.uint64(t.data)),n.lengthDelimited!==!1&&o.ldelim()},(t,o)=>{let n={},i=o==null?t.len:t.pos+o;for(;t.pos<i;){let s=t.uint32();switch(s>>>3){case 1:n.duration=t.uint32();break;case 2:n.data=t.uint64();break;default:t.skipType(s&7);break}}return n})),e),r.encode=t=>Ye(t,r.codec()),r.decode=t=>Ze(t,r.codec())})(Bt||(Bt={}));var qe;(function(r){r.UNUSED="UNUSED",r.OK="OK",r.RESERVATION_REFUSED="RESERVATION_REFUSED",r.RESOURCE_LIMIT_EXCEEDED="RESOURCE_LIMIT_EXCEEDED",r.PERMISSION_DENIED="PERMISSION_DENIED",r.CONNECTION_FAILED="CONNECTION_FAILED",r.NO_RESERVATION="NO_RESERVATION",r.MALFORMED_MESSAGE="MALFORMED_MESSAGE",r.UNEXPECTED_MESSAGE="UNEXPECTED_MESSAGE"})(qe||(qe={}));var Ao;(function(r){r[r.UNUSED=0]="UNUSED",r[r.OK=100]="OK",r[r.RESERVATION_REFUSED=200]="RESERVATION_REFUSED",r[r.RESOURCE_LIMIT_EXCEEDED=201]="RESOURCE_LIMIT_EXCEEDED",r[r.PERMISSION_DENIED=202]="PERMISSION_DENIED",r[r.CONNECTION_FAILED=203]="CONNECTION_FAILED",r[r.NO_RESERVATION=204]="NO_RESERVATION",r[r.MALFORMED_MESSAGE=400]="MALFORMED_MESSAGE",r[r.UNEXPECTED_MESSAGE=401]="UNEXPECTED_MESSAGE"})(Ao||(Ao={}));(function(r){r.codec=()=>ir(Ao)})(qe||(qe={}));var Mc;(function(r){let e;r.codec=()=>(e==null&&(e=He((t,o,n={})=>{n.lengthDelimited!==!1&&o.fork(),t.relay!=null&&t.relay.byteLength>0&&(o.uint32(10),o.bytes(t.relay)),t.peer!=null&&t.peer.byteLength>0&&(o.uint32(18),o.bytes(t.peer)),t.expiration!=null&&t.expiration!==0n&&(o.uint32(24),o.uint64(t.expiration)),n.lengthDelimited!==!1&&o.ldelim()},(t,o)=>{let n={relay:new Uint8Array(0),peer:new Uint8Array(0),expiration:0n},i=o==null?t.len:t.pos+o;for(;t.pos<i;){let s=t.uint32();switch(s>>>3){case 1:n.relay=t.bytes();break;case 2:n.peer=t.bytes();break;case 3:n.expiration=t.uint64();break;default:t.skipType(s&7);break}}return n})),e),r.encode=t=>Ye(t,r.codec()),r.decode=t=>Ze(t,r.codec())})(Mc||(Mc={}));var Dc=Symbol.for("@achingbrain/uint8arraylist");function Ic(r,e){if(e==null||e<0)throw new RangeError("index is out of bounds");let t=0;for(let o of r){let n=t+o.byteLength;if(e<n)return{buf:o,index:e-t};t=n}throw new RangeError("index is out of bounds")}function Br(r){return Boolean(r?.[Dc])}var me=class{constructor(...e){Object.defineProperty(this,Dc,{value:!0}),this.bufs=[],this.length=0,e.length>0&&this.appendAll(e)}*[Symbol.iterator](){yield*this.bufs}get byteLength(){return this.length}append(...e){this.appendAll(e)}appendAll(e){let t=0;for(let o of e)if(o instanceof Uint8Array)t+=o.byteLength,this.bufs.push(o);else if(Br(o))t+=o.byteLength,this.bufs.push(...o.bufs);else throw new Error("Could not append value, must be an Uint8Array or a Uint8ArrayList");this.length+=t}prepend(...e){this.prependAll(e)}prependAll(e){let t=0;for(let o of e.reverse())if(o instanceof Uint8Array)t+=o.byteLength,this.bufs.unshift(o);else if(Br(o))t+=o.byteLength,this.bufs.unshift(...o.bufs);else throw new Error("Could not prepend value, must be an Uint8Array or a Uint8ArrayList");this.length+=t}get(e){let t=Ic(this.bufs,e);return t.buf[t.index]}set(e,t){let o=Ic(this.bufs,e);o.buf[o.index]=t}write(e,t=0){if(e instanceof Uint8Array)for(let o=0;o<e.length;o++)this.set(t+o,e[o]);else if(Br(e))for(let o=0;o<e.length;o++)this.set(t+o,e.get(o));else throw new Error("Could not write value, must be an Uint8Array or a Uint8ArrayList")}consume(e){if(e=Math.trunc(e),!(Number.isNaN(e)||e<=0)){if(e===this.byteLength){this.bufs=[],this.length=0;return}for(;this.bufs.length>0;)if(e>=this.bufs[0].byteLength)e-=this.bufs[0].byteLength,this.length-=this.bufs[0].byteLength,this.bufs.shift();else{this.bufs[0]=this.bufs[0].subarray(e),this.length-=e;break}}}slice(e,t){let{bufs:o,length:n}=this._subList(e,t);return pe(o,n)}subarray(e,t){let{bufs:o,length:n}=this._subList(e,t);return o.length===1?o[0]:pe(o,n)}sublist(e,t){let{bufs:o,length:n}=this._subList(e,t),i=new me;return i.length=n,i.bufs=o,i}_subList(e,t){if(e=e??0,t=t??this.length,e<0&&(e=this.length+e),t<0&&(t=this.length+t),e<0||t>this.length)throw new RangeError("index is out of bounds");if(e===t)return{bufs:[],length:0};if(e===0&&t===this.length)return{bufs:[...this.bufs],length:this.length};let o=[],n=0;for(let i=0;i<this.bufs.length;i++){let s=this.bufs[i],a=n,c=a+s.byteLength;if(n=c,e>=c)continue;let u=e>=a&&e<c,d=t>a&&t<=c;if(u&&d){if(e===a&&t===c){o.push(s);break}let w=e-a;o.push(s.subarray(w,w+(t-e)));break}if(u){if(e===0){o.push(s);continue}o.push(s.subarray(e-a));continue}if(d){if(t===c){o.push(s);break}o.push(s.subarray(0,t-a));break}o.push(s)}return{bufs:o,length:t-e}}indexOf(e,t=0){if(!Br(e)&&!(e instanceof Uint8Array))throw new TypeError('The "value" argument must be a Uint8ArrayList or Uint8Array');let o=e instanceof Uint8Array?e:e.subarray();if(t=Number(t??0),isNaN(t)&&(t=0),t<0&&(t=this.length+t),t<0&&(t=0),e.length===0)return t>this.length?this.length:t;let n=o.byteLength;if(n===0)throw new TypeError("search must be at least 1 byte long");let i=256,s=new Int32Array(i);for(let w=0;w<i;w++)s[w]=-1;for(let w=0;w<n;w++)s[o[w]]=w;let a=s,c=this.byteLength-o.byteLength,u=o.byteLength-1,d;for(let w=t;w<=c;w+=d){d=0;for(let B=u;B>=0;B--){let k=this.get(w+B);if(o[B]!==k){d=Math.max(1,B-a[k]);break}}if(d===0)return w}return-1}getInt8(e){let t=this.subarray(e,e+1);return new DataView(t.buffer,t.byteOffset,t.byteLength).getInt8(0)}setInt8(e,t){let o=ze(1);new DataView(o.buffer,o.byteOffset,o.byteLength).setInt8(0,t),this.write(o,e)}getInt16(e,t){let o=this.subarray(e,e+2);return new DataView(o.buffer,o.byteOffset,o.byteLength).getInt16(0,t)}setInt16(e,t,o){let n=Re(2);new DataView(n.buffer,n.byteOffset,n.byteLength).setInt16(0,t,o),this.write(n,e)}getInt32(e,t){let o=this.subarray(e,e+4);return new DataView(o.buffer,o.byteOffset,o.byteLength).getInt32(0,t)}setInt32(e,t,o){let n=Re(4);new DataView(n.buffer,n.byteOffset,n.byteLength).setInt32(0,t,o),this.write(n,e)}getBigInt64(e,t){let o=this.subarray(e,e+8);return new DataView(o.buffer,o.byteOffset,o.byteLength).getBigInt64(0,t)}setBigInt64(e,t,o){let n=Re(8);new DataView(n.buffer,n.byteOffset,n.byteLength).setBigInt64(0,t,o),this.write(n,e)}getUint8(e){let t=this.subarray(e,e+1);return new DataView(t.buffer,t.byteOffset,t.byteLength).getUint8(0)}setUint8(e,t){let o=ze(1);new DataView(o.buffer,o.byteOffset,o.byteLength).setUint8(0,t),this.write(o,e)}getUint16(e,t){let o=this.subarray(e,e+2);return new DataView(o.buffer,o.byteOffset,o.byteLength).getUint16(0,t)}setUint16(e,t,o){let n=Re(2);new DataView(n.buffer,n.byteOffset,n.byteLength).setUint16(0,t,o),this.write(n,e)}getUint32(e,t){let o=this.subarray(e,e+4);return new DataView(o.buffer,o.byteOffset,o.byteLength).getUint32(0,t)}setUint32(e,t,o){let n=Re(4);new DataView(n.buffer,n.byteOffset,n.byteLength).setUint32(0,t,o),this.write(n,e)}getBigUint64(e,t){let o=this.subarray(e,e+8);return new DataView(o.buffer,o.byteOffset,o.byteLength).getBigUint64(0,t)}setBigUint64(e,t,o){let n=Re(8);new DataView(n.buffer,n.byteOffset,n.byteLength).setBigUint64(0,t,o),this.write(n,e)}getFloat32(e,t){let o=this.subarray(e,e+4);return new DataView(o.buffer,o.byteOffset,o.byteLength).getFloat32(0,t)}setFloat32(e,t,o){let n=Re(4);new DataView(n.buffer,n.byteOffset,n.byteLength).setFloat32(0,t,o),this.write(n,e)}getFloat64(e,t){let o=this.subarray(e,e+8);return new DataView(o.buffer,o.byteOffset,o.byteLength).getFloat64(0,t)}setFloat64(e,t,o){let n=Re(8);new DataView(n.buffer,n.byteOffset,n.byteLength).setFloat64(0,t,o),this.write(n,e)}equals(e){if(e==null||!(e instanceof me)||e.bufs.length!==this.bufs.length)return!1;for(let t=0;t<this.bufs.length;t++)if(!Mr(this.bufs[t],e.bufs[t]))return!1;return!0}static fromUint8Arrays(e,t){let o=new me;return o.bufs=e,t==null&&(t=e.reduce((n,i)=>n+i.byteLength,0)),o.length=t,o}};function _c(r){let e=async function*(){let t=yield,o=new me;for await(let n of r){if(t==null){o.append(n),t=yield o,o=new me;continue}for(o.append(n);o.length>=t;){let i=o.sublist(0,t);if(o.consume(t),t=yield i,t==null){o.length>0&&(t=yield o,o=new me);break}}}if(t!=null)throw Object.assign(new Error(`stream ended before ${t} bytes became available`),{code:"ERR_UNDER_READ",buffer:o})}();return e.next(),e}function kr(r){let e=Mt(),t=_c(r.source),o=Yt(),n,i=r.sink(async function*(){yield*e,yield*await o.promise}());return i.catch(a=>{n=a}),{reader:t,writer:e,stream:{sink:async a=>n!=null?await Promise.reject(n):(o.resolve(a),await i),source:t},rest:()=>e.end(),write:e.push,read:async()=>{let a=await t.next();if(a.value!=null)return a.value}}}function Lr(r){return r instanceof Uint8Array?{get(e){return r[e]},set(e,t){r[e]=t}}:{get(e){return r.get(e)},set(e,t){r.set(e,t)}}}var Cc=4294967296,ve=class{constructor(e=0,t=0){this.hi=e,this.lo=t}toBigInt(e){if(e===!0)return BigInt(this.lo>>>0)+(BigInt(this.hi>>>0)<<32n);if(this.hi>>>31){let t=~this.lo+1>>>0,o=~this.hi>>>0;return t===0&&(o=o+1>>>0),-(BigInt(t)+(BigInt(o)<<32n))}return BigInt(this.lo>>>0)+(BigInt(this.hi>>>0)<<32n)}toNumber(e){return Number(this.toBigInt(e))}zzDecode(){let e=-(this.lo&1),t=((this.lo>>>1|this.hi<<31)^e)>>>0,o=(this.hi>>>1^e)>>>0;return new ve(o,t)}zzEncode(){let e=this.hi>>31,t=((this.hi<<1|this.lo>>>31)^e)>>>0,o=(this.lo<<1^e)>>>0;return new ve(t,o)}toBytes(e,t=0){let o=Lr(e);for(;this.hi>0;)o.set(t++,this.lo&127|128),this.lo=(this.lo>>>7|this.hi<<25)>>>0,this.hi>>>=7;for(;this.lo>127;)o.set(t++,this.lo&127|128),this.lo=this.lo>>>7;o.set(t++,this.lo)}static fromBigInt(e){if(e===0n)return new ve;let t=e<0;t&&(e=-e);let o=Number(e>>32n)|0,n=Number(e-(BigInt(o)<<32n))|0;return t&&(o=~o>>>0,n=~n>>>0,++n>Cc&&(n=0,++o>Cc&&(o=0))),new ve(o,n)}static fromNumber(e){if(e===0)return new ve;let t=e<0;t&&(e=-e);let o=e>>>0,n=(e-o)/4294967296>>>0;return t&&(n=~n>>>0,o=~o>>>0,++o>4294967295&&(o=0,++n>4294967295&&(n=0))),new ve(n,o)}static fromBytes(e,t=0){let o=Lr(e),n=new ve,i=0;if(e.length-t>4){for(;i<4;++i)if(n.lo=(n.lo|(o.get(t)&127)<<i*7)>>>0,o.get(t++)<128)return n;if(n.lo=(n.lo|(o.get(t)&127)<<28)>>>0,n.hi=(n.hi|(o.get(t)&127)>>4)>>>0,o.get(t++)<128)return n;i=0}else for(;i<4;++i){if(t>=e.length)throw RangeError(`index out of range: ${t} > ${e.length}`);if(n.lo=(n.lo|(o.get(t)&127)<<i*7)>>>0,o.get(t++)<128)return n}if(e.length-t>4){for(;i<5;++i)if(n.hi=(n.hi|(o.get(t)&127)<<i*7+3)>>>0,o.get(t++)<128)return n}else if(t<e.byteLength)for(;i<5;++i){if(t>=e.length)throw RangeError(`index out of range: ${t} > ${e.length}`);if(n.hi=(n.hi|(o.get(t)&127)<<i*7+3)>>>0,o.get(t++)<128)return n}throw RangeError("invalid varint encoding")}};var Ph=Math.pow(2,7),Oh=Math.pow(2,14),Mh=Math.pow(2,21),Ih=Math.pow(2,28),Dh=Math.pow(2,35),_h=Math.pow(2,42),Ch=Math.pow(2,49),jh=Math.pow(2,56),qh=Math.pow(2,63),pt={encodingLength(r){return r<Ph?1:r<Oh?2:r<Mh?3:r<Ih?4:r<Dh?5:r<_h?6:r<Ch?7:r<jh?8:r<qh?9:10},encode(r,e,t=0){if(Number.MAX_SAFE_INTEGER!=null&&r>Number.MAX_SAFE_INTEGER)throw new RangeError("Could not encode varint");return e==null&&(e=ze(pt.encodingLength(r))),ve.fromNumber(r).toBytes(e,t),e},decode(r,e=0){return ve.fromBytes(r,e).toNumber(!0)}};function jc(r){return globalThis?.Buffer?.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(r):new Uint8Array(r)}var Ur=r=>{let e=pt.encodingLength(r),t=jc(e);return pt.encode(r,t),Ur.bytes=e,t};Ur.bytes=0;function Rr(r){r=r??{};let e=r.lengthEncoder??Ur;return async function*(o){for await(let n of o){let i=e(n.byteLength);i instanceof Uint8Array?yield i:yield*i,n instanceof Uint8Array?yield n:yield*n}}}Rr.single=(r,e)=>{e=e??{};let t=e.lengthEncoder??Ur;return new me(t(r.byteLength),r)};var sr=oe(no(),1),Bh=8,kh=1024*1024*4,yt;(function(r){r[r.LENGTH=0]="LENGTH",r[r.DATA=1]="DATA"})(yt||(yt={}));var So=r=>{let e=pt.decode(r);return So.bytes=pt.encodingLength(e),e};So.bytes=0;function ar(r){return async function*(t){let o=new me,n=yt.LENGTH,i=-1,s=r?.lengthDecoder??So,a=r?.maxLengthLength??Bh,c=r?.maxDataLength??kh;for await(let u of t)for(o.append(u);o.byteLength>0;){if(n===yt.LENGTH)try{if(i=s(o),i<0)throw(0,sr.default)(new Error("invalid message length"),"ERR_INVALID_MSG_LENGTH");if(i>c)throw(0,sr.default)(new Error("message length too long"),"ERR_MSG_DATA_TOO_LONG");let d=s.bytes;o.consume(d),r?.onLength!=null&&r.onLength(i),n=yt.DATA}catch(d){if(d instanceof RangeError){if(o.byteLength>a)throw(0,sr.default)(new Error("message length length too long"),"ERR_MSG_LENGTH_TOO_LONG");break}throw d}if(n===yt.DATA){if(o.byteLength<i)break;let d=o.sublist(0,i);o.consume(i),r?.onData!=null&&r.onData(d),yield d,n=yt.LENGTH}}if(o.byteLength>0)throw(0,sr.default)(new Error("unexpected end of input"),"ERR_UNEXPECTED_EOF")}}ar.fromReader=(r,e)=>{let t=1,o=async function*(){for(;;)try{let{done:i,value:s}=await r.next(t);if(i===!0)return;s!=null&&(yield s)}catch(i){if(i.code==="ERR_UNDER_READ")return{done:!0,value:null};throw i}finally{t=1}}();return ar({...e??{},onLength:i=>{t=i}})(o)};function qc(r,e={}){let t=kr(r),o=ar.fromReader(t.reader,e),n={read:async i=>{let{value:s}=await t.reader.next(i);if(s==null)throw new Error("Value is null");return s},readLP:async()=>{let{value:i}=await o.next();if(i==null)throw new Error("Value is null");return i},readPB:async i=>{let s=await n.readLP();if(s==null)throw new Error("Value is null");let a=s instanceof Uint8Array?s:s.subarray();return i.decode(a)},write:i=>{i instanceof Uint8Array?t.writer.push(i):t.writer.push(i.subarray())},writeLP:i=>{n.write(Rr.single(i,e))},writePB:(i,s)=>{n.writeLP(s.encode(i))},pb:i=>({read:async()=>await n.readPB(i),write:s=>{n.writePB(s,i)}}),unwrap:()=>(t.rest(),t.stream)};return n}var Uh="/libp2p/circuit/relay/0.2.0/hop",Bc=async(r,e,t)=>{let o=await r.client.openStream(e,Uh),n=qc(o);return n.writePB({type:jt.Type.RESERVE,...t??{}},jt),await n.readPB(jt)},zr={protocol:"/echo/1.0.0",handler:async r=>{await Zt(r,async function*(e){for await(let t of e)yield t.subarray()},r)}};function To(r){let e=["go","js"];e.forEach(t=>{e.forEach(o=>{e.forEach(n=>{Rh(r,t,o,n)})})})}function Rh(r,e,t,o){describe(`${e} to ${t} over relay ${o}`,()=>{let n=[{type:e,noise:!0,noListen:!0},{type:t,noise:!0,noListen:!0},{type:o,noise:!0,relay:!0}],i,s,a,c,u,d;beforeEach(async function(){this.timeout(20*1e3),[i,s,a]=await Promise.all(n.map(async w=>await r.spawn(w))),[c,u]=await Promise.all([s,a].map(async w=>await w.client.identify())),d=ka(`${u.addrs[0].toString()}/p2p/${u.peerId.toString()}/p2p-circuit/p2p/${c.peerId.toString()}`),await s.client.connect(u.peerId,u.addrs)}),afterEach(async function(){await Promise.all([i,s,a].map(async w=>{await w.stop()}))}),it("connects",async()=>{let w=await Bc(s,u.peerId);W(w.status).to.eq(qe.OK),await i.client.connect(c.peerId,[d]),await new Promise(q=>setTimeout(q,500));let B=await i.client.listPeers();W(B.filter(q=>q.equals(c.peerId))).to.have.length(1),await s.client.registerStreamHandler(zr.protocol,zr.handler);let k=await i.client.openStream(c.peerId,zr.protocol),N=ae("test"),E=kr(k);E.write(N);let I=await E.read();W(I?.subarray()).to.deep.equal(N)}),it("fails to connect without a reservation",async()=>{await W(i.client.connect(c.peerId,[d])).to.eventually.be.rejected.with.property("message").that.matches(/NO_RESERVATION/)})})}async function zh(r){hn(r),To(r),await kn(r),await zn(r),await Wn(r)}return Yc(Fh);})();
|
|
6
|
+
Original reason: ${e.inspect(fe)}`)});let De=S.then(fe=>o[y].apply(o,[fe].concat(C)),U);return De.notify=fe=>{d(De,fe)},De}})};Le.exports.transferPromiseness=(r,e)=>{r.then=e.then.bind(e)};Le.exports.transformAsserterArgs=r=>r});var vs=O((Jd,ws)=>{"use strict";function pf(r,e){let t="__deferred__",o=e.flag,n=r.Assertion;function i(E,I){let B=o(E,t)||[];B.push(I),o(E,t,B)}function s(E){let I=o(E,t)||[],B=E,$;for(o(E,t,void 0);$=I.shift();){let Q=$.call(B);Q!==void 0&&(B=Q)}return B}function a(E,I){let B=o(E,t);B&&B.length>0&&B.splice(-1,0,function(){o(this,"message",I)})}function c(E,I){I&&n.addChainableMethod(E,function($){return $&&a(this,$),s(this)},function(){return i(this,I),this})}function u(E){let I={assertCalled:!1,assert:function(){this.assertCalled=!0}};try{E.call(I)}catch{I.assertCalled=!0}return I.assertCalled}let d=Object.getOwnPropertyNames(n.prototype).map(function(E){let I=Object.getOwnPropertyDescriptor(n.prototype,E);return I.name=E,I});d.filter(function(E){return E.name!=="assert"&&E.name!=="constructor"&&typeof E.value=="function"}).forEach(function(E){n.overwriteMethod(E.name,function(I){return function(){let B=s(this);return I.apply(B,arguments)}})}),d.filter(function(E){return Object.prototype.hasOwnProperty.call(n.prototype.__methods,E.name)}).forEach(function(E){n.overwriteChainableMethod(E.name,function(I){return function(){let B=s(this);return I.apply(B,arguments)}},function(I){return function(){return i(this,I),this}})});let w=d.filter(function(E){return E.name!=="_obj"&&typeof E.get=="function"&&!Object.prototype.hasOwnProperty.call(n.prototype.__methods,E.name)});w.filter(function(E){return!u(E.get)}).forEach(function(E){n.overwriteProperty(E.name,function(I){return function(){return i(this,I),this}})}),w.filter(function(E){return u(E.get)}).forEach(function(E){c(E.name,E.get)}),n.addMethod("ensure",function(){return s(this)});let q=e.addProperty;e.addProperty=function(E,I,B){q.apply(e,arguments),c(I,B)};let k=e.addMethod;e.addMethod=function(E,I){k.apply(e,arguments),n.overwriteMethod(I,function(B){return function(){let $=s(this);return B.apply($,arguments)}})};let N=e.addChainableMethod;e.addChainableMethod=function(E,I){let B=!0;Object.prototype.hasOwnProperty.call(n.prototype,I)&&(B=!1),N.apply(e,arguments),B&&n.overwriteChainableMethod(I,function($){return function(){let Q=s(this);return $.apply(Q,arguments)}},function($){return function(){return i(this,$),this}})}}ws.exports=pf});var xs=O((cn,un)=>{(function(){(function(r){return typeof ke=="function"&&typeof cn=="object"&&typeof un=="object"?un.exports=r:typeof define=="function"&&define.amd?define(function(){return r}):chai.use(r)})(function(r,e){var t=r.Assertion,o=t.prototype;t.addMethod("containSubset",function(i){var s=e.flag(this,"object"),a=r.config.showDiff;o.assert.call(this,n(i,s),"expected #{act} to contain subset #{exp}","expected #{act} to not contain subset #{exp}",i,s,a)}),r.assert.containSubset=function(i,s,a){new r.Assertion(i,a).to.be.containSubset(s)};function n(i,s){if(i===s)return!0;if(typeof s!=typeof i)return!1;if(typeof i!="object"||i===null)return i===s;if(i&&!s)return!1;if(Array.isArray(i)){if(typeof s.length!="number")return!1;var a=Array.prototype.slice.call(s);return i.every(function(c){return a.some(function(u){return n(c,u)})})}return i instanceof Date?s instanceof Date?i.getTime()===s.getTime():!1:Object.keys(i).every(function(c){var u=i[c],d=s[c];return typeof u=="object"&&u!==null&&d!==null?n(u,d):typeof u=="function"?u(d):d===u})}})}).call(cn)});var Ss=O((Qd,As)=>{"use strict";function Es(r,e){if(Uint8Array&&Uint8Array.prototype.every)return r.every(e);for(let t=0;t<r.length;t++)if(!e(r[t],t,r))return!1;return!0}As.exports=function(r){let e=r.Assertion;e.addMethod("equalBytes",function(t){if(typeof t=="string"){if(t.length%2!==0||!/^[0-9a-f]*$/i.test(t))throw new TypeError("Invalid hex string: "+t)}else if(t.length===void 0)throw new TypeError("equalBytes consumes string, array, or array-like object; got none of those");let o=this._obj;new e(o).to.be.a("uint8array");let n;typeof t=="string"?n=t.length===o.length*2&&Es(o,function(i,s){return i===parseInt(t.substring(2*s,2*s+2),16)}):n=t.length===o.length&&Es(o,function(i,s){return t[s]===i}),this.assert(n,"expected #{this} to equal #{exp}","expected #{this} to not equal #{exp}",t)}),r.assert.equalBytes=function(t,o,n){return new e(t,n,r.assert.equalBytes,!0).to.equalBytes(o)}}});var Ns=O((Ts,fn)=>{(function(r){typeof ke=="function"&&typeof Ts=="object"&&typeof fn=="object"?fn.exports=r:typeof define=="function"&&define.amd?define(function(){return r}):chai.use(r)})(function(r,e){r.string=r.string||{};function t(s){return typeof s=="string"}r.string.startsWith=function(s,a){return!t(s)||!t(a)?!1:s.indexOf(a)===0},r.string.endsWith=function(s,a){return!t(s)||!t(a)?!1:s.indexOf(a,s.length-a.length)!==-1},r.string.equalIgnoreCase=function(s,a){return!t(s)||!t(a)?!1:s.toLowerCase()===a.toLowerCase()},r.string.equalIgnoreSpaces=function(s,a){return!t(s)||!t(a)?!1:s.replace(/\s/g,"")===a.replace(/\s/g,"")},r.string.containIgnoreSpaces=function(s,a){return!t(s)||!t(a)?!1:s.replace(/\s/g,"").indexOf(a.replace(/\s/g,""))>-1},r.string.containIgnoreCase=function(s,a){return!t(s)||!t(a)?!1:s.toLowerCase().indexOf(a.toLowerCase())>-1},r.string.singleLine=function(s){return t(s)?s.trim().indexOf(`
|
|
7
|
+
`)===-1:!1},r.string.reverseOf=function(s,a){return!t(s)||!t(a)?!1:s.split("").reverse().join("")===a},r.string.palindrome=function(s){if(!t(s))return!1;for(var a=s.length,c=0;c<Math.floor(a/2);c++)if(s[c]!==s[a-1-c])return!1;return!0},r.string.entriesCount=function(s,a,c){var u=0;if(t(s)&&t(a))for(var d=0,w=s.length;d<w;){var q=s.indexOf(a,d);if(q===-1)break;u++,d=q+1}return u===c},r.string.indexOf=function(s,a,c){var u=!t(s)||!t(a)?-1:s.indexOf(a);return u===c};var o=function(s){var a=this._obj;return this.assert(r.string.startsWith(a,s),"expected "+this._obj+" to start with "+s,"expected "+this._obj+" not to start with "+s)};r.Assertion.addChainableMethod("startsWith",o),r.Assertion.addChainableMethod("startWith",o);var n=function(s){var a=this._obj;return this.assert(r.string.endsWith(a,s),"expected "+this._obj+" to end with "+s,"expected "+this._obj+" not to end with "+s)};r.Assertion.addChainableMethod("endsWith",n),r.Assertion.addChainableMethod("endWith",n),r.Assertion.addChainableMethod("equalIgnoreCase",function(s){var a=this._obj;return this.assert(r.string.equalIgnoreCase(a,s),"expected "+this._obj+" to equal "+s+" ignoring case","expected "+this._obj+" not to equal "+s+" ignoring case")}),r.Assertion.addChainableMethod("equalIgnoreSpaces",function(s){var a=this._obj;return this.assert(r.string.equalIgnoreSpaces(a,s),"expected "+this._obj+" to equal "+s+" ignoring spaces","expected "+this._obj+" not to equal "+s+" ignoring spaces")}),r.Assertion.addChainableMethod("containIgnoreSpaces",function(s){var a=this._obj;return this.assert(r.string.containIgnoreSpaces(a,s),"expected "+this._obj+" to contain "+s+" ignoring spaces","expected "+this._obj+" not to contain "+s+" ignoring spaces")}),r.Assertion.addChainableMethod("containIgnoreCase",function(s){var a=this._obj;return this.assert(r.string.containIgnoreCase(a,s),"expected "+this._obj+" to contain "+s+" ignoring case","expected "+this._obj+" not to contain "+s+" ignoring case")}),r.Assertion.addChainableMethod("singleLine",function(){var s=this._obj;return this.assert(r.string.singleLine(s),"expected "+this._obj+" to be a single line","expected "+this._obj+" not to be a single line")}),r.Assertion.addChainableMethod("reverseOf",function(s){var a=this._obj;return this.assert(r.string.reverseOf(a,s),"expected "+this._obj+" to be the reverse of "+s,"expected "+this._obj+" not to be the reverse of "+s)}),r.Assertion.addChainableMethod("palindrome",function(){var s=this._obj;return this.assert(r.string.palindrome(s),"expected "+this._obj+" to be a palindrome","expected "+this._obj+" not to be a palindrome")}),r.Assertion.addChainableMethod("entriesCount",function(s,a){var c=this._obj;return this.assert(r.string.entriesCount(c,s,a),"expected "+this._obj+" to have "+s+" "+a+" time(s)","expected "+this._obj+" to not have "+s+" "+a+" time(s)")}),r.Assertion.addChainableMethod("indexOf",function(s,a){var c=this._obj;return this.assert(r.string.indexOf(c,s,a),"expected "+this._obj+" to have "+s+" on index "+a,"expected "+this._obj+" to not have "+s+" on index "+a)});var i=r.assert;i.startsWith=function(s,a,c){new r.Assertion(s,c).to.startsWith(a)},i.notStartsWith=function(s,a,c){new r.Assertion(s,c).to.not.startsWith(a)},i.endsWith=function(s,a,c){new r.Assertion(s,c).to.endsWith(a)},i.notEndsWith=function(s,a,c){new r.Assertion(s,c).to.not.endsWith(a)},i.equalIgnoreCase=function(s,a,c){new r.Assertion(s,c).to.be.equalIgnoreCase(a)},i.notEqualIgnoreCase=function(s,a,c){new r.Assertion(s,c).to.not.be.equalIgnoreCase(a)},i.equalIgnoreSpaces=function(s,a,c){new r.Assertion(s,c).to.be.equalIgnoreSpaces(a)},i.notEqualIgnoreSpaces=function(s,a,c){new r.Assertion(s,c).to.not.be.equalIgnoreSpaces(a)},i.containIgnoreSpaces=function(s,a,c){new r.Assertion(s,c).to.be.containIgnoreSpaces(a)},i.notContainIgnoreSpaces=function(s,a,c){new r.Assertion(s,c).to.not.be.containIgnoreSpaces(a)},i.containIgnoreCase=function(s,a,c){new r.Assertion(s,c).to.be.containIgnoreCase(a)},i.notContainIgnoreCase=function(s,a,c){new r.Assertion(s,c).to.not.be.containIgnoreCase(a)},i.singleLine=function(s,a,c){new r.Assertion(s,c).to.be.singleLine()},i.notSingleLine=function(s,a,c){new r.Assertion(s,c).to.not.be.singleLine()},i.reverseOf=function(s,a,c){new r.Assertion(s,c).to.be.reverseOf(a)},i.notReverseOf=function(s,a,c){new r.Assertion(s,c).to.not.be.reverseOf(a)},i.palindrome=function(s,a,c){new r.Assertion(s,c).to.be.palindrome()},i.notPalindrome=function(s,a,c){new r.Assertion(s,c).to.not.be.palindrome()},i.entriesCount=function(s,a,c,u){new r.Assertion(s,u).to.have.entriesCount(a,c)},i.indexOf=function(s,a,c,u){new r.Assertion(s,u).to.have.indexOf(a,c)}})});var ta=O((cy,ea)=>{function Ne(r,e){typeof e=="boolean"&&(e={forever:e}),this._originalTimeouts=JSON.parse(JSON.stringify(r)),this._timeouts=r,this._options=e||{},this._maxRetryTime=e&&e.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._timer=null,this._options.forever&&(this._cachedTimeouts=this._timeouts.slice(0))}ea.exports=Ne;Ne.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts.slice(0)};Ne.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timer&&clearTimeout(this._timer),this._timeouts=[],this._cachedTimeouts=null};Ne.prototype.retry=function(r){if(this._timeout&&clearTimeout(this._timeout),!r)return!1;var e=new Date().getTime();if(r&&e-this._operationStart>=this._maxRetryTime)return this._errors.push(r),this._errors.unshift(new Error("RetryOperation timeout occurred")),!1;this._errors.push(r);var t=this._timeouts.shift();if(t===void 0)if(this._cachedTimeouts)this._errors.splice(0,this._errors.length-1),t=this._cachedTimeouts.slice(-1);else return!1;var o=this;return this._timer=setTimeout(function(){o._attempts++,o._operationTimeoutCb&&(o._timeout=setTimeout(function(){o._operationTimeoutCb(o._attempts)},o._operationTimeout),o._options.unref&&o._timeout.unref()),o._fn(o._attempts)},t),this._options.unref&&this._timer.unref(),!0};Ne.prototype.attempt=function(r,e){this._fn=r,e&&(e.timeout&&(this._operationTimeout=e.timeout),e.cb&&(this._operationTimeoutCb=e.cb));var t=this;this._operationTimeoutCb&&(this._timeout=setTimeout(function(){t._operationTimeoutCb()},t._operationTimeout)),this._operationStart=new Date().getTime(),this._fn(this._attempts)};Ne.prototype.try=function(r){console.log("Using RetryOperation.try() is deprecated"),this.attempt(r)};Ne.prototype.start=function(r){console.log("Using RetryOperation.start() is deprecated"),this.attempt(r)};Ne.prototype.start=Ne.prototype.try;Ne.prototype.errors=function(){return this._errors};Ne.prototype.attempts=function(){return this._attempts};Ne.prototype.mainError=function(){if(this._errors.length===0)return null;for(var r={},e=null,t=0,o=0;o<this._errors.length;o++){var n=this._errors[o],i=n.message,s=(r[i]||0)+1;r[i]=s,s>=t&&(e=n,t=s)}return e}});var ra=O(ut=>{var Ml=ta();ut.operation=function(r){var e=ut.timeouts(r);return new Ml(e,{forever:r&&(r.forever||r.retries===1/0),unref:r&&r.unref,maxRetryTime:r&&r.maxRetryTime})};ut.timeouts=function(r){if(r instanceof Array)return[].concat(r);var e={retries:10,factor:2,minTimeout:1*1e3,maxTimeout:1/0,randomize:!1};for(var t in r)e[t]=r[t];if(e.minTimeout>e.maxTimeout)throw new Error("minTimeout is greater than maxTimeout");for(var o=[],n=0;n<e.retries;n++)o.push(this.createTimeout(n,e));return r&&r.forever&&!o.length&&o.push(this.createTimeout(n,e)),o.sort(function(i,s){return i-s}),o};ut.createTimeout=function(r,e){var t=e.randomize?Math.random()+1:1,o=Math.round(t*Math.max(e.minTimeout,1)*Math.pow(e.factor,r));return o=Math.min(o,e.maxTimeout),o};ut.wrap=function(r,e,t){if(e instanceof Array&&(t=e,e=null),!t){t=[];for(var o in r)typeof r[o]=="function"&&t.push(o)}for(var n=0;n<t.length;n++){var i=t[n],s=r[i];r[i]=function(c){var u=ut.operation(e),d=Array.prototype.slice.call(arguments,1),w=d.pop();d.push(function(q){u.retry(q)||(q&&(arguments[0]=u.mainError()),w.apply(this,arguments))}),u.attempt(function(){c.apply(r,d)})}.bind(r,s),r[i].options=e}}});var oa=O((fy,na)=>{na.exports=ra()});var da=O((Sy,Fn)=>{"use strict";var jl=(r,e)=>Math.floor(Math.random()*(e-r+1)+r),fa=()=>{let r=new Error("Delay aborted");return r.name="AbortError",r},la=({clearTimeout:r,setTimeout:e,willResolve:t})=>(o,{value:n,signal:i}={})=>{if(i&&i.aborted)return Promise.reject(fa());let s,a,c,u=r||clearTimeout,d=()=>{u(s),c(fa())},w=()=>{i&&i.removeEventListener("abort",d)},q=new Promise((k,N)=>{a=()=>{w(),t?k(n):N(n)},c=N,s=(e||setTimeout)(a,o)});return i&&i.addEventListener("abort",d,{once:!0}),q.clear=()=>{u(s),s=null,a()},q},ha=r=>{let e=la({...r,willResolve:!0});return e.reject=la({...r,willResolve:!1}),e.range=(t,o,n)=>e(jl(t,o),n),e},zn=ha();zn.createWithTimers=ha;Fn.exports=zn;Fn.exports.default=zn});var Aa=O((mm,Ea)=>{Ea.exports=Qn;var xa=128,Gl=127,Kl=~Gl,Jl=Math.pow(2,31);function Qn(r,e,t){if(Number.MAX_SAFE_INTEGER&&r>Number.MAX_SAFE_INTEGER)throw Qn.bytes=0,new RangeError("Could not encode varint");e=e||[],t=t||0;for(var o=t;r>=Jl;)e[t++]=r&255|xa,r/=128;for(;r&Kl;)e[t++]=r&255|xa,r>>>=7;return e[t]=r|0,Qn.bytes=t-o+1,e}});var Na=O((gm,Ta)=>{Ta.exports=Zn;var Xl=128,Sa=127;function Zn(r,o){var t=0,o=o||0,n=0,i=o,s,a=r.length;do{if(i>=a||n>49)throw Zn.bytes=0,new RangeError("Could not decode varint");s=r[i++],t+=n<28?(s&Sa)<<n:(s&Sa)*Math.pow(2,n),n+=7}while(s>=Xl);return Zn.bytes=i-o,t}});var Oa=O((bm,Pa)=>{var Ql=Math.pow(2,7),Zl=Math.pow(2,14),Yl=Math.pow(2,21),Hl=Math.pow(2,28),eh=Math.pow(2,35),th=Math.pow(2,42),rh=Math.pow(2,49),nh=Math.pow(2,56),oh=Math.pow(2,63);Pa.exports=function(r){return r<Ql?1:r<Zl?2:r<Yl?3:r<Hl?4:r<eh?5:r<th?6:r<rh?7:r<nh?8:r<oh?9:10}});var Tr=O((wm,Ma)=>{Ma.exports={encode:Aa(),decode:Na(),encodingLength:Oa()}});var io=O((Cm,Ra)=>{"use strict";function Ua(r,e){for(let t in e)Object.defineProperty(r,t,{value:e[t],enumerable:!0,configurable:!0});return r}function wh(r,e,t){if(!r||typeof r=="string")throw new TypeError("Please pass an Error to err-code");t||(t={}),typeof e=="object"&&(t=e,e=""),e&&(t.code=e);try{return Ua(r,t)}catch{t.message=r.message,t.stack=r.stack;let n=function(){};return n.prototype=Object.create(Object.getPrototypeOf(r)),Ua(new n,t)}}Ra.exports=wh});var Ga=O((zm,Wa)=>{"use strict";Wa.exports=Sh;function Sh(r,e){for(var t=new Array(arguments.length-1),o=0,n=2,i=!0;n<arguments.length;)t[o++]=arguments[n++];return new Promise(function(a,c){t[o]=function(d){if(i)if(i=!1,d)c(d);else{for(var w=new Array(arguments.length-1),q=0;q<w.length;)w[q++]=arguments[q];a.apply(null,w)}};try{r.apply(e||null,t)}catch(u){i&&(i=!1,c(u))}})}});var Qa=O(Xa=>{"use strict";var Ir=Xa;Ir.length=function(e){var t=e.length;if(!t)return 0;for(var o=0;--t%4>1&&e.charAt(t)==="=";)++o;return Math.ceil(e.length*3)/4-o};var _t=new Array(64),Ja=new Array(123);for(Me=0;Me<64;)Ja[_t[Me]=Me<26?Me+65:Me<52?Me+71:Me<62?Me-4:Me-59|43]=Me++;var Me;Ir.encode=function(e,t,o){for(var n=null,i=[],s=0,a=0,c;t<o;){var u=e[t++];switch(a){case 0:i[s++]=_t[u>>2],c=(u&3)<<4,a=1;break;case 1:i[s++]=_t[c|u>>4],c=(u&15)<<2,a=2;break;case 2:i[s++]=_t[c|u>>6],i[s++]=_t[u&63],a=0;break}s>8191&&((n||(n=[])).push(String.fromCharCode.apply(String,i)),s=0)}return a&&(i[s++]=_t[c],i[s++]=61,a===1&&(i[s++]=61)),n?(s&&n.push(String.fromCharCode.apply(String,i.slice(0,s))),n.join("")):String.fromCharCode.apply(String,i.slice(0,s))};var Ka="invalid encoding";Ir.decode=function(e,t,o){for(var n=o,i=0,s,a=0;a<e.length;){var c=e.charCodeAt(a++);if(c===61&&i>1)break;if((c=Ja[c])===void 0)throw Error(Ka);switch(i){case 0:s=c,i=1;break;case 1:t[o++]=s<<2|(c&48)>>4,s=c,i=2;break;case 2:t[o++]=(s&15)<<4|(c&60)>>2,s=c,i=3;break;case 3:t[o++]=(s&3)<<6|c,i=0;break}}if(i===1)throw Error(Ka);return o-n};Ir.test=function(e){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e)}});var Ya=O((Vm,Za)=>{"use strict";Za.exports=Dr;function Dr(){this._listeners={}}Dr.prototype.on=function(e,t,o){return(this._listeners[e]||(this._listeners[e]=[])).push({fn:t,ctx:o||this}),this};Dr.prototype.off=function(e,t){if(e===void 0)this._listeners={};else if(t===void 0)this._listeners[e]=[];else for(var o=this._listeners[e],n=0;n<o.length;)o[n].fn===t?o.splice(n,1):++n;return this};Dr.prototype.emit=function(e){var t=this._listeners[e];if(t){for(var o=[],n=1;n<arguments.length;)o.push(arguments[n++]);for(n=0;n<t.length;)t[n].fn.apply(t[n++].ctx,o)}return this}});var ic=O(($m,oc)=>{"use strict";oc.exports=Ha(Ha);function Ha(r){return typeof Float32Array<"u"?function(){var e=new Float32Array([-0]),t=new Uint8Array(e.buffer),o=t[3]===128;function n(c,u,d){e[0]=c,u[d]=t[0],u[d+1]=t[1],u[d+2]=t[2],u[d+3]=t[3]}function i(c,u,d){e[0]=c,u[d]=t[3],u[d+1]=t[2],u[d+2]=t[1],u[d+3]=t[0]}r.writeFloatLE=o?n:i,r.writeFloatBE=o?i:n;function s(c,u){return t[0]=c[u],t[1]=c[u+1],t[2]=c[u+2],t[3]=c[u+3],e[0]}function a(c,u){return t[3]=c[u],t[2]=c[u+1],t[1]=c[u+2],t[0]=c[u+3],e[0]}r.readFloatLE=o?s:a,r.readFloatBE=o?a:s}():function(){function e(o,n,i,s){var a=n<0?1:0;if(a&&(n=-n),n===0)o(1/n>0?0:2147483648,i,s);else if(isNaN(n))o(2143289344,i,s);else if(n>34028234663852886e22)o((a<<31|2139095040)>>>0,i,s);else if(n<11754943508222875e-54)o((a<<31|Math.round(n/1401298464324817e-60))>>>0,i,s);else{var c=Math.floor(Math.log(n)/Math.LN2),u=Math.round(n*Math.pow(2,-c)*8388608)&8388607;o((a<<31|c+127<<23|u)>>>0,i,s)}}r.writeFloatLE=e.bind(null,ec),r.writeFloatBE=e.bind(null,tc);function t(o,n,i){var s=o(n,i),a=(s>>31)*2+1,c=s>>>23&255,u=s&8388607;return c===255?u?NaN:a*(1/0):c===0?a*1401298464324817e-60*u:a*Math.pow(2,c-150)*(u+8388608)}r.readFloatLE=t.bind(null,rc),r.readFloatBE=t.bind(null,nc)}(),typeof Float64Array<"u"?function(){var e=new Float64Array([-0]),t=new Uint8Array(e.buffer),o=t[7]===128;function n(c,u,d){e[0]=c,u[d]=t[0],u[d+1]=t[1],u[d+2]=t[2],u[d+3]=t[3],u[d+4]=t[4],u[d+5]=t[5],u[d+6]=t[6],u[d+7]=t[7]}function i(c,u,d){e[0]=c,u[d]=t[7],u[d+1]=t[6],u[d+2]=t[5],u[d+3]=t[4],u[d+4]=t[3],u[d+5]=t[2],u[d+6]=t[1],u[d+7]=t[0]}r.writeDoubleLE=o?n:i,r.writeDoubleBE=o?i:n;function s(c,u){return t[0]=c[u],t[1]=c[u+1],t[2]=c[u+2],t[3]=c[u+3],t[4]=c[u+4],t[5]=c[u+5],t[6]=c[u+6],t[7]=c[u+7],e[0]}function a(c,u){return t[7]=c[u],t[6]=c[u+1],t[5]=c[u+2],t[4]=c[u+3],t[3]=c[u+4],t[2]=c[u+5],t[1]=c[u+6],t[0]=c[u+7],e[0]}r.readDoubleLE=o?s:a,r.readDoubleBE=o?a:s}():function(){function e(o,n,i,s,a,c){var u=s<0?1:0;if(u&&(s=-s),s===0)o(0,a,c+n),o(1/s>0?0:2147483648,a,c+i);else if(isNaN(s))o(0,a,c+n),o(2146959360,a,c+i);else if(s>17976931348623157e292)o(0,a,c+n),o((u<<31|2146435072)>>>0,a,c+i);else{var d;if(s<22250738585072014e-324)d=s/5e-324,o(d>>>0,a,c+n),o((u<<31|d/4294967296)>>>0,a,c+i);else{var w=Math.floor(Math.log(s)/Math.LN2);w===1024&&(w=1023),d=s*Math.pow(2,-w),o(d*4503599627370496>>>0,a,c+n),o((u<<31|w+1023<<20|d*1048576&1048575)>>>0,a,c+i)}}}r.writeDoubleLE=e.bind(null,ec,0,4),r.writeDoubleBE=e.bind(null,tc,4,0);function t(o,n,i,s,a){var c=o(s,a+n),u=o(s,a+i),d=(u>>31)*2+1,w=u>>>20&2047,q=4294967296*(u&1048575)+c;return w===2047?q?NaN:d*(1/0):w===0?d*5e-324*q:d*Math.pow(2,w-1075)*(q+4503599627370496)}r.readDoubleLE=t.bind(null,rc,0,4),r.readDoubleBE=t.bind(null,nc,4,0)}(),r}function ec(r,e,t){e[t]=r&255,e[t+1]=r>>>8&255,e[t+2]=r>>>16&255,e[t+3]=r>>>24}function tc(r,e,t){e[t]=r>>>24,e[t+1]=r>>>16&255,e[t+2]=r>>>8&255,e[t+3]=r&255}function rc(r,e){return(r[e]|r[e+1]<<8|r[e+2]<<16|r[e+3]<<24)>>>0}function nc(r,e){return(r[e]<<24|r[e+1]<<16|r[e+2]<<8|r[e+3])>>>0}});var sc=O((exports,module)=>{"use strict";module.exports=inquire;function inquire(moduleName){try{var mod=eval("quire".replace(/^/,"re"))(moduleName);if(mod&&(mod.length||Object.keys(mod).length))return mod}catch(r){}return null}});var cc=O(ac=>{"use strict";var co=ac;co.length=function(e){for(var t=0,o=0,n=0;n<e.length;++n)o=e.charCodeAt(n),o<128?t+=1:o<2048?t+=2:(o&64512)===55296&&(e.charCodeAt(n+1)&64512)===56320?(++n,t+=4):t+=3;return t};co.read=function(e,t,o){var n=o-t;if(n<1)return"";for(var i=null,s=[],a=0,c;t<o;)c=e[t++],c<128?s[a++]=c:c>191&&c<224?s[a++]=(c&31)<<6|e[t++]&63:c>239&&c<365?(c=((c&7)<<18|(e[t++]&63)<<12|(e[t++]&63)<<6|e[t++]&63)-65536,s[a++]=55296+(c>>10),s[a++]=56320+(c&1023)):s[a++]=(c&15)<<12|(e[t++]&63)<<6|e[t++]&63,a>8191&&((i||(i=[])).push(String.fromCharCode.apply(String,s)),a=0);return i?(a&&i.push(String.fromCharCode.apply(String,s.slice(0,a))),i.join("")):String.fromCharCode.apply(String,s.slice(0,a))};co.write=function(e,t,o){for(var n=o,i,s,a=0;a<e.length;++a)i=e.charCodeAt(a),i<128?t[o++]=i:i<2048?(t[o++]=i>>6|192,t[o++]=i&63|128):(i&64512)===55296&&((s=e.charCodeAt(a+1))&64512)===56320?(i=65536+((i&1023)<<10)+(s&1023),++a,t[o++]=i>>18|240,t[o++]=i>>12&63|128,t[o++]=i>>6&63|128,t[o++]=i&63|128):(t[o++]=i>>12|224,t[o++]=i>>6&63|128,t[o++]=i&63|128);return o-n}});var fc=O((Gm,uc)=>{"use strict";uc.exports=Th;function Th(r,e,t){var o=t||8192,n=o>>>1,i=null,s=o;return function(c){if(c<1||c>n)return r(c);s+c>o&&(i=r(o),s=0);var u=e.call(i,s,s+=c);return s&7&&(s=(s|7)+1),u}}});var hc=O((Km,lc)=>{"use strict";lc.exports=se;var rr=ht();function se(r,e){this.lo=r>>>0,this.hi=e>>>0}var lt=se.zero=new se(0,0);lt.toNumber=function(){return 0};lt.zzEncode=lt.zzDecode=function(){return this};lt.length=function(){return 1};var Nh=se.zeroHash="\0\0\0\0\0\0\0\0";se.fromNumber=function(e){if(e===0)return lt;var t=e<0;t&&(e=-e);var o=e>>>0,n=(e-o)/4294967296>>>0;return t&&(n=~n>>>0,o=~o>>>0,++o>4294967295&&(o=0,++n>4294967295&&(n=0))),new se(o,n)};se.from=function(e){if(typeof e=="number")return se.fromNumber(e);if(rr.isString(e))if(rr.Long)e=rr.Long.fromString(e);else return se.fromNumber(parseInt(e,10));return e.low||e.high?new se(e.low>>>0,e.high>>>0):lt};se.prototype.toNumber=function(e){if(!e&&this.hi>>>31){var t=~this.lo+1>>>0,o=~this.hi>>>0;return t||(o=o+1>>>0),-(t+o*4294967296)}return this.lo+this.hi*4294967296};se.prototype.toLong=function(e){return rr.Long?new rr.Long(this.lo|0,this.hi|0,Boolean(e)):{low:this.lo|0,high:this.hi|0,unsigned:Boolean(e)}};var Xe=String.prototype.charCodeAt;se.fromHash=function(e){return e===Nh?lt:new se((Xe.call(e,0)|Xe.call(e,1)<<8|Xe.call(e,2)<<16|Xe.call(e,3)<<24)>>>0,(Xe.call(e,4)|Xe.call(e,5)<<8|Xe.call(e,6)<<16|Xe.call(e,7)<<24)>>>0)};se.prototype.toHash=function(){return String.fromCharCode(this.lo&255,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,this.hi&255,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)};se.prototype.zzEncode=function(){var e=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^e)>>>0,this.lo=(this.lo<<1^e)>>>0,this};se.prototype.zzDecode=function(){var e=-(this.lo&1);return this.lo=((this.lo>>>1|this.hi<<31)^e)>>>0,this.hi=(this.hi>>>1^e)>>>0,this};se.prototype.length=function(){var e=this.lo,t=(this.lo>>>28|this.hi<<4)>>>0,o=this.hi>>>24;return o===0?t===0?e<16384?e<128?1:2:e<2097152?3:4:t<16384?t<128?5:6:t<2097152?7:8:o<128?9:10}});var ht=O(uo=>{"use strict";var _=uo;_.asPromise=Ga();_.base64=Qa();_.EventEmitter=Ya();_.float=ic();_.inquire=sc();_.utf8=cc();_.pool=fc();_.LongBits=hc();_.isNode=Boolean(typeof globalThis<"u"&&globalThis&&globalThis.process&&globalThis.process.versions&&globalThis.process.versions.node);_.global=_.isNode&&globalThis||typeof window<"u"&&window||typeof self<"u"&&self||uo;_.emptyArray=Object.freeze?Object.freeze([]):[];_.emptyObject=Object.freeze?Object.freeze({}):{};_.isInteger=Number.isInteger||function(e){return typeof e=="number"&&isFinite(e)&&Math.floor(e)===e};_.isString=function(e){return typeof e=="string"||e instanceof String};_.isObject=function(e){return e&&typeof e=="object"};_.isset=_.isSet=function(e,t){var o=e[t];return o!=null&&e.hasOwnProperty(t)?typeof o!="object"||(Array.isArray(o)?o.length:Object.keys(o).length)>0:!1};_.Buffer=function(){try{var r=_.inquire("buffer").Buffer;return r.prototype.utf8Write?r:null}catch{return null}}();_._Buffer_from=null;_._Buffer_allocUnsafe=null;_.newBuffer=function(e){return typeof e=="number"?_.Buffer?_._Buffer_allocUnsafe(e):new _.Array(e):_.Buffer?_._Buffer_from(e):typeof Uint8Array>"u"?e:new Uint8Array(e)};_.Array=typeof Uint8Array<"u"?Uint8Array:Array;_.Long=_.global.dcodeIO&&_.global.dcodeIO.Long||_.global.Long||_.inquire("long");_.key2Re=/^true|false|0|1$/;_.key32Re=/^-?(?:0|[1-9][0-9]*)$/;_.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/;_.longToHash=function(e){return e?_.LongBits.from(e).toHash():_.LongBits.zeroHash};_.longFromHash=function(e,t){var o=_.LongBits.fromHash(e);return _.Long?_.Long.fromBits(o.lo,o.hi,t):o.toNumber(Boolean(t))};function dc(r,e,t){for(var o=Object.keys(e),n=0;n<o.length;++n)(r[o[n]]===void 0||!t)&&(r[o[n]]=e[o[n]]);return r}_.merge=dc;_.lcFirst=function(e){return e.charAt(0).toLowerCase()+e.substring(1)};function pc(r){function e(t,o){if(!(this instanceof e))return new e(t,o);Object.defineProperty(this,"message",{get:function(){return t}}),Error.captureStackTrace?Error.captureStackTrace(this,e):Object.defineProperty(this,"stack",{value:new Error().stack||""}),o&&dc(this,o)}return e.prototype=Object.create(Error.prototype,{constructor:{value:e,writable:!0,enumerable:!1,configurable:!0},name:{get:function(){return r},set:void 0,enumerable:!1,configurable:!0},toString:{value:function(){return this.name+": "+this.message},writable:!0,enumerable:!1,configurable:!0}}),e}_.newError=pc;_.ProtocolError=pc("ProtocolError");_.oneOfGetter=function(e){for(var t={},o=0;o<e.length;++o)t[e[o]]=1;return function(){for(var n=Object.keys(this),i=n.length-1;i>-1;--i)if(t[n[i]]===1&&this[n[i]]!==void 0&&this[n[i]]!==null)return n[i]}};_.oneOfSetter=function(e){return function(t){for(var o=0;o<e.length;++o)e[o]!==t&&delete this[e[o]]}};_.toJSONOptions={longs:String,enums:String,bytes:String,json:!0};_._configure=function(){var r=_.Buffer;if(!r){_._Buffer_from=_._Buffer_allocUnsafe=null;return}_._Buffer_from=r.from!==Uint8Array.from&&r.from||function(t,o){return new r(t,o)},_._Buffer_allocUnsafe=r.allocUnsafe||function(t){return new r(t)}}});var ho=O((Xm,wc)=>{"use strict";wc.exports=ne;var Ce=ht(),lo,gc=Ce.LongBits,Ph=Ce.utf8;function Ie(r,e){return RangeError("index out of range: "+r.pos+" + "+(e||1)+" > "+r.len)}function ne(r){this.buf=r,this.pos=0,this.len=r.length}var yc=typeof Uint8Array<"u"?function(e){if(e instanceof Uint8Array||Array.isArray(e))return new ne(e);throw Error("illegal buffer")}:function(e){if(Array.isArray(e))return new ne(e);throw Error("illegal buffer")},bc=function(){return Ce.Buffer?function(t){return(ne.create=function(n){return Ce.Buffer.isBuffer(n)?new lo(n):yc(n)})(t)}:yc};ne.create=bc();ne.prototype._slice=Ce.Array.prototype.subarray||Ce.Array.prototype.slice;ne.prototype.uint32=function(){var e=4294967295;return function(){if(e=(this.buf[this.pos]&127)>>>0,this.buf[this.pos++]<128||(e=(e|(this.buf[this.pos]&127)<<7)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&127)<<14)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&127)<<21)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&15)<<28)>>>0,this.buf[this.pos++]<128))return e;if((this.pos+=5)>this.len)throw this.pos=this.len,Ie(this,10);return e}}();ne.prototype.int32=function(){return this.uint32()|0};ne.prototype.sint32=function(){var e=this.uint32();return e>>>1^-(e&1)|0};function fo(){var r=new gc(0,0),e=0;if(this.len-this.pos>4){for(;e<4;++e)if(r.lo=(r.lo|(this.buf[this.pos]&127)<<e*7)>>>0,this.buf[this.pos++]<128)return r;if(r.lo=(r.lo|(this.buf[this.pos]&127)<<28)>>>0,r.hi=(r.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return r;e=0}else{for(;e<3;++e){if(this.pos>=this.len)throw Ie(this);if(r.lo=(r.lo|(this.buf[this.pos]&127)<<e*7)>>>0,this.buf[this.pos++]<128)return r}return r.lo=(r.lo|(this.buf[this.pos++]&127)<<e*7)>>>0,r}if(this.len-this.pos>4){for(;e<5;++e)if(r.hi=(r.hi|(this.buf[this.pos]&127)<<e*7+3)>>>0,this.buf[this.pos++]<128)return r}else for(;e<5;++e){if(this.pos>=this.len)throw Ie(this);if(r.hi=(r.hi|(this.buf[this.pos]&127)<<e*7+3)>>>0,this.buf[this.pos++]<128)return r}throw Error("invalid varint encoding")}ne.prototype.bool=function(){return this.uint32()!==0};function _r(r,e){return(r[e-4]|r[e-3]<<8|r[e-2]<<16|r[e-1]<<24)>>>0}ne.prototype.fixed32=function(){if(this.pos+4>this.len)throw Ie(this,4);return _r(this.buf,this.pos+=4)};ne.prototype.sfixed32=function(){if(this.pos+4>this.len)throw Ie(this,4);return _r(this.buf,this.pos+=4)|0};function mc(){if(this.pos+8>this.len)throw Ie(this,8);return new gc(_r(this.buf,this.pos+=4),_r(this.buf,this.pos+=4))}ne.prototype.float=function(){if(this.pos+4>this.len)throw Ie(this,4);var e=Ce.float.readFloatLE(this.buf,this.pos);return this.pos+=4,e};ne.prototype.double=function(){if(this.pos+8>this.len)throw Ie(this,4);var e=Ce.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,e};ne.prototype.bytes=function(){var e=this.uint32(),t=this.pos,o=this.pos+e;if(o>this.len)throw Ie(this,e);return this.pos+=e,Array.isArray(this.buf)?this.buf.slice(t,o):t===o?new this.buf.constructor(0):this._slice.call(this.buf,t,o)};ne.prototype.string=function(){var e=this.bytes();return Ph.read(e,0,e.length)};ne.prototype.skip=function(e){if(typeof e=="number"){if(this.pos+e>this.len)throw Ie(this,e);this.pos+=e}else do if(this.pos>=this.len)throw Ie(this);while(this.buf[this.pos++]&128);return this};ne.prototype.skipType=function(r){switch(r){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(r=this.uint32()&7)!==4;)this.skipType(r);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+r+" at offset "+this.pos)}return this};ne._configure=function(r){lo=r,ne.create=bc(),lo._configure();var e=Ce.Long?"toLong":"toNumber";Ce.merge(ne.prototype,{int64:function(){return fo.call(this)[e](!1)},uint64:function(){return fo.call(this)[e](!0)},sint64:function(){return fo.call(this).zzDecode()[e](!1)},fixed64:function(){return mc.call(this)[e](!0)},sfixed64:function(){return mc.call(this)[e](!1)}})}});var Ac=O((Qm,Ec)=>{"use strict";Ec.exports=dt;var xc=ho();(dt.prototype=Object.create(xc.prototype)).constructor=dt;var vc=ht();function dt(r){xc.call(this,r)}dt._configure=function(){vc.Buffer&&(dt.prototype._slice=vc.Buffer.prototype.slice)};dt.prototype.string=function(){var e=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+e,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+e,this.len))};dt._configure()});var vo=O((Zm,Pc)=>{"use strict";Pc.exports=V;var Pe=ht(),po,Cr=Pe.LongBits,Sc=Pe.base64,Tc=Pe.utf8;function nr(r,e,t){this.fn=r,this.len=e,this.next=void 0,this.val=t}function mo(){}function Oh(r){this.head=r.head,this.tail=r.tail,this.len=r.len,this.next=r.states}function V(){this.len=0,this.head=new nr(mo,0,0),this.tail=this.head,this.states=null}var Nc=function(){return Pe.Buffer?function(){return(V.create=function(){return new po})()}:function(){return new V}};V.create=Nc();V.alloc=function(e){return new Pe.Array(e)};Pe.Array!==Array&&(V.alloc=Pe.pool(V.alloc,Pe.Array.prototype.subarray));V.prototype._push=function(e,t,o){return this.tail=this.tail.next=new nr(e,t,o),this.len+=t,this};function go(r,e,t){e[t]=r&255}function Mh(r,e,t){for(;r>127;)e[t++]=r&127|128,r>>>=7;e[t]=r}function bo(r,e){this.len=r,this.next=void 0,this.val=e}bo.prototype=Object.create(nr.prototype);bo.prototype.fn=Mh;V.prototype.uint32=function(e){return this.len+=(this.tail=this.tail.next=new bo((e=e>>>0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this};V.prototype.int32=function(e){return e<0?this._push(wo,10,Cr.fromNumber(e)):this.uint32(e)};V.prototype.sint32=function(e){return this.uint32((e<<1^e>>31)>>>0)};function wo(r,e,t){for(;r.hi;)e[t++]=r.lo&127|128,r.lo=(r.lo>>>7|r.hi<<25)>>>0,r.hi>>>=7;for(;r.lo>127;)e[t++]=r.lo&127|128,r.lo=r.lo>>>7;e[t++]=r.lo}V.prototype.uint64=function(e){var t=Cr.from(e);return this._push(wo,t.length(),t)};V.prototype.int64=V.prototype.uint64;V.prototype.sint64=function(e){var t=Cr.from(e).zzEncode();return this._push(wo,t.length(),t)};V.prototype.bool=function(e){return this._push(go,1,e?1:0)};function yo(r,e,t){e[t]=r&255,e[t+1]=r>>>8&255,e[t+2]=r>>>16&255,e[t+3]=r>>>24}V.prototype.fixed32=function(e){return this._push(yo,4,e>>>0)};V.prototype.sfixed32=V.prototype.fixed32;V.prototype.fixed64=function(e){var t=Cr.from(e);return this._push(yo,4,t.lo)._push(yo,4,t.hi)};V.prototype.sfixed64=V.prototype.fixed64;V.prototype.float=function(e){return this._push(Pe.float.writeFloatLE,4,e)};V.prototype.double=function(e){return this._push(Pe.float.writeDoubleLE,8,e)};var Ih=Pe.Array.prototype.set?function(e,t,o){t.set(e,o)}:function(e,t,o){for(var n=0;n<e.length;++n)t[o+n]=e[n]};V.prototype.bytes=function(e){var t=e.length>>>0;if(!t)return this._push(go,1,0);if(Pe.isString(e)){var o=V.alloc(t=Sc.length(e));Sc.decode(e,o,0),e=o}return this.uint32(t)._push(Ih,t,e)};V.prototype.string=function(e){var t=Tc.length(e);return t?this.uint32(t)._push(Tc.write,t,e):this._push(go,1,0)};V.prototype.fork=function(){return this.states=new Oh(this),this.head=this.tail=new nr(mo,0,0),this.len=0,this};V.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new nr(mo,0,0),this.len=0),this};V.prototype.ldelim=function(){var e=this.head,t=this.tail,o=this.len;return this.reset().uint32(o),o&&(this.tail.next=e.next,this.tail=t,this.len+=o),this};V.prototype.finish=function(){for(var e=this.head.next,t=this.constructor.alloc(this.len),o=0;e;)e.fn(e.val,t,o),o+=e.len,e=e.next;return t};V._configure=function(r){po=r,V.create=Nc(),po._configure()}});var Ic=O((Ym,Mc)=>{"use strict";Mc.exports=je;var Oc=vo();(je.prototype=Object.create(Oc.prototype)).constructor=je;var Qe=ht();function je(){Oc.call(this)}je._configure=function(){je.alloc=Qe._Buffer_allocUnsafe,je.writeBytesBuffer=Qe.Buffer&&Qe.Buffer.prototype instanceof Uint8Array&&Qe.Buffer.prototype.set.name==="set"?function(e,t,o){t.set(e,o)}:function(e,t,o){if(e.copy)e.copy(t,o,0,e.length);else for(var n=0;n<e.length;)t[o++]=e[n++]}};je.prototype.bytes=function(e){Qe.isString(e)&&(e=Qe._Buffer_from(e,"base64"));var t=e.length>>>0;return this.uint32(t),t&&this._push(je.writeBytesBuffer,t,e),this};function Dh(r,e,t){r.length<40?Qe.utf8.write(r,e,t):e.utf8Write?e.utf8Write(r,t):e.write(r,t)}je.prototype.string=function(e){var t=Qe.Buffer.byteLength(e);return this.uint32(t),t&&this._push(Dh,t,e),this};je._configure()});var Qh={};be(Qh,{connectInteropTests:()=>hn,dhtInteropTests:()=>kn,interopTests:()=>Xh,pubsubInteropTests:()=>Vn,relayInteropTests:()=>Po,streamInteropTests:()=>Kn});var Se=oe(gs(),1),Bd=Se.default.expect,kd=Se.default.version,Ld=Se.default.Assertion,Ud=Se.default.AssertionError,Rd=Se.default.util,zd=Se.default.config,Fd=Se.default.use,Vd=Se.default.should,$d=Se.default.assert,Wd=Se.default.core,We=Se.default;var Ps=oe(bs(),1),Os=oe(vs(),1),Ms=oe(xs(),1),Is=oe(Ss(),1),Ds=oe(Ns(),1);We.use(Ps.default);We.use(Os.default);We.use(Ms.default);We.use(Is.default);We.use(Ds.default);var W=We.expect,Hd=We.assert;var Ge=oe(ke("path"),1),_s=ke("url"),gf={},xt=Ge.default.dirname((0,_s.fileURLToPath)(gf.url)),yf={ed25519:Ge.default.join(xt,"go.ed25519.key"),rsa:Ge.default.join(xt,"go.rsa.key"),secp256k1:Ge.default.join(xt,"go.secp256k1.key")},mf={ed25519:Ge.default.join(xt,"js.ed25519.key"),rsa:Ge.default.join(xt,"js.rsa.key"),secp256k1:Ge.default.join(xt,"js.secp256k1.key")},ln={go:yf,js:mf};function hn(r){let e=["ed25519","rsa","secp256k1"],t=["js","go"];for(let o of e)for(let n of t)for(let i of t)bf(`noise/${o}`,r,{type:n,noise:!0,key:ln.go[o]},{type:i,noise:!0,key:ln.js[o]})}function bf(r,e,t,o){describe(`connect using ${r}`,()=>{let n;before(async function(){this.timeout(20*1e3),n=await Promise.all([e.spawn(t),e.spawn(o)])}),after(async function(){n!=null&&await Promise.all(n.map(async i=>{await i.stop()}))}),it(`${t.type} peer to ${o.type} peer`,async function(){this.timeout(10*1e3);let i=await n[0].client.identify(),s=await n[1].client.identify(),a=await n[0].client.listPeers();W(a).to.have.lengthOf(0);let c=await n[1].client.listPeers();W(c).to.have.lengthOf(0),await n[0].client.connect(s.peerId,s.addrs),await new Promise(w=>setTimeout(w,1e3));let u=await n[0].client.listPeers();W(u).to.have.length.greaterThanOrEqual(1),W(u[0].toString()).to.equal(s.peerId.toString());let d=await n[1].client.listPeers();W(d).to.have.length.greaterThanOrEqual(1),W(d[0].toString()).to.equal(i.peerId.toString())})})}var gn={};be(gn,{identity:()=>Sf});function wf(r,e){if(r.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),o=0;o<t.length;o++)t[o]=255;for(var n=0;n<r.length;n++){var i=r.charAt(n),s=i.charCodeAt(0);if(t[s]!==255)throw new TypeError(i+" is ambiguous");t[s]=n}var a=r.length,c=r.charAt(0),u=Math.log(a)/Math.log(256),d=Math.log(256)/Math.log(a);function w(N){if(N instanceof Uint8Array||(ArrayBuffer.isView(N)?N=new Uint8Array(N.buffer,N.byteOffset,N.byteLength):Array.isArray(N)&&(N=Uint8Array.from(N))),!(N instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(N.length===0)return"";for(var E=0,I=0,B=0,$=N.length;B!==$&&N[B]===0;)B++,E++;for(var Q=($-B)*d+1>>>0,te=new Uint8Array(Q);B!==$;){for(var y=N[B],S=0,C=Q-1;(y!==0||S<I)&&C!==-1;C--,S++)y+=256*te[C]>>>0,te[C]=y%a>>>0,y=y/a>>>0;if(y!==0)throw new Error("Non-zero carry");I=S,B++}for(var U=Q-I;U!==Q&&te[U]===0;)U++;for(var re=c.repeat(E);U<Q;++U)re+=r.charAt(te[U]);return re}function q(N){if(typeof N!="string")throw new TypeError("Expected String");if(N.length===0)return new Uint8Array;var E=0;if(N[E]!==" "){for(var I=0,B=0;N[E]===c;)I++,E++;for(var $=(N.length-E)*u+1>>>0,Q=new Uint8Array($);N[E];){var te=t[N.charCodeAt(E)];if(te===255)return;for(var y=0,S=$-1;(te!==0||y<B)&&S!==-1;S--,y++)te+=a*Q[S]>>>0,Q[S]=te%256>>>0,te=te/256>>>0;if(te!==0)throw new Error("Non-zero carry");B=y,E++}if(N[E]!==" "){for(var C=$-B;C!==$&&Q[C]===0;)C++;for(var U=new Uint8Array(I+($-C)),re=I;C!==$;)U[re++]=Q[C++];return U}}}function k(N){var E=q(N);if(E)return E;throw new Error(`Non-${e} character`)}return{encode:w,decodeUnsafe:q,decode:k}}var vf=wf,xf=vf,Cs=xf;var sp=new Uint8Array(0);var js=(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},Te=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")};var qs=r=>new TextEncoder().encode(r),Bs=r=>new TextDecoder().decode(r);var dn=class{constructor(e,t,o){this.name=e,this.prefix=t,this.baseEncode=o}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},pn=class{constructor(e,t,o){if(this.name=e,this.prefix=t,t.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=t.codePointAt(0),this.baseDecode=o}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 Ls(this,e)}},yn=class{constructor(e){this.decoders=e}or(e){return Ls(this,e)}decode(e){let t=e[0],o=this.decoders[t];if(o)return o.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}},Ls=(r,e)=>new yn({...r.decoders||{[r.prefix]:r},...e.decoders||{[e.prefix]:e}}),mn=class{constructor(e,t,o,n){this.name=e,this.prefix=t,this.baseEncode=o,this.baseDecode=n,this.encoder=new dn(e,t,o),this.decoder=new pn(e,t,n)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}},Et=({name:r,prefix:e,encode:t,decode:o})=>new mn(r,e,t,o),Ke=({prefix:r,name:e,alphabet:t})=>{let{encode:o,decode:n}=Cs(t,e);return Et({prefix:r,name:e,encode:o,decode:i=>Te(n(i))})},Ef=(r,e,t,o)=>{let n={};for(let d=0;d<e.length;++d)n[e[d]]=d;let i=r.length;for(;r[i-1]==="=";)--i;let s=new Uint8Array(i*t/8|0),a=0,c=0,u=0;for(let d=0;d<i;++d){let w=n[r[d]];if(w===void 0)throw new SyntaxError(`Non-${o} character`);c=c<<t|w,a+=t,a>=8&&(a-=8,s[u++]=255&c>>a)}if(a>=t||255&c<<8-a)throw new SyntaxError("Unexpected end of data");return s},Af=(r,e,t)=>{let o=e[e.length-1]==="=",n=(1<<t)-1,i="",s=0,a=0;for(let c=0;c<r.length;++c)for(a=a<<8|r[c],s+=8;s>t;)s-=t,i+=e[n&a>>s];if(s&&(i+=e[n&a<<t-s]),o)for(;i.length*t&7;)i+="=";return i},ee=({name:r,prefix:e,bitsPerChar:t,alphabet:o})=>Et({prefix:e,name:r,encode(n){return Af(n,o,t)},decode(n){return Ef(n,o,t,r)}});var Sf=Et({prefix:"\0",name:"identity",encode:r=>Bs(r),decode:r=>qs(r)});var bn={};be(bn,{base2:()=>Tf});var Tf=ee({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var wn={};be(wn,{base8:()=>Nf});var Nf=ee({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var vn={};be(vn,{base10:()=>Pf});var Pf=Ke({prefix:"9",name:"base10",alphabet:"0123456789"});var xn={};be(xn,{base16:()=>Of,base16upper:()=>Mf});var Of=ee({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),Mf=ee({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var En={};be(En,{base32:()=>Ue,base32hex:()=>Cf,base32hexpad:()=>qf,base32hexpadupper:()=>Bf,base32hexupper:()=>jf,base32pad:()=>Df,base32padupper:()=>_f,base32upper:()=>If,base32z:()=>kf});var Ue=ee({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),If=ee({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),Df=ee({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),_f=ee({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),Cf=ee({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),jf=ee({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),qf=ee({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),Bf=ee({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),kf=ee({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var An={};be(An,{base36:()=>Lf,base36upper:()=>Uf});var Lf=Ke({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),Uf=Ke({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var Sn={};be(Sn,{base58btc:()=>de,base58flickr:()=>Rf});var de=Ke({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),Rf=Ke({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var Tn={};be(Tn,{base64:()=>zf,base64pad:()=>Ff,base64url:()=>Vf,base64urlpad:()=>$f});var zf=ee({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),Ff=ee({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Vf=ee({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),$f=ee({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var Nn={};be(Nn,{base256emoji:()=>Xf});var Us=Array.from("\u{1F680}\u{1FA90}\u2604\u{1F6F0}\u{1F30C}\u{1F311}\u{1F312}\u{1F313}\u{1F314}\u{1F315}\u{1F316}\u{1F317}\u{1F318}\u{1F30D}\u{1F30F}\u{1F30E}\u{1F409}\u2600\u{1F4BB}\u{1F5A5}\u{1F4BE}\u{1F4BF}\u{1F602}\u2764\u{1F60D}\u{1F923}\u{1F60A}\u{1F64F}\u{1F495}\u{1F62D}\u{1F618}\u{1F44D}\u{1F605}\u{1F44F}\u{1F601}\u{1F525}\u{1F970}\u{1F494}\u{1F496}\u{1F499}\u{1F622}\u{1F914}\u{1F606}\u{1F644}\u{1F4AA}\u{1F609}\u263A\u{1F44C}\u{1F917}\u{1F49C}\u{1F614}\u{1F60E}\u{1F607}\u{1F339}\u{1F926}\u{1F389}\u{1F49E}\u270C\u2728\u{1F937}\u{1F631}\u{1F60C}\u{1F338}\u{1F64C}\u{1F60B}\u{1F497}\u{1F49A}\u{1F60F}\u{1F49B}\u{1F642}\u{1F493}\u{1F929}\u{1F604}\u{1F600}\u{1F5A4}\u{1F603}\u{1F4AF}\u{1F648}\u{1F447}\u{1F3B6}\u{1F612}\u{1F92D}\u2763\u{1F61C}\u{1F48B}\u{1F440}\u{1F62A}\u{1F611}\u{1F4A5}\u{1F64B}\u{1F61E}\u{1F629}\u{1F621}\u{1F92A}\u{1F44A}\u{1F973}\u{1F625}\u{1F924}\u{1F449}\u{1F483}\u{1F633}\u270B\u{1F61A}\u{1F61D}\u{1F634}\u{1F31F}\u{1F62C}\u{1F643}\u{1F340}\u{1F337}\u{1F63B}\u{1F613}\u2B50\u2705\u{1F97A}\u{1F308}\u{1F608}\u{1F918}\u{1F4A6}\u2714\u{1F623}\u{1F3C3}\u{1F490}\u2639\u{1F38A}\u{1F498}\u{1F620}\u261D\u{1F615}\u{1F33A}\u{1F382}\u{1F33B}\u{1F610}\u{1F595}\u{1F49D}\u{1F64A}\u{1F639}\u{1F5E3}\u{1F4AB}\u{1F480}\u{1F451}\u{1F3B5}\u{1F91E}\u{1F61B}\u{1F534}\u{1F624}\u{1F33C}\u{1F62B}\u26BD\u{1F919}\u2615\u{1F3C6}\u{1F92B}\u{1F448}\u{1F62E}\u{1F646}\u{1F37B}\u{1F343}\u{1F436}\u{1F481}\u{1F632}\u{1F33F}\u{1F9E1}\u{1F381}\u26A1\u{1F31E}\u{1F388}\u274C\u270A\u{1F44B}\u{1F630}\u{1F928}\u{1F636}\u{1F91D}\u{1F6B6}\u{1F4B0}\u{1F353}\u{1F4A2}\u{1F91F}\u{1F641}\u{1F6A8}\u{1F4A8}\u{1F92C}\u2708\u{1F380}\u{1F37A}\u{1F913}\u{1F619}\u{1F49F}\u{1F331}\u{1F616}\u{1F476}\u{1F974}\u25B6\u27A1\u2753\u{1F48E}\u{1F4B8}\u2B07\u{1F628}\u{1F31A}\u{1F98B}\u{1F637}\u{1F57A}\u26A0\u{1F645}\u{1F61F}\u{1F635}\u{1F44E}\u{1F932}\u{1F920}\u{1F927}\u{1F4CC}\u{1F535}\u{1F485}\u{1F9D0}\u{1F43E}\u{1F352}\u{1F617}\u{1F911}\u{1F30A}\u{1F92F}\u{1F437}\u260E\u{1F4A7}\u{1F62F}\u{1F486}\u{1F446}\u{1F3A4}\u{1F647}\u{1F351}\u2744\u{1F334}\u{1F4A3}\u{1F438}\u{1F48C}\u{1F4CD}\u{1F940}\u{1F922}\u{1F445}\u{1F4A1}\u{1F4A9}\u{1F450}\u{1F4F8}\u{1F47B}\u{1F910}\u{1F92E}\u{1F3BC}\u{1F975}\u{1F6A9}\u{1F34E}\u{1F34A}\u{1F47C}\u{1F48D}\u{1F4E3}\u{1F942}"),Wf=Us.reduce((r,e,t)=>(r[t]=e,r),[]),Gf=Us.reduce((r,e,t)=>(r[e.codePointAt(0)]=t,r),[]);function Kf(r){return r.reduce((e,t)=>(e+=Wf[t],e),"")}function Jf(r){let e=[];for(let t of r){let o=Gf[t.codePointAt(0)];if(o===void 0)throw new Error(`Non-base256emoji character: ${t}`);e.push(o)}return new Uint8Array(e)}var Xf=Et({prefix:"\u{1F680}",name:"base256emoji",encode:Kf,decode:Jf});var Dn={};be(Dn,{sha256:()=>pl,sha512:()=>yl});var In=oe(ke("crypto"),1);var Qf=Fs,Rs=128,Zf=127,Yf=~Zf,Hf=Math.pow(2,31);function Fs(r,e,t){e=e||[],t=t||0;for(var o=t;r>=Hf;)e[t++]=r&255|Rs,r/=128;for(;r&Yf;)e[t++]=r&255|Rs,r>>>=7;return e[t]=r|0,Fs.bytes=t-o+1,e}var el=Pn,tl=128,zs=127;function Pn(r,o){var t=0,o=o||0,n=0,i=o,s,a=r.length;do{if(i>=a)throw Pn.bytes=0,new RangeError("Could not decode varint");s=r[i++],t+=n<28?(s&zs)<<n:(s&zs)*Math.pow(2,n),n+=7}while(s>=tl);return Pn.bytes=i-o,t}var rl=Math.pow(2,7),nl=Math.pow(2,14),ol=Math.pow(2,21),il=Math.pow(2,28),sl=Math.pow(2,35),al=Math.pow(2,42),cl=Math.pow(2,49),ul=Math.pow(2,56),fl=Math.pow(2,63),ll=function(r){return r<rl?1:r<nl?2:r<ol?3:r<il?4:r<sl?5:r<al?6:r<cl?7:r<ul?8:r<fl?9:10},hl={encode:Qf,decode:el,encodingLength:ll},dl=hl,Wt=dl;var Gt=(r,e=0)=>[Wt.decode(r,e),Wt.decode.bytes],At=(r,e,t=0)=>(Wt.encode(r,e,t),e),St=r=>Wt.encodingLength(r);var at=(r,e)=>{let t=e.byteLength,o=St(r),n=o+St(t),i=new Uint8Array(n+t);return At(r,i,0),At(t,i,o),i.set(e,n),new Tt(r,t,e,i)},br=r=>{let e=Te(r),[t,o]=Gt(e),[n,i]=Gt(e.subarray(o)),s=e.subarray(o+i);if(s.byteLength!==n)throw new Error("Incorrect length");return new Tt(t,n,s,e)},Vs=(r,e)=>{if(r===e)return!0;{let t=e;return r.code===t.code&&r.size===t.size&&t.bytes instanceof Uint8Array&&js(r.bytes,t.bytes)}},Tt=class{constructor(e,t,o,n){this.code=e,this.size=t,this.digest=o,this.bytes=n}};var Mn=({name:r,code:e,encode:t})=>new On(r,e,t),On=class{constructor(e,t,o){this.name=e,this.code=t,this.encode=o}digest(e){if(e instanceof Uint8Array){let t=this.encode(e);return t instanceof Uint8Array?at(this.code,t):t.then(o=>at(this.code,o))}else throw Error("Unknown type, must be binary type")}};var pl=Mn({name:"sha2-256",code:18,encode:r=>Te(In.default.createHash("sha256").update(r).digest())}),yl=Mn({name:"sha2-512",code:19,encode:r=>Te(In.default.createHash("sha512").update(r).digest())});var _n={};be(_n,{identity:()=>bl});var Ws=0,ml="identity",Gs=Te,gl=r=>at(Ws,Gs(r)),bl={code:Ws,name:ml,encode:Gs,digest:gl};var Op=new TextEncoder,Mp=new TextDecoder;var Ks=(r,e)=>{let{bytes:t,version:o}=r;switch(o){case 0:return El(t,Cn(r),e||de.encoder);default:return Al(t,Cn(r),e||Ue.encoder)}};var Js=new WeakMap,Cn=r=>{let e=Js.get(r);if(e==null){let t=new Map;return Js.set(r,t),t}return e},Z=class{constructor(e,t,o,n){this.code=t,this.version=e,this.multihash=o,this.bytes=n,this["/"]=n}get asCID(){return this}get byteOffset(){return this.bytes.byteOffset}get byteLength(){return this.bytes.byteLength}toV0(){switch(this.version){case 0:return this;case 1:{let{code:e,multihash:t}=this;if(e!==Kt)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(t.code!==Sl)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return Z.createV0(t)}default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}toV1(){switch(this.version){case 0:{let{code:e,digest:t}=this.multihash,o=at(e,t);return Z.createV1(this.code,o)}case 1:return this;default:throw Error(`Can not convert CID version ${this.version} to version 1. This is a bug please report`)}}equals(e){return Z.equals(this,e)}static equals(e,t){let o=t;return o&&e.code===o.code&&e.version===o.version&&Vs(e.multihash,o.multihash)}toString(e){return Ks(this,e)}toJSON(){return{"/":Ks(this)}}link(){return this}get[Symbol.toStringTag](){return"CID"}[Symbol.for("nodejs.util.inspect.custom")](){return`CID(${this.toString()})`}static asCID(e){if(e==null)return null;let t=e;if(t instanceof Z)return t;if(t["/"]!=null&&t["/"]===t.bytes||t.asCID===t){let{version:o,code:n,multihash:i,bytes:s}=t;return new Z(o,n,i,s||Xs(o,n,i.bytes))}else if(t[Tl]===!0){let{version:o,multihash:n,code:i}=t,s=br(n);return Z.create(o,i,s)}else return null}static create(e,t,o){if(typeof t!="number")throw new Error("String codecs are no longer supported");if(!(o.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(e){case 0:{if(t!==Kt)throw new Error(`Version 0 CID must use dag-pb (code: ${Kt}) block encoding`);return new Z(e,t,o,o.bytes)}case 1:{let n=Xs(e,t,o.bytes);return new Z(e,t,o,n)}default:throw new Error("Invalid version")}}static createV0(e){return Z.create(0,Kt,e)}static createV1(e,t){return Z.create(1,e,t)}static decode(e){let[t,o]=Z.decodeFirst(e);if(o.length)throw new Error("Incorrect length");return t}static decodeFirst(e){let t=Z.inspectBytes(e),o=t.size-t.multihashSize,n=Te(e.subarray(o,o+t.multihashSize));if(n.byteLength!==t.multihashSize)throw new Error("Incorrect length");let i=n.subarray(t.multihashSize-t.digestSize),s=new Tt(t.multihashCode,t.digestSize,i,n);return[t.version===0?Z.createV0(s):Z.createV1(t.codec,s),e.subarray(t.size)]}static inspectBytes(e){let t=0,o=()=>{let[w,q]=Gt(e.subarray(t));return t+=q,w},n=o(),i=Kt;if(n===18?(n=0,t=0):i=o(),n!==0&&n!==1)throw new RangeError(`Invalid CID version ${n}`);let s=t,a=o(),c=o(),u=t+c,d=u-s;return{version:n,codec:i,multihashCode:a,digestSize:c,multihashSize:d,size:u}}static parse(e,t){let[o,n]=xl(e,t),i=Z.decode(n);if(i.version===0&&e[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return Cn(i).set(o,e),i}},xl=(r,e)=>{switch(r[0]){case"Q":{let t=e||de;return[de.prefix,t.decode(`${de.prefix}${r}`)]}case de.prefix:{let t=e||de;return[de.prefix,t.decode(r)]}case Ue.prefix:{let t=e||Ue;return[Ue.prefix,t.decode(r)]}default:{if(e==null)throw Error("To parse non base32 or base58btc encoded CID multibase decoder must be provided");return[r[0],e.decode(r)]}}},El=(r,e,t)=>{let{prefix:o}=t;if(o!==de.prefix)throw Error(`Cannot string encode V0 in ${t.name} encoding`);let n=e.get(o);if(n==null){let i=t.encode(r).slice(1);return e.set(o,i),i}else return n},Al=(r,e,t)=>{let{prefix:o}=t,n=e.get(o);if(n==null){let i=t.encode(r);return e.set(o,i),i}else return n},Kt=112,Sl=18,Xs=(r,e,t)=>{let o=St(r),n=o+St(e),i=new Uint8Array(n+t.byteLength);return At(r,i,0),At(e,i,o),i.set(t,n),i},Tl=Symbol.for("@ipld/js-cid/CID");var Jt={...gn,...bn,...wn,...vn,...xn,...En,...An,...Sn,...Tn,...Nn},Up={...Dn,..._n};function ct(r){return globalThis.Buffer!=null?new Uint8Array(r.buffer,r.byteOffset,r.byteLength):r}function Re(r=0){return globalThis.Buffer?.alloc!=null?ct(globalThis.Buffer.alloc(r)):new Uint8Array(r)}function ze(r=0){return globalThis.Buffer?.allocUnsafe!=null?ct(globalThis.Buffer.allocUnsafe(r)):new Uint8Array(r)}function Zs(r,e,t,o){return{name:r,prefix:e,encoder:{name:r,prefix:e,encode:t},decoder:{decode:o}}}var Qs=Zs("utf8","u",r=>"u"+new TextDecoder("utf8").decode(r),r=>new TextEncoder().encode(r.substring(1))),jn=Zs("ascii","a",r=>{let e="a";for(let t=0;t<r.length;t++)e+=String.fromCharCode(r[t]);return e},r=>{r=r.substring(1);let e=ze(r.length);for(let t=0;t<r.length;t++)e[t]=r.charCodeAt(t);return e}),Nl={utf8:Qs,"utf-8":Qs,hex:Jt.base16,latin1:jn,ascii:jn,binary:jn,...Jt},wr=Nl;function ae(r,e="utf8"){let t=wr[e];if(t==null)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?ct(globalThis.Buffer.from(r,"utf-8")):t.decoder.decode(`${t.prefix}${r}`)}function pe(r,e){e==null&&(e=r.reduce((n,i)=>n+i.length,0));let t=ze(e),o=0;for(let n of r)t.set(n,o),o+=n.length;return ct(t)}var vr={key:pe([ae("/pk/"),ae("muft89xjpybos8eas1vaq2xrbsx2vkll7is4ocy7pia5fsjlt3c2","base36")]),value:ae("080012a60230820122300d06092a864886f70d01010105000382010f003082010a0282010100c2588f998971dac9e3eef76a311bf9159505aff69ea3b664c55a36aa28ee08de1127228a4d431bb9c0840240c75f6e98a0843a78d945491a3ea5e1f7cee2bc71383510db5290702383975b7bffae9fb40c84cc1220fb4a7db862fffb0de42f8fd8fb33a17deb20f30e2d0f194791fe69355a392f77df35f101e08a2fc95b2c018768938814fcb52482f899f5e90a1905e8abbcdbb1647ad80a5b0417e1ce8320d64197a6ba3848926375c63adebabdf6eb82109bcadfee13b62bf922bbb6f74c1a26c9bc6122d1436787e0e6de3c152b1959701092abef84599f73eaedb2fcef9f87293e1bbe8e0fef3f1a7fd2e8b94c7e633f88473644a63cb948e4d25c54490203010001","hex")};function Ys(r){let e=["js","go"];for(let t of e)for(let o of e)Pl(r,{type:t,dht:!0},{type:o,dht:!0})}function Pl(r,e,t){describe("dht.contentFetching",()=>{let o;before(async function(){this.timeout(20*1e3),o=await Promise.all([r.spawn(e),r.spawn(t)]);let n=await o[0].client.identify();await o[1].client.connect(n.peerId,n.addrs),await new Promise(i=>setTimeout(i,1e3))}),after(async function(){o!=null&&await Promise.all(o.map(async n=>{await n.stop()}))}),it(`${e.type} peer to ${t.type} peer`,async function(){this.timeout(10*1e3),await o[0].client.dht.put(vr.key,vr.value);let n=await o[1].client.dht.get(vr.key);W(n).to.equalBytes(vr.value)})})}async function Xt(r){let e=[];for await(let t of r)e.push(t);return e}function Hs(r){let e=["js","go"];for(let t of e)for(let o of e)t==="go"&&o==="go"||Ol(r,{type:t,dht:!0},{type:o,dht:!0})}function Ol(r,e,t){describe("dht.contentRouting",()=>{let o,n;before(async function(){this.timeout(20*1e3),o=await Promise.all([r.spawn(e),r.spawn(t),r.spawn(t)]),n=await Promise.all(o.map(async i=>await i.client.identify())),await o[0].client.connect(n[1].peerId,n[1].addrs),await o[0].client.connect(n[2].peerId,n[2].addrs),await new Promise(i=>setTimeout(i,1e3))}),after(async function(){o!=null&&await Promise.all(o.map(async i=>{await i.stop()}))}),it(`${e.type} peer to ${t.type} peer`,async function(){let i=Z.parse("QmVzw6MPsF96TyXBSRs1ptLoVMWRv5FCYJZZGJSVB2Hp39");await o[0].client.dht.provide(i);let s=await Xt(o[1].client.dht.findProviders(i,1));W(s).to.exist(),W(s.length).to.be.greaterThan(0)})})}var sa=oe(oa(),1),Il=new Set(["Failed to fetch","NetworkError when attempting to fetch resource.","The Internet connection appears to be offline.","Network request failed","fetch failed"]),qn=class extends Error{constructor(e){super(),e instanceof Error?(this.originalError=e,{message:e}=e):(this.originalError=new Error(e),this.originalError.stack=this.stack),this.name="AbortError",this.message=e}},Dl=(r,e,t)=>{let o=t.retries-(e-1);return r.attemptNumber=e,r.retriesLeft=o,r},_l=r=>Il.has(r),ia=r=>globalThis.DOMException===void 0?new Error(r):new DOMException(r);async function Bn(r,e){return new Promise((t,o)=>{e={onFailedAttempt(){},retries:10,...e};let n=sa.default.operation(e);n.attempt(async i=>{try{t(await r(i))}catch(s){if(!(s instanceof Error)){o(new TypeError(`Non-error was thrown: "${s}". You should only throw errors.`));return}if(s instanceof qn)n.stop(),o(s.originalError);else if(s instanceof TypeError&&!_l(s.message))n.stop(),o(s);else{Dl(s,i,e);try{await e.onFailedAttempt(s)}catch(a){o(a);return}n.retry(s)||o(n.mainError())}}}),e.signal&&!e.signal.aborted&&e.signal.addEventListener("abort",()=>{n.stop();let i=e.signal.reason===void 0?ia("The operation was aborted."):e.signal.reason;o(i instanceof Error?i:ia(i))},{once:!0})})}function aa(r){let e=["js","go"];for(let t of e)for(let o of e)Cl(r,{type:t,dht:!0},{type:o,dht:!0})}function Cl(r,e,t){describe("dht.peerRouting",()=>{let o;before(async function(){this.timeout(20*1e3),o=await Promise.all([r.spawn(e),r.spawn(t),r.spawn(t)])}),after(async function(){o!=null&&await Promise.all(o.map(async n=>{await n.stop()}))}),it(`${e.type} peer to ${t.type} peer`,async function(){let n=await o[1].client.identify(),i=await o[2].client.identify();await o[0].client.connect(n.peerId,n.addrs),await o[0].client.connect(i.peerId,i.addrs);let s=await Bn(async()=>await o[1].client.dht.findPeer(i.peerId),{retries:10});W(i.addrs.map(a=>a.toString())).to.include.deep.members(s.multiaddrs.map(a=>a.toString()))})})}async function kn(r){Ys(r),Hs(r),aa(r)}async function ft(r){for await(let e of r)return e}var xr=class extends Error{constructor(e){super(e),this.name="TimeoutError"}},Ln=class extends Error{constructor(e){super(),this.name="AbortError",this.message=e}},ca=r=>globalThis.DOMException===void 0?new Ln(r):new DOMException(r),ua=r=>{let e=r.reason===void 0?ca("This operation was aborted."):r.reason;return e instanceof Error?e:ca(e)};function Un(r,e){let{milliseconds:t,fallback:o,message:n,customTimers:i={setTimeout,clearTimeout}}=e,s,a=new Promise((c,u)=>{if(typeof t!="number"||Math.sign(t)!==1)throw new TypeError(`Expected \`milliseconds\` to be a positive number, got \`${t}\``);if(t===Number.POSITIVE_INFINITY){c(r);return}if(e.signal){let{signal:w}=e;w.aborted&&u(ua(w)),w.addEventListener("abort",()=>{u(ua(w))})}let d=new xr;s=i.setTimeout.call(void 0,()=>{if(o){try{c(o())}catch(w){u(w)}return}typeof r.cancel=="function"&&r.cancel(),n===!1?c():n instanceof Error?u(n):(d.message=n??`Promise timed out after ${t} milliseconds`,u(d))},t),(async()=>{try{c(await r)}catch(w){u(w)}finally{i.clearTimeout.call(void 0,s)}})()});return a.clear=()=>{i.clearTimeout.call(void 0,s),s=void 0},a}var Rn=Symbol("resolveValue");async function Er(r,e={}){let{interval:t=20,timeout:o=Number.POSITIVE_INFINITY,before:n=!0}=e,i,s=new Promise((a,c)=>{let u=async()=>{try{let d=await r();if(typeof d=="object"&&d[Rn])a(d[Rn]);else{if(typeof d!="boolean")throw new TypeError("Expected condition to return a boolean");d===!0?a():i=setTimeout(u,t)}}catch(d){c(d)}};n?u():i=setTimeout(u,t)});if(o===Number.POSITIVE_INFINITY)return s;try{return await Un(s,typeof o=="number"?{milliseconds:o}:o)}finally{clearTimeout(i)}}Er.resolveWith=r=>({[Rn]:r});var pa=oe(da(),1);async function Pt(r,e,t){let o=await t.client.identify();await Er(async()=>(await e.client.pubsub.getSubscribers(r)).map(i=>i.toString()).includes(o.peerId.toString()),{interval:500}),await(0,pa.default)(2e3)}function ya(r){let e=["js","go"];for(let t of e)for(let o of e)ql(r,{type:t,pubsub:!0,pubsubRouter:"floodsub"},{type:o,pubsub:!0,pubsubRouter:"floodsub"})}function ql(r,e,t){describe("pubsub.floodSub",()=>{let o;before(async function(){this.timeout(20*1e3),o=await Promise.all([r.spawn(e),r.spawn(t)]);let[n,i]=o,s=await i.client.identify();await n.client.connect(s.peerId,s.addrs)}),after(async function(){o!=null&&await Promise.all(o.map(async n=>{await n.stop()}))}),it(`${e.type} peer to ${t.type} peer`,async function(){let n="test-topic",i=ae("test-data"),[s,a]=o,c=await a.client.pubsub.subscribe(n),u=async()=>{let w=await ft(c.messages());W(w).to.exist(),W(w).to.have.property("data").that.equalBytes(i)},d=async()=>{await Pt(n,s,a),await s.client.pubsub.publish(n,i)};return await Promise.all([u(),d()])})})}function ma(r){let e=["js","go"];for(let t of e)for(let o of e)Bl(r,{type:t,pubsub:!0,pubsubRouter:"gossipsub"},{type:o,pubsub:!0,pubsubRouter:"gossipsub"})}function Bl(r,e,t){describe("pubsub.gossipsub",()=>{let o;before(async function(){this.timeout(20*1e3),o=await Promise.all([r.spawn(e),r.spawn(t)]);let[n,i]=o,s=await i.client.identify();await n.client.connect(s.peerId,s.addrs)}),after(async function(){o!=null&&await Promise.all(o.map(async n=>{await n.stop()}))}),it(`${e.type} peer to ${t.type} peer`,async function(){let n="test-topic",i=ae("test-data"),[s,a]=o,c=await a.client.pubsub.subscribe(n),u=async()=>{let w=await ft(c.messages());W(w).to.exist(),W(w).to.have.property("data").that.equalBytes(i)},d=async()=>{await Pt(n,s,a),await s.client.pubsub.publish(n,i)};return await Promise.all([u(),d()])})})}function ga(r){let e=["js","go"];for(let t of e)for(let o of e)kl(r,{type:t,pubsub:!0,pubsubRouter:"floodsub"},{type:o,pubsub:!0,pubsubRouter:"gossipsub"})}function kl(r,e,t){describe("pubsub.hybrid",()=>{let o;before(async function(){this.timeout(20*1e3),o=await Promise.all([r.spawn(e),r.spawn(t)]);let[n,i]=o,s=await i.client.identify();await n.client.connect(s.peerId,s.addrs)}),after(async function(){o!=null&&await Promise.all(o.map(async n=>{await n.stop()}))}),it(`${e.type} peer to ${t.type} peer`,async function(){let n="test-topic",i=ae("test-data"),[s,a]=o,c=await a.client.pubsub.subscribe(n),u=async()=>{let w=await ft(c.messages());W(w).to.exist(),W(w).to.have.property("data").that.equalBytes(i)},d=async()=>{await Pt(n,s,a),await s.client.pubsub.publish(n,i)};return await Promise.all([u(),d()])})})}async function Vn(r){ya(r),ma(r),ga(r)}var Ar=class{constructor(e){if(!(e>0)||e-1&e)throw new Error("Max size for a FixedFIFO should be a power of two");this.buffer=new Array(e),this.mask=e-1,this.top=0,this.btm=0,this.next=null}push(e){return this.buffer[this.top]!==void 0?!1:(this.buffer[this.top]=e,this.top=this.top+1&this.mask,!0)}shift(){let e=this.buffer[this.btm];if(e!==void 0)return this.buffer[this.btm]=void 0,this.btm=this.btm+1&this.mask,e}isEmpty(){return this.buffer[this.btm]===void 0}},Ot=class{constructor(e={}){this.hwm=e.splitLimit??16,this.head=new Ar(this.hwm),this.tail=this.head,this.size=0}calculateSize(e){return e?.byteLength!=null?e.byteLength:1}push(e){if(e?.value!=null&&(this.size+=this.calculateSize(e.value)),!this.head.push(e)){let t=this.head;this.head=t.next=new Ar(2*this.head.buffer.length),this.head.push(e)}}shift(){let e=this.tail.shift();if(e===void 0&&this.tail.next!=null){let t=this.tail.next;this.tail.next=null,this.tail=t,e=this.tail.shift()}return e?.value!=null&&(this.size-=this.calculateSize(e.value)),e}isEmpty(){return this.head.isEmpty()}};function Mt(r={}){return Ll(t=>{let o=t.shift();if(o==null)return{done:!0};if(o.error!=null)throw o.error;return{done:o.done===!0,value:o.value}},r)}function Ll(r,e){e=e??{};let t=e.onEnd,o=new Ot,n,i,s,a=async()=>o.isEmpty()?s?{done:!0}:await new Promise((E,I)=>{i=B=>{i=null,o.push(B);try{E(r(o))}catch($){I($)}return n}}):r(o),c=E=>i!=null?i(E):(o.push(E),n),u=E=>(o=new Ot,i!=null?i({error:E}):(o.push({error:E}),n)),d=E=>{if(s)return n;if(e?.objectMode!==!0&&E?.byteLength==null)throw new Error("objectMode was not true but tried to push non-Uint8Array value");return c({done:!1,value:E})},w=E=>s?n:(s=!0,E!=null?u(E):c({done:!0})),q=()=>(o=new Ot,w(),{done:!0}),k=E=>(w(E),{done:!0});if(n={[Symbol.asyncIterator](){return this},next:a,return:q,throw:k,push:d,end:w,get readableLength(){return o.size}},t==null)return n;let N=n;return n={[Symbol.asyncIterator](){return this},next(){return N.next()},throw(E){return N.throw(E),t!=null&&(t(E),t=void 0),{done:!0}},return(){return N.return(),t!=null&&(t(),t=void 0),{done:!0}},push:d,end(E){return N.end(E),t!=null&&(t(E),t=void 0),n},get readableLength(){return N.readableLength}},n}async function*$n(...r){let e=Mt({objectMode:!0});Promise.resolve().then(async()=>{try{await Promise.all(r.map(async t=>{for await(let o of t)e.push(o)})),e.end()}catch(t){e.end(t)}}),yield*e}var Ul=(...r)=>{let e;for(;r.length>0;)e=r.shift()(e);return e},ba=r=>r!=null&&(typeof r[Symbol.asyncIterator]=="function"||typeof r[Symbol.iterator]=="function"||typeof r.next=="function"),Wn=r=>r!=null&&typeof r.sink=="function"&&ba(r.source),Rl=r=>e=>{let t=r.sink(e);if(t.then!=null){let o=Mt({objectMode:!0});return t.then(()=>{o.end()},i=>{o.end(i)}),$n(o,async function*(){yield*r.source,o.end()}())}return r.source};function Qt(r,...e){if(Wn(r)){let o=r;r=()=>o.source}else if(ba(r)){let o=r;r=()=>o}let t=[r,...e];if(t.length>1&&Wn(t[t.length-1])&&(t[t.length-1]=t[t.length-1].sink),t.length>2)for(let o=1;o<t.length-1;o++)Wn(t[o])&&(t[o]=Rl(t[o]));return Ul(...t)}function Zt(){let r={};return r.promise=new Promise((e,t)=>{r.resolve=e,r.reject=t}),r}function Gn(r,e){let t=["js","go"];for(let o of t)for(let n of t)zl(r,e,{type:o,muxer:e},{type:n,muxer:e})}function zl(r,e,t,o){describe(`echo streams - ${e}`,()=>{let n;before(async function(){this.timeout(20*1e3),n=await Promise.all([r.spawn(t),r.spawn(o)]);let i=await n[0].client.identify();await n[1].client.connect(i.peerId,i.addrs),await new Promise(s=>setTimeout(s,1e3))}),after(async function(){n!=null&&await Promise.all(n.map(async i=>{await i.stop()}))}),it(`${t.type} sender to ${o.type} listener`,async function(){this.timeout(10*1e3);let i=await n[1].client.identify(),s="/echo/1.0.0",a=[ae("hello world")];await n[1].client.registerStreamHandler(s,async w=>{await Qt(w,async function*(q){for await(let k of q)yield k.subarray()},w)});let c=await n[0].client.openStream(i.peerId,s),u=Zt(),d=await Qt(a,async function*(w){yield*w,await u.promise},c,async function*(w){for await(let q of w)yield q.subarray(),u.resolve()},async w=>await Xt(w));W(d).to.deep.equal(a)})})}async function Kn(r){Gn(r,"mplex"),Gn(r,"yamux")}var Je=ke("node:net");function Sr(r){return Boolean((0,Je.isIP)(r))}function ye(r,e="utf8"){let t=wr[e];if(t==null)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(r.buffer,r.byteOffset,r.byteLength).toString("utf8"):t.encoder.encode(r).substring(1)}var wa=Je.isIPv4,Fl=Je.isIPv6,Jn=function(r){let e=0;if(r=r.toString().trim(),wa(r)){let t=new Uint8Array(e+4);return r.split(/\./g).forEach(o=>{t[e++]=parseInt(o,10)&255}),t}if(Fl(r)){let t=r.split(":",8),o;for(o=0;o<t.length;o++){let i=wa(t[o]),s;i&&(s=Jn(t[o]),t[o]=ye(s.slice(0,2),"base16")),s!=null&&++o<8&&t.splice(o,0,ye(s.slice(2,4),"base16"))}if(t[0]==="")for(;t.length<8;)t.unshift("0");else if(t[t.length-1]==="")for(;t.length<8;)t.push("0");else if(t.length<8){for(o=0;o<t.length&&t[o]!=="";o++);let i=[o,1];for(o=9-t.length;o>0;o--)i.push("0");t.splice.apply(t,i)}let n=new Uint8Array(e+16);for(o=0;o<t.length;o++){let i=parseInt(t[o],16);n[e++]=i>>8&255,n[e++]=i&255}return n}throw new Error("invalid ip address")},va=function(r,e=0,t){e=~~e,t=t??r.length-e;let o=new DataView(r.buffer);if(t===4){let n=[];for(let i=0;i<t;i++)n.push(r[e+i]);return n.join(".")}if(t===16){let n=[];for(let i=0;i<t;i+=2)n.push(o.getUint16(e+i).toString(16));return n.join(":").replace(/(^|:)0(:0)*:0(:|$)/,"$1::$3").replace(/:{3,4}/,"::")}return""};var Yt={},Xn={},$l=[[4,32,"ip4"],[6,16,"tcp"],[33,16,"dccp"],[41,128,"ip6"],[42,-1,"ip6zone"],[43,8,"ipcidr"],[53,-1,"dns",!0],[54,-1,"dns4",!0],[55,-1,"dns6",!0],[56,-1,"dnsaddr",!0],[132,16,"sctp"],[273,16,"udp"],[275,0,"p2p-webrtc-star"],[276,0,"p2p-webrtc-direct"],[277,0,"p2p-stardust"],[280,0,"webrtc"],[290,0,"p2p-circuit"],[301,0,"udt"],[302,0,"utp"],[400,-1,"unix",!1,!0],[421,-1,"ipfs"],[421,-1,"p2p"],[443,0,"https"],[444,96,"onion"],[445,296,"onion3"],[446,-1,"garlic64"],[448,0,"tls"],[460,0,"quic"],[461,0,"quic-v1"],[465,0,"webtransport"],[466,-1,"certhash"],[477,0,"ws"],[478,0,"wss"],[479,0,"p2p-websocket-star"],[480,0,"http"],[777,-1,"memory"]];$l.forEach(r=>{let e=Wl(...r);Xn[e.code]=e,Yt[e.name]=e});function Wl(r,e,t,o,n){return{code:r,size:e,name:t,resolvable:Boolean(o),path:Boolean(n)}}function H(r){if(typeof r=="number"){if(Xn[r]!=null)return Xn[r];throw new Error(`no protocol with code: ${r}`)}else if(typeof r=="string"){if(Yt[r]!=null)return Yt[r];throw new Error(`no protocol with name: ${r}`)}throw new Error(`invalid protocol id type: ${typeof r}`)}var _e=oe(Tr(),1);function ja(r,e){switch(H(r).code){case 4:case 41:return sh(e);case 42:return _a(e);case 6:case 273:case 33:case 132:return Ba(e).toString();case 53:case 54:case 55:case 56:case 400:case 777:return _a(e);case 421:return fh(e);case 444:return Ca(e);case 445:return Ca(e);case 466:return uh(e);default:return ye(e,"base16")}}function qa(r,e){switch(H(r).code){case 4:return Ia(e);case 41:return Ia(e);case 42:return Da(e);case 6:case 273:case 33:case 132:return Hn(parseInt(e,10));case 53:case 54:case 55:case 56:case 400:case 777:return Da(e);case 421:return ah(e);case 444:return lh(e);case 445:return hh(e);case 466:return ch(e);default:return ae(e,"base16")}}var Yn=Object.values(Jt).map(r=>r.decoder),ih=function(){let r=Yn[0].or(Yn[1]);return Yn.slice(2).forEach(e=>r=r.or(e)),r}();function Ia(r){if(!Sr(r))throw new Error("invalid ip address");return Jn(r)}function sh(r){let e=va(r,0,r.length);if(e==null)throw new Error("ipBuff is required");if(!Sr(e))throw new Error("invalid ip address");return e}function Hn(r){let e=new ArrayBuffer(2);return new DataView(e).setUint16(0,r),new Uint8Array(e)}function Ba(r){return new DataView(r.buffer).getUint16(r.byteOffset)}function Da(r){let e=ae(r),t=Uint8Array.from(_e.default.encode(e.length));return pe([t,e],t.length+e.length)}function _a(r){let e=_e.default.decode(r);if(r=r.slice(_e.default.decode.bytes),r.length!==e)throw new Error("inconsistent lengths");return ye(r)}function ah(r){let e;r[0]==="Q"||r[0]==="1"?e=br(de.decode(`z${r}`)).bytes:e=Z.parse(r).multihash.bytes;let t=Uint8Array.from(_e.default.encode(e.length));return pe([t,e],t.length+e.length)}function ch(r){let e=ih.decode(r),t=Uint8Array.from(_e.default.encode(e.length));return pe([t,e],t.length+e.length)}function uh(r){let e=_e.default.decode(r),t=r.slice(_e.default.decode.bytes);if(t.length!==e)throw new Error("inconsistent lengths");return"u"+ye(t,"base64url")}function fh(r){let e=_e.default.decode(r),t=r.slice(_e.default.decode.bytes);if(t.length!==e)throw new Error("inconsistent lengths");return ye(t,"base58btc")}function lh(r){let e=r.split(":");if(e.length!==2)throw new Error(`failed to parse onion addr: ["'${e.join('", "')}'"]' does not contain a port number`);if(e[0].length!==16)throw new Error(`failed to parse onion addr: ${e[0]} not a Tor onion address.`);let t=Ue.decode("b"+e[0]),o=parseInt(e[1],10);if(o<1||o>65536)throw new Error("Port number is not in range(1, 65536)");let n=Hn(o);return pe([t,n],t.length+n.length)}function hh(r){let e=r.split(":");if(e.length!==2)throw new Error(`failed to parse onion addr: ["'${e.join('", "')}'"]' does not contain a port number`);if(e[0].length!==56)throw new Error(`failed to parse onion addr: ${e[0]} not a Tor onion3 address.`);let t=Ue.decode(`b${e[0]}`),o=parseInt(e[1],10);if(o<1||o>65536)throw new Error("Port number is not in range(1, 65536)");let n=Hn(o);return pe([t,n],t.length+n.length)}function Ca(r){let e=r.slice(0,r.length-2),t=r.slice(r.length-2),o=ye(e,"base32"),n=Ba(t);return`${o}:${n}`}var It=oe(Tr(),1);function dh(r){let e=[],t=r.split("/").slice(1);if(t.length===1&&t[0]==="")return[];for(let o=0;o<t.length;o++){let n=t[o],i=H(n);if(i.size===0){e.push([n]);continue}if(o++,o>=t.length)throw La("invalid address: "+r);if(i.path===!0){e.push([n,oo(t.slice(o).join("/"))]);break}e.push([n,t[o]])}return e}function ph(r){let e=[];return r.map(t=>{let o=Or(t);return e.push(o.name),t.length>1&&t[1]!=null&&e.push(t[1]),null}),oo(e.join("/"))}function yh(r){return r.map(e=>{Array.isArray(e)||(e=[e]);let t=Or(e);return e.length>1?[t.code,qa(t.code,e[1])]:[t.code]})}function eo(r){return r.map(e=>{let t=Or(e);return e[1]!=null?[t.code,ja(t.code,e[1])]:[t.code]})}function to(r){return Pr(pe(r.map(e=>{let t=Or(e),o=Uint8Array.from(It.default.encode(t.code));return e.length>1&&e[1]!=null&&(o=pe([o,e[1]])),o})))}function ro(r,e){return r.size>0?r.size/8:r.size===0?0:It.default.decode(e)+(It.default.decode.bytes??0)}function Nr(r){let e=[],t=0;for(;t<r.length;){let o=It.default.decode(r,t),n=It.default.decode.bytes??0,i=H(o),s=ro(i,r.slice(t+n));if(s===0){e.push([o]),t+=n;continue}let a=r.slice(t+n,t+n+s);if(t+=s+n,t>r.length)throw La("Invalid address Uint8Array: "+ye(r,"base16"));e.push([o,a])}return e}function no(r){let e=Nr(r),t=eo(e);return ph(t)}function mh(r){r=oo(r);let e=dh(r),t=yh(e);return to(t)}function ka(r){return mh(r)}function Pr(r){let e=gh(r);if(e!=null)throw e;return Uint8Array.from(r)}function gh(r){try{Nr(r)}catch(e){return e}}function oo(r){return"/"+r.trim().split("/").filter(e=>e).join("/")}function La(r){return new Error("Error parsing address: "+r)}function Or(r){return H(r[0])}var ao=oe(Tr(),1);var Fa=oe(io(),1);function Mr(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}var Dt=function(r,e,t,o){if(t==="a"&&!o)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!o:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?o:t==="a"?o.call(r):o?o.value:e.get(r)},so=function(r,e,t,o,n){if(o==="m")throw new TypeError("Private method is not writable");if(o==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return o==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},Ht,er,tr,za,vh=Symbol.for("nodejs.util.inspect.custom"),xh=[H("dns").code,H("dns4").code,H("dns6").code,H("dnsaddr").code],Eh=new Map,Va=Symbol.for("@multiformats/js-multiaddr/multiaddr");function Ah(r){return Boolean(r?.[Va])}var Fe=class{constructor(e){if(Ht.set(this,void 0),er.set(this,void 0),tr.set(this,void 0),this[za]=!0,e==null&&(e=""),e instanceof Uint8Array)this.bytes=Pr(e);else if(typeof e=="string"){if(e.length>0&&e.charAt(0)!=="/")throw new Error(`multiaddr "${e}" must start with a "/"`);this.bytes=ka(e)}else if(Ah(e))this.bytes=Pr(e.bytes);else throw new Error("addr must be a string, Buffer, or another Multiaddr")}toString(){return Dt(this,Ht,"f")==null&&so(this,Ht,no(this.bytes),"f"),Dt(this,Ht,"f")}toJSON(){return this.toString()}toOptions(){let e,t,o,n,i="",s=H("tcp"),a=H("udp"),c=H("ip4"),u=H("ip6"),d=H("dns6"),w=H("ip6zone");for(let[k,N]of this.stringTuples())k===w.code&&(i=`%${N??""}`),xh.includes(k)&&(t=s.name,n=443,o=`${N??""}${i}`,e=k===d.code?6:4),(k===s.code||k===a.code)&&(t=H(k).name,n=parseInt(N??"")),(k===c.code||k===u.code)&&(t=H(k).name,o=`${N??""}${i}`,e=k===u.code?6:4);if(e==null||t==null||o==null||n==null)throw new Error('multiaddr must have a valid format: "/{ip4, ip6, dns4, dns6, dnsaddr}/{address}/{tcp, udp}/{port}".');return{family:e,host:o,transport:t,port:n}}protos(){return this.protoCodes().map(e=>Object.assign({},H(e)))}protoCodes(){let e=[],t=this.bytes,o=0;for(;o<t.length;){let n=ao.default.decode(t,o),i=ao.default.decode.bytes??0,s=H(n),a=ro(s,t.slice(o+i));o+=a+i,e.push(n)}return e}protoNames(){return this.protos().map(e=>e.name)}tuples(){return Dt(this,er,"f")==null&&so(this,er,Nr(this.bytes),"f"),Dt(this,er,"f")}stringTuples(){return Dt(this,tr,"f")==null&&so(this,tr,eo(this.tuples()),"f"),Dt(this,tr,"f")}encapsulate(e){return e=new Fe(e),new Fe(this.toString()+e.toString())}decapsulate(e){let t=e.toString(),o=this.toString(),n=o.lastIndexOf(t);if(n<0)throw new Error(`Address ${this.toString()} does not contain subaddress: ${e.toString()}`);return new Fe(o.slice(0,n))}decapsulateCode(e){let t=this.tuples();for(let o=t.length-1;o>=0;o--)if(t[o][0]===e)return new Fe(to(t.slice(0,o)));return this}getPeerId(){try{let t=this.stringTuples().filter(o=>o[0]===Yt.ipfs.code).pop();if(t?.[1]!=null){let o=t[1];return o[0]==="Q"||o[0]==="1"?ye(de.decode(`z${o}`),"base58btc"):ye(Z.parse(o).multihash.bytes,"base58btc")}return null}catch{return null}}getPath(){let e=null;try{e=this.stringTuples().filter(t=>H(t[0]).path===!0)[0][1],e==null&&(e=null)}catch{e=null}return e}equals(e){return Mr(this.bytes,e.bytes)}async resolve(e){let t=this.protos().find(i=>i.resolvable);if(t==null)return[this];let o=Eh.get(t.name);if(o==null)throw(0,Fa.default)(new Error(`no available resolver for ${t.name}`),"ERR_NO_AVAILABLE_RESOLVER");return(await o(this,e)).map(i=>new Fe(i))}nodeAddress(){let e=this.toOptions();if(e.transport!=="tcp"&&e.transport!=="udp")throw new Error(`multiaddr must have a valid format - no protocol with name: "${e.transport}". Must have a valid transport protocol: "{tcp, udp}"`);return{family:e.family,address:e.host,port:e.port}}isThinWaistAddress(e){let t=(e??this).protos();return!(t.length!==2||t[0].code!==4&&t[0].code!==41||t[1].code!==6&&t[1].code!==273)}[(Ht=new WeakMap,er=new WeakMap,tr=new WeakMap,za=Va,vh)](){return`Multiaddr(${no(this.bytes)})`}};function $a(r){return new Fe(r)}var xo=oe(ho(),1),Dc=oe(Ac(),1),_c=oe(ht(),1),Eo=oe(vo(),1),Cc=oe(Ic(),1);function _h(){_c.default._configure(),xo.default._configure(Dc.default),Eo.default._configure(Cc.default)}_h();var jc=["uint64","int64","sint64","fixed64","sfixed64"];function Ch(r){for(let e of jc){if(r[e]==null)continue;let t=r[e];r[e]=function(){return BigInt(t.call(this).toString())}}return r}function Ao(r){return Ch(new xo.default(r))}function jh(r){for(let e of jc){if(r[e]==null)continue;let t=r[e];r[e]=function(o){return t.call(this,o.toString())}}return r}function So(){return jh(Eo.default.create())}function Ze(r,e){let t=Ao(r instanceof Uint8Array?r:r.subarray());return e.decode(t)}function Ye(r,e){let t=So();return e.encode(r,t,{lengthDelimited:!1}),t.finish()}var Ct;(function(r){r[r.VARINT=0]="VARINT",r[r.BIT64=1]="BIT64",r[r.LENGTH_DELIMITED=2]="LENGTH_DELIMITED",r[r.START_GROUP=3]="START_GROUP",r[r.END_GROUP=4]="END_GROUP",r[r.BIT32=5]="BIT32"})(Ct||(Ct={}));function jr(r,e,t,o){return{name:r,type:e,encode:t,decode:o}}function or(r){function e(n){if(r[n.toString()]==null)throw new Error("Invalid enum value");return r[n]}let t=function(i,s){let a=e(i);s.int32(a)},o=function(i){let s=i.int32();return e(s)};return jr("enum",Ct.VARINT,t,o)}function He(r,e){return jr("message",Ct.LENGTH_DELIMITED,r,e)}var jt;(function(r){let e;(function(n){n.RESERVE="RESERVE",n.CONNECT="CONNECT",n.STATUS="STATUS"})(e=r.Type||(r.Type={}));let t;(function(n){n[n.RESERVE=0]="RESERVE",n[n.CONNECT=1]="CONNECT",n[n.STATUS=2]="STATUS"})(t||(t={})),function(n){n.codec=()=>or(t)}(e=r.Type||(r.Type={}));let o;r.codec=()=>(o==null&&(o=He((n,i,s={})=>{s.lengthDelimited!==!1&&i.fork(),n.type!=null&&(i.uint32(8),r.Type.codec().encode(n.type,i)),n.peer!=null&&(i.uint32(18),qt.codec().encode(n.peer,i)),n.reservation!=null&&(i.uint32(26),qr.codec().encode(n.reservation,i)),n.limit!=null&&(i.uint32(34),Bt.codec().encode(n.limit,i)),n.status!=null&&(i.uint32(40),qe.codec().encode(n.status,i)),s.lengthDelimited!==!1&&i.ldelim()},(n,i)=>{let s={},a=i==null?n.len:n.pos+i;for(;n.pos<a;){let c=n.uint32();switch(c>>>3){case 1:s.type=r.Type.codec().decode(n);break;case 2:s.peer=qt.codec().decode(n,n.uint32());break;case 3:s.reservation=qr.codec().decode(n,n.uint32());break;case 4:s.limit=Bt.codec().decode(n,n.uint32());break;case 5:s.status=qe.codec().decode(n);break;default:n.skipType(c&7);break}}return s})),o),r.encode=n=>Ye(n,r.codec()),r.decode=n=>Ze(n,r.codec())})(jt||(jt={}));var qc;(function(r){let e;(function(n){n.CONNECT="CONNECT",n.STATUS="STATUS"})(e=r.Type||(r.Type={}));let t;(function(n){n[n.CONNECT=0]="CONNECT",n[n.STATUS=1]="STATUS"})(t||(t={})),function(n){n.codec=()=>or(t)}(e=r.Type||(r.Type={}));let o;r.codec=()=>(o==null&&(o=He((n,i,s={})=>{s.lengthDelimited!==!1&&i.fork(),n.type!=null&&(i.uint32(8),r.Type.codec().encode(n.type,i)),n.peer!=null&&(i.uint32(18),qt.codec().encode(n.peer,i)),n.limit!=null&&(i.uint32(26),Bt.codec().encode(n.limit,i)),n.status!=null&&(i.uint32(32),qe.codec().encode(n.status,i)),s.lengthDelimited!==!1&&i.ldelim()},(n,i)=>{let s={},a=i==null?n.len:n.pos+i;for(;n.pos<a;){let c=n.uint32();switch(c>>>3){case 1:s.type=r.Type.codec().decode(n);break;case 2:s.peer=qt.codec().decode(n,n.uint32());break;case 3:s.limit=Bt.codec().decode(n,n.uint32());break;case 4:s.status=qe.codec().decode(n);break;default:n.skipType(c&7);break}}return s})),o),r.encode=n=>Ye(n,r.codec()),r.decode=n=>Ze(n,r.codec())})(qc||(qc={}));var qt;(function(r){let e;r.codec=()=>(e==null&&(e=He((t,o,n={})=>{if(n.lengthDelimited!==!1&&o.fork(),t.id!=null&&t.id.byteLength>0&&(o.uint32(10),o.bytes(t.id)),t.addrs!=null)for(let i of t.addrs)o.uint32(18),o.bytes(i);n.lengthDelimited!==!1&&o.ldelim()},(t,o)=>{let n={id:new Uint8Array(0),addrs:[]},i=o==null?t.len:t.pos+o;for(;t.pos<i;){let s=t.uint32();switch(s>>>3){case 1:n.id=t.bytes();break;case 2:n.addrs.push(t.bytes());break;default:t.skipType(s&7);break}}return n})),e),r.encode=t=>Ye(t,r.codec()),r.decode=t=>Ze(t,r.codec())})(qt||(qt={}));var qr;(function(r){let e;r.codec=()=>(e==null&&(e=He((t,o,n={})=>{if(n.lengthDelimited!==!1&&o.fork(),t.expire!=null&&t.expire!==0n&&(o.uint32(8),o.uint64(t.expire)),t.addrs!=null)for(let i of t.addrs)o.uint32(18),o.bytes(i);t.voucher!=null&&(o.uint32(26),o.bytes(t.voucher)),n.lengthDelimited!==!1&&o.ldelim()},(t,o)=>{let n={expire:0n,addrs:[]},i=o==null?t.len:t.pos+o;for(;t.pos<i;){let s=t.uint32();switch(s>>>3){case 1:n.expire=t.uint64();break;case 2:n.addrs.push(t.bytes());break;case 3:n.voucher=t.bytes();break;default:t.skipType(s&7);break}}return n})),e),r.encode=t=>Ye(t,r.codec()),r.decode=t=>Ze(t,r.codec())})(qr||(qr={}));var Bt;(function(r){let e;r.codec=()=>(e==null&&(e=He((t,o,n={})=>{n.lengthDelimited!==!1&&o.fork(),t.duration!=null&&(o.uint32(8),o.uint32(t.duration)),t.data!=null&&(o.uint32(16),o.uint64(t.data)),n.lengthDelimited!==!1&&o.ldelim()},(t,o)=>{let n={},i=o==null?t.len:t.pos+o;for(;t.pos<i;){let s=t.uint32();switch(s>>>3){case 1:n.duration=t.uint32();break;case 2:n.data=t.uint64();break;default:t.skipType(s&7);break}}return n})),e),r.encode=t=>Ye(t,r.codec()),r.decode=t=>Ze(t,r.codec())})(Bt||(Bt={}));var qe;(function(r){r.UNUSED="UNUSED",r.OK="OK",r.RESERVATION_REFUSED="RESERVATION_REFUSED",r.RESOURCE_LIMIT_EXCEEDED="RESOURCE_LIMIT_EXCEEDED",r.PERMISSION_DENIED="PERMISSION_DENIED",r.CONNECTION_FAILED="CONNECTION_FAILED",r.NO_RESERVATION="NO_RESERVATION",r.MALFORMED_MESSAGE="MALFORMED_MESSAGE",r.UNEXPECTED_MESSAGE="UNEXPECTED_MESSAGE"})(qe||(qe={}));var To;(function(r){r[r.UNUSED=0]="UNUSED",r[r.OK=100]="OK",r[r.RESERVATION_REFUSED=200]="RESERVATION_REFUSED",r[r.RESOURCE_LIMIT_EXCEEDED=201]="RESOURCE_LIMIT_EXCEEDED",r[r.PERMISSION_DENIED=202]="PERMISSION_DENIED",r[r.CONNECTION_FAILED=203]="CONNECTION_FAILED",r[r.NO_RESERVATION=204]="NO_RESERVATION",r[r.MALFORMED_MESSAGE=400]="MALFORMED_MESSAGE",r[r.UNEXPECTED_MESSAGE=401]="UNEXPECTED_MESSAGE"})(To||(To={}));(function(r){r.codec=()=>or(To)})(qe||(qe={}));var Bc;(function(r){let e;r.codec=()=>(e==null&&(e=He((t,o,n={})=>{n.lengthDelimited!==!1&&o.fork(),t.relay!=null&&t.relay.byteLength>0&&(o.uint32(10),o.bytes(t.relay)),t.peer!=null&&t.peer.byteLength>0&&(o.uint32(18),o.bytes(t.peer)),t.expiration!=null&&t.expiration!==0n&&(o.uint32(24),o.uint64(t.expiration)),n.lengthDelimited!==!1&&o.ldelim()},(t,o)=>{let n={relay:new Uint8Array(0),peer:new Uint8Array(0),expiration:0n},i=o==null?t.len:t.pos+o;for(;t.pos<i;){let s=t.uint32();switch(s>>>3){case 1:n.relay=t.bytes();break;case 2:n.peer=t.bytes();break;case 3:n.expiration=t.uint64();break;default:t.skipType(s&7);break}}return n})),e),r.encode=t=>Ye(t,r.codec()),r.decode=t=>Ze(t,r.codec())})(Bc||(Bc={}));var Lc=Symbol.for("@achingbrain/uint8arraylist");function kc(r,e){if(e==null||e<0)throw new RangeError("index is out of bounds");let t=0;for(let o of r){let n=t+o.byteLength;if(e<n)return{buf:o,index:e-t};t=n}throw new RangeError("index is out of bounds")}function Br(r){return Boolean(r?.[Lc])}var me=class{constructor(...e){Object.defineProperty(this,Lc,{value:!0}),this.bufs=[],this.length=0,e.length>0&&this.appendAll(e)}*[Symbol.iterator](){yield*this.bufs}get byteLength(){return this.length}append(...e){this.appendAll(e)}appendAll(e){let t=0;for(let o of e)if(o instanceof Uint8Array)t+=o.byteLength,this.bufs.push(o);else if(Br(o))t+=o.byteLength,this.bufs.push(...o.bufs);else throw new Error("Could not append value, must be an Uint8Array or a Uint8ArrayList");this.length+=t}prepend(...e){this.prependAll(e)}prependAll(e){let t=0;for(let o of e.reverse())if(o instanceof Uint8Array)t+=o.byteLength,this.bufs.unshift(o);else if(Br(o))t+=o.byteLength,this.bufs.unshift(...o.bufs);else throw new Error("Could not prepend value, must be an Uint8Array or a Uint8ArrayList");this.length+=t}get(e){let t=kc(this.bufs,e);return t.buf[t.index]}set(e,t){let o=kc(this.bufs,e);o.buf[o.index]=t}write(e,t=0){if(e instanceof Uint8Array)for(let o=0;o<e.length;o++)this.set(t+o,e[o]);else if(Br(e))for(let o=0;o<e.length;o++)this.set(t+o,e.get(o));else throw new Error("Could not write value, must be an Uint8Array or a Uint8ArrayList")}consume(e){if(e=Math.trunc(e),!(Number.isNaN(e)||e<=0)){if(e===this.byteLength){this.bufs=[],this.length=0;return}for(;this.bufs.length>0;)if(e>=this.bufs[0].byteLength)e-=this.bufs[0].byteLength,this.length-=this.bufs[0].byteLength,this.bufs.shift();else{this.bufs[0]=this.bufs[0].subarray(e),this.length-=e;break}}}slice(e,t){let{bufs:o,length:n}=this._subList(e,t);return pe(o,n)}subarray(e,t){let{bufs:o,length:n}=this._subList(e,t);return o.length===1?o[0]:pe(o,n)}sublist(e,t){let{bufs:o,length:n}=this._subList(e,t),i=new me;return i.length=n,i.bufs=o,i}_subList(e,t){if(e=e??0,t=t??this.length,e<0&&(e=this.length+e),t<0&&(t=this.length+t),e<0||t>this.length)throw new RangeError("index is out of bounds");if(e===t)return{bufs:[],length:0};if(e===0&&t===this.length)return{bufs:[...this.bufs],length:this.length};let o=[],n=0;for(let i=0;i<this.bufs.length;i++){let s=this.bufs[i],a=n,c=a+s.byteLength;if(n=c,e>=c)continue;let u=e>=a&&e<c,d=t>a&&t<=c;if(u&&d){if(e===a&&t===c){o.push(s);break}let w=e-a;o.push(s.subarray(w,w+(t-e)));break}if(u){if(e===0){o.push(s);continue}o.push(s.subarray(e-a));continue}if(d){if(t===c){o.push(s);break}o.push(s.subarray(0,t-a));break}o.push(s)}return{bufs:o,length:t-e}}indexOf(e,t=0){if(!Br(e)&&!(e instanceof Uint8Array))throw new TypeError('The "value" argument must be a Uint8ArrayList or Uint8Array');let o=e instanceof Uint8Array?e:e.subarray();if(t=Number(t??0),isNaN(t)&&(t=0),t<0&&(t=this.length+t),t<0&&(t=0),e.length===0)return t>this.length?this.length:t;let n=o.byteLength;if(n===0)throw new TypeError("search must be at least 1 byte long");let i=256,s=new Int32Array(i);for(let w=0;w<i;w++)s[w]=-1;for(let w=0;w<n;w++)s[o[w]]=w;let a=s,c=this.byteLength-o.byteLength,u=o.byteLength-1,d;for(let w=t;w<=c;w+=d){d=0;for(let q=u;q>=0;q--){let k=this.get(w+q);if(o[q]!==k){d=Math.max(1,q-a[k]);break}}if(d===0)return w}return-1}getInt8(e){let t=this.subarray(e,e+1);return new DataView(t.buffer,t.byteOffset,t.byteLength).getInt8(0)}setInt8(e,t){let o=ze(1);new DataView(o.buffer,o.byteOffset,o.byteLength).setInt8(0,t),this.write(o,e)}getInt16(e,t){let o=this.subarray(e,e+2);return new DataView(o.buffer,o.byteOffset,o.byteLength).getInt16(0,t)}setInt16(e,t,o){let n=Re(2);new DataView(n.buffer,n.byteOffset,n.byteLength).setInt16(0,t,o),this.write(n,e)}getInt32(e,t){let o=this.subarray(e,e+4);return new DataView(o.buffer,o.byteOffset,o.byteLength).getInt32(0,t)}setInt32(e,t,o){let n=Re(4);new DataView(n.buffer,n.byteOffset,n.byteLength).setInt32(0,t,o),this.write(n,e)}getBigInt64(e,t){let o=this.subarray(e,e+8);return new DataView(o.buffer,o.byteOffset,o.byteLength).getBigInt64(0,t)}setBigInt64(e,t,o){let n=Re(8);new DataView(n.buffer,n.byteOffset,n.byteLength).setBigInt64(0,t,o),this.write(n,e)}getUint8(e){let t=this.subarray(e,e+1);return new DataView(t.buffer,t.byteOffset,t.byteLength).getUint8(0)}setUint8(e,t){let o=ze(1);new DataView(o.buffer,o.byteOffset,o.byteLength).setUint8(0,t),this.write(o,e)}getUint16(e,t){let o=this.subarray(e,e+2);return new DataView(o.buffer,o.byteOffset,o.byteLength).getUint16(0,t)}setUint16(e,t,o){let n=Re(2);new DataView(n.buffer,n.byteOffset,n.byteLength).setUint16(0,t,o),this.write(n,e)}getUint32(e,t){let o=this.subarray(e,e+4);return new DataView(o.buffer,o.byteOffset,o.byteLength).getUint32(0,t)}setUint32(e,t,o){let n=Re(4);new DataView(n.buffer,n.byteOffset,n.byteLength).setUint32(0,t,o),this.write(n,e)}getBigUint64(e,t){let o=this.subarray(e,e+8);return new DataView(o.buffer,o.byteOffset,o.byteLength).getBigUint64(0,t)}setBigUint64(e,t,o){let n=Re(8);new DataView(n.buffer,n.byteOffset,n.byteLength).setBigUint64(0,t,o),this.write(n,e)}getFloat32(e,t){let o=this.subarray(e,e+4);return new DataView(o.buffer,o.byteOffset,o.byteLength).getFloat32(0,t)}setFloat32(e,t,o){let n=Re(4);new DataView(n.buffer,n.byteOffset,n.byteLength).setFloat32(0,t,o),this.write(n,e)}getFloat64(e,t){let o=this.subarray(e,e+8);return new DataView(o.buffer,o.byteOffset,o.byteLength).getFloat64(0,t)}setFloat64(e,t,o){let n=Re(8);new DataView(n.buffer,n.byteOffset,n.byteLength).setFloat64(0,t,o),this.write(n,e)}equals(e){if(e==null||!(e instanceof me)||e.bufs.length!==this.bufs.length)return!1;for(let t=0;t<this.bufs.length;t++)if(!Mr(this.bufs[t],e.bufs[t]))return!1;return!0}static fromUint8Arrays(e,t){let o=new me;return o.bufs=e,t==null&&(t=e.reduce((n,i)=>n+i.byteLength,0)),o.length=t,o}};function Uc(r){let e=async function*(){let t=yield,o=new me;for await(let n of r){if(t==null){o.append(n),t=yield o,o=new me;continue}for(o.append(n);o.length>=t;){let i=o.sublist(0,t);if(o.consume(t),t=yield i,t==null){o.length>0&&(t=yield o,o=new me);break}}}if(t!=null)throw Object.assign(new Error(`stream ended before ${t} bytes became available`),{code:"ERR_UNDER_READ",buffer:o})}();return e.next(),e}function kr(r){let e=Mt(),t=Uc(r.source),o=Zt(),n,i=r.sink(async function*(){yield*e,yield*await o.promise}());return i.catch(a=>{n=a}),{reader:t,writer:e,stream:{sink:async a=>n!=null?await Promise.reject(n):(o.resolve(a),await i),source:t},rest:()=>e.end(),write:e.push,read:async()=>{let a=await t.next();if(a.value!=null)return a.value}}}function Lr(r){return r instanceof Uint8Array?{get(e){return r[e]},set(e,t){r[e]=t}}:{get(e){return r.get(e)},set(e,t){r.set(e,t)}}}var Rc=4294967296,ve=class{constructor(e=0,t=0){this.hi=e,this.lo=t}toBigInt(e){if(e===!0)return BigInt(this.lo>>>0)+(BigInt(this.hi>>>0)<<32n);if(this.hi>>>31){let t=~this.lo+1>>>0,o=~this.hi>>>0;return t===0&&(o=o+1>>>0),-(BigInt(t)+(BigInt(o)<<32n))}return BigInt(this.lo>>>0)+(BigInt(this.hi>>>0)<<32n)}toNumber(e){return Number(this.toBigInt(e))}zzDecode(){let e=-(this.lo&1),t=((this.lo>>>1|this.hi<<31)^e)>>>0,o=(this.hi>>>1^e)>>>0;return new ve(o,t)}zzEncode(){let e=this.hi>>31,t=((this.hi<<1|this.lo>>>31)^e)>>>0,o=(this.lo<<1^e)>>>0;return new ve(t,o)}toBytes(e,t=0){let o=Lr(e);for(;this.hi>0;)o.set(t++,this.lo&127|128),this.lo=(this.lo>>>7|this.hi<<25)>>>0,this.hi>>>=7;for(;this.lo>127;)o.set(t++,this.lo&127|128),this.lo=this.lo>>>7;o.set(t++,this.lo)}static fromBigInt(e){if(e===0n)return new ve;let t=e<0;t&&(e=-e);let o=Number(e>>32n)|0,n=Number(e-(BigInt(o)<<32n))|0;return t&&(o=~o>>>0,n=~n>>>0,++n>Rc&&(n=0,++o>Rc&&(o=0))),new ve(o,n)}static fromNumber(e){if(e===0)return new ve;let t=e<0;t&&(e=-e);let o=e>>>0,n=(e-o)/4294967296>>>0;return t&&(n=~n>>>0,o=~o>>>0,++o>4294967295&&(o=0,++n>4294967295&&(n=0))),new ve(n,o)}static fromBytes(e,t=0){let o=Lr(e),n=new ve,i=0;if(e.length-t>4){for(;i<4;++i)if(n.lo=(n.lo|(o.get(t)&127)<<i*7)>>>0,o.get(t++)<128)return n;if(n.lo=(n.lo|(o.get(t)&127)<<28)>>>0,n.hi=(n.hi|(o.get(t)&127)>>4)>>>0,o.get(t++)<128)return n;i=0}else for(;i<4;++i){if(t>=e.length)throw RangeError(`index out of range: ${t} > ${e.length}`);if(n.lo=(n.lo|(o.get(t)&127)<<i*7)>>>0,o.get(t++)<128)return n}if(e.length-t>4){for(;i<5;++i)if(n.hi=(n.hi|(o.get(t)&127)<<i*7+3)>>>0,o.get(t++)<128)return n}else if(t<e.byteLength)for(;i<5;++i){if(t>=e.length)throw RangeError(`index out of range: ${t} > ${e.length}`);if(n.hi=(n.hi|(o.get(t)&127)<<i*7+3)>>>0,o.get(t++)<128)return n}throw RangeError("invalid varint encoding")}};var qh=Math.pow(2,7),Bh=Math.pow(2,14),kh=Math.pow(2,21),Lh=Math.pow(2,28),Uh=Math.pow(2,35),Rh=Math.pow(2,42),zh=Math.pow(2,49),Fh=Math.pow(2,56),Vh=Math.pow(2,63),pt={encodingLength(r){return r<qh?1:r<Bh?2:r<kh?3:r<Lh?4:r<Uh?5:r<Rh?6:r<zh?7:r<Fh?8:r<Vh?9:10},encode(r,e,t=0){if(Number.MAX_SAFE_INTEGER!=null&&r>Number.MAX_SAFE_INTEGER)throw new RangeError("Could not encode varint");return e==null&&(e=ze(pt.encodingLength(r))),ve.fromNumber(r).toBytes(e,t),e},decode(r,e=0){return ve.fromBytes(r,e).toNumber(!0)}};function zc(r){return globalThis?.Buffer?.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(r):new Uint8Array(r)}var Ur=r=>{let e=pt.encodingLength(r),t=zc(e);return pt.encode(r,t),Ur.bytes=e,t};Ur.bytes=0;function Rr(r){r=r??{};let e=r.lengthEncoder??Ur;return async function*(o){for await(let n of o){let i=e(n.byteLength);i instanceof Uint8Array?yield i:yield*i,n instanceof Uint8Array?yield n:yield*n}}}Rr.single=(r,e)=>{e=e??{};let t=e.lengthEncoder??Ur;return new me(t(r.byteLength),r)};var ir=oe(io(),1),$h=8,Wh=1024*1024*4,yt;(function(r){r[r.LENGTH=0]="LENGTH",r[r.DATA=1]="DATA"})(yt||(yt={}));var No=r=>{let e=pt.decode(r);return No.bytes=pt.encodingLength(e),e};No.bytes=0;function sr(r){return async function*(t){let o=new me,n=yt.LENGTH,i=-1,s=r?.lengthDecoder??No,a=r?.maxLengthLength??$h,c=r?.maxDataLength??Wh;for await(let u of t)for(o.append(u);o.byteLength>0;){if(n===yt.LENGTH)try{if(i=s(o),i<0)throw(0,ir.default)(new Error("invalid message length"),"ERR_INVALID_MSG_LENGTH");if(i>c)throw(0,ir.default)(new Error("message length too long"),"ERR_MSG_DATA_TOO_LONG");let d=s.bytes;o.consume(d),r?.onLength!=null&&r.onLength(i),n=yt.DATA}catch(d){if(d instanceof RangeError){if(o.byteLength>a)throw(0,ir.default)(new Error("message length length too long"),"ERR_MSG_LENGTH_TOO_LONG");break}throw d}if(n===yt.DATA){if(o.byteLength<i)break;let d=o.sublist(0,i);o.consume(i),r?.onData!=null&&r.onData(d),yield d,n=yt.LENGTH}}if(o.byteLength>0)throw(0,ir.default)(new Error("unexpected end of input"),"ERR_UNEXPECTED_EOF")}}sr.fromReader=(r,e)=>{let t=1,o=async function*(){for(;;)try{let{done:i,value:s}=await r.next(t);if(i===!0)return;s!=null&&(yield s)}catch(i){if(i.code==="ERR_UNDER_READ")return{done:!0,value:null};throw i}finally{t=1}}();return sr({...e??{},onLength:i=>{t=i}})(o)};function Fc(r,e={}){let t=kr(r),o=sr.fromReader(t.reader,e),n={read:async i=>{let{value:s}=await t.reader.next(i);if(s==null)throw new Error("Value is null");return s},readLP:async()=>{let{value:i}=await o.next();if(i==null)throw new Error("Value is null");return i},readPB:async i=>{let s=await n.readLP();if(s==null)throw new Error("Value is null");let a=s instanceof Uint8Array?s:s.subarray();return i.decode(a)},write:i=>{i instanceof Uint8Array?t.writer.push(i):t.writer.push(i.subarray())},writeLP:i=>{n.write(Rr.single(i,e))},writePB:(i,s)=>{n.writeLP(s.encode(i))},pb:i=>({read:async()=>await n.readPB(i),write:s=>{n.writePB(s,i)}}),unwrap:()=>(t.rest(),t.stream)};return n}var Kh="/libp2p/circuit/relay/0.2.0/hop",Vc=async(r,e,t)=>{let o=await r.client.openStream(e,Kh),n=Fc(o);return n.writePB({type:jt.Type.RESERVE,...t??{}},jt),await n.readPB(jt)},zr={protocol:"/echo/1.0.0",handler:async r=>{await Qt(r,async function*(e){for await(let t of e)yield t.subarray()},r)}};function Po(r){let e=["go","js"];e.forEach(t=>{e.forEach(o=>{e.forEach(n=>{Jh(r,t,o,n)})})})}function Jh(r,e,t,o){describe(`${e} to ${t} over relay ${o}`,()=>{let n=[{type:e,noise:!0,noListen:!0},{type:t,noise:!0,noListen:!0},{type:o,noise:!0,relay:!0}],i,s,a,c,u,d;beforeEach(async function(){this.timeout(20*1e3),[i,s,a]=await Promise.all(n.map(async w=>await r.spawn(w))),[c,u]=await Promise.all([s,a].map(async w=>await w.client.identify())),d=$a(`${u.addrs[0].toString()}/p2p/${u.peerId.toString()}/p2p-circuit/p2p/${c.peerId.toString()}`),await s.client.connect(u.peerId,u.addrs)}),afterEach(async function(){await Promise.all([i,s,a].map(async w=>{await w.stop()}))}),it("connects",async()=>{let w=await Vc(s,u.peerId);W(w.status).to.eq(qe.OK),await i.client.connect(c.peerId,[d]),await new Promise(B=>setTimeout(B,500));let q=await i.client.listPeers();W(q.filter(B=>B.equals(c.peerId))).to.have.length(1),await s.client.registerStreamHandler(zr.protocol,zr.handler);let k=await i.client.openStream(c.peerId,zr.protocol),N=ae("test"),E=kr(k);E.write(N);let I=await E.read();W(I?.subarray()).to.deep.equal(N)}),it("fails to connect without a reservation",async()=>{await W(i.client.connect(c.peerId,[d])).to.eventually.be.rejected.with.property("message").that.matches(/NO_RESERVATION/)})})}async function Xh(r){hn(r),Po(r),await kn(r),await Vn(r),await Kn(r)}return iu(Qh);})();
|
|
8
8
|
/*! Bundled license information:
|
|
9
9
|
|
|
10
10
|
assertion-error/index.js:
|