/**
 * Minified by jsDelivr using Terser v5.48.0.
 * Original file: /npm/@araviel/nftst-metaplex-auth@1.2.0/dist/index.browser.js
 *
 * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
 */
var __create=Object.create,__defProp=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__getOwnPropNames=Object.getOwnPropertyNames,__getProtoOf=Object.getPrototypeOf,__hasOwnProp=Object.prototype.hasOwnProperty,__markAsModule=e=>__defProp(e,"__esModule",{value:!0}),__require=(e=>"undefined"!=typeof require?require:"undefined"!=typeof Proxy?new Proxy(e,{get:(e,t)=>("undefined"!=typeof require?require:e)[t]}):e)(function(e){if("undefined"!=typeof require)return require.apply(this,arguments);throw new Error('Dynamic require of "'+e+'" is not supported')}),__esm=(e,t)=>function(){return e&&(t=(0,e[Object.keys(e)[0]])(e=0)),t},__commonJS=(e,t)=>function(){return t||(0,e[Object.keys(e)[0]])((t={exports:{}}).exports,t),t.exports},__export=(e,t)=>{for(var r in __markAsModule(e),t)__defProp(e,r,{get:t[r],enumerable:!0})},__reExport=(e,t,r)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let n of __getOwnPropNames(t))__hasOwnProp.call(e,n)||"default"===n||__defProp(e,n,{get:()=>t[n],enumerable:!(r=__getOwnPropDesc(t,n))||r.enumerable});return e},__toModule=e=>__reExport(__markAsModule(__defProp(null!=e?__create(__getProtoOf(e)):{},"default",e&&e.__esModule&&"default"in e?{get:()=>e.default,enumerable:!0}:{value:e,enumerable:!0})),e),src,_brrp__multiformats_scope_baseX,base_x_default;function base(e,t){if(e.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n<r.length;n++)r[n]=255;for(var o=0;o<e.length;o++){var i=e.charAt(o),s=i.charCodeAt(0);if(255!==r[s])throw new TypeError(i+" is ambiguous");r[s]=o}var a=e.length,c=e.charAt(0),u=Math.log(a)/Math.log(256),l=Math.log(256)/Math.log(a);function d(e){if("string"!=typeof e)throw new TypeError("Expected String");if(0===e.length)return new Uint8Array;var t=0;if(" "!==e[t]){for(var n=0,o=0;e[t]===c;)n++,t++;for(var i=(e.length-t)*u+1>>>0,s=new Uint8Array(i);e[t];){var l=r[e.charCodeAt(t)];if(255===l)return;for(var d=0,f=i-1;(0!==l||d<o)&&-1!==f;f--,d++)l+=a*s[f]>>>0,s[f]=l%256>>>0,l=l/256>>>0;if(0!==l)throw new Error("Non-zero carry");o=d,t++}if(" "!==e[t]){for(var h=i-o;h!==i&&0===s[h];)h++;for(var p=new Uint8Array(n+(i-h)),m=n;h!==i;)p[m++]=s[h++];return p}}}return{encode:function(t){if(t instanceof Uint8Array||(ArrayBuffer.isView(t)?t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength):Array.isArray(t)&&(t=Uint8Array.from(t))),!(t instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(0===t.length)return"";for(var r=0,n=0,o=0,i=t.length;o!==i&&0===t[o];)o++,r++;for(var s=(i-o)*l+1>>>0,u=new Uint8Array(s);o!==i;){for(var d=t[o],f=0,h=s-1;(0!==d||f<n)&&-1!==h;h--,f++)d+=256*u[h]>>>0,u[h]=d%a>>>0,d=d/a>>>0;if(0!==d)throw new Error("Non-zero carry");n=f,o++}for(var p=s-n;p!==s&&0===u[p];)p++;for(var m=c.repeat(r);p<s;++p)m+=e.charAt(u[p]);return m},decodeUnsafe:d,decode:function(e){var r=d(e);if(r)return r;throw new Error(`Non-${t} character`)}}}var init_base_x=__esm({"node_modules/multiformats/esm/vendor/base-x.js"(){base_x_default=_brrp__multiformats_scope_baseX=src=base}}),bytes_exports={},empty,toHex,fromHex,equals,coerce,isBinary,fromString,toString;__export(bytes_exports,{coerce:()=>coerce,empty:()=>empty,equals:()=>equals,fromHex:()=>fromHex,fromString:()=>fromString,isBinary:()=>isBinary,toHex:()=>toHex,toString:()=>toString});var init_bytes=__esm({"node_modules/multiformats/esm/src/bytes.js"(){empty=new Uint8Array(0),toHex=e=>e.reduce((e,t)=>e+t.toString(16).padStart(2,"0"),""),fromHex=e=>{const t=e.match(/../g);return t?new Uint8Array(t.map(e=>parseInt(e,16))):empty},equals=(e,t)=>{if(e===t)return!0;if(e.byteLength!==t.byteLength)return!1;for(let r=0;r<e.byteLength;r++)if(e[r]!==t[r])return!1;return!0},coerce=e=>{if(e instanceof Uint8Array&&"Uint8Array"===e.constructor.name)return e;if(e instanceof ArrayBuffer)return new Uint8Array(e);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);throw new Error("Unknown type, must be binary type")},isBinary=e=>e instanceof ArrayBuffer||ArrayBuffer.isView(e),fromString=e=>(new TextEncoder).encode(e),toString=e=>(new TextDecoder).decode(e)}}),Encoder,Decoder,ComposedDecoder,or,Codec,from,baseX,decode,encode,rfc4648,init_base=__esm({"node_modules/multiformats/esm/src/bases/base.js"(){init_base_x(),init_bytes(),Encoder=class{constructor(e,t,r){this.name=e,this.prefix=t,this.baseEncode=r}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},Decoder=class{constructor(e,t,r){this.name=e,this.prefix=t,this.baseDecode=r}decode(e){if("string"==typeof e){if(e[0]===this.prefix)return this.baseDecode(e.slice(1));throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`)}throw Error("Can only multibase decode strings")}or(e){return or(this,e)}},ComposedDecoder=class{constructor(e){this.decoders=e}or(e){return or(this,e)}decode(e){const t=e[0],r=this.decoders[t];if(r)return r.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}},or=(e,t)=>new ComposedDecoder({...e.decoders||{[e.prefix]:e},...t.decoders||{[t.prefix]:t}}),Codec=class{constructor(e,t,r,n){this.name=e,this.prefix=t,this.baseEncode=r,this.baseDecode=n,this.encoder=new Encoder(e,t,r),this.decoder=new Decoder(e,t,n)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}},from=({name:e,prefix:t,encode:r,decode:n})=>new Codec(e,t,r,n),baseX=({prefix:e,name:t,alphabet:r})=>{const{encode:n,decode:o}=base_x_default(r,t);return from({prefix:e,name:t,encode:n,decode:e=>coerce(o(e))})},decode=(e,t,r,n)=>{const o={};for(let e=0;e<t.length;++e)o[t[e]]=e;let i=e.length;for(;"="===e[i-1];)--i;const s=new Uint8Array(i*r/8|0);let a=0,c=0,u=0;for(let t=0;t<i;++t){const i=o[e[t]];if(void 0===i)throw new SyntaxError(`Non-${n} character`);c=c<<r|i,a+=r,a>=8&&(a-=8,s[u++]=255&c>>a)}if(a>=r||255&c<<8-a)throw new SyntaxError("Unexpected end of data");return s},encode=(e,t,r)=>{const n="="===t[t.length-1],o=(1<<r)-1;let i="",s=0,a=0;for(let n=0;n<e.length;++n)for(a=a<<8|e[n],s+=8;s>r;)s-=r,i+=t[o&a>>s];if(s&&(i+=t[o&a<<r-s]),n)for(;i.length*r&7;)i+="=";return i},rfc4648=({name:e,prefix:t,bitsPerChar:r,alphabet:n})=>from({prefix:t,name:e,encode:e=>encode(e,n,r),decode:t=>decode(t,n,r,e)})}}),base58_exports={},base58btc,base58flickr;__export(base58_exports,{base58btc:()=>base58btc,base58flickr:()=>base58flickr});var init_base58=__esm({"node_modules/multiformats/esm/src/bases/base58.js"(){init_base(),base58btc=baseX({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),base58flickr=baseX({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"})}}),require_encode=__commonJS({"node_modules/varint/encode.js"(e,t){t.exports=function e(t,n,o){if(Number.MAX_SAFE_INTEGER&&t>Number.MAX_SAFE_INTEGER)throw e.bytes=0,new RangeError("Could not encode varint");n=n||[];var i=o=o||0;for(;t>=r;)n[o++]=255&t|128,t/=128;for(;-128&t;)n[o++]=255&t|128,t>>>=7;return n[o]=0|t,e.bytes=o-i+1,n};var r=Math.pow(2,31)}}),require_decode=__commonJS({"node_modules/varint/decode.js"(e,t){t.exports=function e(t,r){var n,o=0,i=0,s=r=r||0,a=t.length;do{if(s>=a||i>49)throw e.bytes=0,new RangeError("Could not decode varint");n=t[s++],o+=i<28?(127&n)<<i:(127&n)*Math.pow(2,i),i+=7}while(n>=128);return e.bytes=s-r,o}}}),require_length=__commonJS({"node_modules/varint/length.js"(e,t){var r=Math.pow(2,7),n=Math.pow(2,14),o=Math.pow(2,21),i=Math.pow(2,28),s=Math.pow(2,35),a=Math.pow(2,42),c=Math.pow(2,49),u=Math.pow(2,56),l=Math.pow(2,63);t.exports=function(e){return e<r?1:e<n?2:e<o?3:e<i?4:e<s?5:e<a?6:e<c?7:e<u?8:e<l?9:10}}}),require_varint=__commonJS({"node_modules/varint/index.js"(e,t){t.exports={encode:require_encode(),decode:require_decode(),encodingLength:require_length()}}}),require_crypto=__commonJS({"(disabled):crypto"(){}}),require_nacl_fast=__commonJS({"node_modules/@dashkite/tweetnacl/nacl-fast.js"(e,t){!function(e){"use strict";var t=function(e){var t,r=new Float64Array(16);if(e)for(t=0;t<e.length;t++)r[t]=e[t];return r},r=function(){throw new Error("no PRNG")},n=new Uint8Array(16),o=new Uint8Array(32);o[0]=9;var i=t(),s=t([1]),a=t([56129,1]),c=t([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),u=t([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),l=t([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),d=t([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),f=t([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function h(e,t,r,n){e[t]=r>>24&255,e[t+1]=r>>16&255,e[t+2]=r>>8&255,e[t+3]=255&r,e[t+4]=n>>24&255,e[t+5]=n>>16&255,e[t+6]=n>>8&255,e[t+7]=255&n}function p(e,t,r,n,o){var i,s=0;for(i=0;i<o;i++)s|=e[t+i]^r[n+i];return(1&s-1>>>8)-1}function m(e,t,r,n){return p(e,t,r,n,16)}function y(e,t,r,n){return p(e,t,r,n,32)}function _(e,t,r,n){!function(e,t,r,n){for(var o,i=255&n[0]|(255&n[1])<<8|(255&n[2])<<16|(255&n[3])<<24,s=255&r[0]|(255&r[1])<<8|(255&r[2])<<16|(255&r[3])<<24,a=255&r[4]|(255&r[5])<<8|(255&r[6])<<16|(255&r[7])<<24,c=255&r[8]|(255&r[9])<<8|(255&r[10])<<16|(255&r[11])<<24,u=255&r[12]|(255&r[13])<<8|(255&r[14])<<16|(255&r[15])<<24,l=255&n[4]|(255&n[5])<<8|(255&n[6])<<16|(255&n[7])<<24,d=255&t[0]|(255&t[1])<<8|(255&t[2])<<16|(255&t[3])<<24,f=255&t[4]|(255&t[5])<<8|(255&t[6])<<16|(255&t[7])<<24,h=255&t[8]|(255&t[9])<<8|(255&t[10])<<16|(255&t[11])<<24,p=255&t[12]|(255&t[13])<<8|(255&t[14])<<16|(255&t[15])<<24,m=255&n[8]|(255&n[9])<<8|(255&n[10])<<16|(255&n[11])<<24,y=255&r[16]|(255&r[17])<<8|(255&r[18])<<16|(255&r[19])<<24,_=255&r[20]|(255&r[21])<<8|(255&r[22])<<16|(255&r[23])<<24,g=255&r[24]|(255&r[25])<<8|(255&r[26])<<16|(255&r[27])<<24,b=255&r[28]|(255&r[29])<<8|(255&r[30])<<16|(255&r[31])<<24,w=255&n[12]|(255&n[13])<<8|(255&n[14])<<16|(255&n[15])<<24,v=i,E=s,S=a,k=c,T=u,$=l,x=d,A=f,j=h,C=p,N=m,I=y,P=_,B=g,D=b,O=w,U=0;U<20;U+=2)v^=(o=(P^=(o=(j^=(o=(T^=(o=v+P|0)<<7|o>>>25)+v|0)<<9|o>>>23)+T|0)<<13|o>>>19)+j|0)<<18|o>>>14,$^=(o=(E^=(o=(B^=(o=(C^=(o=$+E|0)<<7|o>>>25)+$|0)<<9|o>>>23)+C|0)<<13|o>>>19)+B|0)<<18|o>>>14,N^=(o=(x^=(o=(S^=(o=(D^=(o=N+x|0)<<7|o>>>25)+N|0)<<9|o>>>23)+D|0)<<13|o>>>19)+S|0)<<18|o>>>14,O^=(o=(I^=(o=(A^=(o=(k^=(o=O+I|0)<<7|o>>>25)+O|0)<<9|o>>>23)+k|0)<<13|o>>>19)+A|0)<<18|o>>>14,v^=(o=(k^=(o=(S^=(o=(E^=(o=v+k|0)<<7|o>>>25)+v|0)<<9|o>>>23)+E|0)<<13|o>>>19)+S|0)<<18|o>>>14,$^=(o=(T^=(o=(A^=(o=(x^=(o=$+T|0)<<7|o>>>25)+$|0)<<9|o>>>23)+x|0)<<13|o>>>19)+A|0)<<18|o>>>14,N^=(o=(C^=(o=(j^=(o=(I^=(o=N+C|0)<<7|o>>>25)+N|0)<<9|o>>>23)+I|0)<<13|o>>>19)+j|0)<<18|o>>>14,O^=(o=(D^=(o=(B^=(o=(P^=(o=O+D|0)<<7|o>>>25)+O|0)<<9|o>>>23)+P|0)<<13|o>>>19)+B|0)<<18|o>>>14;v=v+i|0,E=E+s|0,S=S+a|0,k=k+c|0,T=T+u|0,$=$+l|0,x=x+d|0,A=A+f|0,j=j+h|0,C=C+p|0,N=N+m|0,I=I+y|0,P=P+_|0,B=B+g|0,D=D+b|0,O=O+w|0,e[0]=v>>>0&255,e[1]=v>>>8&255,e[2]=v>>>16&255,e[3]=v>>>24&255,e[4]=E>>>0&255,e[5]=E>>>8&255,e[6]=E>>>16&255,e[7]=E>>>24&255,e[8]=S>>>0&255,e[9]=S>>>8&255,e[10]=S>>>16&255,e[11]=S>>>24&255,e[12]=k>>>0&255,e[13]=k>>>8&255,e[14]=k>>>16&255,e[15]=k>>>24&255,e[16]=T>>>0&255,e[17]=T>>>8&255,e[18]=T>>>16&255,e[19]=T>>>24&255,e[20]=$>>>0&255,e[21]=$>>>8&255,e[22]=$>>>16&255,e[23]=$>>>24&255,e[24]=x>>>0&255,e[25]=x>>>8&255,e[26]=x>>>16&255,e[27]=x>>>24&255,e[28]=A>>>0&255,e[29]=A>>>8&255,e[30]=A>>>16&255,e[31]=A>>>24&255,e[32]=j>>>0&255,e[33]=j>>>8&255,e[34]=j>>>16&255,e[35]=j>>>24&255,e[36]=C>>>0&255,e[37]=C>>>8&255,e[38]=C>>>16&255,e[39]=C>>>24&255,e[40]=N>>>0&255,e[41]=N>>>8&255,e[42]=N>>>16&255,e[43]=N>>>24&255,e[44]=I>>>0&255,e[45]=I>>>8&255,e[46]=I>>>16&255,e[47]=I>>>24&255,e[48]=P>>>0&255,e[49]=P>>>8&255,e[50]=P>>>16&255,e[51]=P>>>24&255,e[52]=B>>>0&255,e[53]=B>>>8&255,e[54]=B>>>16&255,e[55]=B>>>24&255,e[56]=D>>>0&255,e[57]=D>>>8&255,e[58]=D>>>16&255,e[59]=D>>>24&255,e[60]=O>>>0&255,e[61]=O>>>8&255,e[62]=O>>>16&255,e[63]=O>>>24&255}(e,t,r,n)}function g(e,t,r,n){!function(e,t,r,n){for(var o,i=255&n[0]|(255&n[1])<<8|(255&n[2])<<16|(255&n[3])<<24,s=255&r[0]|(255&r[1])<<8|(255&r[2])<<16|(255&r[3])<<24,a=255&r[4]|(255&r[5])<<8|(255&r[6])<<16|(255&r[7])<<24,c=255&r[8]|(255&r[9])<<8|(255&r[10])<<16|(255&r[11])<<24,u=255&r[12]|(255&r[13])<<8|(255&r[14])<<16|(255&r[15])<<24,l=255&n[4]|(255&n[5])<<8|(255&n[6])<<16|(255&n[7])<<24,d=255&t[0]|(255&t[1])<<8|(255&t[2])<<16|(255&t[3])<<24,f=255&t[4]|(255&t[5])<<8|(255&t[6])<<16|(255&t[7])<<24,h=255&t[8]|(255&t[9])<<8|(255&t[10])<<16|(255&t[11])<<24,p=255&t[12]|(255&t[13])<<8|(255&t[14])<<16|(255&t[15])<<24,m=255&n[8]|(255&n[9])<<8|(255&n[10])<<16|(255&n[11])<<24,y=255&r[16]|(255&r[17])<<8|(255&r[18])<<16|(255&r[19])<<24,_=255&r[20]|(255&r[21])<<8|(255&r[22])<<16|(255&r[23])<<24,g=255&r[24]|(255&r[25])<<8|(255&r[26])<<16|(255&r[27])<<24,b=255&r[28]|(255&r[29])<<8|(255&r[30])<<16|(255&r[31])<<24,w=255&n[12]|(255&n[13])<<8|(255&n[14])<<16|(255&n[15])<<24,v=0;v<20;v+=2)i^=(o=(_^=(o=(h^=(o=(u^=(o=i+_|0)<<7|o>>>25)+i|0)<<9|o>>>23)+u|0)<<13|o>>>19)+h|0)<<18|o>>>14,l^=(o=(s^=(o=(g^=(o=(p^=(o=l+s|0)<<7|o>>>25)+l|0)<<9|o>>>23)+p|0)<<13|o>>>19)+g|0)<<18|o>>>14,m^=(o=(d^=(o=(a^=(o=(b^=(o=m+d|0)<<7|o>>>25)+m|0)<<9|o>>>23)+b|0)<<13|o>>>19)+a|0)<<18|o>>>14,w^=(o=(y^=(o=(f^=(o=(c^=(o=w+y|0)<<7|o>>>25)+w|0)<<9|o>>>23)+c|0)<<13|o>>>19)+f|0)<<18|o>>>14,i^=(o=(c^=(o=(a^=(o=(s^=(o=i+c|0)<<7|o>>>25)+i|0)<<9|o>>>23)+s|0)<<13|o>>>19)+a|0)<<18|o>>>14,l^=(o=(u^=(o=(f^=(o=(d^=(o=l+u|0)<<7|o>>>25)+l|0)<<9|o>>>23)+d|0)<<13|o>>>19)+f|0)<<18|o>>>14,m^=(o=(p^=(o=(h^=(o=(y^=(o=m+p|0)<<7|o>>>25)+m|0)<<9|o>>>23)+y|0)<<13|o>>>19)+h|0)<<18|o>>>14,w^=(o=(b^=(o=(g^=(o=(_^=(o=w+b|0)<<7|o>>>25)+w|0)<<9|o>>>23)+_|0)<<13|o>>>19)+g|0)<<18|o>>>14;e[0]=i>>>0&255,e[1]=i>>>8&255,e[2]=i>>>16&255,e[3]=i>>>24&255,e[4]=l>>>0&255,e[5]=l>>>8&255,e[6]=l>>>16&255,e[7]=l>>>24&255,e[8]=m>>>0&255,e[9]=m>>>8&255,e[10]=m>>>16&255,e[11]=m>>>24&255,e[12]=w>>>0&255,e[13]=w>>>8&255,e[14]=w>>>16&255,e[15]=w>>>24&255,e[16]=d>>>0&255,e[17]=d>>>8&255,e[18]=d>>>16&255,e[19]=d>>>24&255,e[20]=f>>>0&255,e[21]=f>>>8&255,e[22]=f>>>16&255,e[23]=f>>>24&255,e[24]=h>>>0&255,e[25]=h>>>8&255,e[26]=h>>>16&255,e[27]=h>>>24&255,e[28]=p>>>0&255,e[29]=p>>>8&255,e[30]=p>>>16&255,e[31]=p>>>24&255}(e,t,r,n)}var b=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function w(e,t,r,n,o,i,s){var a,c,u=new Uint8Array(16),l=new Uint8Array(64);for(c=0;c<16;c++)u[c]=0;for(c=0;c<8;c++)u[c]=i[c];for(;o>=64;){for(_(l,u,s,b),c=0;c<64;c++)e[t+c]=r[n+c]^l[c];for(a=1,c=8;c<16;c++)a=a+(255&u[c])|0,u[c]=255&a,a>>>=8;o-=64,t+=64,n+=64}if(o>0)for(_(l,u,s,b),c=0;c<o;c++)e[t+c]=r[n+c]^l[c];return 0}function v(e,t,r,n,o){var i,s,a=new Uint8Array(16),c=new Uint8Array(64);for(s=0;s<16;s++)a[s]=0;for(s=0;s<8;s++)a[s]=n[s];for(;r>=64;){for(_(c,a,o,b),s=0;s<64;s++)e[t+s]=c[s];for(i=1,s=8;s<16;s++)i=i+(255&a[s])|0,a[s]=255&i,i>>>=8;r-=64,t+=64}if(r>0)for(_(c,a,o,b),s=0;s<r;s++)e[t+s]=c[s];return 0}function E(e,t,r,n,o){var i=new Uint8Array(32);g(i,n,o,b);for(var s=new Uint8Array(8),a=0;a<8;a++)s[a]=n[a+16];return v(e,t,r,s,i)}function S(e,t,r,n,o,i,s){var a=new Uint8Array(32);g(a,i,s,b);for(var c=new Uint8Array(8),u=0;u<8;u++)c[u]=i[u+16];return w(e,t,r,n,o,c,a)}var k=function(e){var t,r,n,o,i,s,a,c;this.buffer=new Uint8Array(16),this.r=new Uint16Array(10),this.h=new Uint16Array(10),this.pad=new Uint16Array(8),this.leftover=0,this.fin=0,t=255&e[0]|(255&e[1])<<8,this.r[0]=8191&t,r=255&e[2]|(255&e[3])<<8,this.r[1]=8191&(t>>>13|r<<3),n=255&e[4]|(255&e[5])<<8,this.r[2]=7939&(r>>>10|n<<6),o=255&e[6]|(255&e[7])<<8,this.r[3]=8191&(n>>>7|o<<9),i=255&e[8]|(255&e[9])<<8,this.r[4]=255&(o>>>4|i<<12),this.r[5]=i>>>1&8190,s=255&e[10]|(255&e[11])<<8,this.r[6]=8191&(i>>>14|s<<2),a=255&e[12]|(255&e[13])<<8,this.r[7]=8065&(s>>>11|a<<5),c=255&e[14]|(255&e[15])<<8,this.r[8]=8191&(a>>>8|c<<8),this.r[9]=c>>>5&127,this.pad[0]=255&e[16]|(255&e[17])<<8,this.pad[1]=255&e[18]|(255&e[19])<<8,this.pad[2]=255&e[20]|(255&e[21])<<8,this.pad[3]=255&e[22]|(255&e[23])<<8,this.pad[4]=255&e[24]|(255&e[25])<<8,this.pad[5]=255&e[26]|(255&e[27])<<8,this.pad[6]=255&e[28]|(255&e[29])<<8,this.pad[7]=255&e[30]|(255&e[31])<<8};function T(e,t,r,n,o,i){var s=new k(i);return s.update(r,n,o),s.finish(e,t),0}function $(e,t,r,n,o,i){var s=new Uint8Array(16);return T(s,0,r,n,o,i),m(e,t,s,0)}function x(e,t,r,n,o){var i;if(r<32)return-1;for(S(e,0,t,0,r,n,o),T(e,16,e,32,r-32,e),i=0;i<16;i++)e[i]=0;return 0}function A(e,t,r,n,o){var i,s=new Uint8Array(32);if(r<32)return-1;if(E(s,0,32,n,o),0!==$(t,16,t,32,r-32,s))return-1;for(S(e,0,t,0,r,n,o),i=0;i<32;i++)e[i]=0;return 0}function j(e,t){var r;for(r=0;r<16;r++)e[r]=0|t[r]}function C(e){var t,r,n=1;for(t=0;t<16;t++)r=e[t]+n+65535,n=Math.floor(r/65536),e[t]=r-65536*n;e[0]+=n-1+37*(n-1)}function N(e,t,r){for(var n,o=~(r-1),i=0;i<16;i++)n=o&(e[i]^t[i]),e[i]^=n,t[i]^=n}function I(e,r){var n,o,i,s=t(),a=t();for(n=0;n<16;n++)a[n]=r[n];for(C(a),C(a),C(a),o=0;o<2;o++){for(s[0]=a[0]-65517,n=1;n<15;n++)s[n]=a[n]-65535-(s[n-1]>>16&1),s[n-1]&=65535;s[15]=a[15]-32767-(s[14]>>16&1),i=s[15]>>16&1,s[14]&=65535,N(a,s,1-i)}for(n=0;n<16;n++)e[2*n]=255&a[n],e[2*n+1]=a[n]>>8}function P(e,t){var r=new Uint8Array(32),n=new Uint8Array(32);return I(r,e),I(n,t),y(r,0,n,0)}function B(e){var t=new Uint8Array(32);return I(t,e),1&t[0]}function D(e,t){var r;for(r=0;r<16;r++)e[r]=t[2*r]+(t[2*r+1]<<8);e[15]&=32767}function O(e,t,r){for(var n=0;n<16;n++)e[n]=t[n]+r[n]}function U(e,t,r){for(var n=0;n<16;n++)e[n]=t[n]-r[n]}function M(e,t,r){var n,o,i=0,s=0,a=0,c=0,u=0,l=0,d=0,f=0,h=0,p=0,m=0,y=0,_=0,g=0,b=0,w=0,v=0,E=0,S=0,k=0,T=0,$=0,x=0,A=0,j=0,C=0,N=0,I=0,P=0,B=0,D=0,O=r[0],U=r[1],M=r[2],R=r[3],q=r[4],L=r[5],F=r[6],z=r[7],V=r[8],J=r[9],H=r[10],K=r[11],G=r[12],W=r[13],Y=r[14],X=r[15];i+=(n=t[0])*O,s+=n*U,a+=n*M,c+=n*R,u+=n*q,l+=n*L,d+=n*F,f+=n*z,h+=n*V,p+=n*J,m+=n*H,y+=n*K,_+=n*G,g+=n*W,b+=n*Y,w+=n*X,s+=(n=t[1])*O,a+=n*U,c+=n*M,u+=n*R,l+=n*q,d+=n*L,f+=n*F,h+=n*z,p+=n*V,m+=n*J,y+=n*H,_+=n*K,g+=n*G,b+=n*W,w+=n*Y,v+=n*X,a+=(n=t[2])*O,c+=n*U,u+=n*M,l+=n*R,d+=n*q,f+=n*L,h+=n*F,p+=n*z,m+=n*V,y+=n*J,_+=n*H,g+=n*K,b+=n*G,w+=n*W,v+=n*Y,E+=n*X,c+=(n=t[3])*O,u+=n*U,l+=n*M,d+=n*R,f+=n*q,h+=n*L,p+=n*F,m+=n*z,y+=n*V,_+=n*J,g+=n*H,b+=n*K,w+=n*G,v+=n*W,E+=n*Y,S+=n*X,u+=(n=t[4])*O,l+=n*U,d+=n*M,f+=n*R,h+=n*q,p+=n*L,m+=n*F,y+=n*z,_+=n*V,g+=n*J,b+=n*H,w+=n*K,v+=n*G,E+=n*W,S+=n*Y,k+=n*X,l+=(n=t[5])*O,d+=n*U,f+=n*M,h+=n*R,p+=n*q,m+=n*L,y+=n*F,_+=n*z,g+=n*V,b+=n*J,w+=n*H,v+=n*K,E+=n*G,S+=n*W,k+=n*Y,T+=n*X,d+=(n=t[6])*O,f+=n*U,h+=n*M,p+=n*R,m+=n*q,y+=n*L,_+=n*F,g+=n*z,b+=n*V,w+=n*J,v+=n*H,E+=n*K,S+=n*G,k+=n*W,T+=n*Y,$+=n*X,f+=(n=t[7])*O,h+=n*U,p+=n*M,m+=n*R,y+=n*q,_+=n*L,g+=n*F,b+=n*z,w+=n*V,v+=n*J,E+=n*H,S+=n*K,k+=n*G,T+=n*W,$+=n*Y,x+=n*X,h+=(n=t[8])*O,p+=n*U,m+=n*M,y+=n*R,_+=n*q,g+=n*L,b+=n*F,w+=n*z,v+=n*V,E+=n*J,S+=n*H,k+=n*K,T+=n*G,$+=n*W,x+=n*Y,A+=n*X,p+=(n=t[9])*O,m+=n*U,y+=n*M,_+=n*R,g+=n*q,b+=n*L,w+=n*F,v+=n*z,E+=n*V,S+=n*J,k+=n*H,T+=n*K,$+=n*G,x+=n*W,A+=n*Y,j+=n*X,m+=(n=t[10])*O,y+=n*U,_+=n*M,g+=n*R,b+=n*q,w+=n*L,v+=n*F,E+=n*z,S+=n*V,k+=n*J,T+=n*H,$+=n*K,x+=n*G,A+=n*W,j+=n*Y,C+=n*X,y+=(n=t[11])*O,_+=n*U,g+=n*M,b+=n*R,w+=n*q,v+=n*L,E+=n*F,S+=n*z,k+=n*V,T+=n*J,$+=n*H,x+=n*K,A+=n*G,j+=n*W,C+=n*Y,N+=n*X,_+=(n=t[12])*O,g+=n*U,b+=n*M,w+=n*R,v+=n*q,E+=n*L,S+=n*F,k+=n*z,T+=n*V,$+=n*J,x+=n*H,A+=n*K,j+=n*G,C+=n*W,N+=n*Y,I+=n*X,g+=(n=t[13])*O,b+=n*U,w+=n*M,v+=n*R,E+=n*q,S+=n*L,k+=n*F,T+=n*z,$+=n*V,x+=n*J,A+=n*H,j+=n*K,C+=n*G,N+=n*W,I+=n*Y,P+=n*X,b+=(n=t[14])*O,w+=n*U,v+=n*M,E+=n*R,S+=n*q,k+=n*L,T+=n*F,$+=n*z,x+=n*V,A+=n*J,j+=n*H,C+=n*K,N+=n*G,I+=n*W,P+=n*Y,B+=n*X,w+=(n=t[15])*O,s+=38*(E+=n*M),a+=38*(S+=n*R),c+=38*(k+=n*q),u+=38*(T+=n*L),l+=38*($+=n*F),d+=38*(x+=n*z),f+=38*(A+=n*V),h+=38*(j+=n*J),p+=38*(C+=n*H),m+=38*(N+=n*K),y+=38*(I+=n*G),_+=38*(P+=n*W),g+=38*(B+=n*Y),b+=38*(D+=n*X),i=(n=(i+=38*(v+=n*U))+(o=1)+65535)-65536*(o=Math.floor(n/65536)),s=(n=s+o+65535)-65536*(o=Math.floor(n/65536)),a=(n=a+o+65535)-65536*(o=Math.floor(n/65536)),c=(n=c+o+65535)-65536*(o=Math.floor(n/65536)),u=(n=u+o+65535)-65536*(o=Math.floor(n/65536)),l=(n=l+o+65535)-65536*(o=Math.floor(n/65536)),d=(n=d+o+65535)-65536*(o=Math.floor(n/65536)),f=(n=f+o+65535)-65536*(o=Math.floor(n/65536)),h=(n=h+o+65535)-65536*(o=Math.floor(n/65536)),p=(n=p+o+65535)-65536*(o=Math.floor(n/65536)),m=(n=m+o+65535)-65536*(o=Math.floor(n/65536)),y=(n=y+o+65535)-65536*(o=Math.floor(n/65536)),_=(n=_+o+65535)-65536*(o=Math.floor(n/65536)),g=(n=g+o+65535)-65536*(o=Math.floor(n/65536)),b=(n=b+o+65535)-65536*(o=Math.floor(n/65536)),w=(n=w+o+65535)-65536*(o=Math.floor(n/65536)),i=(n=(i+=o-1+37*(o-1))+(o=1)+65535)-65536*(o=Math.floor(n/65536)),s=(n=s+o+65535)-65536*(o=Math.floor(n/65536)),a=(n=a+o+65535)-65536*(o=Math.floor(n/65536)),c=(n=c+o+65535)-65536*(o=Math.floor(n/65536)),u=(n=u+o+65535)-65536*(o=Math.floor(n/65536)),l=(n=l+o+65535)-65536*(o=Math.floor(n/65536)),d=(n=d+o+65535)-65536*(o=Math.floor(n/65536)),f=(n=f+o+65535)-65536*(o=Math.floor(n/65536)),h=(n=h+o+65535)-65536*(o=Math.floor(n/65536)),p=(n=p+o+65535)-65536*(o=Math.floor(n/65536)),m=(n=m+o+65535)-65536*(o=Math.floor(n/65536)),y=(n=y+o+65535)-65536*(o=Math.floor(n/65536)),_=(n=_+o+65535)-65536*(o=Math.floor(n/65536)),g=(n=g+o+65535)-65536*(o=Math.floor(n/65536)),b=(n=b+o+65535)-65536*(o=Math.floor(n/65536)),w=(n=w+o+65535)-65536*(o=Math.floor(n/65536)),i+=o-1+37*(o-1),e[0]=i,e[1]=s,e[2]=a,e[3]=c,e[4]=u,e[5]=l,e[6]=d,e[7]=f,e[8]=h,e[9]=p,e[10]=m,e[11]=y,e[12]=_,e[13]=g,e[14]=b,e[15]=w}function R(e,t){M(e,t,t)}function q(e,r){var n,o=t();for(n=0;n<16;n++)o[n]=r[n];for(n=253;n>=0;n--)R(o,o),2!==n&&4!==n&&M(o,o,r);for(n=0;n<16;n++)e[n]=o[n]}function L(e,r){var n,o=t();for(n=0;n<16;n++)o[n]=r[n];for(n=250;n>=0;n--)R(o,o),1!==n&&M(o,o,r);for(n=0;n<16;n++)e[n]=o[n]}function F(e,r,n){var o,i,s=new Uint8Array(32),c=new Float64Array(80),u=t(),l=t(),d=t(),f=t(),h=t(),p=t();for(i=0;i<31;i++)s[i]=r[i];for(s[31]=127&r[31]|64,s[0]&=248,D(c,n),i=0;i<16;i++)l[i]=c[i],f[i]=u[i]=d[i]=0;for(u[0]=f[0]=1,i=254;i>=0;--i)N(u,l,o=s[i>>>3]>>>(7&i)&1),N(d,f,o),O(h,u,d),U(u,u,d),O(d,l,f),U(l,l,f),R(f,h),R(p,u),M(u,d,u),M(d,l,h),O(h,u,d),U(u,u,d),R(l,u),U(d,f,p),M(u,d,a),O(u,u,f),M(d,d,u),M(u,f,p),M(f,l,c),R(l,h),N(u,l,o),N(d,f,o);for(i=0;i<16;i++)c[i+16]=u[i],c[i+32]=d[i],c[i+48]=l[i],c[i+64]=f[i];var m=c.subarray(32),y=c.subarray(16);return q(m,m),M(y,y,m),I(e,y),0}function z(e,t){return F(e,t,o)}function V(e,t){return r(t,32),z(e,t)}function J(e,t,r){var o=new Uint8Array(32);return F(o,r,t),g(e,n,o,b)}k.prototype.blocks=function(e,t,r){for(var n,o,i,s,a,c,u,l,d,f,h,p,m,y,_,g,b,w,v,E=this.fin?0:2048,S=this.h[0],k=this.h[1],T=this.h[2],$=this.h[3],x=this.h[4],A=this.h[5],j=this.h[6],C=this.h[7],N=this.h[8],I=this.h[9],P=this.r[0],B=this.r[1],D=this.r[2],O=this.r[3],U=this.r[4],M=this.r[5],R=this.r[6],q=this.r[7],L=this.r[8],F=this.r[9];r>=16;)f=d=0,f+=(S+=8191&(n=255&e[t+0]|(255&e[t+1])<<8))*P,f+=(k+=8191&(n>>>13|(o=255&e[t+2]|(255&e[t+3])<<8)<<3))*(5*F),f+=(T+=8191&(o>>>10|(i=255&e[t+4]|(255&e[t+5])<<8)<<6))*(5*L),f+=($+=8191&(i>>>7|(s=255&e[t+6]|(255&e[t+7])<<8)<<9))*(5*q),d=(f+=(x+=8191&(s>>>4|(a=255&e[t+8]|(255&e[t+9])<<8)<<12))*(5*R))>>>13,f&=8191,f+=(A+=a>>>1&8191)*(5*M),f+=(j+=8191&(a>>>14|(c=255&e[t+10]|(255&e[t+11])<<8)<<2))*(5*U),f+=(C+=8191&(c>>>11|(u=255&e[t+12]|(255&e[t+13])<<8)<<5))*(5*O),f+=(N+=8191&(u>>>8|(l=255&e[t+14]|(255&e[t+15])<<8)<<8))*(5*D),h=d+=(f+=(I+=l>>>5|E)*(5*B))>>>13,h+=S*B,h+=k*P,h+=T*(5*F),h+=$*(5*L),d=(h+=x*(5*q))>>>13,h&=8191,h+=A*(5*R),h+=j*(5*M),h+=C*(5*U),h+=N*(5*O),d+=(h+=I*(5*D))>>>13,h&=8191,p=d,p+=S*D,p+=k*B,p+=T*P,p+=$*(5*F),d=(p+=x*(5*L))>>>13,p&=8191,p+=A*(5*q),p+=j*(5*R),p+=C*(5*M),p+=N*(5*U),m=d+=(p+=I*(5*O))>>>13,m+=S*O,m+=k*D,m+=T*B,m+=$*P,d=(m+=x*(5*F))>>>13,m&=8191,m+=A*(5*L),m+=j*(5*q),m+=C*(5*R),m+=N*(5*M),y=d+=(m+=I*(5*U))>>>13,y+=S*U,y+=k*O,y+=T*D,y+=$*B,d=(y+=x*P)>>>13,y&=8191,y+=A*(5*F),y+=j*(5*L),y+=C*(5*q),y+=N*(5*R),_=d+=(y+=I*(5*M))>>>13,_+=S*M,_+=k*U,_+=T*O,_+=$*D,d=(_+=x*B)>>>13,_&=8191,_+=A*P,_+=j*(5*F),_+=C*(5*L),_+=N*(5*q),g=d+=(_+=I*(5*R))>>>13,g+=S*R,g+=k*M,g+=T*U,g+=$*O,d=(g+=x*D)>>>13,g&=8191,g+=A*B,g+=j*P,g+=C*(5*F),g+=N*(5*L),b=d+=(g+=I*(5*q))>>>13,b+=S*q,b+=k*R,b+=T*M,b+=$*U,d=(b+=x*O)>>>13,b&=8191,b+=A*D,b+=j*B,b+=C*P,b+=N*(5*F),w=d+=(b+=I*(5*L))>>>13,w+=S*L,w+=k*q,w+=T*R,w+=$*M,d=(w+=x*U)>>>13,w&=8191,w+=A*O,w+=j*D,w+=C*B,w+=N*P,v=d+=(w+=I*(5*F))>>>13,v+=S*F,v+=k*L,v+=T*q,v+=$*R,d=(v+=x*M)>>>13,v&=8191,v+=A*U,v+=j*O,v+=C*D,v+=N*B,S=f=8191&(d=(d=((d+=(v+=I*P)>>>13)<<2)+d|0)+(f&=8191)|0),k=h+=d>>>=13,T=p&=8191,$=m&=8191,x=y&=8191,A=_&=8191,j=g&=8191,C=b&=8191,N=w&=8191,I=v&=8191,t+=16,r-=16;this.h[0]=S,this.h[1]=k,this.h[2]=T,this.h[3]=$,this.h[4]=x,this.h[5]=A,this.h[6]=j,this.h[7]=C,this.h[8]=N,this.h[9]=I},k.prototype.finish=function(e,t){var r,n,o,i,s=new Uint16Array(10);if(this.leftover){for(i=this.leftover,this.buffer[i++]=1;i<16;i++)this.buffer[i]=0;this.fin=1,this.blocks(this.buffer,0,16)}for(r=this.h[1]>>>13,this.h[1]&=8191,i=2;i<10;i++)this.h[i]+=r,r=this.h[i]>>>13,this.h[i]&=8191;for(this.h[0]+=5*r,r=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=r,r=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=r,s[0]=this.h[0]+5,r=s[0]>>>13,s[0]&=8191,i=1;i<10;i++)s[i]=this.h[i]+r,r=s[i]>>>13,s[i]&=8191;for(s[9]-=8192,n=(1^r)-1,i=0;i<10;i++)s[i]&=n;for(n=~n,i=0;i<10;i++)this.h[i]=this.h[i]&n|s[i];for(this.h[0]=65535&(this.h[0]|this.h[1]<<13),this.h[1]=65535&(this.h[1]>>>3|this.h[2]<<10),this.h[2]=65535&(this.h[2]>>>6|this.h[3]<<7),this.h[3]=65535&(this.h[3]>>>9|this.h[4]<<4),this.h[4]=65535&(this.h[4]>>>12|this.h[5]<<1|this.h[6]<<14),this.h[5]=65535&(this.h[6]>>>2|this.h[7]<<11),this.h[6]=65535&(this.h[7]>>>5|this.h[8]<<8),this.h[7]=65535&(this.h[8]>>>8|this.h[9]<<5),o=this.h[0]+this.pad[0],this.h[0]=65535&o,i=1;i<8;i++)o=(this.h[i]+this.pad[i]|0)+(o>>>16)|0,this.h[i]=65535&o;e[t+0]=this.h[0]>>>0&255,e[t+1]=this.h[0]>>>8&255,e[t+2]=this.h[1]>>>0&255,e[t+3]=this.h[1]>>>8&255,e[t+4]=this.h[2]>>>0&255,e[t+5]=this.h[2]>>>8&255,e[t+6]=this.h[3]>>>0&255,e[t+7]=this.h[3]>>>8&255,e[t+8]=this.h[4]>>>0&255,e[t+9]=this.h[4]>>>8&255,e[t+10]=this.h[5]>>>0&255,e[t+11]=this.h[5]>>>8&255,e[t+12]=this.h[6]>>>0&255,e[t+13]=this.h[6]>>>8&255,e[t+14]=this.h[7]>>>0&255,e[t+15]=this.h[7]>>>8&255},k.prototype.update=function(e,t,r){var n,o;if(this.leftover){for((o=16-this.leftover)>r&&(o=r),n=0;n<o;n++)this.buffer[this.leftover+n]=e[t+n];if(r-=o,t+=o,this.leftover+=o,this.leftover<16)return;this.blocks(this.buffer,0,16),this.leftover=0}if(r>=16&&(o=r-r%16,this.blocks(e,t,o),t+=o,r-=o),r){for(n=0;n<r;n++)this.buffer[this.leftover+n]=e[t+n];this.leftover+=r}};var H=x,K=A;var G=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function W(e,t,r,n){for(var o,i,s,a,c,u,l,d,f,h,p,m,y,_,g,b,w,v,E,S,k,T,$,x,A,j,C=new Int32Array(16),N=new Int32Array(16),I=e[0],P=e[1],B=e[2],D=e[3],O=e[4],U=e[5],M=e[6],R=e[7],q=t[0],L=t[1],F=t[2],z=t[3],V=t[4],J=t[5],H=t[6],K=t[7],W=0;n>=128;){for(E=0;E<16;E++)S=8*E+W,C[E]=r[S+0]<<24|r[S+1]<<16|r[S+2]<<8|r[S+3],N[E]=r[S+4]<<24|r[S+5]<<16|r[S+6]<<8|r[S+7];for(E=0;E<80;E++)if(o=I,i=P,s=B,a=D,c=O,u=U,l=M,R,f=q,h=L,p=F,m=z,y=V,_=J,g=H,K,$=65535&(T=K),x=T>>>16,A=65535&(k=R),j=k>>>16,$+=65535&(T=(V>>>14|O<<18)^(V>>>18|O<<14)^(O>>>9|V<<23)),x+=T>>>16,A+=65535&(k=(O>>>14|V<<18)^(O>>>18|V<<14)^(V>>>9|O<<23)),j+=k>>>16,$+=65535&(T=V&J^~V&H),x+=T>>>16,A+=65535&(k=O&U^~O&M),j+=k>>>16,$+=65535&(T=G[2*E+1]),x+=T>>>16,A+=65535&(k=G[2*E]),j+=k>>>16,k=C[E%16],x+=(T=N[E%16])>>>16,A+=65535&k,j+=k>>>16,A+=(x+=($+=65535&T)>>>16)>>>16,$=65535&(T=v=65535&$|x<<16),x=T>>>16,A=65535&(k=w=65535&A|(j+=A>>>16)<<16),j=k>>>16,$+=65535&(T=(q>>>28|I<<4)^(I>>>2|q<<30)^(I>>>7|q<<25)),x+=T>>>16,A+=65535&(k=(I>>>28|q<<4)^(q>>>2|I<<30)^(q>>>7|I<<25)),j+=k>>>16,x+=(T=q&L^q&F^L&F)>>>16,A+=65535&(k=I&P^I&B^P&B),j+=k>>>16,d=65535&(A+=(x+=($+=65535&T)>>>16)>>>16)|(j+=A>>>16)<<16,b=65535&$|x<<16,$=65535&(T=m),x=T>>>16,A=65535&(k=a),j=k>>>16,x+=(T=v)>>>16,A+=65535&(k=w),j+=k>>>16,P=o,B=i,D=s,O=a=65535&(A+=(x+=($+=65535&T)>>>16)>>>16)|(j+=A>>>16)<<16,U=c,M=u,R=l,I=d,L=f,F=h,z=p,V=m=65535&$|x<<16,J=y,H=_,K=g,q=b,E%16==15)for(S=0;S<16;S++)k=C[S],$=65535&(T=N[S]),x=T>>>16,A=65535&k,j=k>>>16,k=C[(S+9)%16],$+=65535&(T=N[(S+9)%16]),x+=T>>>16,A+=65535&k,j+=k>>>16,w=C[(S+1)%16],$+=65535&(T=((v=N[(S+1)%16])>>>1|w<<31)^(v>>>8|w<<24)^(v>>>7|w<<25)),x+=T>>>16,A+=65535&(k=(w>>>1|v<<31)^(w>>>8|v<<24)^w>>>7),j+=k>>>16,w=C[(S+14)%16],x+=(T=((v=N[(S+14)%16])>>>19|w<<13)^(w>>>29|v<<3)^(v>>>6|w<<26))>>>16,A+=65535&(k=(w>>>19|v<<13)^(v>>>29|w<<3)^w>>>6),j+=k>>>16,j+=(A+=(x+=($+=65535&T)>>>16)>>>16)>>>16,C[S]=65535&A|j<<16,N[S]=65535&$|x<<16;$=65535&(T=q),x=T>>>16,A=65535&(k=I),j=k>>>16,k=e[0],x+=(T=t[0])>>>16,A+=65535&k,j+=k>>>16,j+=(A+=(x+=($+=65535&T)>>>16)>>>16)>>>16,e[0]=I=65535&A|j<<16,t[0]=q=65535&$|x<<16,$=65535&(T=L),x=T>>>16,A=65535&(k=P),j=k>>>16,k=e[1],x+=(T=t[1])>>>16,A+=65535&k,j+=k>>>16,j+=(A+=(x+=($+=65535&T)>>>16)>>>16)>>>16,e[1]=P=65535&A|j<<16,t[1]=L=65535&$|x<<16,$=65535&(T=F),x=T>>>16,A=65535&(k=B),j=k>>>16,k=e[2],x+=(T=t[2])>>>16,A+=65535&k,j+=k>>>16,j+=(A+=(x+=($+=65535&T)>>>16)>>>16)>>>16,e[2]=B=65535&A|j<<16,t[2]=F=65535&$|x<<16,$=65535&(T=z),x=T>>>16,A=65535&(k=D),j=k>>>16,k=e[3],x+=(T=t[3])>>>16,A+=65535&k,j+=k>>>16,j+=(A+=(x+=($+=65535&T)>>>16)>>>16)>>>16,e[3]=D=65535&A|j<<16,t[3]=z=65535&$|x<<16,$=65535&(T=V),x=T>>>16,A=65535&(k=O),j=k>>>16,k=e[4],x+=(T=t[4])>>>16,A+=65535&k,j+=k>>>16,j+=(A+=(x+=($+=65535&T)>>>16)>>>16)>>>16,e[4]=O=65535&A|j<<16,t[4]=V=65535&$|x<<16,$=65535&(T=J),x=T>>>16,A=65535&(k=U),j=k>>>16,k=e[5],x+=(T=t[5])>>>16,A+=65535&k,j+=k>>>16,j+=(A+=(x+=($+=65535&T)>>>16)>>>16)>>>16,e[5]=U=65535&A|j<<16,t[5]=J=65535&$|x<<16,$=65535&(T=H),x=T>>>16,A=65535&(k=M),j=k>>>16,k=e[6],x+=(T=t[6])>>>16,A+=65535&k,j+=k>>>16,j+=(A+=(x+=($+=65535&T)>>>16)>>>16)>>>16,e[6]=M=65535&A|j<<16,t[6]=H=65535&$|x<<16,$=65535&(T=K),x=T>>>16,A=65535&(k=R),j=k>>>16,k=e[7],x+=(T=t[7])>>>16,A+=65535&k,j+=k>>>16,j+=(A+=(x+=($+=65535&T)>>>16)>>>16)>>>16,e[7]=R=65535&A|j<<16,t[7]=K=65535&$|x<<16,W+=128,n-=128}return n}function Y(e,t,r){var n,o=new Int32Array(8),i=new Int32Array(8),s=new Uint8Array(256),a=r;for(o[0]=1779033703,o[1]=3144134277,o[2]=1013904242,o[3]=2773480762,o[4]=1359893119,o[5]=2600822924,o[6]=528734635,o[7]=1541459225,i[0]=4089235720,i[1]=2227873595,i[2]=4271175723,i[3]=1595750129,i[4]=2917565137,i[5]=725511199,i[6]=4215389547,i[7]=327033209,W(o,i,t,r),r%=128,n=0;n<r;n++)s[n]=t[a-r+n];for(s[r]=128,s[(r=256-128*(r<112?1:0))-9]=0,h(s,r-8,a/536870912|0,a<<3),W(o,i,s,r),n=0;n<8;n++)h(e,8*n,o[n],i[n]);return 0}function X(e,r){var n=t(),o=t(),i=t(),s=t(),a=t(),c=t(),l=t(),d=t(),f=t();U(n,e[1],e[0]),U(f,r[1],r[0]),M(n,n,f),O(o,e[0],e[1]),O(f,r[0],r[1]),M(o,o,f),M(i,e[3],r[3]),M(i,i,u),M(s,e[2],r[2]),O(s,s,s),U(a,o,n),U(c,s,i),O(l,s,i),O(d,o,n),M(e[0],a,c),M(e[1],d,l),M(e[2],l,c),M(e[3],a,d)}function Z(e,t,r){var n;for(n=0;n<4;n++)N(e[n],t[n],r)}function Q(e,r){var n=t(),o=t(),i=t();q(i,r[2]),M(n,r[0],i),M(o,r[1],i),I(e,o),e[31]^=B(n)<<7}function ee(e,t,r){var n,o;for(j(e[0],i),j(e[1],s),j(e[2],s),j(e[3],i),o=255;o>=0;--o)Z(e,t,n=r[o/8|0]>>(7&o)&1),X(t,e),X(e,e),Z(e,t,n)}function te(e,r){var n=[t(),t(),t(),t()];j(n[0],l),j(n[1],d),j(n[2],s),M(n[3],l,d),ee(e,n,r)}function re(e,n,o){var i,s=new Uint8Array(64),a=[t(),t(),t(),t()];for(o||r(n,32),Y(s,n,32),s[0]&=248,s[31]&=127,s[31]|=64,te(a,s),Q(e,a),i=0;i<32;i++)n[i+32]=e[i];return 0}var ne=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function oe(e,t){var r,n,o,i;for(n=63;n>=32;--n){for(r=0,o=n-32,i=n-12;o<i;++o)t[o]+=r-16*t[n]*ne[o-(n-32)],r=Math.floor((t[o]+128)/256),t[o]-=256*r;t[o]+=r,t[n]=0}for(r=0,o=0;o<32;o++)t[o]+=r-(t[31]>>4)*ne[o],r=t[o]>>8,t[o]&=255;for(o=0;o<32;o++)t[o]-=r*ne[o];for(n=0;n<32;n++)t[n+1]+=t[n]>>8,e[n]=255&t[n]}function ie(e){var t,r=new Float64Array(64);for(t=0;t<64;t++)r[t]=e[t];for(t=0;t<64;t++)e[t]=0;oe(e,r)}function se(e,r,n,o){var i,s,a=new Uint8Array(64),c=new Uint8Array(64),u=new Uint8Array(64),l=new Float64Array(64),d=[t(),t(),t(),t()];Y(a,o,32),a[0]&=248,a[31]&=127,a[31]|=64;var f=n+64;for(i=0;i<n;i++)e[64+i]=r[i];for(i=0;i<32;i++)e[32+i]=a[32+i];for(Y(u,e.subarray(32),n+32),ie(u),te(d,u),Q(e,d),i=32;i<64;i++)e[i]=o[i];for(Y(c,e,n+64),ie(c),i=0;i<64;i++)l[i]=0;for(i=0;i<32;i++)l[i]=u[i];for(i=0;i<32;i++)for(s=0;s<32;s++)l[i+s]+=c[i]*a[s];return oe(e.subarray(32),l),f}function ae(e,r,n,o){var a,u=new Uint8Array(32),l=new Uint8Array(64),d=[t(),t(),t(),t()],h=[t(),t(),t(),t()];if(n<64)return-1;if(function(e,r){var n=t(),o=t(),a=t(),u=t(),l=t(),d=t(),h=t();return j(e[2],s),D(e[1],r),R(a,e[1]),M(u,a,c),U(a,a,e[2]),O(u,e[2],u),R(l,u),R(d,l),M(h,d,l),M(n,h,a),M(n,n,u),L(n,n),M(n,n,a),M(n,n,u),M(n,n,u),M(e[0],n,u),R(o,e[0]),M(o,o,u),P(o,a)&&M(e[0],e[0],f),R(o,e[0]),M(o,o,u),P(o,a)?-1:(B(e[0])===r[31]>>7&&U(e[0],i,e[0]),M(e[3],e[0],e[1]),0)}(h,o))return-1;for(a=0;a<n;a++)e[a]=r[a];for(a=0;a<32;a++)e[a+32]=o[a];if(Y(l,e,n),ie(l),ee(d,h,l),te(h,r.subarray(32)),X(d,h),Q(u,d),n-=64,y(r,0,u,0)){for(a=0;a<n;a++)e[a]=0;return-1}for(a=0;a<n;a++)e[a]=r[a+64];return n}var ce=16,ue=64,le=32,de=64;function fe(e,t){if(32!==e.length)throw new Error("bad key size");if(24!==t.length)throw new Error("bad nonce size")}function he(){for(var e=0;e<arguments.length;e++)if(!(arguments[e]instanceof Uint8Array))throw new TypeError("unexpected type, use Uint8Array")}function pe(e){for(var t=0;t<e.length;t++)e[t]=0}e.lowlevel={crypto_core_hsalsa20:g,crypto_stream_xor:S,crypto_stream:E,crypto_stream_salsa20_xor:w,crypto_stream_salsa20:v,crypto_onetimeauth:T,crypto_onetimeauth_verify:$,crypto_verify_16:m,crypto_verify_32:y,crypto_secretbox:x,crypto_secretbox_open:A,crypto_scalarmult:F,crypto_scalarmult_base:z,crypto_box_beforenm:J,crypto_box_afternm:H,crypto_box:function(e,t,r,n,o,i){var s=new Uint8Array(32);return J(s,o,i),H(e,t,r,n,s)},crypto_box_open:function(e,t,r,n,o,i){var s=new Uint8Array(32);return J(s,o,i),K(e,t,r,n,s)},crypto_box_keypair:V,crypto_hash:Y,crypto_sign:se,crypto_sign_keypair:re,crypto_sign_open:ae,crypto_secretbox_KEYBYTES:32,crypto_secretbox_NONCEBYTES:24,crypto_secretbox_ZEROBYTES:32,crypto_secretbox_BOXZEROBYTES:ce,crypto_scalarmult_BYTES:32,crypto_scalarmult_SCALARBYTES:32,crypto_box_PUBLICKEYBYTES:32,crypto_box_SECRETKEYBYTES:32,crypto_box_BEFORENMBYTES:32,crypto_box_NONCEBYTES:24,crypto_box_ZEROBYTES:32,crypto_box_BOXZEROBYTES:16,crypto_sign_BYTES:ue,crypto_sign_PUBLICKEYBYTES:le,crypto_sign_SECRETKEYBYTES:de,crypto_sign_SEEDBYTES:32,crypto_hash_BYTES:64,gf:t,D:c,L:ne,pack25519:I,unpack25519:D,M:M,A:O,S:R,Z:U,pow2523:L,add:X,set25519:j,modL:oe,scalarmult:ee,scalarbase:te},e.randomBytes=function(e){var t=new Uint8Array(e);return r(t,e),t},e.secretbox=function(e,t,r){he(e,t,r),fe(r,t);for(var n=new Uint8Array(32+e.length),o=new Uint8Array(n.length),i=0;i<e.length;i++)n[i+32]=e[i];return x(o,n,n.length,t,r),o.subarray(ce)},e.secretbox.open=function(e,t,r){he(e,t,r),fe(r,t);for(var n=new Uint8Array(ce+e.length),o=new Uint8Array(n.length),i=0;i<e.length;i++)n[i+ce]=e[i];return n.length<32||0!==A(o,n,n.length,t,r)?null:o.subarray(32)},e.secretbox.keyLength=32,e.secretbox.nonceLength=24,e.secretbox.overheadLength=ce,e.scalarMult=function(e,t){if(he(e,t),32!==e.length)throw new Error("bad n size");if(32!==t.length)throw new Error("bad p size");var r=new Uint8Array(32);return F(r,e,t),r},e.scalarMult.base=function(e){if(he(e),32!==e.length)throw new Error("bad n size");var t=new Uint8Array(32);return z(t,e),t},e.scalarMult.scalarLength=32,e.scalarMult.groupElementLength=32,e.box=function(t,r,n,o){var i=e.box.before(n,o);return e.secretbox(t,r,i)},e.box.before=function(e,t){he(e,t),function(e,t){if(32!==e.length)throw new Error("bad public key size");if(32!==t.length)throw new Error("bad secret key size")}(e,t);var r=new Uint8Array(32);return J(r,e,t),r},e.box.after=e.secretbox,e.box.open=function(t,r,n,o){var i=e.box.before(n,o);return e.secretbox.open(t,r,i)},e.box.open.after=e.secretbox.open,e.box.keyPair=function(){var e=new Uint8Array(32),t=new Uint8Array(32);return V(e,t),{publicKey:e,secretKey:t}},e.box.keyPair.fromSecretKey=function(e){if(he(e),32!==e.length)throw new Error("bad secret key size");var t=new Uint8Array(32);return z(t,e),{publicKey:t,secretKey:new Uint8Array(e)}},e.box.publicKeyLength=32,e.box.secretKeyLength=32,e.box.sharedKeyLength=32,e.box.nonceLength=24,e.box.overheadLength=e.secretbox.overheadLength,e.sign=function(e,t){if(he(e,t),t.length!==de)throw new Error("bad secret key size");var r=new Uint8Array(ue+e.length);return se(r,e,e.length,t),r},e.sign.open=function(e,t){if(he(e,t),t.length!==le)throw new Error("bad public key size");var r=new Uint8Array(e.length),n=ae(r,e,e.length,t);if(n<0)return null;for(var o=new Uint8Array(n),i=0;i<o.length;i++)o[i]=r[i];return o},e.sign.detached=function(t,r){for(var n=e.sign(t,r),o=new Uint8Array(ue),i=0;i<o.length;i++)o[i]=n[i];return o},e.sign.detached.verify=function(e,t,r){if(he(e,t,r),t.length!==ue)throw new Error("bad signature size");if(r.length!==le)throw new Error("bad public key size");var n,o=new Uint8Array(ue+e.length),i=new Uint8Array(ue+e.length);for(n=0;n<ue;n++)o[n]=t[n];for(n=0;n<e.length;n++)o[n+ue]=e[n];return ae(i,o,o.length,r)>=0},e.sign.keyPair=function(){var e=new Uint8Array(le),t=new Uint8Array(de);return re(e,t),{publicKey:e,secretKey:t}},e.sign.keyPair.fromSecretKey=function(e){if(he(e),e.length!==de)throw new Error("bad secret key size");for(var t=new Uint8Array(le),r=0;r<t.length;r++)t[r]=e[32+r];return{publicKey:t,secretKey:new Uint8Array(e)}},e.sign.keyPair.fromSeed=function(e){if(he(e),32!==e.length)throw new Error("bad seed size");for(var t=new Uint8Array(le),r=new Uint8Array(de),n=0;n<32;n++)r[n]=e[n];return re(t,r,!0),{publicKey:t,secretKey:r}},e.sign.publicKeyLength=le,e.sign.secretKeyLength=de,e.sign.seedLength=32,e.sign.signatureLength=ue,e.hash=function(e){he(e);var t=new Uint8Array(64);return Y(t,e,e.length),t},e.hash.hashLength=64,e.verify=function(e,t){return he(e,t),0!==e.length&&0!==t.length&&(e.length===t.length&&0===p(e,0,t,0,e.length))},e.setPRNG=function(e){r=e},function(){var t="undefined"!=typeof self?self.crypto||self.msCrypto:null;if(t&&t.getRandomValues){e.setPRNG(function(e,r){var n,o=new Uint8Array(r);for(n=0;n<r;n+=65536)t.getRandomValues(o.subarray(n,n+Math.min(r-n,65536)));for(n=0;n<r;n++)e[n]=o[n];pe(o)})}else void 0!==__require&&(t=require_crypto())&&t.randomBytes&&e.setPRNG(function(e,r){var n,o=t.randomBytes(r);for(n=0;n<r;n++)e[n]=o[n];pe(o)})}()}(void 0!==t&&t.exports?t.exports:self.nacl=self.nacl||{})}}),require_retry_operation=__commonJS({"node_modules/retry/lib/retry_operation.js"(e,t){function r(e,t){"boolean"==typeof t&&(t={forever:t}),this._originalTimeouts=JSON.parse(JSON.stringify(e)),this._timeouts=e,this._options=t||{},this._maxRetryTime=t&&t.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))}t.exports=r,r.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts.slice(0)},r.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timer&&clearTimeout(this._timer),this._timeouts=[],this._cachedTimeouts=null},r.prototype.retry=function(e){if(this._timeout&&clearTimeout(this._timeout),!e)return!1;var t=(new Date).getTime();if(e&&t-this._operationStart>=this._maxRetryTime)return this._errors.push(e),this._errors.unshift(new Error("RetryOperation timeout occurred")),!1;this._errors.push(e);var r=this._timeouts.shift();if(void 0===r){if(!this._cachedTimeouts)return!1;this._errors.splice(0,this._errors.length-1),r=this._cachedTimeouts.slice(-1)}var n=this;return this._timer=setTimeout(function(){n._attempts++,n._operationTimeoutCb&&(n._timeout=setTimeout(function(){n._operationTimeoutCb(n._attempts)},n._operationTimeout),n._options.unref&&n._timeout.unref()),n._fn(n._attempts)},r),this._options.unref&&this._timer.unref(),!0},r.prototype.attempt=function(e,t){this._fn=e,t&&(t.timeout&&(this._operationTimeout=t.timeout),t.cb&&(this._operationTimeoutCb=t.cb));var r=this;this._operationTimeoutCb&&(this._timeout=setTimeout(function(){r._operationTimeoutCb()},r._operationTimeout)),this._operationStart=(new Date).getTime(),this._fn(this._attempts)},r.prototype.try=function(e){console.log("Using RetryOperation.try() is deprecated"),this.attempt(e)},r.prototype.start=function(e){console.log("Using RetryOperation.start() is deprecated"),this.attempt(e)},r.prototype.start=r.prototype.try,r.prototype.errors=function(){return this._errors},r.prototype.attempts=function(){return this._attempts},r.prototype.mainError=function(){if(0===this._errors.length)return null;for(var e={},t=null,r=0,n=0;n<this._errors.length;n++){var o=this._errors[n],i=o.message,s=(e[i]||0)+1;e[i]=s,s>=r&&(t=o,r=s)}return t}}}),require_retry=__commonJS({"node_modules/retry/lib/retry.js"(e){var t=require_retry_operation();e.operation=function(r){var n=e.timeouts(r);return new t(n,{forever:r&&(r.forever||r.retries===1/0),unref:r&&r.unref,maxRetryTime:r&&r.maxRetryTime})},e.timeouts=function(e){if(e instanceof Array)return[].concat(e);var t={retries:10,factor:2,minTimeout:1e3,maxTimeout:1/0,randomize:!1};for(var r in e)t[r]=e[r];if(t.minTimeout>t.maxTimeout)throw new Error("minTimeout is greater than maxTimeout");for(var n=[],o=0;o<t.retries;o++)n.push(this.createTimeout(o,t));return e&&e.forever&&!n.length&&n.push(this.createTimeout(o,t)),n.sort(function(e,t){return e-t}),n},e.createTimeout=function(e,t){var r=t.randomize?Math.random()+1:1,n=Math.round(r*Math.max(t.minTimeout,1)*Math.pow(t.factor,e));return n=Math.min(n,t.maxTimeout)},e.wrap=function(t,r,n){if(r instanceof Array&&(n=r,r=null),!n)for(var o in n=[],t)"function"==typeof t[o]&&n.push(o);for(var i=0;i<n.length;i++){var s=n[i],a=t[s];t[s]=function(n){var o=e.operation(r),i=Array.prototype.slice.call(arguments,1),s=i.pop();i.push(function(e){o.retry(e)||(e&&(arguments[0]=o.mainError()),s.apply(this,arguments))}),o.attempt(function(){n.apply(t,i)})}.bind(t,a),t[s].options=r}}}}),require_retry2=__commonJS({"node_modules/retry/index.js"(e,t){t.exports=require_retry()}}),require_p_retry=__commonJS({"node_modules/nft.storage/node_modules/p-retry/index.js"(e,t){"use strict";var r=require_retry2(),n=["Failed to fetch","NetworkError when attempting to fetch resource.","The Internet connection appears to be offline.","Network request failed"],o=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}},i=(e,t)=>new Promise((i,s)=>{t={onFailedAttempt:()=>{},retries:10,...t};const a=r.operation(t);a.attempt(async r=>{try{i(await e(r))}catch(e){if(!(e instanceof Error))return void s(new TypeError(`Non-error was thrown: "${e}". You should only throw errors.`));if(e instanceof o)a.stop(),s(e.originalError);else if(e instanceof TypeError&&(c=e.message,!n.includes(c)))a.stop(),s(e);else{((e,t,r)=>{const n=r.retries-(t-1);e.attemptNumber=t,e.retriesLeft=n})(e,r,t);try{await t.onFailedAttempt(e)}catch(e){return void s(e)}a.retry(e)||s(a.mainError())}}var c})});t.exports=i,t.exports.default=i,t.exports.AbortError=o}}),encode_1,MSB,REST,MSBALL,INT,decode2,MSB$1,REST$1,N1,N2,N3,N4,N5,N6,N7,N8,N9,length,varint2,_brrp_varint,varint_default;function encode3(e,t,r){t=t||[];for(var n=r=r||0;e>=INT;)t[r++]=255&e|MSB,e/=128;for(;e&MSBALL;)t[r++]=255&e|MSB,e>>>=7;return t[r]=0|e,encode3.bytes=r-n+1,t}function read(e,t){var r,n=0,o=0,i=t=t||0,s=e.length;do{if(i>=s)throw read.bytes=0,new RangeError("Could not decode varint");r=e[i++],n+=o<28?(r&REST$1)<<o:(r&REST$1)*Math.pow(2,o),o+=7}while(r>=MSB$1);return read.bytes=i-t,n}var init_varint=__esm({"node_modules/multiformats/esm/vendor/varint.js"(){encode_1=encode3,MSB=128,MSBALL=~(REST=127),INT=Math.pow(2,31),decode2=read,MSB$1=128,REST$1=127,N1=Math.pow(2,7),N2=Math.pow(2,14),N3=Math.pow(2,21),N4=Math.pow(2,28),N5=Math.pow(2,35),N6=Math.pow(2,42),N7=Math.pow(2,49),N8=Math.pow(2,56),N9=Math.pow(2,63),varint_default=_brrp_varint=varint2={encode:encode_1,decode:decode2,encodingLength:length=function(e){return e<N1?1:e<N2?2:e<N3?3:e<N4?4:e<N5?5:e<N6?6:e<N7?7:e<N8?8:e<N9?9:10}}}}),decode3,encodeTo,encodingLength,init_varint2=__esm({"node_modules/multiformats/esm/src/varint.js"(){init_varint(),decode3=e=>[varint_default.decode(e),varint_default.decode.bytes],encodeTo=(e,t,r=0)=>(varint_default.encode(e,t,r),t),encodingLength=e=>varint_default.encodingLength(e)}}),create,decode4,equals2,Digest,init_digest=__esm({"node_modules/multiformats/esm/src/hashes/digest.js"(){init_bytes(),init_varint2(),create=(e,t)=>{const r=t.byteLength,n=encodingLength(e),o=n+encodingLength(r),i=new Uint8Array(o+r);return encodeTo(e,i,0),encodeTo(r,i,n),i.set(t,o),new Digest(e,r,t,i)},decode4=e=>{const t=coerce(e),[r,n]=decode3(t),[o,i]=decode3(t.subarray(n)),s=t.subarray(n+i);if(s.byteLength!==o)throw new Error("Incorrect length");return new Digest(r,o,s,t)},equals2=(e,t)=>e===t||e.code===t.code&&e.size===t.size&&equals(e.bytes,t.bytes),Digest=class{constructor(e,t,r,n){this.code=e,this.size=t,this.digest=r,this.bytes=n}}}}),base32_exports={},base32,base32upper,base32pad,base32padupper,base32hex,base32hexupper,base32hexpad,base32hexpadupper,base32z;__export(base32_exports,{base32:()=>base32,base32hex:()=>base32hex,base32hexpad:()=>base32hexpad,base32hexpadupper:()=>base32hexpadupper,base32hexupper:()=>base32hexupper,base32pad:()=>base32pad,base32padupper:()=>base32padupper,base32upper:()=>base32upper,base32z:()=>base32z});var init_base32=__esm({"node_modules/multiformats/esm/src/bases/base32.js"(){init_base(),base32=rfc4648({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),base32upper=rfc4648({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),base32pad=rfc4648({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),base32padupper=rfc4648({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),base32hex=rfc4648({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),base32hexupper=rfc4648({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),base32hexpad=rfc4648({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),base32hexpadupper=rfc4648({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),base32z=rfc4648({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5})}}),CID,parseCIDtoBytes,toStringV0,toStringV1,DAG_PB_CODE,SHA_256_CODE,encodeCID,cidSymbol,readonly,hidden,version,deprecate,IS_CID_DEPRECATION,init_cid=__esm({"node_modules/multiformats/esm/src/cid.js"(){init_varint2(),init_digest(),init_base58(),init_base32(),init_bytes(),CID=class{constructor(e,t,r,n){this.code=t,this.version=e,this.multihash=r,this.bytes=n,this.byteOffset=n.byteOffset,this.byteLength=n.byteLength,this.asCID=this,this._baseCache=new Map,Object.defineProperties(this,{byteOffset:hidden,byteLength:hidden,code:readonly,version:readonly,multihash:readonly,bytes:readonly,_baseCache:hidden,asCID:hidden})}toV0(){if(0===this.version)return this;{const{code:e,multihash:t}=this;if(e!==DAG_PB_CODE)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(t.code!==SHA_256_CODE)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return CID.createV0(t)}}toV1(){switch(this.version){case 0:{const{code:e,digest:t}=this.multihash,r=create(e,t);return CID.createV1(this.code,r)}case 1:return this;default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}equals(e){return e&&this.code===e.code&&this.version===e.version&&equals2(this.multihash,e.multihash)}toString(e){const{bytes:t,version:r,_baseCache:n}=this;return 0===r?toStringV0(t,n,e||base58btc.encoder):toStringV1(t,n,e||base32.encoder)}toJSON(){return{code:this.code,version:this.version,hash:this.multihash.bytes}}get[Symbol.toStringTag](){return"CID"}[Symbol.for("nodejs.util.inspect.custom")](){return"CID("+this.toString()+")"}static isCID(e){return deprecate(/^0\.0/,IS_CID_DEPRECATION),!(!e||!e[cidSymbol]&&e.asCID!==e)}get toBaseEncodedString(){throw new Error("Deprecated, use .toString()")}get codec(){throw new Error('"codec" property is deprecated, use integer "code" property instead')}get buffer(){throw new Error("Deprecated .buffer property, use .bytes to get Uint8Array instead")}get multibaseName(){throw new Error('"multibaseName" property is deprecated')}get prefix(){throw new Error('"prefix" property is deprecated')}static asCID(e){if(e instanceof CID)return e;if(null!=e&&e.asCID===e){const{version:t,code:r,multihash:n,bytes:o}=e;return new CID(t,r,n,o||encodeCID(t,r,n.bytes))}if(null!=e&&!0===e[cidSymbol]){const{version:t,multihash:r,code:n}=e,o=decode4(r);return CID.create(t,n,o)}return null}static create(e,t,r){if("number"!=typeof t)throw new Error("String codecs are no longer supported");switch(e){case 0:if(t!==DAG_PB_CODE)throw new Error(`Version 0 CID must use dag-pb (code: ${DAG_PB_CODE}) block encoding`);return new CID(e,t,r,r.bytes);case 1:{const n=encodeCID(e,t,r.bytes);return new CID(e,t,r,n)}default:throw new Error("Invalid version")}}static createV0(e){return CID.create(0,DAG_PB_CODE,e)}static createV1(e,t){return CID.create(1,e,t)}static decode(e){const[t,r]=CID.decodeFirst(e);if(r.length)throw new Error("Incorrect length");return t}static decodeFirst(e){const t=CID.inspectBytes(e),r=t.size-t.multihashSize,n=coerce(e.subarray(r,r+t.multihashSize));if(n.byteLength!==t.multihashSize)throw new Error("Incorrect length");const o=n.subarray(t.multihashSize-t.digestSize),i=new Digest(t.multihashCode,t.digestSize,o,n);return[0===t.version?CID.createV0(i):CID.createV1(t.codec,i),e.subarray(t.size)]}static inspectBytes(e){let t=0;const r=()=>{const[r,n]=decode3(e.subarray(t));return t+=n,r};let n=r(),o=DAG_PB_CODE;if(18===n?(n=0,t=0):1===n&&(o=r()),0!==n&&1!==n)throw new RangeError(`Invalid CID version ${n}`);const i=t,s=r(),a=r(),c=t+a;return{version:n,codec:o,multihashCode:s,digestSize:a,multihashSize:c-i,size:c}}static parse(e,t){const[r,n]=parseCIDtoBytes(e,t),o=CID.decode(n);return o._baseCache.set(r,e),o}},parseCIDtoBytes=(e,t)=>{switch(e[0]){case"Q":{const r=t||base58btc;return[base58btc.prefix,r.decode(`${base58btc.prefix}${e}`)]}case base58btc.prefix:{const r=t||base58btc;return[base58btc.prefix,r.decode(e)]}case base32.prefix:{const r=t||base32;return[base32.prefix,r.decode(e)]}default:if(null==t)throw Error("To parse non base32 or base58btc encoded CID multibase decoder must be provided");return[e[0],t.decode(e)]}},toStringV0=(e,t,r)=>{const{prefix:n}=r;if(n!==base58btc.prefix)throw Error(`Cannot string encode V0 in ${r.name} encoding`);const o=t.get(n);if(null==o){const o=r.encode(e).slice(1);return t.set(n,o),o}return o},toStringV1=(e,t,r)=>{const{prefix:n}=r,o=t.get(n);if(null==o){const o=r.encode(e);return t.set(n,o),o}return o},DAG_PB_CODE=112,SHA_256_CODE=18,encodeCID=(e,t,r)=>{const n=encodingLength(e),o=n+encodingLength(t),i=new Uint8Array(o+r.byteLength);return encodeTo(e,i,0),encodeTo(t,i,n),i.set(r,o),i},cidSymbol=Symbol.for("@ipld/js-cid/CID"),readonly={writable:!1,configurable:!1,enumerable:!0},hidden={writable:!1,enumerable:!1,configurable:!1},version="0.0.0-dev",deprecate=(e,t)=>{if(!e.test(version))throw new Error(t);console.warn(t)},IS_CID_DEPRECATION="CID.isCID(v) is deprecated and will be removed in the next major release.\nFollowing code pattern:\n\nif (CID.isCID(value)) {\n  doSomethingWithCID(value)\n}\n\nIs replaced with:\n\nconst cid = CID.asCID(value)\nif (cid) {\n  // Make sure to use cid instead of value\n  doSomethingWithCID(cid)\n}\n"}}),from2,Hasher,init_hasher=__esm({"node_modules/multiformats/esm/src/hashes/hasher.js"(){init_digest(),from2=({name:e,code:t,encode:r})=>new Hasher(e,t,r),Hasher=class{constructor(e,t,r){this.name=e,this.code=t,this.encode=r}digest(e){if(e instanceof Uint8Array){const t=this.encode(e);return t instanceof Uint8Array?create(this.code,t):t.then(e=>create(this.code,e))}throw Error("Unknown type, must be binary type")}}}}),init_src=__esm({"node_modules/multiformats/esm/src/index.js"(){init_cid(),init_varint2(),init_bytes(),init_hasher(),init_digest()}}),raw_exports={},name,code,encode7,decode7;__export(raw_exports,{code:()=>code,decode:()=>decode7,encode:()=>encode7,name:()=>name});var init_raw=__esm({"node_modules/multiformats/esm/src/codecs/raw.js"(){init_bytes(),name="raw",code=85,encode7=e=>coerce(e),decode7=e=>coerce(e)}}),require_it_last=__commonJS({"node_modules/it-last/index.js"(e,t){"use strict";t.exports=async e=>{let t;for await(const r of e)t=r;return t}}}),require_it_pipe=__commonJS({"node_modules/it-pipe/index.js"(e,t){var r=(...e)=>{let t;for(;e.length;)t=e.shift()(t);return t},n=e=>e&&("function"==typeof e[Symbol.asyncIterator]||"function"==typeof e[Symbol.iterator]||"function"==typeof e.next),o=e=>e&&"function"==typeof e.sink&&n(e.source),i=e=>t=>(e.sink(t),e.source),s=(...e)=>{if(o(e[0])){const t=e[0];e[0]=()=>t.source}else if(n(e[0])){const t=e[0];e[0]=()=>t}if(e.length>1&&o(e[e.length-1])&&(e[e.length-1]=e[e.length-1].sink),e.length>2)for(let t=1;t<e.length-1;t++)o(e[t])&&(e[t]=i(e[t]));return r(...e)};t.exports=s,t.exports.pipe=s,t.exports.rawPipe=r,t.exports.isIterable=n,t.exports.isDuplex=o}}),require_it_batch=__commonJS({"node_modules/it-batch/index.js"(e,t){"use strict";t.exports=async function*(e,t=1){let r=[];t<1&&(t=1);for await(const n of e)for(r.push(n);r.length>=t;)yield r.slice(0,t),r=r.slice(t);for(;r.length;)yield r.slice(0,t),r=r.slice(t)}}}),require_it_parallel_batch=__commonJS({"node_modules/it-parallel-batch/index.js"(e,t){"use strict";var r=require_it_batch();t.exports=async function*(e,t=1){for await(const n of r(e,t)){const e=n.map(e=>e().then(e=>({ok:!0,value:e}),e=>({ok:!1,err:e})));for(let t=0;t<e.length;t++){const r=await e[t];if(!r.ok)throw r.err;yield r.value}}}}}),require_is_plain_obj=__commonJS({"node_modules/is-plain-obj/index.js"(e,t){"use strict";t.exports=e=>{if("[object Object]"!==Object.prototype.toString.call(e))return!1;const t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}}}),require_merge_options=__commonJS({"node_modules/merge-options/index.js"(e,t){"use strict";var r=require_is_plain_obj(),{hasOwnProperty:n}=Object.prototype,{propertyIsEnumerable:o}=Object,i=(e,t,r)=>Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0}),s=e,a={concatArrays:!1,ignoreUndefined:!1},c=e=>{const t=[];for(const r in e)n.call(e,r)&&t.push(r);if(Object.getOwnPropertySymbols){const r=Object.getOwnPropertySymbols(e);for(const n of r)o.call(e,n)&&t.push(n)}return t};function u(e){return Array.isArray(e)?function(e){const t=e.slice(0,0);return c(e).forEach(r=>{i(t,r,u(e[r]))}),t}(e):r(e)?function(e){const t=null===Object.getPrototypeOf(e)?Object.create(null):{};return c(e).forEach(r=>{i(t,r,u(e[r]))}),t}(e):e}var l=(e,t,r,n)=>(r.forEach(r=>{void 0===t[r]&&n.ignoreUndefined||(r in e&&e[r]!==Object.getPrototypeOf(e)?i(e,r,d(e[r],t[r],n)):i(e,r,u(t[r])))}),e);function d(e,t,o){return o.concatArrays&&Array.isArray(e)&&Array.isArray(t)?((e,t,r)=>{let o=e.slice(0,0),s=0;return[e,t].forEach(t=>{const a=[];for(let r=0;r<t.length;r++)n.call(t,r)&&(a.push(String(r)),i(o,s++,t===e?t[r]:u(t[r])));o=l(o,t,c(t).filter(e=>!a.includes(e)),r)}),o})(e,t,o):r(t)&&r(e)?l(e,t,c(t),o):u(t)}t.exports=function(...e){const t=d(u(a),this!==s&&this||{},a);let n={_:{}};for(const o of e)if(void 0!==o){if(!r(o))throw new TypeError("`"+o+"` is not an Option Object");n=d(n,{_:o},t)}return n._}}}),sha2_browser_exports={},sha,sha256,sha512;__export(sha2_browser_exports,{sha256:()=>sha256,sha512:()=>sha512});var init_sha2_browser=__esm({"node_modules/multiformats/esm/src/hashes/sha2-browser.js"(){init_hasher(),sha256=from2({name:"sha2-256",code:18,encode:(sha=e=>async t=>new Uint8Array(await crypto.subtle.digest(e,t)))("SHA-256")}),sha512=from2({name:"sha2-512",code:19,encode:sha("SHA-512")})}}),require_murmurHash3js=__commonJS({"node_modules/murmurhash3js-revisited/lib/murmurHash3js.js"(e,t){!function(r,n){"use strict";var o={version:"3.0.0",x86:{},x64:{},inputValidation:!0};function i(e){if(!Array.isArray(e)&&!ArrayBuffer.isView(e))return!1;for(var t=0;t<e.length;t++)if(!Number.isInteger(e[t])||e[t]<0||e[t]>255)return!1;return!0}function s(e,t){return(65535&e)*t+(((e>>>16)*t&65535)<<16)}function a(e,t){return e<<t|e>>>32-t}function c(e){return e=s(e^=e>>>16,2246822507),e=s(e^=e>>>13,3266489909),e^=e>>>16}function u(e,t){e=[e[0]>>>16,65535&e[0],e[1]>>>16,65535&e[1]],t=[t[0]>>>16,65535&t[0],t[1]>>>16,65535&t[1]];var r=[0,0,0,0];return r[3]+=e[3]+t[3],r[2]+=r[3]>>>16,r[3]&=65535,r[2]+=e[2]+t[2],r[1]+=r[2]>>>16,r[2]&=65535,r[1]+=e[1]+t[1],r[0]+=r[1]>>>16,r[1]&=65535,r[0]+=e[0]+t[0],r[0]&=65535,[r[0]<<16|r[1],r[2]<<16|r[3]]}function l(e,t){e=[e[0]>>>16,65535&e[0],e[1]>>>16,65535&e[1]],t=[t[0]>>>16,65535&t[0],t[1]>>>16,65535&t[1]];var r=[0,0,0,0];return r[3]+=e[3]*t[3],r[2]+=r[3]>>>16,r[3]&=65535,r[2]+=e[2]*t[3],r[1]+=r[2]>>>16,r[2]&=65535,r[2]+=e[3]*t[2],r[1]+=r[2]>>>16,r[2]&=65535,r[1]+=e[1]*t[3],r[0]+=r[1]>>>16,r[1]&=65535,r[1]+=e[2]*t[2],r[0]+=r[1]>>>16,r[1]&=65535,r[1]+=e[3]*t[1],r[0]+=r[1]>>>16,r[1]&=65535,r[0]+=e[0]*t[3]+e[1]*t[2]+e[2]*t[1]+e[3]*t[0],r[0]&=65535,[r[0]<<16|r[1],r[2]<<16|r[3]]}function d(e,t){return 32===(t%=64)?[e[1],e[0]]:t<32?[e[0]<<t|e[1]>>>32-t,e[1]<<t|e[0]>>>32-t]:(t-=32,[e[1]<<t|e[0]>>>32-t,e[0]<<t|e[1]>>>32-t])}function f(e,t){return 0===(t%=64)?e:t<32?[e[0]<<t|e[1]>>>32-t,e[1]<<t]:[e[1]<<t-32,0]}function h(e,t){return[e[0]^t[0],e[1]^t[1]]}function p(e){return e=h(e,[0,e[0]>>>1]),e=h(e=l(e,[4283543511,3981806797]),[0,e[0]>>>1]),e=h(e=l(e,[3301882366,444984403]),[0,e[0]>>>1])}o.x86.hash32=function(e,t){if(o.inputValidation&&!i(e))return n;t=t||0;for(var r=e.length%4,u=e.length-r,l=t,d=0,f=3432918353,h=461845907,p=0;p<u;p+=4)d=s(d=e[p]|e[p+1]<<8|e[p+2]<<16|e[p+3]<<24,f),d=s(d=a(d,15),h),l=s(l=a(l^=d,13),5)+3864292196;switch(d=0,r){case 3:d^=e[p+2]<<16;case 2:d^=e[p+1]<<8;case 1:d=s(d^=e[p],f),l^=d=s(d=a(d,15),h)}return(l=c(l^=e.length))>>>0},o.x86.hash128=function(e,t){if(o.inputValidation&&!i(e))return n;t=t||0;for(var r=e.length%16,u=e.length-r,l=t,d=t,f=t,h=t,p=0,m=0,y=0,_=0,g=597399067,b=2869860233,w=951274213,v=2716044179,E=0;E<u;E+=16)p=e[E]|e[E+1]<<8|e[E+2]<<16|e[E+3]<<24,m=e[E+4]|e[E+5]<<8|e[E+6]<<16|e[E+7]<<24,y=e[E+8]|e[E+9]<<8|e[E+10]<<16|e[E+11]<<24,_=e[E+12]|e[E+13]<<8|e[E+14]<<16|e[E+15]<<24,p=a(p=s(p,g),15),l=a(l^=p=s(p,b),19),l=s(l+=d,5)+1444728091,m=a(m=s(m,b),16),d=a(d^=m=s(m,w),17),d=s(d+=f,5)+197830471,y=a(y=s(y,w),17),f=a(f^=y=s(y,v),15),f=s(f+=h,5)+2530024501,_=a(_=s(_,v),18),h=a(h^=_=s(_,g),13),h=s(h+=l,5)+850148119;switch(p=0,m=0,y=0,_=0,r){case 15:_^=e[E+14]<<16;case 14:_^=e[E+13]<<8;case 13:_=s(_^=e[E+12],v),h^=_=s(_=a(_,18),g);case 12:y^=e[E+11]<<24;case 11:y^=e[E+10]<<16;case 10:y^=e[E+9]<<8;case 9:y=s(y^=e[E+8],w),f^=y=s(y=a(y,17),v);case 8:m^=e[E+7]<<24;case 7:m^=e[E+6]<<16;case 6:m^=e[E+5]<<8;case 5:m=s(m^=e[E+4],b),d^=m=s(m=a(m,16),w);case 4:p^=e[E+3]<<24;case 3:p^=e[E+2]<<16;case 2:p^=e[E+1]<<8;case 1:p=s(p^=e[E],g),l^=p=s(p=a(p,15),b)}return l^=e.length,l+=d^=e.length,l+=f^=e.length,d+=l+=h^=e.length,f+=l,h+=l,l=c(l),l+=d=c(d),l+=f=c(f),d+=l+=h=c(h),f+=l,h+=l,("00000000"+(l>>>0).toString(16)).slice(-8)+("00000000"+(d>>>0).toString(16)).slice(-8)+("00000000"+(f>>>0).toString(16)).slice(-8)+("00000000"+(h>>>0).toString(16)).slice(-8)},o.x64.hash128=function(e,t){if(o.inputValidation&&!i(e))return n;t=t||0;for(var r=e.length%16,s=e.length-r,a=[0,t],c=[0,t],m=[0,0],y=[0,0],_=[2277735313,289559509],g=[1291169091,658871167],b=0;b<s;b+=16)m=[e[b+4]|e[b+5]<<8|e[b+6]<<16|e[b+7]<<24,e[b]|e[b+1]<<8|e[b+2]<<16|e[b+3]<<24],y=[e[b+12]|e[b+13]<<8|e[b+14]<<16|e[b+15]<<24,e[b+8]|e[b+9]<<8|e[b+10]<<16|e[b+11]<<24],m=d(m=l(m,_),31),a=u(a=d(a=h(a,m=l(m,g)),27),c),a=u(l(a,[0,5]),[0,1390208809]),y=d(y=l(y,g),33),c=u(c=d(c=h(c,y=l(y,_)),31),a),c=u(l(c,[0,5]),[0,944331445]);switch(m=[0,0],y=[0,0],r){case 15:y=h(y,f([0,e[b+14]],48));case 14:y=h(y,f([0,e[b+13]],40));case 13:y=h(y,f([0,e[b+12]],32));case 12:y=h(y,f([0,e[b+11]],24));case 11:y=h(y,f([0,e[b+10]],16));case 10:y=h(y,f([0,e[b+9]],8));case 9:y=l(y=h(y,[0,e[b+8]]),g),c=h(c,y=l(y=d(y,33),_));case 8:m=h(m,f([0,e[b+7]],56));case 7:m=h(m,f([0,e[b+6]],48));case 6:m=h(m,f([0,e[b+5]],40));case 5:m=h(m,f([0,e[b+4]],32));case 4:m=h(m,f([0,e[b+3]],24));case 3:m=h(m,f([0,e[b+2]],16));case 2:m=h(m,f([0,e[b+1]],8));case 1:m=l(m=h(m,[0,e[b]]),_),a=h(a,m=l(m=d(m,31),g))}return a=u(a=h(a,[0,e.length]),c=h(c,[0,e.length])),c=u(c,a),a=u(a=p(a),c=p(c)),c=u(c,a),("00000000"+(a[0]>>>0).toString(16)).slice(-8)+("00000000"+(a[1]>>>0).toString(16)).slice(-8)+("00000000"+(c[0]>>>0).toString(16)).slice(-8)+("00000000"+(c[1]>>>0).toString(16)).slice(-8)},void 0!==e?(void 0!==t&&t.exports&&(e=t.exports=o),e.murmurHash3=o):"function"==typeof define&&define.amd?define([],function(){return o}):(o._murmurHash3=r.murmurHash3,o.noConflict=function(){return r.murmurHash3=o._murmurHash3,o._murmurHash3=n,o.noConflict=n,o},r.murmurHash3=o)}(e)}}),require_murmurhash3js_revisited=__commonJS({"node_modules/murmurhash3js-revisited/index.js"(e,t){t.exports=require_murmurHash3js()}}),require_err_code=__commonJS({"node_modules/err-code/index.js"(e,t){"use strict";function r(e,t){for(const r in t)Object.defineProperty(e,r,{value:t[r],enumerable:!0,configurable:!0});return e}t.exports=function(e,t,n){if(!e||"string"==typeof e)throw new TypeError("Please pass an Error to err-code");n||(n={}),"object"==typeof t&&(n=t,t=""),t&&(n.code=t);try{return r(e,n)}catch(t){n.message=e.message,n.stack=e.stack;const o=function(){};o.prototype=Object.create(Object.getPrototypeOf(e));return r(new o,n)}}}}),require_aspromise=__commonJS({"node_modules/@protobufjs/aspromise/index.js"(e,t){"use strict";t.exports=function(e,t){var r=new Array(arguments.length-1),n=0,o=2,i=!0;for(;o<arguments.length;)r[n++]=arguments[o++];return new Promise(function(o,s){r[n]=function(e){if(i)if(i=!1,e)s(e);else{for(var t=new Array(arguments.length-1),r=0;r<t.length;)t[r++]=arguments[r];o.apply(null,t)}};try{e.apply(t||null,r)}catch(e){i&&(i=!1,s(e))}})}}}),require_base64=__commonJS({"node_modules/@protobufjs/base64/index.js"(e){"use strict";var t=e;t.length=function(e){var t=e.length;if(!t)return 0;for(var r=0;--t%4>1&&"="===e.charAt(t);)++r;return Math.ceil(3*e.length)/4-r};var r,n=new Array(64),o=new Array(123);for(r=0;r<64;)o[n[r]=r<26?r+65:r<52?r+71:r<62?r-4:r-59|43]=r++;t.encode=function(e,t,r){for(var o,i=null,s=[],a=0,c=0;t<r;){var u=e[t++];switch(c){case 0:s[a++]=n[u>>2],o=(3&u)<<4,c=1;break;case 1:s[a++]=n[o|u>>4],o=(15&u)<<2,c=2;break;case 2:s[a++]=n[o|u>>6],s[a++]=n[63&u],c=0}a>8191&&((i||(i=[])).push(String.fromCharCode.apply(String,s)),a=0)}return c&&(s[a++]=n[o],s[a++]=61,1===c&&(s[a++]=61)),i?(a&&i.push(String.fromCharCode.apply(String,s.slice(0,a))),i.join("")):String.fromCharCode.apply(String,s.slice(0,a))};var i="invalid encoding";t.decode=function(e,t,r){for(var n,s=r,a=0,c=0;c<e.length;){var u=e.charCodeAt(c++);if(61===u&&a>1)break;if(void 0===(u=o[u]))throw Error(i);switch(a){case 0:n=u,a=1;break;case 1:t[r++]=n<<2|(48&u)>>4,n=u,a=2;break;case 2:t[r++]=(15&n)<<4|(60&u)>>2,n=u,a=3;break;case 3:t[r++]=(3&n)<<6|u,a=0}}if(1===a)throw Error(i);return r-s},t.test=function(e){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e)}}}),require_eventemitter=__commonJS({"node_modules/@protobufjs/eventemitter/index.js"(e,t){"use strict";function r(){this._listeners={}}t.exports=r,r.prototype.on=function(e,t,r){return(this._listeners[e]||(this._listeners[e]=[])).push({fn:t,ctx:r||this}),this},r.prototype.off=function(e,t){if(void 0===e)this._listeners={};else if(void 0===t)this._listeners[e]=[];else for(var r=this._listeners[e],n=0;n<r.length;)r[n].fn===t?r.splice(n,1):++n;return this},r.prototype.emit=function(e){var t=this._listeners[e];if(t){for(var r=[],n=1;n<arguments.length;)r.push(arguments[n++]);for(n=0;n<t.length;)t[n].fn.apply(t[n++].ctx,r)}return this}}}),require_float=__commonJS({"node_modules/@protobufjs/float/index.js"(e,t){"use strict";function r(e){return"undefined"!=typeof Float32Array?function(){var t=new Float32Array([-0]),r=new Uint8Array(t.buffer),n=128===r[3];function o(e,n,o){t[0]=e,n[o]=r[0],n[o+1]=r[1],n[o+2]=r[2],n[o+3]=r[3]}function i(e,n,o){t[0]=e,n[o]=r[3],n[o+1]=r[2],n[o+2]=r[1],n[o+3]=r[0]}function s(e,n){return r[0]=e[n],r[1]=e[n+1],r[2]=e[n+2],r[3]=e[n+3],t[0]}function a(e,n){return r[3]=e[n],r[2]=e[n+1],r[1]=e[n+2],r[0]=e[n+3],t[0]}e.writeFloatLE=n?o:i,e.writeFloatBE=n?i:o,e.readFloatLE=n?s:a,e.readFloatBE=n?a:s}():function(){function t(e,t,r,n){var o=t<0?1:0;if(o&&(t=-t),0===t)e(1/t>0?0:2147483648,r,n);else if(isNaN(t))e(2143289344,r,n);else if(t>34028234663852886e22)e((o<<31|2139095040)>>>0,r,n);else if(t<11754943508222875e-54)e((o<<31|Math.round(t/1401298464324817e-60))>>>0,r,n);else{var i=Math.floor(Math.log(t)/Math.LN2);e((o<<31|i+127<<23|8388607&Math.round(t*Math.pow(2,-i)*8388608))>>>0,r,n)}}function r(e,t,r){var n=e(t,r),o=2*(n>>31)+1,i=n>>>23&255,s=8388607&n;return 255===i?s?NaN:o*(1/0):0===i?1401298464324817e-60*o*s:o*Math.pow(2,i-150)*(s+8388608)}e.writeFloatLE=t.bind(null,n),e.writeFloatBE=t.bind(null,o),e.readFloatLE=r.bind(null,i),e.readFloatBE=r.bind(null,s)}(),"undefined"!=typeof Float64Array?function(){var t=new Float64Array([-0]),r=new Uint8Array(t.buffer),n=128===r[7];function o(e,n,o){t[0]=e,n[o]=r[0],n[o+1]=r[1],n[o+2]=r[2],n[o+3]=r[3],n[o+4]=r[4],n[o+5]=r[5],n[o+6]=r[6],n[o+7]=r[7]}function i(e,n,o){t[0]=e,n[o]=r[7],n[o+1]=r[6],n[o+2]=r[5],n[o+3]=r[4],n[o+4]=r[3],n[o+5]=r[2],n[o+6]=r[1],n[o+7]=r[0]}function s(e,n){return r[0]=e[n],r[1]=e[n+1],r[2]=e[n+2],r[3]=e[n+3],r[4]=e[n+4],r[5]=e[n+5],r[6]=e[n+6],r[7]=e[n+7],t[0]}function a(e,n){return r[7]=e[n],r[6]=e[n+1],r[5]=e[n+2],r[4]=e[n+3],r[3]=e[n+4],r[2]=e[n+5],r[1]=e[n+6],r[0]=e[n+7],t[0]}e.writeDoubleLE=n?o:i,e.writeDoubleBE=n?i:o,e.readDoubleLE=n?s:a,e.readDoubleBE=n?a:s}():function(){function t(e,t,r,n,o,i){var s=n<0?1:0;if(s&&(n=-n),0===n)e(0,o,i+t),e(1/n>0?0:2147483648,o,i+r);else if(isNaN(n))e(0,o,i+t),e(2146959360,o,i+r);else if(n>17976931348623157e292)e(0,o,i+t),e((s<<31|2146435072)>>>0,o,i+r);else{var a;if(n<22250738585072014e-324)e((a=n/5e-324)>>>0,o,i+t),e((s<<31|a/4294967296)>>>0,o,i+r);else{var c=Math.floor(Math.log(n)/Math.LN2);1024===c&&(c=1023),e(4503599627370496*(a=n*Math.pow(2,-c))>>>0,o,i+t),e((s<<31|c+1023<<20|1048576*a&1048575)>>>0,o,i+r)}}}function r(e,t,r,n,o){var i=e(n,o+t),s=e(n,o+r),a=2*(s>>31)+1,c=s>>>20&2047,u=4294967296*(1048575&s)+i;return 2047===c?u?NaN:a*(1/0):0===c?5e-324*a*u:a*Math.pow(2,c-1075)*(u+4503599627370496)}e.writeDoubleLE=t.bind(null,n,0,4),e.writeDoubleBE=t.bind(null,o,4,0),e.readDoubleLE=r.bind(null,i,0,4),e.readDoubleBE=r.bind(null,s,4,0)}(),e}function n(e,t,r){t[r]=255&e,t[r+1]=e>>>8&255,t[r+2]=e>>>16&255,t[r+3]=e>>>24}function o(e,t,r){t[r]=e>>>24,t[r+1]=e>>>16&255,t[r+2]=e>>>8&255,t[r+3]=255&e}function i(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0}function s(e,t){return(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])>>>0}t.exports=r(r)}}),require_inquire=__commonJS({"node_modules/@protobufjs/inquire/index.js"(exports,module){"use strict";function inquire(moduleName){try{var mod=eval("quire".replace(/^/,"re"))(moduleName);if(mod&&(mod.length||Object.keys(mod).length))return mod}catch(e){}return null}module.exports=inquire}}),require_utf8=__commonJS({"node_modules/@protobufjs/utf8/index.js"(e){"use strict";var t=e;t.length=function(e){for(var t=0,r=0,n=0;n<e.length;++n)(r=e.charCodeAt(n))<128?t+=1:r<2048?t+=2:55296==(64512&r)&&56320==(64512&e.charCodeAt(n+1))?(++n,t+=4):t+=3;return t},t.read=function(e,t,r){if(r-t<1)return"";for(var n,o=null,i=[],s=0;t<r;)(n=e[t++])<128?i[s++]=n:n>191&&n<224?i[s++]=(31&n)<<6|63&e[t++]:n>239&&n<365?(n=((7&n)<<18|(63&e[t++])<<12|(63&e[t++])<<6|63&e[t++])-65536,i[s++]=55296+(n>>10),i[s++]=56320+(1023&n)):i[s++]=(15&n)<<12|(63&e[t++])<<6|63&e[t++],s>8191&&((o||(o=[])).push(String.fromCharCode.apply(String,i)),s=0);return o?(s&&o.push(String.fromCharCode.apply(String,i.slice(0,s))),o.join("")):String.fromCharCode.apply(String,i.slice(0,s))},t.write=function(e,t,r){for(var n,o,i=r,s=0;s<e.length;++s)(n=e.charCodeAt(s))<128?t[r++]=n:n<2048?(t[r++]=n>>6|192,t[r++]=63&n|128):55296==(64512&n)&&56320==(64512&(o=e.charCodeAt(s+1)))?(n=65536+((1023&n)<<10)+(1023&o),++s,t[r++]=n>>18|240,t[r++]=n>>12&63|128,t[r++]=n>>6&63|128,t[r++]=63&n|128):(t[r++]=n>>12|224,t[r++]=n>>6&63|128,t[r++]=63&n|128);return r-i}}}),require_pool=__commonJS({"node_modules/@protobufjs/pool/index.js"(e,t){"use strict";t.exports=function(e,t,r){var n=r||8192,o=n>>>1,i=null,s=n;return function(r){if(r<1||r>o)return e(r);s+r>n&&(i=e(n),s=0);var a=t.call(i,s,s+=r);return 7&s&&(s=1+(7|s)),a}}}}),require_longbits=__commonJS({"node_modules/protobufjs/src/util/longbits.js"(e,t){"use strict";t.exports=n;var r=require_minimal();function n(e,t){this.lo=e>>>0,this.hi=t>>>0}var o=n.zero=new n(0,0);o.toNumber=function(){return 0},o.zzEncode=o.zzDecode=function(){return this},o.length=function(){return 1};var i=n.zeroHash="\0\0\0\0\0\0\0\0";n.fromNumber=function(e){if(0===e)return o;var t=e<0;t&&(e=-e);var r=e>>>0,i=(e-r)/4294967296>>>0;return t&&(i=~i>>>0,r=~r>>>0,++r>4294967295&&(r=0,++i>4294967295&&(i=0))),new n(r,i)},n.from=function(e){if("number"==typeof e)return n.fromNumber(e);if(r.isString(e)){if(!r.Long)return n.fromNumber(parseInt(e,10));e=r.Long.fromString(e)}return e.low||e.high?new n(e.low>>>0,e.high>>>0):o},n.prototype.toNumber=function(e){if(!e&&this.hi>>>31){var t=1+~this.lo>>>0,r=~this.hi>>>0;return t||(r=r+1>>>0),-(t+4294967296*r)}return this.lo+4294967296*this.hi},n.prototype.toLong=function(e){return r.Long?new r.Long(0|this.lo,0|this.hi,Boolean(e)):{low:0|this.lo,high:0|this.hi,unsigned:Boolean(e)}};var s=String.prototype.charCodeAt;n.fromHash=function(e){return e===i?o:new n((s.call(e,0)|s.call(e,1)<<8|s.call(e,2)<<16|s.call(e,3)<<24)>>>0,(s.call(e,4)|s.call(e,5)<<8|s.call(e,6)<<16|s.call(e,7)<<24)>>>0)},n.prototype.toHash=function(){return String.fromCharCode(255&this.lo,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,255&this.hi,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)},n.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},n.prototype.zzDecode=function(){var e=-(1&this.lo);return this.lo=((this.lo>>>1|this.hi<<31)^e)>>>0,this.hi=(this.hi>>>1^e)>>>0,this},n.prototype.length=function(){var e=this.lo,t=(this.lo>>>28|this.hi<<4)>>>0,r=this.hi>>>24;return 0===r?0===t?e<16384?e<128?1:2:e<2097152?3:4:t<16384?t<128?5:6:t<2097152?7:8:r<128?9:10}}}),require_minimal=__commonJS({"node_modules/protobufjs/src/util/minimal.js"(e){"use strict";var t=e;function r(e,t,r){for(var n=Object.keys(t),o=0;o<n.length;++o)void 0!==e[n[o]]&&r||(e[n[o]]=t[n[o]]);return e}function n(e){function t(e,n){if(!(this instanceof t))return new t(e,n);Object.defineProperty(this,"message",{get:function(){return e}}),Error.captureStackTrace?Error.captureStackTrace(this,t):Object.defineProperty(this,"stack",{value:(new Error).stack||""}),n&&r(this,n)}return(t.prototype=Object.create(Error.prototype)).constructor=t,Object.defineProperty(t.prototype,"name",{get:function(){return e}}),t.prototype.toString=function(){return this.name+": "+this.message},t}t.asPromise=require_aspromise(),t.base64=require_base64(),t.EventEmitter=require_eventemitter(),t.float=require_float(),t.inquire=require_inquire(),t.utf8=require_utf8(),t.pool=require_pool(),t.LongBits=require_longbits(),t.isNode=Boolean("undefined"!=typeof global&&global&&global.process&&global.process.versions&&global.process.versions.node),t.global=t.isNode&&global||"undefined"!=typeof window&&window||"undefined"!=typeof self&&self||e,t.emptyArray=Object.freeze?Object.freeze([]):[],t.emptyObject=Object.freeze?Object.freeze({}):{},t.isInteger=Number.isInteger||function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e},t.isString=function(e){return"string"==typeof e||e instanceof String},t.isObject=function(e){return e&&"object"==typeof e},t.isset=t.isSet=function(e,t){var r=e[t];return!(null==r||!e.hasOwnProperty(t))&&("object"!=typeof r||(Array.isArray(r)?r.length:Object.keys(r).length)>0)},t.Buffer=function(){try{var e=t.inquire("buffer").Buffer;return e.prototype.utf8Write?e:null}catch(e){return null}}(),t._Buffer_from=null,t._Buffer_allocUnsafe=null,t.newBuffer=function(e){return"number"==typeof e?t.Buffer?t._Buffer_allocUnsafe(e):new t.Array(e):t.Buffer?t._Buffer_from(e):"undefined"==typeof Uint8Array?e:new Uint8Array(e)},t.Array="undefined"!=typeof Uint8Array?Uint8Array:Array,t.Long=t.global.dcodeIO&&t.global.dcodeIO.Long||t.global.Long||t.inquire("long"),t.key2Re=/^true|false|0|1$/,t.key32Re=/^-?(?:0|[1-9][0-9]*)$/,t.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,t.longToHash=function(e){return e?t.LongBits.from(e).toHash():t.LongBits.zeroHash},t.longFromHash=function(e,r){var n=t.LongBits.fromHash(e);return t.Long?t.Long.fromBits(n.lo,n.hi,r):n.toNumber(Boolean(r))},t.merge=r,t.lcFirst=function(e){return e.charAt(0).toLowerCase()+e.substring(1)},t.newError=n,t.ProtocolError=n("ProtocolError"),t.oneOfGetter=function(e){for(var t={},r=0;r<e.length;++r)t[e[r]]=1;return function(){for(var e=Object.keys(this),r=e.length-1;r>-1;--r)if(1===t[e[r]]&&void 0!==this[e[r]]&&null!==this[e[r]])return e[r]}},t.oneOfSetter=function(e){return function(t){for(var r=0;r<e.length;++r)e[r]!==t&&delete this[e[r]]}},t.toJSONOptions={longs:String,enums:String,bytes:String,json:!0},t._configure=function(){var e=t.Buffer;e?(t._Buffer_from=e.from!==Uint8Array.from&&e.from||function(t,r){return new e(t,r)},t._Buffer_allocUnsafe=e.allocUnsafe||function(t){return new e(t)}):t._Buffer_from=t._Buffer_allocUnsafe=null}}}),require_writer=__commonJS({"node_modules/protobufjs/src/writer.js"(e,t){"use strict";t.exports=l;var r,n=require_minimal(),o=n.LongBits,i=n.base64,s=n.utf8;function a(e,t,r){this.fn=e,this.len=t,this.next=void 0,this.val=r}function c(){}function u(e){this.head=e.head,this.tail=e.tail,this.len=e.len,this.next=e.states}function l(){this.len=0,this.head=new a(c,0,0),this.tail=this.head,this.states=null}var d=function(){return n.Buffer?function(){return(l.create=function(){return new r})()}:function(){return new l}};function f(e,t,r){t[r]=255&e}function h(e,t){this.len=e,this.next=void 0,this.val=t}function p(e,t,r){for(;e.hi;)t[r++]=127&e.lo|128,e.lo=(e.lo>>>7|e.hi<<25)>>>0,e.hi>>>=7;for(;e.lo>127;)t[r++]=127&e.lo|128,e.lo=e.lo>>>7;t[r++]=e.lo}function m(e,t,r){t[r]=255&e,t[r+1]=e>>>8&255,t[r+2]=e>>>16&255,t[r+3]=e>>>24}l.create=d(),l.alloc=function(e){return new n.Array(e)},n.Array!==Array&&(l.alloc=n.pool(l.alloc,n.Array.prototype.subarray)),l.prototype._push=function(e,t,r){return this.tail=this.tail.next=new a(e,t,r),this.len+=t,this},h.prototype=Object.create(a.prototype),h.prototype.fn=function(e,t,r){for(;e>127;)t[r++]=127&e|128,e>>>=7;t[r]=e},l.prototype.uint32=function(e){return this.len+=(this.tail=this.tail.next=new h((e>>>=0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this},l.prototype.int32=function(e){return e<0?this._push(p,10,o.fromNumber(e)):this.uint32(e)},l.prototype.sint32=function(e){return this.uint32((e<<1^e>>31)>>>0)},l.prototype.uint64=function(e){var t=o.from(e);return this._push(p,t.length(),t)},l.prototype.int64=l.prototype.uint64,l.prototype.sint64=function(e){var t=o.from(e).zzEncode();return this._push(p,t.length(),t)},l.prototype.bool=function(e){return this._push(f,1,e?1:0)},l.prototype.fixed32=function(e){return this._push(m,4,e>>>0)},l.prototype.sfixed32=l.prototype.fixed32,l.prototype.fixed64=function(e){var t=o.from(e);return this._push(m,4,t.lo)._push(m,4,t.hi)},l.prototype.sfixed64=l.prototype.fixed64,l.prototype.float=function(e){return this._push(n.float.writeFloatLE,4,e)},l.prototype.double=function(e){return this._push(n.float.writeDoubleLE,8,e)};var y=n.Array.prototype.set?function(e,t,r){t.set(e,r)}:function(e,t,r){for(var n=0;n<e.length;++n)t[r+n]=e[n]};l.prototype.bytes=function(e){var t=e.length>>>0;if(!t)return this._push(f,1,0);if(n.isString(e)){var r=l.alloc(t=i.length(e));i.decode(e,r,0),e=r}return this.uint32(t)._push(y,t,e)},l.prototype.string=function(e){var t=s.length(e);return t?this.uint32(t)._push(s.write,t,e):this._push(f,1,0)},l.prototype.fork=function(){return this.states=new u(this),this.head=this.tail=new a(c,0,0),this.len=0,this},l.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 a(c,0,0),this.len=0),this},l.prototype.ldelim=function(){var e=this.head,t=this.tail,r=this.len;return this.reset().uint32(r),r&&(this.tail.next=e.next,this.tail=t,this.len+=r),this},l.prototype.finish=function(){for(var e=this.head.next,t=this.constructor.alloc(this.len),r=0;e;)e.fn(e.val,t,r),r+=e.len,e=e.next;return t},l._configure=function(e){r=e,l.create=d(),r._configure()}}}),require_writer_buffer=__commonJS({"node_modules/protobufjs/src/writer_buffer.js"(e,t){"use strict";t.exports=o;var r=require_writer();(o.prototype=Object.create(r.prototype)).constructor=o;var n=require_minimal();function o(){r.call(this)}function i(e,t,r){e.length<40?n.utf8.write(e,t,r):t.utf8Write?t.utf8Write(e,r):t.write(e,r)}o._configure=function(){o.alloc=n._Buffer_allocUnsafe,o.writeBytesBuffer=n.Buffer&&n.Buffer.prototype instanceof Uint8Array&&"set"===n.Buffer.prototype.set.name?function(e,t,r){t.set(e,r)}:function(e,t,r){if(e.copy)e.copy(t,r,0,e.length);else for(var n=0;n<e.length;)t[r++]=e[n++]}},o.prototype.bytes=function(e){n.isString(e)&&(e=n._Buffer_from(e,"base64"));var t=e.length>>>0;return this.uint32(t),t&&this._push(o.writeBytesBuffer,t,e),this},o.prototype.string=function(e){var t=n.Buffer.byteLength(e);return this.uint32(t),t&&this._push(i,t,e),this},o._configure()}}),require_reader=__commonJS({"node_modules/protobufjs/src/reader.js"(e,t){"use strict";t.exports=a;var r,n=require_minimal(),o=n.LongBits,i=n.utf8;function s(e,t){return RangeError("index out of range: "+e.pos+" + "+(t||1)+" > "+e.len)}function a(e){this.buf=e,this.pos=0,this.len=e.length}var c,u="undefined"!=typeof Uint8Array?function(e){if(e instanceof Uint8Array||Array.isArray(e))return new a(e);throw Error("illegal buffer")}:function(e){if(Array.isArray(e))return new a(e);throw Error("illegal buffer")},l=function(){return n.Buffer?function(e){return(a.create=function(e){return n.Buffer.isBuffer(e)?new r(e):u(e)})(e)}:u};function d(){var e=new o(0,0),t=0;if(!(this.len-this.pos>4)){for(;t<3;++t){if(this.pos>=this.len)throw s(this);if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e}return e.lo=(e.lo|(127&this.buf[this.pos++])<<7*t)>>>0,e}for(;t<4;++t)if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e;if(e.lo=(e.lo|(127&this.buf[this.pos])<<28)>>>0,e.hi=(e.hi|(127&this.buf[this.pos])>>4)>>>0,this.buf[this.pos++]<128)return e;if(t=0,this.len-this.pos>4){for(;t<5;++t)if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}else for(;t<5;++t){if(this.pos>=this.len)throw s(this);if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}throw Error("invalid varint encoding")}function f(e,t){return(e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24)>>>0}function h(){if(this.pos+8>this.len)throw s(this,8);return new o(f(this.buf,this.pos+=4),f(this.buf,this.pos+=4))}a.create=l(),a.prototype._slice=n.Array.prototype.subarray||n.Array.prototype.slice,a.prototype.uint32=(c=4294967295,function(){if(c=(127&this.buf[this.pos])>>>0,this.buf[this.pos++]<128)return c;if(c=(c|(127&this.buf[this.pos])<<7)>>>0,this.buf[this.pos++]<128)return c;if(c=(c|(127&this.buf[this.pos])<<14)>>>0,this.buf[this.pos++]<128)return c;if(c=(c|(127&this.buf[this.pos])<<21)>>>0,this.buf[this.pos++]<128)return c;if(c=(c|(15&this.buf[this.pos])<<28)>>>0,this.buf[this.pos++]<128)return c;if((this.pos+=5)>this.len)throw this.pos=this.len,s(this,10);return c}),a.prototype.int32=function(){return 0|this.uint32()},a.prototype.sint32=function(){var e=this.uint32();return e>>>1^-(1&e)},a.prototype.bool=function(){return 0!==this.uint32()},a.prototype.fixed32=function(){if(this.pos+4>this.len)throw s(this,4);return f(this.buf,this.pos+=4)},a.prototype.sfixed32=function(){if(this.pos+4>this.len)throw s(this,4);return 0|f(this.buf,this.pos+=4)},a.prototype.float=function(){if(this.pos+4>this.len)throw s(this,4);var e=n.float.readFloatLE(this.buf,this.pos);return this.pos+=4,e},a.prototype.double=function(){if(this.pos+8>this.len)throw s(this,4);var e=n.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,e},a.prototype.bytes=function(){var e=this.uint32(),t=this.pos,r=this.pos+e;if(r>this.len)throw s(this,e);return this.pos+=e,Array.isArray(this.buf)?this.buf.slice(t,r):t===r?new this.buf.constructor(0):this._slice.call(this.buf,t,r)},a.prototype.string=function(){var e=this.bytes();return i.read(e,0,e.length)},a.prototype.skip=function(e){if("number"==typeof e){if(this.pos+e>this.len)throw s(this,e);this.pos+=e}else do{if(this.pos>=this.len)throw s(this)}while(128&this.buf[this.pos++]);return this},a.prototype.skipType=function(e){switch(e){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;4!=(e=7&this.uint32());)this.skipType(e);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+e+" at offset "+this.pos)}return this},a._configure=function(e){r=e,a.create=l(),r._configure();var t=n.Long?"toLong":"toNumber";n.merge(a.prototype,{int64:function(){return d.call(this)[t](!1)},uint64:function(){return d.call(this)[t](!0)},sint64:function(){return d.call(this).zzDecode()[t](!1)},fixed64:function(){return h.call(this)[t](!0)},sfixed64:function(){return h.call(this)[t](!1)}})}}}),require_reader_buffer=__commonJS({"node_modules/protobufjs/src/reader_buffer.js"(e,t){"use strict";t.exports=o;var r=require_reader();(o.prototype=Object.create(r.prototype)).constructor=o;var n=require_minimal();function o(e){r.call(this,e)}o._configure=function(){n.Buffer&&(o.prototype._slice=n.Buffer.prototype.slice)},o.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))},o._configure()}}),require_service=__commonJS({"node_modules/protobufjs/src/rpc/service.js"(e,t){"use strict";t.exports=n;var r=require_minimal();function n(e,t,n){if("function"!=typeof e)throw TypeError("rpcImpl must be a function");r.EventEmitter.call(this),this.rpcImpl=e,this.requestDelimited=Boolean(t),this.responseDelimited=Boolean(n)}(n.prototype=Object.create(r.EventEmitter.prototype)).constructor=n,n.prototype.rpcCall=function e(t,n,o,i,s){if(!i)throw TypeError("request must be specified");var a=this;if(!s)return r.asPromise(e,a,t,n,o,i);if(a.rpcImpl)try{return a.rpcImpl(t,n[a.requestDelimited?"encodeDelimited":"encode"](i).finish(),function(e,r){if(e)return a.emit("error",e,t),s(e);if(null!==r){if(!(r instanceof o))try{r=o[a.responseDelimited?"decodeDelimited":"decode"](r)}catch(e){return a.emit("error",e,t),s(e)}return a.emit("data",r,t),s(null,r)}a.end(!0)})}catch(e){return a.emit("error",e,t),void setTimeout(function(){s(e)},0)}else setTimeout(function(){s(Error("already ended"))},0)},n.prototype.end=function(e){return this.rpcImpl&&(e||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}}}),require_rpc=__commonJS({"node_modules/protobufjs/src/rpc.js"(e){"use strict";e.Service=require_service()}}),require_roots=__commonJS({"node_modules/protobufjs/src/roots.js"(e,t){"use strict";t.exports={}}}),require_index_minimal=__commonJS({"node_modules/protobufjs/src/index-minimal.js"(e){"use strict";var t=e;function r(){t.util._configure(),t.Writer._configure(t.BufferWriter),t.Reader._configure(t.BufferReader)}t.build="minimal",t.Writer=require_writer(),t.BufferWriter=require_writer_buffer(),t.Reader=require_reader(),t.BufferReader=require_reader_buffer(),t.util=require_minimal(),t.rpc=require_rpc(),t.roots=require_roots(),t.configure=r,r()}}),require_minimal2=__commonJS({"node_modules/protobufjs/minimal.js"(e,t){"use strict";t.exports=require_index_minimal()}}),require_it_all=__commonJS({"node_modules/it-all/index.js"(e,t){"use strict";t.exports=async e=>{const t=[];for await(const r of e)t.push(r);return t}}}),require_base64_js=__commonJS({"node_modules/base64-js/index.js"(e){"use strict";e.byteLength=function(e){var t=s(e),r=t[0],n=t[1];return 3*(r+n)/4-n},e.toByteArray=function(e){var t,r,i=s(e),a=i[0],c=i[1],u=new o(function(e,t,r){return 3*(t+r)/4-r}(0,a,c)),l=0,d=c>0?a-4:a;for(r=0;r<d;r+=4)t=n[e.charCodeAt(r)]<<18|n[e.charCodeAt(r+1)]<<12|n[e.charCodeAt(r+2)]<<6|n[e.charCodeAt(r+3)],u[l++]=t>>16&255,u[l++]=t>>8&255,u[l++]=255&t;2===c&&(t=n[e.charCodeAt(r)]<<2|n[e.charCodeAt(r+1)]>>4,u[l++]=255&t);1===c&&(t=n[e.charCodeAt(r)]<<10|n[e.charCodeAt(r+1)]<<4|n[e.charCodeAt(r+2)]>>2,u[l++]=t>>8&255,u[l++]=255&t);return u},e.fromByteArray=function(e){for(var t,n=e.length,o=n%3,i=[],s=16383,a=0,u=n-o;a<u;a+=s)i.push(c(e,a,a+s>u?u:a+s));1===o?(t=e[n-1],i.push(r[t>>2]+r[t<<4&63]+"==")):2===o&&(t=(e[n-2]<<8)+e[n-1],i.push(r[t>>10]+r[t>>4&63]+r[t<<2&63]+"="));return i.join("")};var t,r=[],n=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(t=0,64;t<64;++t)r[t]=i[t],n[i.charCodeAt(t)]=t;function s(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return-1===r&&(r=t),[r,r===t?0:4-r%4]}function a(e){return r[e>>18&63]+r[e>>12&63]+r[e>>6&63]+r[63&e]}function c(e,t,r){for(var n,o=[],i=t;i<r;i+=3)n=(e[i]<<16&16711680)+(e[i+1]<<8&65280)+(255&e[i+2]),o.push(a(n));return o.join("")}n["-".charCodeAt(0)]=62,n["_".charCodeAt(0)]=63}}),require_ieee754=__commonJS({"node_modules/ieee754/index.js"(e){e.read=function(e,t,r,n,o){var i,s,a=8*o-n-1,c=(1<<a)-1,u=c>>1,l=-7,d=r?o-1:0,f=r?-1:1,h=e[t+d];for(d+=f,i=h&(1<<-l)-1,h>>=-l,l+=a;l>0;i=256*i+e[t+d],d+=f,l-=8);for(s=i&(1<<-l)-1,i>>=-l,l+=n;l>0;s=256*s+e[t+d],d+=f,l-=8);if(0===i)i=1-u;else{if(i===c)return s?NaN:1/0*(h?-1:1);s+=Math.pow(2,n),i-=u}return(h?-1:1)*s*Math.pow(2,i-n)},e.write=function(e,t,r,n,o,i){var s,a,c,u=8*i-o-1,l=(1<<u)-1,d=l>>1,f=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,h=n?0:i-1,p=n?1:-1,m=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=l):(s=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-s))<1&&(s--,c*=2),(t+=s+d>=1?f/c:f*Math.pow(2,1-d))*c>=2&&(s++,c/=2),s+d>=l?(a=0,s=l):s+d>=1?(a=(t*c-1)*Math.pow(2,o),s+=d):(a=t*Math.pow(2,d-1)*Math.pow(2,o),s=0));o>=8;e[r+h]=255&a,h+=p,a/=256,o-=8);for(s=s<<o|a,u+=o;u>0;e[r+h]=255&s,h+=p,s/=256,u-=8);e[r+h-p]|=128*m}}}),require_buffer=__commonJS({"node_modules/bl/node_modules/buffer/index.js"(e){"use strict";var t=require_base64_js(),r=require_ieee754(),n="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;e.Buffer=s,e.SlowBuffer=function(e){+e!=e&&(e=0);return s.alloc(+e)},e.INSPECT_MAX_BYTES=50;var o=2147483647;function i(e){if(e>o)throw new RangeError('The value "'+e+'" is invalid for option "size"');const t=new Uint8Array(e);return Object.setPrototypeOf(t,s.prototype),t}function s(e,t,r){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return u(e)}return a(e,t,r)}function a(e,t,r){if("string"==typeof e)return function(e,t){"string"==typeof t&&""!==t||(t="utf8");if(!s.isEncoding(t))throw new TypeError("Unknown encoding: "+t);const r=0|h(e,t);let n=i(r);const o=n.write(e,t);o!==r&&(n=n.slice(0,o));return n}(e,t);if(ArrayBuffer.isView(e))return function(e){if(K(e,Uint8Array)){const t=new Uint8Array(e);return d(t.buffer,t.byteOffset,t.byteLength)}return l(e)}(e);if(null==e)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(K(e,ArrayBuffer)||e&&K(e.buffer,ArrayBuffer))return d(e,t,r);if("undefined"!=typeof SharedArrayBuffer&&(K(e,SharedArrayBuffer)||e&&K(e.buffer,SharedArrayBuffer)))return d(e,t,r);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');const n=e.valueOf&&e.valueOf();if(null!=n&&n!==e)return s.from(n,t,r);const o=function(e){if(s.isBuffer(e)){const t=0|f(e.length),r=i(t);return 0===r.length||e.copy(r,0,0,t),r}if(void 0!==e.length)return"number"!=typeof e.length||G(e.length)?i(0):l(e);if("Buffer"===e.type&&Array.isArray(e.data))return l(e.data)}(e);if(o)return o;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return s.from(e[Symbol.toPrimitive]("string"),t,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function c(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function u(e){return c(e),i(e<0?0:0|f(e))}function l(e){const t=e.length<0?0:0|f(e.length),r=i(t);for(let n=0;n<t;n+=1)r[n]=255&e[n];return r}function d(e,t,r){if(t<0||e.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(r||0))throw new RangeError('"length" is outside of buffer bounds');let n;return n=void 0===t&&void 0===r?new Uint8Array(e):void 0===r?new Uint8Array(e,t):new Uint8Array(e,t,r),Object.setPrototypeOf(n,s.prototype),n}function f(e){if(e>=o)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+o.toString(16)+" bytes");return 0|e}function h(e,t){if(s.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||K(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);const r=e.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;let o=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return V(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return J(e).length;default:if(o)return n?-1:V(e).length;t=(""+t).toLowerCase(),o=!0}}function p(e,t,r){let n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return A(this,t,r);case"utf8":case"utf-8":return k(this,t,r);case"ascii":return $(this,t,r);case"latin1":case"binary":return x(this,t,r);case"base64":return S(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return j(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function m(e,t,r){const n=e[t];e[t]=e[r],e[r]=n}function y(e,t,r,n,o){if(0===e.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),G(r=+r)&&(r=o?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(o)return-1;r=e.length-1}else if(r<0){if(!o)return-1;r=0}if("string"==typeof t&&(t=s.from(t,n)),s.isBuffer(t))return 0===t.length?-1:_(e,t,r,n,o);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):_(e,[t],r,n,o);throw new TypeError("val must be string, number or Buffer")}function _(e,t,r,n,o){let i,s=1,a=e.length,c=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;s=2,a/=2,c/=2,r/=2}function u(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(o){let n=-1;for(i=r;i<a;i++)if(u(e,i)===u(t,-1===n?0:i-n)){if(-1===n&&(n=i),i-n+1===c)return n*s}else-1!==n&&(i-=i-n),n=-1}else for(r+c>a&&(r=a-c),i=r;i>=0;i--){let r=!0;for(let n=0;n<c;n++)if(u(e,i+n)!==u(t,n)){r=!1;break}if(r)return i}return-1}function g(e,t,r,n){r=Number(r)||0;const o=e.length-r;n?(n=Number(n))>o&&(n=o):n=o;const i=t.length;let s;for(n>i/2&&(n=i/2),s=0;s<n;++s){const n=parseInt(t.substr(2*s,2),16);if(G(n))return s;e[r+s]=n}return s}function b(e,t,r,n){return H(V(t,e.length-r),e,r,n)}function w(e,t,r,n){return H(function(e){const t=[];for(let r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}(t),e,r,n)}function v(e,t,r,n){return H(J(t),e,r,n)}function E(e,t,r,n){return H(function(e,t){let r,n,o;const i=[];for(let s=0;s<e.length&&!((t-=2)<0);++s)r=e.charCodeAt(s),n=r>>8,o=r%256,i.push(o),i.push(n);return i}(t,e.length-r),e,r,n)}function S(e,r,n){return 0===r&&n===e.length?t.fromByteArray(e):t.fromByteArray(e.slice(r,n))}function k(e,t,r){r=Math.min(e.length,r);const n=[];let o=t;for(;o<r;){const t=e[o];let i=null,s=t>239?4:t>223?3:t>191?2:1;if(o+s<=r){let r,n,a,c;switch(s){case 1:t<128&&(i=t);break;case 2:r=e[o+1],128==(192&r)&&(c=(31&t)<<6|63&r,c>127&&(i=c));break;case 3:r=e[o+1],n=e[o+2],128==(192&r)&&128==(192&n)&&(c=(15&t)<<12|(63&r)<<6|63&n,c>2047&&(c<55296||c>57343)&&(i=c));break;case 4:r=e[o+1],n=e[o+2],a=e[o+3],128==(192&r)&&128==(192&n)&&128==(192&a)&&(c=(15&t)<<18|(63&r)<<12|(63&n)<<6|63&a,c>65535&&c<1114112&&(i=c))}}null===i?(i=65533,s=1):i>65535&&(i-=65536,n.push(i>>>10&1023|55296),i=56320|1023&i),n.push(i),o+=s}return function(e){const t=e.length;if(t<=T)return String.fromCharCode.apply(String,e);let r="",n=0;for(;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=T));return r}(n)}e.kMaxLength=o,s.TYPED_ARRAY_SUPPORT=function(){try{const e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),42===e.foo()}catch(e){return!1}}(),s.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(s.prototype,"parent",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.buffer}}),Object.defineProperty(s.prototype,"offset",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.byteOffset}}),s.poolSize=8192,s.from=function(e,t,r){return a(e,t,r)},Object.setPrototypeOf(s.prototype,Uint8Array.prototype),Object.setPrototypeOf(s,Uint8Array),s.alloc=function(e,t,r){return function(e,t,r){return c(e),e<=0?i(e):void 0!==t?"string"==typeof r?i(e).fill(t,r):i(e).fill(t):i(e)}(e,t,r)},s.allocUnsafe=function(e){return u(e)},s.allocUnsafeSlow=function(e){return u(e)},s.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==s.prototype},s.compare=function(e,t){if(K(e,Uint8Array)&&(e=s.from(e,e.offset,e.byteLength)),K(t,Uint8Array)&&(t=s.from(t,t.offset,t.byteLength)),!s.isBuffer(e)||!s.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;let r=e.length,n=t.length;for(let o=0,i=Math.min(r,n);o<i;++o)if(e[o]!==t[o]){r=e[o],n=t[o];break}return r<n?-1:n<r?1:0},s.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},s.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return s.alloc(0);let r;if(void 0===t)for(t=0,r=0;r<e.length;++r)t+=e[r].length;const n=s.allocUnsafe(t);let o=0;for(r=0;r<e.length;++r){let t=e[r];if(K(t,Uint8Array))o+t.length>n.length?(s.isBuffer(t)||(t=s.from(t)),t.copy(n,o)):Uint8Array.prototype.set.call(n,t,o);else{if(!s.isBuffer(t))throw new TypeError('"list" argument must be an Array of Buffers');t.copy(n,o)}o+=t.length}return n},s.byteLength=h,s.prototype._isBuffer=!0,s.prototype.swap16=function(){const e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;t<e;t+=2)m(this,t,t+1);return this},s.prototype.swap32=function(){const e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let t=0;t<e;t+=4)m(this,t,t+3),m(this,t+1,t+2);return this},s.prototype.swap64=function(){const e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let t=0;t<e;t+=8)m(this,t,t+7),m(this,t+1,t+6),m(this,t+2,t+5),m(this,t+3,t+4);return this},s.prototype.toString=function(){const e=this.length;return 0===e?"":0===arguments.length?k(this,0,e):p.apply(this,arguments)},s.prototype.toLocaleString=s.prototype.toString,s.prototype.equals=function(e){if(!s.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===s.compare(this,e)},s.prototype.inspect=function(){let t="";const r=e.INSPECT_MAX_BYTES;return t=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(t+=" ... "),"<Buffer "+t+">"},n&&(s.prototype[n]=s.prototype.inspect),s.prototype.compare=function(e,t,r,n,o){if(K(e,Uint8Array)&&(e=s.from(e,e.offset,e.byteLength)),!s.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===o&&(o=this.length),t<0||r>e.length||n<0||o>this.length)throw new RangeError("out of range index");if(n>=o&&t>=r)return 0;if(n>=o)return-1;if(t>=r)return 1;if(this===e)return 0;let i=(o>>>=0)-(n>>>=0),a=(r>>>=0)-(t>>>=0);const c=Math.min(i,a),u=this.slice(n,o),l=e.slice(t,r);for(let e=0;e<c;++e)if(u[e]!==l[e]){i=u[e],a=l[e];break}return i<a?-1:a<i?1:0},s.prototype.includes=function(e,t,r){return-1!==this.indexOf(e,t,r)},s.prototype.indexOf=function(e,t,r){return y(this,e,t,r,!0)},s.prototype.lastIndexOf=function(e,t,r){return y(this,e,t,r,!1)},s.prototype.write=function(e,t,r,n){if(void 0===t)n="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof t)n=t,r=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t>>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}const o=this.length-t;if((void 0===r||r>o)&&(r=o),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");let i=!1;for(;;)switch(n){case"hex":return g(this,e,t,r);case"utf8":case"utf-8":return b(this,e,t,r);case"ascii":case"latin1":case"binary":return w(this,e,t,r);case"base64":return v(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return E(this,e,t,r);default:if(i)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),i=!0}},s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var T=4096;function $(e,t,r){let n="";r=Math.min(e.length,r);for(let o=t;o<r;++o)n+=String.fromCharCode(127&e[o]);return n}function x(e,t,r){let n="";r=Math.min(e.length,r);for(let o=t;o<r;++o)n+=String.fromCharCode(e[o]);return n}function A(e,t,r){const n=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>n)&&(r=n);let o="";for(let n=t;n<r;++n)o+=W[e[n]];return o}function j(e,t,r){const n=e.slice(t,r);let o="";for(let e=0;e<n.length-1;e+=2)o+=String.fromCharCode(n[e]+256*n[e+1]);return o}function C(e,t,r){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>r)throw new RangeError("Trying to access beyond buffer length")}function N(e,t,r,n,o,i){if(!s.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>o||t<i)throw new RangeError('"value" argument is out of bounds');if(r+n>e.length)throw new RangeError("Index out of range")}function I(e,t,r,n,o){q(t,n,o,e,r,7);let i=Number(t&BigInt(4294967295));e[r++]=i,i>>=8,e[r++]=i,i>>=8,e[r++]=i,i>>=8,e[r++]=i;let s=Number(t>>BigInt(32)&BigInt(4294967295));return e[r++]=s,s>>=8,e[r++]=s,s>>=8,e[r++]=s,s>>=8,e[r++]=s,r}function P(e,t,r,n,o){q(t,n,o,e,r,7);let i=Number(t&BigInt(4294967295));e[r+7]=i,i>>=8,e[r+6]=i,i>>=8,e[r+5]=i,i>>=8,e[r+4]=i;let s=Number(t>>BigInt(32)&BigInt(4294967295));return e[r+3]=s,s>>=8,e[r+2]=s,s>>=8,e[r+1]=s,s>>=8,e[r]=s,r+8}function B(e,t,r,n,o,i){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function D(e,t,n,o,i){return t=+t,n>>>=0,i||B(e,0,n,4),r.write(e,t,n,o,23,4),n+4}function O(e,t,n,o,i){return t=+t,n>>>=0,i||B(e,0,n,8),r.write(e,t,n,o,52,8),n+8}s.prototype.slice=function(e,t){const r=this.length;(e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t<e&&(t=e);const n=this.subarray(e,t);return Object.setPrototypeOf(n,s.prototype),n},s.prototype.readUintLE=s.prototype.readUIntLE=function(e,t,r){e>>>=0,t>>>=0,r||C(e,t,this.length);let n=this[e],o=1,i=0;for(;++i<t&&(o*=256);)n+=this[e+i]*o;return n},s.prototype.readUintBE=s.prototype.readUIntBE=function(e,t,r){e>>>=0,t>>>=0,r||C(e,t,this.length);let n=this[e+--t],o=1;for(;t>0&&(o*=256);)n+=this[e+--t]*o;return n},s.prototype.readUint8=s.prototype.readUInt8=function(e,t){return e>>>=0,t||C(e,1,this.length),this[e]},s.prototype.readUint16LE=s.prototype.readUInt16LE=function(e,t){return e>>>=0,t||C(e,2,this.length),this[e]|this[e+1]<<8},s.prototype.readUint16BE=s.prototype.readUInt16BE=function(e,t){return e>>>=0,t||C(e,2,this.length),this[e]<<8|this[e+1]},s.prototype.readUint32LE=s.prototype.readUInt32LE=function(e,t){return e>>>=0,t||C(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},s.prototype.readUint32BE=s.prototype.readUInt32BE=function(e,t){return e>>>=0,t||C(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},s.prototype.readBigUInt64LE=Y(function(e){L(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||F(e,this.length-8);const n=t+256*this[++e]+65536*this[++e]+this[++e]*2**24,o=this[++e]+256*this[++e]+65536*this[++e]+r*2**24;return BigInt(n)+(BigInt(o)<<BigInt(32))}),s.prototype.readBigUInt64BE=Y(function(e){L(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||F(e,this.length-8);const n=t*2**24+65536*this[++e]+256*this[++e]+this[++e],o=this[++e]*2**24+65536*this[++e]+256*this[++e]+r;return(BigInt(n)<<BigInt(32))+BigInt(o)}),s.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||C(e,t,this.length);let n=this[e],o=1,i=0;for(;++i<t&&(o*=256);)n+=this[e+i]*o;return o*=128,n>=o&&(n-=Math.pow(2,8*t)),n},s.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||C(e,t,this.length);let n=t,o=1,i=this[e+--n];for(;n>0&&(o*=256);)i+=this[e+--n]*o;return o*=128,i>=o&&(i-=Math.pow(2,8*t)),i},s.prototype.readInt8=function(e,t){return e>>>=0,t||C(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},s.prototype.readInt16LE=function(e,t){e>>>=0,t||C(e,2,this.length);const r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},s.prototype.readInt16BE=function(e,t){e>>>=0,t||C(e,2,this.length);const r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},s.prototype.readInt32LE=function(e,t){return e>>>=0,t||C(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},s.prototype.readInt32BE=function(e,t){return e>>>=0,t||C(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},s.prototype.readBigInt64LE=Y(function(e){L(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||F(e,this.length-8);const n=this[e+4]+256*this[e+5]+65536*this[e+6]+(r<<24);return(BigInt(n)<<BigInt(32))+BigInt(t+256*this[++e]+65536*this[++e]+this[++e]*2**24)}),s.prototype.readBigInt64BE=Y(function(e){L(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||F(e,this.length-8);const n=(t<<24)+65536*this[++e]+256*this[++e]+this[++e];return(BigInt(n)<<BigInt(32))+BigInt(this[++e]*2**24+65536*this[++e]+256*this[++e]+r)}),s.prototype.readFloatLE=function(e,t){return e>>>=0,t||C(e,4,this.length),r.read(this,e,!0,23,4)},s.prototype.readFloatBE=function(e,t){return e>>>=0,t||C(e,4,this.length),r.read(this,e,!1,23,4)},s.prototype.readDoubleLE=function(e,t){return e>>>=0,t||C(e,8,this.length),r.read(this,e,!0,52,8)},s.prototype.readDoubleBE=function(e,t){return e>>>=0,t||C(e,8,this.length),r.read(this,e,!1,52,8)},s.prototype.writeUintLE=s.prototype.writeUIntLE=function(e,t,r,n){if(e=+e,t>>>=0,r>>>=0,!n){N(this,e,t,r,Math.pow(2,8*r)-1,0)}let o=1,i=0;for(this[t]=255&e;++i<r&&(o*=256);)this[t+i]=e/o&255;return t+r},s.prototype.writeUintBE=s.prototype.writeUIntBE=function(e,t,r,n){if(e=+e,t>>>=0,r>>>=0,!n){N(this,e,t,r,Math.pow(2,8*r)-1,0)}let o=r-1,i=1;for(this[t+o]=255&e;--o>=0&&(i*=256);)this[t+o]=e/i&255;return t+r},s.prototype.writeUint8=s.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||N(this,e,t,1,255,0),this[t]=255&e,t+1},s.prototype.writeUint16LE=s.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||N(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},s.prototype.writeUint16BE=s.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||N(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},s.prototype.writeUint32LE=s.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||N(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},s.prototype.writeUint32BE=s.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||N(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},s.prototype.writeBigUInt64LE=Y(function(e,t=0){return I(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))}),s.prototype.writeBigUInt64BE=Y(function(e,t=0){return P(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))}),s.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t>>>=0,!n){const n=Math.pow(2,8*r-1);N(this,e,t,r,n-1,-n)}let o=0,i=1,s=0;for(this[t]=255&e;++o<r&&(i*=256);)e<0&&0===s&&0!==this[t+o-1]&&(s=1),this[t+o]=(e/i|0)-s&255;return t+r},s.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t>>>=0,!n){const n=Math.pow(2,8*r-1);N(this,e,t,r,n-1,-n)}let o=r-1,i=1,s=0;for(this[t+o]=255&e;--o>=0&&(i*=256);)e<0&&0===s&&0!==this[t+o+1]&&(s=1),this[t+o]=(e/i|0)-s&255;return t+r},s.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||N(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},s.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||N(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},s.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||N(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},s.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||N(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},s.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||N(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},s.prototype.writeBigInt64LE=Y(function(e,t=0){return I(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),s.prototype.writeBigInt64BE=Y(function(e,t=0){return P(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),s.prototype.writeFloatLE=function(e,t,r){return D(this,e,t,!0,r)},s.prototype.writeFloatBE=function(e,t,r){return D(this,e,t,!1,r)},s.prototype.writeDoubleLE=function(e,t,r){return O(this,e,t,!0,r)},s.prototype.writeDoubleBE=function(e,t,r){return O(this,e,t,!1,r)},s.prototype.copy=function(e,t,r,n){if(!s.isBuffer(e))throw new TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t<n-r&&(n=e.length-t+r);const o=n-r;return this===e&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(t,r,n):Uint8Array.prototype.set.call(e,this.subarray(r,n),t),o},s.prototype.fill=function(e,t,r,n){if("string"==typeof e){if("string"==typeof t?(n=t,t=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!s.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(1===e.length){const t=e.charCodeAt(0);("utf8"===n&&t<128||"latin1"===n)&&(e=t)}}else"number"==typeof e?e&=255:"boolean"==typeof e&&(e=Number(e));if(t<0||this.length<t||this.length<r)throw new RangeError("Out of range index");if(r<=t)return this;let o;if(t>>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(o=t;o<r;++o)this[o]=e;else{const i=s.isBuffer(e)?e:s.from(e,n),a=i.length;if(0===a)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(o=0;o<r-t;++o)this[o+t]=i[o%a]}return this};var U={};function M(e,t,r){U[e]=class extends r{constructor(){super(),Object.defineProperty(this,"message",{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${e}]`,this.stack,delete this.name}get code(){return e}set code(e){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:e,writable:!0})}toString(){return`${this.name} [${e}]: ${this.message}`}}}function R(e){let t="",r=e.length;const n="-"===e[0]?1:0;for(;r>=n+4;r-=3)t=`_${e.slice(r-3,r)}${t}`;return`${e.slice(0,r)}${t}`}function q(e,t,r,n,o,i){if(e>r||e<t){const n="bigint"==typeof t?"n":"";let o;throw o=i>3?0===t||t===BigInt(0)?`>= 0${n} and < 2${n} ** ${8*(i+1)}${n}`:`>= -(2${n} ** ${8*(i+1)-1}${n}) and < 2 ** ${8*(i+1)-1}${n}`:`>= ${t}${n} and <= ${r}${n}`,new U.ERR_OUT_OF_RANGE("value",o,e)}!function(e,t,r){L(t,"offset"),void 0!==e[t]&&void 0!==e[t+r]||F(t,e.length-(r+1))}(n,o,i)}function L(e,t){if("number"!=typeof e)throw new U.ERR_INVALID_ARG_TYPE(t,"number",e)}function F(e,t,r){if(Math.floor(e)!==e)throw L(e,r),new U.ERR_OUT_OF_RANGE(r||"offset","an integer",e);if(t<0)throw new U.ERR_BUFFER_OUT_OF_BOUNDS;throw new U.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${t}`,e)}M("ERR_BUFFER_OUT_OF_BOUNDS",function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),M("ERR_INVALID_ARG_TYPE",function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`},TypeError),M("ERR_OUT_OF_RANGE",function(e,t,r){let n=`The value of "${e}" is out of range.`,o=r;return Number.isInteger(r)&&Math.abs(r)>2**32?o=R(String(r)):"bigint"==typeof r&&(o=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(o=R(o)),o+="n"),n+=` It must be ${t}. Received ${o}`,n},RangeError);var z=/[^+/0-9A-Za-z-_]/g;function V(e,t){let r;t=t||1/0;const n=e.length;let o=null;const i=[];for(let s=0;s<n;++s){if(r=e.charCodeAt(s),r>55295&&r<57344){if(!o){if(r>56319){(t-=3)>-1&&i.push(239,191,189);continue}if(s+1===n){(t-=3)>-1&&i.push(239,191,189);continue}o=r;continue}if(r<56320){(t-=3)>-1&&i.push(239,191,189),o=r;continue}r=65536+(o-55296<<10|r-56320)}else o&&(t-=3)>-1&&i.push(239,191,189);if(o=null,r<128){if((t-=1)<0)break;i.push(r)}else if(r<2048){if((t-=2)<0)break;i.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;i.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return i}function J(e){return t.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(z,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function H(e,t,r,n){let o;for(o=0;o<n&&!(o+r>=t.length||o>=e.length);++o)t[o+r]=e[o];return o}function K(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function G(e){return e!=e}var W=function(){const e="0123456789abcdef",t=new Array(256);for(let r=0;r<16;++r){const n=16*r;for(let o=0;o<16;++o)t[n+o]=e[r]+e[o]}return t}();function Y(e){return"undefined"==typeof BigInt?X:e}function X(){throw new Error("BigInt not supported")}}}),require_BufferList=__commonJS({"node_modules/bl/BufferList.js"(e,t){"use strict";var{Buffer:r}=require_buffer(),n=Symbol.for("BufferList");function o(e){if(!(this instanceof o))return new o(e);o._init.call(this,e)}o._init=function(e){Object.defineProperty(this,n,{value:!0}),this._bufs=[],this.length=0,e&&this.append(e)},o.prototype._new=function(e){return new o(e)},o.prototype._offset=function(e){if(0===e)return[0,0];let t=0;for(let r=0;r<this._bufs.length;r++){const n=t+this._bufs[r].length;if(e<n||r===this._bufs.length-1)return[r,e-t];t=n}},o.prototype._reverseOffset=function(e){const t=e[0];let r=e[1];for(let e=0;e<t;e++)r+=this._bufs[e].length;return r},o.prototype.get=function(e){if(e>this.length||e<0)return;const t=this._offset(e);return this._bufs[t[0]][t[1]]},o.prototype.slice=function(e,t){return"number"==typeof e&&e<0&&(e+=this.length),"number"==typeof t&&t<0&&(t+=this.length),this.copy(null,0,e,t)},o.prototype.copy=function(e,t,n,o){if(("number"!=typeof n||n<0)&&(n=0),("number"!=typeof o||o>this.length)&&(o=this.length),n>=this.length)return e||r.alloc(0);if(o<=0)return e||r.alloc(0);const i=!!e,s=this._offset(n),a=o-n;let c=a,u=i&&t||0,l=s[1];if(0===n&&o===this.length){if(!i)return 1===this._bufs.length?this._bufs[0]:r.concat(this._bufs,this.length);for(let t=0;t<this._bufs.length;t++)this._bufs[t].copy(e,u),u+=this._bufs[t].length;return e}if(c<=this._bufs[s[0]].length-l)return i?this._bufs[s[0]].copy(e,t,l,l+c):this._bufs[s[0]].slice(l,l+c);i||(e=r.allocUnsafe(a));for(let t=s[0];t<this._bufs.length;t++){const r=this._bufs[t].length-l;if(!(c>r)){this._bufs[t].copy(e,u,l,l+c),u+=r;break}this._bufs[t].copy(e,u,l),u+=r,c-=r,l&&(l=0)}return e.length>u?e.slice(0,u):e},o.prototype.shallowSlice=function(e,t){if(e=e||0,t="number"!=typeof t?this.length:t,e<0&&(e+=this.length),t<0&&(t+=this.length),e===t)return this._new();const r=this._offset(e),n=this._offset(t),o=this._bufs.slice(r[0],n[0]+1);return 0===n[1]?o.pop():o[o.length-1]=o[o.length-1].slice(0,n[1]),0!==r[1]&&(o[0]=o[0].slice(r[1])),this._new(o)},o.prototype.toString=function(e,t,r){return this.slice(t,r).toString(e)},o.prototype.consume=function(e){if(e=Math.trunc(e),Number.isNaN(e)||e<=0)return this;for(;this._bufs.length;){if(!(e>=this._bufs[0].length)){this._bufs[0]=this._bufs[0].slice(e),this.length-=e;break}e-=this._bufs[0].length,this.length-=this._bufs[0].length,this._bufs.shift()}return this},o.prototype.duplicate=function(){const e=this._new();for(let t=0;t<this._bufs.length;t++)e.append(this._bufs[t]);return e},o.prototype.append=function(e){if(null==e)return this;if(e.buffer)this._appendBuffer(r.from(e.buffer,e.byteOffset,e.byteLength));else if(Array.isArray(e))for(let t=0;t<e.length;t++)this.append(e[t]);else if(this._isBufferList(e))for(let t=0;t<e._bufs.length;t++)this.append(e._bufs[t]);else"number"==typeof e&&(e=e.toString()),this._appendBuffer(r.from(e));return this},o.prototype._appendBuffer=function(e){this._bufs.push(e),this.length+=e.length},o.prototype.indexOf=function(e,t,n){if(void 0===n&&"string"==typeof t&&(n=t,t=void 0),"function"==typeof e||Array.isArray(e))throw new TypeError('The "value" argument must be one of type string, Buffer, BufferList, or Uint8Array.');if("number"==typeof e?e=r.from([e]):"string"==typeof e?e=r.from(e,n):this._isBufferList(e)?e=e.slice():Array.isArray(e.buffer)?e=r.from(e.buffer,e.byteOffset,e.byteLength):r.isBuffer(e)||(e=r.from(e)),t=Number(t||0),isNaN(t)&&(t=0),t<0&&(t=this.length+t),t<0&&(t=0),0===e.length)return t>this.length?this.length:t;const o=this._offset(t);let i=o[0],s=o[1];for(;i<this._bufs.length;i++){const t=this._bufs[i];for(;s<t.length;){if(t.length-s>=e.length){const r=t.indexOf(e,s);if(-1!==r)return this._reverseOffset([i,r]);s=t.length-e.length+1}else{const t=this._reverseOffset([i,s]);if(this._match(t,e))return t;s++}}s=0}return-1},o.prototype._match=function(e,t){if(this.length-e<t.length)return!1;for(let r=0;r<t.length;r++)if(this.get(e+r)!==t[r])return!1;return!0},function(){const e={readDoubleBE:8,readDoubleLE:8,readFloatBE:4,readFloatLE:4,readInt32BE:4,readInt32LE:4,readUInt32BE:4,readUInt32LE:4,readInt16BE:2,readInt16LE:2,readUInt16BE:2,readUInt16LE:2,readInt8:1,readUInt8:1,readIntBE:null,readIntLE:null,readUIntBE:null,readUIntLE:null};for(const t in e)(function(t){o.prototype[t]=null===e[t]?function(e,r){return this.slice(e,e+r)[t](0,r)}:function(r=0){return this.slice(r,r+e[t])[t](0)}})(t)}(),o.prototype._isBufferList=function(e){return e instanceof o||o.isBufferList(e)},o.isBufferList=function(e){return null!=e&&e[n]},t.exports=o}}),require_rabin=__commonJS({"node_modules/rabin-wasm/src/rabin.js"(e,t){t.exports=class{constructor(e,t=12,r=8192,n=32768,o=64,i){this.bits=t,this.min=r,this.max=n,this.asModule=e,this.rabin=new e.Rabin(t,r,n,o,i),this.polynomial=i}fingerprint(e){const{__retain:t,__release:r,__allocArray:n,__getInt32Array:o,Int32Array_ID:i,Uint8Array_ID:s}=this.asModule,a=t(n(i,new Int32Array(Math.ceil(e.length/this.min)))),c=t(n(s,e)),u=o(this.rabin.fingerprint(c,a));r(c),r(a);const l=u.indexOf(0);return l>=0?u.subarray(0,l):u}}}}),require_loader=__commonJS({"node_modules/@assemblyscript/loader/index.js"(e){"use strict";var t="undefined"!=typeof BigUint64Array,r=Symbol(),n=1024;function o(e,t){const r=new Uint32Array(e),o=new Uint16Array(e);var i=r[t+-4>>>2]>>>1,s=t>>>1;if(i<=n)return String.fromCharCode.apply(String,o.subarray(s,s+i));const a=[];do{const e=o[s+n-1],t=e>=55296&&e<56320?1023:n;a.push(String.fromCharCode.apply(String,o.subarray(s,s+=t))),i-=t}while(i>n);return a.join("")+String.fromCharCode.apply(String,o.subarray(s,s+i))}function i(e){const t={};function r(e,t){return e?o(e.buffer,t):"<yet unknown>"}const n=e.env=e.env||{};return n.abort=n.abort||function(e,o,i,s){const a=t.memory||n.memory;throw Error("abort: "+r(a,e)+" at "+r(a,o)+":"+i+":"+s)},n.trace=n.trace||function(e,o){const i=t.memory||n.memory;console.log("trace: "+r(i,e)+(o?" ":"")+Array.prototype.slice.call(arguments,2,2+o).join(", "))},e.Math=e.Math||Math,e.Date=e.Date||Date,t}function s(e,r){const n=r.exports,i=n.memory,s=n.table,a=n.__alloc,c=n.__retain,u=n.__rtti_base||-1;function d(e){const t=new Uint32Array(i.buffer);if((e>>>=0)>=t[u>>>2])throw Error("invalid id: "+e);return t[(u+4>>>2)+2*e]}function f(e){const t=new Uint32Array(i.buffer);if((e>>>=0)>=t[u>>>2])throw Error("invalid id: "+e);return t[(u+4>>>2)+2*e+1]}function h(e){return 31-Math.clz32(e>>>5&31)}function p(e,t,r){const n=i.buffer;if(r)switch(e){case 2:return new Float32Array(n);case 3:return new Float64Array(n)}else switch(e){case 0:return new(t?Int8Array:Uint8Array)(n);case 1:return new(t?Int16Array:Uint16Array)(n);case 2:return new(t?Int32Array:Uint32Array)(n);case 3:return new(t?BigInt64Array:BigUint64Array)(n)}throw Error("unsupported align: "+e)}function m(e){const t=new Uint32Array(i.buffer),r=t[e+-8>>>2],n=d(r);if(!(1&n))throw Error("not an array: "+r);const o=h(n);var s=t[e+4>>>2];const a=2&n?t[e+12>>>2]:t[s+-4>>>2]>>>o;return p(o,1024&n,2048&n).subarray(s>>>=o,s+a)}function y(e,t,r){return new e(_(e,t,r))}function _(e,t,r){const n=i.buffer,o=new Uint32Array(n),s=o[r+4>>>2];return new e(n,s,o[s+-4>>>2]>>>t)}return e.__allocString=function(e){const t=e.length,r=a(t<<1,1),n=new Uint16Array(i.buffer);for(var o=0,s=r>>>1;o<t;++o)n[s+o]=e.charCodeAt(o);return r},e.__getString=function(e){const t=i.buffer;if(1!==new Uint32Array(t)[e+-8>>>2])throw Error("not a string: "+e);return o(t,e)},e.__allocArray=function(e,t){const r=d(e);if(!(3&r))throw Error("not an array: "+e+" @ "+r);const n=h(r),o=t.length,s=a(o<<n,0),u=a(2&r?16:12,e),l=new Uint32Array(i.buffer);l[u+0>>>2]=c(s),l[u+4>>>2]=s,l[u+8>>>2]=o<<n,2&r&&(l[u+12>>>2]=o);const f=p(n,1024&r,2048&r);if(8192&r)for(let e=0;e<o;++e)f[(s>>>n)+e]=c(t[e]);else f.set(t,s>>>n);return u},e.__getArrayView=m,e.__getArray=function(e){const t=m(e),r=t.length,n=new Array(r);for(let e=0;e<r;e++)n[e]=t[e];return n},e.__getArrayBuffer=function(e){const t=i.buffer,r=new Uint32Array(t)[e+-4>>>2];return t.slice(e,e+r)},e.__getInt8Array=y.bind(null,Int8Array,0),e.__getInt8ArrayView=_.bind(null,Int8Array,0),e.__getUint8Array=y.bind(null,Uint8Array,0),e.__getUint8ArrayView=_.bind(null,Uint8Array,0),e.__getUint8ClampedArray=y.bind(null,Uint8ClampedArray,0),e.__getUint8ClampedArrayView=_.bind(null,Uint8ClampedArray,0),e.__getInt16Array=y.bind(null,Int16Array,1),e.__getInt16ArrayView=_.bind(null,Int16Array,1),e.__getUint16Array=y.bind(null,Uint16Array,1),e.__getUint16ArrayView=_.bind(null,Uint16Array,1),e.__getInt32Array=y.bind(null,Int32Array,2),e.__getInt32ArrayView=_.bind(null,Int32Array,2),e.__getUint32Array=y.bind(null,Uint32Array,2),e.__getUint32ArrayView=_.bind(null,Uint32Array,2),t&&(e.__getInt64Array=y.bind(null,BigInt64Array,3),e.__getInt64ArrayView=_.bind(null,BigInt64Array,3),e.__getUint64Array=y.bind(null,BigUint64Array,3),e.__getUint64ArrayView=_.bind(null,BigUint64Array,3)),e.__getFloat32Array=y.bind(null,Float32Array,2),e.__getFloat32ArrayView=_.bind(null,Float32Array,2),e.__getFloat64Array=y.bind(null,Float64Array,3),e.__getFloat64ArrayView=_.bind(null,Float64Array,3),e.__instanceof=function(e,t){const r=new Uint32Array(i.buffer);var n=r[e+-8>>>2];if(n<=r[u>>>2])do{if(n==t)return!0}while(n=f(n));return!1},e.memory=e.memory||i,e.table=e.table||s,l(n,e)}function a(e){return"undefined"!=typeof Response&&e instanceof Response}async function c(e,t){return a(e=await e)?u(e,t):s(i(t||(t={})),await WebAssembly.instantiate(e instanceof WebAssembly.Module?e:await WebAssembly.compile(e),t))}async function u(e,t){return WebAssembly.instantiateStreaming?s(i(t||(t={})),(await WebAssembly.instantiateStreaming(e,t)).instance):c(a(e=await e)?e.arrayBuffer():e,t)}function l(e,t){var n=t?Object.create(t):{},o=e.__argumentsLength?function(t){e.__argumentsLength.value=t}:e.__setArgumentsLength||e.__setargc||function(){};for(let t in e){if(!Object.prototype.hasOwnProperty.call(e,t))continue;const i=e[t];let s=t.split("."),a=n;for(;s.length>1;){let e=s.shift();Object.prototype.hasOwnProperty.call(a,e)||(a[e]={}),a=a[e]}let c=s[0],u=c.indexOf("#");if(u>=0){let n=c.substring(0,u),s=a[n];if(void 0===s||!s.prototype){let e=function(...t){return e.wrap(e.prototype.constructor(0,...t))};e.prototype={valueOf:function(){return this[r]}},e.wrap=function(t){return Object.create(e.prototype,{[r]:{value:t,writable:!1}})},s&&Object.getOwnPropertyNames(s).forEach(t=>Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(s,t))),a[n]=e}if(c=c.substring(u+1),a=a[n].prototype,/^(get|set):/.test(c)){if(!Object.prototype.hasOwnProperty.call(a,c=c.substring(4))){let n=e[t.replace("set:","get:")],o=e[t.replace("get:","set:")];Object.defineProperty(a,c,{get:function(){return n(this[r])},set:function(e){o(this[r],e)},enumerable:!0})}}else"constructor"===c?(a[c]=(...e)=>(o(e.length),i(...e))).original=i:(a[c]=function(...e){return o(e.length),i(this[r],...e)}).original=i}else/^(get|set):/.test(c)?Object.prototype.hasOwnProperty.call(a,c=c.substring(4))||Object.defineProperty(a,c,{get:e[t.replace("set:","get:")],set:e[t.replace("get:","set:")],enumerable:!0}):"function"==typeof i&&i!==o?(a[c]=(...e)=>(o(e.length),i(...e))).original=i:a[c]=i}return n}e.instantiate=c,e.instantiateSync=function(e,t){return s(i(t||(t={})),new WebAssembly.Instance(e instanceof WebAssembly.Module?e:new WebAssembly.Module(e),t))},e.instantiateStreaming=u,e.demangle=l}}),require_rabin_wasm=__commonJS({"node_modules/rabin-wasm/dist/rabin-wasm.js"(e,t){var{instantiate:r}=require_loader();function n(e={}){if(!n.supported)return null;var t=new Uint8Array([0,97,115,109,1,0,0,0,1,78,14,96,2,127,126,0,96,1,127,1,126,96,2,127,127,0,96,1,127,1,127,96,1,127,0,96,2,127,127,1,127,96,3,127,127,127,1,127,96,0,0,96,3,127,127,127,0,96,0,1,127,96,4,127,127,127,127,0,96,5,127,127,127,127,127,1,127,96,1,126,1,127,96,2,126,126,1,126,2,13,1,3,101,110,118,5,97,98,111,114,116,0,10,3,54,53,2,2,8,9,3,5,2,8,6,5,3,4,2,6,9,12,13,2,5,11,3,2,3,2,3,2,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,6,7,7,4,4,5,3,1,0,1,6,47,9,127,1,65,0,11,127,1,65,0,11,127,0,65,3,11,127,0,65,4,11,127,1,65,0,11,127,1,65,0,11,127,1,65,0,11,127,0,65,240,2,11,127,0,65,6,11,7,240,5,41,6,109,101,109,111,114,121,2,0,7,95,95,97,108,108,111,99,0,10,8,95,95,114,101,116,97,105,110,0,11,9,95,95,114,101,108,101,97,115,101,0,12,9,95,95,99,111,108,108,101,99,116,0,51,11,95,95,114,116,116,105,95,98,97,115,101,3,7,13,73,110,116,51,50,65,114,114,97,121,95,73,68,3,2,13,85,105,110,116,56,65,114,114,97,121,95,73,68,3,3,6,100,101,103,114,101,101,0,16,3,109,111,100,0,17,5,82,97,98,105,110,3,8,16,82,97,98,105,110,35,103,101,116,58,119,105,110,100,111,119,0,21,16,82,97,98,105,110,35,115,101,116,58,119,105,110,100,111,119,0,22,21,82,97,98,105,110,35,103,101,116,58,119,105,110,100,111,119,95,115,105,122,101,0,23,21,82,97,98,105,110,35,115,101,116,58,119,105,110,100,111,119,95,115,105,122,101,0,24,14,82,97,98,105,110,35,103,101,116,58,119,112,111,115,0,25,14,82,97,98,105,110,35,115,101,116,58,119,112,111,115,0,26,15,82,97,98,105,110,35,103,101,116,58,99,111,117,110,116,0,27,15,82,97,98,105,110,35,115,101,116,58,99,111,117,110,116,0,28,13,82,97,98,105,110,35,103,101,116,58,112,111,115,0,29,13,82,97,98,105,110,35,115,101,116,58,112,111,115,0,30,15,82,97,98,105,110,35,103,101,116,58,115,116,97,114,116,0,31,15,82,97,98,105,110,35,115,101,116,58,115,116,97,114,116,0,32,16,82,97,98,105,110,35,103,101,116,58,100,105,103,101,115,116,0,33,16,82,97,98,105,110,35,115,101,116,58,100,105,103,101,115,116,0,34,21,82,97,98,105,110,35,103,101,116,58,99,104,117,110,107,95,115,116,97,114,116,0,35,21,82,97,98,105,110,35,115,101,116,58,99,104,117,110,107,95,115,116,97,114,116,0,36,22,82,97,98,105,110,35,103,101,116,58,99,104,117,110,107,95,108,101,110,103,116,104,0,37,22,82,97,98,105,110,35,115,101,116,58,99,104,117,110,107,95,108,101,110,103,116,104,0,38,31,82,97,98,105,110,35,103,101,116,58,99,104,117,110,107,95,99,117,116,95,102,105,110,103,101,114,112,114,105,110,116,0,39,31,82,97,98,105,110,35,115,101,116,58,99,104,117,110,107,95,99,117,116,95,102,105,110,103,101,114,112,114,105,110,116,0,40,20,82,97,98,105,110,35,103,101,116,58,112,111,108,121,110,111,109,105,97,108,0,41,20,82,97,98,105,110,35,115,101,116,58,112,111,108,121,110,111,109,105,97,108,0,42,17,82,97,98,105,110,35,103,101,116,58,109,105,110,115,105,122,101,0,43,17,82,97,98,105,110,35,115,101,116,58,109,105,110,115,105,122,101,0,44,17,82,97,98,105,110,35,103,101,116,58,109,97,120,115,105,122,101,0,45,17,82,97,98,105,110,35,115,101,116,58,109,97,120,115,105,122,101,0,46,14,82,97,98,105,110,35,103,101,116,58,109,97,115,107,0,47,14,82,97,98,105,110,35,115,101,116,58,109,97,115,107,0,48,17,82,97,98,105,110,35,99,111,110,115,116,114,117,99,116,111,114,0,20,17,82,97,98,105,110,35,102,105,110,103,101,114,112,114,105,110,116,0,49,8,1,50,10,165,31,53,199,1,1,4,127,32,1,40,2,0,65,124,113,34,2,65,128,2,73,4,127,32,2,65,4,118,33,4,65,0,5,32,2,65,31,32,2,103,107,34,3,65,4,107,118,65,16,115,33,4,32,3,65,7,107,11,33,3,32,1,40,2,20,33,2,32,1,40,2,16,34,5,4,64,32,5,32,2,54,2,20,11,32,2,4,64,32,2,32,5,54,2,16,11,32,1,32,0,32,4,32,3,65,4,116,106,65,2,116,106,40,2,96,70,4,64,32,0,32,4,32,3,65,4,116,106,65,2,116,106,32,2,54,2,96,32,2,69,4,64,32,0,32,3,65,2,116,106,32,0,32,3,65,2,116,106,40,2,4,65,1,32,4,116,65,127,115,113,34,1,54,2,4,32,1,69,4,64,32,0,32,0,40,2,0,65,1,32,3,116,65,127,115,113,54,2,0,11,11,11,11,226,2,1,6,127,32,1,40,2,0,33,3,32,1,65,16,106,32,1,40,2,0,65,124,113,106,34,4,40,2,0,34,5,65,1,113,4,64,32,3,65,124,113,65,16,106,32,5,65,124,113,106,34,2,65,240,255,255,255,3,73,4,64,32,0,32,4,16,1,32,1,32,2,32,3,65,3,113,114,34,3,54,2,0,32,1,65,16,106,32,1,40,2,0,65,124,113,106,34,4,40,2,0,33,5,11,11,32,3,65,2,113,4,64,32,1,65,4,107,40,2,0,34,2,40,2,0,34,6,65,124,113,65,16,106,32,3,65,124,113,106,34,7,65,240,255,255,255,3,73,4,64,32,0,32,2,16,1,32,2,32,7,32,6,65,3,113,114,34,3,54,2,0,32,2,33,1,11,11,32,4,32,5,65,2,114,54,2,0,32,4,65,4,107,32,1,54,2,0,32,0,32,3,65,124,113,34,2,65,128,2,73,4,127,32,2,65,4,118,33,4,65,0,5,32,2,65,31,32,2,103,107,34,2,65,4,107,118,65,16,115,33,4,32,2,65,7,107,11,34,3,65,4,116,32,4,106,65,2,116,106,40,2,96,33,2,32,1,65,0,54,2,16,32,1,32,2,54,2,20,32,2,4,64,32,2,32,1,54,2,16,11,32,0,32,4,32,3,65,4,116,106,65,2,116,106,32,1,54,2,96,32,0,32,0,40,2,0,65,1,32,3,116,114,54,2,0,32,0,32,3,65,2,116,106,32,0,32,3,65,2,116,106,40,2,4,65,1,32,4,116,114,54,2,4,11,119,1,1,127,32,2,2,127,32,0,40,2,160,12,34,2,4,64,32,2,32,1,65,16,107,70,4,64,32,2,40,2,0,33,3,32,1,65,16,107,33,1,11,11,32,1,11,107,34,2,65,48,73,4,64,15,11,32,1,32,3,65,2,113,32,2,65,32,107,65,1,114,114,54,2,0,32,1,65,0,54,2,16,32,1,65,0,54,2,20,32,1,32,2,106,65,16,107,34,2,65,2,54,2,0,32,0,32,2,54,2,160,12,32,0,32,1,16,2,11,155,1,1,3,127,35,0,34,0,69,4,64,65,1,63,0,34,0,74,4,127,65,1,32,0,107,64,0,65,0,72,5,65,0,11,4,64,0,11,65,176,3,34,0,65,0,54,2,0,65,208,15,65,0,54,2,0,3,64,32,1,65,23,73,4,64,32,1,65,2,116,65,176,3,106,65,0,54,2,4,65,0,33,2,3,64,32,2,65,16,73,4,64,32,1,65,4,116,32,2,106,65,2,116,65,176,3,106,65,0,54,2,96,32,2,65,1,106,33,2,12,1,11,11,32,1,65,1,106,33,1,12,1,11,11,65,176,3,65,224,15,63,0,65,16,116,16,3,65,176,3,36,0,11,32,0,11,45,0,32,0,65,240,255,255,255,3,79,4,64,65,32,65,224,0,65,201,3,65,29,16,0,0,11,32,0,65,15,106,65,112,113,34,0,65,16,32,0,65,16,75,27,11,169,1,1,1,127,32,0,32,1,65,128,2,73,4,127,32,1,65,4,118,33,1,65,0,5,32,1,65,248,255,255,255,1,73,4,64,32,1,65,1,65,27,32,1,103,107,116,106,65,1,107,33,1,11,32,1,65,31,32,1,103,107,34,2,65,4,107,118,65,16,115,33,1,32,2,65,7,107,11,34,2,65,2,116,106,40,2,4,65,127,32,1,116,113,34,1,4,127,32,0,32,1,104,32,2,65,4,116,106,65,2,116,106,40,2,96,5,32,0,40,2,0,65,127,32,2,65,1,106,116,113,34,1,4,127,32,0,32,0,32,1,104,34,0,65,2,116,106,40,2,4,104,32,0,65,4,116,106,65,2,116,106,40,2,96,5,65,0,11,11,11,111,1,1,127,63,0,34,2,32,1,65,248,255,255,255,1,73,4,127,32,1,65,1,65,27,32,1,103,107,116,65,1,107,106,5,32,1,11,65,16,32,0,40,2,160,12,32,2,65,16,116,65,16,107,71,116,106,65,255,255,3,106,65,128,128,124,113,65,16,118,34,1,32,2,32,1,74,27,64,0,65,0,72,4,64,32,1,64,0,65,0,72,4,64,0,11,11,32,0,32,2,65,16,116,63,0,65,16,116,16,3,11,113,1,2,127,32,1,40,2,0,34,3,65,124,113,32,2,107,34,4,65,32,79,4,64,32,1,32,2,32,3,65,2,113,114,54,2,0,32,2,32,1,65,16,106,106,34,1,32,4,65,16,107,65,1,114,54,2,0,32,0,32,1,16,2,5,32,1,32,3,65,126,113,54,2,0,32,1,65,16,106,32,1,40,2,0,65,124,113,106,32,1,65,16,106,32,1,40,2,0,65,124,113,106,40,2,0,65,125,113,54,2,0,11,11,91,1,2,127,32,0,32,1,16,5,34,4,16,6,34,3,69,4,64,65,1,36,1,65,0,36,1,32,0,32,4,16,6,34,3,69,4,64,32,0,32,4,16,7,32,0,32,4,16,6,33,3,11,11,32,3,65,0,54,2,4,32,3,32,2,54,2,8,32,3,32,1,54,2,12,32,0,32,3,16,1,32,0,32,3,32,4,16,8,32,3,11,13,0,16,4,32,0,32,1,16,9,65,16,106,11,33,1,1,127,32,0,65,172,3,75,4,64,32,0,65,16,107,34,1,32,1,40,2,4,65,1,106,54,2,4,11,32,0,11,18,0,32,0,65,172,3,75,4,64,32,0,65,16,107,16,52,11,11,140,3,1,1,127,2,64,32,1,69,13,0,32,0,65,0,58,0,0,32,0,32,1,106,65,1,107,65,0,58,0,0,32,1,65,2,77,13,0,32,0,65,1,106,65,0,58,0,0,32,0,65,2,106,65,0,58,0,0,32,0,32,1,106,34,2,65,2,107,65,0,58,0,0,32,2,65,3,107,65,0,58,0,0,32,1,65,6,77,13,0,32,0,65,3,106,65,0,58,0,0,32,0,32,1,106,65,4,107,65,0,58,0,0,32,1,65,8,77,13,0,32,1,65,0,32,0,107,65,3,113,34,1,107,33,2,32,0,32,1,106,34,0,65,0,54,2,0,32,0,32,2,65,124,113,34,1,106,65,4,107,65,0,54,2,0,32,1,65,8,77,13,0,32,0,65,4,106,65,0,54,2,0,32,0,65,8,106,65,0,54,2,0,32,0,32,1,106,34,2,65,12,107,65,0,54,2,0,32,2,65,8,107,65,0,54,2,0,32,1,65,24,77,13,0,32,0,65,12,106,65,0,54,2,0,32,0,65,16,106,65,0,54,2,0,32,0,65,20,106,65,0,54,2,0,32,0,65,24,106,65,0,54,2,0,32,0,32,1,106,34,2,65,28,107,65,0,54,2,0,32,2,65,24,107,65,0,54,2,0,32,2,65,20,107,65,0,54,2,0,32,2,65,16,107,65,0,54,2,0,32,0,32,0,65,4,113,65,24,106,34,2,106,33,0,32,1,32,2,107,33,1,3,64,32,1,65,32,79,4,64,32,0,66,0,55,3,0,32,0,65,8,106,66,0,55,3,0,32,0,65,16,106,66,0,55,3,0,32,0,65,24,106,66,0,55,3,0,32,1,65,32,107,33,1,32,0,65,32,106,33,0,12,1,11,11,11,11,178,1,1,3,127,32,1,65,240,255,255,255,3,32,2,118,75,4,64,65,144,1,65,192,1,65,23,65,56,16,0,0,11,32,1,32,2,116,34,3,65,0,16,10,34,2,32,3,16,13,32,0,69,4,64,65,12,65,2,16,10,34,0,65,172,3,75,4,64,32,0,65,16,107,34,1,32,1,40,2,4,65,1,106,54,2,4,11,11,32,0,65,0,54,2,0,32,0,65,0,54,2,4,32,0,65,0,54,2,8,32,2,34,1,32,0,40,2,0,34,4,71,4,64,32,1,65,172,3,75,4,64,32,1,65,16,107,34,5,32,5,40,2,4,65,1,106,54,2,4,11,32,4,16,12,11,32,0,32,1,54,2,0,32,0,32,2,54,2,4,32,0,32,3,54,2,8,32,0,11,46,1,2,127,65,12,65,5,16,10,34,0,65,172,3,75,4,64,32,0,65,16,107,34,1,32,1,40,2,4,65,1,106,54,2,4,11,32,0,65,128,2,65,3,16,14,11,9,0,65,63,32,0,121,167,107,11,49,1,2,127,65,63,32,1,121,167,107,33,2,3,64,65,63,32,0,121,167,107,32,2,107,34,3,65,0,78,4,64,32,0,32,1,32,3,172,134,133,33,0,12,1,11,11,32,0,11,40,0,32,1,32,0,40,2,8,79,4,64,65,128,2,65,192,2,65,163,1,65,44,16,0,0,11,32,1,32,0,40,2,4,106,65,0,58,0,0,11,38,0,32,1,32,0,40,2,8,79,4,64,65,128,2,65,192,2,65,152,1,65,44,16,0,0,11,32,1,32,0,40,2,4,106,45,0,0,11,254,5,2,1,127,4,126,32,0,69,4,64,65,232,0,65,6,16,10,34,0,65,172,3,75,4,64,32,0,65,16,107,34,5,32,5,40,2,4,65,1,106,54,2,4,11,11,32,0,65,0,54,2,0,32,0,65,0,54,2,4,32,0,65,0,54,2,8,32,0,66,0,55,3,16,32,0,66,0,55,3,24,32,0,66,0,55,3,32,32,0,66,0,55,3,40,32,0,66,0,55,3,48,32,0,66,0,55,3,56,32,0,66,0,55,3,64,32,0,66,0,55,3,72,32,0,66,0,55,3,80,32,0,66,0,55,3,88,32,0,66,0,55,3,96,32,0,32,2,173,55,3,80,32,0,32,3,173,55,3,88,65,12,65,4,16,10,34,2,65,172,3,75,4,64,32,2,65,16,107,34,3,32,3,40,2,4,65,1,106,54,2,4,11,32,2,32,4,65,0,16,14,33,2,32,0,40,2,0,16,12,32,0,32,2,54,2,0,32,0,32,4,54,2,4,32,0,66,1,32,1,173,134,66,1,125,55,3,96,32,0,66,243,130,183,218,216,230,232,30,55,3,72,35,4,69,4,64,65,0,33,2,3,64,32,2,65,128,2,72,4,64,32,2,65,255,1,113,173,33,6,32,0,41,3,72,34,7,33,8,65,63,32,7,121,167,107,33,1,3,64,65,63,32,6,121,167,107,32,1,107,34,3,65,0,78,4,64,32,6,32,8,32,3,172,134,133,33,6,12,1,11,11,65,0,33,4,3,64,32,4,32,0,40,2,4,65,1,107,72,4,64,32,6,66,8,134,33,6,32,0,41,3,72,34,7,33,8,65,63,32,7,121,167,107,33,1,3,64,65,63,32,6,121,167,107,32,1,107,34,3,65,0,78,4,64,32,6,32,8,32,3,172,134,133,33,6,12,1,11,11,32,4,65,1,106,33,4,12,1,11,11,35,6,40,2,4,32,2,65,3,116,106,32,6,55,3,0,32,2,65,1,106,33,2,12,1,11,11,65,63,32,0,41,3,72,121,167,107,172,33,7,65,0,33,2,3,64,32,2,65,128,2,72,4,64,35,5,33,1,32,2,172,32,7,134,34,8,33,6,65,63,32,0,41,3,72,34,9,121,167,107,33,3,3,64,65,63,32,6,121,167,107,32,3,107,34,4,65,0,78,4,64,32,6,32,9,32,4,172,134,133,33,6,12,1,11,11,32,1,40,2,4,32,2,65,3,116,106,32,6,32,8,132,55,3,0,32,2,65,1,106,33,2,12,1,11,11,65,1,36,4,11,32,0,66,0,55,3,24,32,0,66,0,55,3,32,65,0,33,2,3,64,32,2,32,0,40,2,4,72,4,64,32,0,40,2,0,32,2,16,18,32,2,65,1,106,33,2,12,1,11,11,32,0,66,0,55,3,40,32,0,65,0,54,2,8,32,0,66,0,55,3,16,32,0,66,0,55,3,40,32,0,40,2,0,32,0,40,2,8,16,19,33,1,32,0,40,2,8,32,0,40,2,0,40,2,4,106,65,1,58,0,0,32,0,32,0,41,3,40,35,6,40,2,4,32,1,65,3,116,106,41,3,0,133,55,3,40,32,0,32,0,40,2,8,65,1,106,32,0,40,2,4,111,54,2,8,32,0,35,5,40,2,4,32,0,41,3,40,34,6,66,45,136,167,65,3,116,106,41,3,0,32,6,66,8,134,66,1,132,133,55,3,40,32,0,11,38,1,1,127,32,0,40,2,0,34,0,65,172,3,75,4,64,32,0,65,16,107,34,1,32,1,40,2,4,65,1,106,54,2,4,11,32,0,11,55,1,2,127,32,1,32,0,40,2,0,34,2,71,4,64,32,1,65,172,3,75,4,64,32,1,65,16,107,34,3,32,3,40,2,4,65,1,106,54,2,4,11,32,2,16,12,11,32,0,32,1,54,2,0,11,7,0,32,0,40,2,4,11,9,0,32,0,32,1,54,2,4,11,7,0,32,0,40,2,8,11,9,0,32,0,32,1,54,2,8,11,7,0,32,0,41,3,16,11,9,0,32,0,32,1,55,3,16,11,7,0,32,0,41,3,24,11,9,0,32,0,32,1,55,3,24,11,7,0,32,0,41,3,32,11,9,0,32,0,32,1,55,3,32,11,7,0,32,0,41,3,40,11,9,0,32,0,32,1,55,3,40,11,7,0,32,0,41,3,48,11,9,0,32,0,32,1,55,3,48,11,7,0,32,0,41,3,56,11,9,0,32,0,32,1,55,3,56,11,7,0,32,0,41,3,64,11,9,0,32,0,32,1,55,3,64,11,7,0,32,0,41,3,72,11,9,0,32,0,32,1,55,3,72,11,7,0,32,0,41,3,80,11,9,0,32,0,32,1,55,3,80,11,7,0,32,0,41,3,88,11,9,0,32,0,32,1,55,3,88,11,7,0,32,0,41,3,96,11,9,0,32,0,32,1,55,3,96,11,172,4,2,5,127,1,126,32,2,65,172,3,75,4,64,32,2,65,16,107,34,4,32,4,40,2,4,65,1,106,54,2,4,11,32,2,33,4,65,0,33,2,32,1,40,2,8,33,5,32,1,40,2,4,33,6,3,64,2,127,65,0,33,3,3,64,32,3,32,5,72,4,64,32,3,32,6,106,45,0,0,33,1,32,0,40,2,0,32,0,40,2,8,16,19,33,7,32,0,40,2,8,32,0,40,2,0,40,2,4,106,32,1,58,0,0,32,0,32,0,41,3,40,35,6,40,2,4,32,7,65,3,116,106,41,3,0,133,55,3,40,32,0,32,0,40,2,8,65,1,106,32,0,40,2,4,111,54,2,8,32,0,35,5,40,2,4,32,0,41,3,40,34,8,66,45,136,167,65,3,116,106,41,3,0,32,1,173,32,8,66,8,134,132,133,55,3,40,32,0,32,0,41,3,16,66,1,124,55,3,16,32,0,32,0,41,3,24,66,1,124,55,3,24,32,0,41,3,16,32,0,41,3,80,90,4,127,32,0,41,3,40,32,0,41,3,96,131,80,5,65,0,11,4,127,65,1,5,32,0,41,3,16,32,0,41,3,88,90,11,4,64,32,0,32,0,41,3,32,55,3,48,32,0,32,0,41,3,16,55,3,56,32,0,32,0,41,3,40,55,3,64,65,0,33,1,3,64,32,1,32,0,40,2,4,72,4,64,32,0,40,2,0,32,1,16,18,32,1,65,1,106,33,1,12,1,11,11,32,0,66,0,55,3,40,32,0,65,0,54,2,8,32,0,66,0,55,3,16,32,0,66,0,55,3,40,32,0,40,2,0,32,0,40,2,8,16,19,33,1,32,0,40,2,8,32,0,40,2,0,40,2,4,106,65,1,58,0,0,32,0,32,0,41,3,40,35,6,40,2,4,32,1,65,3,116,106,41,3,0,133,55,3,40,32,0,32,0,40,2,8,65,1,106,32,0,40,2,4,111,54,2,8,32,0,35,5,40,2,4,32,0,41,3,40,34,8,66,45,136,167,65,3,116,106,41,3,0,32,8,66,8,134,66,1,132,133,55,3,40,32,3,65,1,106,12,3,11,32,3,65,1,106,33,3,12,1,11,11,65,127,11,34,1,65,0,78,4,64,32,5,32,1,107,33,5,32,1,32,6,106,33,6,32,2,34,1,65,1,106,33,2,32,4,40,2,4,32,1,65,2,116,106,32,0,41,3,56,62,2,0,12,1,11,11,32,4,11,10,0,16,15,36,5,16,15,36,6,11,3,0,1,11,73,1,2,127,32,0,40,2,4,34,1,65,255,255,255,255,0,113,34,2,65,1,70,4,64,32,0,65,16,106,16,53,32,0,32,0,40,2,0,65,1,114,54,2,0,35,0,32,0,16,2,5,32,0,32,2,65,1,107,32,1,65,128,128,128,128,127,113,114,54,2,4,11,11,58,0,2,64,2,64,2,64,32,0,65,8,107,40,2,0,14,7,0,0,1,1,1,1,1,2,11,15,11,32,0,40,2,0,34,0,4,64,32,0,65,172,3,79,4,64,32,0,65,16,107,16,52,11,11,15,11,0,11,11,137,3,7,0,65,16,11,55,40,0,0,0,1,0,0,0,1,0,0,0,40,0,0,0,97,0,108,0,108,0,111,0,99,0,97,0,116,0,105,0,111,0,110,0,32,0,116,0,111,0,111,0,32,0,108,0,97,0,114,0,103,0,101,0,65,208,0,11,45,30,0,0,0,1,0,0,0,1,0,0,0,30,0,0,0,126,0,108,0,105,0,98,0,47,0,114,0,116,0,47,0,116,0,108,0,115,0,102,0,46,0,116,0,115,0,65,128,1,11,43,28,0,0,0,1,0,0,0,1,0,0,0,28,0,0,0,73,0,110,0,118,0,97,0,108,0,105,0,100,0,32,0,108,0,101,0,110,0,103,0,116,0,104,0,65,176,1,11,53,38,0,0,0,1,0,0,0,1,0,0,0,38,0,0,0,126,0,108,0,105,0,98,0,47,0,97,0,114,0,114,0,97,0,121,0,98,0,117,0,102,0,102,0,101,0,114,0,46,0,116,0,115,0,65,240,1,11,51,36,0,0,0,1,0,0,0,1,0,0,0,36,0,0,0,73,0,110,0,100,0,101,0,120,0,32,0,111,0,117,0,116,0,32,0,111,0,102,0,32,0,114,0,97,0,110,0,103,0,101,0,65,176,2,11,51,36,0,0,0,1,0,0,0,1,0,0,0,36,0,0,0,126,0,108,0,105,0,98,0,47,0,116,0,121,0,112,0,101,0,100,0,97,0,114,0,114,0,97,0,121,0,46,0,116,0,115,0,65,240,2,11,53,7,0,0,0,16,0,0,0,0,0,0,0,16,0,0,0,0,0,0,0,16,0,0,0,0,0,0,0,145,4,0,0,2,0,0,0,49,0,0,0,2,0,0,0,17,1,0,0,2,0,0,0,16,0,34,16,115,111,117,114,99,101,77,97,112,112,105,110,103,85,82,76,16,46,47,114,97,98,105,110,46,119,97,115,109,46,109,97,112]);return r(new Response(new Blob([t],{type:"application/wasm"})),e)}n.supported="undefined"!=typeof WebAssembly,t.exports=n}}),require_src=__commonJS({"node_modules/rabin-wasm/src/index.js"(e,t){var r=require_rabin(),n=require_rabin_wasm();t.exports={Rabin:r,create:async(e,t,o,i,s)=>{const a=await n();return new r(a,e,t,o,i,s)}}}}),identity_exports={},identity;__export(identity_exports,{identity:()=>identity});var init_identity=__esm({"node_modules/multiformats/esm/src/bases/identity.js"(){init_base(),init_bytes(),identity=from({prefix:"\0",name:"identity",encode:e=>toString(e),decode:e=>fromString(e)})}}),base2_exports={},base2;__export(base2_exports,{base2:()=>base2});var init_base2=__esm({"node_modules/multiformats/esm/src/bases/base2.js"(){init_base(),base2=rfc4648({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1})}}),base8_exports={},base8;__export(base8_exports,{base8:()=>base8});var init_base8=__esm({"node_modules/multiformats/esm/src/bases/base8.js"(){init_base(),base8=rfc4648({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3})}}),base10_exports={},base10;__export(base10_exports,{base10:()=>base10});var init_base10=__esm({"node_modules/multiformats/esm/src/bases/base10.js"(){init_base(),base10=baseX({prefix:"9",name:"base10",alphabet:"0123456789"})}}),base16_exports={},base16,base16upper;__export(base16_exports,{base16:()=>base16,base16upper:()=>base16upper});var init_base16=__esm({"node_modules/multiformats/esm/src/bases/base16.js"(){init_base(),base16=rfc4648({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),base16upper=rfc4648({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4})}}),base36_exports={},base36,base36upper;__export(base36_exports,{base36:()=>base36,base36upper:()=>base36upper});var init_base36=__esm({"node_modules/multiformats/esm/src/bases/base36.js"(){init_base(),base36=baseX({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),base36upper=baseX({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"})}}),base64_exports={},base64,base64pad,base64url,base64urlpad;__export(base64_exports,{base64:()=>base64,base64pad:()=>base64pad,base64url:()=>base64url,base64urlpad:()=>base64urlpad});var init_base64=__esm({"node_modules/multiformats/esm/src/bases/base64.js"(){init_base(),base64=rfc4648({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),base64pad=rfc4648({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),base64url=rfc4648({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),base64urlpad=rfc4648({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6})}}),identity_exports2={},code4,name4,encode10,digest,identity2;__export(identity_exports2,{identity:()=>identity2});var init_identity2=__esm({"node_modules/multiformats/esm/src/hashes/identity.js"(){init_bytes(),init_digest(),digest=e=>create(code4,encode10(e)),identity2={code:code4=0,name:name4="identity",encode:encode10=coerce,digest:digest}}}),textEncoder4,textDecoder3,init_json=__esm({"node_modules/multiformats/esm/src/codecs/json.js"(){textEncoder4=new TextEncoder,textDecoder3=new TextDecoder}}),bases,hashes,init_basics=__esm({"node_modules/multiformats/esm/src/basics.js"(){init_identity(),init_base2(),init_base8(),init_base10(),init_base16(),init_base32(),init_base36(),init_base58(),init_base64(),init_sha2_browser(),init_identity2(),init_raw(),init_json(),init_src(),bases={...identity_exports,...base2_exports,...base8_exports,...base10_exports,...base16_exports,...base32_exports,...base36_exports,...base58_exports,...base64_exports},hashes={...sha2_browser_exports,...identity_exports2}}}),string2,ascii,BASES,bases_default;function createCodec(e,t,r,n){return{name:e,prefix:t,encoder:{name:e,prefix:t,encode:r},decoder:{decode:n}}}var init_bases=__esm({"node_modules/uint8arrays/esm/src/util/bases.js"(){init_basics(),string2=createCodec("utf8","u",e=>"u"+new TextDecoder("utf8").decode(e),e=>(new TextEncoder).encode(e.substring(1))),ascii=createCodec("ascii","a",e=>{let t="a";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return t},e=>{e=e.substring(1);const t=new Uint8Array(e.length);for(let r=0;r<e.length;r++)t[r]=e.charCodeAt(r);return t}),BASES={utf8:string2,"utf-8":string2,hex:bases.base16,latin1:ascii,ascii:ascii,binary:ascii,...bases},bases_default=BASES}}),from_string_exports={};function fromString3(e,t="utf8"){const r=bases_default[t];if(!r)throw new Error(`Unsupported encoding "${t}"`);return r.decoder.decode(`${r.prefix}${e}`)}__export(from_string_exports,{fromString:()=>fromString3});var init_from_string=__esm({"node_modules/uint8arrays/esm/src/from-string.js"(){init_bases()}}),require_sparse_array=__commonJS({"node_modules/sparse-array/index.js"(e,t){"use strict";function r(e,t){return e+n(t)}function n(e){let t=e;return t-=t>>1&1431655765,t=(858993459&t)+(t>>2&858993459),16843009*(t+(t>>4)&252645135)>>24}function o(e,t){return e[0]-t[0]}function i(e){return e[1]}t.exports=class{constructor(){this._bitArrays=[],this._data=[],this._length=0,this._changedLength=!1,this._changedData=!1}set(e,t){let r=this._internalPositionFor(e,!1);if(void 0===t)-1!==r&&(this._unsetInternalPos(r),this._unsetBit(e),this._changedLength=!0,this._changedData=!0);else{let n=!1;-1===r?(r=this._data.length,this._setBit(e),this._changedData=!0):n=!0,this._setInternalPos(r,e,t,n),this._changedLength=!0}}unset(e){this.set(e,void 0)}get(e){this._sortData();const t=this._internalPositionFor(e,!0);if(-1!==t)return this._data[t][1]}push(e){return this.set(this.length,e),this.length}get length(){if(this._sortData(),this._changedLength){const e=this._data[this._data.length-1];this._length=e?e[0]+1:0,this._changedLength=!1}return this._length}forEach(e){let t=0;for(;t<this.length;)e(this.get(t),t,this),t++}map(e){let t=0,r=new Array(this.length);for(;t<this.length;)r[t]=e(this.get(t),t,this),t++;return r}reduce(e,t){let r=0,n=t;for(;r<this.length;){n=e(n,this.get(r),r),r++}return n}find(e){let t,r,n=0;for(;n<this.length&&!t;)r=this.get(n),t=e(r),n++;return t?r:void 0}_internalPositionFor(e,t){const o=this._bytePosFor(e,t);if(o>=this._bitArrays.length)return-1;const i=this._bitArrays[o],s=e-7*o;if(!((i&1<<s)>0))return-1;return this._bitArrays.slice(0,o).reduce(r,0)+n(i&~(4294967295<<s+1))-1}_bytePosFor(e,t){const r=Math.floor(e/7),n=r+1;for(;!t&&this._bitArrays.length<n;)this._bitArrays.push(0);return r}_setBit(e){const t=this._bytePosFor(e,!1);this._bitArrays[t]|=1<<e-7*t}_unsetBit(e){const t=this._bytePosFor(e,!1);this._bitArrays[t]&=~(1<<e-7*t)}_setInternalPos(e,t,r,n){const o=this._data,i=[t,r];if(n)this._sortData(),o[e]=i;else{if(o.length)if(o[o.length-1][0]>=t)o.push(i);else if(o[0][0]<=t)o.unshift(i);else{const e=Math.round(o.length/2);this._data=o.slice(0,e).concat(i).concat(o.slice(e))}else this._data.push(i);this._changedData=!0,this._changedLength=!0}}_unsetInternalPos(e){this._data.splice(e,1)}_sortData(){this._changedData&&this._data.sort(o),this._changedData=!1}bitField(){const e=[];let t,r=8,n=0,o=0;const i=this._bitArrays.slice();for(;i.length||n;){0===n&&(t=i.shift(),n=7);const s=Math.min(n,r);o|=(t&~(255<<s))<<8-r,t>>>=s,n-=s,r-=s,r&&(n||i.length)||(e.push(o),o=0,r=8)}for(var s=e.length-1;s>0;s--){if(0!==e[s])break;e.pop()}return e}compactArray(){return this._sortData(),this._data.map(i)}}}}),require_bucket=__commonJS({"node_modules/hamt-sharding/src/bucket.js"(e,t){"use strict";var r=require_sparse_array(),{fromString:n}=(init_from_string(),from_string_exports),o=class{constructor(e,t,n=0){this._options=e,this._popCount=0,this._parent=t,this._posAtParent=n,this._children=new r,this.key=null}async put(e,t){const r=await this._findNewBucketAndPos(e);await r.bucket._putAt(r,e,t)}async get(e){const t=await this._findChild(e);if(t)return t.value}async del(e){const t=await this._findPlace(e),r=t.bucket._at(t.pos);r&&r.key===e&&t.bucket._delAt(t.pos)}leafCount(){return this._children.compactArray().reduce((e,t)=>t instanceof o?e+t.leafCount():e+1,0)}childrenCount(){return this._children.length}onlyChild(){return this._children.get(0)}*eachLeafSeries(){const e=this._children.compactArray();for(const t of e)t instanceof o?yield*t.eachLeafSeries():yield t;return[]}serialize(e,t){return t(this._children.reduce((r,n,i)=>(n&&(n instanceof o?r.push(n.serialize(e,t)):r.push(e(n,i))),r),[]))}asyncTransform(e,t){return c(this,e,t)}toJSON(){return this.serialize(s,a)}prettyPrint(){return JSON.stringify(this.toJSON(),null,"  ")}tableSize(){return Math.pow(2,this._options.bits)}async _findChild(e){const t=await this._findPlace(e),r=t.bucket._at(t.pos);if(!(r instanceof o))return r&&r.key===e?r:void 0}async _findPlace(e){const t=this._options.hash("string"==typeof e?n(e):e),r=await t.take(this._options.bits),i=this._children.get(r);return i instanceof o?i._findPlace(t):{bucket:this,pos:r,hash:t,existingChild:i}}async _findNewBucketAndPos(e){const t=await this._findPlace(e);if(t.existingChild&&t.existingChild.key!==e){const e=new o(this._options,t.bucket,t.pos);t.bucket._putObjectAt(t.pos,e);const r=await e._findPlace(t.existingChild.hash);return r.bucket._putAt(r,t.existingChild.key,t.existingChild.value),e._findNewBucketAndPos(t.hash)}return t}_putAt(e,t,r){this._putObjectAt(e.pos,{key:t,value:r,hash:e.hash})}_putObjectAt(e,t){this._children.get(e)||this._popCount++,this._children.set(e,t)}_delAt(e){if(-1===e)throw new Error("Invalid position");this._children.get(e)&&this._popCount--,this._children.unset(e),this._level()}_level(){if(this._parent&&this._popCount<=1)if(1===this._popCount){const e=this._children.find(i);if(e&&!(e instanceof o)){const t=e.hash;t.untake(this._options.bits);const r={pos:this._posAtParent,hash:t,bucket:this._parent};this._parent._putAt(r,e.key,e.value)}}else this._parent._delAt(this._posAtParent)}_at(e){return this._children.get(e)}};function i(e){return Boolean(e)}function s(e,t){return e.key}function a(e){return e}async function c(e,t,r){const n=[];for(const i of e._children.compactArray())if(i instanceof o)await c(i,t,r);else{const r=await t(i);n.push({bitField:e._children.bitField(),children:r})}return r(n)}t.exports=o}}),require_consumable_buffer=__commonJS({"node_modules/hamt-sharding/src/consumable-buffer.js"(e,t){"use strict";var r=[255,254,252,248,240,224,192,128],n=[1,3,7,15,31,63,127,255];function o(e,t,o){const i=function(e,t){return r[e]&n[Math.min(t+e-1,7)]}(t,o);return(e&i)>>>t}t.exports=class{constructor(e){this._value=e,this._currentBytePos=e.length-1,this._currentBitPos=7}availableBits(){return this._currentBitPos+1+8*this._currentBytePos}totalBits(){return 8*this._value.length}take(e){let t=e,r=0;for(;t&&this._haveBits();){const e=this._value[this._currentBytePos],n=this._currentBitPos+1,i=Math.min(n,t);r=(r<<i)+o(e,n-i,i),t-=i,this._currentBitPos-=i,this._currentBitPos<0&&(this._currentBitPos=7,this._currentBytePos--)}return r}untake(e){for(this._currentBitPos+=e;this._currentBitPos>7;)this._currentBitPos-=8,this._currentBytePos+=1}_haveBits(){return this._currentBytePos>=0}}}}),concat_exports={};function concat2(e,t){t||(t=e.reduce((e,t)=>e+t.length,0));const r=new Uint8Array(t);let n=0;for(const t of e)r.set(t,n),n+=t.length;return r}__export(concat_exports,{concat:()=>concat2});var init_concat=__esm({"node_modules/uint8arrays/esm/src/concat.js"(){}}),require_consumable_hash=__commonJS({"node_modules/hamt-sharding/src/consumable-hash.js"(e,t){"use strict";var r=require_consumable_buffer(),{concat:n}=(init_concat(),concat_exports);var o=class{constructor(e,t){if(!(e instanceof Uint8Array))throw new Error("can only hash Uint8Arrays");this._value=e,this._hashFn=t,this._depth=-1,this._availableBits=0,this._currentBufferIndex=0,this._buffers=[]}async take(e){let t=e;for(;this._availableBits<t;)await this._produceMoreBits();let r=0;for(;t>0;){const e=this._buffers[this._currentBufferIndex],n=Math.min(e.availableBits(),t);r=(r<<n)+e.take(n),t-=n,this._availableBits-=n,0===e.availableBits()&&this._currentBufferIndex++}return r}untake(e){let t=e;for(;t>0;){const e=this._buffers[this._currentBufferIndex],r=Math.min(e.totalBits()-e.availableBits(),t);e.untake(r),t-=r,this._availableBits+=r,this._currentBufferIndex>0&&e.totalBits()===e.availableBits()&&(this._depth--,this._currentBufferIndex--)}}async _produceMoreBits(){this._depth++;const e=this._depth?n([this._value,Uint8Array.from([this._depth])]):this._value,t=await this._hashFn(e),o=new r(t);this._buffers.push(o),this._availableBits+=o.availableBits()}};t.exports=function(e){return function(t){return t instanceof o?t:new o(t,e)}},t.exports.InfiniteHash=o}}),require_src2=__commonJS({"node_modules/hamt-sharding/src/index.js"(e,t){"use strict";var r=require_bucket(),n=require_consumable_hash();t.exports={createHAMT:function(e){if(!e||!e.hashFn)throw new Error("please define an options.hashFn");const t={bits:e.bits||8,hash:n(e.hashFn)};return new r(t)},Bucket:r}}}),require_browser_readablestream_to_it=__commonJS({"node_modules/browser-readablestream-to-it/index.js"(e,t){"use strict";t.exports=async function*(e,t={}){const r=e.getReader();try{for(;;){const e=await r.read();if(e.done)return;yield e.value}}finally{!0!==t.preventCancel&&r.cancel(),r.releaseLock()}}}}),require_blob_to_it=__commonJS({"node_modules/blob-to-it/index.js"(e,t){"use strict";var r=require_browser_readablestream_to_it();t.exports=function(e){return"function"==typeof e.stream?r(e.stream()):r(new Response(e).body)}}}),require_it_peekable=__commonJS({"node_modules/it-peekable/index.js"(e,t){"use strict";t.exports=function(e){const[t,r]=e[Symbol.asyncIterator]?[e[Symbol.asyncIterator](),Symbol.asyncIterator]:[e[Symbol.iterator](),Symbol.iterator],n=[];return{peek:()=>t.next(),push:e=>{n.push(e)},next:()=>n.length?{done:!1,value:n.shift()}:t.next(),[r](){return this}}}}}),require_it_map=__commonJS({"node_modules/it-map/index.js"(e,t){"use strict";t.exports=async function*(e,t){for await(const r of e)yield t(r)}}}),require_it_drain=__commonJS({"node_modules/it-drain/index.js"(e,t){"use strict";t.exports=async e=>{for await(const t of e);}}}),require_it_filter=__commonJS({"node_modules/it-filter/index.js"(e,t){"use strict";t.exports=async function*(e,t){for await(const r of e)await t(r)&&(yield r)}}}),require_it_take=__commonJS({"node_modules/it-take/index.js"(e,t){"use strict";t.exports=async function*(e,t){let r=0;if(!(t<1))for await(const n of e)if(yield n,r++,r===t)return}}}),require_path_browserify=__commonJS({"node_modules/path-browserify/index.js"(e,t){"use strict";function r(e){if("string"!=typeof e)throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}function n(e,t){for(var r,n="",o=0,i=-1,s=0,a=0;a<=e.length;++a){if(a<e.length)r=e.charCodeAt(a);else{if(47===r)break;r=47}if(47===r){if(i===a-1||1===s);else if(i!==a-1&&2===s){if(n.length<2||2!==o||46!==n.charCodeAt(n.length-1)||46!==n.charCodeAt(n.length-2))if(n.length>2){var c=n.lastIndexOf("/");if(c!==n.length-1){-1===c?(n="",o=0):o=(n=n.slice(0,c)).length-1-n.lastIndexOf("/"),i=a,s=0;continue}}else if(2===n.length||1===n.length){n="",o=0,i=a,s=0;continue}t&&(n.length>0?n+="/..":n="..",o=2)}else n.length>0?n+="/"+e.slice(i+1,a):n=e.slice(i+1,a),o=a-i-1;i=a,s=0}else 46===r&&-1!==s?++s:s=-1}return n}var o={resolve:function(){for(var e,t="",o=!1,i=arguments.length-1;i>=-1&&!o;i--){var s;i>=0?s=arguments[i]:(void 0===e&&(e=process.cwd()),s=e),r(s),0!==s.length&&(t=s+"/"+t,o=47===s.charCodeAt(0))}return t=n(t,!o),o?t.length>0?"/"+t:"/":t.length>0?t:"."},normalize:function(e){if(r(e),0===e.length)return".";var t=47===e.charCodeAt(0),o=47===e.charCodeAt(e.length-1);return 0!==(e=n(e,!t)).length||t||(e="."),e.length>0&&o&&(e+="/"),t?"/"+e:e},isAbsolute:function(e){return r(e),e.length>0&&47===e.charCodeAt(0)},join:function(){if(0===arguments.length)return".";for(var e,t=0;t<arguments.length;++t){var n=arguments[t];r(n),n.length>0&&(void 0===e?e=n:e+="/"+n)}return void 0===e?".":o.normalize(e)},relative:function(e,t){if(r(e),r(t),e===t)return"";if((e=o.resolve(e))===(t=o.resolve(t)))return"";for(var n=1;n<e.length&&47===e.charCodeAt(n);++n);for(var i=e.length,s=i-n,a=1;a<t.length&&47===t.charCodeAt(a);++a);for(var c=t.length-a,u=s<c?s:c,l=-1,d=0;d<=u;++d){if(d===u){if(c>u){if(47===t.charCodeAt(a+d))return t.slice(a+d+1);if(0===d)return t.slice(a+d)}else s>u&&(47===e.charCodeAt(n+d)?l=d:0===d&&(l=0));break}var f=e.charCodeAt(n+d);if(f!==t.charCodeAt(a+d))break;47===f&&(l=d)}var h="";for(d=n+l+1;d<=i;++d)d!==i&&47!==e.charCodeAt(d)||(0===h.length?h+="..":h+="/..");return h.length>0?h+t.slice(a+l):(a+=l,47===t.charCodeAt(a)&&++a,t.slice(a))},_makeLong:function(e){return e},dirname:function(e){if(r(e),0===e.length)return".";for(var t=e.charCodeAt(0),n=47===t,o=-1,i=!0,s=e.length-1;s>=1;--s)if(47===(t=e.charCodeAt(s))){if(!i){o=s;break}}else i=!1;return-1===o?n?"/":".":n&&1===o?"//":e.slice(0,o)},basename:function(e,t){if(void 0!==t&&"string"!=typeof t)throw new TypeError('"ext" argument must be a string');r(e);var n,o=0,i=-1,s=!0;if(void 0!==t&&t.length>0&&t.length<=e.length){if(t.length===e.length&&t===e)return"";var a=t.length-1,c=-1;for(n=e.length-1;n>=0;--n){var u=e.charCodeAt(n);if(47===u){if(!s){o=n+1;break}}else-1===c&&(s=!1,c=n+1),a>=0&&(u===t.charCodeAt(a)?-1===--a&&(i=n):(a=-1,i=c))}return o===i?i=c:-1===i&&(i=e.length),e.slice(o,i)}for(n=e.length-1;n>=0;--n)if(47===e.charCodeAt(n)){if(!s){o=n+1;break}}else-1===i&&(s=!1,i=n+1);return-1===i?"":e.slice(o,i)},extname:function(e){r(e);for(var t=-1,n=0,o=-1,i=!0,s=0,a=e.length-1;a>=0;--a){var c=e.charCodeAt(a);if(47!==c)-1===o&&(i=!1,o=a+1),46===c?-1===t?t=a:1!==s&&(s=1):-1!==t&&(s=-1);else if(!i){n=a+1;break}}return-1===t||-1===o||0===s||1===s&&t===o-1&&t===n+1?"":e.slice(t,o)},format:function(e){if(null===e||"object"!=typeof e)throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof e);return function(e,t){var r=t.dir||t.root,n=t.base||(t.name||"")+(t.ext||"");return r?r===t.root?r+n:r+e+n:n}("/",e)},parse:function(e){r(e);var t={root:"",dir:"",base:"",ext:"",name:""};if(0===e.length)return t;var n,o=e.charCodeAt(0),i=47===o;i?(t.root="/",n=1):n=0;for(var s=-1,a=0,c=-1,u=!0,l=e.length-1,d=0;l>=n;--l)if(47!==(o=e.charCodeAt(l)))-1===c&&(u=!1,c=l+1),46===o?-1===s?s=l:1!==d&&(d=1):-1!==s&&(d=-1);else if(!u){a=l+1;break}return-1===s||-1===c||0===d||1===d&&s===c-1&&s===a+1?-1!==c&&(t.base=t.name=0===a&&i?e.slice(1,c):e.slice(a,c)):(0===a&&i?(t.name=e.slice(1,s),t.base=e.slice(1,c)):(t.name=e.slice(a,s),t.base=e.slice(a,c)),t.ext=e.slice(s,c)),a>0?t.dir=e.slice(0,a-1):i&&(t.dir="/"),t},sep:"/",delimiter:":",win32:null,posix:null};o.posix=o,t.exports=o}}),require_code=__commonJS({"node_modules/ajv/dist/compile/codegen/code.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.regexpCode=e.getEsmExportName=e.getProperty=e.safeStringify=e.stringify=e.strConcat=e.addCodeArg=e.str=e._=e.nil=e._Code=e.Name=e.IDENTIFIER=e._CodeOrName=void 0;var t=class{};e._CodeOrName=t,e.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var r=class extends t{constructor(t){if(super(),!e.IDENTIFIER.test(t))throw new Error("CodeGen: name must be a valid identifier");this.str=t}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};e.Name=r;var n=class extends t{constructor(e){super(),this._items="string"==typeof e?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;const e=this._items[0];return""===e||'""'===e}get str(){var e;return null!==(e=this._str)&&void 0!==e?e:this._str=this._items.reduce((e,t)=>`${e}${t}`,"")}get names(){var e;return null!==(e=this._names)&&void 0!==e?e:this._names=this._items.reduce((e,t)=>(t instanceof r&&(e[t.str]=(e[t.str]||0)+1),e),{})}};function o(e,...t){const r=[e[0]];let o=0;for(;o<t.length;)a(r,t[o]),r.push(e[++o]);return new n(r)}e._Code=n,e.nil=new n(""),e._=o;var i=new n("+");function s(e,...t){const r=[u(e[0])];let o=0;for(;o<t.length;)r.push(i),a(r,t[o]),r.push(i,u(e[++o]));return function(e){let t=1;for(;t<e.length-1;){if(e[t]===i){const r=c(e[t-1],e[t+1]);if(void 0!==r){e.splice(t-1,3,r);continue}e[t++]="+"}t++}}(r),new n(r)}function a(e,t){var o;t instanceof n?e.push(...t._items):t instanceof r?e.push(t):e.push("number"==typeof(o=t)||"boolean"==typeof o||null===o?o:u(Array.isArray(o)?o.join(","):o))}function c(e,t){if('""'===t)return e;if('""'===e)return t;if("string"==typeof e){if(t instanceof r||'"'!==e[e.length-1])return;return"string"!=typeof t?`${e.slice(0,-1)}${t}"`:'"'===t[0]?e.slice(0,-1)+t.slice(1):void 0}return"string"!=typeof t||'"'!==t[0]||e instanceof r?void 0:`"${e}${t.slice(1)}`}function u(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}e.str=s,e.addCodeArg=a,e.strConcat=function(e,t){return t.emptyStr()?e:e.emptyStr()?t:s`${e}${t}`},e.stringify=function(e){return new n(u(e))},e.safeStringify=u,e.getProperty=function(t){return"string"==typeof t&&e.IDENTIFIER.test(t)?new n(`.${t}`):o`[${t}]`},e.getEsmExportName=function(t){if("string"==typeof t&&e.IDENTIFIER.test(t))return new n(`${t}`);throw new Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)},e.regexpCode=function(e){return new n(e.toString())}}}),require_scope=__commonJS({"node_modules/ajv/dist/compile/codegen/scope.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ValueScope=e.ValueScopeName=e.Scope=e.varKinds=e.UsedValueState=void 0;var t,r,n=require_code(),o=class extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}};(r=t=e.UsedValueState||(e.UsedValueState={}))[r.Started=0]="Started",r[r.Completed=1]="Completed",e.varKinds={const:new n.Name("const"),let:new n.Name("let"),var:new n.Name("var")};var i=class{constructor({prefixes:e,parent:t}={}){this._names={},this._prefixes=e,this._parent=t}toName(e){return e instanceof n.Name?e:this.name(e)}name(e){return new n.Name(this._newName(e))}_newName(e){return`${e}${(this._names[e]||this._nameGroup(e)).index++}`}_nameGroup(e){var t,r;if((null===(r=null===(t=this._parent)||void 0===t?void 0:t._prefixes)||void 0===r?void 0:r.has(e))||this._prefixes&&!this._prefixes.has(e))throw new Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}};e.Scope=i;var s=class extends n.Name{constructor(e,t){super(t),this.prefix=e}setValue(e,{property:t,itemIndex:r}){this.value=e,this.scopePath=n._`.${new n.Name(t)}[${r}]`}};e.ValueScopeName=s;var a=n._`\n`;e.ValueScope=class extends i{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?a:n.nil}}get(){return this._scope}name(e){return new s(e,this._newName(e))}value(e,t){var r;if(void 0===t.ref)throw new Error("CodeGen: ref must be passed in value");const n=this.toName(e),{prefix:o}=n,i=null!==(r=t.key)&&void 0!==r?r:t.ref;let s=this._values[o];if(s){const e=s.get(i);if(e)return e}else s=this._values[o]=new Map;s.set(i,n);const a=this._scope[o]||(this._scope[o]=[]),c=a.length;return a[c]=t.ref,n.setValue(t,{property:o,itemIndex:c}),n}getValue(e,t){const r=this._values[e];if(r)return r.get(t)}scopeRefs(e,t=this._values){return this._reduceValues(t,t=>{if(void 0===t.scopePath)throw new Error(`CodeGen: name "${t}" has no value`);return n._`${e}${t.scopePath}`})}scopeCode(e=this._values,t,r){return this._reduceValues(e,e=>{if(void 0===e.value)throw new Error(`CodeGen: name "${e}" has no value`);return e.value.code},t,r)}_reduceValues(r,i,s={},a){let c=n.nil;for(const u in r){const l=r[u];if(!l)continue;const d=s[u]=s[u]||new Map;l.forEach(r=>{if(d.has(r))return;d.set(r,t.Started);let s=i(r);if(s){const t=this.opts.es5?e.varKinds.var:e.varKinds.const;c=n._`${c}${t} ${r} = ${s};${this.opts._n}`}else{if(!(s=null==a?void 0:a(r)))throw new o(r);c=n._`${c}${s}${this.opts._n}`}d.set(r,t.Completed)})}return c}}}}),require_codegen=__commonJS({"node_modules/ajv/dist/compile/codegen/index.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.or=e.and=e.not=e.CodeGen=e.operators=e.varKinds=e.ValueScopeName=e.ValueScope=e.Scope=e.Name=e.regexpCode=e.stringify=e.getProperty=e.nil=e.strConcat=e.str=e._=void 0;var t=require_code(),r=require_scope(),n=require_code();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return n._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return n.str}}),Object.defineProperty(e,"strConcat",{enumerable:!0,get:function(){return n.strConcat}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return n.nil}}),Object.defineProperty(e,"getProperty",{enumerable:!0,get:function(){return n.getProperty}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return n.stringify}}),Object.defineProperty(e,"regexpCode",{enumerable:!0,get:function(){return n.regexpCode}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return n.Name}});var o=require_scope();Object.defineProperty(e,"Scope",{enumerable:!0,get:function(){return o.Scope}}),Object.defineProperty(e,"ValueScope",{enumerable:!0,get:function(){return o.ValueScope}}),Object.defineProperty(e,"ValueScopeName",{enumerable:!0,get:function(){return o.ValueScopeName}}),Object.defineProperty(e,"varKinds",{enumerable:!0,get:function(){return o.varKinds}}),e.operators={GT:new t._Code(">"),GTE:new t._Code(">="),LT:new t._Code("<"),LTE:new t._Code("<="),EQ:new t._Code("==="),NEQ:new t._Code("!=="),NOT:new t._Code("!"),OR:new t._Code("||"),AND:new t._Code("&&"),ADD:new t._Code("+")};var i=class{optimizeNodes(){return this}optimizeNames(e,t){return this}},s=class extends i{constructor(e,t,r){super(),this.varKind=e,this.name=t,this.rhs=r}render({es5:e,_n:t}){const n=e?r.varKinds.var:this.varKind,o=void 0===this.rhs?"":` = ${this.rhs}`;return`${n} ${this.name}${o};`+t}optimizeNames(e,t){if(e[this.name.str])return this.rhs&&(this.rhs=j(this.rhs,e,t)),this}get names(){return this.rhs instanceof t._CodeOrName?this.rhs.names:{}}},a=class extends i{constructor(e,t,r){super(),this.lhs=e,this.rhs=t,this.sideEffects=r}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,r){if(!(this.lhs instanceof t.Name)||e[this.lhs.str]||this.sideEffects)return this.rhs=j(this.rhs,e,r),this}get names(){return A(this.lhs instanceof t.Name?{}:{...this.lhs.names},this.rhs)}},c=class extends a{constructor(e,t,r,n){super(e,r,n),this.op=t}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}},u=class extends i{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}},l=class extends i{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}},d=class extends i{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}},f=class extends i{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,t){return this.code=j(this.code,e,t),this}get names(){return this.code instanceof t._CodeOrName?this.code.names:{}}},h=class extends i{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce((t,r)=>t+r.render(e),"")}optimizeNodes(){const{nodes:e}=this;let t=e.length;for(;t--;){const r=e[t].optimizeNodes();Array.isArray(r)?e.splice(t,1,...r):r?e[t]=r:e.splice(t,1)}return e.length>0?this:void 0}optimizeNames(e,t){const{nodes:r}=this;let n=r.length;for(;n--;){const o=r[n];o.optimizeNames(e,t)||(C(e,o.names),r.splice(n,1))}return r.length>0?this:void 0}get names(){return this.nodes.reduce((e,t)=>x(e,t.names),{})}},p=class extends h{render(e){return"{"+e._n+super.render(e)+"}"+e._n}},m=class extends h{},y=class extends p{};y.kind="else";var _=class extends p{constructor(e,t){super(t),this.condition=e}render(e){let t=`if(${this.condition})`+super.render(e);return this.else&&(t+="else "+this.else.render(e)),t}optimizeNodes(){super.optimizeNodes();const e=this.condition;if(!0===e)return this.nodes;let t=this.else;if(t){const e=t.optimizeNodes();t=this.else=Array.isArray(e)?new y(e):e}return t?!1===e?t instanceof _?t:t.nodes:this.nodes.length?this:new _(N(e),t instanceof _?[t]:t.nodes):!1!==e&&this.nodes.length?this:void 0}optimizeNames(e,t){var r;if(this.else=null===(r=this.else)||void 0===r?void 0:r.optimizeNames(e,t),super.optimizeNames(e,t)||this.else)return this.condition=j(this.condition,e,t),this}get names(){const e=super.names;return A(e,this.condition),this.else&&x(e,this.else.names),e}};_.kind="if";var g=class extends p{};g.kind="for";var b=class extends g{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,t){if(super.optimizeNames(e,t))return this.iteration=j(this.iteration,e,t),this}get names(){return x(super.names,this.iteration.names)}},w=class extends g{constructor(e,t,r,n){super(),this.varKind=e,this.name=t,this.from=r,this.to=n}render(e){const t=e.es5?r.varKinds.var:this.varKind,{name:n,from:o,to:i}=this;return`for(${t} ${n}=${o}; ${n}<${i}; ${n}++)`+super.render(e)}get names(){const e=A(super.names,this.from);return A(e,this.to)}},v=class extends g{constructor(e,t,r,n){super(),this.loop=e,this.varKind=t,this.name=r,this.iterable=n}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,t){if(super.optimizeNames(e,t))return this.iterable=j(this.iterable,e,t),this}get names(){return x(super.names,this.iterable.names)}},E=class extends p{constructor(e,t,r){super(),this.name=e,this.args=t,this.async=r}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}};E.kind="func";var S=class extends h{render(e){return"return "+super.render(e)}};S.kind="return";var k=class extends p{render(e){let t="try"+super.render(e);return this.catch&&(t+=this.catch.render(e)),this.finally&&(t+=this.finally.render(e)),t}optimizeNodes(){var e,t;return super.optimizeNodes(),null===(e=this.catch)||void 0===e||e.optimizeNodes(),null===(t=this.finally)||void 0===t||t.optimizeNodes(),this}optimizeNames(e,t){var r,n;return super.optimizeNames(e,t),null===(r=this.catch)||void 0===r||r.optimizeNames(e,t),null===(n=this.finally)||void 0===n||n.optimizeNames(e,t),this}get names(){const e=super.names;return this.catch&&x(e,this.catch.names),this.finally&&x(e,this.finally.names),e}},T=class extends p{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}};T.kind="catch";var $=class extends p{render(e){return"finally"+super.render(e)}};$.kind="finally";function x(e,t){for(const r in t)e[r]=(e[r]||0)+(t[r]||0);return e}function A(e,r){return r instanceof t._CodeOrName?x(e,r.names):e}function j(e,r,n){return e instanceof t.Name?i(e):(o=e)instanceof t._Code&&o._items.some(e=>e instanceof t.Name&&1===r[e.str]&&void 0!==n[e.str])?new t._Code(e._items.reduce((e,r)=>(r instanceof t.Name&&(r=i(r)),r instanceof t._Code?e.push(...r._items):e.push(r),e),[])):e;var o;function i(e){const t=n[e.str];return void 0===t||1!==r[e.str]?e:(delete r[e.str],t)}}function C(e,t){for(const r in t)e[r]=(e[r]||0)-(t[r]||0)}function N(e){return"boolean"==typeof e||"number"==typeof e||null===e?!e:t._`!${D(e)}`}e.CodeGen=class{constructor(e,t={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...t,_n:t.lines?"\n":""},this._extScope=e,this._scope=new r.Scope({parent:e}),this._nodes=[new m]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,t){const r=this._extScope.value(e,t);return(this._values[r.prefix]||(this._values[r.prefix]=new Set)).add(r),r}getScopeValue(e,t){return this._extScope.getValue(e,t)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,t,r,n){const o=this._scope.toName(t);return void 0!==r&&n&&(this._constants[o.str]=r),this._leafNode(new s(e,o,r)),o}const(e,t,n){return this._def(r.varKinds.const,e,t,n)}let(e,t,n){return this._def(r.varKinds.let,e,t,n)}var(e,t,n){return this._def(r.varKinds.var,e,t,n)}assign(e,t,r){return this._leafNode(new a(e,t,r))}add(t,r){return this._leafNode(new c(t,e.operators.ADD,r))}code(e){return"function"==typeof e?e():e!==t.nil&&this._leafNode(new f(e)),this}object(...e){const r=["{"];for(const[n,o]of e)r.length>1&&r.push(","),r.push(n),(n!==o||this.opts.es5)&&(r.push(":"),(0,t.addCodeArg)(r,o));return r.push("}"),new t._Code(r)}if(e,t,r){if(this._blockNode(new _(e)),t&&r)this.code(t).else().code(r).endIf();else if(t)this.code(t).endIf();else if(r)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(e){return this._elseNode(new _(e))}else(){return this._elseNode(new y)}endIf(){return this._endBlockNode(_,y)}_for(e,t){return this._blockNode(e),t&&this.code(t).endFor(),this}for(e,t){return this._for(new b(e),t)}forRange(e,t,n,o,i=(this.opts.es5?r.varKinds.var:r.varKinds.let)){const s=this._scope.toName(e);return this._for(new w(i,s,t,n),()=>o(s))}forOf(e,n,o,i=r.varKinds.const){const s=this._scope.toName(e);if(this.opts.es5){const e=n instanceof t.Name?n:this.var("_arr",n);return this.forRange("_i",0,t._`${e}.length`,r=>{this.var(s,t._`${e}[${r}]`),o(s)})}return this._for(new v("of",i,s,n),()=>o(s))}forIn(e,n,o,i=(this.opts.es5?r.varKinds.var:r.varKinds.const)){if(this.opts.ownProperties)return this.forOf(e,t._`Object.keys(${n})`,o);const s=this._scope.toName(e);return this._for(new v("in",i,s,n),()=>o(s))}endFor(){return this._endBlockNode(g)}label(e){return this._leafNode(new u(e))}break(e){return this._leafNode(new l(e))}return(e){const t=new S;if(this._blockNode(t),this.code(e),1!==t.nodes.length)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(S)}try(e,t,r){if(!t&&!r)throw new Error('CodeGen: "try" without "catch" and "finally"');const n=new k;if(this._blockNode(n),this.code(e),t){const e=this.name("e");this._currNode=n.catch=new T(e),t(e)}return r&&(this._currNode=n.finally=new $,this.code(r)),this._endBlockNode(T,$)}throw(e){return this._leafNode(new d(e))}block(e,t){return this._blockStarts.push(this._nodes.length),e&&this.code(e).endBlock(t),this}endBlock(e){const t=this._blockStarts.pop();if(void 0===t)throw new Error("CodeGen: not in self-balancing block");const r=this._nodes.length-t;if(r<0||void 0!==e&&r!==e)throw new Error(`CodeGen: wrong number of nodes: ${r} vs ${e} expected`);return this._nodes.length=t,this}func(e,r=t.nil,n,o){return this._blockNode(new E(e,r,n)),o&&this.code(o).endFunc(),this}endFunc(){return this._endBlockNode(E)}optimize(e=1){for(;e-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e)}_endBlockNode(e,t){const r=this._currNode;if(r instanceof e||t&&r instanceof t)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${t?`${e.kind}/${t.kind}`:e.kind}"`)}_elseNode(e){const t=this._currNode;if(!(t instanceof _))throw new Error('CodeGen: "else" without "if"');return this._currNode=t.else=e,this}get _root(){return this._nodes[0]}get _currNode(){const e=this._nodes;return e[e.length-1]}set _currNode(e){const t=this._nodes;t[t.length-1]=e}},e.not=N;var I=B(e.operators.AND);e.and=function(...e){return e.reduce(I)};var P=B(e.operators.OR);function B(e){return(r,n)=>r===t.nil?n:n===t.nil?r:t._`${D(r)} ${e} ${D(n)}`}function D(e){return e instanceof t.Name?e:t._`(${e})`}e.or=function(...e){return e.reduce(P)}}}),require_util=__commonJS({"node_modules/ajv/dist/compile/util.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.checkStrictMode=e.getErrorPath=e.Type=e.useFunc=e.setEvaluated=e.evaluatedPropsToName=e.mergeEvaluated=e.eachItem=e.unescapeJsonPointer=e.escapeJsonPointer=e.escapeFragment=e.unescapeFragment=e.schemaRefOrVal=e.schemaHasRulesButRef=e.schemaHasRules=e.checkUnknownRules=e.alwaysValidSchema=e.toHash=void 0;var t=require_codegen(),r=require_code();function n(e,t=e.schema){const{opts:r,self:n}=e;if(!r.strictSchema)return;if("boolean"==typeof t)return;const o=n.RULES.keywords;for(const r in t)o[r]||h(e,`unknown keyword: "${r}"`)}function o(e,t){if("boolean"==typeof e)return!e;for(const r in e)if(t[r])return!0;return!1}function i(e){return"number"==typeof e?`${e}`:e.replace(/~/g,"~0").replace(/\//g,"~1")}function s(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function a({mergeNames:e,mergeToName:r,mergeValues:n,resultToName:o}){return(i,s,a,c)=>{const u=void 0===a?s:a instanceof t.Name?(s instanceof t.Name?e(i,s,a):r(i,s,a),a):s instanceof t.Name?(r(i,a,s),s):n(s,a);return c!==t.Name||u instanceof t.Name?u:o(i,u)}}function c(e,r){if(!0===r)return e.var("props",!0);const n=e.var("props",t._`{}`);return void 0!==r&&u(e,n,r),n}function u(e,r,n){Object.keys(n).forEach(n=>e.assign(t._`${r}${(0,t.getProperty)(n)}`,!0))}e.toHash=function(e){const t={};for(const r of e)t[r]=!0;return t},e.alwaysValidSchema=function(e,t){return"boolean"==typeof t?t:0===Object.keys(t).length||(n(e,t),!o(t,e.self.RULES.all))},e.checkUnknownRules=n,e.schemaHasRules=o,e.schemaHasRulesButRef=function(e,t){if("boolean"==typeof e)return!e;for(const r in e)if("$ref"!==r&&t.all[r])return!0;return!1},e.schemaRefOrVal=function({topSchemaRef:e,schemaPath:r},n,o,i){if(!i){if("number"==typeof n||"boolean"==typeof n)return n;if("string"==typeof n)return t._`${n}`}return t._`${e}${r}${(0,t.getProperty)(o)}`},e.unescapeFragment=function(e){return s(decodeURIComponent(e))},e.escapeFragment=function(e){return encodeURIComponent(i(e))},e.escapeJsonPointer=i,e.unescapeJsonPointer=s,e.eachItem=function(e,t){if(Array.isArray(e))for(const r of e)t(r);else t(e)},e.mergeEvaluated={props:a({mergeNames:(e,r,n)=>e.if(t._`${n} !== true && ${r} !== undefined`,()=>{e.if(t._`${r} === true`,()=>e.assign(n,!0),()=>e.assign(n,t._`${n} || {}`).code(t._`Object.assign(${n}, ${r})`))}),mergeToName:(e,r,n)=>e.if(t._`${n} !== true`,()=>{!0===r?e.assign(n,!0):(e.assign(n,t._`${n} || {}`),u(e,n,r))}),mergeValues:(e,t)=>!0===e||{...e,...t},resultToName:c}),items:a({mergeNames:(e,r,n)=>e.if(t._`${n} !== true && ${r} !== undefined`,()=>e.assign(n,t._`${r} === true ? true : ${n} > ${r} ? ${n} : ${r}`)),mergeToName:(e,r,n)=>e.if(t._`${n} !== true`,()=>e.assign(n,!0===r||t._`${n} > ${r} ? ${n} : ${r}`)),mergeValues:(e,t)=>!0===e||Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})},e.evaluatedPropsToName=c,e.setEvaluated=u;var l,d,f={};function h(e,t,r=e.opts.strictSchema){if(r){if(t=`strict mode: ${t}`,!0===r)throw new Error(t);e.self.logger.warn(t)}}e.useFunc=function(e,t){return e.scopeValue("func",{ref:t,code:f[t.code]||(f[t.code]=new r._Code(t.code))})},(d=l=e.Type||(e.Type={}))[d.Num=0]="Num",d[d.Str=1]="Str",e.getErrorPath=function(e,r,n){if(e instanceof t.Name){const o=r===l.Num;return n?o?t._`"[" + ${e} + "]"`:t._`"['" + ${e} + "']"`:o?t._`"/" + ${e}`:t._`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return n?(0,t.getProperty)(e).toString():"/"+i(e)},e.checkStrictMode=h}}),require_names=__commonJS({"node_modules/ajv/dist/compile/names.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var t=require_codegen(),r={data:new t.Name("data"),valCxt:new t.Name("valCxt"),instancePath:new t.Name("instancePath"),parentData:new t.Name("parentData"),parentDataProperty:new t.Name("parentDataProperty"),rootData:new t.Name("rootData"),dynamicAnchors:new t.Name("dynamicAnchors"),vErrors:new t.Name("vErrors"),errors:new t.Name("errors"),this:new t.Name("this"),self:new t.Name("self"),scope:new t.Name("scope"),json:new t.Name("json"),jsonPos:new t.Name("jsonPos"),jsonLen:new t.Name("jsonLen"),jsonPart:new t.Name("jsonPart")};e.default=r}}),require_errors=__commonJS({"node_modules/ajv/dist/compile/errors.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.extendErrors=e.resetErrorsCount=e.reportExtraError=e.reportError=e.keyword$DataError=e.keywordError=void 0;var t=require_codegen(),r=require_util(),n=require_names();function o(e,r){const o=e.const("err",r);e.if(t._`${n.default.vErrors} === null`,()=>e.assign(n.default.vErrors,t._`[${o}]`),t._`${n.default.vErrors}.push(${o})`),e.code(t._`${n.default.errors}++`)}function i(e,r){const{gen:n,validateName:o,schemaEnv:i}=e;i.$async?n.throw(t._`new ${e.ValidationError}(${r})`):(n.assign(t._`${o}.errors`,r),n.return(!1))}e.keywordError={message:({keyword:e})=>t.str`must pass "${e}" keyword validation`},e.keyword$DataError={message:({keyword:e,schemaType:r})=>r?t.str`"${e}" keyword must be ${r} ($data)`:t.str`"${e}" keyword is invalid ($data)`},e.reportError=function(r,n=e.keywordError,s,c){const{it:u}=r,{gen:l,compositeRule:d,allErrors:f}=u,h=a(r,n,s);(null!=c?c:d||f)?o(l,h):i(u,t._`[${h}]`)},e.reportExtraError=function(t,r=e.keywordError,s){const{it:c}=t,{gen:u,compositeRule:l,allErrors:d}=c;o(u,a(t,r,s)),l||d||i(c,n.default.vErrors)},e.resetErrorsCount=function(e,r){e.assign(n.default.errors,r),e.if(t._`${n.default.vErrors} !== null`,()=>e.if(r,()=>e.assign(t._`${n.default.vErrors}.length`,r),()=>e.assign(n.default.vErrors,null)))},e.extendErrors=function({gen:e,keyword:r,schemaValue:o,data:i,errsCount:s,it:a}){if(void 0===s)throw new Error("ajv implementation error");const c=e.name("err");e.forRange("i",s,n.default.errors,s=>{e.const(c,t._`${n.default.vErrors}[${s}]`),e.if(t._`${c}.instancePath === undefined`,()=>e.assign(t._`${c}.instancePath`,(0,t.strConcat)(n.default.instancePath,a.errorPath))),e.assign(t._`${c}.schemaPath`,t.str`${a.errSchemaPath}/${r}`),a.opts.verbose&&(e.assign(t._`${c}.schema`,o),e.assign(t._`${c}.data`,i))})};var s={keyword:new t.Name("keyword"),schemaPath:new t.Name("schemaPath"),params:new t.Name("params"),propertyName:new t.Name("propertyName"),message:new t.Name("message"),schema:new t.Name("schema"),parentSchema:new t.Name("parentSchema")};function a(e,r,o){const{createErrors:i}=e.it;return!1===i?t._`{}`:function(e,r,o={}){const{gen:i,it:a}=e,l=[c(a,o),u(e,o)];return function(e,{params:r,message:o},i){const{keyword:a,data:c,schemaValue:u,it:l}=e,{opts:d,propertyName:f,topSchemaRef:h,schemaPath:p}=l;i.push([s.keyword,a],[s.params,"function"==typeof r?r(e):r||t._`{}`]),d.messages&&i.push([s.message,"function"==typeof o?o(e):o]);d.verbose&&i.push([s.schema,u],[s.parentSchema,t._`${h}${p}`],[n.default.data,c]);f&&i.push([s.propertyName,f])}(e,r,l),i.object(...l)}(e,r,o)}function c({errorPath:e},{instancePath:o}){const i=o?t.str`${e}${(0,r.getErrorPath)(o,r.Type.Str)}`:e;return[n.default.instancePath,(0,t.strConcat)(n.default.instancePath,i)]}function u({keyword:e,it:{errSchemaPath:n}},{schemaPath:o,parentSchema:i}){let a=i?n:t.str`${n}/${e}`;return o&&(a=t.str`${a}${(0,r.getErrorPath)(o,r.Type.Str)}`),[s.schemaPath,a]}}}),require_boolSchema=__commonJS({"node_modules/ajv/dist/compile/validate/boolSchema.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.boolOrEmptySchema=e.topBoolOrEmptySchema=void 0;var t=require_errors(),r=require_codegen(),n=require_names(),o={message:"boolean schema is false"};function i(e,r){const{gen:n,data:i}=e,s={gen:n,keyword:"false schema",data:i,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e};(0,t.reportError)(s,o,void 0,r)}e.topBoolOrEmptySchema=function(e){const{gen:t,schema:o,validateName:s}=e;!1===o?i(e,!1):"object"==typeof o&&!0===o.$async?t.return(n.default.data):(t.assign(r._`${s}.errors`,null),t.return(!0))},e.boolOrEmptySchema=function(e,t){const{gen:r,schema:n}=e;!1===n?(r.var(t,!1),i(e)):r.var(t,!0)}}}),require_rules=__commonJS({"node_modules/ajv/dist/compile/rules.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.getRules=e.isJSONType=void 0;var t=new Set(["string","number","integer","boolean","null","object","array"]);e.isJSONType=function(e){return"string"==typeof e&&t.has(e)},e.getRules=function(){const e={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...e,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},e.number,e.string,e.array,e.object],post:{rules:[]},all:{},keywords:{}}}}}),require_applicability=__commonJS({"node_modules/ajv/dist/compile/validate/applicability.js"(e){"use strict";function t(e,t){return t.rules.some(t=>r(e,t))}function r(e,t){var r;return void 0!==e[t.keyword]||(null===(r=t.definition.implements)||void 0===r?void 0:r.some(t=>void 0!==e[t]))}Object.defineProperty(e,"__esModule",{value:!0}),e.shouldUseRule=e.shouldUseGroup=e.schemaHasRulesForType=void 0,e.schemaHasRulesForType=function({schema:e,self:r},n){const o=r.RULES.types[n];return o&&!0!==o&&t(e,o)},e.shouldUseGroup=t,e.shouldUseRule=r}}),require_dataType=__commonJS({"node_modules/ajv/dist/compile/validate/dataType.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.reportTypeError=e.checkDataTypes=e.checkDataType=e.coerceAndCheckDataType=e.getJSONTypes=e.getSchemaTypes=e.DataType=void 0;var t,r,n=require_rules(),o=require_applicability(),i=require_errors(),s=require_codegen(),a=require_util();function c(e){const t=Array.isArray(e)?e:e?[e]:[];if(t.every(n.isJSONType))return t;throw new Error("type must be JSONType or JSONType[]: "+t.join(","))}(r=t=e.DataType||(e.DataType={}))[r.Correct=0]="Correct",r[r.Wrong=1]="Wrong",e.getSchemaTypes=function(e){const t=c(e.type);if(t.includes("null")){if(!1===e.nullable)throw new Error("type: null contradicts nullable: false")}else{if(!t.length&&void 0!==e.nullable)throw new Error('"nullable" cannot be used without "type"');!0===e.nullable&&t.push("null")}return t},e.getJSONTypes=c,e.coerceAndCheckDataType=function(e,r){const{gen:n,data:i,opts:a}=e,c=function(e,t){return t?e.filter(e=>u.has(e)||"array"===t&&"array"===e):[]}(r,a.coerceTypes),l=r.length>0&&!(0===c.length&&1===r.length&&(0,o.schemaHasRulesForType)(e,r[0]));if(l){const o=d(r,i,a.strictNumbers,t.Wrong);n.if(o,()=>{c.length?function(e,t,r){const{gen:n,data:o,opts:i}=e,a=n.let("dataType",s._`typeof ${o}`),c=n.let("coerced",s._`undefined`);"array"===i.coerceTypes&&n.if(s._`${a} == 'object' && Array.isArray(${o}) && ${o}.length == 1`,()=>n.assign(o,s._`${o}[0]`).assign(a,s._`typeof ${o}`).if(d(t,o,i.strictNumbers),()=>n.assign(c,o)));n.if(s._`${c} !== undefined`);for(const e of r)(u.has(e)||"array"===e&&"array"===i.coerceTypes)&&l(e);function l(e){switch(e){case"string":return void n.elseIf(s._`${a} == "number" || ${a} == "boolean"`).assign(c,s._`"" + ${o}`).elseIf(s._`${o} === null`).assign(c,s._`""`);case"number":return void n.elseIf(s._`${a} == "boolean" || ${o} === null
              || (${a} == "string" && ${o} && ${o} == +${o})`).assign(c,s._`+${o}`);case"integer":return void n.elseIf(s._`${a} === "boolean" || ${o} === null
              || (${a} === "string" && ${o} && ${o} == +${o} && !(${o} % 1))`).assign(c,s._`+${o}`);case"boolean":return void n.elseIf(s._`${o} === "false" || ${o} === 0 || ${o} === null`).assign(c,!1).elseIf(s._`${o} === "true" || ${o} === 1`).assign(c,!0);case"null":return n.elseIf(s._`${o} === "" || ${o} === 0 || ${o} === false`),void n.assign(c,null);case"array":n.elseIf(s._`${a} === "string" || ${a} === "number"
              || ${a} === "boolean" || ${o} === null`).assign(c,s._`[${o}]`)}}n.else(),h(e),n.endIf(),n.if(s._`${c} !== undefined`,()=>{n.assign(o,c),function({gen:e,parentData:t,parentDataProperty:r},n){e.if(s._`${t} !== undefined`,()=>e.assign(s._`${t}[${r}]`,n))}(e,c)})}(e,r,c):h(e)})}return l};var u=new Set(["string","number","integer","boolean","null"]);function l(e,r,n,o=t.Correct){const i=o===t.Correct?s.operators.EQ:s.operators.NEQ;let a;switch(e){case"null":return s._`${r} ${i} null`;case"array":a=s._`Array.isArray(${r})`;break;case"object":a=s._`${r} && typeof ${r} == "object" && !Array.isArray(${r})`;break;case"integer":a=c(s._`!(${r} % 1) && !isNaN(${r})`);break;case"number":a=c();break;default:return s._`typeof ${r} ${i} ${e}`}return o===t.Correct?a:(0,s.not)(a);function c(e=s.nil){return(0,s.and)(s._`typeof ${r} == "number"`,e,n?s._`isFinite(${r})`:s.nil)}}function d(e,t,r,n){if(1===e.length)return l(e[0],t,r,n);let o;const i=(0,a.toHash)(e);if(i.array&&i.object){const e=s._`typeof ${t} != "object"`;o=i.null?e:s._`!${t} || ${e}`,delete i.null,delete i.array,delete i.object}else o=s.nil;i.number&&delete i.integer;for(const e in i)o=(0,s.and)(o,l(e,t,r,n));return o}e.checkDataType=l,e.checkDataTypes=d;var f={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>"string"==typeof e?s._`{type: ${e}}`:s._`{type: ${t}}`};function h(e){const t=function(e){const{gen:t,data:r,schema:n}=e,o=(0,a.schemaRefOrVal)(e,n,"type");return{gen:t,keyword:"type",data:r,schema:n.type,schemaCode:o,schemaValue:o,parentSchema:n,params:{},it:e}}(e);(0,i.reportError)(t,f)}e.reportTypeError=h}}),require_defaults=__commonJS({"node_modules/ajv/dist/compile/validate/defaults.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.assignDefaults=void 0;var t=require_codegen(),r=require_util();function n(e,n,o){const{gen:i,compositeRule:s,data:a,opts:c}=e;if(void 0===o)return;const u=t._`${a}${(0,t.getProperty)(n)}`;if(s)return void(0,r.checkStrictMode)(e,`default is ignored for: ${u}`);let l=t._`${u} === undefined`;"empty"===c.useDefaults&&(l=t._`${l} || ${u} === null || ${u} === ""`),i.if(l,t._`${u} = ${(0,t.stringify)(o)}`)}e.assignDefaults=function(e,t){const{properties:r,items:o}=e.schema;if("object"===t&&r)for(const t in r)n(e,t,r[t].default);else"array"===t&&Array.isArray(o)&&o.forEach((t,r)=>n(e,r,t.default))}}}),require_code2=__commonJS({"node_modules/ajv/dist/vocabularies/code.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.validateUnion=e.validateArray=e.usePattern=e.callValidateCode=e.schemaProperties=e.allSchemaProperties=e.noPropertyInData=e.propertyInData=e.isOwnProperty=e.hasPropFunc=e.reportMissingProp=e.checkMissingProp=e.checkReportMissingProp=void 0;var t=require_codegen(),r=require_util(),n=require_names(),o=require_util();function i(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:t._`Object.prototype.hasOwnProperty`})}function s(e,r,n){return t._`${i(e)}.call(${r}, ${n})`}function a(e,r,n,o){const i=t._`${r}${(0,t.getProperty)(n)} === undefined`;return o?(0,t.or)(i,(0,t.not)(s(e,r,n))):i}function c(e){return e?Object.keys(e).filter(e=>"__proto__"!==e):[]}e.checkReportMissingProp=function(e,r){const{gen:n,data:o,it:i}=e;n.if(a(n,o,r,i.opts.ownProperties),()=>{e.setParams({missingProperty:t._`${r}`},!0),e.error()})},e.checkMissingProp=function({gen:e,data:r,it:{opts:n}},o,i){return(0,t.or)(...o.map(o=>(0,t.and)(a(e,r,o,n.ownProperties),t._`${i} = ${o}`)))},e.reportMissingProp=function(e,t){e.setParams({missingProperty:t},!0),e.error()},e.hasPropFunc=i,e.isOwnProperty=s,e.propertyInData=function(e,r,n,o){const i=t._`${r}${(0,t.getProperty)(n)} !== undefined`;return o?t._`${i} && ${s(e,r,n)}`:i},e.noPropertyInData=a,e.allSchemaProperties=c,e.schemaProperties=function(e,t){return c(t).filter(n=>!(0,r.alwaysValidSchema)(e,t[n]))},e.callValidateCode=function({schemaCode:e,data:r,it:{gen:o,topSchemaRef:i,schemaPath:s,errorPath:a},it:c},u,l,d){const f=d?t._`${e}, ${r}, ${i}${s}`:r,h=[[n.default.instancePath,(0,t.strConcat)(n.default.instancePath,a)],[n.default.parentData,c.parentData],[n.default.parentDataProperty,c.parentDataProperty],[n.default.rootData,n.default.rootData]];c.opts.dynamicRef&&h.push([n.default.dynamicAnchors,n.default.dynamicAnchors]);const p=t._`${f}, ${o.object(...h)}`;return l!==t.nil?t._`${u}.call(${l}, ${p})`:t._`${u}(${p})`};var u=t._`new RegExp`;e.usePattern=function({gen:e,it:{opts:r}},n){const i=r.unicodeRegExp?"u":"",{regExp:s}=r.code,a=s(n,i);return e.scopeValue("pattern",{key:a.toString(),ref:a,code:t._`${"new RegExp"===s.code?u:(0,o.useFunc)(e,s)}(${n}, ${i})`})},e.validateArray=function(e){const{gen:n,data:o,keyword:i,it:s}=e,a=n.name("valid");if(s.allErrors){const e=n.let("valid",!0);return c(()=>n.assign(e,!1)),e}return n.var(a,!0),c(()=>n.break()),a;function c(s){const c=n.const("len",t._`${o}.length`);n.forRange("i",0,c,o=>{e.subschema({keyword:i,dataProp:o,dataPropType:r.Type.Num},a),n.if((0,t.not)(a),s)})}},e.validateUnion=function(e){const{gen:n,schema:o,keyword:i,it:s}=e;if(!Array.isArray(o))throw new Error("ajv implementation error");if(o.some(e=>(0,r.alwaysValidSchema)(s,e))&&!s.opts.unevaluated)return;const a=n.let("valid",!1),c=n.name("_valid");n.block(()=>o.forEach((r,o)=>{const s=e.subschema({keyword:i,schemaProp:o,compositeRule:!0},c);n.assign(a,t._`${a} || ${c}`);e.mergeValidEvaluated(s,c)||n.if((0,t.not)(a))})),e.result(a,()=>e.reset(),()=>e.error(!0))}}}),require_keyword=__commonJS({"node_modules/ajv/dist/compile/validate/keyword.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.validateKeywordUsage=e.validSchemaType=e.funcKeywordCode=e.macroKeywordCode=void 0;var t=require_codegen(),r=require_names(),n=require_code2(),o=require_errors();function i(e){const{gen:r,data:n,it:o}=e;r.if(o.parentData,()=>r.assign(n,t._`${o.parentData}[${o.parentDataProperty}]`))}function s(e,r,n){if(void 0===n)throw new Error(`keyword "${r}" failed to compile`);return e.scopeValue("keyword","function"==typeof n?{ref:n}:{ref:n,code:(0,t.stringify)(n)})}e.macroKeywordCode=function(e,r){const{gen:n,keyword:o,schema:i,parentSchema:a,it:c}=e,u=r.macro.call(c.self,i,a,c),l=s(n,o,u);!1!==c.opts.validateSchema&&c.self.validateSchema(u,!0);const d=n.name("valid");e.subschema({schema:u,schemaPath:t.nil,errSchemaPath:`${c.errSchemaPath}/${o}`,topSchemaRef:l,compositeRule:!0},d),e.pass(d,()=>e.error(!0))},e.funcKeywordCode=function(e,a){var c;const{gen:u,keyword:l,schema:d,parentSchema:f,$data:h,it:p}=e;!function({schemaEnv:e},t){if(t.async&&!e.$async)throw new Error("async keyword in sync schema")}(p,a);const m=!h&&a.compile?a.compile.call(p.self,d,f,p):a.validate,y=s(u,l,m),_=u.let("valid");function g(o=(a.async?t._`await `:t.nil)){const i=p.opts.passContext?r.default.this:r.default.self,s=!("compile"in a&&!h||!1===a.schema);u.assign(_,t._`${o}${(0,n.callValidateCode)(e,y,i,s)}`,a.modifying)}function b(e){var r;u.if((0,t.not)(null!==(r=a.valid)&&void 0!==r?r:_),e)}e.block$data(_,function(){if(!1===a.errors)g(),a.modifying&&i(e),b(()=>e.error());else{const n=a.async?function(){const e=u.let("ruleErrs",null);return u.try(()=>g(t._`await `),r=>u.assign(_,!1).if(t._`${r} instanceof ${p.ValidationError}`,()=>u.assign(e,t._`${r}.errors`),()=>u.throw(r))),e}():function(){const e=t._`${y}.errors`;return u.assign(e,null),g(t.nil),e}();a.modifying&&i(e),b(()=>function(e,n){const{gen:i}=e;i.if(t._`Array.isArray(${n})`,()=>{i.assign(r.default.vErrors,t._`${r.default.vErrors} === null ? ${n} : ${r.default.vErrors}.concat(${n})`).assign(r.default.errors,t._`${r.default.vErrors}.length`),(0,o.extendErrors)(e)},()=>e.error())}(e,n))}}),e.ok(null!==(c=a.valid)&&void 0!==c?c:_)},e.validSchemaType=function(e,t,r=!1){return!t.length||t.some(t=>"array"===t?Array.isArray(e):"object"===t?e&&"object"==typeof e&&!Array.isArray(e):typeof e==t||r&&void 0===e)},e.validateKeywordUsage=function({schema:e,opts:t,self:r,errSchemaPath:n},o,i){if(Array.isArray(o.keyword)?!o.keyword.includes(i):o.keyword!==i)throw new Error("ajv implementation error");const s=o.dependencies;if(null==s?void 0:s.some(t=>!Object.prototype.hasOwnProperty.call(e,t)))throw new Error(`parent schema must have dependencies of ${i}: ${s.join(",")}`);if(o.validateSchema){if(!o.validateSchema(e[i])){const e=`keyword "${i}" value is invalid at path "${n}": `+r.errorsText(o.validateSchema.errors);if("log"!==t.validateSchema)throw new Error(e);r.logger.error(e)}}}}}),require_subschema=__commonJS({"node_modules/ajv/dist/compile/validate/subschema.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.extendSubschemaMode=e.extendSubschemaData=e.getSubschema=void 0;var t=require_codegen(),r=require_util();e.getSubschema=function(e,{keyword:n,schemaProp:o,schema:i,schemaPath:s,errSchemaPath:a,topSchemaRef:c}){if(void 0!==n&&void 0!==i)throw new Error('both "keyword" and "schema" passed, only one allowed');if(void 0!==n){const i=e.schema[n];return void 0===o?{schema:i,schemaPath:t._`${e.schemaPath}${(0,t.getProperty)(n)}`,errSchemaPath:`${e.errSchemaPath}/${n}`}:{schema:i[o],schemaPath:t._`${e.schemaPath}${(0,t.getProperty)(n)}${(0,t.getProperty)(o)}`,errSchemaPath:`${e.errSchemaPath}/${n}/${(0,r.escapeFragment)(o)}`}}if(void 0!==i){if(void 0===s||void 0===a||void 0===c)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:i,schemaPath:s,topSchemaRef:c,errSchemaPath:a}}throw new Error('either "keyword" or "schema" must be passed')},e.extendSubschemaData=function(e,n,{dataProp:o,dataPropType:i,data:s,dataTypes:a,propertyName:c}){if(void 0!==s&&void 0!==o)throw new Error('both "data" and "dataProp" passed, only one allowed');const{gen:u}=n;if(void 0!==o){const{errorPath:s,dataPathArr:a,opts:c}=n;l(u.let("data",t._`${n.data}${(0,t.getProperty)(o)}`,!0)),e.errorPath=t.str`${s}${(0,r.getErrorPath)(o,i,c.jsPropertySyntax)}`,e.parentDataProperty=t._`${o}`,e.dataPathArr=[...a,e.parentDataProperty]}if(void 0!==s){l(s instanceof t.Name?s:u.let("data",s,!0)),void 0!==c&&(e.propertyName=c)}function l(t){e.data=t,e.dataLevel=n.dataLevel+1,e.dataTypes=[],n.definedProperties=new Set,e.parentData=n.data,e.dataNames=[...n.dataNames,t]}a&&(e.dataTypes=a)},e.extendSubschemaMode=function(e,{jtdDiscriminator:t,jtdMetadata:r,compositeRule:n,createErrors:o,allErrors:i}){void 0!==n&&(e.compositeRule=n),void 0!==o&&(e.createErrors=o),void 0!==i&&(e.allErrors=i),e.jtdDiscriminator=t,e.jtdMetadata=r}}}),require_fast_deep_equal=__commonJS({"node_modules/fast-deep-equal/index.js"(e,t){"use strict";t.exports=function e(t,r){if(t===r)return!0;if(t&&r&&"object"==typeof t&&"object"==typeof r){if(t.constructor!==r.constructor)return!1;var n,o,i;if(Array.isArray(t)){if((n=t.length)!=r.length)return!1;for(o=n;0!==o--;)if(!e(t[o],r[o]))return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if((n=(i=Object.keys(t)).length)!==Object.keys(r).length)return!1;for(o=n;0!==o--;)if(!Object.prototype.hasOwnProperty.call(r,i[o]))return!1;for(o=n;0!==o--;){var s=i[o];if(!e(t[s],r[s]))return!1}return!0}return t!=t&&r!=r}}}),require_json_schema_traverse=__commonJS({"node_modules/json-schema-traverse/index.js"(e,t){"use strict";var r=t.exports=function(e,t,r){"function"==typeof t&&(r=t,t={}),n(t,"function"==typeof(r=t.cb||r)?r:r.pre||function(){},r.post||function(){},e,"",e)};function n(e,t,i,s,a,c,u,l,d,f){if(s&&"object"==typeof s&&!Array.isArray(s)){for(var h in t(s,a,c,u,l,d,f),s){var p=s[h];if(Array.isArray(p)){if(h in r.arrayKeywords)for(var m=0;m<p.length;m++)n(e,t,i,p[m],a+"/"+h+"/"+m,c,a,h,s,m)}else if(h in r.propsKeywords){if(p&&"object"==typeof p)for(var y in p)n(e,t,i,p[y],a+"/"+h+"/"+o(y),c,a,h,s,y)}else(h in r.keywords||e.allKeys&&!(h in r.skipKeywords))&&n(e,t,i,p,a+"/"+h,c,a,h,s)}i(s,a,c,u,l,d,f)}}function o(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}r.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0},r.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0},r.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0},r.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0}}}),require_resolve=__commonJS({"node_modules/ajv/dist/compile/resolve.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.getSchemaRefs=e.resolveUrl=e.normalizeId=e._getFullPath=e.getFullPath=e.inlineRef=void 0;var t=require_util(),r=require_fast_deep_equal(),n=require_json_schema_traverse(),o=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);e.inlineRef=function(e,t=!0){return"boolean"==typeof e||(!0===t?!s(e):!!t&&a(e)<=t)};var i=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function s(e){for(const t in e){if(i.has(t))return!0;const r=e[t];if(Array.isArray(r)&&r.some(s))return!0;if("object"==typeof r&&s(r))return!0}return!1}function a(e){let r=0;for(const n in e){if("$ref"===n)return 1/0;if(r++,!o.has(n)&&("object"==typeof e[n]&&(0,t.eachItem)(e[n],e=>r+=a(e)),r===1/0))return 1/0}return r}function c(e,t="",r){!1!==r&&(t=d(t));const n=e.parse(t);return u(e,n)}function u(e,t){return e.serialize(t).split("#")[0]+"#"}e.getFullPath=c,e._getFullPath=u;var l=/#\/?$/;function d(e){return e?e.replace(l,""):""}e.normalizeId=d,e.resolveUrl=function(e,t,r){return r=d(r),e.resolve(t,r)};var f=/^[a-z_][-a-z0-9._]*$/i;e.getSchemaRefs=function(e,t){if("boolean"==typeof e)return{};const{schemaId:o,uriResolver:i}=this.opts,s=d(e[o]||t),a={"":s},u=c(i,s,!1),l={},h=new Set;return n(e,{allKeys:!0},(e,t,r,n)=>{if(void 0===n)return;const i=u+t;let s=a[n];function c(t){const r=this.opts.uriResolver.resolve;if(t=d(s?r(s,t):t),h.has(t))throw m(t);h.add(t);let n=this.refs[t];return"string"==typeof n&&(n=this.refs[n]),"object"==typeof n?p(e,n.schema,t):t!==d(i)&&("#"===t[0]?(p(e,l[t],t),l[t]=e):this.refs[t]=i),t}function y(e){if("string"==typeof e){if(!f.test(e))throw new Error(`invalid anchor "${e}"`);c.call(this,`#${e}`)}}"string"==typeof e[o]&&(s=c.call(this,e[o])),y.call(this,e.$anchor),y.call(this,e.$dynamicAnchor),a[t]=s}),l;function p(e,t,n){if(void 0!==t&&!r(e,t))throw m(n)}function m(e){return new Error(`reference "${e}" resolves to more than one schema`)}}}}),require_validate=__commonJS({"node_modules/ajv/dist/compile/validate/index.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.getData=e.KeywordCxt=e.validateFunctionCode=void 0;var t=require_boolSchema(),r=require_dataType(),n=require_applicability(),o=require_dataType(),i=require_defaults(),s=require_keyword(),a=require_subschema(),c=require_codegen(),u=require_names(),l=require_resolve(),d=require_util(),f=require_errors();function h({gen:e,validateName:t,schema:r,schemaEnv:n,opts:o},i){o.code.es5?e.func(t,c._`${u.default.data}, ${u.default.valCxt}`,n.$async,()=>{e.code(c._`"use strict"; ${p(r,o)}`),function(e,t){e.if(u.default.valCxt,()=>{e.var(u.default.instancePath,c._`${u.default.valCxt}.${u.default.instancePath}`),e.var(u.default.parentData,c._`${u.default.valCxt}.${u.default.parentData}`),e.var(u.default.parentDataProperty,c._`${u.default.valCxt}.${u.default.parentDataProperty}`),e.var(u.default.rootData,c._`${u.default.valCxt}.${u.default.rootData}`),t.dynamicRef&&e.var(u.default.dynamicAnchors,c._`${u.default.valCxt}.${u.default.dynamicAnchors}`)},()=>{e.var(u.default.instancePath,c._`""`),e.var(u.default.parentData,c._`undefined`),e.var(u.default.parentDataProperty,c._`undefined`),e.var(u.default.rootData,u.default.data),t.dynamicRef&&e.var(u.default.dynamicAnchors,c._`{}`)})}(e,o),e.code(i)}):e.func(t,c._`${u.default.data}, ${function(e){return c._`{${u.default.instancePath}="", ${u.default.parentData}, ${u.default.parentDataProperty}, ${u.default.rootData}=${u.default.data}${e.dynamicRef?c._`, ${u.default.dynamicAnchors}={}`:c.nil}}={}`}(o)}`,n.$async,()=>e.code(p(r,o)).code(i))}function p(e,t){const r="object"==typeof e&&e[t.schemaId];return r&&(t.code.source||t.code.process)?c._`/*# sourceURL=${r} */`:c.nil}function m(e,r){_(e)&&(g(e),y(e))?function(e,t){const{schema:r,gen:n,opts:o}=e;o.$comment&&r.$comment&&w(e);(function(e){const t=e.schema[e.opts.schemaId];t&&(e.baseId=(0,l.resolveUrl)(e.opts.uriResolver,e.baseId,t))})(e),function(e){if(e.schema.$async&&!e.schemaEnv.$async)throw new Error("async schema in sync schema")}(e);const i=n.const("_errs",u.default.errors);b(e,i),n.var(t,c._`${i} === ${u.default.errors}`)}(e,r):(0,t.boolOrEmptySchema)(e,r)}function y({schema:e,self:t}){if("boolean"==typeof e)return!e;for(const r in e)if(t.RULES.all[r])return!0;return!1}function _(e){return"boolean"!=typeof e.schema}function g(e){(0,d.checkUnknownRules)(e),function(e){const{schema:t,errSchemaPath:r,opts:n,self:o}=e;t.$ref&&n.ignoreKeywordsWithRef&&(0,d.schemaHasRulesButRef)(t,o.RULES)&&o.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}(e)}function b(e,t){if(e.opts.jtd)return v(e,[],!1,t);const n=(0,r.getSchemaTypes)(e.schema);v(e,n,!(0,r.coerceAndCheckDataType)(e,n),t)}function w({gen:e,schemaEnv:t,schema:r,errSchemaPath:n,opts:o}){const i=r.$comment;if(!0===o.$comment)e.code(c._`${u.default.self}.logger.log(${i})`);else if("function"==typeof o.$comment){const r=c.str`${n}/$comment`,o=e.scopeValue("root",{ref:t.root});e.code(c._`${u.default.self}.opts.$comment(${i}, ${r}, ${o}.schema)`)}}function v(e,t,r,i){const{gen:s,schema:a,data:l,allErrors:f,opts:h,self:p}=e,{RULES:m}=p;function y(d){(0,n.shouldUseGroup)(a,d)&&(d.type?(s.if((0,o.checkDataType)(d.type,l,h.strictNumbers)),E(e,d),1===t.length&&t[0]===d.type&&r&&(s.else(),(0,o.reportTypeError)(e)),s.endIf()):E(e,d),f||s.if(c._`${u.default.errors} === ${i||0}`))}!a.$ref||!h.ignoreKeywordsWithRef&&(0,d.schemaHasRulesButRef)(a,m)?(h.jtd||function(e,t){if(e.schemaEnv.meta||!e.opts.strictTypes)return;(function(e,t){if(!t.length)return;if(!e.dataTypes.length)return void(e.dataTypes=t);t.forEach(t=>{k(e.dataTypes,t)||T(e,`type "${t}" not allowed by context "${e.dataTypes.join(",")}"`)}),e.dataTypes=e.dataTypes.filter(e=>k(t,e))})(e,t),e.opts.allowUnionTypes||function(e,t){t.length>1&&(2!==t.length||!t.includes("null"))&&T(e,"use allowUnionTypes to allow union type keyword")}(e,t);!function(e,t){const r=e.self.RULES.all;for(const o in r){const i=r[o];if("object"==typeof i&&(0,n.shouldUseRule)(e.schema,i)){const{type:r}=i.definition;r.length&&!r.some(e=>S(t,e))&&T(e,`missing type "${r.join(",")}" for keyword "${o}"`)}}}(e,e.dataTypes)}(e,t),s.block(()=>{for(const e of m.rules)y(e);y(m.post)})):s.block(()=>x(e,"$ref",m.all.$ref.definition))}function E(e,t){const{gen:r,schema:o,opts:{useDefaults:s}}=e;s&&(0,i.assignDefaults)(e,t.type),r.block(()=>{for(const r of t.rules)(0,n.shouldUseRule)(o,r)&&x(e,r.keyword,r.definition,t.type)})}function S(e,t){return e.includes(t)||"number"===t&&e.includes("integer")}function k(e,t){return e.includes(t)||"integer"===t&&e.includes("number")}function T(e,t){t+=` at "${e.schemaEnv.baseId+e.errSchemaPath}" (strictTypes)`,(0,d.checkStrictMode)(e,t,e.opts.strictTypes)}e.validateFunctionCode=function(e){_(e)&&(g(e),y(e))?function(e){const{schema:t,opts:r,gen:n}=e;h(e,()=>{r.$comment&&t.$comment&&w(e),function(e){const{schema:t,opts:r}=e;void 0!==t.default&&r.useDefaults&&r.strictSchema&&(0,d.checkStrictMode)(e,"default is ignored in the schema root")}(e),n.let(u.default.vErrors,null),n.let(u.default.errors,0),r.unevaluated&&function(e){const{gen:t,validateName:r}=e;e.evaluated=t.const("evaluated",c._`${r}.evaluated`),t.if(c._`${e.evaluated}.dynamicProps`,()=>t.assign(c._`${e.evaluated}.props`,c._`undefined`)),t.if(c._`${e.evaluated}.dynamicItems`,()=>t.assign(c._`${e.evaluated}.items`,c._`undefined`))}(e),b(e),function(e){const{gen:t,schemaEnv:r,validateName:n,ValidationError:o,opts:i}=e;r.$async?t.if(c._`${u.default.errors} === 0`,()=>t.return(u.default.data),()=>t.throw(c._`new ${o}(${u.default.vErrors})`)):(t.assign(c._`${n}.errors`,u.default.vErrors),i.unevaluated&&function({gen:e,evaluated:t,props:r,items:n}){r instanceof c.Name&&e.assign(c._`${t}.props`,r);n instanceof c.Name&&e.assign(c._`${t}.items`,n)}(e),t.return(c._`${u.default.errors} === 0`))}(e)})}(e):h(e,()=>(0,t.topBoolOrEmptySchema)(e))};var $=class{constructor(e,t,r){if((0,s.validateKeywordUsage)(e,t,r),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=r,this.data=e.data,this.schema=e.schema[r],this.$data=t.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,d.schemaRefOrVal)(e,this.schema,r,this.$data),this.schemaType=t.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=t,this.$data)this.schemaCode=e.gen.const("vSchema",C(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,s.validSchemaType)(this.schema,t.schemaType,t.allowUndefined))throw new Error(`${r} value must be ${JSON.stringify(t.schemaType)}`);("code"in t?t.trackErrors:!1!==t.errors)&&(this.errsCount=e.gen.const("_errs",u.default.errors))}result(e,t,r){this.failResult((0,c.not)(e),t,r)}failResult(e,t,r){this.gen.if(e),r?r():this.error(),t?(this.gen.else(),t(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(e,t){this.failResult((0,c.not)(e),void 0,t)}fail(e){if(void 0===e)return this.error(),void(this.allErrors||this.gen.if(!1));this.gen.if(e),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(e){if(!this.$data)return this.fail(e);const{schemaCode:t}=this;this.fail(c._`${t} !== undefined && (${(0,c.or)(this.invalid$data(),e)})`)}error(e,t,r){if(t)return this.setParams(t),this._error(e,r),void this.setParams({});this._error(e,r)}_error(e,t){(e?f.reportExtraError:f.reportError)(this,this.def.error,t)}$dataError(){(0,f.reportError)(this,this.def.$dataError||f.keyword$DataError)}reset(){if(void 0===this.errsCount)throw new Error('add "trackErrors" to keyword definition');(0,f.resetErrorsCount)(this.gen,this.errsCount)}ok(e){this.allErrors||this.gen.if(e)}setParams(e,t){t?Object.assign(this.params,e):this.params=e}block$data(e,t,r=c.nil){this.gen.block(()=>{this.check$data(e,r),t()})}check$data(e=c.nil,t=c.nil){if(!this.$data)return;const{gen:r,schemaCode:n,schemaType:o,def:i}=this;r.if((0,c.or)(c._`${n} === undefined`,t)),e!==c.nil&&r.assign(e,!0),(o.length||i.validateSchema)&&(r.elseIf(this.invalid$data()),this.$dataError(),e!==c.nil&&r.assign(e,!1)),r.else()}invalid$data(){const{gen:e,schemaCode:t,schemaType:r,def:n,it:i}=this;return(0,c.or)(function(){if(r.length){if(!(t instanceof c.Name))throw new Error("ajv implementation error");const e=Array.isArray(r)?r:[r];return c._`${(0,o.checkDataTypes)(e,t,i.opts.strictNumbers,o.DataType.Wrong)}`}return c.nil}(),function(){if(n.validateSchema){const r=e.scopeValue("validate$data",{ref:n.validateSchema});return c._`!${r}(${t})`}return c.nil}())}subschema(e,t){const r=(0,a.getSubschema)(this.it,e);(0,a.extendSubschemaData)(r,this.it,e),(0,a.extendSubschemaMode)(r,e);const n={...this.it,...r,items:void 0,props:void 0};return m(n,t),n}mergeEvaluated(e,t){const{it:r,gen:n}=this;r.opts.unevaluated&&(!0!==r.props&&void 0!==e.props&&(r.props=d.mergeEvaluated.props(n,e.props,r.props,t)),!0!==r.items&&void 0!==e.items&&(r.items=d.mergeEvaluated.items(n,e.items,r.items,t)))}mergeValidEvaluated(e,t){const{it:r,gen:n}=this;if(r.opts.unevaluated&&(!0!==r.props||!0!==r.items))return n.if(t,()=>this.mergeEvaluated(e,c.Name)),!0}};function x(e,t,r,n){const o=new $(e,r,t);"code"in r?r.code(o,n):o.$data&&r.validate?(0,s.funcKeywordCode)(o,r):"macro"in r?(0,s.macroKeywordCode)(o,r):(r.compile||r.validate)&&(0,s.funcKeywordCode)(o,r)}e.KeywordCxt=$;var A=/^\/(?:[^~]|~0|~1)*$/,j=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function C(e,{dataLevel:t,dataNames:r,dataPathArr:n}){let o,i;if(""===e)return u.default.rootData;if("/"===e[0]){if(!A.test(e))throw new Error(`Invalid JSON-pointer: ${e}`);o=e,i=u.default.rootData}else{const s=j.exec(e);if(!s)throw new Error(`Invalid JSON-pointer: ${e}`);const a=+s[1];if(o=s[2],"#"===o){if(a>=t)throw new Error(l("property/index",a));return n[t-a]}if(a>t)throw new Error(l("data",a));if(i=r[t-a],!o)return i}let s=i;const a=o.split("/");for(const e of a)e&&(i=c._`${i}${(0,c.getProperty)((0,d.unescapeJsonPointer)(e))}`,s=c._`${s} && ${i}`);return s;function l(e,r){return`Cannot access ${e} ${r} levels up, current level is ${t}`}}e.getData=C}}),require_validation_error=__commonJS({"node_modules/ajv/dist/runtime/validation_error.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var t=class extends Error{constructor(e){super("validation failed"),this.errors=e,this.ajv=this.validation=!0}};e.default=t}}),require_ref_error=__commonJS({"node_modules/ajv/dist/compile/ref_error.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var t=require_resolve(),r=class extends Error{constructor(e,r,n,o){super(o||`can't resolve reference ${n} from id ${r}`),this.missingRef=(0,t.resolveUrl)(e,r,n),this.missingSchema=(0,t.normalizeId)((0,t.getFullPath)(e,this.missingRef))}};e.default=r}}),require_compile=__commonJS({"node_modules/ajv/dist/compile/index.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.resolveSchema=e.getCompilingSchema=e.resolveRef=e.compileSchema=e.SchemaEnv=void 0;var t=require_codegen(),r=require_validation_error(),n=require_names(),o=require_resolve(),i=require_util(),s=require_validate(),a=class{constructor(e){var t;let r;this.refs={},this.dynamicAnchors={},"object"==typeof e.schema&&(r=e.schema),this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=null!==(t=e.baseId)&&void 0!==t?t:(0,o.normalizeId)(null==r?void 0:r[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=null==r?void 0:r.$async,this.refs={}}};function c(e){const i=l.call(this,e);if(i)return i;const a=(0,o.getFullPath)(this.opts.uriResolver,e.root.baseId),{es5:c,lines:u}=this.opts.code,{ownProperties:d}=this.opts,f=new t.CodeGen(this.scope,{es5:c,lines:u,ownProperties:d});let h;e.$async&&(h=f.scopeValue("Error",{ref:r.default,code:t._`require("ajv/dist/runtime/validation_error").default`}));const p=f.scopeName("validate");e.validateName=p;const m={gen:f,allErrors:this.opts.allErrors,data:n.default.data,parentData:n.default.parentData,parentDataProperty:n.default.parentDataProperty,dataNames:[n.default.data],dataPathArr:[t.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:f.scopeValue("schema",!0===this.opts.code.source?{ref:e.schema,code:(0,t.stringify)(e.schema)}:{ref:e.schema}),validateName:p,ValidationError:h,schema:e.schema,schemaEnv:e,rootId:a,baseId:e.baseId||a,schemaPath:t.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:t._`""`,opts:this.opts,self:this};let y;try{this._compilations.add(e),(0,s.validateFunctionCode)(m),f.optimize(this.opts.code.optimize);const r=f.toString();y=`${f.scopeRefs(n.default.scope)}return ${r}`,this.opts.code.process&&(y=this.opts.code.process(y,e));const o=new Function(`${n.default.self}`,`${n.default.scope}`,y)(this,this.scope.get());if(this.scope.value(p,{ref:o}),o.errors=null,o.schema=e.schema,o.schemaEnv=e,e.$async&&(o.$async=!0),!0===this.opts.code.source&&(o.source={validateName:p,validateCode:r,scopeValues:f._values}),this.opts.unevaluated){const{props:e,items:r}=m;o.evaluated={props:e instanceof t.Name?void 0:e,items:r instanceof t.Name?void 0:r,dynamicProps:e instanceof t.Name,dynamicItems:r instanceof t.Name},o.source&&(o.source.evaluated=(0,t.stringify)(o.evaluated))}return e.validate=o,e}catch(t){throw delete e.validate,delete e.validateName,y&&this.logger.error("Error compiling schema, function code:",y),t}finally{this._compilations.delete(e)}}function u(e){return(0,o.inlineRef)(e.schema,this.opts.inlineRefs)?e.schema:e.validate?e:c.call(this,e)}function l(e){for(const t of this._compilations)if(d(t,e))return t}function d(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function f(e,t){let r;for(;"string"==typeof(r=this.refs[t]);)t=r;return r||this.schemas[t]||h.call(this,e,t)}function h(e,t){const r=this.opts.uriResolver.parse(t),n=(0,o._getFullPath)(this.opts.uriResolver,r);let i=(0,o.getFullPath)(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&n===i)return m.call(this,r,e);const s=(0,o.normalizeId)(n),u=this.refs[s]||this.schemas[s];if("string"==typeof u){const t=h.call(this,e,u);if("object"!=typeof(null==t?void 0:t.schema))return;return m.call(this,r,t)}if("object"==typeof(null==u?void 0:u.schema)){if(u.validate||c.call(this,u),s===(0,o.normalizeId)(t)){const{schema:t}=u,{schemaId:r}=this.opts,n=t[r];return n&&(i=(0,o.resolveUrl)(this.opts.uriResolver,i,n)),new a({schema:t,schemaId:r,root:e,baseId:i})}return m.call(this,r,u)}}e.SchemaEnv=a,e.compileSchema=c,e.resolveRef=function(e,t,r){var n;r=(0,o.resolveUrl)(this.opts.uriResolver,t,r);const i=e.refs[r];if(i)return i;let s=f.call(this,e,r);if(void 0===s){const o=null===(n=e.localRefs)||void 0===n?void 0:n[r],{schemaId:i}=this.opts;o&&(s=new a({schema:o,schemaId:i,root:e,baseId:t}))}return void 0!==s?e.refs[r]=u.call(this,s):void 0},e.getCompilingSchema=l,e.resolveSchema=h;var p=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function m(e,{baseId:t,schema:r,root:n}){var s;if("/"!==(null===(s=e.fragment)||void 0===s?void 0:s[0]))return;for(const n of e.fragment.slice(1).split("/")){if("boolean"==typeof r)return;const e=r[(0,i.unescapeFragment)(n)];if(void 0===e)return;const s="object"==typeof(r=e)&&r[this.opts.schemaId];!p.has(n)&&s&&(t=(0,o.resolveUrl)(this.opts.uriResolver,t,s))}let c;if("boolean"!=typeof r&&r.$ref&&!(0,i.schemaHasRulesButRef)(r,this.RULES)){const e=(0,o.resolveUrl)(this.opts.uriResolver,t,r.$ref);c=h.call(this,n,e)}const{schemaId:u}=this.opts;return c=c||new a({schema:r,schemaId:u,root:n,baseId:t}),c.schema!==c.root.schema?c:void 0}}}),require_data=__commonJS({"node_modules/ajv/dist/refs/data.json"(e,t){t.exports={$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON AnySchema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1}}}),require_uri_all=__commonJS({"node_modules/uri-js/dist/es5/uri.all.js"(e,t){var r,n;r=e,n=function(e){"use strict";function t(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];if(t.length>1){t[0]=t[0].slice(0,-1);for(var n=t.length-1,o=1;o<n;++o)t[o]=t[o].slice(1,-1);return t[n]=t[n].slice(1),t.join("")}return t[0]}function r(e){return"(?:"+e+")"}function n(e){return void 0===e?"undefined":null===e?"null":Object.prototype.toString.call(e).split(" ").pop().split("]").shift().toLowerCase()}function o(e){return e.toUpperCase()}function i(e){var n="[A-Za-z]",o="[0-9]",i=t(o,"[A-Fa-f]"),s=r(r("%[EFef]"+i+"%"+i+i+"%"+i+i)+"|"+r("%[89A-Fa-f]"+i+"%"+i+i)+"|"+r("%"+i+i)),a="[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]",c=t("[\\:\\/\\?\\#\\[\\]\\@]",a),u=e?"[\\uE000-\\uF8FF]":"[]",l=t(n,o,"[\\-\\.\\_\\~]",e?"[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]":"[]"),d=r(n+t(n,o,"[\\+\\-\\.]")+"*"),f=r(r(s+"|"+t(l,a,"[\\:]"))+"*"),h=(r(r("25[0-5]")+"|"+r("2[0-4]"+o)+"|"+r("1"+o+o)+"|"+r("[1-9]"+o)+"|"+o),r(r("25[0-5]")+"|"+r("2[0-4]"+o)+"|"+r("1"+o+o)+"|"+r("0?[1-9]"+o)+"|0?0?"+o)),p=r(h+"\\."+h+"\\."+h+"\\."+h),m=r(i+"{1,4}"),y=r(r(m+"\\:"+m)+"|"+p),_=r(r(m+"\\:")+"{6}"+y),g=r("\\:\\:"+r(m+"\\:")+"{5}"+y),b=r(r(m)+"?\\:\\:"+r(m+"\\:")+"{4}"+y),w=r(r(r(m+"\\:")+"{0,1}"+m)+"?\\:\\:"+r(m+"\\:")+"{3}"+y),v=r(r(r(m+"\\:")+"{0,2}"+m)+"?\\:\\:"+r(m+"\\:")+"{2}"+y),E=r(r(r(m+"\\:")+"{0,3}"+m)+"?\\:\\:"+m+"\\:"+y),S=r(r(r(m+"\\:")+"{0,4}"+m)+"?\\:\\:"+y),k=r(r(r(m+"\\:")+"{0,5}"+m)+"?\\:\\:"+m),T=r(r(r(m+"\\:")+"{0,6}"+m)+"?\\:\\:"),$=r([_,g,b,w,v,E,S,k,T].join("|")),x=r(r(l+"|"+s)+"+"),A=(r($+"\\%25"+x),r($+r("\\%25|\\%(?!"+i+"{2})")+x)),j=r("[vV]"+i+"+\\."+t(l,a,"[\\:]")+"+"),C=r("\\["+r(A+"|"+$+"|"+j)+"\\]"),N=r(r(s+"|"+t(l,a))+"*"),I=r(C+"|"+p+"(?!"+N+")|"+N),P=r(o+"*"),B=r(r(f+"@")+"?"+I+r("\\:"+P)+"?"),D=r(s+"|"+t(l,a,"[\\:\\@]")),O=r(D+"*"),U=r(D+"+"),M=r(r(s+"|"+t(l,a,"[\\@]"))+"+"),R=r(r("\\/"+O)+"*"),q=r("\\/"+r(U+R)+"?"),L=r(M+R),F=r(U+R),z="(?!"+D+")",V=(r(R+"|"+q+"|"+L+"|"+F+"|"+z),r(r(D+"|"+t("[\\/\\?]",u))+"*")),J=r(r(D+"|[\\/\\?]")+"*"),H=r(r("\\/\\/"+B+R)+"|"+q+"|"+F+"|"+z),K=r(d+"\\:"+H+r("\\?"+V)+"?"+r("\\#"+J)+"?"),G=r(r("\\/\\/"+B+R)+"|"+q+"|"+L+"|"+z),W=r(G+r("\\?"+V)+"?"+r("\\#"+J)+"?");return r(K+"|"+W),r(d+"\\:"+H+r("\\?"+V)+"?"),r(r("\\/\\/("+r("("+f+")@")+"?("+I+")"+r("\\:("+P+")")+"?)")+"?("+R+"|"+q+"|"+F+"|"+z+")"),r("\\?("+V+")"),r("\\#("+J+")"),r(r("\\/\\/("+r("("+f+")@")+"?("+I+")"+r("\\:("+P+")")+"?)")+"?("+R+"|"+q+"|"+L+"|"+z+")"),r("\\?("+V+")"),r("\\#("+J+")"),r(r("\\/\\/("+r("("+f+")@")+"?("+I+")"+r("\\:("+P+")")+"?)")+"?("+R+"|"+q+"|"+F+"|"+z+")"),r("\\?("+V+")"),r("\\#("+J+")"),r("("+f+")@"),r("\\:("+P+")"),{NOT_SCHEME:new RegExp(t("[^]",n,o,"[\\+\\-\\.]"),"g"),NOT_USERINFO:new RegExp(t("[^\\%\\:]",l,a),"g"),NOT_HOST:new RegExp(t("[^\\%\\[\\]\\:]",l,a),"g"),NOT_PATH:new RegExp(t("[^\\%\\/\\:\\@]",l,a),"g"),NOT_PATH_NOSCHEME:new RegExp(t("[^\\%\\/\\@]",l,a),"g"),NOT_QUERY:new RegExp(t("[^\\%]",l,a,"[\\:\\@\\/\\?]",u),"g"),NOT_FRAGMENT:new RegExp(t("[^\\%]",l,a,"[\\:\\@\\/\\?]"),"g"),ESCAPE:new RegExp(t("[^]",l,a),"g"),UNRESERVED:new RegExp(l,"g"),OTHER_CHARS:new RegExp(t("[^\\%]",l,c),"g"),PCT_ENCODED:new RegExp(s,"g"),IPV4ADDRESS:new RegExp("^("+p+")$"),IPV6ADDRESS:new RegExp("^\\[?("+$+")"+r(r("\\%25|\\%(?!"+i+"{2})")+"("+x+")")+"?\\]?$")}}var s=i(!1),a=i(!0),c=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var r=[],n=!0,o=!1,i=void 0;try{for(var s,a=e[Symbol.iterator]();!(n=(s=a.next()).done)&&(r.push(s.value),!t||r.length!==t);n=!0);}catch(e){o=!0,i=e}finally{try{!n&&a.return&&a.return()}finally{if(o)throw i}}return r}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")},u=2147483647,l=36,d=/^xn--/,f=/[^\0-\x7E]/,h=/[\x2E\u3002\uFF0E\uFF61]/g,p={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},m=Math.floor,y=String.fromCharCode;function _(e){throw new RangeError(p[e])}function g(e,t){var r=e.split("@"),n="";r.length>1&&(n=r[0]+"@",e=r[1]);var o=function(e,t){for(var r=[],n=e.length;n--;)r[n]=t(e[n]);return r}((e=e.replace(h,".")).split("."),t).join(".");return n+o}function b(e){for(var t=[],r=0,n=e.length;r<n;){var o=e.charCodeAt(r++);if(o>=55296&&o<=56319&&r<n){var i=e.charCodeAt(r++);56320==(64512&i)?t.push(((1023&o)<<10)+(1023&i)+65536):(t.push(o),r--)}else t.push(o)}return t}var w=function(e){return e-48<10?e-22:e-65<26?e-65:e-97<26?e-97:l},v=function(e,t){return e+22+75*(e<26)-((0!=t)<<5)},E=function(e,t,r){var n=0;for(e=r?m(e/700):e>>1,e+=m(e/t);e>455;n+=l)e=m(e/35);return m(n+36*e/(e+38))},S=function(e){var t=[],r=e.length,n=0,o=128,i=72,s=e.lastIndexOf("-");s<0&&(s=0);for(var a=0;a<s;++a)e.charCodeAt(a)>=128&&_("not-basic"),t.push(e.charCodeAt(a));for(var c=s>0?s+1:0;c<r;){for(var d=n,f=1,h=l;;h+=l){c>=r&&_("invalid-input");var p=w(e.charCodeAt(c++));(p>=l||p>m((u-n)/f))&&_("overflow"),n+=p*f;var y=h<=i?1:h>=i+26?26:h-i;if(p<y)break;var g=l-y;f>m(u/g)&&_("overflow"),f*=g}var b=t.length+1;i=E(n-d,b,0==d),m(n/b)>u-o&&_("overflow"),o+=m(n/b),n%=b,t.splice(n++,0,o)}return String.fromCodePoint.apply(String,t)},k=function(e){var t=[],r=(e=b(e)).length,n=128,o=0,i=72,s=!0,a=!1,c=void 0;try{for(var d,f=e[Symbol.iterator]();!(s=(d=f.next()).done);s=!0){var h=d.value;h<128&&t.push(y(h))}}catch(e){a=!0,c=e}finally{try{!s&&f.return&&f.return()}finally{if(a)throw c}}var p=t.length,g=p;for(p&&t.push("-");g<r;){var w=u,S=!0,k=!1,T=void 0;try{for(var $,x=e[Symbol.iterator]();!(S=($=x.next()).done);S=!0){var A=$.value;A>=n&&A<w&&(w=A)}}catch(e){k=!0,T=e}finally{try{!S&&x.return&&x.return()}finally{if(k)throw T}}var j=g+1;w-n>m((u-o)/j)&&_("overflow"),o+=(w-n)*j,n=w;var C=!0,N=!1,I=void 0;try{for(var P,B=e[Symbol.iterator]();!(C=(P=B.next()).done);C=!0){var D=P.value;if(D<n&&++o>u&&_("overflow"),D==n){for(var O=o,U=l;;U+=l){var M=U<=i?1:U>=i+26?26:U-i;if(O<M)break;var R=O-M,q=l-M;t.push(y(v(M+R%q,0))),O=m(R/q)}t.push(y(v(O,0))),i=E(o,j,g==p),o=0,++g}}}catch(e){N=!0,I=e}finally{try{!C&&B.return&&B.return()}finally{if(N)throw I}}++o,++n}return t.join("")},T=function(e){return g(e,function(e){return f.test(e)?"xn--"+k(e):e})},$=function(e){return g(e,function(e){return d.test(e)?S(e.slice(4).toLowerCase()):e})},x={};function A(e){var t=e.charCodeAt(0);return t<16?"%0"+t.toString(16).toUpperCase():t<128?"%"+t.toString(16).toUpperCase():t<2048?"%"+(t>>6|192).toString(16).toUpperCase()+"%"+(63&t|128).toString(16).toUpperCase():"%"+(t>>12|224).toString(16).toUpperCase()+"%"+(t>>6&63|128).toString(16).toUpperCase()+"%"+(63&t|128).toString(16).toUpperCase()}function j(e){for(var t="",r=0,n=e.length;r<n;){var o=parseInt(e.substr(r+1,2),16);if(o<128)t+=String.fromCharCode(o),r+=3;else if(o>=194&&o<224){if(n-r>=6){var i=parseInt(e.substr(r+4,2),16);t+=String.fromCharCode((31&o)<<6|63&i)}else t+=e.substr(r,6);r+=6}else if(o>=224){if(n-r>=9){var s=parseInt(e.substr(r+4,2),16),a=parseInt(e.substr(r+7,2),16);t+=String.fromCharCode((15&o)<<12|(63&s)<<6|63&a)}else t+=e.substr(r,9);r+=9}else t+=e.substr(r,3),r+=3}return t}function C(e,t){function r(e){var r=j(e);return r.match(t.UNRESERVED)?r:e}return e.scheme&&(e.scheme=String(e.scheme).replace(t.PCT_ENCODED,r).toLowerCase().replace(t.NOT_SCHEME,"")),void 0!==e.userinfo&&(e.userinfo=String(e.userinfo).replace(t.PCT_ENCODED,r).replace(t.NOT_USERINFO,A).replace(t.PCT_ENCODED,o)),void 0!==e.host&&(e.host=String(e.host).replace(t.PCT_ENCODED,r).toLowerCase().replace(t.NOT_HOST,A).replace(t.PCT_ENCODED,o)),void 0!==e.path&&(e.path=String(e.path).replace(t.PCT_ENCODED,r).replace(e.scheme?t.NOT_PATH:t.NOT_PATH_NOSCHEME,A).replace(t.PCT_ENCODED,o)),void 0!==e.query&&(e.query=String(e.query).replace(t.PCT_ENCODED,r).replace(t.NOT_QUERY,A).replace(t.PCT_ENCODED,o)),void 0!==e.fragment&&(e.fragment=String(e.fragment).replace(t.PCT_ENCODED,r).replace(t.NOT_FRAGMENT,A).replace(t.PCT_ENCODED,o)),e}function N(e){return e.replace(/^0*(.*)/,"$1")||"0"}function I(e,t){var r=e.match(t.IPV4ADDRESS)||[],n=c(r,2)[1];return n?n.split(".").map(N).join("."):e}function P(e,t){var r=e.match(t.IPV6ADDRESS)||[],n=c(r,3),o=n[1],i=n[2];if(o){for(var s=o.toLowerCase().split("::").reverse(),a=c(s,2),u=a[0],l=a[1],d=l?l.split(":").map(N):[],f=u.split(":").map(N),h=t.IPV4ADDRESS.test(f[f.length-1]),p=h?7:8,m=f.length-p,y=Array(p),_=0;_<p;++_)y[_]=d[_]||f[m+_]||"";h&&(y[p-1]=I(y[p-1],t));var g=y.reduce(function(e,t,r){if(!t||"0"===t){var n=e[e.length-1];n&&n.index+n.length===r?n.length++:e.push({index:r,length:1})}return e},[]).sort(function(e,t){return t.length-e.length})[0],b=void 0;if(g&&g.length>1){var w=y.slice(0,g.index),v=y.slice(g.index+g.length);b=w.join(":")+"::"+v.join(":")}else b=y.join(":");return i&&(b+="%"+i),b}return e}var B=/^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i,D=void 0==="".match(/(){0}/)[1];function O(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r={},n=!1!==t.iri?a:s;"suffix"===t.reference&&(e=(t.scheme?t.scheme+":":"")+"//"+e);var o=e.match(B);if(o){D?(r.scheme=o[1],r.userinfo=o[3],r.host=o[4],r.port=parseInt(o[5],10),r.path=o[6]||"",r.query=o[7],r.fragment=o[8],isNaN(r.port)&&(r.port=o[5])):(r.scheme=o[1]||void 0,r.userinfo=-1!==e.indexOf("@")?o[3]:void 0,r.host=-1!==e.indexOf("//")?o[4]:void 0,r.port=parseInt(o[5],10),r.path=o[6]||"",r.query=-1!==e.indexOf("?")?o[7]:void 0,r.fragment=-1!==e.indexOf("#")?o[8]:void 0,isNaN(r.port)&&(r.port=e.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/)?o[4]:void 0)),r.host&&(r.host=P(I(r.host,n),n)),void 0!==r.scheme||void 0!==r.userinfo||void 0!==r.host||void 0!==r.port||r.path||void 0!==r.query?void 0===r.scheme?r.reference="relative":void 0===r.fragment?r.reference="absolute":r.reference="uri":r.reference="same-document",t.reference&&"suffix"!==t.reference&&t.reference!==r.reference&&(r.error=r.error||"URI is not a "+t.reference+" reference.");var i=x[(t.scheme||r.scheme||"").toLowerCase()];if(t.unicodeSupport||i&&i.unicodeSupport)C(r,n);else{if(r.host&&(t.domainHost||i&&i.domainHost))try{r.host=T(r.host.replace(n.PCT_ENCODED,j).toLowerCase())}catch(e){r.error=r.error||"Host's domain name can not be converted to ASCII via punycode: "+e}C(r,s)}i&&i.parse&&i.parse(r,t)}else r.error=r.error||"URI can not be parsed.";return r}var U=/^\.\.?\//,M=/^\/\.(\/|$)/,R=/^\/\.\.(\/|$)/,q=/^\/?(?:.|\n)*?(?=\/|$)/;function L(e){for(var t=[];e.length;)if(e.match(U))e=e.replace(U,"");else if(e.match(M))e=e.replace(M,"/");else if(e.match(R))e=e.replace(R,"/"),t.pop();else if("."===e||".."===e)e="";else{var r=e.match(q);if(!r)throw new Error("Unexpected dot segment condition");var n=r[0];e=e.slice(n.length),t.push(n)}return t.join("")}function F(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.iri?a:s,n=[],o=x[(t.scheme||e.scheme||"").toLowerCase()];if(o&&o.serialize&&o.serialize(e,t),e.host)if(r.IPV6ADDRESS.test(e.host));else if(t.domainHost||o&&o.domainHost)try{e.host=t.iri?$(e.host):T(e.host.replace(r.PCT_ENCODED,j).toLowerCase())}catch(r){e.error=e.error||"Host's domain name can not be converted to "+(t.iri?"Unicode":"ASCII")+" via punycode: "+r}C(e,r),"suffix"!==t.reference&&e.scheme&&(n.push(e.scheme),n.push(":"));var i=function(e,t){var r=!1!==t.iri?a:s,n=[];return void 0!==e.userinfo&&(n.push(e.userinfo),n.push("@")),void 0!==e.host&&n.push(P(I(String(e.host),r),r).replace(r.IPV6ADDRESS,function(e,t,r){return"["+t+(r?"%25"+r:"")+"]"})),"number"!=typeof e.port&&"string"!=typeof e.port||(n.push(":"),n.push(String(e.port))),n.length?n.join(""):void 0}(e,t);if(void 0!==i&&("suffix"!==t.reference&&n.push("//"),n.push(i),e.path&&"/"!==e.path.charAt(0)&&n.push("/")),void 0!==e.path){var c=e.path;t.absolutePath||o&&o.absolutePath||(c=L(c)),void 0===i&&(c=c.replace(/^\/\//,"/%2F")),n.push(c)}return void 0!==e.query&&(n.push("?"),n.push(e.query)),void 0!==e.fragment&&(n.push("#"),n.push(e.fragment)),n.join("")}function z(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n={};return arguments[3]||(e=O(F(e,r),r),t=O(F(t,r),r)),!(r=r||{}).tolerant&&t.scheme?(n.scheme=t.scheme,n.userinfo=t.userinfo,n.host=t.host,n.port=t.port,n.path=L(t.path||""),n.query=t.query):(void 0!==t.userinfo||void 0!==t.host||void 0!==t.port?(n.userinfo=t.userinfo,n.host=t.host,n.port=t.port,n.path=L(t.path||""),n.query=t.query):(t.path?("/"===t.path.charAt(0)?n.path=L(t.path):(void 0===e.userinfo&&void 0===e.host&&void 0===e.port||e.path?e.path?n.path=e.path.slice(0,e.path.lastIndexOf("/")+1)+t.path:n.path=t.path:n.path="/"+t.path,n.path=L(n.path)),n.query=t.query):(n.path=e.path,void 0!==t.query?n.query=t.query:n.query=e.query),n.userinfo=e.userinfo,n.host=e.host,n.port=e.port),n.scheme=e.scheme),n.fragment=t.fragment,n}function V(e,t){return e&&e.toString().replace(t&&t.iri?a.PCT_ENCODED:s.PCT_ENCODED,j)}var J={scheme:"http",domainHost:!0,parse:function(e,t){return e.host||(e.error=e.error||"HTTP URIs must have a host."),e},serialize:function(e,t){var r="https"===String(e.scheme).toLowerCase();return e.port!==(r?443:80)&&""!==e.port||(e.port=void 0),e.path||(e.path="/"),e}},H={scheme:"https",domainHost:J.domainHost,parse:J.parse,serialize:J.serialize};function K(e){return"boolean"==typeof e.secure?e.secure:"wss"===String(e.scheme).toLowerCase()}var G={scheme:"ws",domainHost:!0,parse:function(e,t){var r=e;return r.secure=K(r),r.resourceName=(r.path||"/")+(r.query?"?"+r.query:""),r.path=void 0,r.query=void 0,r},serialize:function(e,t){if(e.port!==(K(e)?443:80)&&""!==e.port||(e.port=void 0),"boolean"==typeof e.secure&&(e.scheme=e.secure?"wss":"ws",e.secure=void 0),e.resourceName){var r=e.resourceName.split("?"),n=c(r,2),o=n[0],i=n[1];e.path=o&&"/"!==o?o:void 0,e.query=i,e.resourceName=void 0}return e.fragment=void 0,e}},W={scheme:"wss",domainHost:G.domainHost,parse:G.parse,serialize:G.serialize},Y={},X="[A-Za-z0-9\\-\\.\\_\\~\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]",Z="[0-9A-Fa-f]",Q=r(r("%[EFef]"+Z+"%"+Z+Z+"%"+Z+Z)+"|"+r("%[89A-Fa-f]"+Z+"%"+Z+Z)+"|"+r("%"+Z+Z)),ee=t("[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]",'[\\"\\\\]'),te=new RegExp(X,"g"),re=new RegExp(Q,"g"),ne=new RegExp(t("[^]","[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]","[\\.]",'[\\"]',ee),"g"),oe=new RegExp(t("[^]",X,"[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]"),"g"),ie=oe;function se(e){var t=j(e);return t.match(te)?t:e}var ae={scheme:"mailto",parse:function(e,t){var r=e,n=r.to=r.path?r.path.split(","):[];if(r.path=void 0,r.query){for(var o=!1,i={},s=r.query.split("&"),a=0,c=s.length;a<c;++a){var u=s[a].split("=");switch(u[0]){case"to":for(var l=u[1].split(","),d=0,f=l.length;d<f;++d)n.push(l[d]);break;case"subject":r.subject=V(u[1],t);break;case"body":r.body=V(u[1],t);break;default:o=!0,i[V(u[0],t)]=V(u[1],t)}}o&&(r.headers=i)}r.query=void 0;for(var h=0,p=n.length;h<p;++h){var m=n[h].split("@");if(m[0]=V(m[0]),t.unicodeSupport)m[1]=V(m[1],t).toLowerCase();else try{m[1]=T(V(m[1],t).toLowerCase())}catch(e){r.error=r.error||"Email address's domain name can not be converted to ASCII via punycode: "+e}n[h]=m.join("@")}return r},serialize:function(e,t){var r,n=e,i=null!=(r=e.to)?r instanceof Array?r:"number"!=typeof r.length||r.split||r.setInterval||r.call?[r]:Array.prototype.slice.call(r):[];if(i){for(var s=0,a=i.length;s<a;++s){var c=String(i[s]),u=c.lastIndexOf("@"),l=c.slice(0,u).replace(re,se).replace(re,o).replace(ne,A),d=c.slice(u+1);try{d=t.iri?$(d):T(V(d,t).toLowerCase())}catch(e){n.error=n.error||"Email address's domain name can not be converted to "+(t.iri?"Unicode":"ASCII")+" via punycode: "+e}i[s]=l+"@"+d}n.path=i.join(",")}var f=e.headers=e.headers||{};e.subject&&(f.subject=e.subject),e.body&&(f.body=e.body);var h=[];for(var p in f)f[p]!==Y[p]&&h.push(p.replace(re,se).replace(re,o).replace(oe,A)+"="+f[p].replace(re,se).replace(re,o).replace(ie,A));return h.length&&(n.query=h.join("&")),n}},ce=/^([^\:]+)\:(.*)/,ue={scheme:"urn",parse:function(e,t){var r=e.path&&e.path.match(ce),n=e;if(r){var o=t.scheme||n.scheme||"urn",i=r[1].toLowerCase(),s=r[2],a=o+":"+(t.nid||i),c=x[a];n.nid=i,n.nss=s,n.path=void 0,c&&(n=c.parse(n,t))}else n.error=n.error||"URN can not be parsed.";return n},serialize:function(e,t){var r=t.scheme||e.scheme||"urn",n=e.nid,o=r+":"+(t.nid||n),i=x[o];i&&(e=i.serialize(e,t));var s=e,a=e.nss;return s.path=(n||t.nid)+":"+a,s}},le=/^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/,de={scheme:"urn:uuid",parse:function(e,t){var r=e;return r.uuid=r.nss,r.nss=void 0,t.tolerant||r.uuid&&r.uuid.match(le)||(r.error=r.error||"UUID is not valid."),r},serialize:function(e,t){var r=e;return r.nss=(e.uuid||"").toLowerCase(),r}};x[J.scheme]=J,x[H.scheme]=H,x[G.scheme]=G,x[W.scheme]=W,x[ae.scheme]=ae,x[ue.scheme]=ue,x[de.scheme]=de,e.SCHEMES=x,e.pctEncChar=A,e.pctDecChars=j,e.parse=O,e.removeDotSegments=L,e.serialize=F,e.resolveComponents=z,e.resolve=function(e,t,r){var n=function(e,t){var r=e;if(t)for(var n in t)r[n]=t[n];return r}({scheme:"null"},r);return F(z(O(e,n),O(t,n),n,!0),n)},e.normalize=function(e,t){return"string"==typeof e?e=F(O(e,t),t):"object"===n(e)&&(e=O(F(e,t),t)),e},e.equal=function(e,t,r){return"string"==typeof e?e=F(O(e,r),r):"object"===n(e)&&(e=F(e,r)),"string"==typeof t?t=F(O(t,r),r):"object"===n(t)&&(t=F(t,r)),e===t},e.escapeComponent=function(e,t){return e&&e.toString().replace(t&&t.iri?a.ESCAPE:s.ESCAPE,A)},e.unescapeComponent=V,Object.defineProperty(e,"__esModule",{value:!0})},"object"==typeof e&&void 0!==t?n(e):"function"==typeof define&&define.amd?define(["exports"],n):n(r.URI=r.URI||{})}}),require_uri=__commonJS({"node_modules/ajv/dist/runtime/uri.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var t=require_uri_all();t.code='require("ajv/dist/runtime/uri").default',e.default=t}}),require_core=__commonJS({"node_modules/ajv/dist/core.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=void 0;var t=require_validate();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return t.KeywordCxt}});var r=require_codegen();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return r._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return r.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return r.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return r.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return r.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return r.CodeGen}});var n=require_validation_error(),o=require_ref_error(),i=require_rules(),s=require_compile(),a=require_codegen(),c=require_resolve(),u=require_dataType(),l=require_util(),d=require_data(),f=require_uri(),h=(e,t)=>new RegExp(e,t);h.code="new RegExp";var p=["removeAdditional","useDefaults","coerceTypes"],m=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),y={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."},_={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'};function g(e){var t,r,n,o,i,s,a,c,u,l,d,p,m,y,_,g,b,w,v,E,S,k,T,$,x;const A=e.strict,j=null===(t=e.code)||void 0===t?void 0:t.optimize,C=!0===j||void 0===j?1:j||0,N=null!==(n=null===(r=e.code)||void 0===r?void 0:r.regExp)&&void 0!==n?n:h,I=null!==(o=e.uriResolver)&&void 0!==o?o:f.default;return{strictSchema:null===(s=null!==(i=e.strictSchema)&&void 0!==i?i:A)||void 0===s||s,strictNumbers:null===(c=null!==(a=e.strictNumbers)&&void 0!==a?a:A)||void 0===c||c,strictTypes:null!==(l=null!==(u=e.strictTypes)&&void 0!==u?u:A)&&void 0!==l?l:"log",strictTuples:null!==(p=null!==(d=e.strictTuples)&&void 0!==d?d:A)&&void 0!==p?p:"log",strictRequired:null!==(y=null!==(m=e.strictRequired)&&void 0!==m?m:A)&&void 0!==y&&y,code:e.code?{...e.code,optimize:C,regExp:N}:{optimize:C,regExp:N},loopRequired:null!==(_=e.loopRequired)&&void 0!==_?_:200,loopEnum:null!==(g=e.loopEnum)&&void 0!==g?g:200,meta:null===(b=e.meta)||void 0===b||b,messages:null===(w=e.messages)||void 0===w||w,inlineRefs:null===(v=e.inlineRefs)||void 0===v||v,schemaId:null!==(E=e.schemaId)&&void 0!==E?E:"$id",addUsedSchema:null===(S=e.addUsedSchema)||void 0===S||S,validateSchema:null===(k=e.validateSchema)||void 0===k||k,validateFormats:null===(T=e.validateFormats)||void 0===T||T,unicodeRegExp:null===($=e.unicodeRegExp)||void 0===$||$,int32range:null===(x=e.int32range)||void 0===x||x,uriResolver:I}}var b=class{constructor(e={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...g(e)};const{es5:t,lines:r}=this.opts.code;this.scope=new a.ValueScope({scope:{},prefixes:m,es5:t,lines:r}),this.logger=function(e){if(!1===e)return $;if(void 0===e)return console;if(e.log&&e.warn&&e.error)return e;throw new Error("logger must implement log, warn and error methods")}(e.logger);const n=e.validateFormats;e.validateFormats=!1,this.RULES=(0,i.getRules)(),w.call(this,y,e,"NOT SUPPORTED"),w.call(this,_,e,"DEPRECATED","warn"),this._metaOpts=T.call(this),e.formats&&S.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords&&k.call(this,e.keywords),"object"==typeof e.meta&&this.addMetaSchema(e.meta),E.call(this),e.validateFormats=n}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){const{$data:e,meta:t,schemaId:r}=this.opts;let n=d;"id"===r&&(n={...d},n.id=n.$id,delete n.$id),t&&e&&this.addMetaSchema(n,n[r],!1)}defaultMeta(){const{meta:e,schemaId:t}=this.opts;return this.opts.defaultMeta="object"==typeof e?e[t]||e:void 0}validate(e,t){let r;if("string"==typeof e){if(r=this.getSchema(e),!r)throw new Error(`no schema with key or ref "${e}"`)}else r=this.compile(e);const n=r(t);return"$async"in r||(this.errors=r.errors),n}compile(e,t){const r=this._addSchema(e,t);return r.validate||this._compileSchemaEnv(r)}compileAsync(e,t){if("function"!=typeof this.opts.loadSchema)throw new Error("options.loadSchema should be a function");const{loadSchema:r}=this.opts;return n.call(this,e,t);async function n(e,t){await i.call(this,e.$schema);const r=this._addSchema(e,t);return r.validate||s.call(this,r)}async function i(e){e&&!this.getSchema(e)&&await n.call(this,{$ref:e},!0)}async function s(e){try{return this._compileSchemaEnv(e)}catch(t){if(!(t instanceof o.default))throw t;return a.call(this,t),await c.call(this,t.missingSchema),s.call(this,e)}}function a({missingSchema:e,missingRef:t}){if(this.refs[e])throw new Error(`AnySchema ${e} is loaded but ${t} cannot be resolved`)}async function c(e){const r=await u.call(this,e);this.refs[e]||await i.call(this,r.$schema),this.refs[e]||this.addSchema(r,e,t)}async function u(e){const t=this._loading[e];if(t)return t;try{return await(this._loading[e]=r(e))}finally{delete this._loading[e]}}}addSchema(e,t,r,n=this.opts.validateSchema){if(Array.isArray(e)){for(const t of e)this.addSchema(t,void 0,r,n);return this}let o;if("object"==typeof e){const{schemaId:t}=this.opts;if(o=e[t],void 0!==o&&"string"!=typeof o)throw new Error(`schema ${t} must be string`)}return t=(0,c.normalizeId)(t||o),this._checkUnique(t),this.schemas[t]=this._addSchema(e,r,t,n,!0),this}addMetaSchema(e,t,r=this.opts.validateSchema){return this.addSchema(e,t,!0,r),this}validateSchema(e,t){if("boolean"==typeof e)return!0;let r;if(r=e.$schema,void 0!==r&&"string"!=typeof r)throw new Error("$schema must be a string");if(r=r||this.opts.defaultMeta||this.defaultMeta(),!r)return this.logger.warn("meta-schema not available"),this.errors=null,!0;const n=this.validate(r,e);if(!n&&t){const e="schema is invalid: "+this.errorsText();if("log"!==this.opts.validateSchema)throw new Error(e);this.logger.error(e)}return n}getSchema(e){let t;for(;"string"==typeof(t=v.call(this,e));)e=t;if(void 0===t){const{schemaId:r}=this.opts,n=new s.SchemaEnv({schema:{},schemaId:r});if(t=s.resolveSchema.call(this,n,e),!t)return;this.refs[e]=t}return t.validate||this._compileSchemaEnv(t)}removeSchema(e){if(e instanceof RegExp)return this._removeAllSchemas(this.schemas,e),this._removeAllSchemas(this.refs,e),this;switch(typeof e){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{const t=v.call(this,e);return"object"==typeof t&&this._cache.delete(t.schema),delete this.schemas[e],delete this.refs[e],this}case"object":{const t=e;this._cache.delete(t);let r=e[this.opts.schemaId];return r&&(r=(0,c.normalizeId)(r),delete this.schemas[r],delete this.refs[r]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(e){for(const t of e)this.addKeyword(t);return this}addKeyword(e,t){let r;if("string"==typeof e)r=e,"object"==typeof t&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),t.keyword=r);else{if("object"!=typeof e||void 0!==t)throw new Error("invalid addKeywords parameters");if(r=(t=e).keyword,Array.isArray(r)&&!r.length)throw new Error("addKeywords: keyword must be string or non-empty array")}if(A.call(this,r,t),!t)return(0,l.eachItem)(r,e=>j.call(this,e)),this;N.call(this,t);const n={...t,type:(0,u.getJSONTypes)(t.type),schemaType:(0,u.getJSONTypes)(t.schemaType)};return(0,l.eachItem)(r,0===n.type.length?e=>j.call(this,e,n):e=>n.type.forEach(t=>j.call(this,e,n,t))),this}getKeyword(e){const t=this.RULES.all[e];return"object"==typeof t?t.definition:!!t}removeKeyword(e){const{RULES:t}=this;delete t.keywords[e],delete t.all[e];for(const r of t.rules){const t=r.rules.findIndex(t=>t.keyword===e);t>=0&&r.rules.splice(t,1)}return this}addFormat(e,t){return"string"==typeof t&&(t=new RegExp(t)),this.formats[e]=t,this}errorsText(e=this.errors,{separator:t=", ",dataVar:r="data"}={}){return e&&0!==e.length?e.map(e=>`${r}${e.instancePath} ${e.message}`).reduce((e,r)=>e+t+r):"No errors"}$dataMetaSchema(e,t){const r=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(const n of t){const t=n.split("/").slice(1);let o=e;for(const e of t)o=o[e];for(const e in r){const t=r[e];if("object"!=typeof t)continue;const{$data:n}=t.definition,i=o[e];n&&i&&(o[e]=P(i))}}return e}_removeAllSchemas(e,t){for(const r in e){const n=e[r];t&&!t.test(r)||("string"==typeof n?delete e[r]:n&&!n.meta&&(this._cache.delete(n.schema),delete e[r]))}}_addSchema(e,t,r,n=this.opts.validateSchema,o=this.opts.addUsedSchema){let i;const{schemaId:a}=this.opts;if("object"==typeof e)i=e[a];else{if(this.opts.jtd)throw new Error("schema must be object");if("boolean"!=typeof e)throw new Error("schema must be object or boolean")}let u=this._cache.get(e);if(void 0!==u)return u;r=(0,c.normalizeId)(i||r);const l=c.getSchemaRefs.call(this,e,r);return u=new s.SchemaEnv({schema:e,schemaId:a,meta:t,baseId:r,localRefs:l}),this._cache.set(u.schema,u),o&&!r.startsWith("#")&&(r&&this._checkUnique(r),this.refs[r]=u),n&&this.validateSchema(e,!0),u}_checkUnique(e){if(this.schemas[e]||this.refs[e])throw new Error(`schema with key or id "${e}" already exists`)}_compileSchemaEnv(e){if(e.meta?this._compileMetaSchema(e):s.compileSchema.call(this,e),!e.validate)throw new Error("ajv implementation error");return e.validate}_compileMetaSchema(e){const t=this.opts;this.opts=this._metaOpts;try{s.compileSchema.call(this,e)}finally{this.opts=t}}};function w(e,t,r,n="error"){for(const o in e){const i=o;i in t&&this.logger[n](`${r}: option ${o}. ${e[i]}`)}}function v(e){return e=(0,c.normalizeId)(e),this.schemas[e]||this.refs[e]}function E(){const e=this.opts.schemas;if(e)if(Array.isArray(e))this.addSchema(e);else for(const t in e)this.addSchema(e[t],t)}function S(){for(const e in this.opts.formats){const t=this.opts.formats[e];t&&this.addFormat(e,t)}}function k(e){if(Array.isArray(e))this.addVocabulary(e);else{this.logger.warn("keywords option as map is deprecated, pass array");for(const t in e){const r=e[t];r.keyword||(r.keyword=t),this.addKeyword(r)}}}function T(){const e={...this.opts};for(const t of p)delete e[t];return e}e.default=b,b.ValidationError=n.default,b.MissingRefError=o.default;var $={log(){},warn(){},error(){}};var x=/^[a-z_$][a-z0-9_$:-]*$/i;function A(e,t){const{RULES:r}=this;if((0,l.eachItem)(e,e=>{if(r.keywords[e])throw new Error(`Keyword ${e} is already defined`);if(!x.test(e))throw new Error(`Keyword ${e} has invalid name`)}),t&&t.$data&&!("code"in t)&&!("validate"in t))throw new Error('$data keyword must have "code" or "validate" function')}function j(e,t,r){var n;const o=null==t?void 0:t.post;if(r&&o)throw new Error('keyword with "post" flag cannot have "type"');const{RULES:i}=this;let s=o?i.post:i.rules.find(({type:e})=>e===r);if(s||(s={type:r,rules:[]},i.rules.push(s)),i.keywords[e]=!0,!t)return;const a={keyword:e,definition:{...t,type:(0,u.getJSONTypes)(t.type),schemaType:(0,u.getJSONTypes)(t.schemaType)}};t.before?C.call(this,s,a,t.before):s.rules.push(a),i.all[e]=a,null===(n=t.implements)||void 0===n||n.forEach(e=>this.addKeyword(e))}function C(e,t,r){const n=e.rules.findIndex(e=>e.keyword===r);n>=0?e.rules.splice(n,0,t):(e.rules.push(t),this.logger.warn(`rule ${r} is not defined`))}function N(e){let{metaSchema:t}=e;void 0!==t&&(e.$data&&this.opts.$data&&(t=P(t)),e.validateSchema=this.compile(t,!0))}var I={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function P(e){return{anyOf:[e,I]}}}}),require_id=__commonJS({"node_modules/ajv/dist/vocabularies/core/id.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var t={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};e.default=t}}),require_ref=__commonJS({"node_modules/ajv/dist/vocabularies/core/ref.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.callRef=e.getValidate=void 0;var t=require_ref_error(),r=require_code2(),n=require_codegen(),o=require_names(),i=require_compile(),s=require_util(),a={keyword:"$ref",schemaType:"string",code(e){const{gen:r,schema:o,it:s}=e,{baseId:a,schemaEnv:l,validateName:d,opts:f,self:h}=s,{root:p}=l;if(("#"===o||"#/"===o)&&a===p.baseId)return function(){if(l===p)return u(e,d,l,l.$async);const t=r.scopeValue("root",{ref:p});return u(e,n._`${t}.validate`,p,p.$async)}();const m=i.resolveRef.call(h,p,a,o);if(void 0===m)throw new t.default(s.opts.uriResolver,a,o);return m instanceof i.SchemaEnv?function(t){const r=c(e,t);u(e,r,t,t.$async)}(m):function(t){const i=r.scopeValue("schema",!0===f.code.source?{ref:t,code:(0,n.stringify)(t)}:{ref:t}),s=r.name("valid"),a=e.subschema({schema:t,dataTypes:[],schemaPath:n.nil,topSchemaRef:i,errSchemaPath:o},s);e.mergeEvaluated(a),e.ok(s)}(m)}};function c(e,t){const{gen:r}=e;return t.validate?r.scopeValue("validate",{ref:t.validate}):n._`${r.scopeValue("wrapper",{ref:t})}.validate`}function u(e,t,i,a){const{gen:c,it:u}=e,{allErrors:l,schemaEnv:d,opts:f}=u,h=f.passContext?o.default.this:n.nil;function p(e){const t=n._`${e}.errors`;c.assign(o.default.vErrors,n._`${o.default.vErrors} === null ? ${t} : ${o.default.vErrors}.concat(${t})`),c.assign(o.default.errors,n._`${o.default.vErrors}.length`)}function m(e){var t;if(!u.opts.unevaluated)return;const r=null===(t=null==i?void 0:i.validate)||void 0===t?void 0:t.evaluated;if(!0!==u.props)if(r&&!r.dynamicProps)void 0!==r.props&&(u.props=s.mergeEvaluated.props(c,r.props,u.props));else{const t=c.var("props",n._`${e}.evaluated.props`);u.props=s.mergeEvaluated.props(c,t,u.props,n.Name)}if(!0!==u.items)if(r&&!r.dynamicItems)void 0!==r.items&&(u.items=s.mergeEvaluated.items(c,r.items,u.items));else{const t=c.var("items",n._`${e}.evaluated.items`);u.items=s.mergeEvaluated.items(c,t,u.items,n.Name)}}a?function(){if(!d.$async)throw new Error("async schema referenced by sync schema");const o=c.let("valid");c.try(()=>{c.code(n._`await ${(0,r.callValidateCode)(e,t,h)}`),m(t),l||c.assign(o,!0)},e=>{c.if(n._`!(${e} instanceof ${u.ValidationError})`,()=>c.throw(e)),p(e),l||c.assign(o,!1)}),e.ok(o)}():e.result((0,r.callValidateCode)(e,t,h),()=>m(t),()=>p(t))}e.getValidate=c,e.callRef=u,e.default=a}}),require_core2=__commonJS({"node_modules/ajv/dist/vocabularies/core/index.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var t=require_id(),r=require_ref(),n=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",t.default,r.default];e.default=n}}),require_limitNumber=__commonJS({"node_modules/ajv/dist/vocabularies/validation/limitNumber.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var t=require_codegen(),r=t.operators,n={maximum:{okStr:"<=",ok:r.LTE,fail:r.GT},minimum:{okStr:">=",ok:r.GTE,fail:r.LT},exclusiveMaximum:{okStr:"<",ok:r.LT,fail:r.GTE},exclusiveMinimum:{okStr:">",ok:r.GT,fail:r.LTE}},o={message:({keyword:e,schemaCode:r})=>t.str`must be ${n[e].okStr} ${r}`,params:({keyword:e,schemaCode:r})=>t._`{comparison: ${n[e].okStr}, limit: ${r}}`},i={keyword:Object.keys(n),type:"number",schemaType:"number",$data:!0,error:o,code(e){const{keyword:r,data:o,schemaCode:i}=e;e.fail$data(t._`${o} ${n[r].fail} ${i} || isNaN(${o})`)}};e.default=i}}),require_multipleOf=__commonJS({"node_modules/ajv/dist/vocabularies/validation/multipleOf.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var t=require_codegen(),r={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:{message:({schemaCode:e})=>t.str`must be multiple of ${e}`,params:({schemaCode:e})=>t._`{multipleOf: ${e}}`},code(e){const{gen:r,data:n,schemaCode:o,it:i}=e,s=i.opts.multipleOfPrecision,a=r.let("res"),c=s?t._`Math.abs(Math.round(${a}) - ${a}) > 1e-${s}`:t._`${a} !== parseInt(${a})`;e.fail$data(t._`(${o} === 0 || (${a} = ${n}/${o}, ${c}))`)}};e.default=r}}),require_ucs2length=__commonJS({"node_modules/ajv/dist/runtime/ucs2length.js"(e){"use strict";function t(e){const t=e.length;let r,n=0,o=0;for(;o<t;)n++,r=e.charCodeAt(o++),r>=55296&&r<=56319&&o<t&&(r=e.charCodeAt(o),56320==(64512&r)&&o++);return n}Object.defineProperty(e,"__esModule",{value:!0}),e.default=t,t.code='require("ajv/dist/runtime/ucs2length").default'}}),require_limitLength=__commonJS({"node_modules/ajv/dist/vocabularies/validation/limitLength.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var t=require_codegen(),r=require_util(),n=require_ucs2length(),o={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:{message({keyword:e,schemaCode:r}){const n="maxLength"===e?"more":"fewer";return t.str`must NOT have ${n} than ${r} characters`},params:({schemaCode:e})=>t._`{limit: ${e}}`},code(e){const{keyword:o,data:i,schemaCode:s,it:a}=e,c="maxLength"===o?t.operators.GT:t.operators.LT,u=!1===a.opts.unicode?t._`${i}.length`:t._`${(0,r.useFunc)(e.gen,n.default)}(${i})`;e.fail$data(t._`${u} ${c} ${s}`)}};e.default=o}}),require_pattern=__commonJS({"node_modules/ajv/dist/vocabularies/validation/pattern.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var t=require_code2(),r=require_codegen(),n={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:{message:({schemaCode:e})=>r.str`must match pattern "${e}"`,params:({schemaCode:e})=>r._`{pattern: ${e}}`},code(e){const{data:n,$data:o,schema:i,schemaCode:s,it:a}=e,c=a.opts.unicodeRegExp?"u":"",u=o?r._`(new RegExp(${s}, ${c}))`:(0,t.usePattern)(e,i);e.fail$data(r._`!${u}.test(${n})`)}};e.default=n}}),require_limitProperties=__commonJS({"node_modules/ajv/dist/vocabularies/validation/limitProperties.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var t=require_codegen(),r={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:{message({keyword:e,schemaCode:r}){const n="maxProperties"===e?"more":"fewer";return t.str`must NOT have ${n} than ${r} properties`},params:({schemaCode:e})=>t._`{limit: ${e}}`},code(e){const{keyword:r,data:n,schemaCode:o}=e,i="maxProperties"===r?t.operators.GT:t.operators.LT;e.fail$data(t._`Object.keys(${n}).length ${i} ${o}`)}};e.default=r}}),require_required=__commonJS({"node_modules/ajv/dist/vocabularies/validation/required.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var t=require_code2(),r=require_codegen(),n=require_util(),o={keyword:"required",type:"object",schemaType:"array",$data:!0,error:{message:({params:{missingProperty:e}})=>r.str`must have required property '${e}'`,params:({params:{missingProperty:e}})=>r._`{missingProperty: ${e}}`},code(e){const{gen:o,schema:i,schemaCode:s,data:a,$data:c,it:u}=e,{opts:l}=u;if(!c&&0===i.length)return;const d=i.length>=l.loopRequired;if(u.allErrors?function(){if(d||c)e.block$data(r.nil,f);else for(const r of i)(0,t.checkReportMissingProp)(e,r)}():function(){const n=o.let("missing");if(d||c){const i=o.let("valid",!0);e.block$data(i,()=>function(n,i){e.setParams({missingProperty:n}),o.forOf(n,s,()=>{o.assign(i,(0,t.propertyInData)(o,a,n,l.ownProperties)),o.if((0,r.not)(i),()=>{e.error(),o.break()})},r.nil)}(n,i)),e.ok(i)}else o.if((0,t.checkMissingProp)(e,i,n)),(0,t.reportMissingProp)(e,n),o.else()}(),l.strictRequired){const t=e.parentSchema.properties,{definedProperties:r}=e.it;for(const e of i)if(void 0===(null==t?void 0:t[e])&&!r.has(e)){const t=`required property "${e}" is not defined at "${u.schemaEnv.baseId+u.errSchemaPath}" (strictRequired)`;(0,n.checkStrictMode)(u,t,u.opts.strictRequired)}}function f(){o.forOf("prop",s,r=>{e.setParams({missingProperty:r}),o.if((0,t.noPropertyInData)(o,a,r,l.ownProperties),()=>e.error())})}}};e.default=o}}),require_limitItems=__commonJS({"node_modules/ajv/dist/vocabularies/validation/limitItems.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var t=require_codegen(),r={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:{message({keyword:e,schemaCode:r}){const n="maxItems"===e?"more":"fewer";return t.str`must NOT have ${n} than ${r} items`},params:({schemaCode:e})=>t._`{limit: ${e}}`},code(e){const{keyword:r,data:n,schemaCode:o}=e,i="maxItems"===r?t.operators.GT:t.operators.LT;e.fail$data(t._`${n}.length ${i} ${o}`)}};e.default=r}}),require_equal=__commonJS({"node_modules/ajv/dist/runtime/equal.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var t=require_fast_deep_equal();t.code='require("ajv/dist/runtime/equal").default',e.default=t}}),require_uniqueItems=__commonJS({"node_modules/ajv/dist/vocabularies/validation/uniqueItems.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var t=require_dataType(),r=require_codegen(),n=require_util(),o=require_equal(),i={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:{message:({params:{i:e,j:t}})=>r.str`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>r._`{i: ${e}, j: ${t}}`},code(e){const{gen:i,data:s,$data:a,schema:c,parentSchema:u,schemaCode:l,it:d}=e;if(!a&&!c)return;const f=i.let("valid"),h=u.items?(0,t.getSchemaTypes)(u.items):[];function p(n,o){const a=i.name("item"),c=(0,t.checkDataTypes)(h,a,d.opts.strictNumbers,t.DataType.Wrong),u=i.const("indices",r._`{}`);i.for(r._`;${n}--;`,()=>{i.let(a,r._`${s}[${n}]`),i.if(c,r._`continue`),h.length>1&&i.if(r._`typeof ${a} == "string"`,r._`${a} += "_"`),i.if(r._`typeof ${u}[${a}] == "number"`,()=>{i.assign(o,r._`${u}[${a}]`),e.error(),i.assign(f,!1).break()}).code(r._`${u}[${a}] = ${n}`)})}function m(t,a){const c=(0,n.useFunc)(i,o.default),u=i.name("outer");i.label(u).for(r._`;${t}--;`,()=>i.for(r._`${a} = ${t}; ${a}--;`,()=>i.if(r._`${c}(${s}[${t}], ${s}[${a}])`,()=>{e.error(),i.assign(f,!1).break(u)})))}e.block$data(f,function(){const t=i.let("i",r._`${s}.length`),n=i.let("j");e.setParams({i:t,j:n}),i.assign(f,!0),i.if(r._`${t} > 1`,()=>(h.length>0&&!h.some(e=>"object"===e||"array"===e)?p:m)(t,n))},r._`${l} === false`),e.ok(f)}};e.default=i}}),require_const=__commonJS({"node_modules/ajv/dist/vocabularies/validation/const.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var t=require_codegen(),r=require_util(),n=require_equal(),o={keyword:"const",$data:!0,error:{message:"must be equal to constant",params:({schemaCode:e})=>t._`{allowedValue: ${e}}`},code(e){const{gen:o,data:i,$data:s,schemaCode:a,schema:c}=e;s||c&&"object"==typeof c?e.fail$data(t._`!${(0,r.useFunc)(o,n.default)}(${i}, ${a})`):e.fail(t._`${c} !== ${i}`)}};e.default=o}}),require_enum=__commonJS({"node_modules/ajv/dist/vocabularies/validation/enum.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var t=require_codegen(),r=require_util(),n=require_equal(),o={keyword:"enum",schemaType:"array",$data:!0,error:{message:"must be equal to one of the allowed values",params:({schemaCode:e})=>t._`{allowedValues: ${e}}`},code(e){const{gen:o,data:i,$data:s,schema:a,schemaCode:c,it:u}=e;if(!s&&0===a.length)throw new Error("enum must have non-empty array");const l=a.length>=u.opts.loopEnum;let d;const f=()=>null!=d?d:d=(0,r.useFunc)(o,n.default);let h;if(l||s)h=o.let("valid"),e.block$data(h,function(){o.assign(h,!1),o.forOf("v",c,e=>o.if(t._`${f()}(${i}, ${e})`,()=>o.assign(h,!0).break()))});else{if(!Array.isArray(a))throw new Error("ajv implementation error");const e=o.const("vSchema",c);h=(0,t.or)(...a.map((r,n)=>function(e,r){const n=a[r];return"object"==typeof n&&null!==n?t._`${f()}(${i}, ${e}[${r}])`:t._`${i} === ${n}`}(e,n)))}e.pass(h)}};e.default=o}}),require_validation=__commonJS({"node_modules/ajv/dist/vocabularies/validation/index.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var t=require_limitNumber(),r=require_multipleOf(),n=require_limitLength(),o=require_pattern(),i=require_limitProperties(),s=require_required(),a=require_limitItems(),c=require_uniqueItems(),u=require_const(),l=require_enum(),d=[t.default,r.default,n.default,o.default,i.default,s.default,a.default,c.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},u.default,l.default];e.default=d}}),require_additionalItems=__commonJS({"node_modules/ajv/dist/vocabularies/applicator/additionalItems.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.validateAdditionalItems=void 0;var t=require_codegen(),r=require_util(),n={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:{message:({params:{len:e}})=>t.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>t._`{limit: ${e}}`},code(e){const{parentSchema:t,it:n}=e,{items:i}=t;Array.isArray(i)?o(e,i):(0,r.checkStrictMode)(n,'"additionalItems" is ignored when "items" is not an array of schemas')}};function o(e,n){const{gen:o,schema:i,data:s,keyword:a,it:c}=e;c.items=!0;const u=o.const("len",t._`${s}.length`);if(!1===i)e.setParams({len:n.length}),e.pass(t._`${u} <= ${n.length}`);else if("object"==typeof i&&!(0,r.alwaysValidSchema)(c,i)){const i=o.var("valid",t._`${u} <= ${n.length}`);o.if((0,t.not)(i),()=>function(i){o.forRange("i",n.length,u,n=>{e.subschema({keyword:a,dataProp:n,dataPropType:r.Type.Num},i),c.allErrors||o.if((0,t.not)(i),()=>o.break())})}(i)),e.ok(i)}}e.validateAdditionalItems=o,e.default=n}}),require_items=__commonJS({"node_modules/ajv/dist/vocabularies/applicator/items.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.validateTuple=void 0;var t=require_codegen(),r=require_util(),n=require_code2(),o={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){const{schema:t,it:o}=e;if(Array.isArray(t))return i(e,"additionalItems",t);o.items=!0,(0,r.alwaysValidSchema)(o,t)||e.ok((0,n.validateArray)(e))}};function i(e,n,o=e.schema){const{gen:i,parentSchema:s,data:a,keyword:c,it:u}=e;!function(e){const{opts:t,errSchemaPath:i}=u,s=o.length,a=s===e.minItems&&(s===e.maxItems||!1===e[n]);if(t.strictTuples&&!a){const e=`"${c}" is ${s}-tuple, but minItems or maxItems/${n} are not specified or different at path "${i}"`;(0,r.checkStrictMode)(u,e,t.strictTuples)}}(s),u.opts.unevaluated&&o.length&&!0!==u.items&&(u.items=r.mergeEvaluated.items(i,o.length,u.items));const l=i.name("valid"),d=i.const("len",t._`${a}.length`);o.forEach((n,o)=>{(0,r.alwaysValidSchema)(u,n)||(i.if(t._`${d} > ${o}`,()=>e.subschema({keyword:c,schemaProp:o,dataProp:o},l)),e.ok(l))})}e.validateTuple=i,e.default=o}}),require_prefixItems=__commonJS({"node_modules/ajv/dist/vocabularies/applicator/prefixItems.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var t=require_items(),r={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:e=>(0,t.validateTuple)(e,"items")};e.default=r}}),require_items2020=__commonJS({"node_modules/ajv/dist/vocabularies/applicator/items2020.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var t=require_codegen(),r=require_util(),n=require_code2(),o=require_additionalItems(),i={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:{message:({params:{len:e}})=>t.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>t._`{limit: ${e}}`},code(e){const{schema:t,parentSchema:i,it:s}=e,{prefixItems:a}=i;s.items=!0,(0,r.alwaysValidSchema)(s,t)||(a?(0,o.validateAdditionalItems)(e,a):e.ok((0,n.validateArray)(e)))}};e.default=i}}),require_contains=__commonJS({"node_modules/ajv/dist/vocabularies/applicator/contains.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var t=require_codegen(),r=require_util(),n={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:{message:({params:{min:e,max:r}})=>void 0===r?t.str`must contain at least ${e} valid item(s)`:t.str`must contain at least ${e} and no more than ${r} valid item(s)`,params:({params:{min:e,max:r}})=>void 0===r?t._`{minContains: ${e}}`:t._`{minContains: ${e}, maxContains: ${r}}`},code(e){const{gen:n,schema:o,parentSchema:i,data:s,it:a}=e;let c,u;const{minContains:l,maxContains:d}=i;a.opts.next?(c=void 0===l?1:l,u=d):c=1;const f=n.const("len",t._`${s}.length`);if(e.setParams({min:c,max:u}),void 0===u&&0===c)return void(0,r.checkStrictMode)(a,'"minContains" == 0 without "maxContains": "contains" keyword ignored');if(void 0!==u&&c>u)return(0,r.checkStrictMode)(a,'"minContains" > "maxContains" is always invalid'),void e.fail();if((0,r.alwaysValidSchema)(a,o)){let r=t._`${f} >= ${c}`;return void 0!==u&&(r=t._`${r} && ${f} <= ${u}`),void e.pass(r)}a.items=!0;const h=n.name("valid");function p(){const e=n.name("_valid"),r=n.let("count",0);m(e,()=>n.if(e,()=>function(e){n.code(t._`${e}++`),void 0===u?n.if(t._`${e} >= ${c}`,()=>n.assign(h,!0).break()):(n.if(t._`${e} > ${u}`,()=>n.assign(h,!1).break()),1===c?n.assign(h,!0):n.if(t._`${e} >= ${c}`,()=>n.assign(h,!0)))}(r)))}function m(t,o){n.forRange("i",0,f,n=>{e.subschema({keyword:"contains",dataProp:n,dataPropType:r.Type.Num,compositeRule:!0},t),o()})}void 0===u&&1===c?m(h,()=>n.if(h,()=>n.break())):0===c?(n.let(h,!0),void 0!==u&&n.if(t._`${s}.length > 0`,p)):(n.let(h,!1),p()),e.result(h,()=>e.reset())}};e.default=n}}),require_dependencies=__commonJS({"node_modules/ajv/dist/vocabularies/applicator/dependencies.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.validateSchemaDeps=e.validatePropertyDeps=e.error=void 0;var t=require_codegen(),r=require_util(),n=require_code2();e.error={message:({params:{property:e,depsCount:r,deps:n}})=>{const o=1===r?"property":"properties";return t.str`must have ${o} ${n} when property ${e} is present`},params:({params:{property:e,depsCount:r,deps:n,missingProperty:o}})=>t._`{property: ${e},
    missingProperty: ${o},
    depsCount: ${r},
    deps: ${n}}`};var o={keyword:"dependencies",type:"object",schemaType:"object",error:e.error,code(e){const[t,r]=function({schema:e}){const t={},r={};for(const n in e){if("__proto__"===n)continue;(Array.isArray(e[n])?t:r)[n]=e[n]}return[t,r]}(e);i(e,t),s(e,r)}};function i(e,r=e.schema){const{gen:o,data:i,it:s}=e;if(0===Object.keys(r).length)return;const a=o.let("missing");for(const c in r){const u=r[c];if(0===u.length)continue;const l=(0,n.propertyInData)(o,i,c,s.opts.ownProperties);e.setParams({property:c,depsCount:u.length,deps:u.join(", ")}),s.allErrors?o.if(l,()=>{for(const t of u)(0,n.checkReportMissingProp)(e,t)}):(o.if(t._`${l} && (${(0,n.checkMissingProp)(e,u,a)})`),(0,n.reportMissingProp)(e,a),o.else())}}function s(e,t=e.schema){const{gen:o,data:i,keyword:s,it:a}=e,c=o.name("valid");for(const u in t)(0,r.alwaysValidSchema)(a,t[u])||(o.if((0,n.propertyInData)(o,i,u,a.opts.ownProperties),()=>{const t=e.subschema({keyword:s,schemaProp:u},c);e.mergeValidEvaluated(t,c)},()=>o.var(c,!0)),e.ok(c))}e.validatePropertyDeps=i,e.validateSchemaDeps=s,e.default=o}}),require_propertyNames=__commonJS({"node_modules/ajv/dist/vocabularies/applicator/propertyNames.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var t=require_codegen(),r=require_util(),n={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:{message:"property name must be valid",params:({params:e})=>t._`{propertyName: ${e.propertyName}}`},code(e){const{gen:n,schema:o,data:i,it:s}=e;if((0,r.alwaysValidSchema)(s,o))return;const a=n.name("valid");n.forIn("key",i,r=>{e.setParams({propertyName:r}),e.subschema({keyword:"propertyNames",data:r,dataTypes:["string"],propertyName:r,compositeRule:!0},a),n.if((0,t.not)(a),()=>{e.error(!0),s.allErrors||n.break()})}),e.ok(a)}};e.default=n}}),require_additionalProperties=__commonJS({"node_modules/ajv/dist/vocabularies/applicator/additionalProperties.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var t=require_code2(),r=require_codegen(),n=require_names(),o=require_util(),i={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:{message:"must NOT have additional properties",params:({params:e})=>r._`{additionalProperty: ${e.additionalProperty}}`},code(e){const{gen:i,schema:s,parentSchema:a,data:c,errsCount:u,it:l}=e;if(!u)throw new Error("ajv implementation error");const{allErrors:d,opts:f}=l;if(l.props=!0,"all"!==f.removeAdditional&&(0,o.alwaysValidSchema)(l,s))return;const h=(0,t.allSchemaProperties)(a.properties),p=(0,t.allSchemaProperties)(a.patternProperties);function m(e){i.code(r._`delete ${c}[${e}]`)}function y(t){if("all"===f.removeAdditional||f.removeAdditional&&!1===s)m(t);else{if(!1===s)return e.setParams({additionalProperty:t}),e.error(),void(d||i.break());if("object"==typeof s&&!(0,o.alwaysValidSchema)(l,s)){const n=i.name("valid");"failing"===f.removeAdditional?(_(t,n,!1),i.if((0,r.not)(n),()=>{e.reset(),m(t)})):(_(t,n),d||i.if((0,r.not)(n),()=>i.break()))}}}function _(t,r,n){const i={keyword:"additionalProperties",dataProp:t,dataPropType:o.Type.Str};!1===n&&Object.assign(i,{compositeRule:!0,createErrors:!1,allErrors:!1}),e.subschema(i,r)}i.forIn("key",c,n=>{h.length||p.length?i.if(function(n){let s;if(h.length>8){const e=(0,o.schemaRefOrVal)(l,a.properties,"properties");s=(0,t.isOwnProperty)(i,e,n)}else s=h.length?(0,r.or)(...h.map(e=>r._`${n} === ${e}`)):r.nil;return p.length&&(s=(0,r.or)(s,...p.map(o=>r._`${(0,t.usePattern)(e,o)}.test(${n})`))),(0,r.not)(s)}(n),()=>y(n)):y(n)}),e.ok(r._`${u} === ${n.default.errors}`)}};e.default=i}}),require_properties=__commonJS({"node_modules/ajv/dist/vocabularies/applicator/properties.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var t=require_validate(),r=require_code2(),n=require_util(),o=require_additionalProperties(),i={keyword:"properties",type:"object",schemaType:"object",code(e){const{gen:i,schema:s,parentSchema:a,data:c,it:u}=e;"all"===u.opts.removeAdditional&&void 0===a.additionalProperties&&o.default.code(new t.KeywordCxt(u,o.default,"additionalProperties"));const l=(0,r.allSchemaProperties)(s);for(const e of l)u.definedProperties.add(e);u.opts.unevaluated&&l.length&&!0!==u.props&&(u.props=n.mergeEvaluated.props(i,(0,n.toHash)(l),u.props));const d=l.filter(e=>!(0,n.alwaysValidSchema)(u,s[e]));if(0===d.length)return;const f=i.name("valid");for(const t of d)h(t)?p(t):(i.if((0,r.propertyInData)(i,c,t,u.opts.ownProperties)),p(t),u.allErrors||i.else().var(f,!0),i.endIf()),e.it.definedProperties.add(t),e.ok(f);function h(e){return u.opts.useDefaults&&!u.compositeRule&&void 0!==s[e].default}function p(t){e.subschema({keyword:"properties",schemaProp:t,dataProp:t},f)}}};e.default=i}}),require_patternProperties=__commonJS({"node_modules/ajv/dist/vocabularies/applicator/patternProperties.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var t=require_code2(),r=require_codegen(),n=require_util(),o=require_util(),i={keyword:"patternProperties",type:"object",schemaType:"object",code(e){const{gen:i,schema:s,data:a,parentSchema:c,it:u}=e,{opts:l}=u,d=(0,t.allSchemaProperties)(s),f=d.filter(e=>(0,n.alwaysValidSchema)(u,s[e]));if(0===d.length||f.length===d.length&&(!u.opts.unevaluated||!0===u.props))return;const h=l.strictSchema&&!l.allowMatchingProperties&&c.properties,p=i.name("valid");!0===u.props||u.props instanceof r.Name||(u.props=(0,o.evaluatedPropsToName)(i,u.props));const{props:m}=u;function y(e){for(const t in h)new RegExp(e).test(t)&&(0,n.checkStrictMode)(u,`property ${t} matches pattern ${e} (use allowMatchingProperties)`)}function _(n){i.forIn("key",a,s=>{i.if(r._`${(0,t.usePattern)(e,n)}.test(${s})`,()=>{const t=f.includes(n);t||e.subschema({keyword:"patternProperties",schemaProp:n,dataProp:s,dataPropType:o.Type.Str},p),u.opts.unevaluated&&!0!==m?i.assign(r._`${m}[${s}]`,!0):t||u.allErrors||i.if((0,r.not)(p),()=>i.break())})})}!function(){for(const e of d)h&&y(e),u.allErrors?_(e):(i.var(p,!0),_(e),i.if(p))}()}};e.default=i}}),require_not=__commonJS({"node_modules/ajv/dist/vocabularies/applicator/not.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var t=require_util(),r={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){const{gen:r,schema:n,it:o}=e;if((0,t.alwaysValidSchema)(o,n))return void e.fail();const i=r.name("valid");e.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},i),e.failResult(i,()=>e.reset(),()=>e.error())},error:{message:"must NOT be valid"}};e.default=r}}),require_anyOf=__commonJS({"node_modules/ajv/dist/vocabularies/applicator/anyOf.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var t={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:require_code2().validateUnion,error:{message:"must match a schema in anyOf"}};e.default=t}}),require_oneOf=__commonJS({"node_modules/ajv/dist/vocabularies/applicator/oneOf.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var t=require_codegen(),r=require_util(),n={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:{message:"must match exactly one schema in oneOf",params:({params:e})=>t._`{passingSchemas: ${e.passing}}`},code(e){const{gen:n,schema:o,parentSchema:i,it:s}=e;if(!Array.isArray(o))throw new Error("ajv implementation error");if(s.opts.discriminator&&i.discriminator)return;const a=o,c=n.let("valid",!1),u=n.let("passing",null),l=n.name("_valid");e.setParams({passing:u}),n.block(function(){a.forEach((o,i)=>{let a;(0,r.alwaysValidSchema)(s,o)?n.var(l,!0):a=e.subschema({keyword:"oneOf",schemaProp:i,compositeRule:!0},l),i>0&&n.if(t._`${l} && ${c}`).assign(c,!1).assign(u,t._`[${u}, ${i}]`).else(),n.if(l,()=>{n.assign(c,!0),n.assign(u,i),a&&e.mergeEvaluated(a,t.Name)})})}),e.result(c,()=>e.reset(),()=>e.error(!0))}};e.default=n}}),require_allOf=__commonJS({"node_modules/ajv/dist/vocabularies/applicator/allOf.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var t=require_util(),r={keyword:"allOf",schemaType:"array",code(e){const{gen:r,schema:n,it:o}=e;if(!Array.isArray(n))throw new Error("ajv implementation error");const i=r.name("valid");n.forEach((r,n)=>{if((0,t.alwaysValidSchema)(o,r))return;const s=e.subschema({keyword:"allOf",schemaProp:n},i);e.ok(i),e.mergeEvaluated(s)})}};e.default=r}}),require_if=__commonJS({"node_modules/ajv/dist/vocabularies/applicator/if.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var t=require_codegen(),r=require_util(),n={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:{message:({params:e})=>t.str`must match "${e.ifClause}" schema`,params:({params:e})=>t._`{failingKeyword: ${e.ifClause}}`},code(e){const{gen:n,parentSchema:i,it:s}=e;void 0===i.then&&void 0===i.else&&(0,r.checkStrictMode)(s,'"if" without "then" and "else" is ignored');const a=o(s,"then"),c=o(s,"else");if(!a&&!c)return;const u=n.let("valid",!0),l=n.name("_valid");if(function(){const t=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},l);e.mergeEvaluated(t)}(),e.reset(),a&&c){const t=n.let("ifClause");e.setParams({ifClause:t}),n.if(l,d("then",t),d("else",t))}else a?n.if(l,d("then")):n.if((0,t.not)(l),d("else"));function d(r,o){return()=>{const i=e.subschema({keyword:r},l);n.assign(u,l),e.mergeValidEvaluated(i,u),o?n.assign(o,t._`${r}`):e.setParams({ifClause:r})}}e.pass(u,()=>e.error(!0))}};function o(e,t){const n=e.schema[t];return void 0!==n&&!(0,r.alwaysValidSchema)(e,n)}e.default=n}}),require_thenElse=__commonJS({"node_modules/ajv/dist/vocabularies/applicator/thenElse.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var t=require_util(),r={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:r,it:n}){void 0===r.if&&(0,t.checkStrictMode)(n,`"${e}" without "if" is ignored`)}};e.default=r}}),require_applicator=__commonJS({"node_modules/ajv/dist/vocabularies/applicator/index.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var t=require_additionalItems(),r=require_prefixItems(),n=require_items(),o=require_items2020(),i=require_contains(),s=require_dependencies(),a=require_propertyNames(),c=require_additionalProperties(),u=require_properties(),l=require_patternProperties(),d=require_not(),f=require_anyOf(),h=require_oneOf(),p=require_allOf(),m=require_if(),y=require_thenElse();e.default=function(e=!1){const _=[d.default,f.default,h.default,p.default,m.default,y.default,a.default,c.default,s.default,u.default,l.default];return e?_.push(r.default,o.default):_.push(t.default,n.default),_.push(i.default),_}}}),require_format=__commonJS({"node_modules/ajv/dist/vocabularies/format/format.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var t=require_codegen(),r={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:{message:({schemaCode:e})=>t.str`must match format "${e}"`,params:({schemaCode:e})=>t._`{format: ${e}}`},code(e,r){const{gen:n,data:o,$data:i,schema:s,schemaCode:a,it:c}=e,{opts:u,errSchemaPath:l,schemaEnv:d,self:f}=c;u.validateFormats&&(i?function(){const i=n.scopeValue("formats",{ref:f.formats,code:u.code.formats}),s=n.const("fDef",t._`${i}[${a}]`),c=n.let("fType"),l=n.let("format");n.if(t._`typeof ${s} == "object" && !(${s} instanceof RegExp)`,()=>n.assign(c,t._`${s}.type || "string"`).assign(l,t._`${s}.validate`),()=>n.assign(c,t._`"string"`).assign(l,s)),e.fail$data((0,t.or)(!1===u.strictSchema?t.nil:t._`${a} && !${l}`,function(){const e=d.$async?t._`(${s}.async ? await ${l}(${o}) : ${l}(${o}))`:t._`${l}(${o})`,n=t._`(typeof ${l} == "function" ? ${e} : ${l}.test(${o}))`;return t._`${l} && ${l} !== true && ${c} === ${r} && !${n}`}()))}():function(){const i=f.formats[s];if(!i)return void function(){if(!1===u.strictSchema)return void f.logger.warn(e());throw new Error(e());function e(){return`unknown format "${s}" ignored in schema at path "${l}"`}}();if(!0===i)return;const[a,c,h]=function(e){const r=e instanceof RegExp?(0,t.regexpCode)(e):u.code.formats?t._`${u.code.formats}${(0,t.getProperty)(s)}`:void 0,o=n.scopeValue("formats",{key:s,ref:e,code:r});if("object"==typeof e&&!(e instanceof RegExp))return[e.type||"string",e.validate,t._`${o}.validate`];return["string",e,o]}(i);a===r&&e.pass(function(){if("object"==typeof i&&!(i instanceof RegExp)&&i.async){if(!d.$async)throw new Error("async format in sync schema");return t._`await ${h}(${o})`}return"function"==typeof c?t._`${h}(${o})`:t._`${h}.test(${o})`}())}())}};e.default=r}}),require_format2=__commonJS({"node_modules/ajv/dist/vocabularies/format/index.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var t=[require_format().default];e.default=t}}),require_metadata=__commonJS({"node_modules/ajv/dist/vocabularies/metadata.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.contentVocabulary=e.metadataVocabulary=void 0,e.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"],e.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]}}),require_draft7=__commonJS({"node_modules/ajv/dist/vocabularies/draft7.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var t=require_core2(),r=require_validation(),n=require_applicator(),o=require_format2(),i=require_metadata(),s=[t.default,r.default,(0,n.default)(),o.default,i.metadataVocabulary,i.contentVocabulary];e.default=s}}),require_types=__commonJS({"node_modules/ajv/dist/vocabularies/discriminator/types.js"(e){"use strict";var t;Object.defineProperty(e,"__esModule",{value:!0}),e.DiscrError=void 0,(t=e.DiscrError||(e.DiscrError={})).Tag="tag",t.Mapping="mapping"}}),require_discriminator=__commonJS({"node_modules/ajv/dist/vocabularies/discriminator/index.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var t=require_codegen(),r=require_types(),n=require_compile(),o=require_util(),i={keyword:"discriminator",type:"object",schemaType:"object",error:{message:({params:{discrError:e,tagName:t}})=>e===r.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:r,tagName:n}})=>t._`{error: ${e}, tag: ${n}, tagValue: ${r}}`},code(e){const{gen:i,data:s,schema:a,parentSchema:c,it:u}=e,{oneOf:l}=c;if(!u.opts.discriminator)throw new Error("discriminator: requires discriminator option");const d=a.propertyName;if("string"!=typeof d)throw new Error("discriminator: requires propertyName");if(a.mapping)throw new Error("discriminator: mapping is not supported");if(!l)throw new Error("discriminator: requires oneOf keyword");const f=i.let("valid",!1),h=i.const("tag",t._`${s}${(0,t.getProperty)(d)}`);function p(r){const n=i.name("valid"),o=e.subschema({keyword:"oneOf",schemaProp:r},n);return e.mergeEvaluated(o,t.Name),n}i.if(t._`typeof ${h} == "string"`,()=>function(){const s=function(){var e;const t={},r=s(c);let i=!0;for(let t=0;t<l.length;t++){let c=l[t];(null==c?void 0:c.$ref)&&!(0,o.schemaHasRulesButRef)(c,u.self.RULES)&&(c=n.resolveRef.call(u.self,u.schemaEnv.root,u.baseId,null==c?void 0:c.$ref),c instanceof n.SchemaEnv&&(c=c.schema));const f=null===(e=null==c?void 0:c.properties)||void 0===e?void 0:e[d];if("object"!=typeof f)throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${d}"`);i=i&&(r||s(c)),a(f,t)}if(!i)throw new Error(`discriminator: "${d}" must be required`);return t;function s({required:e}){return Array.isArray(e)&&e.includes(d)}function a(e,t){if(e.const)f(e.const,t);else{if(!e.enum)throw new Error(`discriminator: "properties/${d}" must have "const" or "enum"`);for(const r of e.enum)f(r,t)}}function f(e,r){if("string"!=typeof e||e in t)throw new Error(`discriminator: "${d}" values must be unique strings`);t[e]=r}}();i.if(!1);for(const e in s)i.elseIf(t._`${h} === ${e}`),i.assign(f,p(s[e]));i.else(),e.error(!1,{discrError:r.DiscrError.Mapping,tag:h,tagName:d}),i.endIf()}(),()=>e.error(!1,{discrError:r.DiscrError.Tag,tag:h,tagName:d})),e.ok(f)}};e.default=i}}),require_json_schema_draft_07=__commonJS({"node_modules/ajv/dist/refs/json-schema-draft-07.json"(e,t){t.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0}}}),require_ajv=__commonJS({"node_modules/ajv/dist/ajv.js"(e,t){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=void 0;var r=require_core(),n=require_draft7(),o=require_discriminator(),i=require_json_schema_draft_07(),s=["/properties"],a="http://json-schema.org/draft-07/schema",c=class extends r.default{_addVocabularies(){super._addVocabularies(),n.default.forEach(e=>this.addVocabulary(e)),this.opts.discriminator&&this.addKeyword(o.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;const e=this.opts.$data?this.$dataMetaSchema(i,s):i;this.addMetaSchema(e,a,!1),this.refs["http://json-schema.org/schema"]=a}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(a)?a:void 0)}};t.exports=e=c,Object.defineProperty(e,"__esModule",{value:!0}),e.default=c;var u=require_validate();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return u.KeywordCxt}});var l=require_codegen();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return l._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return l.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return l.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return l.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return l.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return l.CodeGen}})}});init_base58();var varint=__toModule(require_varint()),import_tweetnacl=__toModule(require_nacl_fast()),TagChain="chain",TagSolanaCluster="solanaCluster",TagMintingAgent="mintingAgent",TagMintingAgentVersion="agentVersion",DEFAULT_CLUSTER="devnet",MulticodecEd25519Pubkey=varint.encode(237);function MetaplexAuthWithSigner(e,t,r){const n=r.solanaCluster||DEFAULT_CLUSTER,{mintingAgent:o,agentVersion:i}=r;if(!o)throw new Error('required option "mintingAgent" not provided');return{chain:"solana",solanaCluster:n,mintingAgent:o,agentVersion:i,signMessage:e,publicKey:t}}function MetaplexAuthWithSecretKey(e,t){const{publicKey:r,secretKey:n}=import_tweetnacl.default.sign.keyPair.fromSecretKey(e);return MetaplexAuthWithSigner(async e=>import_tweetnacl.default.sign.detached(e,n),r,t)}async function makeMetaplexUploadToken(e,t){const r={put:{rootCID:t,tags:{[TagChain]:e.chain,[TagSolanaCluster]:e.solanaCluster,[TagMintingAgent]:e.mintingAgent,[TagMintingAgentVersion]:e.agentVersion}}},n={iss:keyDID(e.publicKey),req:r},o=objectToB64URL({alg:"EdDSA",typ:"JWT"})+"."+objectToB64URL(n),i=(new TextEncoder).encode(o);return o+"."+b64urlEncode(await e.signMessage(i))}function keyDID(e){const t=new Uint8Array([...MulticodecEd25519Pubkey,...e]);return`did:key:${base58btc.encode(t)}`}function objectToB64URL(e){return b64urlEncode((new TextEncoder).encode(JSON.stringify(e)))}function b64urlEncode(e){return b64Encode(e).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function b64Encode(e){return void 0!==Buffer?Buffer.from(e).toString("base64"):btoa(String.fromCharCode.apply(null,[...e]))}var TIMEOUT=Symbol("TIMEOUT");function getIterator(e){if("function"==typeof e.next)return e;if("function"==typeof e[Symbol.iterator])return e[Symbol.iterator]();if("function"==typeof e[Symbol.asyncIterator])return e[Symbol.asyncIterator]();throw new TypeError('"values" does not to conform to any of the iterator or iterable protocols')}function defer(){let e,t;return{promise:new Promise((r,n)=>{t=r,e=n}),reject:e,resolve:t}}function _transform(e,t,r){const n=getIterator(r),o=[],i=[];let s=!1,a=!1,c=0,u=null;function l(){for(;i.length>0&&o.length>0;){const{resolve:e}=i.shift();e({done:!1,value:o.shift()})}for(;i.length>0&&0===c&&s;){const{resolve:e,reject:t}=i.shift();u?(t(u),u=null):e({done:!0,value:void 0})}}async function d(){if(s)l();else if(!(a||c+o.length>=e)){a=!0,c++;try{const{done:e,value:r}=await n.next();e?(s=!0,c--,l()):async function(e){try{const r=await t(e);o.push(r)}catch(e){s=!0,u=e}c--,l(),d()}(r)}catch(e){s=!0,c--,u=e,l()}a=!1,d()}}const f={next:async function(){if(0===o.length){const e=defer();return i.push(e),d(),e.promise}const e=o.shift();return d(),{done:!1,value:e}},[Symbol.asyncIterator]:()=>f};return f}function transform(e,t,r){return void 0===t?(t,r)=>r?transform(e,t,r):transform(e,t):void 0===r?r=>transform(e,t,r):_transform(e,t,r)}var import_p_retry=__toModule(require_p_retry()),import_varint2=__toModule(require_varint());init_cid(),init_digest();var typeofs=["string","number","bigint","symbol"],objectTypeNames=["Function","Generator","AsyncGenerator","GeneratorFunction","AsyncGeneratorFunction","AsyncFunction","Observable","Array","Buffer","Object","RegExp","Date","Error","Map","Set","WeakMap","WeakSet","ArrayBuffer","SharedArrayBuffer","DataView","Promise","URL","HTMLElement","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Uint16Array","Int32Array","Uint32Array","Float32Array","Float64Array","BigInt64Array","BigUint64Array"];function is(e){if(null===e)return"null";if(void 0===e)return"undefined";if(!0===e||!1===e)return"boolean";const t=typeof e;if(typeofs.includes(t))return t;if("function"===t)return"Function";if(Array.isArray(e))return"Array";if(isBuffer(e))return"Buffer";const r=getObjectType(e);return r||"Object"}function isBuffer(e){return e&&e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer.call(null,e)}function getObjectType(e){const t=Object.prototype.toString.call(e).slice(8,-1);if(objectTypeNames.includes(t))return t}var Type=class{constructor(e,t,r){this.major=e,this.majorEncoded=e<<5,this.name=t,this.terminal=r}toString(){return`Type[${this.major}].${this.name}`}compare(e){return this.major<e.major?-1:this.major>e.major?1:0}};Type.uint=new Type(0,"uint",!0),Type.negint=new Type(1,"negint",!0),Type.bytes=new Type(2,"bytes",!0),Type.string=new Type(3,"string",!0),Type.array=new Type(4,"array",!1),Type.map=new Type(5,"map",!1),Type.tag=new Type(6,"tag",!1),Type.float=new Type(7,"float",!0),Type.false=new Type(7,"false",!0),Type.true=new Type(7,"true",!0),Type.null=new Type(7,"null",!0),Type.undefined=new Type(7,"undefined",!0),Type.break=new Type(7,"break",!0);var Token=class{constructor(e,t,r){this.type=e,this.value=t,this.encodedLength=r,this.encodedBytes=void 0,this.byteValue=void 0}toString(){return`Token[${this.type}].${this.value}`}},useBuffer=globalThis.process&&!globalThis.process.browser&&globalThis.Buffer&&"function"==typeof globalThis.Buffer.isBuffer,textDecoder=new TextDecoder,textEncoder=new TextEncoder;function isBuffer2(e){return useBuffer&&globalThis.Buffer.isBuffer(e)}function asU8A(e){return e instanceof Uint8Array?isBuffer2(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e:Uint8Array.from(e)}var toString2=useBuffer?(e,t,r)=>r-t>64?globalThis.Buffer.from(e.subarray(t,r)).toString("utf8"):utf8Slice(e,t,r):(e,t,r)=>r-t>64?textDecoder.decode(e.subarray(t,r)):utf8Slice(e,t,r),fromString2=useBuffer?e=>e.length>64?globalThis.Buffer.from(e):utf8ToBytes(e):e=>e.length>64?textEncoder.encode(e):utf8ToBytes(e),fromArray=e=>Uint8Array.from(e),slice=useBuffer?(e,t,r)=>isBuffer2(e)?new Uint8Array(e.subarray(t,r)):e.slice(t,r):(e,t,r)=>e.slice(t,r),concat=useBuffer?(e,t)=>(e=e.map(e=>e instanceof Uint8Array?e:globalThis.Buffer.from(e)),asU8A(globalThis.Buffer.concat(e,t))):(e,t)=>{const r=new Uint8Array(t);let n=0;for(let t of e)n+t.length>r.length&&(t=t.subarray(0,r.length-n)),r.set(t,n),n+=t.length;return r},alloc=useBuffer?e=>globalThis.Buffer.allocUnsafe(e):e=>new Uint8Array(e);function compare(e,t){if(isBuffer2(e)&&isBuffer2(t))return e.compare(t);for(let r=0;r<e.length;r++)if(e[r]!==t[r])return e[r]<t[r]?-1:1;return 0}function utf8ToBytes(e,t=1/0){let r;const n=e.length;let o=null;const i=[];for(let s=0;s<n;++s){if(r=e.charCodeAt(s),r>55295&&r<57344){if(!o){if(r>56319){(t-=3)>-1&&i.push(239,191,189);continue}if(s+1===n){(t-=3)>-1&&i.push(239,191,189);continue}o=r;continue}if(r<56320){(t-=3)>-1&&i.push(239,191,189),o=r;continue}r=65536+(o-55296<<10|r-56320)}else o&&(t-=3)>-1&&i.push(239,191,189);if(o=null,r<128){if((t-=1)<0)break;i.push(r)}else if(r<2048){if((t-=2)<0)break;i.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;i.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return i}function utf8Slice(e,t,r){const n=[];for(;t<r;){const o=e[t];let i=null,s=o>239?4:o>223?3:o>191?2:1;if(t+s<=r){let r,n,a,c;switch(s){case 1:o<128&&(i=o);break;case 2:r=e[t+1],128==(192&r)&&(c=(31&o)<<6|63&r,c>127&&(i=c));break;case 3:r=e[t+1],n=e[t+2],128==(192&r)&&128==(192&n)&&(c=(15&o)<<12|(63&r)<<6|63&n,c>2047&&(c<55296||c>57343)&&(i=c));break;case 4:r=e[t+1],n=e[t+2],a=e[t+3],128==(192&r)&&128==(192&n)&&128==(192&a)&&(c=(15&o)<<18|(63&r)<<12|(63&n)<<6|63&a,c>65535&&c<1114112&&(i=c))}}null===i?(i=65533,s=1):i>65535&&(i-=65536,n.push(i>>>10&1023|55296),i=56320|1023&i),n.push(i),t+=s}return decodeCodePointsArray(n)}var MAX_ARGUMENTS_LENGTH=4096;function decodeCodePointsArray(e){const t=e.length;if(t<=MAX_ARGUMENTS_LENGTH)return String.fromCharCode.apply(String,e);let r="",n=0;for(;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=MAX_ARGUMENTS_LENGTH));return r}var defaultChunkSize=256,Bl=class{constructor(e=defaultChunkSize){this.chunkSize=e,this.cursor=0,this.maxCursor=-1,this.chunks=[],this._initReuseChunk=null}reset(){this.cursor=0,this.maxCursor=-1,this.chunks.length&&(this.chunks=[]),null!==this._initReuseChunk&&(this.chunks.push(this._initReuseChunk),this.maxCursor=this._initReuseChunk.length-1)}push(e){let t=this.chunks[this.chunks.length-1];if(this.cursor+e.length<=this.maxCursor+1){const r=t.length-(this.maxCursor-this.cursor)-1;t.set(e,r)}else{if(t){const e=t.length-(this.maxCursor-this.cursor)-1;e<t.length&&(this.chunks[this.chunks.length-1]=t.subarray(0,e),this.maxCursor=this.cursor-1)}e.length<64&&e.length<this.chunkSize?(t=alloc(this.chunkSize),this.chunks.push(t),this.maxCursor+=t.length,null===this._initReuseChunk&&(this._initReuseChunk=t),t.set(e,0)):(this.chunks.push(e),this.maxCursor+=e.length)}this.cursor+=e.length}toBytes(e=!1){let t;if(1===this.chunks.length){const r=this.chunks[0];e&&this.cursor>r.length/2?(t=this.cursor===r.length?r:r.subarray(0,this.cursor),this._initReuseChunk=null,this.chunks=[]):t=slice(r,0,this.cursor)}else t=concat(this.chunks,this.cursor);return e&&this.reset(),t}},decodeErrPrefix="CBOR decode error:",encodeErrPrefix="CBOR encode error:",uintMinorPrefixBytes=[];function assertEnoughData(e,t,r){if(e.length-t<r)throw new Error(`${decodeErrPrefix} not enough data for type`)}uintMinorPrefixBytes[23]=1,uintMinorPrefixBytes[24]=2,uintMinorPrefixBytes[25]=3,uintMinorPrefixBytes[26]=5,uintMinorPrefixBytes[27]=9;var uintBoundaries=[24,256,65536,4294967296,BigInt("18446744073709551616")];function readUint8(e,t,r){assertEnoughData(e,t,1);const n=e[t];if(!0===r.strict&&n<uintBoundaries[0])throw new Error(`${decodeErrPrefix} integer encoded in more bytes than necessary (strict decode)`);return n}function readUint16(e,t,r){assertEnoughData(e,t,2);const n=e[t]<<8|e[t+1];if(!0===r.strict&&n<uintBoundaries[1])throw new Error(`${decodeErrPrefix} integer encoded in more bytes than necessary (strict decode)`);return n}function readUint32(e,t,r){assertEnoughData(e,t,4);const n=16777216*e[t]+(e[t+1]<<16)+(e[t+2]<<8)+e[t+3];if(!0===r.strict&&n<uintBoundaries[2])throw new Error(`${decodeErrPrefix} integer encoded in more bytes than necessary (strict decode)`);return n}function readUint64(e,t,r){assertEnoughData(e,t,8);const n=16777216*e[t]+(e[t+1]<<16)+(e[t+2]<<8)+e[t+3],o=16777216*e[t+4]+(e[t+5]<<16)+(e[t+6]<<8)+e[t+7],i=(BigInt(n)<<BigInt(32))+BigInt(o);if(!0===r.strict&&i<uintBoundaries[3])throw new Error(`${decodeErrPrefix} integer encoded in more bytes than necessary (strict decode)`);if(i<=Number.MAX_SAFE_INTEGER)return Number(i);if(!0===r.allowBigInt)return i;throw new Error(`${decodeErrPrefix} integers outside of the safe integer range are not supported`)}function decodeUint8(e,t,r,n){return new Token(Type.uint,readUint8(e,t+1,n),2)}function decodeUint16(e,t,r,n){return new Token(Type.uint,readUint16(e,t+1,n),3)}function decodeUint32(e,t,r,n){return new Token(Type.uint,readUint32(e,t+1,n),5)}function decodeUint64(e,t,r,n){return new Token(Type.uint,readUint64(e,t+1,n),9)}function encodeUint(e,t){return encodeUintValue(e,0,t.value)}function encodeUintValue(e,t,r){if(r<uintBoundaries[0]){const n=Number(r);e.push([t|n])}else if(r<uintBoundaries[1]){const n=Number(r);e.push([24|t,n])}else if(r<uintBoundaries[2]){const n=Number(r);e.push([25|t,n>>>8,255&n])}else if(r<uintBoundaries[3]){const n=Number(r);e.push([26|t,n>>>24&255,n>>>16&255,n>>>8&255,255&n])}else{const n=BigInt(r);if(!(n<uintBoundaries[4]))throw new Error(`${decodeErrPrefix} encountered BigInt larger than allowable range`);{const r=[27|t,0,0,0,0,0,0,0];let o=Number(n&BigInt(4294967295)),i=Number(n>>BigInt(32)&BigInt(4294967295));r[8]=255&o,o>>=8,r[7]=255&o,o>>=8,r[6]=255&o,o>>=8,r[5]=255&o,r[4]=255&i,i>>=8,r[3]=255&i,i>>=8,r[2]=255&i,i>>=8,r[1]=255&i,e.push(r)}}}function decodeNegint8(e,t,r,n){return new Token(Type.negint,-1-readUint8(e,t+1,n),2)}function decodeNegint16(e,t,r,n){return new Token(Type.negint,-1-readUint16(e,t+1,n),3)}function decodeNegint32(e,t,r,n){return new Token(Type.negint,-1-readUint32(e,t+1,n),5)}encodeUint.encodedSize=function(e){return encodeUintValue.encodedSize(e.value)},encodeUintValue.encodedSize=function(e){return e<uintBoundaries[0]?1:e<uintBoundaries[1]?2:e<uintBoundaries[2]?3:e<uintBoundaries[3]?5:9},encodeUint.compareTokens=function(e,t){return e.value<t.value?-1:e.value>t.value?1:0};var neg1b=BigInt(-1),pos1b=BigInt(1);function decodeNegint64(e,t,r,n){const o=readUint64(e,t+1,n);if("bigint"!=typeof o){const e=-1-o;if(e>=Number.MIN_SAFE_INTEGER)return new Token(Type.negint,e,9)}if(!0!==n.allowBigInt)throw new Error(`${decodeErrPrefix} integers outside of the safe integer range are not supported`);return new Token(Type.negint,neg1b-BigInt(o),9)}function encodeNegint(e,t){const r=t.value,n="bigint"==typeof r?r*neg1b-pos1b:-1*r-1;encodeUintValue(e,t.type.majorEncoded,n)}function toToken(e,t,r,n){assertEnoughData(e,t,r+n);const o=slice(e,t+r,t+r+n);return new Token(Type.bytes,o,r+n)}function decodeBytesCompact(e,t,r,n){return toToken(e,t,1,r)}function decodeBytes8(e,t,r,n){return toToken(e,t,2,readUint8(e,t+1,n))}function decodeBytes16(e,t,r,n){return toToken(e,t,3,readUint16(e,t+1,n))}function decodeBytes32(e,t,r,n){return toToken(e,t,5,readUint32(e,t+1,n))}function decodeBytes64(e,t,r,n){const o=readUint64(e,t+1,n);if("bigint"==typeof o)throw new Error(`${decodeErrPrefix} 64-bit integer bytes lengths not supported`);return toToken(e,t,9,o)}function tokenBytes(e){return void 0===e.encodedBytes&&(e.encodedBytes=e.type===Type.string?fromString2(e.value):e.value),e.encodedBytes}function encodeBytes(e,t){const r=tokenBytes(t);encodeUintValue(e,t.type.majorEncoded,r.length),e.push(r)}function compareBytes(e,t){return e.length<t.length?-1:e.length>t.length?1:compare(e,t)}function toToken2(e,t,r,n,o){const i=r+n;assertEnoughData(e,t,i);const s=new Token(Type.string,toString2(e,t+r,t+i),i);return!0===o.retainStringBytes&&(s.byteValue=slice(e,t+r,t+i)),s}function decodeStringCompact(e,t,r,n){return toToken2(e,t,1,r,n)}function decodeString8(e,t,r,n){return toToken2(e,t,2,readUint8(e,t+1,n),n)}function decodeString16(e,t,r,n){return toToken2(e,t,3,readUint16(e,t+1,n),n)}function decodeString32(e,t,r,n){return toToken2(e,t,5,readUint32(e,t+1,n),n)}function decodeString64(e,t,r,n){const o=readUint64(e,t+1,n);if("bigint"==typeof o)throw new Error(`${decodeErrPrefix} 64-bit integer string lengths not supported`);return toToken2(e,t,9,o,n)}encodeNegint.encodedSize=function(e){const t=e.value,r="bigint"==typeof t?t*neg1b-pos1b:-1*t-1;return r<uintBoundaries[0]?1:r<uintBoundaries[1]?2:r<uintBoundaries[2]?3:r<uintBoundaries[3]?5:9},encodeNegint.compareTokens=function(e,t){return e.value<t.value?1:e.value>t.value?-1:0},encodeBytes.encodedSize=function(e){const t=tokenBytes(e);return encodeUintValue.encodedSize(t.length)+t.length},encodeBytes.compareTokens=function(e,t){return compareBytes(tokenBytes(e),tokenBytes(t))};var encodeString=encodeBytes;function toToken3(e,t,r,n){return new Token(Type.array,n,r)}function decodeArrayCompact(e,t,r,n){return toToken3(e,t,1,r)}function decodeArray8(e,t,r,n){return toToken3(e,t,2,readUint8(e,t+1,n))}function decodeArray16(e,t,r,n){return toToken3(e,t,3,readUint16(e,t+1,n))}function decodeArray32(e,t,r,n){return toToken3(e,t,5,readUint32(e,t+1,n))}function decodeArray64(e,t,r,n){const o=readUint64(e,t+1,n);if("bigint"==typeof o)throw new Error(`${decodeErrPrefix} 64-bit integer array lengths not supported`);return toToken3(e,t,9,o)}function decodeArrayIndefinite(e,t,r,n){if(!1===n.allowIndefinite)throw new Error(`${decodeErrPrefix} indefinite length items not allowed`);return toToken3(e,t,1,1/0)}function encodeArray(e,t){encodeUintValue(e,Type.array.majorEncoded,t.value)}function toToken4(e,t,r,n){return new Token(Type.map,n,r)}function decodeMapCompact(e,t,r,n){return toToken4(e,t,1,r)}function decodeMap8(e,t,r,n){return toToken4(e,t,2,readUint8(e,t+1,n))}function decodeMap16(e,t,r,n){return toToken4(e,t,3,readUint16(e,t+1,n))}function decodeMap32(e,t,r,n){return toToken4(e,t,5,readUint32(e,t+1,n))}function decodeMap64(e,t,r,n){const o=readUint64(e,t+1,n);if("bigint"==typeof o)throw new Error(`${decodeErrPrefix} 64-bit integer map lengths not supported`);return toToken4(e,t,9,o)}function decodeMapIndefinite(e,t,r,n){if(!1===n.allowIndefinite)throw new Error(`${decodeErrPrefix} indefinite length items not allowed`);return toToken4(e,t,1,1/0)}function encodeMap(e,t){encodeUintValue(e,Type.map.majorEncoded,t.value)}function decodeTagCompact(e,t,r,n){return new Token(Type.tag,r,1)}function decodeTag8(e,t,r,n){return new Token(Type.tag,readUint8(e,t+1,n),2)}function decodeTag16(e,t,r,n){return new Token(Type.tag,readUint16(e,t+1,n),3)}function decodeTag32(e,t,r,n){return new Token(Type.tag,readUint32(e,t+1,n),5)}function decodeTag64(e,t,r,n){return new Token(Type.tag,readUint64(e,t+1,n),9)}function encodeTag(e,t){encodeUintValue(e,Type.tag.majorEncoded,t.value)}encodeArray.compareTokens=encodeUint.compareTokens,encodeArray.encodedSize=function(e){return encodeUintValue.encodedSize(e.value)},encodeMap.compareTokens=encodeUint.compareTokens,encodeMap.encodedSize=function(e){return encodeUintValue.encodedSize(e.value)},encodeTag.compareTokens=encodeUint.compareTokens,encodeTag.encodedSize=function(e){return encodeUintValue.encodedSize(e.value)};var MINOR_FALSE=20,MINOR_TRUE=21,MINOR_NULL=22,MINOR_UNDEFINED=23;function decodeUndefined(e,t,r,n){if(!1===n.allowUndefined)throw new Error(`${decodeErrPrefix} undefined values are not supported`);return!0===n.coerceUndefinedToNull?new Token(Type.null,null,1):new Token(Type.undefined,void 0,1)}function decodeBreak(e,t,r,n){if(!1===n.allowIndefinite)throw new Error(`${decodeErrPrefix} indefinite length items not allowed`);return new Token(Type.break,void 0,1)}function createToken(e,t,r){if(r){if(!1===r.allowNaN&&Number.isNaN(e))throw new Error(`${decodeErrPrefix} NaN values are not supported`);if(!1===r.allowInfinity&&(e===1/0||e===-1/0))throw new Error(`${decodeErrPrefix} Infinity values are not supported`)}return new Token(Type.float,e,t)}function decodeFloat16(e,t,r,n){return createToken(readFloat16(e,t+1),3,n)}function decodeFloat32(e,t,r,n){return createToken(readFloat32(e,t+1),5,n)}function decodeFloat64(e,t,r,n){return createToken(readFloat64(e,t+1),9,n)}function encodeFloat(e,t,r){const n=t.value;if(!1===n)e.push([Type.float.majorEncoded|MINOR_FALSE]);else if(!0===n)e.push([Type.float.majorEncoded|MINOR_TRUE]);else if(null===n)e.push([Type.float.majorEncoded|MINOR_NULL]);else if(void 0===n)e.push([Type.float.majorEncoded|MINOR_UNDEFINED]);else{let t,o=!1;r&&!0===r.float64||(encodeFloat16(n),t=readFloat16(ui8a,1),n===t||Number.isNaN(n)?(ui8a[0]=249,e.push(ui8a.slice(0,3)),o=!0):(encodeFloat32(n),t=readFloat32(ui8a,1),n===t&&(ui8a[0]=250,e.push(ui8a.slice(0,5)),o=!0))),o||(encodeFloat64(n),t=readFloat64(ui8a,1),ui8a[0]=251,e.push(ui8a.slice(0,9)))}}encodeFloat.encodedSize=function(e,t){const r=e.value;if(!1===r||!0===r||null==r)return 1;if(!t||!0!==t.float64){encodeFloat16(r);let e=readFloat16(ui8a,1);if(r===e||Number.isNaN(r))return 3;if(encodeFloat32(r),e=readFloat32(ui8a,1),r===e)return 5}return 9};var buffer=new ArrayBuffer(9),dataView=new DataView(buffer,1),ui8a=new Uint8Array(buffer,0);function encodeFloat16(e){if(e===1/0)dataView.setUint16(0,31744,!1);else if(e===-1/0)dataView.setUint16(0,64512,!1);else if(Number.isNaN(e))dataView.setUint16(0,32256,!1);else{dataView.setFloat32(0,e);const t=dataView.getUint32(0),r=(2139095040&t)>>23,n=8388607&t;if(255===r)dataView.setUint16(0,31744,!1);else if(0===r)dataView.setUint16(0,(2147483648&e)>>16|n>>13,!1);else{const e=r-127;e<-24?dataView.setUint16(0,0):e<-14?dataView.setUint16(0,(2147483648&t)>>16|1<<24+e,!1):dataView.setUint16(0,(2147483648&t)>>16|e+15<<10|n>>13,!1)}}}function readFloat16(e,t){if(e.length-t<2)throw new Error(`${decodeErrPrefix} not enough data for float16`);const r=(e[t]<<8)+e[t+1];if(31744===r)return 1/0;if(64512===r)return-1/0;if(32256===r)return NaN;const n=r>>10&31,o=1023&r;let i;return i=0===n?o*2**-24:31!==n?(o+1024)*2**(n-25):0===o?1/0:NaN,32768&r?-i:i}function encodeFloat32(e){dataView.setFloat32(0,e,!1)}function readFloat32(e,t){if(e.length-t<4)throw new Error(`${decodeErrPrefix} not enough data for float32`);const r=(e.byteOffset||0)+t;return new DataView(e.buffer,r,4).getFloat32(0,!1)}function encodeFloat64(e){dataView.setFloat64(0,e,!1)}function readFloat64(e,t){if(e.length-t<8)throw new Error(`${decodeErrPrefix} not enough data for float64`);const r=(e.byteOffset||0)+t;return new DataView(e.buffer,r,8).getFloat64(0,!1)}function invalidMinor(e,t,r){throw new Error(`${decodeErrPrefix} encountered invalid minor (${r}) for major ${e[t]>>>5}`)}function errorer(e){return()=>{throw new Error(`${decodeErrPrefix} ${e}`)}}encodeFloat.compareTokens=encodeUint.compareTokens;var jump=[];for(let e=0;e<=23;e++)jump[e]=invalidMinor;jump[24]=decodeUint8,jump[25]=decodeUint16,jump[26]=decodeUint32,jump[27]=decodeUint64,jump[28]=invalidMinor,jump[29]=invalidMinor,jump[30]=invalidMinor,jump[31]=invalidMinor;for(let e=32;e<=55;e++)jump[e]=invalidMinor;jump[56]=decodeNegint8,jump[57]=decodeNegint16,jump[58]=decodeNegint32,jump[59]=decodeNegint64,jump[60]=invalidMinor,jump[61]=invalidMinor,jump[62]=invalidMinor,jump[63]=invalidMinor;for(let e=64;e<=87;e++)jump[e]=decodeBytesCompact;jump[88]=decodeBytes8,jump[89]=decodeBytes16,jump[90]=decodeBytes32,jump[91]=decodeBytes64,jump[92]=invalidMinor,jump[93]=invalidMinor,jump[94]=invalidMinor,jump[95]=errorer("indefinite length bytes/strings are not supported");for(let e=96;e<=119;e++)jump[e]=decodeStringCompact;jump[120]=decodeString8,jump[121]=decodeString16,jump[122]=decodeString32,jump[123]=decodeString64,jump[124]=invalidMinor,jump[125]=invalidMinor,jump[126]=invalidMinor,jump[127]=errorer("indefinite length bytes/strings are not supported");for(let e=128;e<=151;e++)jump[e]=decodeArrayCompact;jump[152]=decodeArray8,jump[153]=decodeArray16,jump[154]=decodeArray32,jump[155]=decodeArray64,jump[156]=invalidMinor,jump[157]=invalidMinor,jump[158]=invalidMinor,jump[159]=decodeArrayIndefinite;for(let e=160;e<=183;e++)jump[e]=decodeMapCompact;jump[184]=decodeMap8,jump[185]=decodeMap16,jump[186]=decodeMap32,jump[187]=decodeMap64,jump[188]=invalidMinor,jump[189]=invalidMinor,jump[190]=invalidMinor,jump[191]=decodeMapIndefinite;for(let e=192;e<=215;e++)jump[e]=decodeTagCompact;jump[216]=decodeTag8,jump[217]=decodeTag16,jump[218]=decodeTag32,jump[219]=decodeTag64,jump[220]=invalidMinor,jump[221]=invalidMinor,jump[222]=invalidMinor,jump[223]=invalidMinor;for(let e=224;e<=243;e++)jump[e]=errorer("simple values are not supported");jump[244]=invalidMinor,jump[245]=invalidMinor,jump[246]=invalidMinor,jump[247]=decodeUndefined,jump[248]=errorer("simple values are not supported"),jump[249]=decodeFloat16,jump[250]=decodeFloat32,jump[251]=decodeFloat64,jump[252]=invalidMinor,jump[253]=invalidMinor,jump[254]=invalidMinor,jump[255]=decodeBreak;var quick=[];for(let e=0;e<24;e++)quick[e]=new Token(Type.uint,e,1);for(let e=-1;e>=-24;e--)quick[31-e]=new Token(Type.negint,e,1);function quickEncodeToken(e){switch(e.type){case Type.false:return fromArray([244]);case Type.true:return fromArray([245]);case Type.null:return fromArray([246]);case Type.bytes:return e.value.length?void 0:fromArray([64]);case Type.string:return""===e.value?fromArray([96]):void 0;case Type.array:return 0===e.value?fromArray([128]):void 0;case Type.map:return 0===e.value?fromArray([160]):void 0;case Type.uint:return e.value<24?fromArray([Number(e.value)]):void 0;case Type.negint:if(e.value>=-24)return fromArray([31-Number(e.value)])}}quick[64]=new Token(Type.bytes,new Uint8Array(0),1),quick[96]=new Token(Type.string,"",1),quick[128]=new Token(Type.array,0,1),quick[160]=new Token(Type.map,0,1),quick[244]=new Token(Type.false,!1,1),quick[245]=new Token(Type.true,!0,1),quick[246]=new Token(Type.null,null,1);var defaultEncodeOptions={float64:!1,mapSorter:mapSorter,quickEncodeToken:quickEncodeToken};function makeCborEncoders(){const e=[];return e[Type.uint.major]=encodeUint,e[Type.negint.major]=encodeNegint,e[Type.bytes.major]=encodeBytes,e[Type.string.major]=encodeString,e[Type.array.major]=encodeArray,e[Type.map.major]=encodeMap,e[Type.tag.major]=encodeTag,e[Type.float.major]=encodeFloat,e}var cborEncoders=makeCborEncoders(),buf=new Bl,Ref=class{constructor(e,t){this.obj=e,this.parent=t}includes(e){let t=this;do{if(t.obj===e)return!0}while(t=t.parent);return!1}static createCheck(e,t){if(e&&e.includes(t))throw new Error(`${encodeErrPrefix} object contains circular references`);return new Ref(t,e)}},simpleTokens={null:new Token(Type.null,null),undefined:new Token(Type.undefined,void 0),true:new Token(Type.true,!0),false:new Token(Type.false,!1),emptyArray:new Token(Type.array,0),emptyMap:new Token(Type.map,0)},typeEncoders={number:(e,t,r,n)=>Number.isInteger(e)&&Number.isSafeInteger(e)?new Token(e>=0?Type.uint:Type.negint,e):new Token(Type.float,e),bigint:(e,t,r,n)=>e>=BigInt(0)?new Token(Type.uint,e):new Token(Type.negint,e),Uint8Array:(e,t,r,n)=>new Token(Type.bytes,e),string:(e,t,r,n)=>new Token(Type.string,e),boolean:(e,t,r,n)=>e?simpleTokens.true:simpleTokens.false,null:(e,t,r,n)=>simpleTokens.null,undefined:(e,t,r,n)=>simpleTokens.undefined,ArrayBuffer:(e,t,r,n)=>new Token(Type.bytes,new Uint8Array(e)),DataView:(e,t,r,n)=>new Token(Type.bytes,new Uint8Array(e.buffer,e.byteOffset,e.byteLength)),Array(e,t,r,n){if(!e.length)return!0===r.addBreakTokens?[simpleTokens.emptyArray,new Token(Type.break)]:simpleTokens.emptyArray;n=Ref.createCheck(n,e);const o=[];let i=0;for(const t of e)o[i++]=objectToTokens(t,r,n);return r.addBreakTokens?[new Token(Type.array,e.length),o,new Token(Type.break)]:[new Token(Type.array,e.length),o]},Object(e,t,r,n){const o="Object"!==t,i=o?e.keys():Object.keys(e),s=o?e.size:i.length;if(!s)return!0===r.addBreakTokens?[simpleTokens.emptyMap,new Token(Type.break)]:simpleTokens.emptyMap;n=Ref.createCheck(n,e);const a=[];let c=0;for(const t of i)a[c++]=[objectToTokens(t,r,n),objectToTokens(o?e.get(t):e[t],r,n)];return sortMapEntries(a,r),r.addBreakTokens?[new Token(Type.map,s),a,new Token(Type.break)]:[new Token(Type.map,s),a]}};typeEncoders.Map=typeEncoders.Object,typeEncoders.Buffer=typeEncoders.Uint8Array;for(const e of"Uint8Clamped Uint16 Uint32 Int8 Int16 Int32 BigUint64 BigInt64 Float32 Float64".split(" "))typeEncoders[`${e}Array`]=typeEncoders.DataView;function objectToTokens(e,t={},r){const n=is(e),o=t&&t.typeEncoders&&t.typeEncoders[n]||typeEncoders[n];if("function"==typeof o){const i=o(e,n,t,r);if(null!=i)return i}const i=typeEncoders[n];if(!i)throw new Error(`${encodeErrPrefix} unsupported type: ${n}`);return i(e,n,t,r)}function sortMapEntries(e,t){t.mapSorter&&e.sort(t.mapSorter)}function mapSorter(e,t){const r=Array.isArray(e[0])?e[0][0]:e[0],n=Array.isArray(t[0])?t[0][0]:t[0];if(r.type!==n.type)return r.type.compare(n.type);const o=r.type.major,i=cborEncoders[o].compareTokens(r,n);return 0===i&&console.warn("WARNING: complex key types used, CBOR key sorting guarantees are gone"),i}function tokensToEncoded(e,t,r,n){if(Array.isArray(t))for(const o of t)tokensToEncoded(e,o,r,n);else r[t.type.major](e,t,n)}function encodeCustom(e,t,r){const n=objectToTokens(e,r);if(!Array.isArray(n)&&r.quickEncodeToken){const e=r.quickEncodeToken(n);if(e)return e;const o=t[n.type.major];if(o.encodedSize){const e=o.encodedSize(n,r),t=new Bl(e);if(o(t,n,r),1!==t.chunks.length)throw new Error(`Unexpected error: pre-calculated length for ${n} was wrong`);return asU8A(t.chunks[0])}}return buf.reset(),tokensToEncoded(buf,n,t,r),buf.toBytes(!0)}function encode4(e,t){return t=Object.assign({},defaultEncodeOptions,t),encodeCustom(e,cborEncoders,t)}var defaultDecodeOptions={strict:!1,allowIndefinite:!0,allowUndefined:!0,allowBigInt:!0},Tokeniser=class{constructor(e,t={}){this.pos=0,this.data=e,this.options=t}done(){return this.pos>=this.data.length}next(){const e=this.data[this.pos];let t=quick[e];if(void 0===t){const r=jump[e];if(!r)throw new Error(`${decodeErrPrefix} no decoder for major type ${e>>>5} (byte 0x${e.toString(16).padStart(2,"0")})`);const n=31&e;t=r(this.data,this.pos,n,this.options)}return this.pos+=t.encodedLength,t}},DONE=Symbol.for("DONE"),BREAK=Symbol.for("BREAK");function tokenToArray(e,t,r){const n=[];for(let o=0;o<e.value;o++){const i=tokensToObject(t,r);if(i===BREAK){if(e.value===1/0)break;throw new Error(`${decodeErrPrefix} got unexpected break to lengthed array`)}if(i===DONE)throw new Error(`${decodeErrPrefix} found array but not enough entries (got ${o}, expected ${e.value})`);n[o]=i}return n}function tokenToMap(e,t,r){const n=!0===r.useMaps,o=n?void 0:{},i=n?new Map:void 0;for(let s=0;s<e.value;s++){const a=tokensToObject(t,r);if(a===BREAK){if(e.value===1/0)break;throw new Error(`${decodeErrPrefix} got unexpected break to lengthed map`)}if(a===DONE)throw new Error(`${decodeErrPrefix} found map but not enough entries (got ${s} [no key], expected ${e.value})`);if(!0!==n&&"string"!=typeof a)throw new Error(`${decodeErrPrefix} non-string keys not supported (got ${typeof a})`);const c=tokensToObject(t,r);if(c===DONE)throw new Error(`${decodeErrPrefix} found map but not enough entries (got ${s} [no value], expected ${e.value})`);n?i.set(a,c):o[a]=c}return n?i:o}function tokensToObject(e,t){if(e.done())return DONE;const r=e.next();if(r.type===Type.break)return BREAK;if(r.type.terminal)return r.value;if(r.type===Type.array)return tokenToArray(r,e,t);if(r.type===Type.map)return tokenToMap(r,e,t);if(r.type===Type.tag){if(t.tags&&"function"==typeof t.tags[r.value]){const n=tokensToObject(e,t);return t.tags[r.value](n)}throw new Error(`${decodeErrPrefix} tag not supported (${r.value})`)}throw new Error("unsupported")}function decode5(e,t){if(!(e instanceof Uint8Array))throw new Error(`${decodeErrPrefix} data to decode must be a Uint8Array`);const r=(t=Object.assign({},defaultDecodeOptions,t)).tokenizer||new Tokeniser(e,t),n=tokensToObject(r,t);if(n===DONE)throw new Error(`${decodeErrPrefix} did not find any content to decode`);if(n===BREAK)throw new Error(`${decodeErrPrefix} got unexpected break`);if(!r.done())throw new Error(`${decodeErrPrefix} too many terminals, data makes no sense`);return n}init_cid();var CID_CBOR_TAG=42;function cidEncoder(e){if(e.asCID!==e)return null;const t=CID.asCID(e);if(!t)return null;const r=new Uint8Array(t.bytes.byteLength+1);return r.set(t.bytes,1),[new Token(Type.tag,CID_CBOR_TAG),new Token(Type.bytes,r)]}function undefinedEncoder(){throw new Error("`undefined` is not supported by the IPLD Data Model and cannot be encoded")}function numberEncoder(e){if(Number.isNaN(e))throw new Error("`NaN` is not supported by the IPLD Data Model and cannot be encoded");if(e===1/0||e===-1/0)throw new Error("`Infinity` and `-Infinity` is not supported by the IPLD Data Model and cannot be encoded");return null}var encodeOptions={float64:!0,typeEncoders:{Object:cidEncoder,undefined:undefinedEncoder,number:numberEncoder}};function cidDecoder(e){if(0!==e[0])throw new Error("Invalid CID for CBOR tag 42; expected leading 0x00");return CID.decode(e.subarray(1))}var decodeOptions={allowIndefinite:!1,coerceUndefinedToNull:!0,allowNaN:!1,allowInfinity:!1,allowBigInt:!0,strict:!0,useMaps:!1,tags:[]};decodeOptions.tags[CID_CBOR_TAG]=cidDecoder;var encode5=e=>encode4(e,encodeOptions),decode6=e=>decode5(e,decodeOptions),CIDV0_BYTES={SHA2_256:18,LENGTH:32,DAG_PB:112};async function readVarint(e){const t=await e.upTo(8),r=import_varint2.default.decode(t);return e.seek(import_varint2.default.decode.bytes),r}async function readHeader(e){const t=await readVarint(e);if(0===t)throw new Error("Invalid CAR header (zero length)");const r=await e.exactly(t);e.seek(t);const n=decode6(r);if(null==n||Array.isArray(n)||"object"!=typeof n)throw new Error("Invalid CAR header format");if(1!==n.version){if("string"==typeof n.version)throw new Error(`Invalid CAR version: "${n.version}"`);throw new Error(`Invalid CAR version: ${n.version}`)}if(!Array.isArray(n.roots))throw new Error("Invalid CAR header format");if(Object.keys(n).filter(e=>"roots"!==e&&"version"!==e).length)throw new Error("Invalid CAR header format");return n}async function readMultihash(e){const t=await e.upTo(8);import_varint2.default.decode(t);const r=import_varint2.default.decode.bytes,n=import_varint2.default.decode(t.subarray(import_varint2.default.decode.bytes)),o=r+import_varint2.default.decode.bytes+n,i=await e.exactly(o);return e.seek(o),i}async function readCid(e){const t=await e.exactly(2);if(t[0]===CIDV0_BYTES.SHA2_256&&t[1]===CIDV0_BYTES.LENGTH){const t=await e.exactly(34);e.seek(34);const r=decode4(t);return CID.create(0,CIDV0_BYTES.DAG_PB,r)}const r=await readVarint(e);if(1!==r)throw new Error(`Unexpected CID version (${r})`);const n=await readVarint(e),o=await readMultihash(e),i=decode4(o);return CID.create(r,n,i)}async function readBlockHead(e){const t=e.pos;let r=await readVarint(e);if(0===r)throw new Error("Invalid CAR section (zero length)");r+=e.pos-t;return{cid:await readCid(e),length:r,blockLength:r-(e.pos-t)}}async function readBlock(e){const{cid:t,blockLength:r}=await readBlockHead(e),n=await e.exactly(r);return e.seek(r),{bytes:n,cid:t}}async function readBlockIndex(e){const t=e.pos,{cid:r,length:n,blockLength:o}=await readBlockHead(e),i={cid:r,length:n,blockLength:o,offset:t,blockOffset:e.pos};return e.seek(i.blockLength),i}function createDecoder(e){const t=readHeader(e);return{header:()=>t,async*blocks(){for(await t;(await e.upTo(8)).length>0;)yield await readBlock(e)},async*blocksIndex(){for(await t;(await e.upTo(8)).length>0;)yield await readBlockIndex(e)}}}function bytesReader(e){let t=0;return{upTo:async r=>e.subarray(t,t+Math.min(r,e.length-t)),async exactly(r){if(r>e.length-t)throw new Error("Unexpected end of data");return e.subarray(t,t+r)},seek(e){t+=e},get pos(){return t}}}function chunkReader(e){let t=0,r=0,n=0,o=new Uint8Array(0);const i=async t=>{r=o.length-n;const i=[o.subarray(n)];for(;r<t;){const t=await e();if(null==t)break;r<0?t.length>r&&i.push(t.subarray(-r)):i.push(t),r+=t.length}o=new Uint8Array(i.reduce((e,t)=>e+t.length,0));let s=0;for(const e of i)o.set(e,s),s+=e.length;n=0};return{upTo:async e=>(o.length-n<e&&await i(e),o.subarray(n,n+Math.min(o.length-n,e))),async exactly(e){if(o.length-n<e&&await i(e),o.length-n<e)throw new Error("Unexpected end of data");return o.subarray(n,n+e)},seek(e){t+=e,n+=e},get pos(){return t}}}function asyncIterableReader(e){const t=e[Symbol.asyncIterator]();return chunkReader(async function(){const e=await t.next();return e.done?null:e.value})}var CarReader=class{constructor(e,t,r){this._version=e,this._roots=t,this._blocks=r,this._keys=r.map(e=>e.cid.toString())}get version(){return this._version}async getRoots(){return this._roots}async has(e){return this._keys.indexOf(e.toString())>-1}async get(e){const t=this._keys.indexOf(e.toString());return t>-1?this._blocks[t]:void 0}async*blocks(){for(const e of this._blocks)yield e}async*cids(){for(const e of this._blocks)yield e.cid}static async fromBytes(e){if(!(e instanceof Uint8Array))throw new TypeError("fromBytes() requires a Uint8Array");return decodeReaderComplete(bytesReader(e))}static async fromIterable(e){if(!e||"function"!=typeof e[Symbol.asyncIterator])throw new TypeError("fromIterable() requires an async iterable");return decodeReaderComplete(asyncIterableReader(e))}};async function decodeReaderComplete(e){const t=createDecoder(e),{version:r,roots:n}=await t.header(),o=[];for await(const e of t.blocks())o.push(e);return new CarReader(r,n,o)}var CarIndexer=class{constructor(e,t,r){this._version=e,this._roots=t,this._iterator=r}get version(){return this._version}async getRoots(){return this._roots}[Symbol.asyncIterator](){return this._iterator}static async fromBytes(e){if(!(e instanceof Uint8Array))throw new TypeError("fromBytes() requires a Uint8Array");return decodeIndexerComplete(bytesReader(e))}static async fromIterable(e){if(!e||"function"!=typeof e[Symbol.asyncIterator])throw new TypeError("fromIterable() requires an async iterable");return decodeIndexerComplete(asyncIterableReader(e))}};async function decodeIndexerComplete(e){const t=createDecoder(e),{version:r,roots:n}=await t.header();return new CarIndexer(r,n,t.blocksIndex())}var CarIteratorBase=class{constructor(e,t,r){this._version=e,this._roots=t,this._iterable=r,this._decoded=!1}get version(){return this._version}async getRoots(){return this._roots}},CarBlockIterator=class extends CarIteratorBase{[Symbol.asyncIterator](){if(this._decoded)throw new Error("Cannot decode more than once");if(!this._iterable)throw new Error("Block iterable not found");return this._decoded=!0,this._iterable[Symbol.asyncIterator]()}static async fromBytes(e){const{version:t,roots:r,iterator:n}=await fromBytes(e);return new CarBlockIterator(t,r,n)}static async fromIterable(e){const{version:t,roots:r,iterator:n}=await fromIterable(e);return new CarBlockIterator(t,r,n)}},CarCIDIterator=class extends CarIteratorBase{[Symbol.asyncIterator](){if(this._decoded)throw new Error("Cannot decode more than once");if(!this._iterable)throw new Error("Block iterable not found");this._decoded=!0;const e=this._iterable[Symbol.asyncIterator]();return{async next(){const t=await e.next();return t.done?t:{done:!1,value:t.value.cid}}}}static async fromBytes(e){const{version:t,roots:r,iterator:n}=await fromBytes(e);return new CarCIDIterator(t,r,n)}static async fromIterable(e){const{version:t,roots:r,iterator:n}=await fromIterable(e);return new CarCIDIterator(t,r,n)}};async function fromBytes(e){if(!(e instanceof Uint8Array))throw new TypeError("fromBytes() requires a Uint8Array");return decodeIterator(bytesReader(e))}async function fromIterable(e){if(!e||"function"!=typeof e[Symbol.asyncIterator])throw new TypeError("fromIterable() requires an async iterable");return decodeIterator(asyncIterableReader(e))}async function decodeIterator(e){const t=createDecoder(e),{version:r,roots:n}=await t.header();return{version:r,roots:n,iterator:t.blocks()}}init_cid();var import_varint3=__toModule(require_varint());function createHeader(e){const t=encode5({version:1,roots:e}),r=import_varint3.default.encode(t.length),n=new Uint8Array(r.length+t.length);return n.set(r,0),n.set(t,r.length),n}function createEncoder(e){return{async setRoots(t){const r=createHeader(t);await e.write(r)},async writeBlock(t){const{cid:r,bytes:n}=t;await e.write(new Uint8Array(import_varint3.default.encode(r.bytes.length+n.length))),await e.write(r.bytes),n.length&&await e.write(n)},close:async()=>e.end()}}function noop(){}function create2(){const e=[];let t=null,r=noop,n=!1,o=null,i=noop;const s=()=>(t||(t=new Promise(e=>{r=()=>{t=null,r=noop,e()}})),t),a={write(t){e.push(t);const r=s();return i(),r},async end(){n=!0;const e=s();return i(),e}},c={async next(){const t=e.shift();return t?(0===e.length&&r(),{done:!1,value:t}):n?(r(),{done:!0,value:void 0}):(o||(o=new Promise(e=>{i=()=>(o=null,i=noop,e(c.next()))})),o)}};return{writer:a,iterator:c}}var CarWriter=class{constructor(e,t){this._encoder=t,this._mutex=t.setRoots(e),this._ended=!1}async put(e){if(!(e.bytes instanceof Uint8Array&&e.cid))throw new TypeError("Can only write {cid, bytes} objects");if(this._ended)throw new Error("Already closed");const t=CID.asCID(e.cid);if(!t)throw new TypeError("Can only write {cid, bytes} objects");return this._mutex=this._mutex.then(()=>this._encoder.writeBlock({cid:t,bytes:e.bytes})),this._mutex}async close(){if(this._ended)throw new Error("Already closed");return await this._mutex,this._ended=!0,this._encoder.close()}static create(e){e=toRoots(e);const{encoder:t,iterator:r}=encodeWriter();return{writer:new CarWriter(e,t),out:new CarWriterOut(r)}}static createAppender(){const{encoder:e,iterator:t}=encodeWriter();e.setRoots=()=>Promise.resolve();return{writer:new CarWriter([],e),out:new CarWriterOut(t)}}static async updateRootsInBytes(e,t){const r=bytesReader(e);await readHeader(r);const n=createHeader(t);if(r.pos!==n.length)throw new Error(`updateRoots() can only overwrite a header of the same length (old header is ${r.pos} bytes, new header is ${n.length} bytes)`);return e.set(n,0),e}},CarWriterOut=class{constructor(e){this._iterator=e}[Symbol.asyncIterator](){if(this._iterating)throw new Error("Multiple iterator not supported");return this._iterating=!0,this._iterator}};function encodeWriter(){const e=create2(),{writer:t,iterator:r}=e;return{encoder:createEncoder(t),iterator:r}}function toRoots(e){if(void 0===e)return[];if(!Array.isArray(e)){const t=CID.asCID(e);if(!t)throw new TypeError("roots must be a single CID or an array of CIDs");return[t]}const t=[];for(const r of e){const e=CID.asCID(r);if(!e)throw new TypeError("roots must be a single CID or an array of CIDs");t.push(e)}return t}init_src();var readonly2=({enumerable:e=!0,configurable:t=!1}={})=>({enumerable:e,configurable:t,writable:!1}),links=function*(e,t){if(null!=e&&!(e instanceof Uint8Array))for(const[r,n]of Object.entries(e)){const e=[...t,r];if(null!=n&&"object"==typeof n)if(Array.isArray(n))for(const[t,r]of n.entries()){const n=[...e,t],o=CID.asCID(r);o?yield[n.join("/"),o]:"object"==typeof r&&(yield*links(r,n))}else{const t=CID.asCID(n);t?yield[e.join("/"),t]:yield*links(n,e)}}},tree=function*(e,t){if(null!=e)for(const[r,n]of Object.entries(e)){const e=[...t,r];if(yield e.join("/"),!(null==n||n instanceof Uint8Array||"object"!=typeof n||CID.asCID(n)))if(Array.isArray(n))for(const[t,r]of n.entries()){const n=[...e,t];yield n.join("/"),"object"!=typeof r||CID.asCID(r)||(yield*tree(r,n))}else yield*tree(n,e)}},get=(e,t)=>{let r=e;for(const[e,n]of t.entries()){if(r=r[n],null==r)throw new Error(`Object has no property at ${t.slice(0,e+1).map(e=>`[${JSON.stringify(e)}]`).join("")}`);const o=CID.asCID(r);if(o)return{value:o,remaining:t.slice(e+1).join("/")}}return{value:r}},Block=class{constructor({cid:e,bytes:t,value:r}){if(!e||!t||void 0===r)throw new Error("Missing required argument");this.cid=e,this.bytes=t,this.value=r,this.asBlock=this,Object.defineProperties(this,{cid:readonly2(),bytes:readonly2(),value:readonly2(),asBlock:readonly2()})}links(){return links(this.value,[])}tree(){return tree(this.value,[])}get(e="/"){return get(this.value,e.split("/").filter(Boolean))}},encode6=async({value:e,codec:t,hasher:r})=>{if(void 0===e)throw new Error('Missing required argument "value"');if(!t||!r)throw new Error("Missing required argument: codec or hasher");const n=t.encode(e),o=await r.digest(n),i=CID.create(1,t.code,o);return new Block({value:e,bytes:n,cid:i})};init_raw();var esm_exports={};__export(esm_exports,{code:()=>code2,decode:()=>decode8,encode:()=>encode8,name:()=>name2}),init_cid();var CID_CBOR_TAG2=42;function cidEncoder2(e){if(e.asCID!==e)return null;const t=CID.asCID(e);if(!t)return null;const r=new Uint8Array(t.bytes.byteLength+1);return r.set(t.bytes,1),[new Token(Type.tag,CID_CBOR_TAG2),new Token(Type.bytes,r)]}function undefinedEncoder2(){throw new Error("`undefined` is not supported by the IPLD Data Model and cannot be encoded")}function numberEncoder2(e){if(Number.isNaN(e))throw new Error("`NaN` is not supported by the IPLD Data Model and cannot be encoded");if(e===1/0||e===-1/0)throw new Error("`Infinity` and `-Infinity` is not supported by the IPLD Data Model and cannot be encoded");return null}var encodeOptions2={float64:!0,typeEncoders:{Object:cidEncoder2,undefined:undefinedEncoder2,number:numberEncoder2}};function cidDecoder2(e){if(0!==e[0])throw new Error("Invalid CID for CBOR tag 42; expected leading 0x00");return CID.decode(e.subarray(1))}var decodeOptions2={allowIndefinite:!1,allowUndefined:!1,allowNaN:!1,allowInfinity:!1,allowBigInt:!0,strict:!0,useMaps:!1,tags:[]};decodeOptions2.tags[CID_CBOR_TAG2]=cidDecoder2;var name2="dag-cbor",code2=113,encode8=e=>encode4(e,encodeOptions2),decode8=e=>decode5(e,decodeOptions2),src_exports={};__export(src_exports,{code:()=>code3,createLink:()=>createLink,createNode:()=>createNode,decode:()=>decode9,encode:()=>encode9,name:()=>name3,prepare:()=>prepare,validate:()=>validate}),init_cid();var textDecoder2=new TextDecoder;function decodeVarint(e,t){let r=0;for(let n=0;;n+=7){if(n>=64)throw new Error("protobuf: varint overflow");if(t>=e.length)throw new Error("protobuf: unexpected end of data");const o=e[t++];if(r+=n<28?(127&o)<<n:(127&o)*2**n,o<128)break}return[r,t]}function decodeBytes(e,t){let r;[r,t]=decodeVarint(e,t);const n=t+r;if(r<0||n<0)throw new Error("protobuf: invalid length");if(n>e.length)throw new Error("protobuf: unexpected end of data");return[e.subarray(t,n),n]}function decodeKey(e,t){let r;return[r,t]=decodeVarint(e,t),[7&r,r>>3,t]}function decodeLink(e){const t={},r=e.length;let n=0;for(;n<r;){let r,o;if([r,o,n]=decodeKey(e,n),1===o){if(t.Hash)throw new Error("protobuf: (PBLink) duplicate Hash section");if(2!==r)throw new Error(`protobuf: (PBLink) wrong wireType (${r}) for Hash`);if(void 0!==t.Name)throw new Error("protobuf: (PBLink) invalid order, found Name before Hash");if(void 0!==t.Tsize)throw new Error("protobuf: (PBLink) invalid order, found Tsize before Hash");[t.Hash,n]=decodeBytes(e,n)}else if(2===o){if(void 0!==t.Name)throw new Error("protobuf: (PBLink) duplicate Name section");if(2!==r)throw new Error(`protobuf: (PBLink) wrong wireType (${r}) for Name`);if(void 0!==t.Tsize)throw new Error("protobuf: (PBLink) invalid order, found Tsize before Name");let o;[o,n]=decodeBytes(e,n),t.Name=textDecoder2.decode(o)}else{if(3!==o)throw new Error(`protobuf: (PBLink) invalid fieldNumber, expected 1, 2 or 3, got ${o}`);if(void 0!==t.Tsize)throw new Error("protobuf: (PBLink) duplicate Tsize section");if(0!==r)throw new Error(`protobuf: (PBLink) wrong wireType (${r}) for Tsize`);[t.Tsize,n]=decodeVarint(e,n)}}if(n>r)throw new Error("protobuf: (PBLink) unexpected end of data");return t}function decodeNode(e){const t=e.length;let r,n,o=0,i=!1;for(;o<t;){let t,s;if([t,s,o]=decodeKey(e,o),2!==t)throw new Error(`protobuf: (PBNode) invalid wireType, expected 2, got ${t}`);if(1===s){if(n)throw new Error("protobuf: (PBNode) duplicate Data section");[n,o]=decodeBytes(e,o),r&&(i=!0)}else{if(2!==s)throw new Error(`protobuf: (PBNode) invalid fieldNumber, expected 1 or 2, got ${s}`);{if(i)throw new Error("protobuf: (PBNode) duplicate Links section");let t;r||(r=[]),[t,o]=decodeBytes(e,o),r.push(decodeLink(t))}}}if(o>t)throw new Error("protobuf: (PBNode) unexpected end of data");const s={};return n&&(s.Data=n),s.Links=r||[],s}var textEncoder2=new TextEncoder,maxInt32=2**32,maxUInt32=2**31;function encodeLink(e,t){let r=t.length;if("number"==typeof e.Tsize){if(e.Tsize<0)throw new Error("Tsize cannot be negative");if(!Number.isSafeInteger(e.Tsize))throw new Error("Tsize too large for encoding");r=encodeVarint(t,r,e.Tsize)-1,t[r]=24}if("string"==typeof e.Name){const n=textEncoder2.encode(e.Name);r-=n.length,t.set(n,r),r=encodeVarint(t,r,n.length)-1,t[r]=18}return e.Hash&&(r-=e.Hash.length,t.set(e.Hash,r),r=encodeVarint(t,r,e.Hash.length)-1,t[r]=10),t.length-r}function encodeNode(e){const t=sizeNode(e),r=new Uint8Array(t);let n=t;if(e.Data&&(n-=e.Data.length,r.set(e.Data,n),n=encodeVarint(r,n,e.Data.length)-1,r[n]=10),e.Links)for(let t=e.Links.length-1;t>=0;t--){const o=encodeLink(e.Links[t],r.subarray(0,n));n-=o,n=encodeVarint(r,n,o)-1,r[n]=18}return r}function sizeLink(e){let t=0;if(e.Hash){const r=e.Hash.length;t+=1+r+sov(r)}if("string"==typeof e.Name){const r=textEncoder2.encode(e.Name).length;t+=1+r+sov(r)}return"number"==typeof e.Tsize&&(t+=1+sov(e.Tsize)),t}function sizeNode(e){let t=0;if(e.Data){const r=e.Data.length;t+=1+r+sov(r)}if(e.Links)for(const r of e.Links){const e=sizeLink(r);t+=1+e+sov(e)}return t}function encodeVarint(e,t,r){const n=t-=sov(r);for(;r>=maxUInt32;)e[t++]=127&r|128,r/=128;for(;r>=128;)e[t++]=127&r|128,r>>>=7;return e[t]=r,n}function sov(e){return e%2==0&&e++,Math.floor((len64(e)+6)/7)}function len64(e){let t=0;return e>=maxInt32&&(e=Math.floor(e/maxInt32),t=32),e>=65536&&(e>>>=16,t+=16),e>=256&&(e>>>=8,t+=8),t+len8tab[e]}var len8tab=[0,1,2,2,3,3,3,3,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8];init_cid();var pbNodeProperties=["Data","Links"],pbLinkProperties=["Hash","Name","Tsize"],textEncoder3=new TextEncoder;function linkComparator(e,t){if(e===t)return 0;const r=e.Name?textEncoder3.encode(e.Name):[],n=t.Name?textEncoder3.encode(t.Name):[];let o=r.length,i=n.length;for(let e=0,t=Math.min(o,i);e<t;++e)if(r[e]!==n[e]){o=r[e],i=n[e];break}return o<i?-1:i<o?1:0}function hasOnlyProperties(e,t){return!Object.keys(e).some(e=>!t.includes(e))}function asLink(e){if("object"==typeof e.asCID){const t=CID.asCID(e);if(!t)throw new TypeError("Invalid DAG-PB form");return{Hash:t}}if("object"!=typeof e||Array.isArray(e))throw new TypeError("Invalid DAG-PB form");const t={};if(e.Hash){let r=CID.asCID(e.Hash);try{r||("string"==typeof e.Hash?r=CID.parse(e.Hash):e.Hash instanceof Uint8Array&&(r=CID.decode(e.Hash)))}catch(e){throw new TypeError(`Invalid DAG-PB form: ${e.message}`)}r&&(t.Hash=r)}if(!t.Hash)throw new TypeError("Invalid DAG-PB form");return"string"==typeof e.Name&&(t.Name=e.Name),"number"==typeof e.Tsize&&(t.Tsize=e.Tsize),t}function prepare(e){if((e instanceof Uint8Array||"string"==typeof e)&&(e={Data:e}),"object"!=typeof e||Array.isArray(e))throw new TypeError("Invalid DAG-PB form");const t={};if(void 0!==e.Data)if("string"==typeof e.Data)t.Data=textEncoder3.encode(e.Data);else{if(!(e.Data instanceof Uint8Array))throw new TypeError("Invalid DAG-PB form");t.Data=e.Data}if(void 0!==e.Links){if(!Array.isArray(e.Links))throw new TypeError("Invalid DAG-PB form");t.Links=e.Links.map(asLink),t.Links.sort(linkComparator)}else t.Links=[];return t}function validate(e){if(!e||"object"!=typeof e||Array.isArray(e))throw new TypeError("Invalid DAG-PB form");if(!hasOnlyProperties(e,pbNodeProperties))throw new TypeError("Invalid DAG-PB form (extraneous properties)");if(void 0!==e.Data&&!(e.Data instanceof Uint8Array))throw new TypeError("Invalid DAG-PB form (Data must be a Uint8Array)");if(!Array.isArray(e.Links))throw new TypeError("Invalid DAG-PB form (Links must be an array)");for(let t=0;t<e.Links.length;t++){const r=e.Links[t];if(!r||"object"!=typeof r||Array.isArray(r))throw new TypeError("Invalid DAG-PB form (bad link object)");if(!hasOnlyProperties(r,pbLinkProperties))throw new TypeError("Invalid DAG-PB form (extraneous properties on link object)");if(!r.Hash)throw new TypeError("Invalid DAG-PB form (link must have a Hash)");if(r.Hash.asCID!==r.Hash)throw new TypeError("Invalid DAG-PB form (link Hash must be a CID)");if(void 0!==r.Name&&"string"!=typeof r.Name)throw new TypeError("Invalid DAG-PB form (link Name must be a string)");if(void 0!==r.Tsize&&("number"!=typeof r.Tsize||r.Tsize%1!=0))throw new TypeError("Invalid DAG-PB form (link Tsize must be an integer)");if(t>0&&-1===linkComparator(r,e.Links[t-1]))throw new TypeError("Invalid DAG-PB form (links must be sorted by Name bytes)")}}function createNode(e,t=[]){return prepare({Data:e,Links:t})}function createLink(e,t,r){return asLink({Hash:r,Name:e,Tsize:t})}var name3="dag-pb",code3=112;function encode9(e){validate(e);const t={};return e.Links&&(t.Links=e.Links.map(e=>{const t={};return e.Hash&&(t.Hash=e.Hash.bytes),void 0!==e.Name&&(t.Name=e.Name),void 0!==e.Tsize&&(t.Tsize=e.Tsize),t})),e.Data&&(t.Data=e.Data),encodeNode(t)}function decode9(e){const t=decodeNode(e),r={};return t.Data&&(r.Data=t.Data),t.Links&&(r.Links=t.Links.map(e=>{const t={};try{t.Hash=CID.decode(e.Hash)}catch(e){}if(!t.Hash)throw new Error("Invalid Hash field found in link, expected CID");return void 0!==e.Name&&(t.Name=e.Name),void 0!==e.Tsize&&(t.Tsize=e.Tsize),t})),r}var TreewalkCarSplitter=class{constructor(e,t,r={}){if("number"!=typeof t||t<=0)throw new Error("invalid target chunk size");this._reader=e,this._targetSize=t,this._decoders=[src_exports,raw_exports,esm_exports,...r.decoders||[]]}async*cars(){const e=await this._reader.getRoots();if(1!==e.length)throw new Error(`unexpected number of roots: ${e.length}`);let t;for await(const r of this._cars(e[0]))t=r.channel,r.out&&(yield r.out);if(!t)throw new Error("missing CAR writer channel");t.writer.close(),yield t.out}async _get(e){const t=await this._reader.get(e);if(!t)throw new Error(`missing block for ${e}`);const{bytes:r}=t,n=this._decoders.find(t=>t.code===e.code);if(!n)throw new Error(`missing decoder for ${e.code}`);return new Block({cid:e,bytes:r,value:n.decode(r)})}async*_cars(e,t=[],r=void 0){const n=await this._get(e);if((r=r||Object.assign(CarWriter.create(e),{size:0})).size>0&&r.size+n.bytes.byteLength>=this._targetSize){r.writer.close();const{out:e}=r;r=newCar(t),yield{channel:r,out:e}}t=t.concat(n),r.size+=n.bytes.byteLength,r.writer.put(n);for(const[,e]of n.links())for await(const n of this._cars(e,t,r))r=n.channel,yield n;if(!r)throw new Error("missing CAR writer channel");yield{channel:r}}static async fromIterable(e,t,r){const n=await CarReader.fromIterable(e);return new TreewalkCarSplitter(n,t,r)}static async fromBlob(e,t,r){const n=await e.arrayBuffer(),o=await CarReader.fromBytes(new Uint8Array(n));return new TreewalkCarSplitter(o,t,r)}};function newCar(e){const t=Object.assign(CarWriter.create(e[0].cid),{size:e.reduce((e,t)=>e+t.bytes.byteLength,0)});for(const r of e)t.writer.put(r);return t}var import_it_last=__toModule(require_it_last()),import_it_pipe=__toModule(require_it_pipe()),import_it_parallel_batch2=__toModule(require_it_parallel_batch()),import_index2=__toModule(require_merge_options()),merge_options_default=import_index2.default;init_sha2_browser(),init_hasher(),init_src();var import_murmurhash3js_revisited=__toModule(require_murmurhash3js_revisited());function fromNumberTo32BitBuf(e){const t=new Array(4);for(let r=0;r<4;r++)t[r]=255&e,e>>=8;return new Uint8Array(t)}var murmur332=from2({name:"murmur3-32",code:35,encode:e=>fromNumberTo32BitBuf(import_murmurhash3js_revisited.default.x86.hash32(e))}),murmur3128=from2({name:"murmur3-128",code:34,encode:e=>bytes_exports.fromHex(import_murmurhash3js_revisited.default.x64.hash128(e))});async function hamtHashFn(e){return(await murmur3128.encode(e)).slice(0,8).reverse()}var defaultOptions={chunker:"fixed",strategy:"balanced",rawLeaves:!1,onlyHash:!1,reduceSingleLeafToSelf:!0,hasher:sha256,leafType:"file",cidVersion:0,progress:()=>()=>{},shardSplitThreshold:1e3,fileImportConcurrency:50,blockWriteConcurrency:10,minChunkSize:262144,maxChunkSize:262144,avgChunkSize:262144,window:16,polynomial:0x3df305dfb2a804,maxChildrenPerNode:174,layerRepeat:4,wrapWithDirectory:!1,recursive:!1,hidden:!1,timeout:void 0,hamtHashFn:hamtHashFn,hamtHashCode:34,hamtBucketBits:8},options_default=(e={})=>merge_options_default.bind({ignoreUndefined:!0})(defaultOptions,e),import_err_code=__toModule(require_err_code()),import_minimal=__toModule(require_minimal2()),$Reader=import_minimal.default.Reader,$Writer=import_minimal.default.Writer,$util=import_minimal.default.util,$root=import_minimal.default.roots["ipfs-unixfs"]||(import_minimal.default.roots["ipfs-unixfs"]={}),Data=$root.Data=(()=>{function e(e){if(this.blocksizes=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.Type=0,e.prototype.Data=$util.newBuffer([]),e.prototype.filesize=$util.Long?$util.Long.fromBits(0,0,!0):0,e.prototype.blocksizes=$util.emptyArray,e.prototype.hashType=$util.Long?$util.Long.fromBits(0,0,!0):0,e.prototype.fanout=$util.Long?$util.Long.fromBits(0,0,!0):0,e.prototype.mode=0,e.prototype.mtime=null,e.encode=function(e,t){if(t||(t=$Writer.create()),t.uint32(8).int32(e.Type),null!=e.Data&&Object.hasOwnProperty.call(e,"Data")&&t.uint32(18).bytes(e.Data),null!=e.filesize&&Object.hasOwnProperty.call(e,"filesize")&&t.uint32(24).uint64(e.filesize),null!=e.blocksizes&&e.blocksizes.length)for(var r=0;r<e.blocksizes.length;++r)t.uint32(32).uint64(e.blocksizes[r]);return null!=e.hashType&&Object.hasOwnProperty.call(e,"hashType")&&t.uint32(40).uint64(e.hashType),null!=e.fanout&&Object.hasOwnProperty.call(e,"fanout")&&t.uint32(48).uint64(e.fanout),null!=e.mode&&Object.hasOwnProperty.call(e,"mode")&&t.uint32(56).uint32(e.mode),null!=e.mtime&&Object.hasOwnProperty.call(e,"mtime")&&$root.UnixTime.encode(e.mtime,t.uint32(66).fork()).ldelim(),t},e.decode=function(e,t){e instanceof $Reader||(e=$Reader.create(e));for(var r=void 0===t?e.len:e.pos+t,n=new $root.Data;e.pos<r;){var o=e.uint32();switch(o>>>3){case 1:n.Type=e.int32();break;case 2:n.Data=e.bytes();break;case 3:n.filesize=e.uint64();break;case 4:if(n.blocksizes&&n.blocksizes.length||(n.blocksizes=[]),2==(7&o))for(var i=e.uint32()+e.pos;e.pos<i;)n.blocksizes.push(e.uint64());else n.blocksizes.push(e.uint64());break;case 5:n.hashType=e.uint64();break;case 6:n.fanout=e.uint64();break;case 7:n.mode=e.uint32();break;case 8:n.mtime=$root.UnixTime.decode(e,e.uint32());break;default:e.skipType(7&o)}}if(!n.hasOwnProperty("Type"))throw $util.ProtocolError("missing required 'Type'",{instance:n});return n},e.fromObject=function(e){if(e instanceof $root.Data)return e;var t=new $root.Data;switch(e.Type){case"Raw":case 0:t.Type=0;break;case"Directory":case 1:t.Type=1;break;case"File":case 2:t.Type=2;break;case"Metadata":case 3:t.Type=3;break;case"Symlink":case 4:t.Type=4;break;case"HAMTShard":case 5:t.Type=5}if(null!=e.Data&&("string"==typeof e.Data?$util.base64.decode(e.Data,t.Data=$util.newBuffer($util.base64.length(e.Data)),0):e.Data.length&&(t.Data=e.Data)),null!=e.filesize&&($util.Long?(t.filesize=$util.Long.fromValue(e.filesize)).unsigned=!0:"string"==typeof e.filesize?t.filesize=parseInt(e.filesize,10):"number"==typeof e.filesize?t.filesize=e.filesize:"object"==typeof e.filesize&&(t.filesize=new $util.LongBits(e.filesize.low>>>0,e.filesize.high>>>0).toNumber(!0))),e.blocksizes){if(!Array.isArray(e.blocksizes))throw TypeError(".Data.blocksizes: array expected");t.blocksizes=[];for(var r=0;r<e.blocksizes.length;++r)$util.Long?(t.blocksizes[r]=$util.Long.fromValue(e.blocksizes[r])).unsigned=!0:"string"==typeof e.blocksizes[r]?t.blocksizes[r]=parseInt(e.blocksizes[r],10):"number"==typeof e.blocksizes[r]?t.blocksizes[r]=e.blocksizes[r]:"object"==typeof e.blocksizes[r]&&(t.blocksizes[r]=new $util.LongBits(e.blocksizes[r].low>>>0,e.blocksizes[r].high>>>0).toNumber(!0))}if(null!=e.hashType&&($util.Long?(t.hashType=$util.Long.fromValue(e.hashType)).unsigned=!0:"string"==typeof e.hashType?t.hashType=parseInt(e.hashType,10):"number"==typeof e.hashType?t.hashType=e.hashType:"object"==typeof e.hashType&&(t.hashType=new $util.LongBits(e.hashType.low>>>0,e.hashType.high>>>0).toNumber(!0))),null!=e.fanout&&($util.Long?(t.fanout=$util.Long.fromValue(e.fanout)).unsigned=!0:"string"==typeof e.fanout?t.fanout=parseInt(e.fanout,10):"number"==typeof e.fanout?t.fanout=e.fanout:"object"==typeof e.fanout&&(t.fanout=new $util.LongBits(e.fanout.low>>>0,e.fanout.high>>>0).toNumber(!0))),null!=e.mode&&(t.mode=e.mode>>>0),null!=e.mtime){if("object"!=typeof e.mtime)throw TypeError(".Data.mtime: object expected");t.mtime=$root.UnixTime.fromObject(e.mtime)}return t},e.toObject=function(e,t){t||(t={});var r={};if((t.arrays||t.defaults)&&(r.blocksizes=[]),t.defaults){if(r.Type=t.enums===String?"Raw":0,t.bytes===String?r.Data="":(r.Data=[],t.bytes!==Array&&(r.Data=$util.newBuffer(r.Data))),$util.Long){var n=new $util.Long(0,0,!0);r.filesize=t.longs===String?n.toString():t.longs===Number?n.toNumber():n}else r.filesize=t.longs===String?"0":0;if($util.Long){n=new $util.Long(0,0,!0);r.hashType=t.longs===String?n.toString():t.longs===Number?n.toNumber():n}else r.hashType=t.longs===String?"0":0;if($util.Long){n=new $util.Long(0,0,!0);r.fanout=t.longs===String?n.toString():t.longs===Number?n.toNumber():n}else r.fanout=t.longs===String?"0":0;r.mode=0,r.mtime=null}if(null!=e.Type&&e.hasOwnProperty("Type")&&(r.Type=t.enums===String?$root.Data.DataType[e.Type]:e.Type),null!=e.Data&&e.hasOwnProperty("Data")&&(r.Data=t.bytes===String?$util.base64.encode(e.Data,0,e.Data.length):t.bytes===Array?Array.prototype.slice.call(e.Data):e.Data),null!=e.filesize&&e.hasOwnProperty("filesize")&&("number"==typeof e.filesize?r.filesize=t.longs===String?String(e.filesize):e.filesize:r.filesize=t.longs===String?$util.Long.prototype.toString.call(e.filesize):t.longs===Number?new $util.LongBits(e.filesize.low>>>0,e.filesize.high>>>0).toNumber(!0):e.filesize),e.blocksizes&&e.blocksizes.length){r.blocksizes=[];for(var o=0;o<e.blocksizes.length;++o)"number"==typeof e.blocksizes[o]?r.blocksizes[o]=t.longs===String?String(e.blocksizes[o]):e.blocksizes[o]:r.blocksizes[o]=t.longs===String?$util.Long.prototype.toString.call(e.blocksizes[o]):t.longs===Number?new $util.LongBits(e.blocksizes[o].low>>>0,e.blocksizes[o].high>>>0).toNumber(!0):e.blocksizes[o]}return null!=e.hashType&&e.hasOwnProperty("hashType")&&("number"==typeof e.hashType?r.hashType=t.longs===String?String(e.hashType):e.hashType:r.hashType=t.longs===String?$util.Long.prototype.toString.call(e.hashType):t.longs===Number?new $util.LongBits(e.hashType.low>>>0,e.hashType.high>>>0).toNumber(!0):e.hashType),null!=e.fanout&&e.hasOwnProperty("fanout")&&("number"==typeof e.fanout?r.fanout=t.longs===String?String(e.fanout):e.fanout:r.fanout=t.longs===String?$util.Long.prototype.toString.call(e.fanout):t.longs===Number?new $util.LongBits(e.fanout.low>>>0,e.fanout.high>>>0).toNumber(!0):e.fanout),null!=e.mode&&e.hasOwnProperty("mode")&&(r.mode=e.mode),null!=e.mtime&&e.hasOwnProperty("mtime")&&(r.mtime=$root.UnixTime.toObject(e.mtime,t)),r},e.prototype.toJSON=function(){return this.constructor.toObject(this,import_minimal.default.util.toJSONOptions)},e.DataType=function(){const e={},t=Object.create(e);return t[e[0]="Raw"]=0,t[e[1]="Directory"]=1,t[e[2]="File"]=2,t[e[3]="Metadata"]=3,t[e[4]="Symlink"]=4,t[e[5]="HAMTShard"]=5,t}(),e})(),UnixTime=$root.UnixTime=(()=>{function e(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.Seconds=$util.Long?$util.Long.fromBits(0,0,!1):0,e.prototype.FractionalNanoseconds=0,e.encode=function(e,t){return t||(t=$Writer.create()),t.uint32(8).int64(e.Seconds),null!=e.FractionalNanoseconds&&Object.hasOwnProperty.call(e,"FractionalNanoseconds")&&t.uint32(21).fixed32(e.FractionalNanoseconds),t},e.decode=function(e,t){e instanceof $Reader||(e=$Reader.create(e));for(var r=void 0===t?e.len:e.pos+t,n=new $root.UnixTime;e.pos<r;){var o=e.uint32();switch(o>>>3){case 1:n.Seconds=e.int64();break;case 2:n.FractionalNanoseconds=e.fixed32();break;default:e.skipType(7&o)}}if(!n.hasOwnProperty("Seconds"))throw $util.ProtocolError("missing required 'Seconds'",{instance:n});return n},e.fromObject=function(e){if(e instanceof $root.UnixTime)return e;var t=new $root.UnixTime;return null!=e.Seconds&&($util.Long?(t.Seconds=$util.Long.fromValue(e.Seconds)).unsigned=!1:"string"==typeof e.Seconds?t.Seconds=parseInt(e.Seconds,10):"number"==typeof e.Seconds?t.Seconds=e.Seconds:"object"==typeof e.Seconds&&(t.Seconds=new $util.LongBits(e.Seconds.low>>>0,e.Seconds.high>>>0).toNumber())),null!=e.FractionalNanoseconds&&(t.FractionalNanoseconds=e.FractionalNanoseconds>>>0),t},e.toObject=function(e,t){t||(t={});var r={};if(t.defaults){if($util.Long){var n=new $util.Long(0,0,!1);r.Seconds=t.longs===String?n.toString():t.longs===Number?n.toNumber():n}else r.Seconds=t.longs===String?"0":0;r.FractionalNanoseconds=0}return null!=e.Seconds&&e.hasOwnProperty("Seconds")&&("number"==typeof e.Seconds?r.Seconds=t.longs===String?String(e.Seconds):e.Seconds:r.Seconds=t.longs===String?$util.Long.prototype.toString.call(e.Seconds):t.longs===Number?new $util.LongBits(e.Seconds.low>>>0,e.Seconds.high>>>0).toNumber():e.Seconds),null!=e.FractionalNanoseconds&&e.hasOwnProperty("FractionalNanoseconds")&&(r.FractionalNanoseconds=e.FractionalNanoseconds),r},e.prototype.toJSON=function(){return this.constructor.toObject(this,import_minimal.default.util.toJSONOptions)},e})(),Metadata=$root.Metadata=(()=>{function e(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.MimeType="",e.encode=function(e,t){return t||(t=$Writer.create()),null!=e.MimeType&&Object.hasOwnProperty.call(e,"MimeType")&&t.uint32(10).string(e.MimeType),t},e.decode=function(e,t){e instanceof $Reader||(e=$Reader.create(e));for(var r=void 0===t?e.len:e.pos+t,n=new $root.Metadata;e.pos<r;){var o=e.uint32();if(o>>>3==1)n.MimeType=e.string();else e.skipType(7&o)}return n},e.fromObject=function(e){if(e instanceof $root.Metadata)return e;var t=new $root.Metadata;return null!=e.MimeType&&(t.MimeType=String(e.MimeType)),t},e.toObject=function(e,t){t||(t={});var r={};return t.defaults&&(r.MimeType=""),null!=e.MimeType&&e.hasOwnProperty("MimeType")&&(r.MimeType=e.MimeType),r},e.prototype.toJSON=function(){return this.constructor.toObject(this,import_minimal.default.util.toJSONOptions)},e})(),PBData=Data,types=["raw","directory","file","metadata","symlink","hamt-sharded-directory"],dirTypes=["directory","hamt-sharded-directory"],DEFAULT_FILE_MODE=parseInt("0644",8),DEFAULT_DIRECTORY_MODE=parseInt("0755",8);function parseMode(e){if(null!=e)return"number"==typeof e?4095&e:"0"===(e=e.toString()).substring(0,1)?4095&parseInt(e,8):4095&parseInt(e,10)}function parseMtime(e){if(null==e)return;let t;if(null!=e.secs&&(t={secs:e.secs,nsecs:e.nsecs}),null!=e.Seconds&&(t={secs:e.Seconds,nsecs:e.FractionalNanoseconds}),Array.isArray(e)&&(t={secs:e[0],nsecs:e[1]}),e instanceof Date){const r=e.getTime(),n=Math.floor(r/1e3);t={secs:n,nsecs:1e3*(r-1e3*n)}}if(Object.prototype.hasOwnProperty.call(t,"secs")){if(null!=t&&null!=t.nsecs&&(t.nsecs<0||t.nsecs>999999999))throw(0,import_err_code.default)(new Error("mtime-nsecs must be within the range [0,999999999]"),"ERR_INVALID_MTIME_NSECS");return t}}var UnixFS=class{static unmarshal(e){const t=PBData.decode(e),r=PBData.toObject(t,{defaults:!1,arrays:!0,longs:Number,objects:!1}),n=new UnixFS({type:types[r.Type],data:r.Data,blockSizes:r.blocksizes,mode:r.mode,mtime:r.mtime?{secs:r.mtime.Seconds,nsecs:r.mtime.FractionalNanoseconds}:void 0});return n._originalMode=r.mode||0,n}constructor(e={type:"file"}){const{type:t,data:r,blockSizes:n,hashType:o,fanout:i,mtime:s,mode:a}=e;if(t&&!types.includes(t))throw(0,import_err_code.default)(new Error("Type: "+t+" is not valid"),"ERR_INVALID_TYPE");this.type=t||"file",this.data=r,this.hashType=o,this.fanout=i,this.blockSizes=n||[],this._originalMode=0,this.mode=parseMode(a),s&&(this.mtime=parseMtime(s),this.mtime&&!this.mtime.nsecs&&(this.mtime.nsecs=0))}set mode(e){this._mode=this.isDirectory()?DEFAULT_DIRECTORY_MODE:DEFAULT_FILE_MODE;const t=parseMode(e);void 0!==t&&(this._mode=t)}get mode(){return this._mode}isDirectory(){return Boolean(this.type&&dirTypes.includes(this.type))}addBlockSize(e){this.blockSizes.push(e)}removeBlockSize(e){this.blockSizes.splice(e,1)}fileSize(){if(this.isDirectory())return 0;let e=0;return this.blockSizes.forEach(t=>{e+=t}),this.data&&(e+=this.data.length),e}marshal(){let e;switch(this.type){case"raw":e=PBData.DataType.Raw;break;case"directory":e=PBData.DataType.Directory;break;case"file":e=PBData.DataType.File;break;case"metadata":e=PBData.DataType.Metadata;break;case"symlink":e=PBData.DataType.Symlink;break;case"hamt-sharded-directory":e=PBData.DataType.HAMTShard;break;default:throw(0,import_err_code.default)(new Error("Type: "+e+" is not valid"),"ERR_INVALID_TYPE")}let t,r,n=this.data;if(this.data&&this.data.length||(n=void 0),null!=this.mode&&(t=4294963200&this._originalMode|(parseMode(this.mode)||0),t!==DEFAULT_FILE_MODE||this.isDirectory()||(t=void 0),t===DEFAULT_DIRECTORY_MODE&&this.isDirectory()&&(t=void 0)),null!=this.mtime){const e=parseMtime(this.mtime);e&&(r={Seconds:e.secs,FractionalNanoseconds:e.nsecs},0===r.FractionalNanoseconds&&delete r.FractionalNanoseconds)}const o={Type:e,Data:n,filesize:this.isDirectory()?void 0:this.fileSize(),blocksizes:this.blockSizes,hashType:this.hashType,fanout:this.fanout,mode:t,mtime:r};return PBData.encode(o).finish()}};init_cid(),init_sha2_browser();var persist=async(e,t,r)=>{r.codec||(r.codec=src_exports),r.hasher||(r.hasher=sha256),void 0===r.cidVersion&&(r.cidVersion=1),r.codec===src_exports&&r.hasher!==sha256&&(r.cidVersion=1);const n=await r.hasher.digest(e),o=CID.create(r.cidVersion,r.codec.code,n);return r.onlyHash||await t.put(o,e,{signal:r.signal}),o},persist_default=persist,dirBuilder=async(e,t,r)=>{const n=new UnixFS({type:"directory",mtime:e.mtime,mode:e.mode}),o=encode9(prepare({Data:n.marshal()}));return{cid:await persist_default(o,t,r),path:e.path,unixfs:n,size:o.length}},dir_default=dirBuilder,import_err_code2=__toModule(require_err_code()),import_it_parallel_batch=__toModule(require_it_parallel_batch());init_raw();var import_it_all=__toModule(require_it_all());async function flat(e,t){return t(await(0,import_it_all.default)(e))}var flat_default=flat,import_it_batch=__toModule(require_it_batch());function balanced(e,t,r){return reduceToParents(e,t,r)}async function reduceToParents(e,t,r){const n=[];for await(const o of(0,import_it_batch.default)(e,r.maxChildrenPerNode))n.push(await t(o));return n.length>1?reduceToParents(n,t,r):n[0]}var balanced_default=balanced,import_it_batch2=__toModule(require_it_batch());async function trickleStream(e,t,r){const n=new Root(r.layerRepeat);let o=0,i=1,s=n;for await(const a of(0,import_it_batch2.default)(e,r.maxChildrenPerNode))s.isFull()&&(s!==n&&n.addChild(await s.reduce(t)),o&&o%r.layerRepeat===0&&i++,s=new SubTree(i,r.layerRepeat,o),o++),s.append(a);return s&&s!==n&&n.addChild(await s.reduce(t)),n.reduce(t)}var trickle_default=trickleStream,SubTree=class{constructor(e,t,r=0){this.maxDepth=e,this.layerRepeat=t,this.currentDepth=1,this.iteration=r,this.root=this.node=this.parent={children:[],depth:this.currentDepth,maxDepth:e,maxChildren:(this.maxDepth-this.currentDepth)*this.layerRepeat}}isFull(){if(!this.root.data)return!1;if(this.currentDepth<this.maxDepth&&this.node.maxChildren)return this._addNextNodeToParent(this.node),!1;const e=this._findParent(this.node,this.currentDepth);return!e||(this._addNextNodeToParent(e),!1)}_addNextNodeToParent(e){this.parent=e;const t={children:[],depth:e.depth+1,parent:e,maxDepth:this.maxDepth,maxChildren:Math.floor(e.children.length/this.layerRepeat)*this.layerRepeat};e.children.push(t),this.currentDepth=t.depth,this.node=t}append(e){this.node.data=e}reduce(e){return this._reduce(this.root,e)}async _reduce(e,t){let r=[];return e.children.length&&(r=await Promise.all(e.children.filter(e=>e.data).map(e=>this._reduce(e,t)))),t((e.data||[]).concat(r))}_findParent(e,t){const r=e.parent;if(r&&0!==r.depth)return r.children.length!==r.maxChildren&&r.maxChildren?r:this._findParent(r,t)}},Root=class extends SubTree{constructor(e){super(0,e),this.root.depth=0,this.currentDepth=1}addChild(e){this.root.children.push(e)}reduce(e){return e((this.root.data||[]).concat(this.root.children))}};async function*bufferImporter(e,t,r){for await(let n of e.content)yield async()=>{let o;r.progress(n.length,e.path);const i={codec:src_exports,cidVersion:r.cidVersion,hasher:r.hasher,onlyHash:r.onlyHash};return r.rawLeaves?(i.codec=raw_exports,i.cidVersion=1):(o=new UnixFS({type:r.leafType,data:n,mtime:e.mtime,mode:e.mode}),n=encode9({Data:o.marshal(),Links:[]})),{cid:await persist_default(n,t,i),unixfs:o,size:n.length}}}init_raw();var buffer_importer_default=bufferImporter,dagBuilders={flat:flat_default,balanced:balanced_default,trickle:trickle_default};async function*buildFileBatch(e,t,r){let n,o,i=-1;o="function"==typeof r.bufferImporter?r.bufferImporter:buffer_importer_default;for await(const s of(0,import_it_parallel_batch.default)(o(e,t,r),r.blockWriteConcurrency))i++,0!==i?(1===i&&n&&(yield n,n=null),yield s):n=s;n&&(n.single=!0,yield n)}var reduce=(e,t,r)=>async function(n){if(1===n.length&&n[0].single&&r.reduceSingleLeafToSelf){const o=n[0];if(o.cid.code===code&&(void 0!==e.mtime||void 0!==e.mode)){let n=await t.get(o.cid);o.unixfs=new UnixFS({type:"file",mtime:e.mtime,mode:e.mode,data:n}),n=encode9(prepare({Data:o.unixfs.marshal()})),o.cid=await persist_default(n,t,{...r,codec:src_exports,hasher:r.hasher,cidVersion:r.cidVersion}),o.size=n.length}return{cid:o.cid,path:e.path,unixfs:o.unixfs,size:o.size}}const o=new UnixFS({type:"file",mtime:e.mtime,mode:e.mode}),i=n.filter(e=>!(e.cid.code!==code||!e.size)||(!(!e.unixfs||e.unixfs.data||!e.unixfs.fileSize())||Boolean(e.unixfs&&e.unixfs.data&&e.unixfs.data.length))).map(e=>e.cid.code===code?(o.addBlockSize(e.size),{Name:"",Tsize:e.size,Hash:e.cid}):(e.unixfs&&e.unixfs.data?o.addBlockSize(e.unixfs.data.length):o.addBlockSize(e.unixfs&&e.unixfs.fileSize()||0),{Name:"",Tsize:e.size,Hash:e.cid})),s={Data:o.marshal(),Links:i},a=encode9(prepare(s));return{cid:await persist_default(a,t,r),path:e.path,unixfs:o,size:a.length+s.Links.reduce((e,t)=>e+t.Tsize,0)}};function fileBuilder(e,t,r){const n=dagBuilders[r.strategy];if(!n)throw(0,import_err_code2.default)(new Error(`Unknown importer build strategy name: ${r.strategy}`),"ERR_BAD_STRATEGY");return n(buildFileBatch(e,t,r),reduce(e,t,r),r)}var file_default=fileBuilder,import_err_code5=__toModule(require_err_code()),import_BufferList=__toModule(require_BufferList()),import_rabin_wasm=__toModule(require_src()),import_err_code3=__toModule(require_err_code());async function*rabinChunker(e,t){let r,n,o;if(t.minChunkSize&&t.maxChunkSize&&t.avgChunkSize)o=t.avgChunkSize,r=t.minChunkSize,n=t.maxChunkSize;else{if(!t.avgChunkSize)throw(0,import_err_code3.default)(new Error("please specify an average chunk size"),"ERR_INVALID_AVG_CHUNK_SIZE");o=t.avgChunkSize,r=o/3,n=o+o/2}if(r<16)throw(0,import_err_code3.default)(new Error("rabin min must be greater than 16"),"ERR_INVALID_MIN_CHUNK_SIZE");n<r&&(n=r),o<r&&(o=r);const i=Math.floor(Math.log2(o));for await(const o of rabin(e,{min:r,max:n,bits:i,window:t.window,polynomial:t.polynomial}))yield o}var rabin_default=rabinChunker;async function*rabin(e,t){const r=await(0,import_rabin_wasm.create)(t.bits,t.min,t.max,t.window),n=new import_BufferList.default;for await(const t of e){n.append(t);const e=r.fingerprint(t);for(let t=0;t<e.length;t++){const r=e[t],o=n.slice(0,r);n.consume(r),yield o}}n.length&&(yield n.slice(0))}var import_BufferList2=__toModule(require_BufferList());async function*fixedSizeChunker(e,t){let r=new import_BufferList2.default,n=0,o=!1;const i=t.maxChunkSize;for await(const t of e)for(r.append(t),n+=t.length;n>=i;)if(yield r.slice(0,i),o=!0,i===r.length)r=new import_BufferList2.default,n=0;else{const e=new import_BufferList2.default;e.append(r.shallowSlice(i)),r=e,n-=i}o&&!n||(yield r.slice(0,n))}var fixed_size_default=fixedSizeChunker,import_err_code4=__toModule(require_err_code());async function*validateChunks(e){for await(const t of e){if(void 0===t.length)throw(0,import_err_code4.default)(new Error("Content was invalid"),"ERR_INVALID_CONTENT");if("string"==typeof t||t instanceof String)yield fromString3(t.toString());else if(Array.isArray(t))yield Uint8Array.from(t);else{if(!(t instanceof Uint8Array))throw(0,import_err_code4.default)(new Error("Content was invalid"),"ERR_INVALID_CONTENT");yield t}}}init_from_string();var validate_chunks_default=validateChunks;function isIterable(e){return Symbol.iterator in e}function isAsyncIterable(e){return Symbol.asyncIterator in e}function contentAsAsyncIterable(e){try{if(e instanceof Uint8Array)return async function*(){yield e}();if(isIterable(e))return async function*(){yield*e}();if(isAsyncIterable(e))return e}catch(e){throw(0,import_err_code5.default)(new Error("Content was invalid"),"ERR_INVALID_CONTENT")}throw(0,import_err_code5.default)(new Error("Content was invalid"),"ERR_INVALID_CONTENT")}async function*dagBuilder(e,t,r){for await(const n of e)if(n.path&&("./"===n.path.substring(0,2)&&(r.wrapWithDirectory=!0),n.path=n.path.split("/").filter(e=>e&&"."!==e).join("/")),n.content){let e,o;e="function"==typeof r.chunker?r.chunker:"rabin"===r.chunker?rabin_default:fixed_size_default,o="function"==typeof r.chunkValidator?r.chunkValidator:validate_chunks_default;const i={path:n.path,mtime:n.mtime,mode:n.mode,content:e(o(contentAsAsyncIterable(n.content),r),r)};yield()=>file_default(i,t,r)}else{if(!n.path)throw new Error("Import candidate must have content or path or both");{const e={path:n.path,mtime:n.mtime,mode:n.mode};yield()=>dir_default(e,t,r)}}}var dag_builder_default=dagBuilder,Dir=class{constructor(e,t){this.options=t||{},this.root=e.root,this.dir=e.dir,this.path=e.path,this.dirty=e.dirty,this.flat=e.flat,this.parent=e.parent,this.parentKey=e.parentKey,this.unixfs=e.unixfs,this.mode=e.mode,this.mtime=e.mtime,this.cid=void 0,this.size=void 0}async put(e,t){}get(e){return Promise.resolve(this)}async*eachChildSeries(){}async*flush(e){}},dir_default2=Dir,DirFlat=class extends dir_default2{constructor(e,t){super(e,t),this._children={}}async put(e,t){this.cid=void 0,this.size=void 0,this._children[e]=t}get(e){return Promise.resolve(this._children[e])}childCount(){return Object.keys(this._children).length}directChildrenCount(){return this.childCount()}onlyChild(){return this._children[Object.keys(this._children)[0]]}async*eachChildSeries(){const e=Object.keys(this._children);for(let t=0;t<e.length;t++){const r=e[t];yield{key:r,child:this._children[r]}}}async*flush(e){const t=Object.keys(this._children),r=[];for(let n=0;n<t.length;n++){let o=this._children[t[n]];if(o instanceof dir_default2)for await(const t of o.flush(e))o=t,yield o;null!=o.size&&o.cid&&r.push({Name:t[n],Tsize:o.size,Hash:o.cid})}const n=new UnixFS({type:"directory",mtime:this.mtime,mode:this.mode}),o={Data:n.marshal(),Links:r},i=encode9(prepare(o)),s=await persist_default(i,e,this.options),a=i.length+o.Links.reduce((e,t)=>e+(null==t.Tsize?0:t.Tsize),0);this.cid=s,this.size=a,yield{cid:s,unixfs:n,path:this.path,size:a}}},dir_flat_default=DirFlat,import_hamt_sharding=__toModule(require_src2()),DirSharded=class extends dir_default2{constructor(e,t){super(e,t),this._bucket=(0,import_hamt_sharding.createHAMT)({hashFn:t.hamtHashFn,bits:t.hamtBucketBits})}async put(e,t){await this._bucket.put(e,t)}get(e){return this._bucket.get(e)}childCount(){return this._bucket.leafCount()}directChildrenCount(){return this._bucket.childrenCount()}onlyChild(){return this._bucket.onlyChild()}async*eachChildSeries(){for await(const{key:e,value:t}of this._bucket.eachLeafSeries())yield{key:e,child:t}}async*flush(e){for await(const t of flush(this._bucket,e,this,this.options))yield{...t,path:this.path}}},dir_sharded_default=DirSharded;async function*flush(e,t,r,n){const o=e._children,i=[];let s=0;for(let e=0;e<o.length;e++){const r=o.get(e);if(!r)continue;const a=e.toString(16).toUpperCase().padStart(2,"0");if(r instanceof import_hamt_sharding.Bucket){let e;for await(const o of await flush(r,t,null,n))e=o;if(!e)throw new Error("Could not flush sharded directory, no subshard found");i.push({Name:a,Tsize:e.size,Hash:e.cid}),s+=e.size}else if("function"==typeof r.value.flush){const e=r.value;let n;for await(const r of e.flush(t))n=r,yield n;const o=a+r.key;i.push({Name:o,Tsize:n.size,Hash:n.cid}),s+=n.size}else{const e=r.value;if(!e.cid)continue;const t=a+r.key,n=e.size;i.push({Name:t,Tsize:n,Hash:e.cid}),s+=n}}const a=Uint8Array.from(o.bitField().reverse()),c=new UnixFS({type:"hamt-sharded-directory",data:a,fanout:e.tableSize(),hashType:n.hamtHashCode,mtime:r&&r.mtime,mode:r&&r.mode}),u=encode9(prepare({Data:c.marshal(),Links:i})),l=await persist_default(u,t,n),d=u.length+s;yield{cid:l,unixfs:c,size:d}}async function flatToShard(e,t,r,n){let o=t;t instanceof dir_flat_default&&t.directChildrenCount()>=r&&(o=await convertToShard(t,n));const i=o.parent;if(i){if(o!==t){if(e&&(e.parent=o),!o.parentKey)throw new Error("No parent key found");await i.put(o.parentKey,o)}return flatToShard(o,i,r,n)}return o}async function convertToShard(e,t){const r=new dir_sharded_default({root:e.root,dir:!0,parent:e.parent,parentKey:e.parentKey,path:e.path,dirty:e.dirty,flat:!1,mtime:e.mtime,mode:e.mode},t);for await(const{key:t,child:n}of e.eachChildSeries())await r.put(t,n);return r}var flat_to_shard_default=flatToShard,toPathComponents=(e="")=>(e.trim().match(/([^\\^/]|\\\/)+/g)||[]).filter(Boolean),to_path_components_default=toPathComponents;async function addToTree(e,t,r){const n=to_path_components_default(e.path||""),o=n.length-1;let i=t,s="";for(let a=0;a<n.length;a++){const c=n[a];s+=`${s?"/":""}${c}`;const u=a===o;if(i.dirty=!0,i.cid=void 0,i.size=void 0,u)await i.put(c,e),t=await flat_to_shard_default(null,i,r.shardSplitThreshold,r);else{let e=await i.get(c);e&&e instanceof dir_default2||(e=new dir_flat_default({root:!1,dir:!0,parent:i,parentKey:c,path:s,dirty:!0,flat:!0,mtime:e&&e.unixfs&&e.unixfs.mtime,mode:e&&e.unixfs&&e.unixfs.mode},r)),await i.put(c,e),i=e}}return t}async function*flushAndYield(e,t){e instanceof dir_default2?yield*e.flush(t):e&&e.unixfs&&e.unixfs.isDirectory()&&(yield e)}async function*treeBuilder(e,t,r){let n=new dir_flat_default({root:!0,dir:!0,path:"",dirty:!0,flat:!0},r);for await(const t of e)t&&(n=await addToTree(t,n,r),t.unixfs&&t.unixfs.isDirectory()||(yield t));if(r.wrapWithDirectory)yield*flushAndYield(n,t);else for await(const e of n.eachChildSeries())e&&(yield*flushAndYield(e.child,t))}var tree_builder_default=treeBuilder;async function*importer(e,t,r={}){const n=options_default(r);let o,i,s;o="function"==typeof r.dagBuilder?r.dagBuilder:dag_builder_default,i="function"==typeof r.treeBuilder?r.treeBuilder:tree_builder_default,s=Symbol.asyncIterator in e||Symbol.iterator in e?e:[e];for await(const e of i((0,import_it_parallel_batch2.default)(o(s,t,n),n.fileImportConcurrency),t,n))yield{cid:e.cid,path:e.path,unixfs:e.unixfs,size:e.size}}var import_err_code6=__toModule(require_err_code());init_from_string();var import_browser_readablestream_to_it=__toModule(require_browser_readablestream_to_it()),import_blob_to_it=__toModule(require_blob_to_it()),import_it_peekable=__toModule(require_it_peekable()),import_it_all2=__toModule(require_it_all()),import_it_map=__toModule(require_it_map());function isBytes(e){return ArrayBuffer.isView(e)||e instanceof ArrayBuffer}function isBlob(e){return e.constructor&&("Blob"===e.constructor.name||"File"===e.constructor.name)&&"function"==typeof e.stream}function isFileObject(e){return"object"==typeof e&&(e.path||e.content)}var isReadableStream=e=>e&&"function"==typeof e.getReader;async function*toAsyncIterable(e){yield e}async function normaliseContent(e){if(isBytes(e))return toAsyncIterable(toBytes(e));if("string"==typeof e||e instanceof String)return toAsyncIterable(toBytes(e.toString()));if(isBlob(e))return(0,import_blob_to_it.default)(e);if(isReadableStream(e)&&(e=(0,import_browser_readablestream_to_it.default)(e)),Symbol.iterator in e||Symbol.asyncIterator in e){const t=(0,import_it_peekable.default)(e),{value:r,done:n}=await t.peek();if(n)return toAsyncIterable(new Uint8Array(0));if(t.push(r),Number.isInteger(r))return toAsyncIterable(Uint8Array.from(await(0,import_it_all2.default)(t)));if(isBytes(r)||"string"==typeof r||r instanceof String)return(0,import_it_map.default)(t,toBytes)}throw(0,import_err_code6.default)(new Error(`Unexpected input: ${e}`),"ERR_UNEXPECTED_INPUT")}function toBytes(e){return e instanceof Uint8Array?e:ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e instanceof ArrayBuffer?new Uint8Array(e):Array.isArray(e)?Uint8Array.from(e):fromString3(e.toString())}var import_err_code7=__toModule(require_err_code()),import_browser_readablestream_to_it2=__toModule(require_browser_readablestream_to_it()),import_it_peekable2=__toModule(require_it_peekable());async function*normaliseCandidateSingle(e,t){if(null==e)throw(0,import_err_code7.default)(new Error(`Unexpected input: ${e}`),"ERR_UNEXPECTED_INPUT");if("string"==typeof e||e instanceof String)yield toFileObject(e.toString(),t);else if(isBytes(e)||isBlob(e))yield toFileObject(e,t);else{if(isReadableStream(e)&&(e=(0,import_browser_readablestream_to_it2.default)(e)),Symbol.iterator in e||Symbol.asyncIterator in e){const r=(0,import_it_peekable2.default)(e),{value:n,done:o}=await r.peek();if(o)return void(yield{content:[]});if(r.push(n),Number.isInteger(n)||isBytes(n)||"string"==typeof n||n instanceof String)return void(yield toFileObject(r,t));throw(0,import_err_code7.default)(new Error("Unexpected input: multiple items passed - if you are using ipfs.add, please use ipfs.addAll instead"),"ERR_UNEXPECTED_INPUT")}if(!isFileObject(e))throw(0,import_err_code7.default)(new Error('Unexpected input: cannot convert "'+typeof e+'" into ImportCandidate'),"ERR_UNEXPECTED_INPUT");yield toFileObject(e,t)}}async function toFileObject(e,t){const{path:r,mode:n,mtime:o,content:i}=e,s={path:r||"",mode:parseMode(n),mtime:parseMtime(o)};return i?s.content=await t(i):r||(s.content=await t(e)),s}function normaliseInput(e){return normaliseCandidateSingle(e,normaliseContent)}var import_err_code8=__toModule(require_err_code()),import_browser_readablestream_to_it3=__toModule(require_browser_readablestream_to_it()),import_it_peekable3=__toModule(require_it_peekable()),import_it_map2=__toModule(require_it_map());async function*normaliseCandidateMultiple(e,t){if("string"==typeof e||e instanceof String||isBytes(e)||isBlob(e)||e._readableState)throw(0,import_err_code8.default)(new Error("Unexpected input: single item passed - if you are using ipfs.addAll, please use ipfs.add instead"),"ERR_UNEXPECTED_INPUT");if(isReadableStream(e)&&(e=(0,import_browser_readablestream_to_it3.default)(e)),Symbol.iterator in e||Symbol.asyncIterator in e){const r=(0,import_it_peekable3.default)(e),{value:n,done:o}=await r.peek();if(o)return void(yield*[]);if(r.push(n),Number.isInteger(n))throw(0,import_err_code8.default)(new Error("Unexpected input: single item passed - if you are using ipfs.addAll, please use ipfs.add instead"),"ERR_UNEXPECTED_INPUT");if(n._readableState)return void(yield*(0,import_it_map2.default)(r,e=>toFileObject2({content:e},t)));if(isBytes(n))return void(yield toFileObject2({content:r},t));if(isFileObject(n)||n[Symbol.iterator]||n[Symbol.asyncIterator]||isReadableStream(n)||isBlob(n))return void(yield*(0,import_it_map2.default)(r,e=>toFileObject2(e,t)))}if(isFileObject(e))throw(0,import_err_code8.default)(new Error("Unexpected input: single item passed - if you are using ipfs.addAll, please use ipfs.add instead"),"ERR_UNEXPECTED_INPUT");throw(0,import_err_code8.default)(new Error("Unexpected input: "+typeof e),"ERR_UNEXPECTED_INPUT")}async function toFileObject2(e,t){const{path:r,mode:n,mtime:o,content:i}=e,s={path:r||"",mode:parseMode(n),mtime:parseMtime(o)};return i?s.content=await t(i):r||(s.content=await t(e)),s}function normaliseInput2(e){return normaliseCandidateMultiple(e,normaliseContent)}function isBytes2(e){return ArrayBuffer.isView(e)||e instanceof ArrayBuffer}function isBlob2(e){return Boolean(e.constructor)&&("Blob"===e.constructor.name||"File"===e.constructor.name)&&"function"==typeof e.stream}function isSingle(e){return"string"==typeof e||e instanceof String||isBytes2(e)||isBlob2(e)||"_readableState"in e}function getNormaliser(e){return isSingle(e)?normaliseInput(e):normaliseInput2(e)}init_src();var errors_exports={};__export(errors_exports,{abortedError:()=>abortedError,notFoundError:()=>notFoundError});var import_err_code9=__toModule(require_err_code());function notFoundError(e){return e=e||new Error("Not Found"),(0,import_err_code9.default)(e,"ERR_NOT_FOUND")}function abortedError(e){return e=e||new Error("Aborted"),(0,import_err_code9.default)(e,"ERR_ABORTED")}var import_it_drain=__toModule(require_it_drain()),import_it_filter=__toModule(require_it_filter()),import_it_take=__toModule(require_it_take()),import_it_all3=__toModule(require_it_all()),sortAll=(e,t)=>async function*(){const r=await(0,import_it_all3.default)(e);yield*r.sort(t)}(),BaseBlockstore=class{open(){return Promise.reject(new Error(".open is not implemented"))}close(){return Promise.reject(new Error(".close is not implemented"))}put(e,t,r){return Promise.reject(new Error(".put is not implemented"))}get(e,t){return Promise.reject(new Error(".get is not implemented"))}has(e,t){return Promise.reject(new Error(".has is not implemented"))}delete(e,t){return Promise.reject(new Error(".delete is not implemented"))}async*putMany(e,t={}){for await(const{key:r,value:n}of e)await this.put(r,n,t),yield{key:r,value:n}}async*getMany(e,t={}){for await(const r of e)yield this.get(r,t)}async*deleteMany(e,t={}){for await(const r of e)await this.delete(r,t),yield r}batch(){let e=[],t=[];return{put(t,r){e.push({key:t,value:r})},delete(e){t.push(e)},commit:async r=>{await(0,import_it_drain.default)(this.putMany(e,r)),e=[],await(0,import_it_drain.default)(this.deleteMany(t,r)),t=[]}}}async*_all(e,t){throw new Error("._all is not implemented")}async*_allKeys(e,t){throw new Error("._allKeys is not implemented")}query(e,t){let r=this._all(e,t);if(null!=e.prefix&&(r=(0,import_it_filter.default)(r,t=>t.key.toString().startsWith(e.prefix||""))),Array.isArray(e.filters)&&(r=e.filters.reduce((e,t)=>(0,import_it_filter.default)(e,t),r)),Array.isArray(e.orders)&&(r=e.orders.reduce((e,t)=>sortAll(e,t),r)),null!=e.offset){let t=0;r=(0,import_it_filter.default)(r,()=>t++>=(e.offset||0))}return null!=e.limit&&(r=(0,import_it_take.default)(r,e.limit)),r}queryKeys(e,t){let r=this._allKeys(e,t);if(null!=e.prefix&&(r=(0,import_it_filter.default)(r,t=>t.toString().startsWith(e.prefix||""))),Array.isArray(e.filters)&&(r=e.filters.reduce((e,t)=>(0,import_it_filter.default)(e,t),r)),Array.isArray(e.orders)&&(r=e.orders.reduce((e,t)=>sortAll(e,t),r)),null!=e.offset){let t=0;r=(0,import_it_filter.default)(r,()=>t++>=e.offset)}return null!=e.limit&&(r=(0,import_it_take.default)(r,e.limit)),r}};init_base32(),init_raw(),init_cid(),init_digest();var Errors2={...errors_exports},MemoryBlockStore=class extends BaseBlockstore{constructor(){super(),this.store=new Map}async*blocks(){for(const[e,t]of this.store.entries())yield{cid:CID.parse(e),bytes:t}}put(e,t){return this.store.set(e.toString(),t),Promise.resolve()}get(e){const t=this.store.get(e.toString());if(!t)throw new Error(`block with cid ${e.toString()} no found`);return Promise.resolve(t)}has(e){return Promise.resolve(this.store.has(e.toString()))}close(){return this.store.clear(),Promise.resolve()}};init_sha2_browser();var unixfsImporterOptionsDefault={cidVersion:1,chunker:"fixed",maxChunkSize:262144,hasher:sha256,rawLeaves:!0,wrapWithDirectory:!0,maxChildrenPerNode:174};async function pack({input:e,blockstore:t,hasher:r,maxChunkSize:n,maxChildrenPerNode:o,wrapWithDirectory:i,rawLeaves:s}){if(!e||Array.isArray(e)&&!e.length)throw new Error("missing input file(s)");const a=t||new MemoryBlockStore,c=await(0,import_it_last.default)((0,import_it_pipe.default)(getNormaliser(e),e=>importer(e,a,{...unixfsImporterOptionsDefault,hasher:r||unixfsImporterOptionsDefault.hasher,maxChunkSize:n||unixfsImporterOptionsDefault.maxChunkSize,maxChildrenPerNode:o||unixfsImporterOptionsDefault.maxChildrenPerNode,wrapWithDirectory:!1!==i&&unixfsImporterOptionsDefault.wrapWithDirectory,rawLeaves:null==s?unixfsImporterOptionsDefault.rawLeaves:s})));if(!c||!c.cid)throw new Error("given input could not be parsed correctly");const u=c.cid,{writer:l,out:d}=await CarWriter.create([u]),f=d[Symbol.asyncIterator]();let h;return{root:u,out:{[Symbol.asyncIterator](){if(null!=h)throw new Error("Multiple iterator not supported");return h=(async()=>{for await(const e of a.blocks())await l.put(e);await l.close(),t||await a.close()})(),{async next(){const e=await f.next();return e.done&&await h,e}}}}}}init_cid(),init_cid(),init_sha2_browser();var esm_exports2={};__export(esm_exports2,{code:()=>code5,decode:()=>decode10,encode:()=>encode11,name:()=>name5}),init_cid();var CID_CBOR_TAG3=42;function cidEncoder3(e){if(e.asCID!==e)return null;const t=CID.asCID(e);if(!t)return null;const r=new Uint8Array(t.bytes.byteLength+1);return r.set(t.bytes,1),[new Token(Type.tag,CID_CBOR_TAG3),new Token(Type.bytes,r)]}function undefinedEncoder3(){throw new Error("`undefined` is not supported by the IPLD Data Model and cannot be encoded")}function numberEncoder3(e){if(Number.isNaN(e))throw new Error("`NaN` is not supported by the IPLD Data Model and cannot be encoded");if(e===1/0||e===-1/0)throw new Error("`Infinity` and `-Infinity` is not supported by the IPLD Data Model and cannot be encoded");return null}var encodeOptions3={float64:!0,typeEncoders:{Object:cidEncoder3,undefined:undefinedEncoder3,number:numberEncoder3}};function cidDecoder3(e){if(0!==e[0])throw new Error("Invalid CID for CBOR tag 42; expected leading 0x00");return CID.decode(e.subarray(1))}var decodeOptions3={allowIndefinite:!1,allowUndefined:!1,allowNaN:!1,allowInfinity:!1,allowBigInt:!0,strict:!0,useMaps:!1,tags:[]};decodeOptions3.tags[CID_CBOR_TAG3]=cidDecoder3;var name5="dag-cbor",code5=113,encode11=e=>encode4(e,encodeOptions3),decode10=e=>decode5(e,decodeOptions3),fetch2=globalThis.fetch,FormData=globalThis.FormData,Headers=globalThis.Headers,Request=globalThis.Request,Response2=globalThis.Response,Blob2=globalThis.Blob,File2=globalThis.File,ReadableStream=globalThis.ReadableStream,Blockstore=MemoryBlockStore,GATEWAY=new URL("https://dweb.link/"),toGatewayURL=(e,t={})=>{const r=t.gateway||GATEWAY;return"ipfs:"===(e=new URL(String(e))).protocol?new URL(`/ipfs/${e.href.slice(7)}`,r):e},BlockstoreCarReader=class{constructor(e,t,r){this._version=e,this._roots=t,this._blockstore=r}get version(){return this._version}get blockstore(){return this._blockstore}async getRoots(){return this._roots}has(e){return this._blockstore.has(e)}async get(e){return{cid:e,bytes:await this._blockstore.get(e)}}blocks(){return this._blockstore.blocks()}async*cids(){for await(const e of this.blocks())yield e.cid}},Token2=class{constructor(e,t,r){this.ipnft=e,this.url=t,this.data=r,Object.defineProperties(this,{ipnft:{enumerable:!0,writable:!1},url:{enumerable:!0,writable:!1},data:{enumerable:!1,writable:!1}})}embed(){return Token2.embed(this)}static embed({data:e}){return embed(e,{gateway:GATEWAY})}static async encode(e){const t=new Blockstore,[r,n]=mapTokenInputBlobs(e),o=JSON.parse(JSON.stringify(n)),i=JSON.parse(JSON.stringify(n));for(const[e,n]of r.entries()){const r=n.name||"blob",s=n.stream(),{root:a}=await pack({input:[{path:r,content:s}],blockstore:t,wrapWithDirectory:!0}),c=new URL(`ipfs://${a}/${r}`),u=e.split(".");setIn(o,u,c),setIn(i,u,a)}const{root:s}=await pack({input:[{path:"metadata.json",content:JSON.stringify(o)}],blockstore:t,wrapWithDirectory:!1}),a=await encode6({value:{...i,"metadata.json":s,type:"nft"},codec:esm_exports2,hasher:sha256});return await t.put(a.cid,a.bytes),{cid:a.cid,token:new Token2(a.cid.toString(),`ipfs://${a.cid}/metadata.json`,o),car:new BlockstoreCarReader(1,[a.cid],t)}}},embed=(e,t)=>mapWith(e,isURL,embedURL,t),isURL=e=>e instanceof URL,embedURL=(e,t)=>[e,toGatewayURL(t,e)],isObject=e=>"object"==typeof e&&null!=e,encodeBlob=(e,t,r)=>(e.set(r.join("."),t),[e,void 0]),isBlob3=e=>e instanceof Blob2,mapTokenInputBlobs=e=>mapValueWith(e,isBlob3,encodeBlob,new Map,[]),mapWith=(e,t,r,n)=>{const[,o]=mapValueWith(e,t,r,n,[]);return o},mapValueWith=(e,t,r,n,o)=>t(e,n,o)?r(n,e,o):Array.isArray(e)?mapArrayWith(e,t,r,n,o):isObject(e)?mapObjectWith(e,t,r,n,o):[n,e],mapObjectWith=(e,t,r,n,o)=>{let i=n;const s={};for(const[n,a]of Object.entries(e)){const[e,c]=mapValueWith(a,t,r,i,[...o,n]);s[n]=c,i=e}return[i,s]},mapArrayWith=(e,t,r,n,o)=>{const i=[];let s=n;for(const[n,a]of e.entries()){const[e,c]=mapValueWith(a,t,r,s,[...o,n]);i[n]=c,s=e}return[s,i]},setIn=(e,t,r)=>{const n=t.length-1;let o=e;for(let[e,i]of t.entries())e===n?o[i]=r:o=o[i]},MAX_STORE_RETRIES=5,MAX_CONCURRENT_UPLOADS=3,MAX_CHUNK_SIZE=10485760,NFTStorage=class{constructor({token:e,endpoint:t=new URL("https://api.nft.storage")}){this.token=e,this.endpoint=t}static auth(e){if(!e)throw new Error("missing token");return{Authorization:`Bearer ${e}`,"X-Client":"nft.storage/js"}}static async storeBlob(e,t){const r=new Blockstore;let n;try{const{cid:o,car:i}=await NFTStorage.encodeBlob(t,{blockstore:r});await NFTStorage.storeCar(e,i),n=o.toString()}finally{await r.close()}return n}static async storeCar({endpoint:e,token:t},r,{onStoredChunk:n,maxRetries:o,decoders:i}={}){const s=new URL("upload/",e),a=NFTStorage.auth(t),c=MAX_CHUNK_SIZE,u=r instanceof Blob2?await TreewalkCarSplitter.fromBlob(r,c,{decoders:i}):new TreewalkCarSplitter(r,c,{decoders:i}),l=transform(MAX_CONCURRENT_UPLOADS,async function(e){const t=[];for await(const r of e)t.push(r);const r=new Blob2(t,{type:"application/car"}),i=await(0,import_p_retry.default)(async()=>{const e=await fetch2(s.toString(),{method:"POST",headers:a,body:r}),t=await e.json();if(!t.ok){if(401===e.status)throw new import_p_retry.AbortError(t.error.message);throw new Error(t.error.message)}return t.value.cid},{retries:null==o?MAX_STORE_RETRIES:o});return n&&n(r.size),i});let d;for await(const e of l(u.cars()))d=e;return d}static async storeDirectory(e,t){const r=new Blockstore;let n;try{const{cid:o,car:i}=await NFTStorage.encodeDirectory(t,{blockstore:r});await NFTStorage.storeCar(e,i),n=o.toString()}finally{await r.close()}return n}static async store(e,t){const{token:r,car:n}=await NFTStorage.encodeNFT(t);return await NFTStorage.storeCar(e,n),r}static async status({endpoint:e,token:t},r){const n=new URL(`${r}/`,e),o=await fetch2(n.toString(),{method:"GET",headers:NFTStorage.auth(t)}),i=await o.json();if(i.ok)return{cid:i.value.cid,deals:decodeDeals(i.value.deals),size:i.value.size,pin:decodePin(i.value.pin),created:new Date(i.value.created)};throw new Error(i.error.message)}static async check({endpoint:e},t){const r=new URL(`check/${t}/`,e),n=await fetch2(r.toString()),o=await n.json();if(o.ok)return{cid:o.value.cid,deals:decodeDeals(o.value.deals),pin:o.value.pin};throw new Error(o.error.message)}static async delete({endpoint:e,token:t},r){const n=new URL(`${r}/`,e),o=await fetch2(n.toString(),{method:"DELETE",headers:NFTStorage.auth(t)}),i=await o.json();if(!i.ok)throw new Error(i.error.message)}static async encodeNFT(e){return validateERC1155(e),Token2.encode(e)}static async encodeBlob(e,{blockstore:t}={}){if(0===e.size)throw new Error("Content size is 0, make sure to provide some content");return packCar([{path:"blob",content:e.stream()}],{blockstore:t,wrapWithDirectory:!1})}static async encodeDirectory(e,{blockstore:t}={}){const r=[];let n=0;for(const t of e)r.push({path:t.name,content:t.stream()}),n+=t.size;if(0===n)throw new Error("Total size of files should exceed 0, make sure to provide some content");return packCar(r,{blockstore:t,wrapWithDirectory:!0})}storeBlob(e){return NFTStorage.storeBlob(this,e)}storeCar(e,t){return NFTStorage.storeCar(this,e,t)}storeDirectory(e){return NFTStorage.storeDirectory(this,e)}status(e){return NFTStorage.status(this,e)}delete(e){return NFTStorage.delete(this,e)}check(e){return NFTStorage.check(this,e)}store(e){return NFTStorage.store(this,e)}},validateERC1155=({name:e,description:t,image:r,decimals:n})=>{if("string"!=typeof e)throw new TypeError("string property `name` identifying the asset is required");if("string"!=typeof t)throw new TypeError("string property `description` describing asset is required");if(!(r instanceof Blob2))throw new TypeError("property `image` must be a Blob or File object");if(r.type.startsWith("image/")||console.warn("According to ERC721 Metadata JSON Schema 'image' must have 'image/*' mime type.\n\nFor better interoperability we would highly recommend storing content with different mime type under 'properties' namespace e.g. `properties: { video: file }` and using 'image' field for storing a preview image for it instead.\n\nFor more context please see ERC-721 specification https://eips.ethereum.org/EIPS/eip-721"),void 0!==n&&"number"!=typeof n)throw new TypeError("property `decimals` must be an integer value")},packCar=async(e,{blockstore:t,wrapWithDirectory:r}={})=>{t=t||new Blockstore;const{root:n}=await pack({input:e,blockstore:t,wrapWithDirectory:r});return{cid:n,car:new BlockstoreCarReader(1,[n],t)}},decodeDeals=e=>e.map(e=>{const{dealActivation:t,dealExpiration:r,lastChanged:n}={dealExpiration:null,dealActivation:null,...e};return{...e,lastChanged:new Date(n),...t&&{dealActivation:new Date(t)},...r&&{dealExpiration:new Date(r)}}}),decodePin=e=>({...e,created:new Date(e.created)}),import_path_browserify=__toModule(require_path_browserify()),file=File,blob=Blob,textEncoder5=TextEncoder,dummyFS={promises:{readFile(){throw new Error("not implemented in browser")},stat(){throw new Error("not implemented in browser")},readdir(){throw new Error("not implemented in browser")}}},fileSchema={type:"object",properties:{uri:{type:"string"},type:{type:"string"},cdn:{type:"boolean",nullable:!0}},required:["uri","type"]},attributeSchema={type:"object",properties:{trait_type:{type:"string"},value:{anyOf:[{type:"string"},{type:"number"}]},display_type:{type:"string",nullable:!0},max_value:{type:"number",nullable:!0},trait_count:{type:"number",nullable:!0}},required:["trait_type","value"]},creatorSchema={type:"object",properties:{address:{type:"string"},share:{type:"number"}},required:["address","share"]},metadataSchema={type:"object",properties:{name:{type:"string"},symbol:{type:"string",nullable:!0},description:{type:"string",nullable:!0},seller_fee_basis_points:{type:"number",nullable:!0},image:{type:"string"},animation_url:{type:"string",nullable:!0},external_url:{type:"string",nullable:!0},attributes:{type:"array",nullable:!0,items:attributeSchema},properties:{type:"object",properties:{files:{type:"array",items:fileSchema},category:{type:"string",nullable:!0},creators:{type:"array",items:creatorSchema,nullable:!0}},additionalProperties:!0,required:["files"]},collection:{type:"object",nullable:!0,properties:{name:{type:"string"},family:{type:"string"}},required:["name","family"]}},required:["name","image","properties"]},import_ajv=__toModule(require_ajv()),ajv=new import_ajv.default,validateMetadata=ajv.compile(metadataSchema);function ensureValidMetadata(e){if(!validateMetadata(e))throw new ValidationError(validateMetadata.errors);return e}var ValidationError=class extends Error{constructor(e){const t=[];for(const r of e)switch(r.keyword){case"required":t.push(`- required property ${r.params.missingProperty} missing`);break;case"propertyNames":t.push(`- invalid property name: ${r.params.propertyName}`);break;default:t.push(r.message||"unknown error")}super("metadata had validation errors: \n"+t.join("\n")),this.errors=e}},DEFAULT_GATEWAY_HOST="https://nftstorage.link",isBrowser="undefined"!=typeof window&&void 0!==window.document;function makeGatewayURL(e,t,r=DEFAULT_GATEWAY_HOST){let n=`/ipfs/${e}`;t&&(n+="/"),r=r||DEFAULT_GATEWAY_HOST;const o=new URL(n,r);return new URL(t,o).toString()}function makeIPFSURI(e,t){return new URL(t,`ipfs://${e}`).toString()}async function prepareMetaplexNFT(e,t,r={}){const n=r.validateSchema?ensureValidMetadata(e):e,o=r.additionalAssetFiles||[],i=r.blockstore||new MemoryBlockStore,s=[t,...o],a=await NFTStorage.encodeDirectory(s,{blockstore:i}),c=replaceFileRefsWithIPFSLinks(n,t.name||"image.png",o.map(e=>e.name),a.cid.toString(),r.gatewayHost),u=new file([JSON.stringify(c)],"metadata.json"),l=await NFTStorage.encodeDirectory([u],{blockstore:i}),d=makeGatewayURL(l.cid.toString(),"metadata.json",r.gatewayHost),f=makeIPFSURI(l.cid.toString(),"metadata.json");return{metadata:c,encodedMetadata:l,encodedAssets:a,metadataGatewayURL:d,metadataURI:f,blockstore:i}}function replaceFileRefsWithIPFSLinks(e,t,r,n,o){const i=makeGatewayURL(n,t,o),s=((e.properties||{}).files||[]).flatMap(e=>e.uri===t||r.includes(e.uri)?[{...e,uri:makeGatewayURL(n,e.uri,o),cdn:!0},{...e,uri:makeIPFSURI(n,e.uri),cdn:!1}]:[e]);let a=e.animation_url;return a&&r.includes(a)&&(a=makeGatewayURL(n,a,o)),{...e,image:i,animation_url:a,properties:{...e.properties,files:s}}}async function loadNFTFromFilesystem(e,t,r={}){if(isBrowser)throw new Error("loadNFTFromFilesystem is only supported on node.js");const n=await dummyFS.promises.readFile(e,{encoding:"utf-8"}),o=JSON.parse(n),i=r.validateSchema?ensureValidMetadata(o):o,s=import_path_browserify.default.dirname(e);if(!t){const r=import_path_browserify.default.resolve(s,i.image);if(i.image&&await fileExists(r))t=r;else{const r=import_path_browserify.default.basename(e,".json"),n=import_path_browserify.default.resolve(s,r+".png");await fileExists(n)&&(t=n)}}if(!t)throw new Error("unable to determine path to image.");const a=await fileFromPath(t,s),c=new Set,u=(i.properties||{}).files||[];for(const e of u){const t=import_path_browserify.default.resolve(s,e.uri);await fileExists(t)&&c.add(t)}c.delete(import_path_browserify.default.basename(t));const l=[...c].map(e=>fileFromPath(e,s));return prepareMetaplexNFT(i,a,{additionalAssetFiles:await Promise.all(l),blockstore:r.blockstore,gatewayHost:r.gatewayHost,validateSchema:r.validateSchema})}async function*loadAllNFTsFromDirectory(e,t={}){for await(const r of walk(e)){if(!r.endsWith(".json"))continue;const e=await loadNFTFromFilesystem(r,void 0,t);yield e}}async function fileFromPath(e,t=""){const r=await dummyFS.promises.readFile(e),n=import_path_browserify.default.relative(t,e);return new File2([r],n)}async function fileExists(e){if(isBrowser)return!1;try{return await dummyFS.promises.stat(e),!0}catch(e){return!1}}async function*walk(e){if(isBrowser)return;const t=await dummyFS.promises.readdir(e);for(const r of t){if((await dummyFS.promises.stat(import_path_browserify.default.join(e,r))).isDirectory())for await(const t of walk(import_path_browserify.default.join(e,r)))yield t;else yield import_path_browserify.default.join(e,r)}}init_sha2_browser();var BlockstoreCarReader2=class{constructor(e,t,r){this._version=e,this._roots=t,this._blockstore=r}get version(){return this._version}get blockstore(){return this._blockstore}async getRoots(){return this._roots}has(e){return this._blockstore.has(e)}async get(e){return{cid:e,bytes:await this._blockstore.get(e)}}blocks(){return this._blockstore.blocks()}async*cids(){for await(const e of this.blocks())yield e.cid}},_NFTBundle=class{constructor(e={}){this._blockstore=e.blockstore||new MemoryBlockStore,this._nfts={}}async addNFT(e,t,r,n={}){this._enforceMaxEntries(),this._enforceMaxIdLength(e);const o=await prepareMetaplexNFT(t,r,{...n,blockstore:this._blockstore});return this._addManifestEntry(e,o),o}async addNFTFromFileSystem(e,t,r={}){this._enforceMaxEntries();let n=r.id;n||(n=import_path_browserify.default.basename(e,".json")),this._enforceMaxIdLength(n);const o=await loadNFTFromFilesystem(e,t,{...r,blockstore:this._blockstore});return this._addManifestEntry(n,o),o}_enforceMaxEntries(){if(Object.keys(this._nfts).length>=_NFTBundle.MAX_ENTRIES)throw new Error(`unable to add more than ${_NFTBundle.MAX_ENTRIES} to a bundle.`)}_enforceMaxIdLength(e){if((new textEncoder5).encode(e).byteLength>_NFTBundle.MAX_ID_LEN)throw new Error(`NFT id exceeds max length (${_NFTBundle.MAX_ID_LEN} bytes): ${e}`)}_addManifestEntry(e,t){if(e in this._nfts)throw new Error(`duplicate id in bundle: an entry with id "${e}" has already been added.`);this._nfts[e]=t}manifest(){return{...this._nfts}}async makeRootBlock(){let e=[];for(const[t,r]of Object.entries(this._nfts)){const n=await wrapperDirForNFT(r),o=createLink(t,n.bytes.byteLength,n.cid);await this._blockstore.put(n.cid,n.bytes),e.push(o)}return makeDirectoryBlock(e)}async getRawSize(){let e=0;for await(const t of this._blockstore.blocks())e+=t.bytes.byteLength;return e}async asCAR(){const e=await this.makeRootBlock();await this._blockstore.put(e.cid,e.bytes);return{car:new BlockstoreCarReader2(1,[e.cid],this._blockstore),cid:e.cid}}},NFTBundle=_NFTBundle;async function wrapperDirForNFT(e){const t=await e.encodedMetadata.car.get(e.encodedMetadata.cid),r=await e.encodedAssets.car.get(e.encodedAssets.cid);if(!t||!r)throw new Error("invalid PackagedNFT: missing root blocks");const n=createLink("metadata",t.bytes.byteLength,e.encodedMetadata.cid);return makeDirectoryBlock([createLink("assets",r.bytes.byteLength,e.encodedAssets.cid),n])}async function makeDirectoryBlock(e){const t=createNode(new UnixFS({type:"directory"}).marshal(),e);return encode6({value:t,codec:src_exports,hasher:sha256})}NFTBundle.MAX_ENTRIES=2200,NFTBundle.MAX_ID_LEN=64;var DEFAULT_ENDPOINT=new URL("https://api.nft.storage"),NFTStorageMetaplexor=class{static init(){this._initialized||(NFTStorage.auth=e=>({"x-web3auth":`Metaplex ${e}`}),this._initialized=!0)}constructor({auth:e,endpoint:t}){this.auth=e,this.endpoint=t||DEFAULT_ENDPOINT}static withSecretKey(e,t){const{solanaCluster:r,mintingAgent:n,agentVersion:o,endpoint:i}=t,s=MetaplexAuthWithSecretKey(e,{solanaCluster:r,mintingAgent:n,agentVersion:o});return new NFTStorageMetaplexor({auth:s,endpoint:i})}static withSigner(e,t,r){const{solanaCluster:n,mintingAgent:o,agentVersion:i,endpoint:s}=r,a=MetaplexAuthWithSigner(e,t,{solanaCluster:n,mintingAgent:o,agentVersion:i});return new NFTStorageMetaplexor({auth:a,endpoint:s})}static async storeBlob(e,t){this.init();const{cid:r,car:n}=await NFTStorage.encodeBlob(t);return this.storeCar(e,r,n)}static async storeDirectory(e,t){this.init();const{cid:r,car:n}=await NFTStorage.encodeDirectory(t);return this.storeCar(e,r,n)}static async storeCar(e,t,r,n){this.init();const{auth:o}=e,i=e.endpoint||DEFAULT_ENDPOINT,s=new URL("/metaplex/",i),a=await makeMetaplexUploadToken(o,t.toString());return NFTStorage.storeCar({endpoint:s,token:a},r,n)}static async storePreparedNFT(e,t,r){this.init();const n=await this.storeCar(e,t.encodedMetadata.cid,t.encodedMetadata.car,r),o=await this.storeCar(e,t.encodedAssets.cid,t.encodedAssets.car,r),{metadataGatewayURL:i,metadataURI:s}=t;return{metadataRootCID:n,assetRootCID:o,metadataGatewayURL:i,metadataURI:s,metadata:t.metadata}}static async storeNFTFromFilesystem(e,t,r,n={}){if(isBrowser)throw new Error("storeNFTFromFilesystem is only available on node.js");const o=await loadNFTFromFilesystem(t,r,n);return this.storePreparedNFT(e,o,n.storeCarOptions)}async storeBlob(e){const{cid:t,car:r}=await NFTStorage.encodeBlob(e);return NFTStorageMetaplexor.storeCar(this,t,r)}async storeCar(e,t,r){return NFTStorageMetaplexor.storeCar(this,e,t,r)}async storeDirectory(e){return NFTStorageMetaplexor.storeDirectory(this,e)}async storePreparedNFT(e,t){return NFTStorageMetaplexor.storePreparedNFT(this,e,t)}async storeNFTFromFilesystem(e,t,r={}){return NFTStorageMetaplexor.storeNFTFromFilesystem(this,e,t,r)}};export{blob as Blob,file as File,MetaplexAuthWithSecretKey,MetaplexAuthWithSigner,NFTBundle,NFTStorageMetaplexor,TagChain,TagMintingAgent,TagMintingAgentVersion,TagSolanaCluster,ValidationError,ensureValidMetadata,keyDID,loadAllNFTsFromDirectory,loadNFTFromFilesystem,makeMetaplexUploadToken,metadataSchema,prepareMetaplexNFT,validateMetadata};
/*!
 * The buffer module from node.js, for the browser.
 *
 * @author   Feross Aboukhadijeh <https://feross.org>
 * @license  MIT
 */
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
/** @license URI.js v4.4.1 (c) 2011 Gary Court. License: http://github.com/garycourt/uri-js */
//# sourceMappingURL=/sm/d64d91f01efa733d1b3f7f60e3c5c01f082132e49528efee6e169aa264d413f1.map