@web5/credentials
Version:
Verifiable Credentials
1 lines • 1.19 MB
JavaScript
var Iz=Object.create;var Ay=Object.defineProperty;var Bz=Object.getOwnPropertyDescriptor;var kz=Object.getOwnPropertyNames;var Rz=Object.getPrototypeOf,$z=Object.prototype.hasOwnProperty;var CO=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,r)=>(typeof require<"u"?require:e)[r]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var ct=(t,e)=>()=>(t&&(e=t(t=0)),e);var v=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Rr=(t,e)=>{for(var r in e)Ay(t,r,{get:e[r],enumerable:!0})},PO=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of kz(e))!$z.call(t,s)&&s!==r&&Ay(t,s,{get:()=>e[s],enumerable:!(n=Bz(e,s))||n.enumerable});return t};var Ds=(t,e,r)=>(r=t!=null?Iz(Rz(t)):{},PO(e||!t||!t.__esModule?Ay(r,"default",{value:t,enumerable:!0}):r,t)),OO=t=>PO(Ay({},"__esModule",{value:!0}),t);var TO=v((Nwe,FO)=>{var jz=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,Dy=()=>jz.now(),Nz=t=>t&&t===Math.floor(t)&&t>0&&isFinite(t),z_=t=>t===1/0||Nz(t),H_=class t{constructor({max:e=1/0,ttl:r,updateAgeOnGet:n=!1,checkAgeOnGet:s=!1,noUpdateTTL:i=!1,dispose:o,noDisposeOnSet:a=!1}={}){if(this.expirations=Object.create(null),this.data=new Map,this.expirationMap=new Map,r!==void 0&&!z_(r))throw new TypeError("ttl must be positive integer or Infinity if set");if(!z_(e))throw new TypeError("max must be positive integer or Infinity");if(this.ttl=r,this.max=e,this.updateAgeOnGet=!!n,this.checkAgeOnGet=!!s,this.noUpdateTTL=!!i,this.noDisposeOnSet=!!a,o!==void 0){if(typeof o!="function")throw new TypeError("dispose must be function if set");this.dispose=o}this.timer=void 0,this.timerExpiration=void 0}setTimer(e,r){if(this.timerExpiration<e)return;this.timer&&clearTimeout(this.timer);let n=setTimeout(()=>{this.timer=void 0,this.timerExpiration=void 0,this.purgeStale();for(let s in this.expirations){this.setTimer(s,s-Dy());break}},r);n.unref&&n.unref(),this.timerExpiration=e,this.timer=n}cancelTimer(){this.timer&&(clearTimeout(this.timer),this.timerExpiration=void 0,this.timer=void 0)}cancelTimers(){return process.emitWarning('TTLCache.cancelTimers has been renamed to TTLCache.cancelTimer (no "s"), and will be removed in the next major version update'),this.cancelTimer()}clear(){let e=this.dispose!==t.prototype.dispose?[...this]:[];this.data.clear(),this.expirationMap.clear(),this.cancelTimer(),this.expirations=Object.create(null);for(let[r,n]of e)this.dispose(n,r,"delete")}setTTL(e,r=this.ttl){let n=this.expirationMap.get(e);if(n!==void 0){let s=this.expirations[n];!s||s.length<=1?delete this.expirations[n]:this.expirations[n]=s.filter(i=>i!==e)}if(r!==1/0){let s=Math.floor(Dy()+r);this.expirationMap.set(e,s),this.expirations[s]||(this.expirations[s]=[],this.setTimer(s,r)),this.expirations[s].push(e)}else this.expirationMap.set(e,1/0)}set(e,r,{ttl:n=this.ttl,noUpdateTTL:s=this.noUpdateTTL,noDisposeOnSet:i=this.noDisposeOnSet}={}){if(!z_(n))throw new TypeError("ttl must be positive integer or Infinity");if(this.expirationMap.has(e)){s||this.setTTL(e,n);let o=this.data.get(e);o!==r&&(this.data.set(e,r),i||this.dispose(o,e,"set"))}else this.setTTL(e,n),this.data.set(e,r);for(;this.size>this.max;)this.purgeToCapacity();return this}has(e){return this.data.has(e)}getRemainingTTL(e){let r=this.expirationMap.get(e);return r===1/0?r:r!==void 0?Math.max(0,Math.ceil(r-Dy())):0}get(e,{updateAgeOnGet:r=this.updateAgeOnGet,ttl:n=this.ttl,checkAgeOnGet:s=this.checkAgeOnGet}={}){let i=this.data.get(e);if(s&&this.getRemainingTTL(e)===0){this.delete(e);return}return r&&this.setTTL(e,n),i}dispose(e,r){}delete(e){let r=this.expirationMap.get(e);if(r!==void 0){let n=this.data.get(e);this.data.delete(e),this.expirationMap.delete(e);let s=this.expirations[r];return s&&(s.length<=1?delete this.expirations[r]:this.expirations[r]=s.filter(i=>i!==e)),this.dispose(n,e,"delete"),this.size===0&&this.cancelTimer(),!0}return!1}purgeToCapacity(){for(let e in this.expirations){let r=this.expirations[e];if(this.size-r.length>=this.max){delete this.expirations[e];let n=[];for(let s of r)n.push([s,this.data.get(s)]),this.data.delete(s),this.expirationMap.delete(s);for(let[s,i]of n)this.dispose(i,s,"evict")}else{let n=this.size-this.max,s=[];for(let i of r.splice(0,n))s.push([i,this.data.get(i)]),this.data.delete(i),this.expirationMap.delete(i);for(let[i,o]of s)this.dispose(o,i,"evict");return}}}get size(){return this.data.size}purgeStale(){let e=Math.ceil(Dy());for(let r in this.expirations){if(r==="Infinity"||r>e)return;let n=[...this.expirations[r]||[]],s=[];delete this.expirations[r];for(let i of n)s.push([i,this.data.get(i)]),this.data.delete(i),this.expirationMap.delete(i);for(let[i,o]of s)this.dispose(o,i,"stale")}this.size===0&&this.cancelTimer()}*entries(){for(let e in this.expirations)for(let r of this.expirations[e])yield[r,this.data.get(r)]}*keys(){for(let e in this.expirations)for(let r of this.expirations[e])yield r}*values(){for(let e in this.expirations)for(let r of this.expirations[e])yield this.data.get(r)}[Symbol.iterator](){return this.entries()}};FO.exports=H_});var JO=v(WO=>{"use strict";WO.supports=function(...e){let r=e.reduce((n,s)=>Object.assign(n,s),{});return Object.assign(r,{snapshots:r.snapshots||!1,permanence:r.permanence||!1,seek:r.seek||!1,clear:r.clear||!1,getMany:r.getMany||!1,keyIterator:r.keyIterator||!1,valueIterator:r.valueIterator||!1,iteratorNextv:r.iteratorNextv||!1,iteratorAll:r.iteratorAll||!1,status:r.status||!1,createIfMissing:r.createIfMissing||!1,errorIfExists:r.errorIfExists||!1,deferredOpen:r.deferredOpen||!1,promises:r.promises||!1,streams:r.streams||!1,encodings:Object.assign({},r.encodings),events:Object.assign({},r.events),additionalMethods:Object.assign({},r.additionalMethods)})}});var Hi=v(($Ee,GO)=>{"use strict";GO.exports=class extends Error{constructor(e,r){super(e||""),typeof r=="object"&&r!==null&&(r.code&&(this.code=String(r.code)),r.expected&&(this.expected=!0),r.transient&&(this.transient=!0),r.cause&&(this.cause=r.cause)),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}}});var YO=v(Cy=>{"use strict";Cy.byteLength=vH;Cy.toByteArray=_H;Cy.fromByteArray=SH;var Cs=[],pi=[],gH=typeof Uint8Array<"u"?Uint8Array:Array,o1="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(Uu=0,ZO=o1.length;Uu<ZO;++Uu)Cs[Uu]=o1[Uu],pi[o1.charCodeAt(Uu)]=Uu;var Uu,ZO;pi[45]=62;pi[95]=63;function XO(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");r===-1&&(r=e);var n=r===e?0:4-r%4;return[r,n]}function vH(t){var e=XO(t),r=e[0],n=e[1];return(r+n)*3/4-n}function bH(t,e,r){return(e+r)*3/4-r}function _H(t){var e,r=XO(t),n=r[0],s=r[1],i=new gH(bH(t,n,s)),o=0,a=s>0?n-4:n,c;for(c=0;c<a;c+=4)e=pi[t.charCodeAt(c)]<<18|pi[t.charCodeAt(c+1)]<<12|pi[t.charCodeAt(c+2)]<<6|pi[t.charCodeAt(c+3)],i[o++]=e>>16&255,i[o++]=e>>8&255,i[o++]=e&255;return s===2&&(e=pi[t.charCodeAt(c)]<<2|pi[t.charCodeAt(c+1)]>>4,i[o++]=e&255),s===1&&(e=pi[t.charCodeAt(c)]<<10|pi[t.charCodeAt(c+1)]<<4|pi[t.charCodeAt(c+2)]>>2,i[o++]=e>>8&255,i[o++]=e&255),i}function wH(t){return Cs[t>>18&63]+Cs[t>>12&63]+Cs[t>>6&63]+Cs[t&63]}function EH(t,e,r){for(var n,s=[],i=e;i<r;i+=3)n=(t[i]<<16&16711680)+(t[i+1]<<8&65280)+(t[i+2]&255),s.push(wH(n));return s.join("")}function SH(t){for(var e,r=t.length,n=r%3,s=[],i=16383,o=0,a=r-n;o<a;o+=i)s.push(EH(t,o,o+i>a?a:o+i));return n===1?(e=t[r-1],s.push(Cs[e>>2]+Cs[e<<4&63]+"==")):n===2&&(e=(t[r-2]<<8)+t[r-1],s.push(Cs[e>>10]+Cs[e>>4&63]+Cs[e<<2&63]+"=")),s.join("")}});var QO=v(a1=>{a1.read=function(t,e,r,n,s){var i,o,a=s*8-n-1,c=(1<<a)-1,u=c>>1,l=-7,d=r?s-1:0,p=r?-1:1,f=t[e+d];for(d+=p,i=f&(1<<-l)-1,f>>=-l,l+=a;l>0;i=i*256+t[e+d],d+=p,l-=8);for(o=i&(1<<-l)-1,i>>=-l,l+=n;l>0;o=o*256+t[e+d],d+=p,l-=8);if(i===0)i=1-u;else{if(i===c)return o?NaN:(f?-1:1)*(1/0);o=o+Math.pow(2,n),i=i-u}return(f?-1:1)*o*Math.pow(2,i-n)};a1.write=function(t,e,r,n,s,i){var o,a,c,u=i*8-s-1,l=(1<<u)-1,d=l>>1,p=s===23?Math.pow(2,-24)-Math.pow(2,-77):0,f=n?0:i-1,h=n?1:-1,y=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,o=l):(o=Math.floor(Math.log(e)/Math.LN2),e*(c=Math.pow(2,-o))<1&&(o--,c*=2),o+d>=1?e+=p/c:e+=p*Math.pow(2,1-d),e*c>=2&&(o++,c/=2),o+d>=l?(a=0,o=l):o+d>=1?(a=(e*c-1)*Math.pow(2,s),o=o+d):(a=e*Math.pow(2,d-1)*Math.pow(2,s),o=0));s>=8;t[r+f]=a&255,f+=h,a/=256,s-=8);for(o=o<<s|a,u+=s;u>0;t[r+f]=o&255,f+=h,o/=256,u-=8);t[r+f-h]|=y*128}});var hi=v(kl=>{"use strict";var u1=YO(),Il=QO(),eF=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;kl.Buffer=J;kl.SlowBuffer=OH;kl.INSPECT_MAX_BYTES=50;var Py=2147483647;kl.kMaxLength=Py;J.TYPED_ARRAY_SUPPORT=AH();!J.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&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.");function AH(){try{let t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),t.foo()===42}catch{return!1}}Object.defineProperty(J.prototype,"parent",{enumerable:!0,get:function(){if(J.isBuffer(this))return this.buffer}});Object.defineProperty(J.prototype,"offset",{enumerable:!0,get:function(){if(J.isBuffer(this))return this.byteOffset}});function So(t){if(t>Py)throw new RangeError('The value "'+t+'" is invalid for option "size"');let e=new Uint8Array(t);return Object.setPrototypeOf(e,J.prototype),e}function J(t,e,r){if(typeof t=="number"){if(typeof e=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return f1(t)}return iF(t,e,r)}J.poolSize=8192;function iF(t,e,r){if(typeof t=="string")return xH(t,e);if(ArrayBuffer.isView(t))return CH(t);if(t==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(Ps(t,ArrayBuffer)||t&&Ps(t.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(Ps(t,SharedArrayBuffer)||t&&Ps(t.buffer,SharedArrayBuffer)))return l1(t,e,r);if(typeof t=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let n=t.valueOf&&t.valueOf();if(n!=null&&n!==t)return J.from(n,e,r);let s=PH(t);if(s)return s;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof t[Symbol.toPrimitive]=="function")return J.from(t[Symbol.toPrimitive]("string"),e,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}J.from=function(t,e,r){return iF(t,e,r)};Object.setPrototypeOf(J.prototype,Uint8Array.prototype);Object.setPrototypeOf(J,Uint8Array);function sF(t){if(typeof t!="number")throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function DH(t,e,r){return sF(t),t<=0?So(t):e!==void 0?typeof r=="string"?So(t).fill(e,r):So(t).fill(e):So(t)}J.alloc=function(t,e,r){return DH(t,e,r)};function f1(t){return sF(t),So(t<0?0:p1(t)|0)}J.allocUnsafe=function(t){return f1(t)};J.allocUnsafeSlow=function(t){return f1(t)};function xH(t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!J.isEncoding(e))throw new TypeError("Unknown encoding: "+e);let r=oF(t,e)|0,n=So(r),s=n.write(t,e);return s!==r&&(n=n.slice(0,s)),n}function c1(t){let e=t.length<0?0:p1(t.length)|0,r=So(e);for(let n=0;n<e;n+=1)r[n]=t[n]&255;return r}function CH(t){if(Ps(t,Uint8Array)){let e=new Uint8Array(t);return l1(e.buffer,e.byteOffset,e.byteLength)}return c1(t)}function l1(t,e,r){if(e<0||t.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(t.byteLength<e+(r||0))throw new RangeError('"length" is outside of buffer bounds');let n;return e===void 0&&r===void 0?n=new Uint8Array(t):r===void 0?n=new Uint8Array(t,e):n=new Uint8Array(t,e,r),Object.setPrototypeOf(n,J.prototype),n}function PH(t){if(J.isBuffer(t)){let e=p1(t.length)|0,r=So(e);return r.length===0||t.copy(r,0,0,e),r}if(t.length!==void 0)return typeof t.length!="number"||m1(t.length)?So(0):c1(t);if(t.type==="Buffer"&&Array.isArray(t.data))return c1(t.data)}function p1(t){if(t>=Py)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Py.toString(16)+" bytes");return t|0}function OH(t){return+t!=t&&(t=0),J.alloc(+t)}J.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==J.prototype};J.compare=function(e,r){if(Ps(e,Uint8Array)&&(e=J.from(e,e.offset,e.byteLength)),Ps(r,Uint8Array)&&(r=J.from(r,r.offset,r.byteLength)),!J.isBuffer(e)||!J.isBuffer(r))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===r)return 0;let n=e.length,s=r.length;for(let i=0,o=Math.min(n,s);i<o;++i)if(e[i]!==r[i]){n=e[i],s=r[i];break}return n<s?-1:s<n?1:0};J.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}};J.concat=function(e,r){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(e.length===0)return J.alloc(0);let n;if(r===void 0)for(r=0,n=0;n<e.length;++n)r+=e[n].length;let s=J.allocUnsafe(r),i=0;for(n=0;n<e.length;++n){let o=e[n];if(Ps(o,Uint8Array))i+o.length>s.length?(J.isBuffer(o)||(o=J.from(o)),o.copy(s,i)):Uint8Array.prototype.set.call(s,o,i);else if(J.isBuffer(o))o.copy(s,i);else throw new TypeError('"list" argument must be an Array of Buffers');i+=o.length}return s};function oF(t,e){if(J.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||Ps(t,ArrayBuffer))return t.byteLength;if(typeof t!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);let r=t.length,n=arguments.length>2&&arguments[2]===!0;if(!n&&r===0)return 0;let s=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return d1(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return mF(t).length;default:if(s)return n?-1:d1(t).length;e=(""+e).toLowerCase(),s=!0}}J.byteLength=oF;function FH(t,e,r){let n=!1;if((e===void 0||e<0)&&(e=0),e>this.length||((r===void 0||r>this.length)&&(r=this.length),r<=0)||(r>>>=0,e>>>=0,r<=e))return"";for(t||(t="utf8");;)switch(t){case"hex":return qH(this,e,r);case"utf8":case"utf-8":return uF(this,e,r);case"ascii":return NH(this,e,r);case"latin1":case"binary":return MH(this,e,r);case"base64":return $H(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return LH(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}J.prototype._isBuffer=!0;function Vu(t,e,r){let n=t[e];t[e]=t[r],t[r]=n}J.prototype.swap16=function(){let e=this.length;if(e%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let r=0;r<e;r+=2)Vu(this,r,r+1);return this};J.prototype.swap32=function(){let e=this.length;if(e%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let r=0;r<e;r+=4)Vu(this,r,r+3),Vu(this,r+1,r+2);return this};J.prototype.swap64=function(){let e=this.length;if(e%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let r=0;r<e;r+=8)Vu(this,r,r+7),Vu(this,r+1,r+6),Vu(this,r+2,r+5),Vu(this,r+3,r+4);return this};J.prototype.toString=function(){let e=this.length;return e===0?"":arguments.length===0?uF(this,0,e):FH.apply(this,arguments)};J.prototype.toLocaleString=J.prototype.toString;J.prototype.equals=function(e){if(!J.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e?!0:J.compare(this,e)===0};J.prototype.inspect=function(){let e="",r=kl.INSPECT_MAX_BYTES;return e=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(e+=" ... "),"<Buffer "+e+">"};eF&&(J.prototype[eF]=J.prototype.inspect);J.prototype.compare=function(e,r,n,s,i){if(Ps(e,Uint8Array)&&(e=J.from(e,e.offset,e.byteLength)),!J.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(r===void 0&&(r=0),n===void 0&&(n=e?e.length:0),s===void 0&&(s=0),i===void 0&&(i=this.length),r<0||n>e.length||s<0||i>this.length)throw new RangeError("out of range index");if(s>=i&&r>=n)return 0;if(s>=i)return-1;if(r>=n)return 1;if(r>>>=0,n>>>=0,s>>>=0,i>>>=0,this===e)return 0;let o=i-s,a=n-r,c=Math.min(o,a),u=this.slice(s,i),l=e.slice(r,n);for(let d=0;d<c;++d)if(u[d]!==l[d]){o=u[d],a=l[d];break}return o<a?-1:a<o?1:0};function aF(t,e,r,n,s){if(t.length===0)return-1;if(typeof r=="string"?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,m1(r)&&(r=s?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(s)return-1;r=t.length-1}else if(r<0)if(s)r=0;else return-1;if(typeof e=="string"&&(e=J.from(e,n)),J.isBuffer(e))return e.length===0?-1:tF(t,e,r,n,s);if(typeof e=="number")return e=e&255,typeof Uint8Array.prototype.indexOf=="function"?s?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):tF(t,[e],r,n,s);throw new TypeError("val must be string, number or Buffer")}function tF(t,e,r,n,s){let i=1,o=t.length,a=e.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(t.length<2||e.length<2)return-1;i=2,o/=2,a/=2,r/=2}function c(l,d){return i===1?l[d]:l.readUInt16BE(d*i)}let u;if(s){let l=-1;for(u=r;u<o;u++)if(c(t,u)===c(e,l===-1?0:u-l)){if(l===-1&&(l=u),u-l+1===a)return l*i}else l!==-1&&(u-=u-l),l=-1}else for(r+a>o&&(r=o-a),u=r;u>=0;u--){let l=!0;for(let d=0;d<a;d++)if(c(t,u+d)!==c(e,d)){l=!1;break}if(l)return u}return-1}J.prototype.includes=function(e,r,n){return this.indexOf(e,r,n)!==-1};J.prototype.indexOf=function(e,r,n){return aF(this,e,r,n,!0)};J.prototype.lastIndexOf=function(e,r,n){return aF(this,e,r,n,!1)};function TH(t,e,r,n){r=Number(r)||0;let s=t.length-r;n?(n=Number(n),n>s&&(n=s)):n=s;let i=e.length;n>i/2&&(n=i/2);let o;for(o=0;o<n;++o){let a=parseInt(e.substr(o*2,2),16);if(m1(a))return o;t[r+o]=a}return o}function IH(t,e,r,n){return Oy(d1(e,t.length-r),t,r,n)}function BH(t,e,r,n){return Oy(zH(e),t,r,n)}function kH(t,e,r,n){return Oy(mF(e),t,r,n)}function RH(t,e,r,n){return Oy(HH(e,t.length-r),t,r,n)}J.prototype.write=function(e,r,n,s){if(r===void 0)s="utf8",n=this.length,r=0;else if(n===void 0&&typeof r=="string")s=r,n=this.length,r=0;else if(isFinite(r))r=r>>>0,isFinite(n)?(n=n>>>0,s===void 0&&(s="utf8")):(s=n,n=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let i=this.length-r;if((n===void 0||n>i)&&(n=i),e.length>0&&(n<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");s||(s="utf8");let o=!1;for(;;)switch(s){case"hex":return TH(this,e,r,n);case"utf8":case"utf-8":return IH(this,e,r,n);case"ascii":case"latin1":case"binary":return BH(this,e,r,n);case"base64":return kH(this,e,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return RH(this,e,r,n);default:if(o)throw new TypeError("Unknown encoding: "+s);s=(""+s).toLowerCase(),o=!0}};J.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function $H(t,e,r){return e===0&&r===t.length?u1.fromByteArray(t):u1.fromByteArray(t.slice(e,r))}function uF(t,e,r){r=Math.min(t.length,r);let n=[],s=e;for(;s<r;){let i=t[s],o=null,a=i>239?4:i>223?3:i>191?2:1;if(s+a<=r){let c,u,l,d;switch(a){case 1:i<128&&(o=i);break;case 2:c=t[s+1],(c&192)===128&&(d=(i&31)<<6|c&63,d>127&&(o=d));break;case 3:c=t[s+1],u=t[s+2],(c&192)===128&&(u&192)===128&&(d=(i&15)<<12|(c&63)<<6|u&63,d>2047&&(d<55296||d>57343)&&(o=d));break;case 4:c=t[s+1],u=t[s+2],l=t[s+3],(c&192)===128&&(u&192)===128&&(l&192)===128&&(d=(i&15)<<18|(c&63)<<12|(u&63)<<6|l&63,d>65535&&d<1114112&&(o=d))}}o===null?(o=65533,a=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|o&1023),n.push(o),s+=a}return jH(n)}var rF=4096;function jH(t){let e=t.length;if(e<=rF)return String.fromCharCode.apply(String,t);let r="",n=0;for(;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=rF));return r}function NH(t,e,r){let n="";r=Math.min(t.length,r);for(let s=e;s<r;++s)n+=String.fromCharCode(t[s]&127);return n}function MH(t,e,r){let n="";r=Math.min(t.length,r);for(let s=e;s<r;++s)n+=String.fromCharCode(t[s]);return n}function qH(t,e,r){let n=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>n)&&(r=n);let s="";for(let i=e;i<r;++i)s+=WH[t[i]];return s}function LH(t,e,r){let n=t.slice(e,r),s="";for(let i=0;i<n.length-1;i+=2)s+=String.fromCharCode(n[i]+n[i+1]*256);return s}J.prototype.slice=function(e,r){let n=this.length;e=~~e,r=r===void 0?n:~~r,e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),r<0?(r+=n,r<0&&(r=0)):r>n&&(r=n),r<e&&(r=e);let s=this.subarray(e,r);return Object.setPrototypeOf(s,J.prototype),s};function $r(t,e,r){if(t%1!==0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}J.prototype.readUintLE=J.prototype.readUIntLE=function(e,r,n){e=e>>>0,r=r>>>0,n||$r(e,r,this.length);let s=this[e],i=1,o=0;for(;++o<r&&(i*=256);)s+=this[e+o]*i;return s};J.prototype.readUintBE=J.prototype.readUIntBE=function(e,r,n){e=e>>>0,r=r>>>0,n||$r(e,r,this.length);let s=this[e+--r],i=1;for(;r>0&&(i*=256);)s+=this[e+--r]*i;return s};J.prototype.readUint8=J.prototype.readUInt8=function(e,r){return e=e>>>0,r||$r(e,1,this.length),this[e]};J.prototype.readUint16LE=J.prototype.readUInt16LE=function(e,r){return e=e>>>0,r||$r(e,2,this.length),this[e]|this[e+1]<<8};J.prototype.readUint16BE=J.prototype.readUInt16BE=function(e,r){return e=e>>>0,r||$r(e,2,this.length),this[e]<<8|this[e+1]};J.prototype.readUint32LE=J.prototype.readUInt32LE=function(e,r){return e=e>>>0,r||$r(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};J.prototype.readUint32BE=J.prototype.readUInt32BE=function(e,r){return e=e>>>0,r||$r(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};J.prototype.readBigUInt64LE=wa(function(e){e=e>>>0,Bl(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&up(e,this.length-8);let s=r+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24,i=this[++e]+this[++e]*2**8+this[++e]*2**16+n*2**24;return BigInt(s)+(BigInt(i)<<BigInt(32))});J.prototype.readBigUInt64BE=wa(function(e){e=e>>>0,Bl(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&up(e,this.length-8);let s=r*2**24+this[++e]*2**16+this[++e]*2**8+this[++e],i=this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+n;return(BigInt(s)<<BigInt(32))+BigInt(i)});J.prototype.readIntLE=function(e,r,n){e=e>>>0,r=r>>>0,n||$r(e,r,this.length);let s=this[e],i=1,o=0;for(;++o<r&&(i*=256);)s+=this[e+o]*i;return i*=128,s>=i&&(s-=Math.pow(2,8*r)),s};J.prototype.readIntBE=function(e,r,n){e=e>>>0,r=r>>>0,n||$r(e,r,this.length);let s=r,i=1,o=this[e+--s];for(;s>0&&(i*=256);)o+=this[e+--s]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*r)),o};J.prototype.readInt8=function(e,r){return e=e>>>0,r||$r(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};J.prototype.readInt16LE=function(e,r){e=e>>>0,r||$r(e,2,this.length);let n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n};J.prototype.readInt16BE=function(e,r){e=e>>>0,r||$r(e,2,this.length);let n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n};J.prototype.readInt32LE=function(e,r){return e=e>>>0,r||$r(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};J.prototype.readInt32BE=function(e,r){return e=e>>>0,r||$r(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};J.prototype.readBigInt64LE=wa(function(e){e=e>>>0,Bl(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&up(e,this.length-8);let s=this[e+4]+this[e+5]*2**8+this[e+6]*2**16+(n<<24);return(BigInt(s)<<BigInt(32))+BigInt(r+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24)});J.prototype.readBigInt64BE=wa(function(e){e=e>>>0,Bl(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&up(e,this.length-8);let s=(r<<24)+this[++e]*2**16+this[++e]*2**8+this[++e];return(BigInt(s)<<BigInt(32))+BigInt(this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+n)});J.prototype.readFloatLE=function(e,r){return e=e>>>0,r||$r(e,4,this.length),Il.read(this,e,!0,23,4)};J.prototype.readFloatBE=function(e,r){return e=e>>>0,r||$r(e,4,this.length),Il.read(this,e,!1,23,4)};J.prototype.readDoubleLE=function(e,r){return e=e>>>0,r||$r(e,8,this.length),Il.read(this,e,!0,52,8)};J.prototype.readDoubleBE=function(e,r){return e=e>>>0,r||$r(e,8,this.length),Il.read(this,e,!1,52,8)};function In(t,e,r,n,s,i){if(!J.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>s||e<i)throw new RangeError('"value" argument is out of bounds');if(r+n>t.length)throw new RangeError("Index out of range")}J.prototype.writeUintLE=J.prototype.writeUIntLE=function(e,r,n,s){if(e=+e,r=r>>>0,n=n>>>0,!s){let a=Math.pow(2,8*n)-1;In(this,e,r,n,a,0)}let i=1,o=0;for(this[r]=e&255;++o<n&&(i*=256);)this[r+o]=e/i&255;return r+n};J.prototype.writeUintBE=J.prototype.writeUIntBE=function(e,r,n,s){if(e=+e,r=r>>>0,n=n>>>0,!s){let a=Math.pow(2,8*n)-1;In(this,e,r,n,a,0)}let i=n-1,o=1;for(this[r+i]=e&255;--i>=0&&(o*=256);)this[r+i]=e/o&255;return r+n};J.prototype.writeUint8=J.prototype.writeUInt8=function(e,r,n){return e=+e,r=r>>>0,n||In(this,e,r,1,255,0),this[r]=e&255,r+1};J.prototype.writeUint16LE=J.prototype.writeUInt16LE=function(e,r,n){return e=+e,r=r>>>0,n||In(this,e,r,2,65535,0),this[r]=e&255,this[r+1]=e>>>8,r+2};J.prototype.writeUint16BE=J.prototype.writeUInt16BE=function(e,r,n){return e=+e,r=r>>>0,n||In(this,e,r,2,65535,0),this[r]=e>>>8,this[r+1]=e&255,r+2};J.prototype.writeUint32LE=J.prototype.writeUInt32LE=function(e,r,n){return e=+e,r=r>>>0,n||In(this,e,r,4,4294967295,0),this[r+3]=e>>>24,this[r+2]=e>>>16,this[r+1]=e>>>8,this[r]=e&255,r+4};J.prototype.writeUint32BE=J.prototype.writeUInt32BE=function(e,r,n){return e=+e,r=r>>>0,n||In(this,e,r,4,4294967295,0),this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=e&255,r+4};function cF(t,e,r,n,s){hF(e,n,s,t,r,7);let i=Number(e&BigInt(4294967295));t[r++]=i,i=i>>8,t[r++]=i,i=i>>8,t[r++]=i,i=i>>8,t[r++]=i;let o=Number(e>>BigInt(32)&BigInt(4294967295));return t[r++]=o,o=o>>8,t[r++]=o,o=o>>8,t[r++]=o,o=o>>8,t[r++]=o,r}function lF(t,e,r,n,s){hF(e,n,s,t,r,7);let i=Number(e&BigInt(4294967295));t[r+7]=i,i=i>>8,t[r+6]=i,i=i>>8,t[r+5]=i,i=i>>8,t[r+4]=i;let o=Number(e>>BigInt(32)&BigInt(4294967295));return t[r+3]=o,o=o>>8,t[r+2]=o,o=o>>8,t[r+1]=o,o=o>>8,t[r]=o,r+8}J.prototype.writeBigUInt64LE=wa(function(e,r=0){return cF(this,e,r,BigInt(0),BigInt("0xffffffffffffffff"))});J.prototype.writeBigUInt64BE=wa(function(e,r=0){return lF(this,e,r,BigInt(0),BigInt("0xffffffffffffffff"))});J.prototype.writeIntLE=function(e,r,n,s){if(e=+e,r=r>>>0,!s){let c=Math.pow(2,8*n-1);In(this,e,r,n,c-1,-c)}let i=0,o=1,a=0;for(this[r]=e&255;++i<n&&(o*=256);)e<0&&a===0&&this[r+i-1]!==0&&(a=1),this[r+i]=(e/o>>0)-a&255;return r+n};J.prototype.writeIntBE=function(e,r,n,s){if(e=+e,r=r>>>0,!s){let c=Math.pow(2,8*n-1);In(this,e,r,n,c-1,-c)}let i=n-1,o=1,a=0;for(this[r+i]=e&255;--i>=0&&(o*=256);)e<0&&a===0&&this[r+i+1]!==0&&(a=1),this[r+i]=(e/o>>0)-a&255;return r+n};J.prototype.writeInt8=function(e,r,n){return e=+e,r=r>>>0,n||In(this,e,r,1,127,-128),e<0&&(e=255+e+1),this[r]=e&255,r+1};J.prototype.writeInt16LE=function(e,r,n){return e=+e,r=r>>>0,n||In(this,e,r,2,32767,-32768),this[r]=e&255,this[r+1]=e>>>8,r+2};J.prototype.writeInt16BE=function(e,r,n){return e=+e,r=r>>>0,n||In(this,e,r,2,32767,-32768),this[r]=e>>>8,this[r+1]=e&255,r+2};J.prototype.writeInt32LE=function(e,r,n){return e=+e,r=r>>>0,n||In(this,e,r,4,2147483647,-2147483648),this[r]=e&255,this[r+1]=e>>>8,this[r+2]=e>>>16,this[r+3]=e>>>24,r+4};J.prototype.writeInt32BE=function(e,r,n){return e=+e,r=r>>>0,n||In(this,e,r,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=e&255,r+4};J.prototype.writeBigInt64LE=wa(function(e,r=0){return cF(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});J.prototype.writeBigInt64BE=wa(function(e,r=0){return lF(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function dF(t,e,r,n,s,i){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function fF(t,e,r,n,s){return e=+e,r=r>>>0,s||dF(t,e,r,4,34028234663852886e22,-34028234663852886e22),Il.write(t,e,r,n,23,4),r+4}J.prototype.writeFloatLE=function(e,r,n){return fF(this,e,r,!0,n)};J.prototype.writeFloatBE=function(e,r,n){return fF(this,e,r,!1,n)};function pF(t,e,r,n,s){return e=+e,r=r>>>0,s||dF(t,e,r,8,17976931348623157e292,-17976931348623157e292),Il.write(t,e,r,n,52,8),r+8}J.prototype.writeDoubleLE=function(e,r,n){return pF(this,e,r,!0,n)};J.prototype.writeDoubleBE=function(e,r,n){return pF(this,e,r,!1,n)};J.prototype.copy=function(e,r,n,s){if(!J.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),!s&&s!==0&&(s=this.length),r>=e.length&&(r=e.length),r||(r=0),s>0&&s<n&&(s=n),s===n||e.length===0||this.length===0)return 0;if(r<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("Index out of range");if(s<0)throw new RangeError("sourceEnd out of bounds");s>this.length&&(s=this.length),e.length-r<s-n&&(s=e.length-r+n);let i=s-n;return this===e&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(r,n,s):Uint8Array.prototype.set.call(e,this.subarray(n,s),r),i};J.prototype.fill=function(e,r,n,s){if(typeof e=="string"){if(typeof r=="string"?(s=r,r=0,n=this.length):typeof n=="string"&&(s=n,n=this.length),s!==void 0&&typeof s!="string")throw new TypeError("encoding must be a string");if(typeof s=="string"&&!J.isEncoding(s))throw new TypeError("Unknown encoding: "+s);if(e.length===1){let o=e.charCodeAt(0);(s==="utf8"&&o<128||s==="latin1")&&(e=o)}}else typeof e=="number"?e=e&255:typeof e=="boolean"&&(e=Number(e));if(r<0||this.length<r||this.length<n)throw new RangeError("Out of range index");if(n<=r)return this;r=r>>>0,n=n===void 0?this.length:n>>>0,e||(e=0);let i;if(typeof e=="number")for(i=r;i<n;++i)this[i]=e;else{let o=J.isBuffer(e)?e:J.from(e,s),a=o.length;if(a===0)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(i=0;i<n-r;++i)this[i+r]=o[i%a]}return this};var Tl={};function h1(t,e,r){Tl[t]=class extends r{constructor(){super(),Object.defineProperty(this,"message",{value:e.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${t}]`,this.stack,delete this.name}get code(){return t}set code(s){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:s,writable:!0})}toString(){return`${this.name} [${t}]: ${this.message}`}}}h1("ERR_BUFFER_OUT_OF_BOUNDS",function(t){return t?`${t} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError);h1("ERR_INVALID_ARG_TYPE",function(t,e){return`The "${t}" argument must be of type number. Received type ${typeof e}`},TypeError);h1("ERR_OUT_OF_RANGE",function(t,e,r){let n=`The value of "${t}" is out of range.`,s=r;return Number.isInteger(r)&&Math.abs(r)>2**32?s=nF(String(r)):typeof r=="bigint"&&(s=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(s=nF(s)),s+="n"),n+=` It must be ${e}. Received ${s}`,n},RangeError);function nF(t){let e="",r=t.length,n=t[0]==="-"?1:0;for(;r>=n+4;r-=3)e=`_${t.slice(r-3,r)}${e}`;return`${t.slice(0,r)}${e}`}function UH(t,e,r){Bl(e,"offset"),(t[e]===void 0||t[e+r]===void 0)&&up(e,t.length-(r+1))}function hF(t,e,r,n,s,i){if(t>r||t<e){let o=typeof e=="bigint"?"n":"",a;throw i>3?e===0||e===BigInt(0)?a=`>= 0${o} and < 2${o} ** ${(i+1)*8}${o}`:a=`>= -(2${o} ** ${(i+1)*8-1}${o}) and < 2 ** ${(i+1)*8-1}${o}`:a=`>= ${e}${o} and <= ${r}${o}`,new Tl.ERR_OUT_OF_RANGE("value",a,t)}UH(n,s,i)}function Bl(t,e){if(typeof t!="number")throw new Tl.ERR_INVALID_ARG_TYPE(e,"number",t)}function up(t,e,r){throw Math.floor(t)!==t?(Bl(t,r),new Tl.ERR_OUT_OF_RANGE(r||"offset","an integer",t)):e<0?new Tl.ERR_BUFFER_OUT_OF_BOUNDS:new Tl.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${e}`,t)}var VH=/[^+/0-9A-Za-z-_]/g;function KH(t){if(t=t.split("=")[0],t=t.trim().replace(VH,""),t.length<2)return"";for(;t.length%4!==0;)t=t+"=";return t}function d1(t,e){e=e||1/0;let r,n=t.length,s=null,i=[];for(let o=0;o<n;++o){if(r=t.charCodeAt(o),r>55295&&r<57344){if(!s){if(r>56319){(e-=3)>-1&&i.push(239,191,189);continue}else if(o+1===n){(e-=3)>-1&&i.push(239,191,189);continue}s=r;continue}if(r<56320){(e-=3)>-1&&i.push(239,191,189),s=r;continue}r=(s-55296<<10|r-56320)+65536}else s&&(e-=3)>-1&&i.push(239,191,189);if(s=null,r<128){if((e-=1)<0)break;i.push(r)}else if(r<2048){if((e-=2)<0)break;i.push(r>>6|192,r&63|128)}else if(r<65536){if((e-=3)<0)break;i.push(r>>12|224,r>>6&63|128,r&63|128)}else if(r<1114112){if((e-=4)<0)break;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,r&63|128)}else throw new Error("Invalid code point")}return i}function zH(t){let e=[];for(let r=0;r<t.length;++r)e.push(t.charCodeAt(r)&255);return e}function HH(t,e){let r,n,s,i=[];for(let o=0;o<t.length&&!((e-=2)<0);++o)r=t.charCodeAt(o),n=r>>8,s=r%256,i.push(s),i.push(n);return i}function mF(t){return u1.toByteArray(KH(t))}function Oy(t,e,r,n){let s;for(s=0;s<n&&!(s+r>=e.length||s>=t.length);++s)e[s+r]=t[s];return s}function Ps(t,e){return t instanceof e||t!=null&&t.constructor!=null&&t.constructor.name!=null&&t.constructor.name===e.name}function m1(t){return t!==t}var WH=function(){let t="0123456789abcdef",e=new Array(256);for(let r=0;r<16;++r){let n=r*16;for(let s=0;s<16;++s)e[n+s]=t[r]+t[s]}return e}();function wa(t){return typeof BigInt>"u"?JH:t}function JH(){throw new Error("BigInt not supported")}});var g1=v((LEe,yF)=>{"use strict";var y1=null;yF.exports=function(){return y1===null&&(y1={textEncoder:new TextEncoder,textDecoder:new TextDecoder}),y1}});var _1=v(gF=>{"use strict";var v1=Hi(),GH=new Set(["buffer","view","utf8"]),b1=class{constructor(e){if(this.encode=e.encode||this.encode,this.decode=e.decode||this.decode,this.name=e.name||this.name,this.format=e.format||this.format,typeof this.encode!="function")throw new TypeError("The 'encode' property must be a function");if(typeof this.decode!="function")throw new TypeError("The 'decode' property must be a function");if(this.encode=this.encode.bind(this),this.decode=this.decode.bind(this),typeof this.name!="string"||this.name==="")throw new TypeError("The 'name' property must be a string");if(typeof this.format!="string"||!GH.has(this.format))throw new TypeError("The 'format' property must be one of 'buffer', 'view', 'utf8'");e.createViewTranscoder&&(this.createViewTranscoder=e.createViewTranscoder),e.createBufferTranscoder&&(this.createBufferTranscoder=e.createBufferTranscoder),e.createUTF8Transcoder&&(this.createUTF8Transcoder=e.createUTF8Transcoder)}get commonName(){return this.name.split("+")[0]}createBufferTranscoder(){throw new v1(`Encoding '${this.name}' cannot be transcoded to 'buffer'`,{code:"LEVEL_ENCODING_NOT_SUPPORTED"})}createViewTranscoder(){throw new v1(`Encoding '${this.name}' cannot be transcoded to 'view'`,{code:"LEVEL_ENCODING_NOT_SUPPORTED"})}createUTF8Transcoder(){throw new v1(`Encoding '${this.name}' cannot be transcoded to 'utf8'`,{code:"LEVEL_ENCODING_NOT_SUPPORTED"})}};gF.Encoding=b1});var A1=v(Fy=>{"use strict";var{Buffer:E1}=hi()||{},{Encoding:S1}=_1(),ZH=g1(),cp=class extends S1{constructor(e){super({...e,format:"buffer"})}createViewTranscoder(){return new lp({encode:this.encode,decode:e=>this.decode(E1.from(e.buffer,e.byteOffset,e.byteLength)),name:`${this.name}+view`})}createBufferTranscoder(){return this}},lp=class extends S1{constructor(e){super({...e,format:"view"})}createBufferTranscoder(){return new cp({encode:e=>{let r=this.encode(e);return E1.from(r.buffer,r.byteOffset,r.byteLength)},decode:this.decode,name:`${this.name}+buffer`})}createViewTranscoder(){return this}},w1=class extends S1{constructor(e){super({...e,format:"utf8"})}createBufferTranscoder(){return new cp({encode:e=>E1.from(this.encode(e),"utf8"),decode:e=>this.decode(e.toString("utf8")),name:`${this.name}+buffer`})}createViewTranscoder(){let{textEncoder:e,textDecoder:r}=ZH();return new lp({encode:n=>e.encode(this.encode(n)),decode:n=>this.decode(r.decode(n)),name:`${this.name}+view`})}createUTF8Transcoder(){return this}};Fy.BufferFormat=cp;Fy.ViewFormat=lp;Fy.UTF8Format=w1});var wF=v(Ku=>{"use strict";var{Buffer:un}=hi()||{Buffer:{isBuffer:()=>!1}},{textEncoder:bF,textDecoder:vF}=g1()(),{BufferFormat:dp,ViewFormat:D1,UTF8Format:_F}=A1(),Ty=t=>t;Ku.utf8=new _F({encode:function(t){return un.isBuffer(t)?t.toString("utf8"):ArrayBuffer.isView(t)?vF.decode(t):String(t)},decode:Ty,name:"utf8",createViewTranscoder(){return new D1({encode:function(t){return ArrayBuffer.isView(t)?t:bF.encode(t)},decode:function(t){return vF.decode(t)},name:`${this.name}+view`})},createBufferTranscoder(){return new dp({encode:function(t){return un.isBuffer(t)?t:ArrayBuffer.isView(t)?un.from(t.buffer,t.byteOffset,t.byteLength):un.from(String(t),"utf8")},decode:function(t){return t.toString("utf8")},name:`${this.name}+buffer`})}});Ku.json=new _F({encode:JSON.stringify,decode:JSON.parse,name:"json"});Ku.buffer=new dp({encode:function(t){return un.isBuffer(t)?t:ArrayBuffer.isView(t)?un.from(t.buffer,t.byteOffset,t.byteLength):un.from(String(t),"utf8")},decode:Ty,name:"buffer",createViewTranscoder(){return new D1({encode:function(t){return ArrayBuffer.isView(t)?t:un.from(String(t),"utf8")},decode:function(t){return un.from(t.buffer,t.byteOffset,t.byteLength)},name:`${this.name}+view`})}});Ku.view=new D1({encode:function(t){return ArrayBuffer.isView(t)?t:bF.encode(t)},decode:Ty,name:"view",createBufferTranscoder(){return new dp({encode:function(t){return un.isBuffer(t)?t:ArrayBuffer.isView(t)?un.from(t.buffer,t.byteOffset,t.byteLength):un.from(String(t),"utf8")},decode:Ty,name:`${this.name}+buffer`})}});Ku.hex=new dp({encode:function(t){return un.isBuffer(t)?t:un.from(String(t),"hex")},decode:function(t){return t.toString("hex")},name:"hex"});Ku.base64=new dp({encode:function(t){return un.isBuffer(t)?t:un.from(String(t),"base64")},decode:function(t){return t.toString("base64")},name:"base64"})});var AF=v(SF=>{"use strict";var EF=Hi(),By=wF(),{Encoding:XH}=_1(),{BufferFormat:YH,ViewFormat:QH,UTF8Format:eW}=A1(),fp=Symbol("formats"),Iy=Symbol("encodings"),tW=new Set(["buffer","view","utf8"]),x1=class{constructor(e){if(Array.isArray(e)){if(!e.every(r=>tW.has(r)))throw new TypeError("Format must be one of 'buffer', 'view', 'utf8'")}else throw new TypeError("The first argument 'formats' must be an array");this[Iy]=new Map,this[fp]=new Set(e);for(let r in By)try{this.encoding(r)}catch(n){if(n.code!=="LEVEL_ENCODING_NOT_SUPPORTED")throw n}}encodings(){return Array.from(new Set(this[Iy].values()))}encoding(e){let r=this[Iy].get(e);if(r===void 0){if(typeof e=="string"&&e!==""){if(r=sW[e],!r)throw new EF(`Encoding '${e}' is not found`,{code:"LEVEL_ENCODING_NOT_FOUND"})}else{if(typeof e!="object"||e===null)throw new TypeError("First argument 'encoding' must be a string or object");r=rW(e)}let{name:n,format:s}=r;if(!this[fp].has(s))if(this[fp].has("view"))r=r.createViewTranscoder();else if(this[fp].has("buffer"))r=r.createBufferTranscoder();else if(this[fp].has("utf8"))r=r.createUTF8Transcoder();else throw new EF(`Encoding '${n}' cannot be transcoded`,{code:"LEVEL_ENCODING_NOT_SUPPORTED"});for(let i of[e,n,r.name,r.commonName])this[Iy].set(i,r)}return r}};SF.Transcoder=x1;function rW(t){if(t instanceof XH)return t;let e="type"in t&&typeof t.type=="string"?t.type:void 0,r=t.name||e||`anonymous-${oW++}`;switch(nW(t)){case"view":return new QH({...t,name:r});case"utf8":return new eW({...t,name:r});case"buffer":return new YH({...t,name:r});default:throw new TypeError("Format must be one of 'buffer', 'view', 'utf8'")}}function nW(t){return"format"in t&&t.format!==void 0?t.format:"buffer"in t&&typeof t.buffer=="boolean"?t.buffer?"buffer":"utf8":"code"in t&&Number.isInteger(t.code)?"view":"buffer"}var iW={binary:By.buffer,"utf-8":By.utf8},sW={...By,...iW},oW=0});var $l=v((HEe,C1)=>{"use strict";var Rl=typeof Reflect=="object"?Reflect:null,DF=Rl&&typeof Rl.apply=="function"?Rl.apply:function(e,r,n){return Function.prototype.apply.call(e,r,n)},ky;Rl&&typeof Rl.ownKeys=="function"?ky=Rl.ownKeys:Object.getOwnPropertySymbols?ky=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:ky=function(e){return Object.getOwnPropertyNames(e)};function aW(t){console&&console.warn&&console.warn(t)}var CF=Number.isNaN||function(e){return e!==e};function Nt(){Nt.init.call(this)}C1.exports=Nt;C1.exports.once=dW;Nt.EventEmitter=Nt;Nt.prototype._events=void 0;Nt.prototype._eventsCount=0;Nt.prototype._maxListeners=void 0;var xF=10;function Ry(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(Nt,"defaultMaxListeners",{enumerable:!0,get:function(){return xF},set:function(t){if(typeof t!="number"||t<0||CF(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");xF=t}});Nt.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0};Nt.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||CF(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this};function PF(t){return t._maxListeners===void 0?Nt.defaultMaxListeners:t._maxListeners}Nt.prototype.getMaxListeners=function(){return PF(this)};Nt.prototype.emit=function(e){for(var r=[],n=1;n<arguments.length;n++)r.push(arguments[n]);var s=e==="error",i=this._events;if(i!==void 0)s=s&&i.error===void 0;else if(!s)return!1;if(s){var o;if(r.length>0&&(o=r[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var c=i[e];if(c===void 0)return!1;if(typeof c=="function")DF(c,this,r);else for(var u=c.length,l=BF(c,u),n=0;n<u;++n)DF(l[n],this,r);return!0};function OF(t,e,r,n){var s,i,o;if(Ry(r),i=t._events,i===void 0?(i=t._events=Object.create(null),t._eventsCount=0):(i.newListener!==void 0&&(t.emit("newListener",e,r.listener?r.listener:r),i=t._events),o=i[e]),o===void 0)o=i[e]=r,++t._eventsCount;else if(typeof o=="function"?o=i[e]=n?[r,o]:[o,r]:n?o.unshift(r):o.push(r),s=PF(t),s>0&&o.length>s&&!o.warned){o.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=t,a.type=e,a.count=o.length,aW(a)}return t}Nt.prototype.addListener=function(e,r){return OF(this,e,r,!1)};Nt.prototype.on=Nt.prototype.addListener;Nt.prototype.prependListener=function(e,r){return OF(this,e,r,!0)};function uW(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function FF(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},s=uW.bind(n);return s.listener=r,n.wrapFn=s,s}Nt.prototype.once=function(e,r){return Ry(r),this.on(e,FF(this,e,r)),this};Nt.prototype.prependOnceListener=function(e,r){return Ry(r),this.prependListener(e,FF(this,e,r)),this};Nt.prototype.removeListener=function(e,r){var n,s,i,o,a;if(Ry(r),s=this._events,s===void 0)return this;if(n=s[e],n===void 0)return this;if(n===r||n.listener===r)--this._eventsCount===0?this._events=Object.create(null):(delete s[e],s.removeListener&&this.emit("removeListener",e,n.listener||r));else if(typeof n!="function"){for(i=-1,o=n.length-1;o>=0;o--)if(n[o]===r||n[o].listener===r){a=n[o].listener,i=o;break}if(i<0)return this;i===0?n.shift():cW(n,i),n.length===1&&(s[e]=n[0]),s.removeListener!==void 0&&this.emit("removeListener",e,a||r)}return this};Nt.prototype.off=Nt.prototype.removeListener;Nt.prototype.removeAllListeners=function(e){var r,n,s;if(n=this._events,n===void 0)return this;if(n.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):n[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete n[e]),this;if(arguments.length===0){var i=Object.keys(n),o;for(s=0;s<i.length;++s)o=i[s],o!=="removeListener"&&this.removeAllListeners(o);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(r=n[e],typeof r=="function")this.removeListener(e,r);else if(r!==void 0)for(s=r.length-1;s>=0;s--)this.removeListener(e,r[s]);return this};function TF(t,e,r){var n=t._events;if(n===void 0)return[];var s=n[e];return s===void 0?[]:typeof s=="function"?r?[s.listener||s]:[s]:r?lW(s):BF(s,s.length)}Nt.prototype.listeners=function(e){return TF(this,e,!0)};Nt.prototype.rawListeners=function(e){return TF(this,e,!1)};Nt.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):IF.call(t,e)};Nt.prototype.listenerCount=IF;function IF(t){var e=this._events;if(e!==void 0){var r=e[t];if(typeof r=="function")return 1;if(r!==void 0)return r.length}return 0}Nt.prototype.eventNames=function(){return this._eventsCount>0?ky(this._events):[]};function BF(t,e){for(var r=new Array(e),n=0;n<e;++n)r[n]=t[n];return r}function cW(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}function lW(t){for(var e=new Array(t.length),r=0;r<e.length;++r)e[r]=t[r].listener||t[r];return e}function dW(t,e){return new Promise(function(r,n){function s(o){t.removeListener(e,i),n(o)}function i(){typeof t.removeListener=="function"&&t.removeListener("error",s),r([].slice.call(arguments))}kF(t,e,i,{once:!0}),e!=="error"&&fW(t,s,{once:!0})})}function fW(t,e,r){typeof t.on=="function"&&kF(t,"error",e,r)}function kF(t,e,r,n){if(typeof t.on=="function")n.once?t.once(e,r):t.on(e,r);else if(typeof t.addEventListener=="function")t.addEventListener(e,function s(i){n.once&&t.removeEventListener(e,s),r(i)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof t)}});var $F=v((WEe,RF)=>{RF.exports=typeof queueMicrotask=="function"?queueMicrotask:t=>Promise.resolve().then(t)});var pp=v(P1=>{"use strict";var jF=$F();P1.fromCallback=function(t,e){if(t===void 0){var r=new Promise(function(n,s){t=function(i,o){i?s(i):n(o)}});t[e!==void 0?e:"promise"]=r}else if(typeof t!="function")throw new TypeError("Callback must be a function");return t};P1.fromPromise=function(t,e){if(e===void 0)return t;t.then(function(r){jF(()=>e(null,r))}).catch(function(r){jF(()=>e(r))})}});var $y=v(O1=>{"use strict";O1.getCallback=function(t,e){return typeof t=="function"?t:e};O1.getOptions=function(t,e){return typeof t=="object"&&t!==null?t:e!==void 0?e:{}}});var Ca=v(qy=>{"use strict";var{fromCallback:F1}=pp(),Gn=Hi(),{getOptions:T1,getCallback:NF}=$y(),zu=Symbol("promise"),jl=Symbol("callback"),Os=Symbol("working"),Hu=Symbol("handleOne"),Ao=Symbol("handleMany"),I1=Symbol("autoClose"),Da=Symbol("finishWork"),Fs=Symbol("returnMany"),Ea=Symbol("closing"),hp=Symbol("handleClose"),jy=Symbol("closed"),mp=Symbol("closeCallbacks"),Aa=Symbol("keyEncoding"),Wu=Symbol("valueEncoding"),B1=Symbol("abortOnClose"),Ny=Symbol("legacy"),k1=Symbol("keys"),R1=Symbol("values"),Sa=Symbol("limit"),mi=Symbol("count"),My=Object.freeze({}),pW=()=>{},MF=!1,yp=class{constructor(e,r,n){if(typeof e!="object"||e===null){let s=e===null?"null":typeof e;throw new TypeError(`The first argument must be an abstract-level database, received ${s}`)}if(typeof r!="object"||r===null)throw new TypeError("The second argument must be an options object");this[jy]=!1,this[mp]=[],this[Os]=!1,this[Ea]=!1,this[I1]=!1,this[jl]=null,this[Hu]=this[Hu].bind(this),this[Ao]=this[Ao].bind(this),this[hp]=this[hp].bind(this),this[Aa]=r[Aa],this[Wu]=r[Wu],this[Ny]=n,this[Sa]=Number.isInteger(r.limit)&&r.limit>=0?r.limit:1/0,this[mi]=0,this[B1]=!!r.abortOnClose,this.db=e,this.db.attachResource(this),this.nextTick=e.nextTick}get count(){return this[mi]}get limit(){return this[Sa]}next(e){let r;if(e===void 0)r=new Promise((n,s)=>{e=(i,o,a)=>{i?s(i):this[Ny]?o===void 0&&a===void 0?n():n([o,a]):n(o)}});else if(typeof e!="function")throw new TypeError("Callback must be a function");return this[Ea]?this.nextTick(e,new Gn("Iterator is not open: cannot call next() after close()",{code:"LEVEL_ITERATOR_NOT_OPEN"})):this[Os]?this.nextTick(e,new Gn("Iterator is busy: cannot call next() until previous call has completed",{code:"LEVEL_ITERATOR_BUSY"})):(this[Os]=!0,this[jl]=e,this[mi]>=this[Sa]?this.nextTick(this[Hu],null):this._next(this[Hu])),r}_next(e){this.nextTick(e)}nextv(e,r,n){return n=NF(r,n),n=F1(n,zu),r=T1(r,My),Number.isInteger(e)?(this[Ea]?this.nextTick(n,new Gn("Iterator is not open: cannot call nextv() after close()",{code:"LEVEL_ITERATOR_NOT_OPEN"})):this[Os]?this.nextTick(n,new Gn("Iterator is busy: cannot call nextv() until previous call has completed",{code:"LEVEL_ITERATOR_BUSY"})):(e<1&&(e=1),this[Sa]<1/0&&(e=Math.min(e,this[Sa]-this[mi])),this[Os]=!0,this[jl]=n,e<=0?this.nextTick(this[Ao],null,[]):this._nextv(e,r,this[Ao])),n[zu]):(this.nextTick(n,new TypeError("The first argument 'size' must be an integer")),n[zu])}_nextv(e,r,n){let s=[],i=(o,a,c)=>{if(o)return n(o);if(this[Ny]?a===void 0&&c===void 0:a===void 0)return n(null,s);s.push(this[Ny]?[a,c]:a),s.length===e?n(null,s):this._next(i)};this._next(i)}all(e,r){return r=NF(e,r),r=F1(r,zu),e=T1(e,My),this[Ea]?this.nextTick(r,new Gn("Iterator is not open: cannot call all() after close()",{code:"LEVEL_ITERATOR_NOT_OPEN"})):this[Os]?this.nextTick(r,new Gn("Iterator is busy: cannot call all() until previous call has completed",{code:"LEVEL_ITERA