@libp2p/interop 6.0.2 → 6.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.min.js +5 -5
- package/dist/src/pubsub/floodsub.d.ts.map +1 -1
- package/dist/src/pubsub/floodsub.js +3 -8
- package/dist/src/pubsub/floodsub.js.map +1 -1
- package/dist/src/pubsub/gossipsub.d.ts.map +1 -1
- package/dist/src/pubsub/gossipsub.js +3 -8
- package/dist/src/pubsub/gossipsub.js.map +1 -1
- package/dist/src/pubsub/hybrid.d.ts.map +1 -1
- package/dist/src/pubsub/hybrid.js +3 -8
- package/dist/src/pubsub/hybrid.js.map +1 -1
- package/dist/src/pubsub/utils.d.ts +3 -0
- package/dist/src/pubsub/utils.d.ts.map +1 -0
- package/dist/src/pubsub/utils.js +21 -0
- package/dist/src/pubsub/utils.js.map +1 -0
- package/package.json +1 -1
- package/src/pubsub/floodsub.ts +3 -10
- package/src/pubsub/gossipsub.ts +3 -10
- package/src/pubsub/hybrid.ts +3 -9
- package/src/pubsub/utils.ts +23 -0
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 To(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,Bc," ")),h.truncate-=Y.length;var he=h.truncate,ue=Fr(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 kc=typeof Symbol=="function"&&typeof Symbol.for=="function",cr=kc?Symbol.for("chai/inspect"):"@@chai/inspect",bt=!1;try{var No=ke("util");bt=No.inspect?No.inspect.custom:!1}catch{bt=!1}function Po(){this.key="chai/loupe__"+Math.random()+Date.now()}Po.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:Po),fr={},Oo={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:gt,Set:zr,RegExp:tt,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:Fr,NodeList:Fr},Lc=function(h,b,P){return cr in h&&typeof h[cr]=="function"?h[cr](b):bt&&bt in h&&typeof h[bt]=="function"?h[bt](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):""},Uc=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=Uc.call(l).slice(8,-1)),Oo[D])return Oo[D](l,h);if(P&&l){var R=Lc(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?To(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 Rc(l,h){return ur.has(l)?!1:(ur.set(l,h),!0)}function zc(l,h){return l in fr?!1:(fr[l]=h,!0)}var Fc=cr;r.custom=Fc,r.default=lr,r.inspect=lr,r.registerConstructor=Rc,r.registerStringTag=zc,Object.defineProperty(r,"__esModule",{value:!0})})});var ot=O((Qh,Xo)=>{Xo.exports={includeStack:!1,showDiff:!0,truncateThreshold:40,useProxy:!0,proxyExcludedKeys:["then","catch","inspect","toJSON"]}});var pr=O((Yh,Zo)=>{var Zh=Qr(),au=Jo(),Qo=ot();Zo.exports=cu;function cu(r,e,t,o){var n={colors:o,depth:typeof t>"u"?2:t,showHidden:e,truncate:Qo.truncateThreshold?Qo.truncateThreshold:1/0};return au.inspect(r,n)}});var Zr=O((Hh,Ho)=>{var uu=pr(),Yo=ot();Ho.exports=function(e){var t=uu(e),o=Object.prototype.toString.call(e);if(Yo.truncateThreshold&&t.length>=Yo.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 ti=O((ed,ei)=>{var Yr=Ae(),fu=Xr(),Hr=Zr();ei.exports=function(e,t){var o=Yr(e,"negate"),n=Yr(e,"object"),i=t[3],s=fu(e,t),a=o?t[2]:t[1],c=Yr(e,"message");return typeof a=="function"&&(a=a()),a=a||"",a=a.replace(/#\{this\}/g,function(){return Hr(n)}).replace(/#\{act\}/g,function(){return Hr(s)}).replace(/#\{exp\}/g,function(){return Hr(i)}),c?c+": "+a:a}});var Ve=O((td,ri)=>{ri.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 pi=O((rd,rn)=>{"use strict";var ni=Ut();function li(){this._key="chai/deep-eql__"+Math.random()+Date.now()}li.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 tn=typeof WeakMap=="function"?WeakMap:li;function oi(r,e,t){if(!t||vt(r)||vt(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||vt(r)||vt(e))){var n=t.get(r);n?n.set(e,o):(n=new tn,n.set(e,o),t.set(r,n))}}rn.exports=mr;rn.exports.MemoizeMap=tn;function mr(r,e,t){if(t&&t.comparator)return ii(r,e,t);var o=hi(r,e);return o!==null?o:ii(r,e,t)}function hi(r,e){return r===e?r!==0||1/r===1/e:r!==r&&e!==e?!0:vt(r)||vt(e)?!1:null}function ii(r,e,t){t=t||{},t.memoize=t.memoize===!1?!1:t.memoize||new tn;var o=t&&t.comparator,n=oi(r,e,t.memoize);if(n!==null)return n;var i=oi(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=hi(r,e);if(a!==null)return a}var c=ni(r);if(c!==ni(e))return yr(r,e,t.memoize,!1),!1;yr(r,e,t.memoize,!0);var u=lu(r,e,c,t);return yr(r,e,t.memoize,u),u}function lu(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 di(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 st(r,e,o);case"RegExp":return hu(r,e);case"Generator":return du(r,e,o);case"DataView":return st(new Uint8Array(r.buffer),new Uint8Array(e.buffer),o);case"ArrayBuffer":return st(new Uint8Array(r),new Uint8Array(e),o);case"Set":return si(r,e,o);case"Map":return si(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 yu(r,e,o)}}function hu(r,e){return r.toString()===e.toString()}function si(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])}),st(o.sort(),n.sort(),t)}function st(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 du(r,e,t){return st(en(r),en(e),t)}function pu(r){return typeof Symbol<"u"&&typeof r=="object"&&typeof Symbol.iterator<"u"&&typeof r[Symbol.iterator]=="function"}function ai(r){if(pu(r))try{return en(r[Symbol.iterator]())}catch{return[]}return[]}function en(r){for(var e=r.next(),t=[e.value];e.done===!1;)e=r.next(),t.push(e.value);return t}function ci(r){var e=[];for(var t in r)e.push(t);return e}function ui(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 di(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 yu(r,e,t){var o=ci(r),n=ci(e),i=ui(r),s=ui(e);if(o=o.concat(i),n=n.concat(s),o.length&&o.length===n.length)return st(fi(o).sort(),fi(n).sort())===!1?!1:di(r,e,o,t);var a=ai(r),c=ai(e);return a.length&&a.length===c.length?(a.sort(),c.sort(),st(a,c,t)):o.length===0&&a.length===0&&n.length===0&&c.length===0}function vt(r){return r===null||typeof r!="object"}function fi(r){return r.map(function(t){return typeof t=="symbol"?t.toString():t})}});var Rt=O((nd,yi)=>{var mu=ot();yi.exports=function(){return mu.useProxy&&typeof Proxy<"u"&&typeof Reflect<"u"}});var bi=O((od,gi)=>{var gu=$e(),mi=Ae(),bu=Rt(),wu=Ve();gi.exports=function(e,t,o){o=o===void 0?function(){}:o,Object.defineProperty(e,t,{get:function n(){!bu()&&!mi(this,"lockSsfi")&&mi(this,"ssfi",n);var i=o.call(this);if(i!==void 0)return i;var s=new gu.Assertion;return wu(this,s),s},configurable:!0})}});var zt=O((id,wi)=>{var vu=Object.getOwnPropertyDescriptor(function(){},"length");wi.exports=function(e,t,o){return vu.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 xi=O((sd,vi)=>{vi.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((ad,Si)=>{var xu=ot(),Ei=Ae(),Eu=xi(),Au=Rt();var Ai=["__flags","__methods","_obj","assert"];Si.exports=function(e,t){return Au()?new Proxy(e,{get:function o(n,i){if(typeof i=="string"&&xu.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 Eu(n).forEach(function(c){if(!Object.prototype.hasOwnProperty(c)&&Ai.indexOf(c)===-1){var u=Su(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 Ai.indexOf(i)===-1&&!Ei(n,"lockSsfi")&&Ei(n,"ssfi",o),Reflect.get(n,i)}}):e};function Su(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 Pi=O((cd,Ni)=>{var Tu=zt(),Nu=$e(),Ti=Ae(),Pu=Ft(),Ou=Ve();Ni.exports=function(e,t,o){var n=function(){Ti(this,"lockSsfi")||Ti(this,"ssfi",n);var i=o.apply(this,arguments);if(i!==void 0)return i;var s=new Nu.Assertion;return Ou(this,s),s};Tu(n,t,!1),e[t]=Pu(n,t)}});var Mi=O((ud,Oi)=>{var Mu=$e(),Vt=Ae(),Iu=Rt(),Du=Ve();Oi.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(){!Iu()&&!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 Mu.Assertion;return Du(this,u),u},configurable:!0})}});var Di=O((fd,Ii)=>{var _u=zt(),Cu=$e(),$t=Ae(),ju=Ft(),qu=Ve();Ii.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 Cu.Assertion;return qu(this,u),u};_u(s,t,!1),e[t]=ju(s,t)}});var Bi=O((ld,qi)=>{var Bu=zt(),ku=$e(),_i=Ae(),Lu=Ft(),Ci=Ve();var Uu=typeof Object.setPrototypeOf=="function",ji=function(){},Ru=Object.getOwnPropertyNames(ji).filter(function(r){var e=Object.getOwnPropertyDescriptor(ji,r);return typeof e!="object"?!0:!e.configurable}),zu=Function.prototype.call,Fu=Function.prototype.apply;qi.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(){_i(this,"lockSsfi")||_i(this,"ssfi",a);var d=i.method.apply(this,arguments);if(d!==void 0)return d;var w=new ku.Assertion;return Ci(this,w),w};if(Bu(a,t,!0),Uu){var c=Object.create(this);c.call=zu,c.apply=Fu,Object.setPrototypeOf(a,c)}else{var u=Object.getOwnPropertyNames(e);u.forEach(function(d){if(Ru.indexOf(d)===-1){var w=Object.getOwnPropertyDescriptor(e,d);Object.defineProperty(a,d,w)}})}return Ci(this,a),Lu(a)},configurable:!0})}});var Ri=O((hd,Ui)=>{var ki=$e(),Li=Ve();Ui.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 ki.Assertion;return Li(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 ki.Assertion;return Li(this,d),d}}});var Vi=O((dd,Fi)=>{var zi=pr();Fi.exports=function(e,t){return zi(e)<zi(t)?-1:1}});var nn=O((pd,$i)=>{$i.exports=function(e){return typeof Object.getOwnPropertySymbols!="function"?[]:Object.getOwnPropertySymbols(e).filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})}});var Gi=O((yd,Wi)=>{var Vu=nn();Wi.exports=function(e){return Object.keys(e).concat(Vu(e))}});var sn=O((md,Ki)=>{"use strict";function $u(r,e){return e instanceof Error&&r===e}function Wu(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 Gu(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 Ku=/\s*function(?:\s|\s*\/\*[^(?:*\/)]+\*\/\s*)*([^\(\/]+)/;function on(r){var e="";if(typeof r.name>"u"){var t=String(r).match(Ku);t&&(e=t[1])}else e=r.name;return e}function Ju(r){var e=r;return r instanceof Error?e=on(r.constructor):typeof r=="function"&&(e=on(r).trim()||on(new r)),e}function Xu(r){var e="";return r&&r.message?e=r.message:typeof r=="string"&&(e=r),e}Ki.exports={compatibleInstance:$u,compatibleConstructor:Wu,compatibleMessage:Gu,getMessage:Xu,getConstructorName:Ju}});var Xi=O((gd,Ji)=>{function Qu(r){return r!==r}Ji.exports=Number.isNaN||Qu});var Yi=O((bd,Zi)=>{var Zu=Ut(),Qi=Ae();function Yu(r){var e=Zu(r),t=["Array","Object","function"];return t.indexOf(e)!==-1}Zi.exports=function(e,t){var o=Qi(e,"operator"),n=Qi(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=Yu(i);return/\snot\s/.test(s)?a?"notDeepStrictEqual":"notStrictEqual":a?"deepStrictEqual":"strictEqual"}}});var es=O(J=>{var Hi=Uo();J.test=Fo();J.type=Ut();J.expectTypes=$o();J.getMessage=ti();J.getActual=Xr();J.inspect=pr();J.objDisplay=Zr();J.flag=Ae();J.transferFlags=Ve();J.eql=pi();J.getPathInfo=Hi.getPathInfo;J.hasProperty=Hi.hasProperty;J.getName=Qr();J.addProperty=bi();J.addMethod=Pi();J.overwriteProperty=Mi();J.overwriteMethod=Di();J.addChainableMethod=Bi();J.overwriteChainableMethod=Ri();J.compareByInspect=Vi();J.getOwnEnumerablePropertySymbols=nn();J.getOwnEnumerableProperties=Gi();J.checkError=sn();J.proxify=Ft();J.addLengthGuard=zt();J.isProxyEnabled=Rt();J.isNaN=Xi();J.getOperator=Yi()});var rs=O((vd,ts)=>{var xt=ot();ts.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."),xt.includeStack},set:function(i){console.warn("Assertion.includeStack is deprecated, use chai.config.includeStack instead."),xt.includeStack=i}}),Object.defineProperty(n,"showDiff",{get:function(){return console.warn("Assertion.showDiff is deprecated, use chai.config.showDiff instead."),xt.showDiff},set:function(i){console.warn("Assertion.showDiff is deprecated, use chai.config.showDiff instead."),xt.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),xt.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,xt.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 os=O((xd,ns)=>{ns.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 gt(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",gt),t.addMethod("approximately",gt);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 tt(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",tt),t.addMethod("increases",tt);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 zr(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",zr),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 ss=O((Ed,is)=>{is.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 cs=O((Ad,as)=>{as.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 fs=O((Sd,us)=>{us.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 ls=[];we.version="4.3.3";we.AssertionError=Wr();var hs=es();we.use=function(r){return~ls.indexOf(r)||(r(we,hs),ls.push(r)),we};we.util=hs;var Hu=ot();we.config=Hu;var ef=rs();we.use(ef);var tf=os();we.use(tf);var rf=ss();we.use(rf);var nf=cs();we.use(nf);var of=fs();we.use(of)});var ps=O((Nd,ds)=>{ds.exports=$e()});var ys=O((Ld,Le)=>{"use strict";var at=sn();Le.exports=(r,e)=>{let t=r.Assertion,o=r.assert,n=e.proxify;e.checkError&&(at=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():at.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=at.getConstructorName(y):y=null;let De=Boolean(y&&S),fe="including";S instanceof RegExp&&(fe="matching");let gt=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?at.compatibleInstance(ge,y):at.compatibleConstructor(ge,y)),xe=S&&at.compatibleMessage(ge,S),tt=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,tt):(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,tt),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,at.getMessage(ge))),ge});return Le.exports.transferPromiseness(this,gt),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 Kc=Object.create;var dr=Object.defineProperty;var Jc=Object.getOwnPropertyDescriptor;var Xc=Object.getOwnPropertyNames;var Qc=Object.getPrototypeOf,Zc=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)dr(r,t,{get:e[t],enumerable:!0})},_o=(r,e,t,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Xc(e))!Zc.call(r,n)&&n!==t&&dr(r,n,{get:()=>e[n],enumerable:!(o=Jc(e,n))||o.enumerable});return r};var oe=(r,e,t)=>(t=r!=null?Kc(Qc(r)):{},_o(e||!r||!r.__esModule?dr(t,"default",{value:r,enumerable:!0}):t,r)),Yc=r=>_o(dr({},"__esModule",{value:!0}),r);var Gr=O(($h,jo)=>{function Co(){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}}jo.exports=rt;function rt(r,e,t){var o=Co("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=Co("constructor","toJSON","stack"),t=e({name:this.name},this);return r!==!1&&this.stack&&(t.stack=this.stack),t}});var Ro=O((Wh,Uo)=>{"use strict";function Bo(r,e){return typeof r>"u"||r===null?!1:e in Object(r)}function ko(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 qo(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 Hc(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 Lo(r,e){var t=ko(e),o=t[t.length-1],n={parent:t.length>1?qo(r,t,t.length-1):r,name:o.p||o.i,value:qo(r,t)};return n.exists=Bo(n.parent,n.name),n}function eu(r,e){var t=Lo(r,e);return t.value}function tu(r,e,t){var o=ko(e);return Hc(r,t,o),r}Uo.exports={hasProperty:Bo,getPathInfo:Lo,getPathValue:eu,setPathValue:tu}});var Ae=O((Gh,zo)=>{zo.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 Vo=O((Kh,Fo)=>{var ru=Ae();Fo.exports=function(e,t){var o=ru(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",B=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",q=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===B?"Set Iterator":N&&U===E?"Array Iterator":I&&U===q?"String Iterator":U===null?"Object":Object.prototype.toString.call(y).slice($,Q)}return te})});var Wo=O((Jh,$o)=>{var nu=Gr(),Xr=Ae(),ou=Ut();$o.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=ou(e).toLowerCase();if(!t.some(function(a){return s===a}))throw new nu(o+"object tested must be "+i+", but "+s+" given",void 0,n)}});var Qr=O((Xh,Go)=>{Go.exports=function(e,t){return t.length>4?t[4]:e._obj}});var Zr=O((Qh,Ko)=>{"use strict";var iu=Function.prototype.toString,su=/\s*function(?:\s|\s*\/\*[^(?:*\/)]+\*\/\s*)*([^\s\(\/]+)/;function au(r){if(typeof r!="function")return null;var e="";if(typeof Function.prototype.name>"u"&&typeof r.name>"u"){var t=iu.call(r).match(su);t&&(e=t[1])}else e=r.name;return e}Ko.exports=au});var Xo=O((pr,Jo)=>{(function(r,e){typeof pr=="object"&&typeof Jo<"u"?e(pr):typeof define=="function"&&define.amd?define(["exports"],e):(r=typeof globalThis<"u"?globalThis:r||self,e(r.loupe={}))})(pr,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 B(){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,$c=Lt===void 0?[]:Lt,Io=l.truncate,Wc=Io===void 0?1/0:Io,Do=l.stylize,Gc=Do===void 0?String:Do,Wr={showHidden:Boolean(b),depth:Number(D),colors:Boolean(K),customInspect:Boolean(he),showProxy:Boolean(Ee),maxArrayLength:Number($r),breakLength:Number(bt),truncate:Number(Wc),seen:$c,stylize:Gc};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 q(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 cr(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(cr(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 kc(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,No,`
|
|
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}
|
|
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 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 Ys=O((Hp,Zs)=>{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))}Zs.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 Hs=O(ft=>{var xl=Ys();ft.operation=function(r){var e=ft.timeouts(r);return new xl(e,{forever:r&&(r.forever||r.retries===1/0),unref:r&&r.unref,maxRetryTime:r&&r.maxRetryTime})};ft.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};ft.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};ft.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=ft.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 ta=O((ty,ea)=>{ea.exports=Hs()});var ya=O((om,pa)=>{pa.exports=Kn;var da=128,kl=127,Ll=~kl,Ul=Math.pow(2,31);function Kn(r,e,t){if(Number.MAX_SAFE_INTEGER&&r>Number.MAX_SAFE_INTEGER)throw Kn.bytes=0,new RangeError("Could not encode varint");e=e||[],t=t||0;for(var o=t;r>=Ul;)e[t++]=r&255|da,r/=128;for(;r⋘)e[t++]=r&255|da,r>>>=7;return e[t]=r|0,Kn.bytes=t-o+1,e}});var ba=O((im,ga)=>{ga.exports=Jn;var Rl=128,ma=127;function Jn(r,o){var t=0,o=o||0,n=0,i=o,s,a=r.length;do{if(i>=a||n>49)throw Jn.bytes=0,new RangeError("Could not decode varint");s=r[i++],t+=n<28?(s&ma)<<n:(s&ma)*Math.pow(2,n),n+=7}while(s>=Rl);return Jn.bytes=i-o,t}});var va=O((sm,wa)=>{var zl=Math.pow(2,7),Fl=Math.pow(2,14),Vl=Math.pow(2,21),$l=Math.pow(2,28),Wl=Math.pow(2,35),Gl=Math.pow(2,42),Kl=Math.pow(2,49),Jl=Math.pow(2,56),Xl=Math.pow(2,63);wa.exports=function(r){return r<zl?1:r<Fl?2:r<Vl?3:r<$l?4:r<Wl?5:r<Gl?6:r<Kl?7:r<Jl?8:r<Xl?9:10}});var Sr=O((am,xa)=>{xa.exports={encode:ya(),decode:ba(),encodingLength:va()}});var ro=O((xm,_a)=>{"use strict";function Da(r,e){for(let t in e)Object.defineProperty(r,t,{value:e[t],enumerable:!0,configurable:!0});return r}function fh(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 Da(r,t)}catch{t.message=r.message,t.stack=r.stack;let n=function(){};return n.prototype=Object.create(Object.getPrototypeOf(r)),Da(new n,t)}}_a.exports=fh});var La=O((Mm,ka)=>{"use strict";ka.exports=yh;function yh(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 Fa=O(za=>{"use strict";var Mr=za;Mr.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),Ra=new Array(123);for(Me=0;Me<64;)Ra[_t[Me]=Me<26?Me+65:Me<52?Me+71:Me<62?Me-4:Me-59|43]=Me++;var Me;Mr.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 Ua="invalid encoding";Mr.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=Ra[c])===void 0)throw Error(Ua);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(Ua);return o-n};Mr.test=function(e){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e)}});var $a=O((Dm,Va)=>{"use strict";Va.exports=Ir;function Ir(){this._listeners={}}Ir.prototype.on=function(e,t,o){return(this._listeners[e]||(this._listeners[e]=[])).push({fn:t,ctx:o||this}),this};Ir.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};Ir.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 Za=O((_m,Qa)=>{"use strict";Qa.exports=Wa(Wa);function Wa(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,Ga),r.writeFloatBE=e.bind(null,Ka);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,Ja),r.readFloatBE=t.bind(null,Xa)}(),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,Ga,0,4),r.writeDoubleBE=e.bind(null,Ka,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,Ja,0,4),r.readDoubleBE=t.bind(null,Xa,4,0)}(),r}function Ga(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 Ka(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 Ja(r,e){return(r[e]|r[e+1]<<8|r[e+2]<<16|r[e+3]<<24)>>>0}function Xa(r,e){return(r[e]<<24|r[e+1]<<16|r[e+2]<<8|r[e+3])>>>0}});var Ya=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 ec=O(Ha=>{"use strict";var io=Ha;io.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};io.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))};io.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 rc=O((jm,tc)=>{"use strict";tc.exports=mh;function mh(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 oc=O((qm,nc)=>{"use strict";nc.exports=se;var rr=dt();function se(r,e){this.lo=r>>>0,this.hi=e>>>0}var ht=se.zero=new se(0,0);ht.toNumber=function(){return 0};ht.zzEncode=ht.zzDecode=function(){return this};ht.length=function(){return 1};var gh=se.zeroHash="\0\0\0\0\0\0\0\0";se.fromNumber=function(e){if(e===0)return ht;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):ht};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 Qe=String.prototype.charCodeAt;se.fromHash=function(e){return e===gh?ht:new se((Qe.call(e,0)|Qe.call(e,1)<<8|Qe.call(e,2)<<16|Qe.call(e,3)<<24)>>>0,(Qe.call(e,4)|Qe.call(e,5)<<8|Qe.call(e,6)<<16|Qe.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 dt=O(so=>{"use strict";var _=so;_.asPromise=La();_.base64=Fa();_.EventEmitter=$a();_.float=Za();_.inquire=Ya();_.utf8=ec();_.pool=rc();_.LongBits=oc();_.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||so;_.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 ic(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=ic;_.lcFirst=function(e){return e.charAt(0).toLowerCase()+e.substring(1)};function sc(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&&ic(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=sc;_.ProtocolError=sc("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 uo=O((km,lc)=>{"use strict";lc.exports=ne;var Ce=dt(),co,uc=Ce.LongBits,bh=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 ac=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")},fc=function(){return Ce.Buffer?function(t){return(ne.create=function(n){return Ce.Buffer.isBuffer(n)?new co(n):ac(n)})(t)}:ac};ne.create=fc();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 ao(){var r=new uc(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 Dr(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 Dr(this.buf,this.pos+=4)};ne.prototype.sfixed32=function(){if(this.pos+4>this.len)throw Ie(this,4);return Dr(this.buf,this.pos+=4)|0};function cc(){if(this.pos+8>this.len)throw Ie(this,8);return new uc(Dr(this.buf,this.pos+=4),Dr(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 bh.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){co=r,ne.create=fc(),co._configure();var e=Ce.Long?"toLong":"toNumber";Ce.merge(ne.prototype,{int64:function(){return ao.call(this)[e](!1)},uint64:function(){return ao.call(this)[e](!0)},sint64:function(){return ao.call(this).zzDecode()[e](!1)},fixed64:function(){return cc.call(this)[e](!0)},sfixed64:function(){return cc.call(this)[e](!1)}})}});var yc=O((Lm,pc)=>{"use strict";pc.exports=pt;var dc=uo();(pt.prototype=Object.create(dc.prototype)).constructor=pt;var hc=dt();function pt(r){dc.call(this,r)}pt._configure=function(){hc.Buffer&&(pt.prototype._slice=hc.Buffer.prototype.slice)};pt.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))};pt._configure()});var go=O((Um,wc)=>{"use strict";wc.exports=V;var Pe=dt(),fo,_r=Pe.LongBits,mc=Pe.base64,gc=Pe.utf8;function nr(r,e,t){this.fn=r,this.len=e,this.next=void 0,this.val=t}function ho(){}function wh(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(ho,0,0),this.tail=this.head,this.states=null}var bc=function(){return Pe.Buffer?function(){return(V.create=function(){return new fo})()}:function(){return new V}};V.create=bc();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 po(r,e,t){e[t]=r&255}function vh(r,e,t){for(;r>127;)e[t++]=r&127|128,r>>>=7;e[t]=r}function yo(r,e){this.len=r,this.next=void 0,this.val=e}yo.prototype=Object.create(nr.prototype);yo.prototype.fn=vh;V.prototype.uint32=function(e){return this.len+=(this.tail=this.tail.next=new yo((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(mo,10,_r.fromNumber(e)):this.uint32(e)};V.prototype.sint32=function(e){return this.uint32((e<<1^e>>31)>>>0)};function mo(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=_r.from(e);return this._push(mo,t.length(),t)};V.prototype.int64=V.prototype.uint64;V.prototype.sint64=function(e){var t=_r.from(e).zzEncode();return this._push(mo,t.length(),t)};V.prototype.bool=function(e){return this._push(po,1,e?1:0)};function lo(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(lo,4,e>>>0)};V.prototype.sfixed32=V.prototype.fixed32;V.prototype.fixed64=function(e){var t=_r.from(e);return this._push(lo,4,t.lo)._push(lo,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 xh=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(po,1,0);if(Pe.isString(e)){var o=V.alloc(t=mc.length(e));mc.decode(e,o,0),e=o}return this.uint32(t)._push(xh,t,e)};V.prototype.string=function(e){var t=gc.length(e);return t?this.uint32(t)._push(gc.write,t,e):this._push(po,1,0)};V.prototype.fork=function(){return this.states=new wh(this),this.head=this.tail=new nr(ho,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(ho,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){fo=r,V.create=bc(),fo._configure()}});var Ec=O((Rm,xc)=>{"use strict";xc.exports=je;var vc=go();(je.prototype=Object.create(vc.prototype)).constructor=je;var Ze=dt();function je(){vc.call(this)}je._configure=function(){je.alloc=Ze._Buffer_allocUnsafe,je.writeBytesBuffer=Ze.Buffer&&Ze.Buffer.prototype instanceof Uint8Array&&Ze.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){Ze.isString(e)&&(e=Ze._Buffer_from(e,"base64"));var t=e.length>>>0;return this.uint32(t),t&&this._push(je.writeBytesBuffer,t,e),this};function Eh(r,e,t){r.length<40?Ze.utf8.write(r,e,t):e.utf8Write?e.utf8Write(r,t):e.write(r,t)}je.prototype.string=function(e){var t=Ze.Buffer.byteLength(e);return this.uint32(t),t&&this._push(Eh,t,e),this};je._configure()});var zh={};be(zh,{connectInteropTests:()=>ln,dhtInteropTests:()=>Bn,interopTests:()=>Rh,pubsubInteropTests:()=>Rn,relayInteropTests:()=>So,streamInteropTests:()=>$n});var Se=oe(ps(),1),Pd=Se.default.expect,Od=Se.default.version,Md=Se.default.Assertion,Id=Se.default.AssertionError,Dd=Se.default.util,_d=Se.default.config,Cd=Se.default.use,jd=Se.default.should,qd=Se.default.assert,Bd=Se.default.core,We=Se.default;var Ss=oe(ys(),1),Ts=oe(gs(),1),Ns=oe(bs(),1),Ps=oe(xs(),1),Os=oe(As(),1);We.use(Ss.default);We.use(Ts.default);We.use(Ns.default);We.use(Ps.default);We.use(Os.default);var W=We.expect,$d=We.assert;var Ge=oe(ke("path"),1),Ms=ke("url"),uf={},Et=Ge.default.dirname((0,Ms.fileURLToPath)(uf.url)),af={ed25519:Ge.default.join(Et,"go.ed25519.key"),rsa:Ge.default.join(Et,"go.rsa.key"),secp256k1:Ge.default.join(Et,"go.secp256k1.key")},cf={ed25519:Ge.default.join(Et,"js.ed25519.key"),rsa:Ge.default.join(Et,"js.rsa.key"),secp256k1:Ge.default.join(Et,"js.secp256k1.key")},fn={go:af,js:cf};function ln(r){let e=["ed25519","rsa","secp256k1"],t=["js","go"];for(let o of e)for(let n of t)for(let i of t)ff(`noise/${o}`,r,{type:n,noise:!0,key:fn.go[o]},{type:i,noise:!0,key:fn.js[o]})}function ff(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 mn={};be(mn,{identity:()=>mf});function lf(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 hf=lf,df=hf,Is=df;var Zd=new Uint8Array(0);var Ds=(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 _s=r=>new TextEncoder().encode(r),Cs=r=>new TextDecoder().decode(r);var hn=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")}},dn=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 qs(this,e)}},pn=class{constructor(e){this.decoders=e}or(e){return qs(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`)}},qs=(r,e)=>new pn({...r.decoders||{[r.prefix]:r},...e.decoders||{[e.prefix]:e}}),yn=class{constructor(e,t,o,n){this.name=e,this.prefix=t,this.baseEncode=o,this.baseDecode=n,this.encoder=new hn(e,t,o),this.decoder=new dn(e,t,n)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}},At=({name:r,prefix:e,encode:t,decode:o})=>new yn(r,e,t,o),Ke=({prefix:r,name:e,alphabet:t})=>{let{encode:o,decode:n}=Is(t,e);return At({prefix:r,name:e,encode:o,decode:i=>Te(n(i))})},pf=(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},yf=(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})=>At({prefix:e,name:r,encode(n){return yf(n,o,t)},decode(n){return pf(n,o,t,r)}});var mf=At({prefix:"\0",name:"identity",encode:r=>Cs(r),decode:r=>_s(r)});var gn={};be(gn,{base2:()=>gf});var gf=ee({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var bn={};be(bn,{base8:()=>bf});var bf=ee({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var wn={};be(wn,{base10:()=>wf});var wf=Ke({prefix:"9",name:"base10",alphabet:"0123456789"});var vn={};be(vn,{base16:()=>vf,base16upper:()=>xf});var vf=ee({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),xf=ee({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var xn={};be(xn,{base32:()=>Ue,base32hex:()=>Tf,base32hexpad:()=>Pf,base32hexpadupper:()=>Of,base32hexupper:()=>Nf,base32pad:()=>Af,base32padupper:()=>Sf,base32upper:()=>Ef,base32z:()=>Mf});var Ue=ee({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),Ef=ee({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),Af=ee({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),Sf=ee({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),Tf=ee({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),Nf=ee({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),Pf=ee({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),Of=ee({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),Mf=ee({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var En={};be(En,{base36:()=>If,base36upper:()=>Df});var If=Ke({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),Df=Ke({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var An={};be(An,{base58btc:()=>de,base58flickr:()=>_f});var de=Ke({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),_f=Ke({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var Sn={};be(Sn,{base64:()=>Cf,base64pad:()=>jf,base64url:()=>qf,base64urlpad:()=>Bf});var Cf=ee({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),jf=ee({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),qf=ee({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),Bf=ee({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var Tn={};be(Tn,{base256emoji:()=>zf});var Bs=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}"),kf=Bs.reduce((r,e,t)=>(r[t]=e,r),[]),Lf=Bs.reduce((r,e,t)=>(r[e.codePointAt(0)]=t,r),[]);function Uf(r){return r.reduce((e,t)=>(e+=kf[t],e),"")}function Rf(r){let e=[];for(let t of r){let o=Lf[t.codePointAt(0)];if(o===void 0)throw new Error(`Non-base256emoji character: ${t}`);e.push(o)}return new Uint8Array(e)}var zf=At({prefix:"\u{1F680}",name:"base256emoji",encode:Uf,decode:Rf});var In={};be(In,{sha256:()=>sl,sha512:()=>al});var Mn=oe(ke("crypto"),1);var Ff=Us,ks=128,Vf=127,$f=~Vf,Wf=Math.pow(2,31);function Us(r,e,t){e=e||[],t=t||0;for(var o=t;r>=Wf;)e[t++]=r&255|ks,r/=128;for(;r&$f;)e[t++]=r&255|ks,r>>>=7;return e[t]=r|0,Us.bytes=t-o+1,e}var Gf=Nn,Kf=128,Ls=127;function Nn(r,o){var t=0,o=o||0,n=0,i=o,s,a=r.length;do{if(i>=a)throw Nn.bytes=0,new RangeError("Could not decode varint");s=r[i++],t+=n<28?(s&Ls)<<n:(s&Ls)*Math.pow(2,n),n+=7}while(s>=Kf);return Nn.bytes=i-o,t}var Jf=Math.pow(2,7),Xf=Math.pow(2,14),Qf=Math.pow(2,21),Zf=Math.pow(2,28),Yf=Math.pow(2,35),Hf=Math.pow(2,42),el=Math.pow(2,49),tl=Math.pow(2,56),rl=Math.pow(2,63),nl=function(r){return r<Jf?1:r<Xf?2:r<Qf?3:r<Zf?4:r<Yf?5:r<Hf?6:r<el?7:r<tl?8:r<rl?9:10},ol={encode:Ff,decode:Gf,encodingLength:nl},il=ol,Wt=il;var Gt=(r,e=0)=>[Wt.decode(r,e),Wt.decode.bytes],St=(r,e,t=0)=>(Wt.encode(r,e,t),e),Tt=r=>Wt.encodingLength(r);var ct=(r,e)=>{let t=e.byteLength,o=Tt(r),n=o+Tt(t),i=new Uint8Array(n+t);return St(r,i,0),St(t,i,o),i.set(e,n),new Nt(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 Nt(t,n,s,e)},Rs=(r,e)=>{if(r===e)return!0;{let t=e;return r.code===t.code&&r.size===t.size&&t.bytes instanceof Uint8Array&&Ds(r.bytes,t.bytes)}},Nt=class{constructor(e,t,o,n){this.code=e,this.size=t,this.digest=o,this.bytes=n}};var On=({name:r,code:e,encode:t})=>new Pn(r,e,t),Pn=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?ct(this.code,t):t.then(o=>ct(this.code,o))}else throw Error("Unknown type, must be binary type")}};var sl=On({name:"sha2-256",code:18,encode:r=>Te(Mn.default.createHash("sha256").update(r).digest())}),al=On({name:"sha2-512",code:19,encode:r=>Te(Mn.default.createHash("sha512").update(r).digest())});var Dn={};be(Dn,{identity:()=>fl});var Fs=0,cl="identity",Vs=Te,ul=r=>ct(Fs,Vs(r)),fl={code:Fs,name:cl,encode:Vs,digest:ul};var wp=new TextEncoder,vp=new TextDecoder;var $s=(r,e)=>{let{bytes:t,version:o}=r;switch(o){case 0:return pl(t,_n(r),e||de.encoder);default:return yl(t,_n(r),e||Ue.encoder)}};var Ws=new WeakMap,_n=r=>{let e=Ws.get(r);if(e==null){let t=new Map;return Ws.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!==ml)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=ct(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&&Rs(e.multihash,o.multihash)}toString(e){return $s(this,e)}toJSON(){return{"/":$s(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||Gs(o,n,i.bytes))}else if(t[gl]===!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=Gs(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 Nt(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]=dl(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 _n(i).set(o,e),i}},dl=(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)]}}},pl=(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},yl=(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,ml=18,Gs=(r,e,t)=>{let o=Tt(r),n=o+Tt(e),i=new Uint8Array(n+t.byteLength);return St(r,i,0),St(e,i,o),i.set(t,n),i},gl=Symbol.for("@ipld/js-cid/CID");var Jt={...mn,...gn,...bn,...wn,...vn,...xn,...En,...An,...Sn,...Tn},Ip={...In,...Dn};function ut(r){return globalThis.Buffer!=null?new Uint8Array(r.buffer,r.byteOffset,r.byteLength):r}function Re(r=0){return globalThis.Buffer?.alloc!=null?ut(globalThis.Buffer.alloc(r)):new Uint8Array(r)}function ze(r=0){return globalThis.Buffer?.allocUnsafe!=null?ut(globalThis.Buffer.allocUnsafe(r)):new Uint8Array(r)}function Js(r,e,t,o){return{name:r,prefix:e,encoder:{name:r,prefix:e,encode:t},decoder:{decode:o}}}var Ks=Js("utf8","u",r=>"u"+new TextDecoder("utf8").decode(r),r=>new TextEncoder().encode(r.substring(1))),Cn=Js("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}),bl={utf8:Ks,"utf-8":Ks,hex:Jt.base16,latin1:Cn,ascii:Cn,binary:Cn,...Jt},wr=bl;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?ut(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 ut(t)}var vr={key:pe([ae("/pk/"),ae("muft89xjpybos8eas1vaq2xrbsx2vkll7is4ocy7pia5fsjlt3c2","base36")]),value:ae("080012a60230820122300d06092a864886f70d01010105000382010f003082010a0282010100c2588f998971dac9e3eef76a311bf9159505aff69ea3b664c55a36aa28ee08de1127228a4d431bb9c0840240c75f6e98a0843a78d945491a3ea5e1f7cee2bc71383510db5290702383975b7bffae9fb40c84cc1220fb4a7db862fffb0de42f8fd8fb33a17deb20f30e2d0f194791fe69355a392f77df35f101e08a2fc95b2c018768938814fcb52482f899f5e90a1905e8abbcdbb1647ad80a5b0417e1ce8320d64197a6ba3848926375c63adebabdf6eb82109bcadfee13b62bf922bbb6f74c1a26c9bc6122d1436787e0e6de3c152b1959701092abef84599f73eaedb2fcef9f87293e1bbe8e0fef3f1a7fd2e8b94c7e633f88473644a63cb948e4d25c54490203010001","hex")};function Xs(r){let e=["js","go"];for(let t of e)for(let o of e)wl(r,{type:t,dht:!0},{type:o,dht:!0})}function wl(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 Qs(r){let e=["js","go"];for(let t of e)for(let o of e)t==="go"&&o==="go"||vl(r,{type:t,dht:!0},{type:o,dht:!0})}function vl(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 na=oe(ta(),1),El=new Set(["Failed to fetch","NetworkError when attempting to fetch resource.","The Internet connection appears to be offline.","Network request failed","fetch failed"]),jn=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}},Al=(r,e,t)=>{let o=t.retries-(e-1);return r.attemptNumber=e,r.retriesLeft=o,r},Sl=r=>El.has(r),ra=r=>globalThis.DOMException===void 0?new Error(r):new DOMException(r);async function qn(r,e){return new Promise((t,o)=>{e={onFailedAttempt(){},retries:10,...e};let n=na.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 jn)n.stop(),o(s.originalError);else if(s instanceof TypeError&&!Sl(s.message))n.stop(),o(s);else{Al(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?ra("The operation was aborted."):e.signal.reason;o(i instanceof Error?i:ra(i))},{once:!0})})}function oa(r){let e=["js","go"];for(let t of e)for(let o of e)Tl(r,{type:t,dht:!0},{type:o,dht:!0})}function Tl(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 qn(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 Bn(r){Xs(r),Qs(r),oa(r)}async function lt(r){for await(let e of r)return e}var xr=class extends Error{constructor(e){super(e),this.name="TimeoutError"}},kn=class extends Error{constructor(e){super(),this.name="AbortError",this.message=e}},ia=r=>globalThis.DOMException===void 0?new kn(r):new DOMException(r),sa=r=>{let e=r.reason===void 0?ia("This operation was aborted."):r.reason;return e instanceof Error?e:ia(e)};function Ln(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(sa(w)),w.addEventListener("abort",()=>{u(sa(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 Un=Symbol("resolveValue");async function Je(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[Un])a(d[Un]);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 Ln(s,typeof o=="number"?{milliseconds:o}:o)}finally{clearTimeout(i)}}Je.resolveWith=r=>({[Un]:r});function aa(r){let e=["js","go"];for(let t of e)for(let o of e)Nl(r,{type:t,pubsub:!0,pubsubRouter:"floodsub"},{type:o,pubsub:!0,pubsubRouter:"floodsub"})}function Nl(r,e,t){describe("pubsub.floodSub",()=>{let o,n;before(async function(){this.timeout(20*1e3),o=await Promise.all([r.spawn(e),r.spawn(t)]);let[i,s]=o;n=await s.client.identify(),await i.client.connect(n.peerId,n.addrs)}),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="test-topic",s=ae("test-data"),[a,c]=o,u=c.client.pubsub.subscribe(i),d=async()=>{let q=await lt(u);W(q).to.exist(),W(q).to.have.property("data").that.equalBytes(s)},w=async()=>{await Je(async()=>(await o[0].client.pubsub.getSubscribers(i)).map(k=>k.toString()).includes(n.peerId.toString())),await a.client.pubsub.publish(i,s)};return await Promise.all([d(),w()])})})}function ca(r){let e=["js","go"];for(let t of e)for(let o of e)Pl(r,{type:t,pubsub:!0,pubsubRouter:"gossipsub"},{type:o,pubsub:!0,pubsubRouter:"gossipsub"})}function Pl(r,e,t){describe("pubsub.gossipsub",()=>{let o,n;before(async function(){this.timeout(20*1e3),o=await Promise.all([r.spawn(e),r.spawn(t)]),n=await o[1].client.identify(),await o[0].client.connect(n.peerId,n.addrs)}),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="test-topic",s=ae("test-data"),a=o[1].client.pubsub.subscribe(i),c=async()=>{let d=await lt(a);W(d).to.exist(),W(d).to.have.property("data").that.equalBytes(s)},u=async()=>{await Je(async()=>(await o[0].client.pubsub.getSubscribers(i)).map(w=>w.toString()).includes(n.peerId.toString())),await o[0].client.pubsub.publish(i,s)};return await Promise.all([c(),u()])})})}function ua(r){let e=["js","go"];for(let t of e)for(let o of e)Ol(r,{type:t,pubsub:!0,pubsubRouter:"floodsub"},{type:o,pubsub:!0,pubsubRouter:"gossipsub"})}function Ol(r,e,t){describe("pubsub.hybrid",()=>{let o,n;before(async function(){this.timeout(20*1e3),o=await Promise.all([r.spawn(e),r.spawn(t)]),n=await o[1].client.identify(),await o[0].client.connect(n.peerId,n.addrs)}),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="test-topic",s=ae("test-data"),a=o[1].client.pubsub.subscribe(i),c=async()=>{let d=await lt(a);W(d).to.exist(),W(d).to.have.property("data").that.equalBytes(s)},u=async()=>{await Je(async()=>(await o[0].client.pubsub.getSubscribers(i)).map(w=>w.toString()).includes(n.peerId.toString())),await o[0].client.pubsub.publish(i,s)};return await Promise.all([c(),u()])})})}async function Rn(r){aa(r),ca(r),ua(r)}var Er=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 Er(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 Er(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 Ml(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 Ml(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*zn(...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 Il=(...r)=>{let e;for(;r.length>0;)e=r.shift()(e);return e},fa=r=>r!=null&&(typeof r[Symbol.asyncIterator]=="function"||typeof r[Symbol.iterator]=="function"||typeof r.next=="function"),Fn=r=>r!=null&&typeof r.sink=="function"&&fa(r.source),Dl=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)}),zn(o,async function*(){yield*r.source,o.end()}())}return r.source};function Qt(r,...e){if(Fn(r)){let o=r;r=()=>o.source}else if(fa(r)){let o=r;r=()=>o}let t=[r,...e];if(t.length>1&&Fn(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++)Fn(t[o])&&(t[o]=Dl(t[o]));return Il(...t)}function Zt(){let r={};return r.promise=new Promise((e,t)=>{r.resolve=e,r.reject=t}),r}function Vn(r,e){let t=["js","go"];for(let o of t)for(let n of t)_l(r,e,{type:o,muxer:e},{type:n,muxer:e})}function _l(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 $n(r){Vn(r,"mplex"),Vn(r,"yamux")}var Xe=ke("node:net");function Ar(r){return Boolean((0,Xe.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 la=Xe.isIPv4,Cl=Xe.isIPv6,Wn=function(r){let e=0;if(r=r.toString().trim(),la(r)){let t=new Uint8Array(e+4);return r.split(/\./g).forEach(o=>{t[e++]=parseInt(o,10)&255}),t}if(Cl(r)){let t=r.split(":",8),o;for(o=0;o<t.length;o++){let i=la(t[o]),s;i&&(s=Wn(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")},ha=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={},Gn={},ql=[[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"]];ql.forEach(r=>{let e=Bl(...r);Gn[e.code]=e,Yt[e.name]=e});function Bl(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(Gn[r]!=null)return Gn[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(Sr(),1);function Na(r,e){switch(H(r).code){case 4:case 41:return Zl(e);case 42:return Sa(e);case 6:case 273:case 33:case 132:return Oa(e).toString();case 53:case 54:case 55:case 56:case 400:case 777:return Sa(e);case 421:return th(e);case 444:return Ta(e);case 445:return Ta(e);case 466:return eh(e);default:return ye(e,"base16")}}function Pa(r,e){switch(H(r).code){case 4:return Ea(e);case 41:return Ea(e);case 42:return Aa(e);case 6:case 273:case 33:case 132:return Qn(parseInt(e,10));case 53:case 54:case 55:case 56:case 400:case 777:return Aa(e);case 421:return Yl(e);case 444:return rh(e);case 445:return nh(e);case 466:return Hl(e);default:return ae(e,"base16")}}var Xn=Object.values(Jt).map(r=>r.decoder),Ql=function(){let r=Xn[0].or(Xn[1]);return Xn.slice(2).forEach(e=>r=r.or(e)),r}();function Ea(r){if(!Ar(r))throw new Error("invalid ip address");return Wn(r)}function Zl(r){let e=ha(r,0,r.length);if(e==null)throw new Error("ipBuff is required");if(!Ar(e))throw new Error("invalid ip address");return e}function Qn(r){let e=new ArrayBuffer(2);return new DataView(e).setUint16(0,r),new Uint8Array(e)}function Oa(r){return new DataView(r.buffer).getUint16(r.byteOffset)}function Aa(r){let e=ae(r),t=Uint8Array.from(_e.default.encode(e.length));return pe([t,e],t.length+e.length)}function Sa(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 Yl(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 Hl(r){let e=Ql.decode(r),t=Uint8Array.from(_e.default.encode(e.length));return pe([t,e],t.length+e.length)}function eh(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 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 ye(t,"base58btc")}function rh(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=Qn(o);return pe([t,n],t.length+n.length)}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!==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=Qn(o);return pe([t,n],t.length+n.length)}function Ta(r){let e=r.slice(0,r.length-2),t=r.slice(r.length-2),o=ye(e,"base32"),n=Oa(t);return`${o}:${n}`}var It=oe(Sr(),1);function oh(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 Ia("invalid address: "+r);if(i.path===!0){e.push([n,to(t.slice(o).join("/"))]);break}e.push([n,t[o]])}return e}function ih(r){let e=[];return r.map(t=>{let o=Pr(t);return e.push(o.name),t.length>1&&t[1]!=null&&e.push(t[1]),null}),to(e.join("/"))}function sh(r){return r.map(e=>{Array.isArray(e)||(e=[e]);let t=Pr(e);return e.length>1?[t.code,Pa(t.code,e[1])]:[t.code]})}function Zn(r){return r.map(e=>{let t=Pr(e);return e[1]!=null?[t.code,Na(t.code,e[1])]:[t.code]})}function Yn(r){return Nr(pe(r.map(e=>{let t=Pr(e),o=Uint8Array.from(It.default.encode(t.code));return e.length>1&&e[1]!=null&&(o=pe([o,e[1]])),o})))}function Hn(r,e){return r.size>0?r.size/8:r.size===0?0:It.default.decode(e)+(It.default.decode.bytes??0)}function Tr(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=Hn(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 Ia("Invalid address Uint8Array: "+ye(r,"base16"));e.push([o,a])}return e}function eo(r){let e=Tr(r),t=Zn(e);return ih(t)}function ah(r){r=to(r);let e=oh(r),t=sh(e);return Yn(t)}function Ma(r){return ah(r)}function Nr(r){let e=ch(r);if(e!=null)throw e;return Uint8Array.from(r)}function ch(r){try{Tr(r)}catch(e){return e}}function to(r){return"/"+r.trim().split("/").filter(e=>e).join("/")}function Ia(r){return new Error("Error parsing address: "+r)}function Pr(r){return H(r[0])}var oo=oe(Sr(),1);var ja=oe(ro(),1);function Or(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)},no=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,Ca,lh=Symbol.for("nodejs.util.inspect.custom"),hh=[H("dns").code,H("dns4").code,H("dns6").code,H("dnsaddr").code],dh=new Map,qa=Symbol.for("@multiformats/js-multiaddr/multiaddr");function ph(r){return Boolean(r?.[qa])}var Fe=class{constructor(e){if(Ht.set(this,void 0),er.set(this,void 0),tr.set(this,void 0),this[Ca]=!0,e==null&&(e=""),e instanceof Uint8Array)this.bytes=Nr(e);else if(typeof e=="string"){if(e.length>0&&e.charAt(0)!=="/")throw new Error(`multiaddr "${e}" must start with a "/"`);this.bytes=Ma(e)}else if(ph(e))this.bytes=Nr(e.bytes);else throw new Error("addr must be a string, Buffer, or another Multiaddr")}toString(){return Dt(this,Ht,"f")==null&&no(this,Ht,eo(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??""}`),hh.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=oo.default.decode(t,o),i=oo.default.decode.bytes??0,s=H(n),a=Hn(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&&no(this,er,Tr(this.bytes),"f"),Dt(this,er,"f")}stringTuples(){return Dt(this,tr,"f")==null&&no(this,tr,Zn(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(Yn(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 Or(this.bytes,e.bytes)}async resolve(e){let t=this.protos().find(i=>i.resolvable);if(t==null)return[this];let o=dh.get(t.name);if(o==null)throw(0,ja.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,Ca=qa,lh)](){return`Multiaddr(${eo(this.bytes)})`}};function Ba(r){return new Fe(r)}var bo=oe(uo(),1),Ac=oe(yc(),1),Sc=oe(dt(),1),wo=oe(go(),1),Tc=oe(Ec(),1);function Ah(){Sc.default._configure(),bo.default._configure(Ac.default),wo.default._configure(Tc.default)}Ah();var Nc=["uint64","int64","sint64","fixed64","sfixed64"];function Sh(r){for(let e of Nc){if(r[e]==null)continue;let t=r[e];r[e]=function(){return BigInt(t.call(this).toString())}}return r}function vo(r){return Sh(new bo.default(r))}function Th(r){for(let e of Nc){if(r[e]==null)continue;let t=r[e];r[e]=function(o){return t.call(this,o.toString())}}return r}function xo(){return Th(wo.default.create())}function Ye(r,e){let t=vo(r instanceof Uint8Array?r:r.subarray());return e.decode(t)}function He(r,e){let t=xo();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 Cr(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 Cr("enum",Ct.VARINT,t,o)}function et(r,e){return Cr("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=et((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),jr.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=jr.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=>He(n,r.codec()),r.decode=n=>Ye(n,r.codec())})(jt||(jt={}));var Pc;(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=et((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=>He(n,r.codec()),r.decode=n=>Ye(n,r.codec())})(Pc||(Pc={}));var qt;(function(r){let e;r.codec=()=>(e==null&&(e=et((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=>He(t,r.codec()),r.decode=t=>Ye(t,r.codec())})(qt||(qt={}));var jr;(function(r){let e;r.codec=()=>(e==null&&(e=et((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=>He(t,r.codec()),r.decode=t=>Ye(t,r.codec())})(jr||(jr={}));var Bt;(function(r){let e;r.codec=()=>(e==null&&(e=et((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=>He(t,r.codec()),r.decode=t=>Ye(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 Eo;(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"})(Eo||(Eo={}));(function(r){r.codec=()=>or(Eo)})(qe||(qe={}));var Oc;(function(r){let e;r.codec=()=>(e==null&&(e=et((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=>He(t,r.codec()),r.decode=t=>Ye(t,r.codec())})(Oc||(Oc={}));var Ic=Symbol.for("@achingbrain/uint8arraylist");function Mc(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 qr(r){return Boolean(r?.[Ic])}var me=class{constructor(...e){Object.defineProperty(this,Ic,{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(qr(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(qr(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=Mc(this.bufs,e);return t.buf[t.index]}set(e,t){let o=Mc(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(qr(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(!qr(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(!Or(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 Dc(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 Br(r){let e=Mt(),t=Dc(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 kr(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 _c=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=kr(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>_c&&(n=0,++o>_c&&(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=kr(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 Nh=Math.pow(2,7),Ph=Math.pow(2,14),Oh=Math.pow(2,21),Mh=Math.pow(2,28),Ih=Math.pow(2,35),Dh=Math.pow(2,42),_h=Math.pow(2,49),Ch=Math.pow(2,56),jh=Math.pow(2,63),yt={encodingLength(r){return r<Nh?1:r<Ph?2:r<Oh?3:r<Mh?4:r<Ih?5:r<Dh?6:r<_h?7:r<Ch?8:r<jh?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(yt.encodingLength(r))),ve.fromNumber(r).toBytes(e,t),e},decode(r,e=0){return ve.fromBytes(r,e).toNumber(!0)}};function Cc(r){return globalThis?.Buffer?.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(r):new Uint8Array(r)}var Lr=r=>{let e=yt.encodingLength(r),t=Cc(e);return yt.encode(r,t),Lr.bytes=e,t};Lr.bytes=0;function Ur(r){r=r??{};let e=r.lengthEncoder??Lr;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}}}Ur.single=(r,e)=>{e=e??{};let t=e.lengthEncoder??Lr;return new me(t(r.byteLength),r)};var ir=oe(ro(),1),qh=8,Bh=1024*1024*4,mt;(function(r){r[r.LENGTH=0]="LENGTH",r[r.DATA=1]="DATA"})(mt||(mt={}));var Ao=r=>{let e=yt.decode(r);return Ao.bytes=yt.encodingLength(e),e};Ao.bytes=0;function sr(r){return async function*(t){let o=new me,n=mt.LENGTH,i=-1,s=r?.lengthDecoder??Ao,a=r?.maxLengthLength??qh,c=r?.maxDataLength??Bh;for await(let u of t)for(o.append(u);o.byteLength>0;){if(n===mt.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=mt.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===mt.DATA){if(o.byteLength<i)break;let d=o.sublist(0,i);o.consume(i),r?.onData!=null&&r.onData(d),yield d,n=mt.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 jc(r,e={}){let t=Br(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(Ur.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 Lh="/libp2p/circuit/relay/0.2.0/hop",qc=async(r,e,t)=>{let o=await r.client.openStream(e,Lh),n=jc(o);return n.writePB({type:jt.Type.RESERVE,...t??{}},jt),await n.readPB(jt)},Rr={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 So(r){let e=["go","js"];e.forEach(t=>{e.forEach(o=>{e.forEach(n=>{Uh(r,t,o,n)})})})}function Uh(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=Ba(`${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 qc(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(Rr.protocol,Rr.handler);let k=await i.client.openStream(c.peerId,Rr.protocol),N=ae("test"),E=Br(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 Rh(r){ln(r),So(r),await Bn(r),await Rn(r),await $n(r)}return Zc(zh);})();
|
|
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 bs=O((Rd,gs)=>{"use strict";function af(r,e){let t="__deferred__",o=e.flag,n=r.Assertion;function i(E,I){let q=o(E,t)||[];q.push(I),o(E,t,q)}function s(E){let I=o(E,t)||[],q=E,$;for(o(E,t,void 0);$=I.shift();){let Q=$.call(q);Q!==void 0&&(q=Q)}return q}function a(E,I){let q=o(E,t);q&&q.length>0&&q.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 q=s(this);return I.apply(q,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 q=s(this);return I.apply(q,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 B=e.addProperty;e.addProperty=function(E,I,q){B.apply(e,arguments),c(I,q)};let k=e.addMethod;e.addMethod=function(E,I){k.apply(e,arguments),n.overwriteMethod(I,function(q){return function(){let $=s(this);return q.apply($,arguments)}})};let N=e.addChainableMethod;e.addChainableMethod=function(E,I){let q=!0;Object.prototype.hasOwnProperty.call(n.prototype,I)&&(q=!1),N.apply(e,arguments),q&&n.overwriteChainableMethod(I,function($){return function(){let Q=s(this);return $.apply(Q,arguments)}},function($){return function(){return i(this,$),this}})}}gs.exports=af});var ws=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 Es=O((Fd,xs)=>{"use strict";function vs(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}xs.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&&vs(o,function(i,s){return i===parseInt(t.substring(2*s,2*s+2),16)}):n=t.length===o.length&&vs(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 Ss=O((As,fn)=>{(function(r){typeof ke=="function"&&typeof As=="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 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){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=a.client.pubsub.subscribe(n),u=async()=>{let w=await ft(c);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=await o[1].client.identify();await o[0].client.connect(n.peerId,n.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=o[1].client.pubsub.subscribe(n),a=async()=>{let u=await ft(s);W(u).to.exist(),W(u).to.have.property("data").that.equalBytes(i)},c=async()=>{await Pt(n,o[0],o[1]),await o[0].client.pubsub.publish(n,i)};return await Promise.all([a(),c()])})})}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=await o[1].client.identify();await o[0].client.connect(n.peerId,n.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=o[1].client.pubsub.subscribe(n),a=async()=>{let u=await ft(s);W(u).to.exist(),W(u).to.have.property("data").that.equalBytes(i)},c=async()=>{await Pt(n,o[0],o[1]),await o[0].client.pubsub.publish(n,i)};return await Promise.all([a(),c()])})})}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);})();
|
|
8
8
|
/*! Bundled license information:
|
|
9
9
|
|
|
10
10
|
assertion-error/index.js:
|