Dorian 0d073fa89e Add comprehensive installation and setup documentation
- Add GETTING_STARTED.md with quick start guide and development modes
- Add INSTALL.sh automated installation script
- Add INSTALLATION_CHECKLIST.md, INSTALLATION_SUCCESS.md, and INSTALLATION_SUMMARY.md
- Add QUICK_REFERENCE.md for common commands
- Add SETUP_GUIDE.md with detailed setup instructions
- Update README.md with improved project overview
- Add did-wallet app dependencies and node_modules
2026-01-27 17:18:21 +00:00

140 lines
2.0 MiB

var Rge=Object.create;var DA=Object.defineProperty;var Ige=Object.getOwnPropertyDescriptor;var kge=Object.getOwnPropertyNames;var Oge=Object.getPrototypeOf,Bge=Object.prototype.hasOwnProperty;var Dge=(t,e)=>()=>(t&&(e=t(t=0)),e);var H=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Di=(t,e)=>{for(var r in e)DA(t,r,{get:e[r],enumerable:!0})},Cge=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of kge(e))!Bge.call(t,i)&&i!==r&&DA(t,i,{get:()=>e[i],enumerable:!(n=Ige(e,i))||n.enumerable});return t};var or=(t,e,r)=>(r=t!=null?Rge(Oge(t)):{},Cge(e||!t||!t.__esModule?DA(r,"default",{value:t,enumerable:!0}):r,t));var UL=(t,e,r)=>{if(!e.has(t))throw TypeError("Cannot "+r)};var FL=(t,e,r)=>(UL(t,e,"read from private field"),r?r.call(t):e.get(t)),zL=(t,e,r)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,r)},CA=(t,e,r,n)=>(UL(t,e,"write to private field"),n?n.call(t,r):e.set(t,r),r);var WL=H(dE=>{"use strict";E();dE.byteLength=Nge;dE.toByteArray=$ge;dE.fromByteArray=Fge;var Eu=[],wc=[],jge=typeof Uint8Array<"u"?Uint8Array:Array,jA="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(A0=0,KL=jA.length;A0<KL;++A0)Eu[A0]=jA[A0],wc[jA.charCodeAt(A0)]=A0;var A0,KL;wc["-".charCodeAt(0)]=62;wc["_".charCodeAt(0)]=63;function GL(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 Nge(t){var e=GL(t),r=e[0],n=e[1];return(r+n)*3/4-n}function qge(t,e,r){return(e+r)*3/4-r}function $ge(t){var e,r=GL(t),n=r[0],i=r[1],o=new jge(qge(t,n,i)),s=0,a=i>0?n-4:n,d;for(d=0;d<a;d+=4)e=wc[t.charCodeAt(d)]<<18|wc[t.charCodeAt(d+1)]<<12|wc[t.charCodeAt(d+2)]<<6|wc[t.charCodeAt(d+3)],o[s++]=e>>16&255,o[s++]=e>>8&255,o[s++]=e&255;return i===2&&(e=wc[t.charCodeAt(d)]<<2|wc[t.charCodeAt(d+1)]>>4,o[s++]=e&255),i===1&&(e=wc[t.charCodeAt(d)]<<10|wc[t.charCodeAt(d+1)]<<4|wc[t.charCodeAt(d+2)]>>2,o[s++]=e>>8&255,o[s++]=e&255),o}function Lge(t){return Eu[t>>18&63]+Eu[t>>12&63]+Eu[t>>6&63]+Eu[t&63]}function Uge(t,e,r){for(var n,i=[],o=e;o<r;o+=3)n=(t[o]<<16&16711680)+(t[o+1]<<8&65280)+(t[o+2]&255),i.push(Lge(n));return i.join("")}function Fge(t){for(var e,r=t.length,n=r%3,i=[],o=16383,s=0,a=r-n;s<a;s+=o)i.push(Uge(t,s,s+o>a?a:s+o));return n===1?(e=t[r-1],i.push(Eu[e>>2]+Eu[e<<4&63]+"==")):n===2&&(e=(t[r-2]<<8)+t[r-1],i.push(Eu[e>>10]+Eu[e>>4&63]+Eu[e<<2&63]+"=")),i.join("")}});var VL=H(NA=>{E();NA.read=function(t,e,r,n,i){var o,s,a=i*8-n-1,d=(1<<a)-1,m=d>>1,p=-7,w=r?i-1:0,P=r?-1:1,S=t[e+w];for(w+=P,o=S&(1<<-p)-1,S>>=-p,p+=a;p>0;o=o*256+t[e+w],w+=P,p-=8);for(s=o&(1<<-p)-1,o>>=-p,p+=n;p>0;s=s*256+t[e+w],w+=P,p-=8);if(o===0)o=1-m;else{if(o===d)return s?NaN:(S?-1:1)*(1/0);s=s+Math.pow(2,n),o=o-m}return(S?-1:1)*s*Math.pow(2,o-n)};NA.write=function(t,e,r,n,i,o){var s,a,d,m=o*8-i-1,p=(1<<m)-1,w=p>>1,P=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,S=n?0:o-1,M=n?1:-1,A=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=p):(s=Math.floor(Math.log(e)/Math.LN2),e*(d=Math.pow(2,-s))<1&&(s--,d*=2),s+w>=1?e+=P/d:e+=P*Math.pow(2,1-w),e*d>=2&&(s++,d/=2),s+w>=p?(a=0,s=p):s+w>=1?(a=(e*d-1)*Math.pow(2,i),s=s+w):(a=e*Math.pow(2,w-1)*Math.pow(2,i),s=0));i>=8;t[r+S]=a&255,S+=M,a/=256,i-=8);for(s=s<<i|a,m+=i;m>0;t[r+S]=s&255,S+=M,s/=256,m-=8);t[r+S-M]|=A*128}});var sr=H(Mg=>{"use strict";E();var qA=WL(),Sg=VL(),HL=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Mg.Buffer=Le;Mg.SlowBuffer=Hge;Mg.INSPECT_MAX_BYTES=50;var hE=2147483647;Mg.kMaxLength=hE;Le.TYPED_ARRAY_SUPPORT=zge();!Le.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 zge(){try{var 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(Le.prototype,"parent",{enumerable:!0,get:function(){if(Le.isBuffer(this))return this.buffer}});Object.defineProperty(Le.prototype,"offset",{enumerable:!0,get:function(){if(Le.isBuffer(this))return this.byteOffset}});function ed(t){if(t>hE)throw new RangeError('The value "'+t+'" is invalid for option "size"');var e=new Uint8Array(t);return Object.setPrototypeOf(e,Le.prototype),e}function Le(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 FA(t)}return YL(t,e,r)}Le.poolSize=8192;function YL(t,e,r){if(typeof t=="string")return Gge(t,e);if(ArrayBuffer.isView(t))return Wge(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(Su(t,ArrayBuffer)||t&&Su(t.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(Su(t,SharedArrayBuffer)||t&&Su(t.buffer,SharedArrayBuffer)))return LA(t,e,r);if(typeof t=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');var n=t.valueOf&&t.valueOf();if(n!=null&&n!==t)return Le.from(n,e,r);var i=Vge(t);if(i)return i;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof t[Symbol.toPrimitive]=="function")return Le.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)}Le.from=function(t,e,r){return YL(t,e,r)};Object.setPrototypeOf(Le.prototype,Uint8Array.prototype);Object.setPrototypeOf(Le,Uint8Array);function QL(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 Kge(t,e,r){return QL(t),t<=0?ed(t):e!==void 0?typeof r=="string"?ed(t).fill(e,r):ed(t).fill(e):ed(t)}Le.alloc=function(t,e,r){return Kge(t,e,r)};function FA(t){return QL(t),ed(t<0?0:zA(t)|0)}Le.allocUnsafe=function(t){return FA(t)};Le.allocUnsafeSlow=function(t){return FA(t)};function Gge(t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!Le.isEncoding(e))throw new TypeError("Unknown encoding: "+e);var r=XL(t,e)|0,n=ed(r),i=n.write(t,e);return i!==r&&(n=n.slice(0,i)),n}function $A(t){for(var e=t.length<0?0:zA(t.length)|0,r=ed(e),n=0;n<e;n+=1)r[n]=t[n]&255;return r}function Wge(t){if(Su(t,Uint8Array)){var e=new Uint8Array(t);return LA(e.buffer,e.byteOffset,e.byteLength)}return $A(t)}function LA(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');var 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,Le.prototype),n}function Vge(t){if(Le.isBuffer(t)){var e=zA(t.length)|0,r=ed(e);return r.length===0||t.copy(r,0,0,e),r}if(t.length!==void 0)return typeof t.length!="number"||KA(t.length)?ed(0):$A(t);if(t.type==="Buffer"&&Array.isArray(t.data))return $A(t.data)}function zA(t){if(t>=hE)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+hE.toString(16)+" bytes");return t|0}function Hge(t){return+t!=t&&(t=0),Le.alloc(+t)}Le.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==Le.prototype};Le.compare=function(e,r){if(Su(e,Uint8Array)&&(e=Le.from(e,e.offset,e.byteLength)),Su(r,Uint8Array)&&(r=Le.from(r,r.offset,r.byteLength)),!Le.isBuffer(e)||!Le.isBuffer(r))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===r)return 0;for(var n=e.length,i=r.length,o=0,s=Math.min(n,i);o<s;++o)if(e[o]!==r[o]){n=e[o],i=r[o];break}return n<i?-1:i<n?1:0};Le.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}};Le.concat=function(e,r){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(e.length===0)return Le.alloc(0);var n;if(r===void 0)for(r=0,n=0;n<e.length;++n)r+=e[n].length;var i=Le.allocUnsafe(r),o=0;for(n=0;n<e.length;++n){var s=e[n];if(Su(s,Uint8Array))o+s.length>i.length?Le.from(s).copy(i,o):Uint8Array.prototype.set.call(i,s,o);else if(Le.isBuffer(s))s.copy(i,o);else throw new TypeError('"list" argument must be an Array of Buffers');o+=s.length}return i};function XL(t,e){if(Le.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||Su(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);var r=t.length,n=arguments.length>2&&arguments[2]===!0;if(!n&&r===0)return 0;for(var i=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return UA(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return oU(t).length;default:if(i)return n?-1:UA(t).length;e=(""+e).toLowerCase(),i=!0}}Le.byteLength=XL;function Zge(t,e,r){var 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 ove(this,e,r);case"utf8":case"utf-8":return tU(this,e,r);case"ascii":return nve(this,e,r);case"latin1":case"binary":return ive(this,e,r);case"base64":return tve(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return sve(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}Le.prototype._isBuffer=!0;function T0(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}Le.prototype.swap16=function(){var e=this.length;if(e%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var r=0;r<e;r+=2)T0(this,r,r+1);return this};Le.prototype.swap32=function(){var e=this.length;if(e%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var r=0;r<e;r+=4)T0(this,r,r+3),T0(this,r+1,r+2);return this};Le.prototype.swap64=function(){var e=this.length;if(e%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var r=0;r<e;r+=8)T0(this,r,r+7),T0(this,r+1,r+6),T0(this,r+2,r+5),T0(this,r+3,r+4);return this};Le.prototype.toString=function(){var e=this.length;return e===0?"":arguments.length===0?tU(this,0,e):Zge.apply(this,arguments)};Le.prototype.toLocaleString=Le.prototype.toString;Le.prototype.equals=function(e){if(!Le.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e?!0:Le.compare(this,e)===0};Le.prototype.inspect=function(){var e="",r=Mg.INSPECT_MAX_BYTES;return e=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(e+=" ... "),"<Buffer "+e+">"};HL&&(Le.prototype[HL]=Le.prototype.inspect);Le.prototype.compare=function(e,r,n,i,o){if(Su(e,Uint8Array)&&(e=Le.from(e,e.offset,e.byteLength)),!Le.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),i===void 0&&(i=0),o===void 0&&(o=this.length),r<0||n>e.length||i<0||o>this.length)throw new RangeError("out of range index");if(i>=o&&r>=n)return 0;if(i>=o)return-1;if(r>=n)return 1;if(r>>>=0,n>>>=0,i>>>=0,o>>>=0,this===e)return 0;for(var s=o-i,a=n-r,d=Math.min(s,a),m=this.slice(i,o),p=e.slice(r,n),w=0;w<d;++w)if(m[w]!==p[w]){s=m[w],a=p[w];break}return s<a?-1:a<s?1:0};function eU(t,e,r,n,i){if(t.length===0)return-1;if(typeof r=="string"?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,KA(r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0)if(i)r=0;else return-1;if(typeof e=="string"&&(e=Le.from(e,n)),Le.isBuffer(e))return e.length===0?-1:ZL(t,e,r,n,i);if(typeof e=="number")return e=e&255,typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):ZL(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function ZL(t,e,r,n,i){var o=1,s=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;o=2,s/=2,a/=2,r/=2}function d(S,M){return o===1?S[M]:S.readUInt16BE(M*o)}var m;if(i){var p=-1;for(m=r;m<s;m++)if(d(t,m)===d(e,p===-1?0:m-p)){if(p===-1&&(p=m),m-p+1===a)return p*o}else p!==-1&&(m-=m-p),p=-1}else for(r+a>s&&(r=s-a),m=r;m>=0;m--){for(var w=!0,P=0;P<a;P++)if(d(t,m+P)!==d(e,P)){w=!1;break}if(w)return m}return-1}Le.prototype.includes=function(e,r,n){return this.indexOf(e,r,n)!==-1};Le.prototype.indexOf=function(e,r,n){return eU(this,e,r,n,!0)};Le.prototype.lastIndexOf=function(e,r,n){return eU(this,e,r,n,!1)};function Jge(t,e,r,n){r=Number(r)||0;var i=t.length-r;n?(n=Number(n),n>i&&(n=i)):n=i;var o=e.length;n>o/2&&(n=o/2);for(var s=0;s<n;++s){var a=parseInt(e.substr(s*2,2),16);if(KA(a))return s;t[r+s]=a}return s}function Yge(t,e,r,n){return pE(UA(e,t.length-r),t,r,n)}function Qge(t,e,r,n){return pE(fve(e),t,r,n)}function Xge(t,e,r,n){return pE(oU(e),t,r,n)}function eve(t,e,r,n){return pE(uve(e,t.length-r),t,r,n)}Le.prototype.write=function(e,r,n,i){if(r===void 0)i="utf8",n=this.length,r=0;else if(n===void 0&&typeof r=="string")i=r,n=this.length,r=0;else if(isFinite(r))r=r>>>0,isFinite(n)?(n=n>>>0,i===void 0&&(i="utf8")):(i=n,n=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var o=this.length-r;if((n===void 0||n>o)&&(n=o),e.length>0&&(n<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var s=!1;;)switch(i){case"hex":return Jge(this,e,r,n);case"utf8":case"utf-8":return Yge(this,e,r,n);case"ascii":case"latin1":case"binary":return Qge(this,e,r,n);case"base64":return Xge(this,e,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return eve(this,e,r,n);default:if(s)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),s=!0}};Le.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function tve(t,e,r){return e===0&&r===t.length?qA.fromByteArray(t):qA.fromByteArray(t.slice(e,r))}function tU(t,e,r){r=Math.min(t.length,r);for(var n=[],i=e;i<r;){var o=t[i],s=null,a=o>239?4:o>223?3:o>191?2:1;if(i+a<=r){var d,m,p,w;switch(a){case 1:o<128&&(s=o);break;case 2:d=t[i+1],(d&192)===128&&(w=(o&31)<<6|d&63,w>127&&(s=w));break;case 3:d=t[i+1],m=t[i+2],(d&192)===128&&(m&192)===128&&(w=(o&15)<<12|(d&63)<<6|m&63,w>2047&&(w<55296||w>57343)&&(s=w));break;case 4:d=t[i+1],m=t[i+2],p=t[i+3],(d&192)===128&&(m&192)===128&&(p&192)===128&&(w=(o&15)<<18|(d&63)<<12|(m&63)<<6|p&63,w>65535&&w<1114112&&(s=w))}}s===null?(s=65533,a=1):s>65535&&(s-=65536,n.push(s>>>10&1023|55296),s=56320|s&1023),n.push(s),i+=a}return rve(n)}var JL=4096;function rve(t){var e=t.length;if(e<=JL)return String.fromCharCode.apply(String,t);for(var r="",n=0;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=JL));return r}function nve(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;i<r;++i)n+=String.fromCharCode(t[i]&127);return n}function ive(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;i<r;++i)n+=String.fromCharCode(t[i]);return n}function ove(t,e,r){var n=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>n)&&(r=n);for(var i="",o=e;o<r;++o)i+=lve[t[o]];return i}function sve(t,e,r){for(var n=t.slice(e,r),i="",o=0;o<n.length-1;o+=2)i+=String.fromCharCode(n[o]+n[o+1]*256);return i}Le.prototype.slice=function(e,r){var 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);var i=this.subarray(e,r);return Object.setPrototypeOf(i,Le.prototype),i};function _o(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")}Le.prototype.readUintLE=Le.prototype.readUIntLE=function(e,r,n){e=e>>>0,r=r>>>0,n||_o(e,r,this.length);for(var i=this[e],o=1,s=0;++s<r&&(o*=256);)i+=this[e+s]*o;return i};Le.prototype.readUintBE=Le.prototype.readUIntBE=function(e,r,n){e=e>>>0,r=r>>>0,n||_o(e,r,this.length);for(var i=this[e+--r],o=1;r>0&&(o*=256);)i+=this[e+--r]*o;return i};Le.prototype.readUint8=Le.prototype.readUInt8=function(e,r){return e=e>>>0,r||_o(e,1,this.length),this[e]};Le.prototype.readUint16LE=Le.prototype.readUInt16LE=function(e,r){return e=e>>>0,r||_o(e,2,this.length),this[e]|this[e+1]<<8};Le.prototype.readUint16BE=Le.prototype.readUInt16BE=function(e,r){return e=e>>>0,r||_o(e,2,this.length),this[e]<<8|this[e+1]};Le.prototype.readUint32LE=Le.prototype.readUInt32LE=function(e,r){return e=e>>>0,r||_o(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};Le.prototype.readUint32BE=Le.prototype.readUInt32BE=function(e,r){return e=e>>>0,r||_o(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};Le.prototype.readIntLE=function(e,r,n){e=e>>>0,r=r>>>0,n||_o(e,r,this.length);for(var i=this[e],o=1,s=0;++s<r&&(o*=256);)i+=this[e+s]*o;return o*=128,i>=o&&(i-=Math.pow(2,8*r)),i};Le.prototype.readIntBE=function(e,r,n){e=e>>>0,r=r>>>0,n||_o(e,r,this.length);for(var i=r,o=1,s=this[e+--i];i>0&&(o*=256);)s+=this[e+--i]*o;return o*=128,s>=o&&(s-=Math.pow(2,8*r)),s};Le.prototype.readInt8=function(e,r){return e=e>>>0,r||_o(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};Le.prototype.readInt16LE=function(e,r){e=e>>>0,r||_o(e,2,this.length);var n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n};Le.prototype.readInt16BE=function(e,r){e=e>>>0,r||_o(e,2,this.length);var n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n};Le.prototype.readInt32LE=function(e,r){return e=e>>>0,r||_o(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};Le.prototype.readInt32BE=function(e,r){return e=e>>>0,r||_o(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};Le.prototype.readFloatLE=function(e,r){return e=e>>>0,r||_o(e,4,this.length),Sg.read(this,e,!0,23,4)};Le.prototype.readFloatBE=function(e,r){return e=e>>>0,r||_o(e,4,this.length),Sg.read(this,e,!1,23,4)};Le.prototype.readDoubleLE=function(e,r){return e=e>>>0,r||_o(e,8,this.length),Sg.read(this,e,!0,52,8)};Le.prototype.readDoubleBE=function(e,r){return e=e>>>0,r||_o(e,8,this.length),Sg.read(this,e,!1,52,8)};function ba(t,e,r,n,i,o){if(!Le.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<o)throw new RangeError('"value" argument is out of bounds');if(r+n>t.length)throw new RangeError("Index out of range")}Le.prototype.writeUintLE=Le.prototype.writeUIntLE=function(e,r,n,i){if(e=+e,r=r>>>0,n=n>>>0,!i){var o=Math.pow(2,8*n)-1;ba(this,e,r,n,o,0)}var s=1,a=0;for(this[r]=e&255;++a<n&&(s*=256);)this[r+a]=e/s&255;return r+n};Le.prototype.writeUintBE=Le.prototype.writeUIntBE=function(e,r,n,i){if(e=+e,r=r>>>0,n=n>>>0,!i){var o=Math.pow(2,8*n)-1;ba(this,e,r,n,o,0)}var s=n-1,a=1;for(this[r+s]=e&255;--s>=0&&(a*=256);)this[r+s]=e/a&255;return r+n};Le.prototype.writeUint8=Le.prototype.writeUInt8=function(e,r,n){return e=+e,r=r>>>0,n||ba(this,e,r,1,255,0),this[r]=e&255,r+1};Le.prototype.writeUint16LE=Le.prototype.writeUInt16LE=function(e,r,n){return e=+e,r=r>>>0,n||ba(this,e,r,2,65535,0),this[r]=e&255,this[r+1]=e>>>8,r+2};Le.prototype.writeUint16BE=Le.prototype.writeUInt16BE=function(e,r,n){return e=+e,r=r>>>0,n||ba(this,e,r,2,65535,0),this[r]=e>>>8,this[r+1]=e&255,r+2};Le.prototype.writeUint32LE=Le.prototype.writeUInt32LE=function(e,r,n){return e=+e,r=r>>>0,n||ba(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};Le.prototype.writeUint32BE=Le.prototype.writeUInt32BE=function(e,r,n){return e=+e,r=r>>>0,n||ba(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};Le.prototype.writeIntLE=function(e,r,n,i){if(e=+e,r=r>>>0,!i){var o=Math.pow(2,8*n-1);ba(this,e,r,n,o-1,-o)}var s=0,a=1,d=0;for(this[r]=e&255;++s<n&&(a*=256);)e<0&&d===0&&this[r+s-1]!==0&&(d=1),this[r+s]=(e/a>>0)-d&255;return r+n};Le.prototype.writeIntBE=function(e,r,n,i){if(e=+e,r=r>>>0,!i){var o=Math.pow(2,8*n-1);ba(this,e,r,n,o-1,-o)}var s=n-1,a=1,d=0;for(this[r+s]=e&255;--s>=0&&(a*=256);)e<0&&d===0&&this[r+s+1]!==0&&(d=1),this[r+s]=(e/a>>0)-d&255;return r+n};Le.prototype.writeInt8=function(e,r,n){return e=+e,r=r>>>0,n||ba(this,e,r,1,127,-128),e<0&&(e=255+e+1),this[r]=e&255,r+1};Le.prototype.writeInt16LE=function(e,r,n){return e=+e,r=r>>>0,n||ba(this,e,r,2,32767,-32768),this[r]=e&255,this[r+1]=e>>>8,r+2};Le.prototype.writeInt16BE=function(e,r,n){return e=+e,r=r>>>0,n||ba(this,e,r,2,32767,-32768),this[r]=e>>>8,this[r+1]=e&255,r+2};Le.prototype.writeInt32LE=function(e,r,n){return e=+e,r=r>>>0,n||ba(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};Le.prototype.writeInt32BE=function(e,r,n){return e=+e,r=r>>>0,n||ba(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};function rU(t,e,r,n,i,o){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function nU(t,e,r,n,i){return e=+e,r=r>>>0,i||rU(t,e,r,4,34028234663852886e22,-34028234663852886e22),Sg.write(t,e,r,n,23,4),r+4}Le.prototype.writeFloatLE=function(e,r,n){return nU(this,e,r,!0,n)};Le.prototype.writeFloatBE=function(e,r,n){return nU(this,e,r,!1,n)};function iU(t,e,r,n,i){return e=+e,r=r>>>0,i||rU(t,e,r,8,17976931348623157e292,-17976931348623157e292),Sg.write(t,e,r,n,52,8),r+8}Le.prototype.writeDoubleLE=function(e,r,n){return iU(this,e,r,!0,n)};Le.prototype.writeDoubleBE=function(e,r,n){return iU(this,e,r,!1,n)};Le.prototype.copy=function(e,r,n,i){if(!Le.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),!i&&i!==0&&(i=this.length),r>=e.length&&(r=e.length),r||(r=0),i>0&&i<n&&(i=n),i===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(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),e.length-r<i-n&&(i=e.length-r+n);var o=i-n;return this===e&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(r,n,i):Uint8Array.prototype.set.call(e,this.subarray(n,i),r),o};Le.prototype.fill=function(e,r,n,i){if(typeof e=="string"){if(typeof r=="string"?(i=r,r=0,n=this.length):typeof n=="string"&&(i=n,n=this.length),i!==void 0&&typeof i!="string")throw new TypeError("encoding must be a string");if(typeof i=="string"&&!Le.isEncoding(i))throw new TypeError("Unknown encoding: "+i);if(e.length===1){var o=e.charCodeAt(0);(i==="utf8"&&o<128||i==="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);var s;if(typeof e=="number")for(s=r;s<n;++s)this[s]=e;else{var a=Le.isBuffer(e)?e:Le.from(e,i),d=a.length;if(d===0)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(s=0;s<n-r;++s)this[s+r]=a[s%d]}return this};var ave=/[^+/0-9A-Za-z-_]/g;function cve(t){if(t=t.split("=")[0],t=t.trim().replace(ave,""),t.length<2)return"";for(;t.length%4!==0;)t=t+"=";return t}function UA(t,e){e=e||1/0;for(var r,n=t.length,i=null,o=[],s=0;s<n;++s){if(r=t.charCodeAt(s),r>55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&o.push(239,191,189);continue}else if(s+1===n){(e-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&o.push(239,191,189),i=r;continue}r=(i-55296<<10|r-56320)+65536}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;o.push(r)}else if(r<2048){if((e-=2)<0)break;o.push(r>>6|192,r&63|128)}else if(r<65536){if((e-=3)<0)break;o.push(r>>12|224,r>>6&63|128,r&63|128)}else if(r<1114112){if((e-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,r&63|128)}else throw new Error("Invalid code point")}return o}function fve(t){for(var e=[],r=0;r<t.length;++r)e.push(t.charCodeAt(r)&255);return e}function uve(t,e){for(var r,n,i,o=[],s=0;s<t.length&&!((e-=2)<0);++s)r=t.charCodeAt(s),n=r>>8,i=r%256,o.push(i),o.push(n);return o}function oU(t){return qA.toByteArray(cve(t))}function pE(t,e,r,n){for(var i=0;i<n&&!(i+r>=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function Su(t,e){return t instanceof e||t!=null&&t.constructor!=null&&t.constructor.name!=null&&t.constructor.name===e.name}function KA(t){return t!==t}var lve=function(){for(var t="0123456789abcdef",e=new Array(256),r=0;r<16;++r)for(var n=r*16,i=0;i<16;++i)e[n+i]=t[r]+t[i];return e}()});var ws=H((Aet,fU)=>{E();var Ci=fU.exports={},Mu,Pu;function GA(){throw new Error("setTimeout has not been defined")}function WA(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?Mu=setTimeout:Mu=GA}catch{Mu=GA}try{typeof clearTimeout=="function"?Pu=clearTimeout:Pu=WA}catch{Pu=WA}})();function sU(t){if(Mu===setTimeout)return setTimeout(t,0);if((Mu===GA||!Mu)&&setTimeout)return Mu=setTimeout,setTimeout(t,0);try{return Mu(t,0)}catch{try{return Mu.call(null,t,0)}catch{return Mu.call(this,t,0)}}}function dve(t){if(Pu===clearTimeout)return clearTimeout(t);if((Pu===WA||!Pu)&&clearTimeout)return Pu=clearTimeout,clearTimeout(t);try{return Pu(t)}catch{try{return Pu.call(null,t)}catch{return Pu.call(this,t)}}}var td=[],Pg=!1,R0,mE=-1;function hve(){!Pg||!R0||(Pg=!1,R0.length?td=R0.concat(td):mE=-1,td.length&&aU())}function aU(){if(!Pg){var t=sU(hve);Pg=!0;for(var e=td.length;e;){for(R0=td,td=[];++mE<e;)R0&&R0[mE].run();mE=-1,e=td.length}R0=null,Pg=!1,dve(t)}}Ci.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)e[r-1]=arguments[r];td.push(new cU(t,e)),td.length===1&&!Pg&&sU(aU)};function cU(t,e){this.fun=t,this.array=e}cU.prototype.run=function(){this.fun.apply(null,this.array)};Ci.title="browser";Ci.browser=!0;Ci.env={};Ci.argv=[];Ci.version="";Ci.versions={};function rd(){}Ci.on=rd;Ci.addListener=rd;Ci.once=rd;Ci.off=rd;Ci.removeListener=rd;Ci.removeAllListeners=rd;Ci.emit=rd;Ci.prependListener=rd;Ci.prependOnceListener=rd;Ci.listeners=function(t){return[]};Ci.binding=function(t){throw new Error("process.binding is not supported")};Ci.cwd=function(){return"/"};Ci.chdir=function(t){throw new Error("process.chdir is not supported")};Ci.umask=function(){return 0}});var $,j,Ret,E=Dge(()=>{$=or(sr()),j=or(ws()),Ret=function(t){function e(){var n=this||self;return delete t.prototype.__magic__,n}if(typeof globalThis=="object")return globalThis;if(this)return e();t.defineProperty(t.prototype,"__magic__",{configurable:!0,get:e});var r=__magic__;return r}(Object)});var lU=H((ket,uU)=>{E();var pve=typeof globalThis=="object"&&globalThis&&globalThis.Object===Object&&globalThis;uU.exports=pve});var hU=H((Bet,dU)=>{E();var mve=lU(),yve=typeof self=="object"&&self&&self.Object===Object&&self,gve=mve||yve||Function("return this")();dU.exports=gve});var VA=H((Cet,pU)=>{E();var vve=hU(),bve=vve.Symbol;pU.exports=bve});var vU=H((Net,gU)=>{E();var mU=VA(),yU=Object.prototype,wve=yU.hasOwnProperty,_ve=yU.toString,d1=mU?mU.toStringTag:void 0;function xve(t){var e=wve.call(t,d1),r=t[d1];try{t[d1]=void 0;var n=!0}catch{}var i=_ve.call(t);return n&&(e?t[d1]=r:delete t[d1]),i}gU.exports=xve});var wU=H(($et,bU)=>{E();var Eve=Object.prototype,Sve=Eve.toString;function Mve(t){return Sve.call(t)}bU.exports=Mve});var SU=H((Uet,EU)=>{E();var _U=VA(),Pve=vU(),Ave=wU(),Tve="[object Null]",Rve="[object Undefined]",xU=_U?_U.toStringTag:void 0;function Ive(t){return t==null?t===void 0?Rve:Tve:xU&&xU in Object(t)?Pve(t):Ave(t)}EU.exports=Ive});var PU=H((zet,MU)=>{E();function kve(t,e){return function(r){return t(e(r))}}MU.exports=kve});var TU=H((Get,AU)=>{E();var Ove=PU(),Bve=Ove(Object.getPrototypeOf,Object);AU.exports=Bve});var IU=H((Vet,RU)=>{E();function Dve(t){return t!=null&&typeof t=="object"}RU.exports=Dve});var BU=H((Zet,OU)=>{E();var Cve=SU(),jve=TU(),Nve=IU(),qve="[object Object]",$ve=Function.prototype,Lve=Object.prototype,kU=$ve.toString,Uve=Lve.hasOwnProperty,Fve=kU.call(Object);function zve(t){if(!Nve(t)||Cve(t)!=qve)return!1;var e=jve(t);if(e===null)return!0;var r=Uve.call(e,"constructor")&&e.constructor;return typeof r=="function"&&r instanceof r&&kU.call(r)==Fve}OU.exports=zve});var Va=H((zst,DK)=>{"use strict";E();function BK(t,e){for(let r in e)Object.defineProperty(t,r,{value:e[r],enumerable:!0,configurable:!0});return t}function z2e(t,e,r){if(!t||typeof t=="string")throw new TypeError("Please pass an Error to err-code");r||(r={}),typeof e=="object"&&(r=e,e=""),e&&(r.code=e);try{return BK(t,r)}catch{r.message=t.message,r.stack=t.stack;let i=function(){};return i.prototype=Object.create(Object.getPrototypeOf(t)),BK(new i,r)}}DK.exports=z2e});var fG=H((ict,cG)=>{"use strict";E();cG.exports=B_e;function B_e(t,e){for(var r=new Array(arguments.length-1),n=0,i=2,o=!0;i<arguments.length;)r[n++]=arguments[i++];return new Promise(function(a,d){r[n]=function(p){if(o)if(o=!1,p)d(p);else{for(var w=new Array(arguments.length-1),P=0;P<w.length;)w[P++]=arguments[P];a.apply(null,w)}};try{t.apply(e||null,r)}catch(m){o&&(o=!1,d(m))}})}});var hG=H(dG=>{"use strict";E();var r6=dG;r6.length=function(e){var r=e.length;if(!r)return 0;for(var n=0;--r%4>1&&e.charAt(r)==="=";)++n;return Math.ceil(e.length*3)/4-n};var fv=new Array(64),lG=new Array(123);for(Mf=0;Mf<64;)lG[fv[Mf]=Mf<26?Mf+65:Mf<52?Mf+71:Mf<62?Mf-4:Mf-59|43]=Mf++;var Mf;r6.encode=function(e,r,n){for(var i=null,o=[],s=0,a=0,d;r<n;){var m=e[r++];switch(a){case 0:o[s++]=fv[m>>2],d=(m&3)<<4,a=1;break;case 1:o[s++]=fv[d|m>>4],d=(m&15)<<2,a=2;break;case 2:o[s++]=fv[d|m>>6],o[s++]=fv[m&63],a=0;break}s>8191&&((i||(i=[])).push(String.fromCharCode.apply(String,o)),s=0)}return a&&(o[s++]=fv[d],o[s++]=61,a===1&&(o[s++]=61)),i?(s&&i.push(String.fromCharCode.apply(String,o.slice(0,s))),i.join("")):String.fromCharCode.apply(String,o.slice(0,s))};var uG="invalid encoding";r6.decode=function(e,r,n){for(var i=n,o=0,s,a=0;a<e.length;){var d=e.charCodeAt(a++);if(d===61&&o>1)break;if((d=lG[d])===void 0)throw Error(uG);switch(o){case 0:s=d,o=1;break;case 1:r[n++]=s<<2|(d&48)>>4,s=d,o=2;break;case 2:r[n++]=(s&15)<<4|(d&60)>>2,s=d,o=3;break;case 3:r[n++]=(s&3)<<6|d,o=0;break}}if(o===1)throw Error(uG);return n-i};r6.test=function(e){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e)}});var mG=H((cct,pG)=>{"use strict";E();pG.exports=n6;function n6(){this._listeners={}}n6.prototype.on=function(e,r,n){return(this._listeners[e]||(this._listeners[e]=[])).push({fn:r,ctx:n||this}),this};n6.prototype.off=function(e,r){if(e===void 0)this._listeners={};else if(r===void 0)this._listeners[e]=[];else for(var n=this._listeners[e],i=0;i<n.length;)n[i].fn===r?n.splice(i,1):++i;return this};n6.prototype.emit=function(e){var r=this._listeners[e];if(r){for(var n=[],i=1;i<arguments.length;)n.push(arguments[i++]);for(i=0;i<r.length;)r[i].fn.apply(r[i++].ctx,n)}return this}});var xG=H((uct,_G)=>{"use strict";E();_G.exports=yG(yG);function yG(t){return typeof Float32Array<"u"?function(){var e=new Float32Array([-0]),r=new Uint8Array(e.buffer),n=r[3]===128;function i(d,m,p){e[0]=d,m[p]=r[0],m[p+1]=r[1],m[p+2]=r[2],m[p+3]=r[3]}function o(d,m,p){e[0]=d,m[p]=r[3],m[p+1]=r[2],m[p+2]=r[1],m[p+3]=r[0]}t.writeFloatLE=n?i:o,t.writeFloatBE=n?o:i;function s(d,m){return r[0]=d[m],r[1]=d[m+1],r[2]=d[m+2],r[3]=d[m+3],e[0]}function a(d,m){return r[3]=d[m],r[2]=d[m+1],r[1]=d[m+2],r[0]=d[m+3],e[0]}t.readFloatLE=n?s:a,t.readFloatBE=n?a:s}():function(){function e(n,i,o,s){var a=i<0?1:0;if(a&&(i=-i),i===0)n(1/i>0?0:2147483648,o,s);else if(isNaN(i))n(2143289344,o,s);else if(i>34028234663852886e22)n((a<<31|2139095040)>>>0,o,s);else if(i<11754943508222875e-54)n((a<<31|Math.round(i/1401298464324817e-60))>>>0,o,s);else{var d=Math.floor(Math.log(i)/Math.LN2),m=Math.round(i*Math.pow(2,-d)*8388608)&8388607;n((a<<31|d+127<<23|m)>>>0,o,s)}}t.writeFloatLE=e.bind(null,gG),t.writeFloatBE=e.bind(null,vG);function r(n,i,o){var s=n(i,o),a=(s>>31)*2+1,d=s>>>23&255,m=s&8388607;return d===255?m?NaN:a*(1/0):d===0?a*1401298464324817e-60*m:a*Math.pow(2,d-150)*(m+8388608)}t.readFloatLE=r.bind(null,bG),t.readFloatBE=r.bind(null,wG)}(),typeof Float64Array<"u"?function(){var e=new Float64Array([-0]),r=new Uint8Array(e.buffer),n=r[7]===128;function i(d,m,p){e[0]=d,m[p]=r[0],m[p+1]=r[1],m[p+2]=r[2],m[p+3]=r[3],m[p+4]=r[4],m[p+5]=r[5],m[p+6]=r[6],m[p+7]=r[7]}function o(d,m,p){e[0]=d,m[p]=r[7],m[p+1]=r[6],m[p+2]=r[5],m[p+3]=r[4],m[p+4]=r[3],m[p+5]=r[2],m[p+6]=r[1],m[p+7]=r[0]}t.writeDoubleLE=n?i:o,t.writeDoubleBE=n?o:i;function s(d,m){return r[0]=d[m],r[1]=d[m+1],r[2]=d[m+2],r[3]=d[m+3],r[4]=d[m+4],r[5]=d[m+5],r[6]=d[m+6],r[7]=d[m+7],e[0]}function a(d,m){return r[7]=d[m],r[6]=d[m+1],r[5]=d[m+2],r[4]=d[m+3],r[3]=d[m+4],r[2]=d[m+5],r[1]=d[m+6],r[0]=d[m+7],e[0]}t.readDoubleLE=n?s:a,t.readDoubleBE=n?a:s}():function(){function e(n,i,o,s,a,d){var m=s<0?1:0;if(m&&(s=-s),s===0)n(0,a,d+i),n(1/s>0?0:2147483648,a,d+o);else if(isNaN(s))n(0,a,d+i),n(2146959360,a,d+o);else if(s>17976931348623157e292)n(0,a,d+i),n((m<<31|2146435072)>>>0,a,d+o);else{var p;if(s<22250738585072014e-324)p=s/5e-324,n(p>>>0,a,d+i),n((m<<31|p/4294967296)>>>0,a,d+o);else{var w=Math.floor(Math.log(s)/Math.LN2);w===1024&&(w=1023),p=s*Math.pow(2,-w),n(p*4503599627370496>>>0,a,d+i),n((m<<31|w+1023<<20|p*1048576&1048575)>>>0,a,d+o)}}}t.writeDoubleLE=e.bind(null,gG,0,4),t.writeDoubleBE=e.bind(null,vG,4,0);function r(n,i,o,s,a){var d=n(s,a+i),m=n(s,a+o),p=(m>>31)*2+1,w=m>>>20&2047,P=4294967296*(m&1048575)+d;return w===2047?P?NaN:p*(1/0):w===0?p*5e-324*P:p*Math.pow(2,w-1075)*(P+4503599627370496)}t.readDoubleLE=r.bind(null,bG,0,4),t.readDoubleBE=r.bind(null,wG,4,0)}(),t}function gG(t,e,r){e[r]=t&255,e[r+1]=t>>>8&255,e[r+2]=t>>>16&255,e[r+3]=t>>>24}function vG(t,e,r){e[r]=t>>>24,e[r+1]=t>>>16&255,e[r+2]=t>>>8&255,e[r+3]=t&255}function bG(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16|t[e+3]<<24)>>>0}function wG(t,e){return(t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3])>>>0}});var EG=H((exports,module)=>{"use strict";E();module.exports=inquire;function inquire(moduleName){try{var mod=eval("quire".replace(/^/,"re"))(moduleName);if(mod&&(mod.length||Object.keys(mod).length))return mod}catch(t){}return null}});var MG=H(SG=>{"use strict";E();var IR=SG;IR.length=function(e){for(var r=0,n=0,i=0;i<e.length;++i)n=e.charCodeAt(i),n<128?r+=1:n<2048?r+=2:(n&64512)===55296&&(e.charCodeAt(i+1)&64512)===56320?(++i,r+=4):r+=3;return r};IR.read=function(e,r,n){var i=n-r;if(i<1)return"";for(var o=null,s=[],a=0,d;r<n;)d=e[r++],d<128?s[a++]=d:d>191&&d<224?s[a++]=(d&31)<<6|e[r++]&63:d>239&&d<365?(d=((d&7)<<18|(e[r++]&63)<<12|(e[r++]&63)<<6|e[r++]&63)-65536,s[a++]=55296+(d>>10),s[a++]=56320+(d&1023)):s[a++]=(d&15)<<12|(e[r++]&63)<<6|e[r++]&63,a>8191&&((o||(o=[])).push(String.fromCharCode.apply(String,s)),a=0);return o?(a&&o.push(String.fromCharCode.apply(String,s.slice(0,a))),o.join("")):String.fromCharCode.apply(String,s.slice(0,a))};IR.write=function(e,r,n){for(var i=n,o,s,a=0;a<e.length;++a)o=e.charCodeAt(a),o<128?r[n++]=o:o<2048?(r[n++]=o>>6|192,r[n++]=o&63|128):(o&64512)===55296&&((s=e.charCodeAt(a+1))&64512)===56320?(o=65536+((o&1023)<<10)+(s&1023),++a,r[n++]=o>>18|240,r[n++]=o>>12&63|128,r[n++]=o>>6&63|128,r[n++]=o&63|128):(r[n++]=o>>12|224,r[n++]=o>>6&63|128,r[n++]=o&63|128);return n-i}});var AG=H((mct,PG)=>{"use strict";E();PG.exports=D_e;function D_e(t,e,r){var n=r||8192,i=n>>>1,o=null,s=n;return function(d){if(d<1||d>i)return t(d);s+d>n&&(o=t(n),s=0);var m=e.call(o,s,s+=d);return s&7&&(s=(s|7)+1),m}}});var RG=H((gct,TG)=>{"use strict";E();TG.exports=Po;var Y1=J0();function Po(t,e){this.lo=t>>>0,this.hi=e>>>0}var Z0=Po.zero=new Po(0,0);Z0.toNumber=function(){return 0};Z0.zzEncode=Z0.zzDecode=function(){return this};Z0.length=function(){return 1};var C_e=Po.zeroHash="\0\0\0\0\0\0\0\0";Po.fromNumber=function(e){if(e===0)return Z0;var r=e<0;r&&(e=-e);var n=e>>>0,i=(e-n)/4294967296>>>0;return r&&(i=~i>>>0,n=~n>>>0,++n>4294967295&&(n=0,++i>4294967295&&(i=0))),new Po(n,i)};Po.from=function(e){if(typeof e=="number")return Po.fromNumber(e);if(Y1.isString(e))if(Y1.Long)e=Y1.Long.fromString(e);else return Po.fromNumber(parseInt(e,10));return e.low||e.high?new Po(e.low>>>0,e.high>>>0):Z0};Po.prototype.toNumber=function(e){if(!e&&this.hi>>>31){var r=~this.lo+1>>>0,n=~this.hi>>>0;return r||(n=n+1>>>0),-(r+n*4294967296)}return this.lo+this.hi*4294967296};Po.prototype.toLong=function(e){return Y1.Long?new Y1.Long(this.lo|0,this.hi|0,Boolean(e)):{low:this.lo|0,high:this.hi|0,unsigned:Boolean(e)}};var Hh=String.prototype.charCodeAt;Po.fromHash=function(e){return e===C_e?Z0:new Po((Hh.call(e,0)|Hh.call(e,1)<<8|Hh.call(e,2)<<16|Hh.call(e,3)<<24)>>>0,(Hh.call(e,4)|Hh.call(e,5)<<8|Hh.call(e,6)<<16|Hh.call(e,7)<<24)>>>0)};Po.prototype.toHash=function(){return String.fromCharCode(this.lo&255,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,this.hi&255,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)};Po.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};Po.prototype.zzDecode=function(){var e=-(this.lo&1);return this.lo=((this.lo>>>1|this.hi<<31)^e)>>>0,this.hi=(this.hi>>>1^e)>>>0,this};Po.prototype.length=function(){var e=this.lo,r=(this.lo>>>28|this.hi<<4)>>>0,n=this.hi>>>24;return n===0?r===0?e<16384?e<128?1:2:e<2097152?3:4:r<16384?r<128?5:6:r<2097152?7:8:n<128?9:10}});var J0=H(kR=>{"use strict";E();var wt=kR;wt.asPromise=fG();wt.base64=hG();wt.EventEmitter=mG();wt.float=xG();wt.inquire=EG();wt.utf8=MG();wt.pool=AG();wt.LongBits=RG();wt.isNode=Boolean(typeof globalThis<"u"&&globalThis&&globalThis.process&&globalThis.process.versions&&globalThis.process.versions.node);wt.global=wt.isNode&&globalThis||typeof window<"u"&&window||typeof self<"u"&&self||kR;wt.emptyArray=Object.freeze?Object.freeze([]):[];wt.emptyObject=Object.freeze?Object.freeze({}):{};wt.isInteger=Number.isInteger||function(e){return typeof e=="number"&&isFinite(e)&&Math.floor(e)===e};wt.isString=function(e){return typeof e=="string"||e instanceof String};wt.isObject=function(e){return e&&typeof e=="object"};wt.isset=wt.isSet=function(e,r){var n=e[r];return n!=null&&e.hasOwnProperty(r)?typeof n!="object"||(Array.isArray(n)?n.length:Object.keys(n).length)>0:!1};wt.Buffer=function(){try{var t=wt.inquire("buffer").Buffer;return t.prototype.utf8Write?t:null}catch{return null}}();wt._Buffer_from=null;wt._Buffer_allocUnsafe=null;wt.newBuffer=function(e){return typeof e=="number"?wt.Buffer?wt._Buffer_allocUnsafe(e):new wt.Array(e):wt.Buffer?wt._Buffer_from(e):typeof Uint8Array>"u"?e:new Uint8Array(e)};wt.Array=typeof Uint8Array<"u"?Uint8Array:Array;wt.Long=wt.global.dcodeIO&&wt.global.dcodeIO.Long||wt.global.Long||wt.inquire("long");wt.key2Re=/^true|false|0|1$/;wt.key32Re=/^-?(?:0|[1-9][0-9]*)$/;wt.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/;wt.longToHash=function(e){return e?wt.LongBits.from(e).toHash():wt.LongBits.zeroHash};wt.longFromHash=function(e,r){var n=wt.LongBits.fromHash(e);return wt.Long?wt.Long.fromBits(n.lo,n.hi,r):n.toNumber(Boolean(r))};function IG(t,e,r){for(var n=Object.keys(e),i=0;i<n.length;++i)(t[n[i]]===void 0||!r)&&(t[n[i]]=e[n[i]]);return t}wt.merge=IG;wt.lcFirst=function(e){return e.charAt(0).toLowerCase()+e.substring(1)};function kG(t){function e(r,n){if(!(this instanceof e))return new e(r,n);Object.defineProperty(this,"message",{get:function(){return r}}),Error.captureStackTrace?Error.captureStackTrace(this,e):Object.defineProperty(this,"stack",{value:new Error().stack||""}),n&&IG(this,n)}return e.prototype=Object.create(Error.prototype,{constructor:{value:e,writable:!0,enumerable:!1,configurable:!0},name:{get:function(){return t},set:void 0,enumerable:!1,configurable:!0},toString:{value:function(){return this.name+": "+this.message},writable:!0,enumerable:!1,configurable:!0}}),e}wt.newError=kG;wt.ProtocolError=kG("ProtocolError");wt.oneOfGetter=function(e){for(var r={},n=0;n<e.length;++n)r[e[n]]=1;return function(){for(var i=Object.keys(this),o=i.length-1;o>-1;--o)if(r[i[o]]===1&&this[i[o]]!==void 0&&this[i[o]]!==null)return i[o]}};wt.oneOfSetter=function(e){return function(r){for(var n=0;n<e.length;++n)e[n]!==r&&delete this[e[n]]}};wt.toJSONOptions={longs:String,enums:String,bytes:String,json:!0};wt._configure=function(){var t=wt.Buffer;if(!t){wt._Buffer_from=wt._Buffer_allocUnsafe=null;return}wt._Buffer_from=t.from!==Uint8Array.from&&t.from||function(r,n){return new t(r,n)},wt._Buffer_allocUnsafe=t.allocUnsafe||function(r){return new t(r)}}});var DR=H((_ct,jG)=>{"use strict";E();jG.exports=qi;var Pf=J0(),BR,DG=Pf.LongBits,j_e=Pf.utf8;function Af(t,e){return RangeError("index out of range: "+t.pos+" + "+(e||1)+" > "+t.len)}function qi(t){this.buf=t,this.pos=0,this.len=t.length}var OG=typeof Uint8Array<"u"?function(e){if(e instanceof Uint8Array||Array.isArray(e))return new qi(e);throw Error("illegal buffer")}:function(e){if(Array.isArray(e))return new qi(e);throw Error("illegal buffer")},CG=function(){return Pf.Buffer?function(r){return(qi.create=function(i){return Pf.Buffer.isBuffer(i)?new BR(i):OG(i)})(r)}:OG};qi.create=CG();qi.prototype._slice=Pf.Array.prototype.subarray||Pf.Array.prototype.slice;qi.prototype.uint32=function(){var e=4294967295;return function(){if(e=(this.buf[this.pos]&127)>>>0,this.buf[this.pos++]<128||(e=(e|(this.buf[this.pos]&127)<<7)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&127)<<14)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&127)<<21)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&15)<<28)>>>0,this.buf[this.pos++]<128))return e;if((this.pos+=5)>this.len)throw this.pos=this.len,Af(this,10);return e}}();qi.prototype.int32=function(){return this.uint32()|0};qi.prototype.sint32=function(){var e=this.uint32();return e>>>1^-(e&1)|0};function OR(){var t=new DG(0,0),e=0;if(this.len-this.pos>4){for(;e<4;++e)if(t.lo=(t.lo|(this.buf[this.pos]&127)<<e*7)>>>0,this.buf[this.pos++]<128)return t;if(t.lo=(t.lo|(this.buf[this.pos]&127)<<28)>>>0,t.hi=(t.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return t;e=0}else{for(;e<3;++e){if(this.pos>=this.len)throw Af(this);if(t.lo=(t.lo|(this.buf[this.pos]&127)<<e*7)>>>0,this.buf[this.pos++]<128)return t}return t.lo=(t.lo|(this.buf[this.pos++]&127)<<e*7)>>>0,t}if(this.len-this.pos>4){for(;e<5;++e)if(t.hi=(t.hi|(this.buf[this.pos]&127)<<e*7+3)>>>0,this.buf[this.pos++]<128)return t}else for(;e<5;++e){if(this.pos>=this.len)throw Af(this);if(t.hi=(t.hi|(this.buf[this.pos]&127)<<e*7+3)>>>0,this.buf[this.pos++]<128)return t}throw Error("invalid varint encoding")}qi.prototype.bool=function(){return this.uint32()!==0};function i6(t,e){return(t[e-4]|t[e-3]<<8|t[e-2]<<16|t[e-1]<<24)>>>0}qi.prototype.fixed32=function(){if(this.pos+4>this.len)throw Af(this,4);return i6(this.buf,this.pos+=4)};qi.prototype.sfixed32=function(){if(this.pos+4>this.len)throw Af(this,4);return i6(this.buf,this.pos+=4)|0};function BG(){if(this.pos+8>this.len)throw Af(this,8);return new DG(i6(this.buf,this.pos+=4),i6(this.buf,this.pos+=4))}qi.prototype.float=function(){if(this.pos+4>this.len)throw Af(this,4);var e=Pf.float.readFloatLE(this.buf,this.pos);return this.pos+=4,e};qi.prototype.double=function(){if(this.pos+8>this.len)throw Af(this,4);var e=Pf.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,e};qi.prototype.bytes=function(){var e=this.uint32(),r=this.pos,n=this.pos+e;if(n>this.len)throw Af(this,e);if(this.pos+=e,Array.isArray(this.buf))return this.buf.slice(r,n);if(r===n){var i=Pf.Buffer;return i?i.alloc(0):new this.buf.constructor(0)}return this._slice.call(this.buf,r,n)};qi.prototype.string=function(){var e=this.bytes();return j_e.read(e,0,e.length)};qi.prototype.skip=function(e){if(typeof e=="number"){if(this.pos+e>this.len)throw Af(this,e);this.pos+=e}else do if(this.pos>=this.len)throw Af(this);while(this.buf[this.pos++]&128);return this};qi.prototype.skipType=function(t){switch(t){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(t=this.uint32()&7)!==4;)this.skipType(t);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+t+" at offset "+this.pos)}return this};qi._configure=function(t){BR=t,qi.create=CG(),BR._configure();var e=Pf.Long?"toLong":"toNumber";Pf.merge(qi.prototype,{int64:function(){return OR.call(this)[e](!1)},uint64:function(){return OR.call(this)[e](!0)},sint64:function(){return OR.call(this).zzDecode()[e](!1)},fixed64:function(){return BG.call(this)[e](!0)},sfixed64:function(){return BG.call(this)[e](!1)}})}});var LG=H((Ect,$G)=>{"use strict";E();$G.exports=Y0;var qG=DR();(Y0.prototype=Object.create(qG.prototype)).constructor=Y0;var NG=J0();function Y0(t){qG.call(this,t)}Y0._configure=function(){NG.Buffer&&(Y0.prototype._slice=NG.Buffer.prototype.slice)};Y0.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))};Y0._configure()});var UR=H((Mct,KG)=>{"use strict";E();KG.exports=Zr;var Ac=J0(),CR,o6=Ac.LongBits,UG=Ac.base64,FG=Ac.utf8;function Q1(t,e,r){this.fn=t,this.len=e,this.next=void 0,this.val=r}function NR(){}function N_e(t){this.head=t.head,this.tail=t.tail,this.len=t.len,this.next=t.states}function Zr(){this.len=0,this.head=new Q1(NR,0,0),this.tail=this.head,this.states=null}var zG=function(){return Ac.Buffer?function(){return(Zr.create=function(){return new CR})()}:function(){return new Zr}};Zr.create=zG();Zr.alloc=function(e){return new Ac.Array(e)};Ac.Array!==Array&&(Zr.alloc=Ac.pool(Zr.alloc,Ac.Array.prototype.subarray));Zr.prototype._push=function(e,r,n){return this.tail=this.tail.next=new Q1(e,r,n),this.len+=r,this};function qR(t,e,r){e[r]=t&255}function q_e(t,e,r){for(;t>127;)e[r++]=t&127|128,t>>>=7;e[r]=t}function $R(t,e){this.len=t,this.next=void 0,this.val=e}$R.prototype=Object.create(Q1.prototype);$R.prototype.fn=q_e;Zr.prototype.uint32=function(e){return this.len+=(this.tail=this.tail.next=new $R((e=e>>>0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this};Zr.prototype.int32=function(e){return e<0?this._push(LR,10,o6.fromNumber(e)):this.uint32(e)};Zr.prototype.sint32=function(e){return this.uint32((e<<1^e>>31)>>>0)};function LR(t,e,r){for(;t.hi;)e[r++]=t.lo&127|128,t.lo=(t.lo>>>7|t.hi<<25)>>>0,t.hi>>>=7;for(;t.lo>127;)e[r++]=t.lo&127|128,t.lo=t.lo>>>7;e[r++]=t.lo}Zr.prototype.uint64=function(e){var r=o6.from(e);return this._push(LR,r.length(),r)};Zr.prototype.int64=Zr.prototype.uint64;Zr.prototype.sint64=function(e){var r=o6.from(e).zzEncode();return this._push(LR,r.length(),r)};Zr.prototype.bool=function(e){return this._push(qR,1,e?1:0)};function jR(t,e,r){e[r]=t&255,e[r+1]=t>>>8&255,e[r+2]=t>>>16&255,e[r+3]=t>>>24}Zr.prototype.fixed32=function(e){return this._push(jR,4,e>>>0)};Zr.prototype.sfixed32=Zr.prototype.fixed32;Zr.prototype.fixed64=function(e){var r=o6.from(e);return this._push(jR,4,r.lo)._push(jR,4,r.hi)};Zr.prototype.sfixed64=Zr.prototype.fixed64;Zr.prototype.float=function(e){return this._push(Ac.float.writeFloatLE,4,e)};Zr.prototype.double=function(e){return this._push(Ac.float.writeDoubleLE,8,e)};var $_e=Ac.Array.prototype.set?function(e,r,n){r.set(e,n)}:function(e,r,n){for(var i=0;i<e.length;++i)r[n+i]=e[i]};Zr.prototype.bytes=function(e){var r=e.length>>>0;if(!r)return this._push(qR,1,0);if(Ac.isString(e)){var n=Zr.alloc(r=UG.length(e));UG.decode(e,n,0),e=n}return this.uint32(r)._push($_e,r,e)};Zr.prototype.string=function(e){var r=FG.length(e);return r?this.uint32(r)._push(FG.write,r,e):this._push(qR,1,0)};Zr.prototype.fork=function(){return this.states=new N_e(this),this.head=this.tail=new Q1(NR,0,0),this.len=0,this};Zr.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 Q1(NR,0,0),this.len=0),this};Zr.prototype.ldelim=function(){var e=this.head,r=this.tail,n=this.len;return this.reset().uint32(n),n&&(this.tail.next=e.next,this.tail=r,this.len+=n),this};Zr.prototype.finish=function(){for(var e=this.head.next,r=this.constructor.alloc(this.len),n=0;e;)e.fn(e.val,r,n),n+=e.len,e=e.next;return r};Zr._configure=function(t){CR=t,Zr.create=zG(),CR._configure()}});var VG=H((Act,WG)=>{"use strict";E();WG.exports=Cu;var GG=UR();(Cu.prototype=Object.create(GG.prototype)).constructor=Cu;var Zh=J0();function Cu(){GG.call(this)}Cu._configure=function(){Cu.alloc=Zh._Buffer_allocUnsafe,Cu.writeBytesBuffer=Zh.Buffer&&Zh.Buffer.prototype instanceof Uint8Array&&Zh.Buffer.prototype.set.name==="set"?function(e,r,n){r.set(e,n)}:function(e,r,n){if(e.copy)e.copy(r,n,0,e.length);else for(var i=0;i<e.length;)r[n++]=e[i++]}};Cu.prototype.bytes=function(e){Zh.isString(e)&&(e=Zh._Buffer_from(e,"base64"));var r=e.length>>>0;return this.uint32(r),r&&this._push(Cu.writeBytesBuffer,r,e),this};function L_e(t,e,r){t.length<40?Zh.utf8.write(t,e,r):e.utf8Write?e.utf8Write(t,r):e.write(t,r)}Cu.prototype.string=function(e){var r=Zh.Buffer.byteLength(e);return this.uint32(r),r&&this._push(L_e,r,e),this};Cu._configure()});var wW=H((u2,f6)=>{E();(function(t,e){"use strict";var r={version:"3.0.0",x86:{},x64:{},inputValidation:!0};function n(S){if(!Array.isArray(S)&&!ArrayBuffer.isView(S))return!1;for(var M=0;M<S.length;M++)if(!Number.isInteger(S[M])||S[M]<0||S[M]>255)return!1;return!0}function i(S,M){return(S&65535)*M+(((S>>>16)*M&65535)<<16)}function o(S,M){return S<<M|S>>>32-M}function s(S){return S^=S>>>16,S=i(S,2246822507),S^=S>>>13,S=i(S,3266489909),S^=S>>>16,S}function a(S,M){S=[S[0]>>>16,S[0]&65535,S[1]>>>16,S[1]&65535],M=[M[0]>>>16,M[0]&65535,M[1]>>>16,M[1]&65535];var A=[0,0,0,0];return A[3]+=S[3]+M[3],A[2]+=A[3]>>>16,A[3]&=65535,A[2]+=S[2]+M[2],A[1]+=A[2]>>>16,A[2]&=65535,A[1]+=S[1]+M[1],A[0]+=A[1]>>>16,A[1]&=65535,A[0]+=S[0]+M[0],A[0]&=65535,[A[0]<<16|A[1],A[2]<<16|A[3]]}function d(S,M){S=[S[0]>>>16,S[0]&65535,S[1]>>>16,S[1]&65535],M=[M[0]>>>16,M[0]&65535,M[1]>>>16,M[1]&65535];var A=[0,0,0,0];return A[3]+=S[3]*M[3],A[2]+=A[3]>>>16,A[3]&=65535,A[2]+=S[2]*M[3],A[1]+=A[2]>>>16,A[2]&=65535,A[2]+=S[3]*M[2],A[1]+=A[2]>>>16,A[2]&=65535,A[1]+=S[1]*M[3],A[0]+=A[1]>>>16,A[1]&=65535,A[1]+=S[2]*M[2],A[0]+=A[1]>>>16,A[1]&=65535,A[1]+=S[3]*M[1],A[0]+=A[1]>>>16,A[1]&=65535,A[0]+=S[0]*M[3]+S[1]*M[2]+S[2]*M[1]+S[3]*M[0],A[0]&=65535,[A[0]<<16|A[1],A[2]<<16|A[3]]}function m(S,M){return M%=64,M===32?[S[1],S[0]]:M<32?[S[0]<<M|S[1]>>>32-M,S[1]<<M|S[0]>>>32-M]:(M-=32,[S[1]<<M|S[0]>>>32-M,S[0]<<M|S[1]>>>32-M])}function p(S,M){return M%=64,M===0?S:M<32?[S[0]<<M|S[1]>>>32-M,S[1]<<M]:[S[1]<<M-32,0]}function w(S,M){return[S[0]^M[0],S[1]^M[1]]}function P(S){return S=w(S,[0,S[0]>>>1]),S=d(S,[4283543511,3981806797]),S=w(S,[0,S[0]>>>1]),S=d(S,[3301882366,444984403]),S=w(S,[0,S[0]>>>1]),S}r.x86.hash32=function(S,M){if(r.inputValidation&&!n(S))return e;M=M||0;for(var A=S.length%4,B=S.length-A,I=M,C=0,k=3432918353,q=461845907,L=0;L<B;L=L+4)C=S[L]|S[L+1]<<8|S[L+2]<<16|S[L+3]<<24,C=i(C,k),C=o(C,15),C=i(C,q),I^=C,I=o(I,13),I=i(I,5)+3864292196;switch(C=0,A){case 3:C^=S[L+2]<<16;case 2:C^=S[L+1]<<8;case 1:C^=S[L],C=i(C,k),C=o(C,15),C=i(C,q),I^=C}return I^=S.length,I=s(I),I>>>0},r.x86.hash128=function(S,M){if(r.inputValidation&&!n(S))return e;M=M||0;for(var A=S.length%16,B=S.length-A,I=M,C=M,k=M,q=M,L=0,U=0,F=0,N=0,G=597399067,x=2869860233,c=951274213,u=2716044179,y=0;y<B;y=y+16)L=S[y]|S[y+1]<<8|S[y+2]<<16|S[y+3]<<24,U=S[y+4]|S[y+5]<<8|S[y+6]<<16|S[y+7]<<24,F=S[y+8]|S[y+9]<<8|S[y+10]<<16|S[y+11]<<24,N=S[y+12]|S[y+13]<<8|S[y+14]<<16|S[y+15]<<24,L=i(L,G),L=o(L,15),L=i(L,x),I^=L,I=o(I,19),I+=C,I=i(I,5)+1444728091,U=i(U,x),U=o(U,16),U=i(U,c),C^=U,C=o(C,17),C+=k,C=i(C,5)+197830471,F=i(F,c),F=o(F,17),F=i(F,u),k^=F,k=o(k,15),k+=q,k=i(k,5)+2530024501,N=i(N,u),N=o(N,18),N=i(N,G),q^=N,q=o(q,13),q+=I,q=i(q,5)+850148119;switch(L=0,U=0,F=0,N=0,A){case 15:N^=S[y+14]<<16;case 14:N^=S[y+13]<<8;case 13:N^=S[y+12],N=i(N,u),N=o(N,18),N=i(N,G),q^=N;case 12:F^=S[y+11]<<24;case 11:F^=S[y+10]<<16;case 10:F^=S[y+9]<<8;case 9:F^=S[y+8],F=i(F,c),F=o(F,17),F=i(F,u),k^=F;case 8:U^=S[y+7]<<24;case 7:U^=S[y+6]<<16;case 6:U^=S[y+5]<<8;case 5:U^=S[y+4],U=i(U,x),U=o(U,16),U=i(U,c),C^=U;case 4:L^=S[y+3]<<24;case 3:L^=S[y+2]<<16;case 2:L^=S[y+1]<<8;case 1:L^=S[y],L=i(L,G),L=o(L,15),L=i(L,x),I^=L}return I^=S.length,C^=S.length,k^=S.length,q^=S.length,I+=C,I+=k,I+=q,C+=I,k+=I,q+=I,I=s(I),C=s(C),k=s(k),q=s(q),I+=C,I+=k,I+=q,C+=I,k+=I,q+=I,("00000000"+(I>>>0).toString(16)).slice(-8)+("00000000"+(C>>>0).toString(16)).slice(-8)+("00000000"+(k>>>0).toString(16)).slice(-8)+("00000000"+(q>>>0).toString(16)).slice(-8)},r.x64.hash128=function(S,M){if(r.inputValidation&&!n(S))return e;M=M||0;for(var A=S.length%16,B=S.length-A,I=[0,M],C=[0,M],k=[0,0],q=[0,0],L=[2277735313,289559509],U=[1291169091,658871167],F=0;F<B;F=F+16)k=[S[F+4]|S[F+5]<<8|S[F+6]<<16|S[F+7]<<24,S[F]|S[F+1]<<8|S[F+2]<<16|S[F+3]<<24],q=[S[F+12]|S[F+13]<<8|S[F+14]<<16|S[F+15]<<24,S[F+8]|S[F+9]<<8|S[F+10]<<16|S[F+11]<<24],k=d(k,L),k=m(k,31),k=d(k,U),I=w(I,k),I=m(I,27),I=a(I,C),I=a(d(I,[0,5]),[0,1390208809]),q=d(q,U),q=m(q,33),q=d(q,L),C=w(C,q),C=m(C,31),C=a(C,I),C=a(d(C,[0,5]),[0,944331445]);switch(k=[0,0],q=[0,0],A){case 15:q=w(q,p([0,S[F+14]],48));case 14:q=w(q,p([0,S[F+13]],40));case 13:q=w(q,p([0,S[F+12]],32));case 12:q=w(q,p([0,S[F+11]],24));case 11:q=w(q,p([0,S[F+10]],16));case 10:q=w(q,p([0,S[F+9]],8));case 9:q=w(q,[0,S[F+8]]),q=d(q,U),q=m(q,33),q=d(q,L),C=w(C,q);case 8:k=w(k,p([0,S[F+7]],56));case 7:k=w(k,p([0,S[F+6]],48));case 6:k=w(k,p([0,S[F+5]],40));case 5:k=w(k,p([0,S[F+4]],32));case 4:k=w(k,p([0,S[F+3]],24));case 3:k=w(k,p([0,S[F+2]],16));case 2:k=w(k,p([0,S[F+1]],8));case 1:k=w(k,[0,S[F]]),k=d(k,L),k=m(k,31),k=d(k,U),I=w(I,k)}return I=w(I,[0,S.length]),C=w(C,[0,S.length]),I=a(I,C),C=a(C,I),I=P(I),C=P(C),I=a(I,C),C=a(C,I),("00000000"+(I[0]>>>0).toString(16)).slice(-8)+("00000000"+(I[1]>>>0).toString(16)).slice(-8)+("00000000"+(C[0]>>>0).toString(16)).slice(-8)+("00000000"+(C[1]>>>0).toString(16)).slice(-8)},typeof u2<"u"?(typeof f6<"u"&&f6.exports&&(u2=f6.exports=r),u2.murmurHash3=r):typeof define=="function"&&define.amd?define([],function(){return r}):(r._murmurHash3=t.murmurHash3,r.noConflict=function(){return t.murmurHash3=r._murmurHash3,r._murmurHash3=e,r.noConflict=e,r},t.murmurHash3=r)})(u2)});var xW=H((elt,_W)=>{E();_W.exports=wW()});var MW=H((flt,SW)=>{"use strict";E();SW.exports=class{constructor(){this._bitArrays=[],this._data=[],this._length=0,this._changedLength=!1,this._changedData=!1}set(e,r){let n=this._internalPositionFor(e,!1);if(r===void 0)n!==-1&&(this._unsetInternalPos(n),this._unsetBit(e),this._changedLength=!0,this._changedData=!0);else{let i=!1;n===-1?(n=this._data.length,this._setBit(e),this._changedData=!0):i=!0,this._setInternalPos(n,e,r,i),this._changedLength=!0}}unset(e){this.set(e,void 0)}get(e){this._sortData();let r=this._internalPositionFor(e,!0);if(r!==-1)return this._data[r][1]}push(e){return this.set(this.length,e),this.length}get length(){if(this._sortData(),this._changedLength){let e=this._data[this._data.length-1];this._length=e?e[0]+1:0,this._changedLength=!1}return this._length}forEach(e){let r=0;for(;r<this.length;)e(this.get(r),r,this),r++}map(e){let r=0,n=new Array(this.length);for(;r<this.length;)n[r]=e(this.get(r),r,this),r++;return n}reduce(e,r){let n=0,i=r;for(;n<this.length;){let o=this.get(n);i=e(i,o,n),n++}return i}find(e){let r=0,n,i;for(;r<this.length&&!n;)i=this.get(r),n=e(i),r++;return n?i:void 0}_internalPositionFor(e,r){let n=this._bytePosFor(e,r);if(n>=this._bitArrays.length)return-1;let i=this._bitArrays[n],o=e-n*7;if(!((i&1<<o)>0))return-1;let a=this._bitArrays.slice(0,n).reduce(Bxe,0),d=~(4294967295<<o+1),m=EW(i&d);return a+m-1}_bytePosFor(e,r){let n=Math.floor(e/7),i=n+1;for(;!r&&this._bitArrays.length<i;)this._bitArrays.push(0);return n}_setBit(e){let r=this._bytePosFor(e,!1);this._bitArrays[r]|=1<<e-r*7}_unsetBit(e){let r=this._bytePosFor(e,!1);this._bitArrays[r]&=~(1<<e-r*7)}_setInternalPos(e,r,n,i){let o=this._data,s=[r,n];if(i)this._sortData(),o[e]=s;else{if(o.length)if(o[o.length-1][0]>=r)o.push(s);else if(o[0][0]<=r)o.unshift(s);else{let a=Math.round(o.length/2);this._data=o.slice(0,a).concat(s).concat(o.slice(a))}else this._data.push(s);this._changedData=!0,this._changedLength=!0}}_unsetInternalPos(e){this._data.splice(e,1)}_sortData(){this._changedData&&this._data.sort(Dxe),this._changedData=!1}bitField(){let e=[],r=8,n=0,i=0,o,s=this._bitArrays.slice();for(;s.length||n;){n===0&&(o=s.shift(),n=7);let d=Math.min(n,r),m=~(255<<d),p=o&m;i|=p<<8-r,o=o>>>d,n-=d,r-=d,(!r||!n&&!s.length)&&(e.push(i),i=0,r=8)}for(var a=e.length-1;a>0&&e[a]===0;a--)e.pop();return e}compactArray(){return this._sortData(),this._data.map(Cxe)}};function Bxe(t,e){return t+EW(e)}function EW(t){let e=t;return e=e-(e>>1&1431655765),e=(e&858993459)+(e>>2&858993459),(e+(e>>4)&252645135)*16843009>>24}function Dxe(t,e){return t[0]-e[0]}function Cxe(t){return t[1]}});var Fr=H((uI,$W)=>{E();var m6=sr(),wd=m6.Buffer;function qW(t,e){for(var r in t)e[r]=t[r]}wd.from&&wd.alloc&&wd.allocUnsafe&&wd.allocUnsafeSlow?$W.exports=m6:(qW(m6,uI),uI.Buffer=pv);function pv(t,e,r){return wd(t,e,r)}qW(wd,pv);pv.from=function(t,e,r){if(typeof t=="number")throw new TypeError("Argument must not be a number");return wd(t,e,r)};pv.alloc=function(t,e,r){if(typeof t!="number")throw new TypeError("Argument must be a number");var n=wd(t);return e!==void 0?typeof r=="string"?n.fill(e,r):n.fill(e):n.fill(0),n};pv.allocUnsafe=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return wd(t)};pv.allocUnsafeSlow=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return m6.SlowBuffer(t)}});var em=H((fdt,dI)=>{"use strict";E();var lI=65536,Hxe=4294967295;function Zxe(){throw new Error(`Secure random number generation is not supported by this browser.
Use Chrome, Firefox or Internet Explorer 11`)}var Jxe=Fr().Buffer,y6=globalThis.crypto||globalThis.msCrypto;y6&&y6.getRandomValues?dI.exports=Yxe:dI.exports=Zxe;function Yxe(t,e){if(t>Hxe)throw new RangeError("requested too many random bytes");var r=Jxe.allocUnsafe(t);if(t>0)if(t>lI)for(var n=0;n<t;n+=lI)y6.getRandomValues(r.slice(n,n+lI));else y6.getRandomValues(r);return typeof e=="function"?j.default.nextTick(function(){e(null,r)}):r}});var It=H((ldt,hI)=>{E();typeof Object.create=="function"?hI.exports=function(e,r){r&&(e.super_=r,e.prototype=Object.create(r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:hI.exports=function(e,r){if(r){e.super_=r;var n=function(){};n.prototype=r.prototype,e.prototype=new n,e.prototype.constructor=e}}});var FW=H((pI,UW)=>{E();var g6=sr(),qu=g6.Buffer;function LW(t,e){for(var r in t)e[r]=t[r]}qu.from&&qu.alloc&&qu.allocUnsafe&&qu.allocUnsafeSlow?UW.exports=g6:(LW(g6,pI),pI.Buffer=tm);function tm(t,e,r){return qu(t,e,r)}tm.prototype=Object.create(qu.prototype);LW(qu,tm);tm.from=function(t,e,r){if(typeof t=="number")throw new TypeError("Argument must not be a number");return qu(t,e,r)};tm.alloc=function(t,e,r){if(typeof t!="number")throw new TypeError("Argument must be a number");var n=qu(t);return e!==void 0?typeof r=="string"?n.fill(e,r):n.fill(e):n.fill(0),n};tm.allocUnsafe=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return qu(t)};tm.allocUnsafeSlow=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return g6.SlowBuffer(t)}});var Go=H((pdt,mI)=>{"use strict";E();var mv=typeof Reflect=="object"?Reflect:null,zW=mv&&typeof mv.apply=="function"?mv.apply:function(e,r,n){return Function.prototype.apply.call(e,r,n)},v6;mv&&typeof mv.ownKeys=="function"?v6=mv.ownKeys:Object.getOwnPropertySymbols?v6=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:v6=function(e){return Object.getOwnPropertyNames(e)};function Qxe(t){console&&console.warn&&console.warn(t)}var GW=Number.isNaN||function(e){return e!==e};function gn(){gn.init.call(this)}mI.exports=gn;mI.exports.once=r3e;gn.EventEmitter=gn;gn.prototype._events=void 0;gn.prototype._eventsCount=0;gn.prototype._maxListeners=void 0;var KW=10;function b6(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(gn,"defaultMaxListeners",{enumerable:!0,get:function(){return KW},set:function(t){if(typeof t!="number"||t<0||GW(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");KW=t}});gn.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};gn.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||GW(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 WW(t){return t._maxListeners===void 0?gn.defaultMaxListeners:t._maxListeners}gn.prototype.getMaxListeners=function(){return WW(this)};gn.prototype.emit=function(e){for(var r=[],n=1;n<arguments.length;n++)r.push(arguments[n]);var i=e==="error",o=this._events;if(o!==void 0)i=i&&o.error===void 0;else if(!i)return!1;if(i){var s;if(r.length>0&&(s=r[0]),s instanceof Error)throw s;var a=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw a.context=s,a}var d=o[e];if(d===void 0)return!1;if(typeof d=="function")zW(d,this,r);else for(var m=d.length,p=YW(d,m),n=0;n<m;++n)zW(p[n],this,r);return!0};function VW(t,e,r,n){var i,o,s;if(b6(r),o=t._events,o===void 0?(o=t._events=Object.create(null),t._eventsCount=0):(o.newListener!==void 0&&(t.emit("newListener",e,r.listener?r.listener:r),o=t._events),s=o[e]),s===void 0)s=o[e]=r,++t._eventsCount;else if(typeof s=="function"?s=o[e]=n?[r,s]:[s,r]:n?s.unshift(r):s.push(r),i=WW(t),i>0&&s.length>i&&!s.warned){s.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=t,a.type=e,a.count=s.length,Qxe(a)}return t}gn.prototype.addListener=function(e,r){return VW(this,e,r,!1)};gn.prototype.on=gn.prototype.addListener;gn.prototype.prependListener=function(e,r){return VW(this,e,r,!0)};function Xxe(){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 HW(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},i=Xxe.bind(n);return i.listener=r,n.wrapFn=i,i}gn.prototype.once=function(e,r){return b6(r),this.on(e,HW(this,e,r)),this};gn.prototype.prependOnceListener=function(e,r){return b6(r),this.prependListener(e,HW(this,e,r)),this};gn.prototype.removeListener=function(e,r){var n,i,o,s,a;if(b6(r),i=this._events,i===void 0)return this;if(n=i[e],n===void 0)return this;if(n===r||n.listener===r)--this._eventsCount===0?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,n.listener||r));else if(typeof n!="function"){for(o=-1,s=n.length-1;s>=0;s--)if(n[s]===r||n[s].listener===r){a=n[s].listener,o=s;break}if(o<0)return this;o===0?n.shift():e3e(n,o),n.length===1&&(i[e]=n[0]),i.removeListener!==void 0&&this.emit("removeListener",e,a||r)}return this};gn.prototype.off=gn.prototype.removeListener;gn.prototype.removeAllListeners=function(e){var r,n,i;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 o=Object.keys(n),s;for(i=0;i<o.length;++i)s=o[i],s!=="removeListener"&&this.removeAllListeners(s);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(i=r.length-1;i>=0;i--)this.removeListener(e,r[i]);return this};function ZW(t,e,r){var n=t._events;if(n===void 0)return[];var i=n[e];return i===void 0?[]:typeof i=="function"?r?[i.listener||i]:[i]:r?t3e(i):YW(i,i.length)}gn.prototype.listeners=function(e){return ZW(this,e,!0)};gn.prototype.rawListeners=function(e){return ZW(this,e,!1)};gn.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):JW.call(t,e)};gn.prototype.listenerCount=JW;function JW(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}gn.prototype.eventNames=function(){return this._eventsCount>0?v6(this._events):[]};function YW(t,e){for(var r=new Array(e),n=0;n<e;++n)r[n]=t[n];return r}function e3e(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}function t3e(t){for(var e=new Array(t.length),r=0;r<e.length;++r)e[r]=t[r].listener||t[r];return e}function r3e(t,e){return new Promise(function(r,n){function i(s){t.removeListener(e,o),n(s)}function o(){typeof t.removeListener=="function"&&t.removeListener("error",i),r([].slice.call(arguments))}QW(t,e,o,{once:!0}),e!=="error"&&n3e(t,i,{once:!0})})}function n3e(t,e,r){typeof t.on=="function"&&QW(t,"error",e,r)}function QW(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 i(o){n.once&&t.removeEventListener(e,i),r(o)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof t)}});var yI=H((ydt,XW)=>{E();XW.exports=Go().EventEmitter});var gI=H((vdt,eV)=>{"use strict";E();eV.exports=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var e={},r=Symbol("test"),n=Object(r);if(typeof r=="string"||Object.prototype.toString.call(r)!=="[object Symbol]"||Object.prototype.toString.call(n)!=="[object Symbol]")return!1;var i=42;e[r]=i;for(r in e)return!1;if(typeof Object.keys=="function"&&Object.keys(e).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(e).length!==0)return!1;var o=Object.getOwnPropertySymbols(e);if(o.length!==1||o[0]!==r||!Object.prototype.propertyIsEnumerable.call(e,r))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var s=Object.getOwnPropertyDescriptor(e,r);if(s.value!==i||s.enumerable!==!0)return!1}return!0}});var d2=H((wdt,tV)=>{"use strict";E();var i3e=gI();tV.exports=function(){return i3e()&&!!Symbol.toStringTag}});var iV=H((xdt,nV)=>{"use strict";E();var rV=typeof Symbol<"u"&&Symbol,o3e=gI();nV.exports=function(){return typeof rV!="function"||typeof Symbol!="function"||typeof rV("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:o3e()}});var aV=H((Sdt,sV)=>{"use strict";E();var oV={foo:{}},s3e=Object;sV.exports=function(){return{__proto__:oV}.foo===oV.foo&&!({__proto__:null}instanceof s3e)}});var fV=H((Pdt,cV)=>{"use strict";E();var a3e="Function.prototype.bind called on incompatible ",vI=Array.prototype.slice,c3e=Object.prototype.toString,f3e="[object Function]";cV.exports=function(e){var r=this;if(typeof r!="function"||c3e.call(r)!==f3e)throw new TypeError(a3e+r);for(var n=vI.call(arguments,1),i,o=function(){if(this instanceof i){var p=r.apply(this,n.concat(vI.call(arguments)));return Object(p)===p?p:this}else return r.apply(e,n.concat(vI.call(arguments)))},s=Math.max(0,r.length-n.length),a=[],d=0;d<s;d++)a.push("$"+d);if(i=Function("binder","return function ("+a.join(",")+"){ return binder.apply(this,arguments); }")(o),r.prototype){var m=function(){};m.prototype=r.prototype,i.prototype=new m,m.prototype=null}return i}});var w6=H((Tdt,uV)=>{"use strict";E();var u3e=fV();uV.exports=Function.prototype.bind||u3e});var dV=H((Idt,lV)=>{"use strict";E();var l3e=w6();lV.exports=l3e.call(Function.call,Object.prototype.hasOwnProperty)});var E6=H((Odt,gV)=>{"use strict";E();var Nr,bv=SyntaxError,yV=Function,vv=TypeError,bI=function(t){try{return yV('"use strict"; return ('+t+").constructor;")()}catch{}},rm=Object.getOwnPropertyDescriptor;if(rm)try{rm({},"")}catch{rm=null}var wI=function(){throw new vv},d3e=rm?function(){try{return arguments.callee,wI}catch{try{return rm(arguments,"callee").get}catch{return wI}}}():wI,yv=iV()(),h3e=aV()(),To=Object.getPrototypeOf||(h3e?function(t){return t.__proto__}:null),gv={},p3e=typeof Uint8Array>"u"||!To?Nr:To(Uint8Array),nm={"%AggregateError%":typeof AggregateError>"u"?Nr:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?Nr:ArrayBuffer,"%ArrayIteratorPrototype%":yv&&To?To([][Symbol.iterator]()):Nr,"%AsyncFromSyncIteratorPrototype%":Nr,"%AsyncFunction%":gv,"%AsyncGenerator%":gv,"%AsyncGeneratorFunction%":gv,"%AsyncIteratorPrototype%":gv,"%Atomics%":typeof Atomics>"u"?Nr:Atomics,"%BigInt%":typeof BigInt>"u"?Nr:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?Nr:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?Nr:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?Nr:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":typeof Float32Array>"u"?Nr:Float32Array,"%Float64Array%":typeof Float64Array>"u"?Nr:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?Nr:FinalizationRegistry,"%Function%":yV,"%GeneratorFunction%":gv,"%Int8Array%":typeof Int8Array>"u"?Nr:Int8Array,"%Int16Array%":typeof Int16Array>"u"?Nr:Int16Array,"%Int32Array%":typeof Int32Array>"u"?Nr:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":yv&&To?To(To([][Symbol.iterator]())):Nr,"%JSON%":typeof JSON=="object"?JSON:Nr,"%Map%":typeof Map>"u"?Nr:Map,"%MapIteratorPrototype%":typeof Map>"u"||!yv||!To?Nr:To(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?Nr:Promise,"%Proxy%":typeof Proxy>"u"?Nr:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":typeof Reflect>"u"?Nr:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?Nr:Set,"%SetIteratorPrototype%":typeof Set>"u"||!yv||!To?Nr:To(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?Nr:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":yv&&To?To(""[Symbol.iterator]()):Nr,"%Symbol%":yv?Symbol:Nr,"%SyntaxError%":bv,"%ThrowTypeError%":d3e,"%TypedArray%":p3e,"%TypeError%":vv,"%Uint8Array%":typeof Uint8Array>"u"?Nr:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?Nr:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?Nr:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?Nr:Uint32Array,"%URIError%":URIError,"%WeakMap%":typeof WeakMap>"u"?Nr:WeakMap,"%WeakRef%":typeof WeakRef>"u"?Nr:WeakRef,"%WeakSet%":typeof WeakSet>"u"?Nr:WeakSet};if(To)try{null.error}catch(t){hV=To(To(t)),nm["%Error.prototype%"]=hV}var hV,m3e=function t(e){var r;if(e==="%AsyncFunction%")r=bI("async function () {}");else if(e==="%GeneratorFunction%")r=bI("function* () {}");else if(e==="%AsyncGeneratorFunction%")r=bI("async function* () {}");else if(e==="%AsyncGenerator%"){var n=t("%AsyncGeneratorFunction%");n&&(r=n.prototype)}else if(e==="%AsyncIteratorPrototype%"){var i=t("%AsyncGenerator%");i&&To&&(r=To(i.prototype))}return nm[e]=r,r},pV={"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},h2=w6(),_6=dV(),y3e=h2.call(Function.call,Array.prototype.concat),g3e=h2.call(Function.apply,Array.prototype.splice),mV=h2.call(Function.call,String.prototype.replace),x6=h2.call(Function.call,String.prototype.slice),v3e=h2.call(Function.call,RegExp.prototype.exec),b3e=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,w3e=/\\(\\)?/g,_3e=function(e){var r=x6(e,0,1),n=x6(e,-1);if(r==="%"&&n!=="%")throw new bv("invalid intrinsic syntax, expected closing `%`");if(n==="%"&&r!=="%")throw new bv("invalid intrinsic syntax, expected opening `%`");var i=[];return mV(e,b3e,function(o,s,a,d){i[i.length]=a?mV(d,w3e,"$1"):s||o}),i},x3e=function(e,r){var n=e,i;if(_6(pV,n)&&(i=pV[n],n="%"+i[0]+"%"),_6(nm,n)){var o=nm[n];if(o===gv&&(o=m3e(n)),typeof o>"u"&&!r)throw new vv("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:i,name:n,value:o}}throw new bv("intrinsic "+e+" does not exist!")};gV.exports=function(e,r){if(typeof e!="string"||e.length===0)throw new vv("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof r!="boolean")throw new vv('"allowMissing" argument must be a boolean');if(v3e(/^%?[^%]*%?$/,e)===null)throw new bv("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var n=_3e(e),i=n.length>0?n[0]:"",o=x3e("%"+i+"%",r),s=o.name,a=o.value,d=!1,m=o.alias;m&&(i=m[0],g3e(n,y3e([0,1],m)));for(var p=1,w=!0;p<n.length;p+=1){var P=n[p],S=x6(P,0,1),M=x6(P,-1);if((S==='"'||S==="'"||S==="`"||M==='"'||M==="'"||M==="`")&&S!==M)throw new bv("property names with quotes must have matching quotes");if((P==="constructor"||!w)&&(d=!0),i+="."+P,s="%"+i+"%",_6(nm,s))a=nm[s];else if(a!=null){if(!(P in a)){if(!r)throw new vv("base intrinsic for "+e+" exists, but the property is not available.");return}if(rm&&p+1>=n.length){var A=rm(a,P);w=!!A,w&&"get"in A&&!("originalValue"in A.get)?a=A.get:a=a[P]}else w=_6(a,P),a=a[P];w&&!d&&(nm[s]=a)}}return a}});var M6=H((Ddt,S6)=>{"use strict";E();var _I=w6(),wv=E6(),wV=wv("%Function.prototype.apply%"),_V=wv("%Function.prototype.call%"),xV=wv("%Reflect.apply%",!0)||_I.call(_V,wV),vV=wv("%Object.getOwnPropertyDescriptor%",!0),im=wv("%Object.defineProperty%",!0),E3e=wv("%Math.max%");if(im)try{im({},"a",{value:1})}catch{im=null}S6.exports=function(e){var r=xV(_I,_V,arguments);if(vV&&im){var n=vV(r,"length");n.configurable&&im(r,"length",{value:1+E3e(0,e.length-(arguments.length-1))})}return r};var bV=function(){return xV(_I,wV,arguments)};im?im(S6.exports,"apply",{value:bV}):S6.exports.apply=bV});var P6=H((jdt,MV)=>{"use strict";E();var EV=E6(),SV=M6(),S3e=SV(EV("String.prototype.indexOf"));MV.exports=function(e,r){var n=EV(e,!!r);return typeof n=="function"&&S3e(e,".prototype.")>-1?SV(n):n}});var TV=H((qdt,AV)=>{"use strict";E();var M3e=d2()(),P3e=P6(),xI=P3e("Object.prototype.toString"),A6=function(e){return M3e&&e&&typeof e=="object"&&Symbol.toStringTag in e?!1:xI(e)==="[object Arguments]"},PV=function(e){return A6(e)?!0:e!==null&&typeof e=="object"&&typeof e.length=="number"&&e.length>=0&&xI(e)!=="[object Array]"&&xI(e.callee)==="[object Function]"},A3e=function(){return A6(arguments)}();A6.isLegacyArguments=PV;AV.exports=A3e?A6:PV});var kV=H((Ldt,IV)=>{"use strict";E();var T3e=Object.prototype.toString,R3e=Function.prototype.toString,I3e=/^\s*(?:function)?\*/,RV=d2()(),EI=Object.getPrototypeOf,k3e=function(){if(!RV)return!1;try{return Function("return function*() {}")()}catch{}},SI;IV.exports=function(e){if(typeof e!="function")return!1;if(I3e.test(R3e.call(e)))return!0;if(!RV){var r=T3e.call(e);return r==="[object GeneratorFunction]"}if(!EI)return!1;if(typeof SI>"u"){var n=k3e();SI=n?EI(n):!1}return EI(e)===SI}});var CV=H((Fdt,DV)=>{"use strict";E();var BV=Function.prototype.toString,_v=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,PI,T6;if(typeof _v=="function"&&typeof Object.defineProperty=="function")try{PI=Object.defineProperty({},"length",{get:function(){throw T6}}),T6={},_v(function(){throw 42},null,PI)}catch(t){t!==T6&&(_v=null)}else _v=null;var O3e=/^\s*class\b/,AI=function(e){try{var r=BV.call(e);return O3e.test(r)}catch{return!1}},MI=function(e){try{return AI(e)?!1:(BV.call(e),!0)}catch{return!1}},R6=Object.prototype.toString,B3e="[object Object]",D3e="[object Function]",C3e="[object GeneratorFunction]",j3e="[object HTMLAllCollection]",N3e="[object HTML document.all class]",q3e="[object HTMLCollection]",$3e=typeof Symbol=="function"&&!!Symbol.toStringTag,L3e=!(0 in[,]),TI=function(){return!1};typeof document=="object"&&(OV=document.all,R6.call(OV)===R6.call(document.all)&&(TI=function(e){if((L3e||!e)&&(typeof e>"u"||typeof e=="object"))try{var r=R6.call(e);return(r===j3e||r===N3e||r===q3e||r===B3e)&&e("")==null}catch{}return!1}));var OV;DV.exports=_v?function(e){if(TI(e))return!0;if(!e||typeof e!="function"&&typeof e!="object")return!1;try{_v(e,null,PI)}catch(r){if(r!==T6)return!1}return!AI(e)&&MI(e)}:function(e){if(TI(e))return!0;if(!e||typeof e!="function"&&typeof e!="object")return!1;if($3e)return MI(e);if(AI(e))return!1;var r=R6.call(e);return r!==D3e&&r!==C3e&&!/^\[object HTML/.test(r)?!1:MI(e)}});var RI=H((Kdt,NV)=>{"use strict";E();var U3e=CV(),F3e=Object.prototype.toString,jV=Object.prototype.hasOwnProperty,z3e=function(e,r,n){for(var i=0,o=e.length;i<o;i++)jV.call(e,i)&&(n==null?r(e[i],i,e):r.call(n,e[i],i,e))},K3e=function(e,r,n){for(var i=0,o=e.length;i<o;i++)n==null?r(e.charAt(i),i,e):r.call(n,e.charAt(i),i,e)},G3e=function(e,r,n){for(var i in e)jV.call(e,i)&&(n==null?r(e[i],i,e):r.call(n,e[i],i,e))},W3e=function(e,r,n){if(!U3e(r))throw new TypeError("iterator must be a function");var i;arguments.length>=3&&(i=n),F3e.call(e)==="[object Array]"?z3e(e,r,i):typeof e=="string"?K3e(e,r,i):G3e(e,r,i)};NV.exports=W3e});var kI=H((Wdt,qV)=>{"use strict";E();var II=["BigInt64Array","BigUint64Array","Float32Array","Float64Array","Int16Array","Int32Array","Int8Array","Uint16Array","Uint32Array","Uint8Array","Uint8ClampedArray"],V3e=globalThis;qV.exports=function(){for(var e=[],r=0;r<II.length;r++)typeof V3e[II[r]]=="function"&&(e[e.length]=II[r]);return e}});var OI=H((Hdt,$V)=>{"use strict";E();var H3e=E6(),I6=H3e("%Object.getOwnPropertyDescriptor%",!0);if(I6)try{I6([],"length")}catch{I6=null}$V.exports=I6});var jI=H((Jdt,zV)=>{"use strict";E();var O6=RI(),Z3e=kI(),LV=M6(),CI=P6(),J3e=CI("Object.prototype.toString"),FV=d2()(),k6=OI(),UV=globalThis,DI=Z3e(),Y3e=CI("Array.prototype.indexOf",!0)||function(e,r){for(var n=0;n<e.length;n+=1)if(e[n]===r)return n;return-1},Q3e=CI("String.prototype.slice"),B6={__proto__:null},BI=Object.getPrototypeOf;FV&&k6&&BI?O6(DI,function(t){var e=new UV[t];if(Symbol.toStringTag in e){var r=BI(e),n=k6(r,Symbol.toStringTag);if(!n){var i=BI(r);n=k6(i,Symbol.toStringTag)}B6["$"+t]=LV(n.get)}}):O6(DI,function(t){var e=new UV[t];B6["$"+t]=LV(e.slice)});var X3e=function(e){var r=!1;return O6(B6,function(n,i){if(!r)try{r="$"+n(e)===i}catch{}}),r},eEe=function(e){var r=!1;return O6(B6,function(n){if(!r)try{n(e),r=!0}catch{}}),r};zV.exports=function(e){if(!e||typeof e!="object")return!1;if(!FV){var r=Q3e(J3e(e),8,-1);return Y3e(DI,r)>-1?!0:r!=="Object"?!1:eEe(e)}return k6?X3e(e):null}});var JV=H((Qdt,ZV)=>{"use strict";E();var GV=RI(),tEe=kI(),rEe=M6(),WV=P6(),NI=OI(),nEe=WV("Object.prototype.toString"),VV=d2()(),KV=globalThis,iEe=tEe(),oEe=WV("String.prototype.slice"),HV={__proto__:null},qI=Object.getPrototypeOf;VV&&NI&&qI&&GV(iEe,function(t){if(typeof KV[t]=="function"){var e=new KV[t];if(Symbol.toStringTag in e){var r=qI(e),n=NI(r,Symbol.toStringTag);if(!n){var i=qI(r);n=NI(i,Symbol.toStringTag)}HV[t]=rEe(n.get)}}});var sEe=function(e){var r=!1;return GV(HV,function(n,i){if(!r)try{var o=n(e);o===i&&(r=o)}catch{}}),r},aEe=jI();ZV.exports=function(e){return aEe(e)?!VV||!(Symbol.toStringTag in e)?oEe(nEe(e),8,-1):sEe(e):!1}});var uH=H(kr=>{"use strict";E();var cEe=TV(),fEe=kV(),If=JV(),YV=jI();function xv(t){return t.call.bind(t)}var QV=typeof BigInt<"u",XV=typeof Symbol<"u",Tc=xv(Object.prototype.toString),uEe=xv(Number.prototype.valueOf),lEe=xv(String.prototype.valueOf),dEe=xv(Boolean.prototype.valueOf);QV&&(eH=xv(BigInt.prototype.valueOf));var eH;XV&&(tH=xv(Symbol.prototype.valueOf));var tH;function m2(t,e){if(typeof t!="object")return!1;try{return e(t),!0}catch{return!1}}kr.isArgumentsObject=cEe;kr.isGeneratorFunction=fEe;kr.isTypedArray=YV;function hEe(t){return typeof Promise<"u"&&t instanceof Promise||t!==null&&typeof t=="object"&&typeof t.then=="function"&&typeof t.catch=="function"}kr.isPromise=hEe;function pEe(t){return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?ArrayBuffer.isView(t):YV(t)||nH(t)}kr.isArrayBufferView=pEe;function mEe(t){return If(t)==="Uint8Array"}kr.isUint8Array=mEe;function yEe(t){return If(t)==="Uint8ClampedArray"}kr.isUint8ClampedArray=yEe;function gEe(t){return If(t)==="Uint16Array"}kr.isUint16Array=gEe;function vEe(t){return If(t)==="Uint32Array"}kr.isUint32Array=vEe;function bEe(t){return If(t)==="Int8Array"}kr.isInt8Array=bEe;function wEe(t){return If(t)==="Int16Array"}kr.isInt16Array=wEe;function _Ee(t){return If(t)==="Int32Array"}kr.isInt32Array=_Ee;function xEe(t){return If(t)==="Float32Array"}kr.isFloat32Array=xEe;function EEe(t){return If(t)==="Float64Array"}kr.isFloat64Array=EEe;function SEe(t){return If(t)==="BigInt64Array"}kr.isBigInt64Array=SEe;function MEe(t){return If(t)==="BigUint64Array"}kr.isBigUint64Array=MEe;function D6(t){return Tc(t)==="[object Map]"}D6.working=typeof Map<"u"&&D6(new Map);function PEe(t){return typeof Map>"u"?!1:D6.working?D6(t):t instanceof Map}kr.isMap=PEe;function C6(t){return Tc(t)==="[object Set]"}C6.working=typeof Set<"u"&&C6(new Set);function AEe(t){return typeof Set>"u"?!1:C6.working?C6(t):t instanceof Set}kr.isSet=AEe;function j6(t){return Tc(t)==="[object WeakMap]"}j6.working=typeof WeakMap<"u"&&j6(new WeakMap);function TEe(t){return typeof WeakMap>"u"?!1:j6.working?j6(t):t instanceof WeakMap}kr.isWeakMap=TEe;function LI(t){return Tc(t)==="[object WeakSet]"}LI.working=typeof WeakSet<"u"&&LI(new WeakSet);function REe(t){return LI(t)}kr.isWeakSet=REe;function N6(t){return Tc(t)==="[object ArrayBuffer]"}N6.working=typeof ArrayBuffer<"u"&&N6(new ArrayBuffer);function rH(t){return typeof ArrayBuffer>"u"?!1:N6.working?N6(t):t instanceof ArrayBuffer}kr.isArrayBuffer=rH;function q6(t){return Tc(t)==="[object DataView]"}q6.working=typeof ArrayBuffer<"u"&&typeof DataView<"u"&&q6(new DataView(new ArrayBuffer(1),0,1));function nH(t){return typeof DataView>"u"?!1:q6.working?q6(t):t instanceof DataView}kr.isDataView=nH;var $I=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:void 0;function p2(t){return Tc(t)==="[object SharedArrayBuffer]"}function iH(t){return typeof $I>"u"?!1:(typeof p2.working>"u"&&(p2.working=p2(new $I)),p2.working?p2(t):t instanceof $I)}kr.isSharedArrayBuffer=iH;function IEe(t){return Tc(t)==="[object AsyncFunction]"}kr.isAsyncFunction=IEe;function kEe(t){return Tc(t)==="[object Map Iterator]"}kr.isMapIterator=kEe;function OEe(t){return Tc(t)==="[object Set Iterator]"}kr.isSetIterator=OEe;function BEe(t){return Tc(t)==="[object Generator]"}kr.isGeneratorObject=BEe;function DEe(t){return Tc(t)==="[object WebAssembly.Module]"}kr.isWebAssemblyCompiledModule=DEe;function oH(t){return m2(t,uEe)}kr.isNumberObject=oH;function sH(t){return m2(t,lEe)}kr.isStringObject=sH;function aH(t){return m2(t,dEe)}kr.isBooleanObject=aH;function cH(t){return QV&&m2(t,eH)}kr.isBigIntObject=cH;function fH(t){return XV&&m2(t,tH)}kr.isSymbolObject=fH;function CEe(t){return oH(t)||sH(t)||aH(t)||cH(t)||fH(t)}kr.isBoxedPrimitive=CEe;function jEe(t){return typeof Uint8Array<"u"&&(rH(t)||iH(t))}kr.isAnyArrayBuffer=jEe;["isProxy","isExternal","isModuleNamespaceObject"].forEach(function(t){Object.defineProperty(kr,t,{enumerable:!1,value:function(){throw new Error(t+" is not supported in userland")}})})});var dH=H((rht,lH)=>{E();lH.exports=function(e){return e&&typeof e=="object"&&typeof e.copy=="function"&&typeof e.fill=="function"&&typeof e.readUInt8=="function"}});var am=H(Or=>{E();var hH=Object.getOwnPropertyDescriptors||function(e){for(var r=Object.keys(e),n={},i=0;i<r.length;i++)n[r[i]]=Object.getOwnPropertyDescriptor(e,r[i]);return n},NEe=/%[sdj%]/g;Or.format=function(t){if(!G6(t)){for(var e=[],r=0;r<arguments.length;r++)e.push(Jh(arguments[r]));return e.join(" ")}for(var r=1,n=arguments,i=n.length,o=String(t).replace(NEe,function(a){if(a==="%%")return"%";if(r>=i)return a;switch(a){case"%s":return String(n[r++]);case"%d":return Number(n[r++]);case"%j":try{return JSON.stringify(n[r++])}catch{return"[Circular]"}default:return a}}),s=n[r];r<i;s=n[++r])K6(s)||!Ev(s)?o+=" "+s:o+=" "+Jh(s);return o};Or.deprecate=function(t,e){if(typeof j.default<"u"&&j.default.noDeprecation===!0)return t;if(typeof j.default>"u")return function(){return Or.deprecate(t,e).apply(this,arguments)};var r=!1;function n(){if(!r){if(j.default.throwDeprecation)throw new Error(e);j.default.traceDeprecation?console.trace(e):console.error(e),r=!0}return t.apply(this,arguments)}return n};var $6={},pH=/^$/;j.default.env.NODE_DEBUG&&(L6=j.default.env.NODE_DEBUG,L6=L6.replace(/[|\\{}()[\]^$+?.]/g,"\\$&").replace(/\*/g,".*").replace(/,/g,"$|^").toUpperCase(),pH=new RegExp("^"+L6+"$","i"));var L6;Or.debuglog=function(t){if(t=t.toUpperCase(),!$6[t])if(pH.test(t)){var e=j.default.pid;$6[t]=function(){var r=Or.format.apply(Or,arguments);console.error("%s %d: %s",t,e,r)}}else $6[t]=function(){};return $6[t]};function Jh(t,e){var r={seen:[],stylize:$Ee};return arguments.length>=3&&(r.depth=arguments[2]),arguments.length>=4&&(r.colors=arguments[3]),KI(e)?r.showHidden=e:e&&Or._extend(r,e),sm(r.showHidden)&&(r.showHidden=!1),sm(r.depth)&&(r.depth=2),sm(r.colors)&&(r.colors=!1),sm(r.customInspect)&&(r.customInspect=!0),r.colors&&(r.stylize=qEe),F6(r,t,r.depth)}Or.inspect=Jh;Jh.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]};Jh.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};function qEe(t,e){var r=Jh.styles[e];return r?"\x1B["+Jh.colors[r][0]+"m"+t+"\x1B["+Jh.colors[r][1]+"m":t}function $Ee(t,e){return t}function LEe(t){var e={};return t.forEach(function(r,n){e[r]=!0}),e}function F6(t,e,r){if(t.customInspect&&e&&U6(e.inspect)&&e.inspect!==Or.inspect&&!(e.constructor&&e.constructor.prototype===e)){var n=e.inspect(r,t);return G6(n)||(n=F6(t,n,r)),n}var i=UEe(t,e);if(i)return i;var o=Object.keys(e),s=LEe(o);if(t.showHidden&&(o=Object.getOwnPropertyNames(e)),g2(e)&&(o.indexOf("message")>=0||o.indexOf("description")>=0))return UI(e);if(o.length===0){if(U6(e)){var a=e.name?": "+e.name:"";return t.stylize("[Function"+a+"]","special")}if(y2(e))return t.stylize(RegExp.prototype.toString.call(e),"regexp");if(z6(e))return t.stylize(Date.prototype.toString.call(e),"date");if(g2(e))return UI(e)}var d="",m=!1,p=["{","}"];if(mH(e)&&(m=!0,p=["[","]"]),U6(e)){var w=e.name?": "+e.name:"";d=" [Function"+w+"]"}if(y2(e)&&(d=" "+RegExp.prototype.toString.call(e)),z6(e)&&(d=" "+Date.prototype.toUTCString.call(e)),g2(e)&&(d=" "+UI(e)),o.length===0&&(!m||e.length==0))return p[0]+d+p[1];if(r<0)return y2(e)?t.stylize(RegExp.prototype.toString.call(e),"regexp"):t.stylize("[Object]","special");t.seen.push(e);var P;return m?P=FEe(t,e,r,s,o):P=o.map(function(S){return zI(t,e,r,s,S,m)}),t.seen.pop(),zEe(P,d,p)}function UEe(t,e){if(sm(e))return t.stylize("undefined","undefined");if(G6(e)){var r="'"+JSON.stringify(e).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return t.stylize(r,"string")}if(yH(e))return t.stylize(""+e,"number");if(KI(e))return t.stylize(""+e,"boolean");if(K6(e))return t.stylize("null","null")}function UI(t){return"["+Error.prototype.toString.call(t)+"]"}function FEe(t,e,r,n,i){for(var o=[],s=0,a=e.length;s<a;++s)gH(e,String(s))?o.push(zI(t,e,r,n,String(s),!0)):o.push("");return i.forEach(function(d){d.match(/^\d+$/)||o.push(zI(t,e,r,n,d,!0))}),o}function zI(t,e,r,n,i,o){var s,a,d;if(d=Object.getOwnPropertyDescriptor(e,i)||{value:e[i]},d.get?d.set?a=t.stylize("[Getter/Setter]","special"):a=t.stylize("[Getter]","special"):d.set&&(a=t.stylize("[Setter]","special")),gH(n,i)||(s="["+i+"]"),a||(t.seen.indexOf(d.value)<0?(K6(r)?a=F6(t,d.value,null):a=F6(t,d.value,r-1),a.indexOf(`
`)>-1&&(o?a=a.split(`
`).map(function(m){return" "+m}).join(`
`).substr(2):a=`
`+a.split(`
`).map(function(m){return" "+m}).join(`
`))):a=t.stylize("[Circular]","special")),sm(s)){if(o&&i.match(/^\d+$/))return a;s=JSON.stringify(""+i),s.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(s=s.substr(1,s.length-2),s=t.stylize(s,"name")):(s=s.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),s=t.stylize(s,"string"))}return s+": "+a}function zEe(t,e,r){var n=0,i=t.reduce(function(o,s){return n++,s.indexOf(`
`)>=0&&n++,o+s.replace(/\u001b\[\d\d?m/g,"").length+1},0);return i>60?r[0]+(e===""?"":e+`
`)+" "+t.join(`,
`)+" "+r[1]:r[0]+e+" "+t.join(", ")+" "+r[1]}Or.types=uH();function mH(t){return Array.isArray(t)}Or.isArray=mH;function KI(t){return typeof t=="boolean"}Or.isBoolean=KI;function K6(t){return t===null}Or.isNull=K6;function KEe(t){return t==null}Or.isNullOrUndefined=KEe;function yH(t){return typeof t=="number"}Or.isNumber=yH;function G6(t){return typeof t=="string"}Or.isString=G6;function GEe(t){return typeof t=="symbol"}Or.isSymbol=GEe;function sm(t){return t===void 0}Or.isUndefined=sm;function y2(t){return Ev(t)&&GI(t)==="[object RegExp]"}Or.isRegExp=y2;Or.types.isRegExp=y2;function Ev(t){return typeof t=="object"&&t!==null}Or.isObject=Ev;function z6(t){return Ev(t)&&GI(t)==="[object Date]"}Or.isDate=z6;Or.types.isDate=z6;function g2(t){return Ev(t)&&(GI(t)==="[object Error]"||t instanceof Error)}Or.isError=g2;Or.types.isNativeError=g2;function U6(t){return typeof t=="function"}Or.isFunction=U6;function WEe(t){return t===null||typeof t=="boolean"||typeof t=="number"||typeof t=="string"||typeof t=="symbol"||typeof t>"u"}Or.isPrimitive=WEe;Or.isBuffer=dH();function GI(t){return Object.prototype.toString.call(t)}function FI(t){return t<10?"0"+t.toString(10):t.toString(10)}var VEe=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function HEe(){var t=new Date,e=[FI(t.getHours()),FI(t.getMinutes()),FI(t.getSeconds())].join(":");return[t.getDate(),VEe[t.getMonth()],e].join(" ")}Or.log=function(){console.log("%s - %s",HEe(),Or.format.apply(Or,arguments))};Or.inherits=It();Or._extend=function(t,e){if(!e||!Ev(e))return t;for(var r=Object.keys(e),n=r.length;n--;)t[r[n]]=e[r[n]];return t};function gH(t,e){return Object.prototype.hasOwnProperty.call(t,e)}var om=typeof Symbol<"u"?Symbol("util.promisify.custom"):void 0;Or.promisify=function(e){if(typeof e!="function")throw new TypeError('The "original" argument must be of type Function');if(om&&e[om]){var r=e[om];if(typeof r!="function")throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(r,om,{value:r,enumerable:!1,writable:!1,configurable:!0}),r}function r(){for(var n,i,o=new Promise(function(d,m){n=d,i=m}),s=[],a=0;a<arguments.length;a++)s.push(arguments[a]);s.push(function(d,m){d?i(d):n(m)});try{e.apply(this,s)}catch(d){i(d)}return o}return Object.setPrototypeOf(r,Object.getPrototypeOf(e)),om&&Object.defineProperty(r,om,{value:r,enumerable:!1,writable:!1,configurable:!0}),Object.defineProperties(r,hH(e))};Or.promisify.custom=om;function ZEe(t,e){if(!t){var r=new Error("Promise was rejected with a falsy value");r.reason=t,t=r}return e(t)}function JEe(t){if(typeof t!="function")throw new TypeError('The "original" argument must be of type Function');function e(){for(var r=[],n=0;n<arguments.length;n++)r.push(arguments[n]);var i=r.pop();if(typeof i!="function")throw new TypeError("The last argument must be of type Function");var o=this,s=function(){return i.apply(o,arguments)};t.apply(this,r).then(function(a){j.default.nextTick(s.bind(null,null,a))},function(a){j.default.nextTick(ZEe.bind(null,a,s))})}return Object.setPrototypeOf(e,Object.getPrototypeOf(t)),Object.defineProperties(e,hH(t)),e}Or.callbackify=JEe});var EH=H((sht,xH)=>{"use strict";E();function vH(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function bH(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?vH(Object(r),!0).forEach(function(n){YEe(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):vH(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function YEe(t,e,r){return e=_H(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function QEe(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function wH(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,_H(n.key),n)}}function XEe(t,e,r){return e&&wH(t.prototype,e),r&&wH(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function _H(t){var e=e6e(t,"string");return typeof e=="symbol"?e:String(e)}function e6e(t,e){if(typeof t!="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var t6e=sr(),W6=t6e.Buffer,r6e=am(),WI=r6e.inspect,n6e=WI&&WI.custom||"inspect";function i6e(t,e,r){W6.prototype.copy.call(t,e,r)}xH.exports=function(){function t(){QEe(this,t),this.head=null,this.tail=null,this.length=0}return XEe(t,[{key:"push",value:function(r){var n={data:r,next:null};this.length>0?this.tail.next=n:this.head=n,this.tail=n,++this.length}},{key:"unshift",value:function(r){var n={data:r,next:this.head};this.length===0&&(this.tail=n),this.head=n,++this.length}},{key:"shift",value:function(){if(this.length!==0){var r=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,r}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(r){if(this.length===0)return"";for(var n=this.head,i=""+n.data;n=n.next;)i+=r+n.data;return i}},{key:"concat",value:function(r){if(this.length===0)return W6.alloc(0);for(var n=W6.allocUnsafe(r>>>0),i=this.head,o=0;i;)i6e(i.data,n,o),o+=i.data.length,i=i.next;return n}},{key:"consume",value:function(r,n){var i;return r<this.head.data.length?(i=this.head.data.slice(0,r),this.head.data=this.head.data.slice(r)):r===this.head.data.length?i=this.shift():i=n?this._getString(r):this._getBuffer(r),i}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(r){var n=this.head,i=1,o=n.data;for(r-=o.length;n=n.next;){var s=n.data,a=r>s.length?s.length:r;if(a===s.length?o+=s:o+=s.slice(0,r),r-=a,r===0){a===s.length?(++i,n.next?this.head=n.next:this.head=this.tail=null):(this.head=n,n.data=s.slice(a));break}++i}return this.length-=i,o}},{key:"_getBuffer",value:function(r){var n=W6.allocUnsafe(r),i=this.head,o=1;for(i.data.copy(n),r-=i.data.length;i=i.next;){var s=i.data,a=r>s.length?s.length:r;if(s.copy(n,n.length-r,0,a),r-=a,r===0){a===s.length?(++o,i.next?this.head=i.next:this.head=this.tail=null):(this.head=i,i.data=s.slice(a));break}++o}return this.length-=o,n}},{key:n6e,value:function(r,n){return WI(this,bH(bH({},n),{},{depth:0,customInspect:!1}))}}]),t}()});var HI=H((cht,MH)=>{"use strict";E();function o6e(t,e){var r=this,n=this._readableState&&this._readableState.destroyed,i=this._writableState&&this._writableState.destroyed;return n||i?(e?e(t):t&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,j.default.nextTick(VI,this,t)):j.default.nextTick(VI,this,t)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(t||null,function(o){!e&&o?r._writableState?r._writableState.errorEmitted?j.default.nextTick(V6,r):(r._writableState.errorEmitted=!0,j.default.nextTick(SH,r,o)):j.default.nextTick(SH,r,o):e?(j.default.nextTick(V6,r),e(o)):j.default.nextTick(V6,r)}),this)}function SH(t,e){VI(t,e),V6(t)}function V6(t){t._writableState&&!t._writableState.emitClose||t._readableState&&!t._readableState.emitClose||t.emit("close")}function s6e(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}function VI(t,e){t.emit("error",e)}function a6e(t,e){var r=t._readableState,n=t._writableState;r&&r.autoDestroy||n&&n.autoDestroy?t.destroy(e):t.emit("error",e)}MH.exports={destroy:o6e,undestroy:s6e,errorOrDestroy:a6e}});var cm=H((uht,TH)=>{"use strict";E();function c6e(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}var AH={};function Rc(t,e,r){r||(r=Error);function n(o,s,a){return typeof e=="string"?e:e(o,s,a)}var i=function(o){c6e(s,o);function s(a,d,m){return o.call(this,n(a,d,m))||this}return s}(r);i.prototype.name=r.name,i.prototype.code=t,AH[t]=i}function PH(t,e){if(Array.isArray(t)){var r=t.length;return t=t.map(function(n){return String(n)}),r>2?"one of ".concat(e," ").concat(t.slice(0,r-1).join(", "),", or ")+t[r-1]:r===2?"one of ".concat(e," ").concat(t[0]," or ").concat(t[1]):"of ".concat(e," ").concat(t[0])}else return"of ".concat(e," ").concat(String(t))}function f6e(t,e,r){return t.substr(!r||r<0?0:+r,e.length)===e}function u6e(t,e,r){return(r===void 0||r>t.length)&&(r=t.length),t.substring(r-e.length,r)===e}function l6e(t,e,r){return typeof r!="number"&&(r=0),r+e.length>t.length?!1:t.indexOf(e,r)!==-1}Rc("ERR_INVALID_OPT_VALUE",function(t,e){return'The value "'+e+'" is invalid for option "'+t+'"'},TypeError);Rc("ERR_INVALID_ARG_TYPE",function(t,e,r){var n;typeof e=="string"&&f6e(e,"not ")?(n="must not be",e=e.replace(/^not /,"")):n="must be";var i;if(u6e(t," argument"))i="The ".concat(t," ").concat(n," ").concat(PH(e,"type"));else{var o=l6e(t,".")?"property":"argument";i='The "'.concat(t,'" ').concat(o," ").concat(n," ").concat(PH(e,"type"))}return i+=". Received type ".concat(typeof r),i},TypeError);Rc("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF");Rc("ERR_METHOD_NOT_IMPLEMENTED",function(t){return"The "+t+" method is not implemented"});Rc("ERR_STREAM_PREMATURE_CLOSE","Premature close");Rc("ERR_STREAM_DESTROYED",function(t){return"Cannot call "+t+" after a stream was destroyed"});Rc("ERR_MULTIPLE_CALLBACK","Callback called multiple times");Rc("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable");Rc("ERR_STREAM_WRITE_AFTER_END","write after end");Rc("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError);Rc("ERR_UNKNOWN_ENCODING",function(t){return"Unknown encoding: "+t},TypeError);Rc("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event");TH.exports.codes=AH});var ZI=H((dht,RH)=>{"use strict";E();var d6e=cm().codes.ERR_INVALID_OPT_VALUE;function h6e(t,e,r){return t.highWaterMark!=null?t.highWaterMark:e?t[r]:null}function p6e(t,e,r,n){var i=h6e(e,n,r);if(i!=null){if(!(isFinite(i)&&Math.floor(i)===i)||i<0){var o=n?r:"highWaterMark";throw new d6e(o,i)}return Math.floor(i)}return t.objectMode?16:16*1024}RH.exports={getHighWaterMark:p6e}});var H6=H((pht,IH)=>{E();IH.exports=m6e;function m6e(t,e){if(JI("noDeprecation"))return t;var r=!1;function n(){if(!r){if(JI("throwDeprecation"))throw new Error(e);JI("traceDeprecation")?console.trace(e):console.warn(e),r=!0}return t.apply(this,arguments)}return n}function JI(t){try{if(!globalThis.localStorage)return!1}catch{return!1}var e=globalThis.localStorage[t];return e==null?!1:String(e).toLowerCase()==="true"}});var XI=H((yht,jH)=>{"use strict";E();jH.exports=Mi;function OH(t){var e=this;this.next=null,this.entry=null,this.finish=function(){F6e(e,t)}}var Sv;Mi.WritableState=b2;var y6e={deprecate:H6()},BH=yI(),J6=sr().Buffer,g6e=(typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function v6e(t){return J6.from(t)}function b6e(t){return J6.isBuffer(t)||t instanceof g6e}var QI=HI(),w6e=ZI(),_6e=w6e.getHighWaterMark,Yh=cm().codes,x6e=Yh.ERR_INVALID_ARG_TYPE,E6e=Yh.ERR_METHOD_NOT_IMPLEMENTED,S6e=Yh.ERR_MULTIPLE_CALLBACK,M6e=Yh.ERR_STREAM_CANNOT_PIPE,P6e=Yh.ERR_STREAM_DESTROYED,A6e=Yh.ERR_STREAM_NULL_VALUES,T6e=Yh.ERR_STREAM_WRITE_AFTER_END,R6e=Yh.ERR_UNKNOWN_ENCODING,Mv=QI.errorOrDestroy;It()(Mi,BH);function I6e(){}function b2(t,e,r){Sv=Sv||fm(),t=t||{},typeof r!="boolean"&&(r=e instanceof Sv),this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.writableObjectMode),this.highWaterMark=_6e(this,t,"writableHighWaterMark",r),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var n=t.decodeStrings===!1;this.decodeStrings=!n,this.defaultEncoding=t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(i){N6e(e,i)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=t.emitClose!==!1,this.autoDestroy=!!t.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new OH(this)}b2.prototype.getBuffer=function(){for(var e=this.bufferedRequest,r=[];e;)r.push(e),e=e.next;return r};(function(){try{Object.defineProperty(b2.prototype,"buffer",{get:y6e.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}})();var Z6;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(Z6=Function.prototype[Symbol.hasInstance],Object.defineProperty(Mi,Symbol.hasInstance,{value:function(e){return Z6.call(this,e)?!0:this!==Mi?!1:e&&e._writableState instanceof b2}})):Z6=function(e){return e instanceof this};function Mi(t){Sv=Sv||fm();var e=this instanceof Sv;if(!e&&!Z6.call(Mi,this))return new Mi(t);this._writableState=new b2(t,this,e),this.writable=!0,t&&(typeof t.write=="function"&&(this._write=t.write),typeof t.writev=="function"&&(this._writev=t.writev),typeof t.destroy=="function"&&(this._destroy=t.destroy),typeof t.final=="function"&&(this._final=t.final)),BH.call(this)}Mi.prototype.pipe=function(){Mv(this,new M6e)};function k6e(t,e){var r=new T6e;Mv(t,r),j.default.nextTick(e,r)}function O6e(t,e,r,n){var i;return r===null?i=new A6e:typeof r!="string"&&!e.objectMode&&(i=new x6e("chunk",["string","Buffer"],r)),i?(Mv(t,i),j.default.nextTick(n,i),!1):!0}Mi.prototype.write=function(t,e,r){var n=this._writableState,i=!1,o=!n.objectMode&&b6e(t);return o&&!J6.isBuffer(t)&&(t=v6e(t)),typeof e=="function"&&(r=e,e=null),o?e="buffer":e||(e=n.defaultEncoding),typeof r!="function"&&(r=I6e),n.ending?k6e(this,r):(o||O6e(this,n,t,r))&&(n.pendingcb++,i=D6e(this,n,o,t,e,r)),i};Mi.prototype.cork=function(){this._writableState.corked++};Mi.prototype.uncork=function(){var t=this._writableState;t.corked&&(t.corked--,!t.writing&&!t.corked&&!t.bufferProcessing&&t.bufferedRequest&&DH(this,t))};Mi.prototype.setDefaultEncoding=function(e){if(typeof e=="string"&&(e=e.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase())>-1))throw new R6e(e);return this._writableState.defaultEncoding=e,this};Object.defineProperty(Mi.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});function B6e(t,e,r){return!t.objectMode&&t.decodeStrings!==!1&&typeof e=="string"&&(e=J6.from(e,r)),e}Object.defineProperty(Mi.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function D6e(t,e,r,n,i,o){if(!r){var s=B6e(e,n,i);n!==s&&(r=!0,i="buffer",n=s)}var a=e.objectMode?1:n.length;e.length+=a;var d=e.length<e.highWaterMark;if(d||(e.needDrain=!0),e.writing||e.corked){var m=e.lastBufferedRequest;e.lastBufferedRequest={chunk:n,encoding:i,isBuf:r,callback:o,next:null},m?m.next=e.lastBufferedRequest:e.bufferedRequest=e.lastBufferedRequest,e.bufferedRequestCount+=1}else YI(t,e,!1,a,n,i,o);return d}function YI(t,e,r,n,i,o,s){e.writelen=n,e.writecb=s,e.writing=!0,e.sync=!0,e.destroyed?e.onwrite(new P6e("write")):r?t._writev(i,e.onwrite):t._write(i,o,e.onwrite),e.sync=!1}function C6e(t,e,r,n,i){--e.pendingcb,r?(j.default.nextTick(i,n),j.default.nextTick(v2,t,e),t._writableState.errorEmitted=!0,Mv(t,n)):(i(n),t._writableState.errorEmitted=!0,Mv(t,n),v2(t,e))}function j6e(t){t.writing=!1,t.writecb=null,t.length-=t.writelen,t.writelen=0}function N6e(t,e){var r=t._writableState,n=r.sync,i=r.writecb;if(typeof i!="function")throw new S6e;if(j6e(r),e)C6e(t,r,n,e,i);else{var o=CH(r)||t.destroyed;!o&&!r.corked&&!r.bufferProcessing&&r.bufferedRequest&&DH(t,r),n?j.default.nextTick(kH,t,r,o,i):kH(t,r,o,i)}}function kH(t,e,r,n){r||q6e(t,e),e.pendingcb--,n(),v2(t,e)}function q6e(t,e){e.length===0&&e.needDrain&&(e.needDrain=!1,t.emit("drain"))}function DH(t,e){e.bufferProcessing=!0;var r=e.bufferedRequest;if(t._writev&&r&&r.next){var n=e.bufferedRequestCount,i=new Array(n),o=e.corkedRequestsFree;o.entry=r;for(var s=0,a=!0;r;)i[s]=r,r.isBuf||(a=!1),r=r.next,s+=1;i.allBuffers=a,YI(t,e,!0,e.length,i,"",o.finish),e.pendingcb++,e.lastBufferedRequest=null,o.next?(e.corkedRequestsFree=o.next,o.next=null):e.corkedRequestsFree=new OH(e),e.bufferedRequestCount=0}else{for(;r;){var d=r.chunk,m=r.encoding,p=r.callback,w=e.objectMode?1:d.length;if(YI(t,e,!1,w,d,m,p),r=r.next,e.bufferedRequestCount--,e.writing)break}r===null&&(e.lastBufferedRequest=null)}e.bufferedRequest=r,e.bufferProcessing=!1}Mi.prototype._write=function(t,e,r){r(new E6e("_write()"))};Mi.prototype._writev=null;Mi.prototype.end=function(t,e,r){var n=this._writableState;return typeof t=="function"?(r=t,t=null,e=null):typeof e=="function"&&(r=e,e=null),t!=null&&this.write(t,e),n.corked&&(n.corked=1,this.uncork()),n.ending||U6e(this,n,r),this};Object.defineProperty(Mi.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}});function CH(t){return t.ending&&t.length===0&&t.bufferedRequest===null&&!t.finished&&!t.writing}function $6e(t,e){t._final(function(r){e.pendingcb--,r&&Mv(t,r),e.prefinished=!0,t.emit("prefinish"),v2(t,e)})}function L6e(t,e){!e.prefinished&&!e.finalCalled&&(typeof t._final=="function"&&!e.destroyed?(e.pendingcb++,e.finalCalled=!0,j.default.nextTick($6e,t,e)):(e.prefinished=!0,t.emit("prefinish")))}function v2(t,e){var r=CH(e);if(r&&(L6e(t,e),e.pendingcb===0&&(e.finished=!0,t.emit("finish"),e.autoDestroy))){var n=t._readableState;(!n||n.autoDestroy&&n.endEmitted)&&t.destroy()}return r}function U6e(t,e,r){e.ending=!0,v2(t,e),r&&(e.finished?j.default.nextTick(r):t.once("finish",r)),e.ended=!0,t.writable=!1}function F6e(t,e,r){var n=t.entry;for(t.entry=null;n;){var i=n.callback;e.pendingcb--,i(r),n=n.next}e.corkedRequestsFree.next=t}Object.defineProperty(Mi.prototype,"destroyed",{enumerable:!1,get:function(){return this._writableState===void 0?!1:this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}});Mi.prototype.destroy=QI.destroy;Mi.prototype._undestroy=QI.undestroy;Mi.prototype._destroy=function(t,e){e(t)}});var fm=H((vht,qH)=>{"use strict";E();var z6e=Object.keys||function(t){var e=[];for(var r in t)e.push(r);return e};qH.exports=$u;var NH=rk(),tk=XI();It()($u,NH);for(ek=z6e(tk.prototype),Y6=0;Y6<ek.length;Y6++)Q6=ek[Y6],$u.prototype[Q6]||($u.prototype[Q6]=tk.prototype[Q6]);var ek,Q6,Y6;function $u(t){if(!(this instanceof $u))return new $u(t);NH.call(this,t),tk.call(this,t),this.allowHalfOpen=!0,t&&(t.readable===!1&&(this.readable=!1),t.writable===!1&&(this.writable=!1),t.allowHalfOpen===!1&&(this.allowHalfOpen=!1,this.once("end",K6e)))}Object.defineProperty($u.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});Object.defineProperty($u.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});Object.defineProperty($u.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}});function K6e(){this._writableState.ended||j.default.nextTick(G6e,this)}function G6e(t){t.end()}Object.defineProperty($u.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set:function(e){this._readableState===void 0||this._writableState===void 0||(this._readableState.destroyed=e,this._writableState.destroyed=e)}})});var UH=H((nk,LH)=>{E();var X6=sr(),Lu=X6.Buffer;function $H(t,e){for(var r in t)e[r]=t[r]}Lu.from&&Lu.alloc&&Lu.allocUnsafe&&Lu.allocUnsafeSlow?LH.exports=X6:($H(X6,nk),nk.Buffer=um);function um(t,e,r){return Lu(t,e,r)}um.prototype=Object.create(Lu.prototype);$H(Lu,um);um.from=function(t,e,r){if(typeof t=="number")throw new TypeError("Argument must not be a number");return Lu(t,e,r)};um.alloc=function(t,e,r){if(typeof t!="number")throw new TypeError("Argument must be a number");var n=Lu(t);return e!==void 0?typeof r=="string"?n.fill(e,r):n.fill(e):n.fill(0),n};um.allocUnsafe=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return Lu(t)};um.allocUnsafeSlow=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return X6.SlowBuffer(t)}});var Uu=H(zH=>{"use strict";E();var ok=UH().Buffer,FH=ok.isEncoding||function(t){switch(t=""+t,t&&t.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function W6e(t){if(!t)return"utf8";for(var e;;)switch(t){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return t;default:if(e)return;t=(""+t).toLowerCase(),e=!0}}function V6e(t){var e=W6e(t);if(typeof e!="string"&&(ok.isEncoding===FH||!FH(t)))throw new Error("Unknown encoding: "+t);return e||t}zH.StringDecoder=w2;function w2(t){this.encoding=V6e(t);var e;switch(this.encoding){case"utf16le":this.text=X6e,this.end=eSe,e=4;break;case"utf8":this.fillLast=J6e,e=4;break;case"base64":this.text=tSe,this.end=rSe,e=3;break;default:this.write=nSe,this.end=iSe;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=ok.allocUnsafe(e)}w2.prototype.write=function(t){if(t.length===0)return"";var e,r;if(this.lastNeed){if(e=this.fillLast(t),e===void 0)return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r<t.length?e?e+this.text(t,r):this.text(t,r):e||""};w2.prototype.end=Q6e;w2.prototype.text=Y6e;w2.prototype.fillLast=function(t){if(this.lastNeed<=t.length)return t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,t.length),this.lastNeed-=t.length};function ik(t){return t<=127?0:t>>5===6?2:t>>4===14?3:t>>3===30?4:t>>6===2?-1:-2}function H6e(t,e,r){var n=e.length-1;if(n<r)return 0;var i=ik(e[n]);return i>=0?(i>0&&(t.lastNeed=i-1),i):--n<r||i===-2?0:(i=ik(e[n]),i>=0?(i>0&&(t.lastNeed=i-2),i):--n<r||i===-2?0:(i=ik(e[n]),i>=0?(i>0&&(i===2?i=0:t.lastNeed=i-3),i):0))}function Z6e(t,e,r){if((e[0]&192)!==128)return t.lastNeed=0,"\uFFFD";if(t.lastNeed>1&&e.length>1){if((e[1]&192)!==128)return t.lastNeed=1,"\uFFFD";if(t.lastNeed>2&&e.length>2&&(e[2]&192)!==128)return t.lastNeed=2,"\uFFFD"}}function J6e(t){var e=this.lastTotal-this.lastNeed,r=Z6e(this,t,e);if(r!==void 0)return r;if(this.lastNeed<=t.length)return t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,e,0,t.length),this.lastNeed-=t.length}function Y6e(t,e){var r=H6e(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=r;var n=t.length-(r-this.lastNeed);return t.copy(this.lastChar,0,n),t.toString("utf8",e,n)}function Q6e(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+"\uFFFD":e}function X6e(t,e){if((t.length-e)%2===0){var r=t.toString("utf16le",e);if(r){var n=r.charCodeAt(r.length-1);if(n>=55296&&n<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",e,t.length-1)}function eSe(t){var e=t&&t.length?this.write(t):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,r)}return e}function tSe(t,e){var r=(t.length-e)%3;return r===0?t.toString("base64",e):(this.lastNeed=3-r,this.lastTotal=3,r===1?this.lastChar[0]=t[t.length-1]:(this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1]),t.toString("base64",e,t.length-r))}function rSe(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function nSe(t){return t.toString(this.encoding)}function iSe(t){return t&&t.length?this.write(t):""}});var eS=H((Eht,WH)=>{"use strict";E();var KH=cm().codes.ERR_STREAM_PREMATURE_CLOSE;function oSe(t){var e=!1;return function(){if(!e){e=!0;for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];t.apply(this,n)}}}function sSe(){}function aSe(t){return t.setHeader&&typeof t.abort=="function"}function GH(t,e,r){if(typeof e=="function")return GH(t,null,e);e||(e={}),r=oSe(r||sSe);var n=e.readable||e.readable!==!1&&t.readable,i=e.writable||e.writable!==!1&&t.writable,o=function(){t.writable||a()},s=t._writableState&&t._writableState.finished,a=function(){i=!1,s=!0,n||r.call(t)},d=t._readableState&&t._readableState.endEmitted,m=function(){n=!1,d=!0,i||r.call(t)},p=function(M){r.call(t,M)},w=function(){var M;if(n&&!d)return(!t._readableState||!t._readableState.ended)&&(M=new KH),r.call(t,M);if(i&&!s)return(!t._writableState||!t._writableState.ended)&&(M=new KH),r.call(t,M)},P=function(){t.req.on("finish",a)};return aSe(t)?(t.on("complete",a),t.on("abort",w),t.req?P():t.on("request",P)):i&&!t._writableState&&(t.on("end",o),t.on("close",o)),t.on("end",m),t.on("finish",a),e.error!==!1&&t.on("error",p),t.on("close",w),function(){t.removeListener("complete",a),t.removeListener("abort",w),t.removeListener("request",P),t.req&&t.req.removeListener("finish",a),t.removeListener("end",o),t.removeListener("close",o),t.removeListener("finish",a),t.removeListener("end",m),t.removeListener("error",p),t.removeListener("close",w)}}WH.exports=GH});var HH=H((Mht,VH)=>{"use strict";E();var tS;function Qh(t,e,r){return e=cSe(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function cSe(t){var e=fSe(t,"string");return typeof e=="symbol"?e:String(e)}function fSe(t,e){if(typeof t!="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var uSe=eS(),Xh=Symbol("lastResolve"),lm=Symbol("lastReject"),_2=Symbol("error"),rS=Symbol("ended"),dm=Symbol("lastPromise"),sk=Symbol("handlePromise"),hm=Symbol("stream");function ep(t,e){return{value:t,done:e}}function lSe(t){var e=t[Xh];if(e!==null){var r=t[hm].read();r!==null&&(t[dm]=null,t[Xh]=null,t[lm]=null,e(ep(r,!1)))}}function dSe(t){j.default.nextTick(lSe,t)}function hSe(t,e){return function(r,n){t.then(function(){if(e[rS]){r(ep(void 0,!0));return}e[sk](r,n)},n)}}var pSe=Object.getPrototypeOf(function(){}),mSe=Object.setPrototypeOf((tS={get stream(){return this[hm]},next:function(){var e=this,r=this[_2];if(r!==null)return Promise.reject(r);if(this[rS])return Promise.resolve(ep(void 0,!0));if(this[hm].destroyed)return new Promise(function(s,a){j.default.nextTick(function(){e[_2]?a(e[_2]):s(ep(void 0,!0))})});var n=this[dm],i;if(n)i=new Promise(hSe(n,this));else{var o=this[hm].read();if(o!==null)return Promise.resolve(ep(o,!1));i=new Promise(this[sk])}return this[dm]=i,i}},Qh(tS,Symbol.asyncIterator,function(){return this}),Qh(tS,"return",function(){var e=this;return new Promise(function(r,n){e[hm].destroy(null,function(i){if(i){n(i);return}r(ep(void 0,!0))})})}),tS),pSe),ySe=function(e){var r,n=Object.create(mSe,(r={},Qh(r,hm,{value:e,writable:!0}),Qh(r,Xh,{value:null,writable:!0}),Qh(r,lm,{value:null,writable:!0}),Qh(r,_2,{value:null,writable:!0}),Qh(r,rS,{value:e._readableState.endEmitted,writable:!0}),Qh(r,sk,{value:function(o,s){var a=n[hm].read();a?(n[dm]=null,n[Xh]=null,n[lm]=null,o(ep(a,!1))):(n[Xh]=o,n[lm]=s)},writable:!0}),r));return n[dm]=null,uSe(e,function(i){if(i&&i.code!=="ERR_STREAM_PREMATURE_CLOSE"){var o=n[lm];o!==null&&(n[dm]=null,n[Xh]=null,n[lm]=null,o(i)),n[_2]=i;return}var s=n[Xh];s!==null&&(n[dm]=null,n[Xh]=null,n[lm]=null,s(ep(void 0,!0))),n[rS]=!0}),e.on("readable",dSe.bind(null,n)),n};VH.exports=ySe});var JH=H((Aht,ZH)=>{E();ZH.exports=function(){throw new Error("Readable.from is not available in the browser")}});var rk=H((Iht,sZ)=>{"use strict";E();sZ.exports=Jr;var Pv;Jr.ReadableState=eZ;var Rht=Go().EventEmitter,XH=function(e,r){return e.listeners(r).length},E2=yI(),nS=sr().Buffer,gSe=(typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function vSe(t){return nS.from(t)}function bSe(t){return nS.isBuffer(t)||t instanceof gSe}var ak=am(),Sr;ak&&ak.debuglog?Sr=ak.debuglog("stream"):Sr=function(){};var wSe=EH(),pk=HI(),_Se=ZI(),xSe=_Se.getHighWaterMark,iS=cm().codes,ESe=iS.ERR_INVALID_ARG_TYPE,SSe=iS.ERR_STREAM_PUSH_AFTER_EOF,MSe=iS.ERR_METHOD_NOT_IMPLEMENTED,PSe=iS.ERR_STREAM_UNSHIFT_AFTER_END_EVENT,Av,ck,fk;It()(Jr,E2);var x2=pk.errorOrDestroy,uk=["error","close","destroy","pause","resume"];function ASe(t,e,r){if(typeof t.prependListener=="function")return t.prependListener(e,r);!t._events||!t._events[e]?t.on(e,r):Array.isArray(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]}function eZ(t,e,r){Pv=Pv||fm(),t=t||{},typeof r!="boolean"&&(r=e instanceof Pv),this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.readableObjectMode),this.highWaterMark=xSe(this,t,"readableHighWaterMark",r),this.buffer=new wSe,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=t.emitClose!==!1,this.autoDestroy=!!t.autoDestroy,this.destroyed=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(Av||(Av=Uu().StringDecoder),this.decoder=new Av(t.encoding),this.encoding=t.encoding)}function Jr(t){if(Pv=Pv||fm(),!(this instanceof Jr))return new Jr(t);var e=this instanceof Pv;this._readableState=new eZ(t,this,e),this.readable=!0,t&&(typeof t.read=="function"&&(this._read=t.read),typeof t.destroy=="function"&&(this._destroy=t.destroy)),E2.call(this)}Object.defineProperty(Jr.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0?!1:this._readableState.destroyed},set:function(e){this._readableState&&(this._readableState.destroyed=e)}});Jr.prototype.destroy=pk.destroy;Jr.prototype._undestroy=pk.undestroy;Jr.prototype._destroy=function(t,e){e(t)};Jr.prototype.push=function(t,e){var r=this._readableState,n;return r.objectMode?n=!0:typeof t=="string"&&(e=e||r.defaultEncoding,e!==r.encoding&&(t=nS.from(t,e),e=""),n=!0),tZ(this,t,e,!1,n)};Jr.prototype.unshift=function(t){return tZ(this,t,null,!0,!1)};function tZ(t,e,r,n,i){Sr("readableAddChunk",e);var o=t._readableState;if(e===null)o.reading=!1,ISe(t,o);else{var s;if(i||(s=TSe(o,e)),s)x2(t,s);else if(o.objectMode||e&&e.length>0)if(typeof e!="string"&&!o.objectMode&&Object.getPrototypeOf(e)!==nS.prototype&&(e=vSe(e)),n)o.endEmitted?x2(t,new PSe):lk(t,o,e,!0);else if(o.ended)x2(t,new SSe);else{if(o.destroyed)return!1;o.reading=!1,o.decoder&&!r?(e=o.decoder.write(e),o.objectMode||e.length!==0?lk(t,o,e,!1):hk(t,o)):lk(t,o,e,!1)}else n||(o.reading=!1,hk(t,o))}return!o.ended&&(o.length<o.highWaterMark||o.length===0)}function lk(t,e,r,n){e.flowing&&e.length===0&&!e.sync?(e.awaitDrain=0,t.emit("data",r)):(e.length+=e.objectMode?1:r.length,n?e.buffer.unshift(r):e.buffer.push(r),e.needReadable&&oS(t)),hk(t,e)}function TSe(t,e){var r;return!bSe(e)&&typeof e!="string"&&e!==void 0&&!t.objectMode&&(r=new ESe("chunk",["string","Buffer","Uint8Array"],e)),r}Jr.prototype.isPaused=function(){return this._readableState.flowing===!1};Jr.prototype.setEncoding=function(t){Av||(Av=Uu().StringDecoder);var e=new Av(t);this._readableState.decoder=e,this._readableState.encoding=this._readableState.decoder.encoding;for(var r=this._readableState.buffer.head,n="";r!==null;)n+=e.write(r.data),r=r.next;return this._readableState.buffer.clear(),n!==""&&this._readableState.buffer.push(n),this._readableState.length=n.length,this};var YH=1073741824;function RSe(t){return t>=YH?t=YH:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}function QH(t,e){return t<=0||e.length===0&&e.ended?0:e.objectMode?1:t!==t?e.flowing&&e.length?e.buffer.head.data.length:e.length:(t>e.highWaterMark&&(e.highWaterMark=RSe(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}Jr.prototype.read=function(t){Sr("read",t),t=parseInt(t,10);var e=this._readableState,r=t;if(t!==0&&(e.emittedReadable=!1),t===0&&e.needReadable&&((e.highWaterMark!==0?e.length>=e.highWaterMark:e.length>0)||e.ended))return Sr("read: emitReadable",e.length,e.ended),e.length===0&&e.ended?dk(this):oS(this),null;if(t=QH(t,e),t===0&&e.ended)return e.length===0&&dk(this),null;var n=e.needReadable;Sr("need readable",n),(e.length===0||e.length-t<e.highWaterMark)&&(n=!0,Sr("length less than watermark",n)),e.ended||e.reading?(n=!1,Sr("reading or ended",n)):n&&(Sr("do read"),e.reading=!0,e.sync=!0,e.length===0&&(e.needReadable=!0),this._read(e.highWaterMark),e.sync=!1,e.reading||(t=QH(r,e)));var i;return t>0?i=iZ(t,e):i=null,i===null?(e.needReadable=e.length<=e.highWaterMark,t=0):(e.length-=t,e.awaitDrain=0),e.length===0&&(e.ended||(e.needReadable=!0),r!==t&&e.ended&&dk(this)),i!==null&&this.emit("data",i),i};function ISe(t,e){if(Sr("onEofChunk"),!e.ended){if(e.decoder){var r=e.decoder.end();r&&r.length&&(e.buffer.push(r),e.length+=e.objectMode?1:r.length)}e.ended=!0,e.sync?oS(t):(e.needReadable=!1,e.emittedReadable||(e.emittedReadable=!0,rZ(t)))}}function oS(t){var e=t._readableState;Sr("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||(Sr("emitReadable",e.flowing),e.emittedReadable=!0,j.default.nextTick(rZ,t))}function rZ(t){var e=t._readableState;Sr("emitReadable_",e.destroyed,e.length,e.ended),!e.destroyed&&(e.length||e.ended)&&(t.emit("readable"),e.emittedReadable=!1),e.needReadable=!e.flowing&&!e.ended&&e.length<=e.highWaterMark,mk(t)}function hk(t,e){e.readingMore||(e.readingMore=!0,j.default.nextTick(kSe,t,e))}function kSe(t,e){for(;!e.reading&&!e.ended&&(e.length<e.highWaterMark||e.flowing&&e.length===0);){var r=e.length;if(Sr("maybeReadMore read 0"),t.read(0),r===e.length)break}e.readingMore=!1}Jr.prototype._read=function(t){x2(this,new MSe("_read()"))};Jr.prototype.pipe=function(t,e){var r=this,n=this._readableState;switch(n.pipesCount){case 0:n.pipes=t;break;case 1:n.pipes=[n.pipes,t];break;default:n.pipes.push(t);break}n.pipesCount+=1,Sr("pipe count=%d opts=%j",n.pipesCount,e);var i=(!e||e.end!==!1)&&t!==j.default.stdout&&t!==j.default.stderr,o=i?a:A;n.endEmitted?j.default.nextTick(o):r.once("end",o),t.on("unpipe",s);function s(B,I){Sr("onunpipe"),B===r&&I&&I.hasUnpiped===!1&&(I.hasUnpiped=!0,p())}function a(){Sr("onend"),t.end()}var d=OSe(r);t.on("drain",d);var m=!1;function p(){Sr("cleanup"),t.removeListener("close",S),t.removeListener("finish",M),t.removeListener("drain",d),t.removeListener("error",P),t.removeListener("unpipe",s),r.removeListener("end",a),r.removeListener("end",A),r.removeListener("data",w),m=!0,n.awaitDrain&&(!t._writableState||t._writableState.needDrain)&&d()}r.on("data",w);function w(B){Sr("ondata");var I=t.write(B);Sr("dest.write",I),I===!1&&((n.pipesCount===1&&n.pipes===t||n.pipesCount>1&&oZ(n.pipes,t)!==-1)&&!m&&(Sr("false write response, pause",n.awaitDrain),n.awaitDrain++),r.pause())}function P(B){Sr("onerror",B),A(),t.removeListener("error",P),XH(t,"error")===0&&x2(t,B)}ASe(t,"error",P);function S(){t.removeListener("finish",M),A()}t.once("close",S);function M(){Sr("onfinish"),t.removeListener("close",S),A()}t.once("finish",M);function A(){Sr("unpipe"),r.unpipe(t)}return t.emit("pipe",r),n.flowing||(Sr("pipe resume"),r.resume()),t};function OSe(t){return function(){var r=t._readableState;Sr("pipeOnDrain",r.awaitDrain),r.awaitDrain&&r.awaitDrain--,r.awaitDrain===0&&XH(t,"data")&&(r.flowing=!0,mk(t))}}Jr.prototype.unpipe=function(t){var e=this._readableState,r={hasUnpiped:!1};if(e.pipesCount===0)return this;if(e.pipesCount===1)return t&&t!==e.pipes?this:(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this,r),this);if(!t){var n=e.pipes,i=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var o=0;o<i;o++)n[o].emit("unpipe",this,{hasUnpiped:!1});return this}var s=oZ(e.pipes,t);return s===-1?this:(e.pipes.splice(s,1),e.pipesCount-=1,e.pipesCount===1&&(e.pipes=e.pipes[0]),t.emit("unpipe",this,r),this)};Jr.prototype.on=function(t,e){var r=E2.prototype.on.call(this,t,e),n=this._readableState;return t==="data"?(n.readableListening=this.listenerCount("readable")>0,n.flowing!==!1&&this.resume()):t==="readable"&&!n.endEmitted&&!n.readableListening&&(n.readableListening=n.needReadable=!0,n.flowing=!1,n.emittedReadable=!1,Sr("on readable",n.length,n.reading),n.length?oS(this):n.reading||j.default.nextTick(BSe,this)),r};Jr.prototype.addListener=Jr.prototype.on;Jr.prototype.removeListener=function(t,e){var r=E2.prototype.removeListener.call(this,t,e);return t==="readable"&&j.default.nextTick(nZ,this),r};Jr.prototype.removeAllListeners=function(t){var e=E2.prototype.removeAllListeners.apply(this,arguments);return(t==="readable"||t===void 0)&&j.default.nextTick(nZ,this),e};function nZ(t){var e=t._readableState;e.readableListening=t.listenerCount("readable")>0,e.resumeScheduled&&!e.paused?e.flowing=!0:t.listenerCount("data")>0&&t.resume()}function BSe(t){Sr("readable nexttick read 0"),t.read(0)}Jr.prototype.resume=function(){var t=this._readableState;return t.flowing||(Sr("resume"),t.flowing=!t.readableListening,DSe(this,t)),t.paused=!1,this};function DSe(t,e){e.resumeScheduled||(e.resumeScheduled=!0,j.default.nextTick(CSe,t,e))}function CSe(t,e){Sr("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),mk(t),e.flowing&&!e.reading&&t.read(0)}Jr.prototype.pause=function(){return Sr("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(Sr("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this};function mk(t){var e=t._readableState;for(Sr("flow",e.flowing);e.flowing&&t.read()!==null;);}Jr.prototype.wrap=function(t){var e=this,r=this._readableState,n=!1;t.on("end",function(){if(Sr("wrapped end"),r.decoder&&!r.ended){var s=r.decoder.end();s&&s.length&&e.push(s)}e.push(null)}),t.on("data",function(s){if(Sr("wrapped data"),r.decoder&&(s=r.decoder.write(s)),!(r.objectMode&&s==null)&&!(!r.objectMode&&(!s||!s.length))){var a=e.push(s);a||(n=!0,t.pause())}});for(var i in t)this[i]===void 0&&typeof t[i]=="function"&&(this[i]=function(a){return function(){return t[a].apply(t,arguments)}}(i));for(var o=0;o<uk.length;o++)t.on(uk[o],this.emit.bind(this,uk[o]));return this._read=function(s){Sr("wrapped _read",s),n&&(n=!1,t.resume())},this};typeof Symbol=="function"&&(Jr.prototype[Symbol.asyncIterator]=function(){return ck===void 0&&(ck=HH()),ck(this)});Object.defineProperty(Jr.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}});Object.defineProperty(Jr.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}});Object.defineProperty(Jr.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(e){this._readableState&&(this._readableState.flowing=e)}});Jr._fromList=iZ;Object.defineProperty(Jr.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}});function iZ(t,e){if(e.length===0)return null;var r;return e.objectMode?r=e.buffer.shift():!t||t>=e.length?(e.decoder?r=e.buffer.join(""):e.buffer.length===1?r=e.buffer.first():r=e.buffer.concat(e.length),e.buffer.clear()):r=e.buffer.consume(t,e.decoder),r}function dk(t){var e=t._readableState;Sr("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,j.default.nextTick(jSe,e,t))}function jSe(t,e){if(Sr("endReadableNT",t.endEmitted,t.length),!t.endEmitted&&t.length===0&&(t.endEmitted=!0,e.readable=!1,e.emit("end"),t.autoDestroy)){var r=e._writableState;(!r||r.autoDestroy&&r.finished)&&e.destroy()}}typeof Symbol=="function"&&(Jr.from=function(t,e){return fk===void 0&&(fk=JH()),fk(Jr,t,e)});function oZ(t,e){for(var r=0,n=t.length;r<n;r++)if(t[r]===e)return r;return-1}});var yk=H((Oht,cZ)=>{"use strict";E();cZ.exports=_d;var sS=cm().codes,NSe=sS.ERR_METHOD_NOT_IMPLEMENTED,qSe=sS.ERR_MULTIPLE_CALLBACK,$Se=sS.ERR_TRANSFORM_ALREADY_TRANSFORMING,LSe=sS.ERR_TRANSFORM_WITH_LENGTH_0,aS=fm();It()(_d,aS);function USe(t,e){var r=this._transformState;r.transforming=!1;var n=r.writecb;if(n===null)return this.emit("error",new qSe);r.writechunk=null,r.writecb=null,e!=null&&this.push(e),n(t);var i=this._readableState;i.reading=!1,(i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}function _d(t){if(!(this instanceof _d))return new _d(t);aS.call(this,t),this._transformState={afterTransform:USe.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,t&&(typeof t.transform=="function"&&(this._transform=t.transform),typeof t.flush=="function"&&(this._flush=t.flush)),this.on("prefinish",FSe)}function FSe(){var t=this;typeof this._flush=="function"&&!this._readableState.destroyed?this._flush(function(e,r){aZ(t,e,r)}):aZ(this,null,null)}_d.prototype.push=function(t,e){return this._transformState.needTransform=!1,aS.prototype.push.call(this,t,e)};_d.prototype._transform=function(t,e,r){r(new NSe("_transform()"))};_d.prototype._write=function(t,e,r){var n=this._transformState;if(n.writecb=r,n.writechunk=t,n.writeencoding=e,!n.transforming){var i=this._readableState;(n.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}};_d.prototype._read=function(t){var e=this._transformState;e.writechunk!==null&&!e.transforming?(e.transforming=!0,this._transform(e.writechunk,e.writeencoding,e.afterTransform)):e.needTransform=!0};_d.prototype._destroy=function(t,e){aS.prototype._destroy.call(this,t,function(r){e(r)})};function aZ(t,e,r){if(e)return t.emit("error",e);if(r!=null&&t.push(r),t._writableState.length)throw new LSe;if(t._transformState.transforming)throw new $Se;return t.push(null)}});var lZ=H((Dht,uZ)=>{"use strict";E();uZ.exports=S2;var fZ=yk();It()(S2,fZ);function S2(t){if(!(this instanceof S2))return new S2(t);fZ.call(this,t)}S2.prototype._transform=function(t,e,r){r(null,t)}});var yZ=H((jht,mZ)=>{"use strict";E();var gk;function zSe(t){var e=!1;return function(){e||(e=!0,t.apply(void 0,arguments))}}var pZ=cm().codes,KSe=pZ.ERR_MISSING_ARGS,GSe=pZ.ERR_STREAM_DESTROYED;function dZ(t){if(t)throw t}function WSe(t){return t.setHeader&&typeof t.abort=="function"}function VSe(t,e,r,n){n=zSe(n);var i=!1;t.on("close",function(){i=!0}),gk===void 0&&(gk=eS()),gk(t,{readable:e,writable:r},function(s){if(s)return n(s);i=!0,n()});var o=!1;return function(s){if(!i&&!o){if(o=!0,WSe(t))return t.abort();if(typeof t.destroy=="function")return t.destroy();n(s||new GSe("pipe"))}}}function hZ(t){t()}function HSe(t,e){return t.pipe(e)}function ZSe(t){return!t.length||typeof t[t.length-1]!="function"?dZ:t.pop()}function JSe(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];var n=ZSe(e);if(Array.isArray(e[0])&&(e=e[0]),e.length<2)throw new KSe("streams");var i,o=e.map(function(s,a){var d=a<e.length-1,m=a>0;return VSe(s,d,m,function(p){i||(i=p),p&&o.forEach(hZ),!d&&(o.forEach(hZ),n(i))})});return e.reduce(HSe)}mZ.exports=JSe});var vZ=H((Ic,gZ)=>{E();Ic=gZ.exports=rk();Ic.Stream=Ic;Ic.Readable=Ic;Ic.Writable=XI();Ic.Duplex=fm();Ic.Transform=yk();Ic.PassThrough=lZ();Ic.finished=eS();Ic.pipeline=yZ()});var vk=H(($ht,wZ)=>{"use strict";E();var cS=FW().Buffer,bZ=vZ().Transform,YSe=It();function QSe(t,e){if(!cS.isBuffer(t)&&typeof t!="string")throw new TypeError(e+" must be a string or a buffer")}function tp(t){bZ.call(this),this._block=cS.allocUnsafe(t),this._blockSize=t,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}YSe(tp,bZ);tp.prototype._transform=function(t,e,r){var n=null;try{this.update(t,e)}catch(i){n=i}r(n)};tp.prototype._flush=function(t){var e=null;try{this.push(this.digest())}catch(r){e=r}t(e)};tp.prototype.update=function(t,e){if(QSe(t,"Data"),this._finalized)throw new Error("Digest already called");cS.isBuffer(t)||(t=cS.from(t,e));for(var r=this._block,n=0;this._blockOffset+t.length-n>=this._blockSize;){for(var i=this._blockOffset;i<this._blockSize;)r[i++]=t[n++];this._update(),this._blockOffset=0}for(;n<t.length;)r[this._blockOffset++]=t[n++];for(var o=0,s=t.length*8;s>0;++o)this._length[o]+=s,s=this._length[o]/4294967296|0,s>0&&(this._length[o]-=4294967296*s);return this};tp.prototype._update=function(){throw new Error("_update is not implemented")};tp.prototype.digest=function(t){if(this._finalized)throw new Error("Digest already called");this._finalized=!0;var e=this._digest();t!==void 0&&(e=e.toString(t)),this._block.fill(0),this._blockOffset=0;for(var r=0;r<4;++r)this._length[r]=0;return e};tp.prototype._digest=function(){throw new Error("_digest is not implemented")};wZ.exports=tp});var lS=H((Uht,xZ)=>{"use strict";E();var XSe=It(),_Z=vk(),eMe=Fr().Buffer,tMe=new Array(16);function fS(){_Z.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878}XSe(fS,_Z);fS.prototype._update=function(){for(var t=tMe,e=0;e<16;++e)t[e]=this._block.readInt32LE(e*4);var r=this._a,n=this._b,i=this._c,o=this._d;r=Rs(r,n,i,o,t[0],3614090360,7),o=Rs(o,r,n,i,t[1],3905402710,12),i=Rs(i,o,r,n,t[2],606105819,17),n=Rs(n,i,o,r,t[3],3250441966,22),r=Rs(r,n,i,o,t[4],4118548399,7),o=Rs(o,r,n,i,t[5],1200080426,12),i=Rs(i,o,r,n,t[6],2821735955,17),n=Rs(n,i,o,r,t[7],4249261313,22),r=Rs(r,n,i,o,t[8],1770035416,7),o=Rs(o,r,n,i,t[9],2336552879,12),i=Rs(i,o,r,n,t[10],4294925233,17),n=Rs(n,i,o,r,t[11],2304563134,22),r=Rs(r,n,i,o,t[12],1804603682,7),o=Rs(o,r,n,i,t[13],4254626195,12),i=Rs(i,o,r,n,t[14],2792965006,17),n=Rs(n,i,o,r,t[15],1236535329,22),r=Is(r,n,i,o,t[1],4129170786,5),o=Is(o,r,n,i,t[6],3225465664,9),i=Is(i,o,r,n,t[11],643717713,14),n=Is(n,i,o,r,t[0],3921069994,20),r=Is(r,n,i,o,t[5],3593408605,5),o=Is(o,r,n,i,t[10],38016083,9),i=Is(i,o,r,n,t[15],3634488961,14),n=Is(n,i,o,r,t[4],3889429448,20),r=Is(r,n,i,o,t[9],568446438,5),o=Is(o,r,n,i,t[14],3275163606,9),i=Is(i,o,r,n,t[3],4107603335,14),n=Is(n,i,o,r,t[8],1163531501,20),r=Is(r,n,i,o,t[13],2850285829,5),o=Is(o,r,n,i,t[2],4243563512,9),i=Is(i,o,r,n,t[7],1735328473,14),n=Is(n,i,o,r,t[12],2368359562,20),r=ks(r,n,i,o,t[5],4294588738,4),o=ks(o,r,n,i,t[8],2272392833,11),i=ks(i,o,r,n,t[11],1839030562,16),n=ks(n,i,o,r,t[14],4259657740,23),r=ks(r,n,i,o,t[1],2763975236,4),o=ks(o,r,n,i,t[4],1272893353,11),i=ks(i,o,r,n,t[7],4139469664,16),n=ks(n,i,o,r,t[10],3200236656,23),r=ks(r,n,i,o,t[13],681279174,4),o=ks(o,r,n,i,t[0],3936430074,11),i=ks(i,o,r,n,t[3],3572445317,16),n=ks(n,i,o,r,t[6],76029189,23),r=ks(r,n,i,o,t[9],3654602809,4),o=ks(o,r,n,i,t[12],3873151461,11),i=ks(i,o,r,n,t[15],530742520,16),n=ks(n,i,o,r,t[2],3299628645,23),r=Os(r,n,i,o,t[0],4096336452,6),o=Os(o,r,n,i,t[7],1126891415,10),i=Os(i,o,r,n,t[14],2878612391,15),n=Os(n,i,o,r,t[5],4237533241,21),r=Os(r,n,i,o,t[12],1700485571,6),o=Os(o,r,n,i,t[3],2399980690,10),i=Os(i,o,r,n,t[10],4293915773,15),n=Os(n,i,o,r,t[1],2240044497,21),r=Os(r,n,i,o,t[8],1873313359,6),o=Os(o,r,n,i,t[15],4264355552,10),i=Os(i,o,r,n,t[6],2734768916,15),n=Os(n,i,o,r,t[13],1309151649,21),r=Os(r,n,i,o,t[4],4149444226,6),o=Os(o,r,n,i,t[11],3174756917,10),i=Os(i,o,r,n,t[2],718787259,15),n=Os(n,i,o,r,t[9],3951481745,21),this._a=this._a+r|0,this._b=this._b+n|0,this._c=this._c+i|0,this._d=this._d+o|0};fS.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var t=eMe.allocUnsafe(16);return t.writeInt32LE(this._a,0),t.writeInt32LE(this._b,4),t.writeInt32LE(this._c,8),t.writeInt32LE(this._d,12),t};function uS(t,e){return t<<e|t>>>32-e}function Rs(t,e,r,n,i,o,s){return uS(t+(e&r|~e&n)+i+o|0,s)+e|0}function Is(t,e,r,n,i,o,s){return uS(t+(e&n|r&~n)+i+o|0,s)+e|0}function ks(t,e,r,n,i,o,s){return uS(t+(e^r^n)+i+o|0,s)+e|0}function Os(t,e,r,n,i,o,s){return uS(t+(r^(e|~n))+i+o|0,s)+e|0}xZ.exports=fS});var hS=H((zht,RZ)=>{"use strict";E();var bk=sr().Buffer,rMe=It(),TZ=vk(),nMe=new Array(16),M2=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],P2=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],A2=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],T2=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11],R2=[0,1518500249,1859775393,2400959708,2840853838],I2=[1352829926,1548603684,1836072691,2053994217,0];function dS(){TZ.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520}rMe(dS,TZ);dS.prototype._update=function(){for(var t=nMe,e=0;e<16;++e)t[e]=this._block.readInt32LE(e*4);for(var r=this._a|0,n=this._b|0,i=this._c|0,o=this._d|0,s=this._e|0,a=this._a|0,d=this._b|0,m=this._c|0,p=this._d|0,w=this._e|0,P=0;P<80;P+=1){var S,M;P<16?(S=EZ(r,n,i,o,s,t[M2[P]],R2[0],A2[P]),M=AZ(a,d,m,p,w,t[P2[P]],I2[0],T2[P])):P<32?(S=SZ(r,n,i,o,s,t[M2[P]],R2[1],A2[P]),M=PZ(a,d,m,p,w,t[P2[P]],I2[1],T2[P])):P<48?(S=MZ(r,n,i,o,s,t[M2[P]],R2[2],A2[P]),M=MZ(a,d,m,p,w,t[P2[P]],I2[2],T2[P])):P<64?(S=PZ(r,n,i,o,s,t[M2[P]],R2[3],A2[P]),M=SZ(a,d,m,p,w,t[P2[P]],I2[3],T2[P])):(S=AZ(r,n,i,o,s,t[M2[P]],R2[4],A2[P]),M=EZ(a,d,m,p,w,t[P2[P]],I2[4],T2[P])),r=s,s=o,o=pm(i,10),i=n,n=S,a=w,w=p,p=pm(m,10),m=d,d=M}var A=this._b+i+p|0;this._b=this._c+o+w|0,this._c=this._d+s+a|0,this._d=this._e+r+d|0,this._e=this._a+n+m|0,this._a=A};dS.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var t=bk.alloc?bk.alloc(20):new bk(20);return t.writeInt32LE(this._a,0),t.writeInt32LE(this._b,4),t.writeInt32LE(this._c,8),t.writeInt32LE(this._d,12),t.writeInt32LE(this._e,16),t};function pm(t,e){return t<<e|t>>>32-e}function EZ(t,e,r,n,i,o,s,a){return pm(t+(e^r^n)+o+s|0,a)+i|0}function SZ(t,e,r,n,i,o,s,a){return pm(t+(e&r|~e&n)+o+s|0,a)+i|0}function MZ(t,e,r,n,i,o,s,a){return pm(t+((e|~r)^n)+o+s|0,a)+i|0}function PZ(t,e,r,n,i,o,s,a){return pm(t+(e&n|r&~n)+o+s|0,a)+i|0}function AZ(t,e,r,n,i,o,s,a){return pm(t+(e^(r|~n))+o+s|0,a)+i|0}RZ.exports=dS});var mm=H((Ght,kZ)=>{E();var IZ=Fr().Buffer;function pS(t,e){this._block=IZ.alloc(t),this._finalSize=e,this._blockSize=t,this._len=0}pS.prototype.update=function(t,e){typeof t=="string"&&(e=e||"utf8",t=IZ.from(t,e));for(var r=this._block,n=this._blockSize,i=t.length,o=this._len,s=0;s<i;){for(var a=o%n,d=Math.min(i-s,n-a),m=0;m<d;m++)r[a+m]=t[s+m];o+=d,s+=d,o%n===0&&this._update(r)}return this._len+=i,this};pS.prototype.digest=function(t){var e=this._len%this._blockSize;this._block[e]=128,this._block.fill(0,e+1),e>=this._finalSize&&(this._update(this._block),this._block.fill(0));var r=this._len*8;if(r<=4294967295)this._block.writeUInt32BE(r,this._blockSize-4);else{var n=(r&4294967295)>>>0,i=(r-n)/4294967296;this._block.writeUInt32BE(i,this._blockSize-8),this._block.writeUInt32BE(n,this._blockSize-4)}this._update(this._block);var o=this._hash();return t?o.toString(t):o};pS.prototype._update=function(){throw new Error("_update must be implemented by subclass")};kZ.exports=pS});var DZ=H((Vht,BZ)=>{E();var iMe=It(),OZ=mm(),oMe=Fr().Buffer,sMe=[1518500249,1859775393,-1894007588,-899497514],aMe=new Array(80);function k2(){this.init(),this._w=aMe,OZ.call(this,64,56)}iMe(k2,OZ);k2.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this};function cMe(t){return t<<5|t>>>27}function fMe(t){return t<<30|t>>>2}function uMe(t,e,r,n){return t===0?e&r|~e&n:t===2?e&r|e&n|r&n:e^r^n}k2.prototype._update=function(t){for(var e=this._w,r=this._a|0,n=this._b|0,i=this._c|0,o=this._d|0,s=this._e|0,a=0;a<16;++a)e[a]=t.readInt32BE(a*4);for(;a<80;++a)e[a]=e[a-3]^e[a-8]^e[a-14]^e[a-16];for(var d=0;d<80;++d){var m=~~(d/20),p=cMe(r)+uMe(m,n,i,o)+s+e[d]+sMe[m]|0;s=o,o=i,i=fMe(n),n=r,r=p}this._a=r+this._a|0,this._b=n+this._b|0,this._c=i+this._c|0,this._d=o+this._d|0,this._e=s+this._e|0};k2.prototype._hash=function(){var t=oMe.allocUnsafe(20);return t.writeInt32BE(this._a|0,0),t.writeInt32BE(this._b|0,4),t.writeInt32BE(this._c|0,8),t.writeInt32BE(this._d|0,12),t.writeInt32BE(this._e|0,16),t};BZ.exports=k2});var NZ=H((Zht,jZ)=>{E();var lMe=It(),CZ=mm(),dMe=Fr().Buffer,hMe=[1518500249,1859775393,-1894007588,-899497514],pMe=new Array(80);function O2(){this.init(),this._w=pMe,CZ.call(this,64,56)}lMe(O2,CZ);O2.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this};function mMe(t){return t<<1|t>>>31}function yMe(t){return t<<5|t>>>27}function gMe(t){return t<<30|t>>>2}function vMe(t,e,r,n){return t===0?e&r|~e&n:t===2?e&r|e&n|r&n:e^r^n}O2.prototype._update=function(t){for(var e=this._w,r=this._a|0,n=this._b|0,i=this._c|0,o=this._d|0,s=this._e|0,a=0;a<16;++a)e[a]=t.readInt32BE(a*4);for(;a<80;++a)e[a]=mMe(e[a-3]^e[a-8]^e[a-14]^e[a-16]);for(var d=0;d<80;++d){var m=~~(d/20),p=yMe(r)+vMe(m,n,i,o)+s+e[d]+hMe[m]|0;s=o,o=i,i=gMe(n),n=r,r=p}this._a=r+this._a|0,this._b=n+this._b|0,this._c=i+this._c|0,this._d=o+this._d|0,this._e=s+this._e|0};O2.prototype._hash=function(){var t=dMe.allocUnsafe(20);return t.writeInt32BE(this._a|0,0),t.writeInt32BE(this._b|0,4),t.writeInt32BE(this._c|0,8),t.writeInt32BE(this._d|0,12),t.writeInt32BE(this._e|0,16),t};jZ.exports=O2});var wk=H((Yht,$Z)=>{E();var bMe=It(),qZ=mm(),wMe=Fr().Buffer,_Me=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],xMe=new Array(64);function B2(){this.init(),this._w=xMe,qZ.call(this,64,56)}bMe(B2,qZ);B2.prototype.init=function(){return this._a=1779033703,this._b=3144134277,this._c=1013904242,this._d=2773480762,this._e=1359893119,this._f=2600822924,this._g=528734635,this._h=1541459225,this};function EMe(t,e,r){return r^t&(e^r)}function SMe(t,e,r){return t&e|r&(t|e)}function MMe(t){return(t>>>2|t<<30)^(t>>>13|t<<19)^(t>>>22|t<<10)}function PMe(t){return(t>>>6|t<<26)^(t>>>11|t<<21)^(t>>>25|t<<7)}function AMe(t){return(t>>>7|t<<25)^(t>>>18|t<<14)^t>>>3}function TMe(t){return(t>>>17|t<<15)^(t>>>19|t<<13)^t>>>10}B2.prototype._update=function(t){for(var e=this._w,r=this._a|0,n=this._b|0,i=this._c|0,o=this._d|0,s=this._e|0,a=this._f|0,d=this._g|0,m=this._h|0,p=0;p<16;++p)e[p]=t.readInt32BE(p*4);for(;p<64;++p)e[p]=TMe(e[p-2])+e[p-7]+AMe(e[p-15])+e[p-16]|0;for(var w=0;w<64;++w){var P=m+PMe(s)+EMe(s,a,d)+_Me[w]+e[w]|0,S=MMe(r)+SMe(r,n,i)|0;m=d,d=a,a=s,s=o+P|0,o=i,i=n,n=r,r=P+S|0}this._a=r+this._a|0,this._b=n+this._b|0,this._c=i+this._c|0,this._d=o+this._d|0,this._e=s+this._e|0,this._f=a+this._f|0,this._g=d+this._g|0,this._h=m+this._h|0};B2.prototype._hash=function(){var t=wMe.allocUnsafe(32);return t.writeInt32BE(this._a,0),t.writeInt32BE(this._b,4),t.writeInt32BE(this._c,8),t.writeInt32BE(this._d,12),t.writeInt32BE(this._e,16),t.writeInt32BE(this._f,20),t.writeInt32BE(this._g,24),t.writeInt32BE(this._h,28),t};$Z.exports=B2});var UZ=H((Xht,LZ)=>{E();var RMe=It(),IMe=wk(),kMe=mm(),OMe=Fr().Buffer,BMe=new Array(64);function mS(){this.init(),this._w=BMe,kMe.call(this,64,56)}RMe(mS,IMe);mS.prototype.init=function(){return this._a=3238371032,this._b=914150663,this._c=812702999,this._d=4144912697,this._e=4290775857,this._f=1750603025,this._g=1694076839,this._h=3204075428,this};mS.prototype._hash=function(){var t=OMe.allocUnsafe(28);return t.writeInt32BE(this._a,0),t.writeInt32BE(this._b,4),t.writeInt32BE(this._c,8),t.writeInt32BE(this._d,12),t.writeInt32BE(this._e,16),t.writeInt32BE(this._f,20),t.writeInt32BE(this._g,24),t};LZ.exports=mS});var _k=H((tpt,HZ)=>{E();var DMe=It(),VZ=mm(),CMe=Fr().Buffer,FZ=[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],jMe=new Array(160);function D2(){this.init(),this._w=jMe,VZ.call(this,128,112)}DMe(D2,VZ);D2.prototype.init=function(){return this._ah=1779033703,this._bh=3144134277,this._ch=1013904242,this._dh=2773480762,this._eh=1359893119,this._fh=2600822924,this._gh=528734635,this._hh=1541459225,this._al=4089235720,this._bl=2227873595,this._cl=4271175723,this._dl=1595750129,this._el=2917565137,this._fl=725511199,this._gl=4215389547,this._hl=327033209,this};function zZ(t,e,r){return r^t&(e^r)}function KZ(t,e,r){return t&e|r&(t|e)}function GZ(t,e){return(t>>>28|e<<4)^(e>>>2|t<<30)^(e>>>7|t<<25)}function WZ(t,e){return(t>>>14|e<<18)^(t>>>18|e<<14)^(e>>>9|t<<23)}function NMe(t,e){return(t>>>1|e<<31)^(t>>>8|e<<24)^t>>>7}function qMe(t,e){return(t>>>1|e<<31)^(t>>>8|e<<24)^(t>>>7|e<<25)}function $Me(t,e){return(t>>>19|e<<13)^(e>>>29|t<<3)^t>>>6}function LMe(t,e){return(t>>>19|e<<13)^(e>>>29|t<<3)^(t>>>6|e<<26)}function Ro(t,e){return t>>>0<e>>>0?1:0}D2.prototype._update=function(t){for(var e=this._w,r=this._ah|0,n=this._bh|0,i=this._ch|0,o=this._dh|0,s=this._eh|0,a=this._fh|0,d=this._gh|0,m=this._hh|0,p=this._al|0,w=this._bl|0,P=this._cl|0,S=this._dl|0,M=this._el|0,A=this._fl|0,B=this._gl|0,I=this._hl|0,C=0;C<32;C+=2)e[C]=t.readInt32BE(C*4),e[C+1]=t.readInt32BE(C*4+4);for(;C<160;C+=2){var k=e[C-30],q=e[C-15*2+1],L=NMe(k,q),U=qMe(q,k);k=e[C-2*2],q=e[C-2*2+1];var F=$Me(k,q),N=LMe(q,k),G=e[C-7*2],x=e[C-7*2+1],c=e[C-16*2],u=e[C-16*2+1],y=U+x|0,l=L+G+Ro(y,U)|0;y=y+N|0,l=l+F+Ro(y,N)|0,y=y+u|0,l=l+c+Ro(y,u)|0,e[C]=l,e[C+1]=y}for(var h=0;h<160;h+=2){l=e[h],y=e[h+1];var b=KZ(r,n,i),_=KZ(p,w,P),g=GZ(r,p),f=GZ(p,r),v=WZ(s,M),O=WZ(M,s),T=FZ[h],R=FZ[h+1],z=zZ(s,a,d),V=zZ(M,A,B),W=I+O|0,Z=m+v+Ro(W,I)|0;W=W+V|0,Z=Z+z+Ro(W,V)|0,W=W+R|0,Z=Z+T+Ro(W,R)|0,W=W+y|0,Z=Z+l+Ro(W,y)|0;var J=f+_|0,X=g+b+Ro(J,f)|0;m=d,I=B,d=a,B=A,a=s,A=M,M=S+W|0,s=o+Z+Ro(M,S)|0,o=i,S=P,i=n,P=w,n=r,w=p,p=W+J|0,r=Z+X+Ro(p,W)|0}this._al=this._al+p|0,this._bl=this._bl+w|0,this._cl=this._cl+P|0,this._dl=this._dl+S|0,this._el=this._el+M|0,this._fl=this._fl+A|0,this._gl=this._gl+B|0,this._hl=this._hl+I|0,this._ah=this._ah+r+Ro(this._al,p)|0,this._bh=this._bh+n+Ro(this._bl,w)|0,this._ch=this._ch+i+Ro(this._cl,P)|0,this._dh=this._dh+o+Ro(this._dl,S)|0,this._eh=this._eh+s+Ro(this._el,M)|0,this._fh=this._fh+a+Ro(this._fl,A)|0,this._gh=this._gh+d+Ro(this._gl,B)|0,this._hh=this._hh+m+Ro(this._hl,I)|0};D2.prototype._hash=function(){var t=CMe.allocUnsafe(64);function e(r,n,i){t.writeInt32BE(r,i),t.writeInt32BE(n,i+4)}return e(this._ah,this._al,0),e(this._bh,this._bl,8),e(this._ch,this._cl,16),e(this._dh,this._dl,24),e(this._eh,this._el,32),e(this._fh,this._fl,40),e(this._gh,this._gl,48),e(this._hh,this._hl,56),t};HZ.exports=D2});var JZ=H((npt,ZZ)=>{E();var UMe=It(),FMe=_k(),zMe=mm(),KMe=Fr().Buffer,GMe=new Array(160);function yS(){this.init(),this._w=GMe,zMe.call(this,128,112)}UMe(yS,FMe);yS.prototype.init=function(){return this._ah=3418070365,this._bh=1654270250,this._ch=2438529370,this._dh=355462360,this._eh=1731405415,this._fh=2394180231,this._gh=3675008525,this._hh=1203062813,this._al=3238371032,this._bl=914150663,this._cl=812702999,this._dl=4144912697,this._el=4290775857,this._fl=1750603025,this._gl=1694076839,this._hl=3204075428,this};yS.prototype._hash=function(){var t=KMe.allocUnsafe(48);function e(r,n,i){t.writeInt32BE(r,i),t.writeInt32BE(n,i+4)}return e(this._ah,this._al,0),e(this._bh,this._bl,8),e(this._ch,this._cl,16),e(this._dh,this._dl,24),e(this._eh,this._el,32),e(this._fh,this._fl,40),t};ZZ.exports=yS});var gS=H((xd,YZ)=>{E();var xd=YZ.exports=function(e){e=e.toLowerCase();var r=xd[e];if(!r)throw new Error(e+" is not supported (we accept pull requests)");return new r};xd.sha=DZ();xd.sha1=NZ();xd.sha224=UZ();xd.sha256=wk();xd.sha384=JZ();xd.sha512=_k()});var xk=H((spt,QZ)=>{E();QZ.exports=Go().EventEmitter});var iJ=H((cpt,nJ)=>{"use strict";E();function XZ(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function eJ(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?XZ(Object(r),!0).forEach(function(n){WMe(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):XZ(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function WMe(t,e,r){return e=rJ(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function VMe(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function tJ(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,rJ(n.key),n)}}function HMe(t,e,r){return e&&tJ(t.prototype,e),r&&tJ(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function rJ(t){var e=ZMe(t,"string");return typeof e=="symbol"?e:String(e)}function ZMe(t,e){if(typeof t!="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var JMe=sr(),vS=JMe.Buffer,YMe=am(),Ek=YMe.inspect,QMe=Ek&&Ek.custom||"inspect";function XMe(t,e,r){vS.prototype.copy.call(t,e,r)}nJ.exports=function(){function t(){VMe(this,t),this.head=null,this.tail=null,this.length=0}return HMe(t,[{key:"push",value:function(r){var n={data:r,next:null};this.length>0?this.tail.next=n:this.head=n,this.tail=n,++this.length}},{key:"unshift",value:function(r){var n={data:r,next:this.head};this.length===0&&(this.tail=n),this.head=n,++this.length}},{key:"shift",value:function(){if(this.length!==0){var r=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,r}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(r){if(this.length===0)return"";for(var n=this.head,i=""+n.data;n=n.next;)i+=r+n.data;return i}},{key:"concat",value:function(r){if(this.length===0)return vS.alloc(0);for(var n=vS.allocUnsafe(r>>>0),i=this.head,o=0;i;)XMe(i.data,n,o),o+=i.data.length,i=i.next;return n}},{key:"consume",value:function(r,n){var i;return r<this.head.data.length?(i=this.head.data.slice(0,r),this.head.data=this.head.data.slice(r)):r===this.head.data.length?i=this.shift():i=n?this._getString(r):this._getBuffer(r),i}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(r){var n=this.head,i=1,o=n.data;for(r-=o.length;n=n.next;){var s=n.data,a=r>s.length?s.length:r;if(a===s.length?o+=s:o+=s.slice(0,r),r-=a,r===0){a===s.length?(++i,n.next?this.head=n.next:this.head=this.tail=null):(this.head=n,n.data=s.slice(a));break}++i}return this.length-=i,o}},{key:"_getBuffer",value:function(r){var n=vS.allocUnsafe(r),i=this.head,o=1;for(i.data.copy(n),r-=i.data.length;i=i.next;){var s=i.data,a=r>s.length?s.length:r;if(s.copy(n,n.length-r,0,a),r-=a,r===0){a===s.length?(++o,i.next?this.head=i.next:this.head=this.tail=null):(this.head=i,i.data=s.slice(a));break}++o}return this.length-=o,n}},{key:QMe,value:function(r,n){return Ek(this,eJ(eJ({},n),{},{depth:0,customInspect:!1}))}}]),t}()});var Mk=H((upt,sJ)=>{"use strict";E();function e5e(t,e){var r=this,n=this._readableState&&this._readableState.destroyed,i=this._writableState&&this._writableState.destroyed;return n||i?(e?e(t):t&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,j.default.nextTick(Sk,this,t)):j.default.nextTick(Sk,this,t)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(t||null,function(o){!e&&o?r._writableState?r._writableState.errorEmitted?j.default.nextTick(bS,r):(r._writableState.errorEmitted=!0,j.default.nextTick(oJ,r,o)):j.default.nextTick(oJ,r,o):e?(j.default.nextTick(bS,r),e(o)):j.default.nextTick(bS,r)}),this)}function oJ(t,e){Sk(t,e),bS(t)}function bS(t){t._writableState&&!t._writableState.emitClose||t._readableState&&!t._readableState.emitClose||t.emit("close")}function t5e(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}function Sk(t,e){t.emit("error",e)}function r5e(t,e){var r=t._readableState,n=t._writableState;r&&r.autoDestroy||n&&n.autoDestroy?t.destroy(e):t.emit("error",e)}sJ.exports={destroy:e5e,undestroy:t5e,errorOrDestroy:r5e}});var ym=H((dpt,fJ)=>{"use strict";E();function n5e(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}var cJ={};function kc(t,e,r){r||(r=Error);function n(o,s,a){return typeof e=="string"?e:e(o,s,a)}var i=function(o){n5e(s,o);function s(a,d,m){return o.call(this,n(a,d,m))||this}return s}(r);i.prototype.name=r.name,i.prototype.code=t,cJ[t]=i}function aJ(t,e){if(Array.isArray(t)){var r=t.length;return t=t.map(function(n){return String(n)}),r>2?"one of ".concat(e," ").concat(t.slice(0,r-1).join(", "),", or ")+t[r-1]:r===2?"one of ".concat(e," ").concat(t[0]," or ").concat(t[1]):"of ".concat(e," ").concat(t[0])}else return"of ".concat(e," ").concat(String(t))}function i5e(t,e,r){return t.substr(!r||r<0?0:+r,e.length)===e}function o5e(t,e,r){return(r===void 0||r>t.length)&&(r=t.length),t.substring(r-e.length,r)===e}function s5e(t,e,r){return typeof r!="number"&&(r=0),r+e.length>t.length?!1:t.indexOf(e,r)!==-1}kc("ERR_INVALID_OPT_VALUE",function(t,e){return'The value "'+e+'" is invalid for option "'+t+'"'},TypeError);kc("ERR_INVALID_ARG_TYPE",function(t,e,r){var n;typeof e=="string"&&i5e(e,"not ")?(n="must not be",e=e.replace(/^not /,"")):n="must be";var i;if(o5e(t," argument"))i="The ".concat(t," ").concat(n," ").concat(aJ(e,"type"));else{var o=s5e(t,".")?"property":"argument";i='The "'.concat(t,'" ').concat(o," ").concat(n," ").concat(aJ(e,"type"))}return i+=". Received type ".concat(typeof r),i},TypeError);kc("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF");kc("ERR_METHOD_NOT_IMPLEMENTED",function(t){return"The "+t+" method is not implemented"});kc("ERR_STREAM_PREMATURE_CLOSE","Premature close");kc("ERR_STREAM_DESTROYED",function(t){return"Cannot call "+t+" after a stream was destroyed"});kc("ERR_MULTIPLE_CALLBACK","Callback called multiple times");kc("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable");kc("ERR_STREAM_WRITE_AFTER_END","write after end");kc("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError);kc("ERR_UNKNOWN_ENCODING",function(t){return"Unknown encoding: "+t},TypeError);kc("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event");fJ.exports.codes=cJ});var Pk=H((ppt,uJ)=>{"use strict";E();var a5e=ym().codes.ERR_INVALID_OPT_VALUE;function c5e(t,e,r){return t.highWaterMark!=null?t.highWaterMark:e?t[r]:null}function f5e(t,e,r,n){var i=c5e(e,n,r);if(i!=null){if(!(isFinite(i)&&Math.floor(i)===i)||i<0){var o=n?r:"highWaterMark";throw new a5e(o,i)}return Math.floor(i)}return t.objectMode?16:16*1024}uJ.exports={getHighWaterMark:f5e}});var Rk=H((ypt,yJ)=>{"use strict";E();yJ.exports=Pi;function dJ(t){var e=this;this.next=null,this.entry=null,this.finish=function(){j5e(e,t)}}var Tv;Pi.WritableState=j2;var u5e={deprecate:H6()},hJ=xk(),_S=sr().Buffer,l5e=(typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function d5e(t){return _S.from(t)}function h5e(t){return _S.isBuffer(t)||t instanceof l5e}var Tk=Mk(),p5e=Pk(),m5e=p5e.getHighWaterMark,rp=ym().codes,y5e=rp.ERR_INVALID_ARG_TYPE,g5e=rp.ERR_METHOD_NOT_IMPLEMENTED,v5e=rp.ERR_MULTIPLE_CALLBACK,b5e=rp.ERR_STREAM_CANNOT_PIPE,w5e=rp.ERR_STREAM_DESTROYED,_5e=rp.ERR_STREAM_NULL_VALUES,x5e=rp.ERR_STREAM_WRITE_AFTER_END,E5e=rp.ERR_UNKNOWN_ENCODING,Rv=Tk.errorOrDestroy;It()(Pi,hJ);function S5e(){}function j2(t,e,r){Tv=Tv||gm(),t=t||{},typeof r!="boolean"&&(r=e instanceof Tv),this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.writableObjectMode),this.highWaterMark=m5e(this,t,"writableHighWaterMark",r),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var n=t.decodeStrings===!1;this.decodeStrings=!n,this.defaultEncoding=t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(i){k5e(e,i)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=t.emitClose!==!1,this.autoDestroy=!!t.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new dJ(this)}j2.prototype.getBuffer=function(){for(var e=this.bufferedRequest,r=[];e;)r.push(e),e=e.next;return r};(function(){try{Object.defineProperty(j2.prototype,"buffer",{get:u5e.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}})();var wS;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(wS=Function.prototype[Symbol.hasInstance],Object.defineProperty(Pi,Symbol.hasInstance,{value:function(e){return wS.call(this,e)?!0:this!==Pi?!1:e&&e._writableState instanceof j2}})):wS=function(e){return e instanceof this};function Pi(t){Tv=Tv||gm();var e=this instanceof Tv;if(!e&&!wS.call(Pi,this))return new Pi(t);this._writableState=new j2(t,this,e),this.writable=!0,t&&(typeof t.write=="function"&&(this._write=t.write),typeof t.writev=="function"&&(this._writev=t.writev),typeof t.destroy=="function"&&(this._destroy=t.destroy),typeof t.final=="function"&&(this._final=t.final)),hJ.call(this)}Pi.prototype.pipe=function(){Rv(this,new b5e)};function M5e(t,e){var r=new x5e;Rv(t,r),j.default.nextTick(e,r)}function P5e(t,e,r,n){var i;return r===null?i=new _5e:typeof r!="string"&&!e.objectMode&&(i=new y5e("chunk",["string","Buffer"],r)),i?(Rv(t,i),j.default.nextTick(n,i),!1):!0}Pi.prototype.write=function(t,e,r){var n=this._writableState,i=!1,o=!n.objectMode&&h5e(t);return o&&!_S.isBuffer(t)&&(t=d5e(t)),typeof e=="function"&&(r=e,e=null),o?e="buffer":e||(e=n.defaultEncoding),typeof r!="function"&&(r=S5e),n.ending?M5e(this,r):(o||P5e(this,n,t,r))&&(n.pendingcb++,i=T5e(this,n,o,t,e,r)),i};Pi.prototype.cork=function(){this._writableState.corked++};Pi.prototype.uncork=function(){var t=this._writableState;t.corked&&(t.corked--,!t.writing&&!t.corked&&!t.bufferProcessing&&t.bufferedRequest&&pJ(this,t))};Pi.prototype.setDefaultEncoding=function(e){if(typeof e=="string"&&(e=e.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase())>-1))throw new E5e(e);return this._writableState.defaultEncoding=e,this};Object.defineProperty(Pi.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});function A5e(t,e,r){return!t.objectMode&&t.decodeStrings!==!1&&typeof e=="string"&&(e=_S.from(e,r)),e}Object.defineProperty(Pi.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function T5e(t,e,r,n,i,o){if(!r){var s=A5e(e,n,i);n!==s&&(r=!0,i="buffer",n=s)}var a=e.objectMode?1:n.length;e.length+=a;var d=e.length<e.highWaterMark;if(d||(e.needDrain=!0),e.writing||e.corked){var m=e.lastBufferedRequest;e.lastBufferedRequest={chunk:n,encoding:i,isBuf:r,callback:o,next:null},m?m.next=e.lastBufferedRequest:e.bufferedRequest=e.lastBufferedRequest,e.bufferedRequestCount+=1}else Ak(t,e,!1,a,n,i,o);return d}function Ak(t,e,r,n,i,o,s){e.writelen=n,e.writecb=s,e.writing=!0,e.sync=!0,e.destroyed?e.onwrite(new w5e("write")):r?t._writev(i,e.onwrite):t._write(i,o,e.onwrite),e.sync=!1}function R5e(t,e,r,n,i){--e.pendingcb,r?(j.default.nextTick(i,n),j.default.nextTick(C2,t,e),t._writableState.errorEmitted=!0,Rv(t,n)):(i(n),t._writableState.errorEmitted=!0,Rv(t,n),C2(t,e))}function I5e(t){t.writing=!1,t.writecb=null,t.length-=t.writelen,t.writelen=0}function k5e(t,e){var r=t._writableState,n=r.sync,i=r.writecb;if(typeof i!="function")throw new v5e;if(I5e(r),e)R5e(t,r,n,e,i);else{var o=mJ(r)||t.destroyed;!o&&!r.corked&&!r.bufferProcessing&&r.bufferedRequest&&pJ(t,r),n?j.default.nextTick(lJ,t,r,o,i):lJ(t,r,o,i)}}function lJ(t,e,r,n){r||O5e(t,e),e.pendingcb--,n(),C2(t,e)}function O5e(t,e){e.length===0&&e.needDrain&&(e.needDrain=!1,t.emit("drain"))}function pJ(t,e){e.bufferProcessing=!0;var r=e.bufferedRequest;if(t._writev&&r&&r.next){var n=e.bufferedRequestCount,i=new Array(n),o=e.corkedRequestsFree;o.entry=r;for(var s=0,a=!0;r;)i[s]=r,r.isBuf||(a=!1),r=r.next,s+=1;i.allBuffers=a,Ak(t,e,!0,e.length,i,"",o.finish),e.pendingcb++,e.lastBufferedRequest=null,o.next?(e.corkedRequestsFree=o.next,o.next=null):e.corkedRequestsFree=new dJ(e),e.bufferedRequestCount=0}else{for(;r;){var d=r.chunk,m=r.encoding,p=r.callback,w=e.objectMode?1:d.length;if(Ak(t,e,!1,w,d,m,p),r=r.next,e.bufferedRequestCount--,e.writing)break}r===null&&(e.lastBufferedRequest=null)}e.bufferedRequest=r,e.bufferProcessing=!1}Pi.prototype._write=function(t,e,r){r(new g5e("_write()"))};Pi.prototype._writev=null;Pi.prototype.end=function(t,e,r){var n=this._writableState;return typeof t=="function"?(r=t,t=null,e=null):typeof e=="function"&&(r=e,e=null),t!=null&&this.write(t,e),n.corked&&(n.corked=1,this.uncork()),n.ending||C5e(this,n,r),this};Object.defineProperty(Pi.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}});function mJ(t){return t.ending&&t.length===0&&t.bufferedRequest===null&&!t.finished&&!t.writing}function B5e(t,e){t._final(function(r){e.pendingcb--,r&&Rv(t,r),e.prefinished=!0,t.emit("prefinish"),C2(t,e)})}function D5e(t,e){!e.prefinished&&!e.finalCalled&&(typeof t._final=="function"&&!e.destroyed?(e.pendingcb++,e.finalCalled=!0,j.default.nextTick(B5e,t,e)):(e.prefinished=!0,t.emit("prefinish")))}function C2(t,e){var r=mJ(e);if(r&&(D5e(t,e),e.pendingcb===0&&(e.finished=!0,t.emit("finish"),e.autoDestroy))){var n=t._readableState;(!n||n.autoDestroy&&n.endEmitted)&&t.destroy()}return r}function C5e(t,e,r){e.ending=!0,C2(t,e),r&&(e.finished?j.default.nextTick(r):t.once("finish",r)),e.ended=!0,t.writable=!1}function j5e(t,e,r){var n=t.entry;for(t.entry=null;n;){var i=n.callback;e.pendingcb--,i(r),n=n.next}e.corkedRequestsFree.next=t}Object.defineProperty(Pi.prototype,"destroyed",{enumerable:!1,get:function(){return this._writableState===void 0?!1:this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}});Pi.prototype.destroy=Tk.destroy;Pi.prototype._undestroy=Tk.undestroy;Pi.prototype._destroy=function(t,e){e(t)}});var gm=H((vpt,vJ)=>{"use strict";E();var N5e=Object.keys||function(t){var e=[];for(var r in t)e.push(r);return e};vJ.exports=Fu;var gJ=Ok(),kk=Rk();It()(Fu,gJ);for(Ik=N5e(kk.prototype),xS=0;xS<Ik.length;xS++)ES=Ik[xS],Fu.prototype[ES]||(Fu.prototype[ES]=kk.prototype[ES]);var Ik,ES,xS;function Fu(t){if(!(this instanceof Fu))return new Fu(t);gJ.call(this,t),kk.call(this,t),this.allowHalfOpen=!0,t&&(t.readable===!1&&(this.readable=!1),t.writable===!1&&(this.writable=!1),t.allowHalfOpen===!1&&(this.allowHalfOpen=!1,this.once("end",q5e)))}Object.defineProperty(Fu.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});Object.defineProperty(Fu.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});Object.defineProperty(Fu.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}});function q5e(){this._writableState.ended||j.default.nextTick($5e,this)}function $5e(t){t.end()}Object.defineProperty(Fu.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set:function(e){this._readableState===void 0||this._writableState===void 0||(this._readableState.destroyed=e,this._writableState.destroyed=e)}})});var SS=H((wpt,_J)=>{"use strict";E();var bJ=ym().codes.ERR_STREAM_PREMATURE_CLOSE;function L5e(t){var e=!1;return function(){if(!e){e=!0;for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];t.apply(this,n)}}}function U5e(){}function F5e(t){return t.setHeader&&typeof t.abort=="function"}function wJ(t,e,r){if(typeof e=="function")return wJ(t,null,e);e||(e={}),r=L5e(r||U5e);var n=e.readable||e.readable!==!1&&t.readable,i=e.writable||e.writable!==!1&&t.writable,o=function(){t.writable||a()},s=t._writableState&&t._writableState.finished,a=function(){i=!1,s=!0,n||r.call(t)},d=t._readableState&&t._readableState.endEmitted,m=function(){n=!1,d=!0,i||r.call(t)},p=function(M){r.call(t,M)},w=function(){var M;if(n&&!d)return(!t._readableState||!t._readableState.ended)&&(M=new bJ),r.call(t,M);if(i&&!s)return(!t._writableState||!t._writableState.ended)&&(M=new bJ),r.call(t,M)},P=function(){t.req.on("finish",a)};return F5e(t)?(t.on("complete",a),t.on("abort",w),t.req?P():t.on("request",P)):i&&!t._writableState&&(t.on("end",o),t.on("close",o)),t.on("end",m),t.on("finish",a),e.error!==!1&&t.on("error",p),t.on("close",w),function(){t.removeListener("complete",a),t.removeListener("abort",w),t.removeListener("request",P),t.req&&t.req.removeListener("finish",a),t.removeListener("end",o),t.removeListener("close",o),t.removeListener("finish",a),t.removeListener("end",m),t.removeListener("error",p),t.removeListener("close",w)}}_J.exports=wJ});var EJ=H((xpt,xJ)=>{"use strict";E();var MS;function np(t,e,r){return e=z5e(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function z5e(t){var e=K5e(t,"string");return typeof e=="symbol"?e:String(e)}function K5e(t,e){if(typeof t!="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var G5e=SS(),ip=Symbol("lastResolve"),vm=Symbol("lastReject"),N2=Symbol("error"),PS=Symbol("ended"),bm=Symbol("lastPromise"),Bk=Symbol("handlePromise"),wm=Symbol("stream");function op(t,e){return{value:t,done:e}}function W5e(t){var e=t[ip];if(e!==null){var r=t[wm].read();r!==null&&(t[bm]=null,t[ip]=null,t[vm]=null,e(op(r,!1)))}}function V5e(t){j.default.nextTick(W5e,t)}function H5e(t,e){return function(r,n){t.then(function(){if(e[PS]){r(op(void 0,!0));return}e[Bk](r,n)},n)}}var Z5e=Object.getPrototypeOf(function(){}),J5e=Object.setPrototypeOf((MS={get stream(){return this[wm]},next:function(){var e=this,r=this[N2];if(r!==null)return Promise.reject(r);if(this[PS])return Promise.resolve(op(void 0,!0));if(this[wm].destroyed)return new Promise(function(s,a){j.default.nextTick(function(){e[N2]?a(e[N2]):s(op(void 0,!0))})});var n=this[bm],i;if(n)i=new Promise(H5e(n,this));else{var o=this[wm].read();if(o!==null)return Promise.resolve(op(o,!1));i=new Promise(this[Bk])}return this[bm]=i,i}},np(MS,Symbol.asyncIterator,function(){return this}),np(MS,"return",function(){var e=this;return new Promise(function(r,n){e[wm].destroy(null,function(i){if(i){n(i);return}r(op(void 0,!0))})})}),MS),Z5e),Y5e=function(e){var r,n=Object.create(J5e,(r={},np(r,wm,{value:e,writable:!0}),np(r,ip,{value:null,writable:!0}),np(r,vm,{value:null,writable:!0}),np(r,N2,{value:null,writable:!0}),np(r,PS,{value:e._readableState.endEmitted,writable:!0}),np(r,Bk,{value:function(o,s){var a=n[wm].read();a?(n[bm]=null,n[ip]=null,n[vm]=null,o(op(a,!1))):(n[ip]=o,n[vm]=s)},writable:!0}),r));return n[bm]=null,G5e(e,function(i){if(i&&i.code!=="ERR_STREAM_PREMATURE_CLOSE"){var o=n[vm];o!==null&&(n[bm]=null,n[ip]=null,n[vm]=null,o(i)),n[N2]=i;return}var s=n[ip];s!==null&&(n[bm]=null,n[ip]=null,n[vm]=null,s(op(void 0,!0))),n[PS]=!0}),e.on("readable",V5e.bind(null,n)),n};xJ.exports=Y5e});var MJ=H((Spt,SJ)=>{E();SJ.exports=function(){throw new Error("Readable.from is not available in the browser")}});var Ok=H((Apt,CJ)=>{"use strict";E();CJ.exports=Yr;var Iv;Yr.ReadableState=RJ;var Ppt=Go().EventEmitter,TJ=function(e,r){return e.listeners(r).length},$2=xk(),AS=sr().Buffer,Q5e=(typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function X5e(t){return AS.from(t)}function e8e(t){return AS.isBuffer(t)||t instanceof Q5e}var Dk=am(),Mr;Dk&&Dk.debuglog?Mr=Dk.debuglog("stream"):Mr=function(){};var t8e=iJ(),Uk=Mk(),r8e=Pk(),n8e=r8e.getHighWaterMark,TS=ym().codes,i8e=TS.ERR_INVALID_ARG_TYPE,o8e=TS.ERR_STREAM_PUSH_AFTER_EOF,s8e=TS.ERR_METHOD_NOT_IMPLEMENTED,a8e=TS.ERR_STREAM_UNSHIFT_AFTER_END_EVENT,kv,Ck,jk;It()(Yr,$2);var q2=Uk.errorOrDestroy,Nk=["error","close","destroy","pause","resume"];function c8e(t,e,r){if(typeof t.prependListener=="function")return t.prependListener(e,r);!t._events||!t._events[e]?t.on(e,r):Array.isArray(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]}function RJ(t,e,r){Iv=Iv||gm(),t=t||{},typeof r!="boolean"&&(r=e instanceof Iv),this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.readableObjectMode),this.highWaterMark=n8e(this,t,"readableHighWaterMark",r),this.buffer=new t8e,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=t.emitClose!==!1,this.autoDestroy=!!t.autoDestroy,this.destroyed=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(kv||(kv=Uu().StringDecoder),this.decoder=new kv(t.encoding),this.encoding=t.encoding)}function Yr(t){if(Iv=Iv||gm(),!(this instanceof Yr))return new Yr(t);var e=this instanceof Iv;this._readableState=new RJ(t,this,e),this.readable=!0,t&&(typeof t.read=="function"&&(this._read=t.read),typeof t.destroy=="function"&&(this._destroy=t.destroy)),$2.call(this)}Object.defineProperty(Yr.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0?!1:this._readableState.destroyed},set:function(e){this._readableState&&(this._readableState.destroyed=e)}});Yr.prototype.destroy=Uk.destroy;Yr.prototype._undestroy=Uk.undestroy;Yr.prototype._destroy=function(t,e){e(t)};Yr.prototype.push=function(t,e){var r=this._readableState,n;return r.objectMode?n=!0:typeof t=="string"&&(e=e||r.defaultEncoding,e!==r.encoding&&(t=AS.from(t,e),e=""),n=!0),IJ(this,t,e,!1,n)};Yr.prototype.unshift=function(t){return IJ(this,t,null,!0,!1)};function IJ(t,e,r,n,i){Mr("readableAddChunk",e);var o=t._readableState;if(e===null)o.reading=!1,l8e(t,o);else{var s;if(i||(s=f8e(o,e)),s)q2(t,s);else if(o.objectMode||e&&e.length>0)if(typeof e!="string"&&!o.objectMode&&Object.getPrototypeOf(e)!==AS.prototype&&(e=X5e(e)),n)o.endEmitted?q2(t,new a8e):qk(t,o,e,!0);else if(o.ended)q2(t,new o8e);else{if(o.destroyed)return!1;o.reading=!1,o.decoder&&!r?(e=o.decoder.write(e),o.objectMode||e.length!==0?qk(t,o,e,!1):Lk(t,o)):qk(t,o,e,!1)}else n||(o.reading=!1,Lk(t,o))}return!o.ended&&(o.length<o.highWaterMark||o.length===0)}function qk(t,e,r,n){e.flowing&&e.length===0&&!e.sync?(e.awaitDrain=0,t.emit("data",r)):(e.length+=e.objectMode?1:r.length,n?e.buffer.unshift(r):e.buffer.push(r),e.needReadable&&RS(t)),Lk(t,e)}function f8e(t,e){var r;return!e8e(e)&&typeof e!="string"&&e!==void 0&&!t.objectMode&&(r=new i8e("chunk",["string","Buffer","Uint8Array"],e)),r}Yr.prototype.isPaused=function(){return this._readableState.flowing===!1};Yr.prototype.setEncoding=function(t){kv||(kv=Uu().StringDecoder);var e=new kv(t);this._readableState.decoder=e,this._readableState.encoding=this._readableState.decoder.encoding;for(var r=this._readableState.buffer.head,n="";r!==null;)n+=e.write(r.data),r=r.next;return this._readableState.buffer.clear(),n!==""&&this._readableState.buffer.push(n),this._readableState.length=n.length,this};var PJ=1073741824;function u8e(t){return t>=PJ?t=PJ:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}function AJ(t,e){return t<=0||e.length===0&&e.ended?0:e.objectMode?1:t!==t?e.flowing&&e.length?e.buffer.head.data.length:e.length:(t>e.highWaterMark&&(e.highWaterMark=u8e(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}Yr.prototype.read=function(t){Mr("read",t),t=parseInt(t,10);var e=this._readableState,r=t;if(t!==0&&(e.emittedReadable=!1),t===0&&e.needReadable&&((e.highWaterMark!==0?e.length>=e.highWaterMark:e.length>0)||e.ended))return Mr("read: emitReadable",e.length,e.ended),e.length===0&&e.ended?$k(this):RS(this),null;if(t=AJ(t,e),t===0&&e.ended)return e.length===0&&$k(this),null;var n=e.needReadable;Mr("need readable",n),(e.length===0||e.length-t<e.highWaterMark)&&(n=!0,Mr("length less than watermark",n)),e.ended||e.reading?(n=!1,Mr("reading or ended",n)):n&&(Mr("do read"),e.reading=!0,e.sync=!0,e.length===0&&(e.needReadable=!0),this._read(e.highWaterMark),e.sync=!1,e.reading||(t=AJ(r,e)));var i;return t>0?i=BJ(t,e):i=null,i===null?(e.needReadable=e.length<=e.highWaterMark,t=0):(e.length-=t,e.awaitDrain=0),e.length===0&&(e.ended||(e.needReadable=!0),r!==t&&e.ended&&$k(this)),i!==null&&this.emit("data",i),i};function l8e(t,e){if(Mr("onEofChunk"),!e.ended){if(e.decoder){var r=e.decoder.end();r&&r.length&&(e.buffer.push(r),e.length+=e.objectMode?1:r.length)}e.ended=!0,e.sync?RS(t):(e.needReadable=!1,e.emittedReadable||(e.emittedReadable=!0,kJ(t)))}}function RS(t){var e=t._readableState;Mr("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||(Mr("emitReadable",e.flowing),e.emittedReadable=!0,j.default.nextTick(kJ,t))}function kJ(t){var e=t._readableState;Mr("emitReadable_",e.destroyed,e.length,e.ended),!e.destroyed&&(e.length||e.ended)&&(t.emit("readable"),e.emittedReadable=!1),e.needReadable=!e.flowing&&!e.ended&&e.length<=e.highWaterMark,Fk(t)}function Lk(t,e){e.readingMore||(e.readingMore=!0,j.default.nextTick(d8e,t,e))}function d8e(t,e){for(;!e.reading&&!e.ended&&(e.length<e.highWaterMark||e.flowing&&e.length===0);){var r=e.length;if(Mr("maybeReadMore read 0"),t.read(0),r===e.length)break}e.readingMore=!1}Yr.prototype._read=function(t){q2(this,new s8e("_read()"))};Yr.prototype.pipe=function(t,e){var r=this,n=this._readableState;switch(n.pipesCount){case 0:n.pipes=t;break;case 1:n.pipes=[n.pipes,t];break;default:n.pipes.push(t);break}n.pipesCount+=1,Mr("pipe count=%d opts=%j",n.pipesCount,e);var i=(!e||e.end!==!1)&&t!==j.default.stdout&&t!==j.default.stderr,o=i?a:A;n.endEmitted?j.default.nextTick(o):r.once("end",o),t.on("unpipe",s);function s(B,I){Mr("onunpipe"),B===r&&I&&I.hasUnpiped===!1&&(I.hasUnpiped=!0,p())}function a(){Mr("onend"),t.end()}var d=h8e(r);t.on("drain",d);var m=!1;function p(){Mr("cleanup"),t.removeListener("close",S),t.removeListener("finish",M),t.removeListener("drain",d),t.removeListener("error",P),t.removeListener("unpipe",s),r.removeListener("end",a),r.removeListener("end",A),r.removeListener("data",w),m=!0,n.awaitDrain&&(!t._writableState||t._writableState.needDrain)&&d()}r.on("data",w);function w(B){Mr("ondata");var I=t.write(B);Mr("dest.write",I),I===!1&&((n.pipesCount===1&&n.pipes===t||n.pipesCount>1&&DJ(n.pipes,t)!==-1)&&!m&&(Mr("false write response, pause",n.awaitDrain),n.awaitDrain++),r.pause())}function P(B){Mr("onerror",B),A(),t.removeListener("error",P),TJ(t,"error")===0&&q2(t,B)}c8e(t,"error",P);function S(){t.removeListener("finish",M),A()}t.once("close",S);function M(){Mr("onfinish"),t.removeListener("close",S),A()}t.once("finish",M);function A(){Mr("unpipe"),r.unpipe(t)}return t.emit("pipe",r),n.flowing||(Mr("pipe resume"),r.resume()),t};function h8e(t){return function(){var r=t._readableState;Mr("pipeOnDrain",r.awaitDrain),r.awaitDrain&&r.awaitDrain--,r.awaitDrain===0&&TJ(t,"data")&&(r.flowing=!0,Fk(t))}}Yr.prototype.unpipe=function(t){var e=this._readableState,r={hasUnpiped:!1};if(e.pipesCount===0)return this;if(e.pipesCount===1)return t&&t!==e.pipes?this:(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this,r),this);if(!t){var n=e.pipes,i=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var o=0;o<i;o++)n[o].emit("unpipe",this,{hasUnpiped:!1});return this}var s=DJ(e.pipes,t);return s===-1?this:(e.pipes.splice(s,1),e.pipesCount-=1,e.pipesCount===1&&(e.pipes=e.pipes[0]),t.emit("unpipe",this,r),this)};Yr.prototype.on=function(t,e){var r=$2.prototype.on.call(this,t,e),n=this._readableState;return t==="data"?(n.readableListening=this.listenerCount("readable")>0,n.flowing!==!1&&this.resume()):t==="readable"&&!n.endEmitted&&!n.readableListening&&(n.readableListening=n.needReadable=!0,n.flowing=!1,n.emittedReadable=!1,Mr("on readable",n.length,n.reading),n.length?RS(this):n.reading||j.default.nextTick(p8e,this)),r};Yr.prototype.addListener=Yr.prototype.on;Yr.prototype.removeListener=function(t,e){var r=$2.prototype.removeListener.call(this,t,e);return t==="readable"&&j.default.nextTick(OJ,this),r};Yr.prototype.removeAllListeners=function(t){var e=$2.prototype.removeAllListeners.apply(this,arguments);return(t==="readable"||t===void 0)&&j.default.nextTick(OJ,this),e};function OJ(t){var e=t._readableState;e.readableListening=t.listenerCount("readable")>0,e.resumeScheduled&&!e.paused?e.flowing=!0:t.listenerCount("data")>0&&t.resume()}function p8e(t){Mr("readable nexttick read 0"),t.read(0)}Yr.prototype.resume=function(){var t=this._readableState;return t.flowing||(Mr("resume"),t.flowing=!t.readableListening,m8e(this,t)),t.paused=!1,this};function m8e(t,e){e.resumeScheduled||(e.resumeScheduled=!0,j.default.nextTick(y8e,t,e))}function y8e(t,e){Mr("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),Fk(t),e.flowing&&!e.reading&&t.read(0)}Yr.prototype.pause=function(){return Mr("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(Mr("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this};function Fk(t){var e=t._readableState;for(Mr("flow",e.flowing);e.flowing&&t.read()!==null;);}Yr.prototype.wrap=function(t){var e=this,r=this._readableState,n=!1;t.on("end",function(){if(Mr("wrapped end"),r.decoder&&!r.ended){var s=r.decoder.end();s&&s.length&&e.push(s)}e.push(null)}),t.on("data",function(s){if(Mr("wrapped data"),r.decoder&&(s=r.decoder.write(s)),!(r.objectMode&&s==null)&&!(!r.objectMode&&(!s||!s.length))){var a=e.push(s);a||(n=!0,t.pause())}});for(var i in t)this[i]===void 0&&typeof t[i]=="function"&&(this[i]=function(a){return function(){return t[a].apply(t,arguments)}}(i));for(var o=0;o<Nk.length;o++)t.on(Nk[o],this.emit.bind(this,Nk[o]));return this._read=function(s){Mr("wrapped _read",s),n&&(n=!1,t.resume())},this};typeof Symbol=="function"&&(Yr.prototype[Symbol.asyncIterator]=function(){return Ck===void 0&&(Ck=EJ()),Ck(this)});Object.defineProperty(Yr.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}});Object.defineProperty(Yr.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}});Object.defineProperty(Yr.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(e){this._readableState&&(this._readableState.flowing=e)}});Yr._fromList=BJ;Object.defineProperty(Yr.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}});function BJ(t,e){if(e.length===0)return null;var r;return e.objectMode?r=e.buffer.shift():!t||t>=e.length?(e.decoder?r=e.buffer.join(""):e.buffer.length===1?r=e.buffer.first():r=e.buffer.concat(e.length),e.buffer.clear()):r=e.buffer.consume(t,e.decoder),r}function $k(t){var e=t._readableState;Mr("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,j.default.nextTick(g8e,e,t))}function g8e(t,e){if(Mr("endReadableNT",t.endEmitted,t.length),!t.endEmitted&&t.length===0&&(t.endEmitted=!0,e.readable=!1,e.emit("end"),t.autoDestroy)){var r=e._writableState;(!r||r.autoDestroy&&r.finished)&&e.destroy()}}typeof Symbol=="function"&&(Yr.from=function(t,e){return jk===void 0&&(jk=MJ()),jk(Yr,t,e)});function DJ(t,e){for(var r=0,n=t.length;r<n;r++)if(t[r]===e)return r;return-1}});var zk=H((Rpt,NJ)=>{"use strict";E();NJ.exports=Ed;var IS=ym().codes,v8e=IS.ERR_METHOD_NOT_IMPLEMENTED,b8e=IS.ERR_MULTIPLE_CALLBACK,w8e=IS.ERR_TRANSFORM_ALREADY_TRANSFORMING,_8e=IS.ERR_TRANSFORM_WITH_LENGTH_0,kS=gm();It()(Ed,kS);function x8e(t,e){var r=this._transformState;r.transforming=!1;var n=r.writecb;if(n===null)return this.emit("error",new b8e);r.writechunk=null,r.writecb=null,e!=null&&this.push(e),n(t);var i=this._readableState;i.reading=!1,(i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}function Ed(t){if(!(this instanceof Ed))return new Ed(t);kS.call(this,t),this._transformState={afterTransform:x8e.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,t&&(typeof t.transform=="function"&&(this._transform=t.transform),typeof t.flush=="function"&&(this._flush=t.flush)),this.on("prefinish",E8e)}function E8e(){var t=this;typeof this._flush=="function"&&!this._readableState.destroyed?this._flush(function(e,r){jJ(t,e,r)}):jJ(this,null,null)}Ed.prototype.push=function(t,e){return this._transformState.needTransform=!1,kS.prototype.push.call(this,t,e)};Ed.prototype._transform=function(t,e,r){r(new v8e("_transform()"))};Ed.prototype._write=function(t,e,r){var n=this._transformState;if(n.writecb=r,n.writechunk=t,n.writeencoding=e,!n.transforming){var i=this._readableState;(n.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}};Ed.prototype._read=function(t){var e=this._transformState;e.writechunk!==null&&!e.transforming?(e.transforming=!0,this._transform(e.writechunk,e.writeencoding,e.afterTransform)):e.needTransform=!0};Ed.prototype._destroy=function(t,e){kS.prototype._destroy.call(this,t,function(r){e(r)})};function jJ(t,e,r){if(e)return t.emit("error",e);if(r!=null&&t.push(r),t._writableState.length)throw new _8e;if(t._transformState.transforming)throw new w8e;return t.push(null)}});var LJ=H((kpt,$J)=>{"use strict";E();$J.exports=L2;var qJ=zk();It()(L2,qJ);function L2(t){if(!(this instanceof L2))return new L2(t);qJ.call(this,t)}L2.prototype._transform=function(t,e,r){r(null,t)}});var GJ=H((Bpt,KJ)=>{"use strict";E();var Kk;function S8e(t){var e=!1;return function(){e||(e=!0,t.apply(void 0,arguments))}}var zJ=ym().codes,M8e=zJ.ERR_MISSING_ARGS,P8e=zJ.ERR_STREAM_DESTROYED;function UJ(t){if(t)throw t}function A8e(t){return t.setHeader&&typeof t.abort=="function"}function T8e(t,e,r,n){n=S8e(n);var i=!1;t.on("close",function(){i=!0}),Kk===void 0&&(Kk=SS()),Kk(t,{readable:e,writable:r},function(s){if(s)return n(s);i=!0,n()});var o=!1;return function(s){if(!i&&!o){if(o=!0,A8e(t))return t.abort();if(typeof t.destroy=="function")return t.destroy();n(s||new P8e("pipe"))}}}function FJ(t){t()}function R8e(t,e){return t.pipe(e)}function I8e(t){return!t.length||typeof t[t.length-1]!="function"?UJ:t.pop()}function k8e(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];var n=I8e(e);if(Array.isArray(e[0])&&(e=e[0]),e.length<2)throw new M8e("streams");var i,o=e.map(function(s,a){var d=a<e.length-1,m=a>0;return T8e(s,d,m,function(p){i||(i=p),p&&o.forEach(FJ),!d&&(o.forEach(FJ),n(i))})});return e.reduce(R8e)}KJ.exports=k8e});var VJ=H((Cpt,WJ)=>{E();WJ.exports=Oc;var Gk=Go().EventEmitter,O8e=It();O8e(Oc,Gk);Oc.Readable=Ok();Oc.Writable=Rk();Oc.Duplex=gm();Oc.Transform=zk();Oc.PassThrough=LJ();Oc.finished=SS();Oc.pipeline=GJ();Oc.Stream=Oc;function Oc(){Gk.call(this)}Oc.prototype.pipe=function(t,e){var r=this;function n(p){t.writable&&t.write(p)===!1&&r.pause&&r.pause()}r.on("data",n);function i(){r.readable&&r.resume&&r.resume()}t.on("drain",i),!t._isStdio&&(!e||e.end!==!1)&&(r.on("end",s),r.on("close",a));var o=!1;function s(){o||(o=!0,t.end())}function a(){o||(o=!0,typeof t.destroy=="function"&&t.destroy())}function d(p){if(m(),Gk.listenerCount(this,"error")===0)throw p}r.on("error",d),t.on("error",d);function m(){r.removeListener("data",n),t.removeListener("drain",i),r.removeListener("end",s),r.removeListener("close",a),r.removeListener("error",d),t.removeListener("error",d),r.removeListener("end",m),r.removeListener("close",m),t.removeListener("close",m)}return r.on("end",m),r.on("close",m),t.on("close",m),t.emit("pipe",r),t}});var Sd=H((Npt,JJ)=>{E();var HJ=Fr().Buffer,ZJ=VJ().Transform,B8e=Uu().StringDecoder,D8e=It();function kf(t){ZJ.call(this),this.hashMode=typeof t=="string",this.hashMode?this[t]=this._finalOrDigest:this.final=this._finalOrDigest,this._final&&(this.__final=this._final,this._final=null),this._decoder=null,this._encoding=null}D8e(kf,ZJ);kf.prototype.update=function(t,e,r){typeof t=="string"&&(t=HJ.from(t,e));var n=this._update(t);return this.hashMode?this:(r&&(n=this._toString(n,r)),n)};kf.prototype.setAutoPadding=function(){};kf.prototype.getAuthTag=function(){throw new Error("trying to get auth tag in unsupported state")};kf.prototype.setAuthTag=function(){throw new Error("trying to set auth tag in unsupported state")};kf.prototype.setAAD=function(){throw new Error("trying to set aad in unsupported state")};kf.prototype._transform=function(t,e,r){var n;try{this.hashMode?this._update(t):this.push(this._update(t))}catch(i){n=i}finally{r(n)}};kf.prototype._flush=function(t){var e;try{this.push(this.__final())}catch(r){e=r}t(e)};kf.prototype._finalOrDigest=function(t){var e=this.__final()||HJ.alloc(0);return t&&(e=this._toString(e,t,!0)),e};kf.prototype._toString=function(t,e,r){if(this._decoder||(this._decoder=new B8e(e),this._encoding=e),this._encoding!==e)throw new Error("can't switch encodings");var n=this._decoder.write(t);return r&&(n+=this._decoder.end()),n};JJ.exports=kf});var Ov=H(($pt,QJ)=>{"use strict";E();var C8e=It(),j8e=lS(),N8e=hS(),q8e=gS(),YJ=Sd();function OS(t){YJ.call(this,"digest"),this._hash=t}C8e(OS,YJ);OS.prototype._update=function(t){this._hash.update(t)};OS.prototype._final=function(){return this._hash.digest()};QJ.exports=function(e){return e=e.toLowerCase(),e==="md5"?new j8e:e==="rmd160"||e==="ripemd160"?new N8e:new OS(q8e(e))}});var tY=H((Upt,eY)=>{"use strict";E();var $8e=It(),_m=Fr().Buffer,XJ=Sd(),L8e=_m.alloc(128),Bv=64;function BS(t,e){XJ.call(this,"digest"),typeof e=="string"&&(e=_m.from(e)),this._alg=t,this._key=e,e.length>Bv?e=t(e):e.length<Bv&&(e=_m.concat([e,L8e],Bv));for(var r=this._ipad=_m.allocUnsafe(Bv),n=this._opad=_m.allocUnsafe(Bv),i=0;i<Bv;i++)r[i]=e[i]^54,n[i]=e[i]^92;this._hash=[r]}$8e(BS,XJ);BS.prototype._update=function(t){this._hash.push(t)};BS.prototype._final=function(){var t=this._alg(_m.concat(this._hash));return this._alg(_m.concat([this._opad,t]))};eY.exports=BS});var Wk=H((zpt,rY)=>{E();var U8e=lS();rY.exports=function(t){return new U8e().update(t).digest()}});var Zk=H((Gpt,iY)=>{"use strict";E();var F8e=It(),z8e=tY(),nY=Sd(),U2=Fr().Buffer,K8e=Wk(),Vk=hS(),Hk=gS(),G8e=U2.alloc(128);function F2(t,e){nY.call(this,"digest"),typeof e=="string"&&(e=U2.from(e));var r=t==="sha512"||t==="sha384"?128:64;if(this._alg=t,this._key=e,e.length>r){var n=t==="rmd160"?new Vk:Hk(t);e=n.update(e).digest()}else e.length<r&&(e=U2.concat([e,G8e],r));for(var i=this._ipad=U2.allocUnsafe(r),o=this._opad=U2.allocUnsafe(r),s=0;s<r;s++)i[s]=e[s]^54,o[s]=e[s]^92;this._hash=t==="rmd160"?new Vk:Hk(t),this._hash.update(i)}F8e(F2,nY);F2.prototype._update=function(t){this._hash.update(t)};F2.prototype._final=function(){var t=this._hash.digest(),e=this._alg==="rmd160"?new Vk:Hk(this._alg);return e.update(this._opad).update(t).digest()};iY.exports=function(e,r){return e=e.toLowerCase(),e==="rmd160"||e==="ripemd160"?new F2("rmd160",r):e==="md5"?new z8e(K8e,r):new F2(e,r)}});var Jk=H((Vpt,W8e)=>{W8e.exports={sha224WithRSAEncryption:{sign:"rsa",hash:"sha224",id:"302d300d06096086480165030402040500041c"},"RSA-SHA224":{sign:"ecdsa/rsa",hash:"sha224",id:"302d300d06096086480165030402040500041c"},sha256WithRSAEncryption:{sign:"rsa",hash:"sha256",id:"3031300d060960864801650304020105000420"},"RSA-SHA256":{sign:"ecdsa/rsa",hash:"sha256",id:"3031300d060960864801650304020105000420"},sha384WithRSAEncryption:{sign:"rsa",hash:"sha384",id:"3041300d060960864801650304020205000430"},"RSA-SHA384":{sign:"ecdsa/rsa",hash:"sha384",id:"3041300d060960864801650304020205000430"},sha512WithRSAEncryption:{sign:"rsa",hash:"sha512",id:"3051300d060960864801650304020305000440"},"RSA-SHA512":{sign:"ecdsa/rsa",hash:"sha512",id:"3051300d060960864801650304020305000440"},"RSA-SHA1":{sign:"rsa",hash:"sha1",id:"3021300906052b0e03021a05000414"},"ecdsa-with-SHA1":{sign:"ecdsa",hash:"sha1",id:""},sha256:{sign:"ecdsa",hash:"sha256",id:""},sha224:{sign:"ecdsa",hash:"sha224",id:""},sha384:{sign:"ecdsa",hash:"sha384",id:""},sha512:{sign:"ecdsa",hash:"sha512",id:""},"DSA-SHA":{sign:"dsa",hash:"sha1",id:""},"DSA-SHA1":{sign:"dsa",hash:"sha1",id:""},DSA:{sign:"dsa",hash:"sha1",id:""},"DSA-WITH-SHA224":{sign:"dsa",hash:"sha224",id:""},"DSA-SHA224":{sign:"dsa",hash:"sha224",id:""},"DSA-WITH-SHA256":{sign:"dsa",hash:"sha256",id:""},"DSA-SHA256":{sign:"dsa",hash:"sha256",id:""},"DSA-WITH-SHA384":{sign:"dsa",hash:"sha384",id:""},"DSA-SHA384":{sign:"dsa",hash:"sha384",id:""},"DSA-WITH-SHA512":{sign:"dsa",hash:"sha512",id:""},"DSA-SHA512":{sign:"dsa",hash:"sha512",id:""},"DSA-RIPEMD160":{sign:"dsa",hash:"rmd160",id:""},ripemd160WithRSA:{sign:"rsa",hash:"rmd160",id:"3021300906052b2403020105000414"},"RSA-RIPEMD160":{sign:"rsa",hash:"rmd160",id:"3021300906052b2403020105000414"},md5WithRSAEncryption:{sign:"rsa",hash:"md5",id:"3020300c06082a864886f70d020505000410"},"RSA-MD5":{sign:"rsa",hash:"md5",id:"3020300c06082a864886f70d020505000410"}}});var sY=H((Hpt,oY)=>{"use strict";E();oY.exports=Jk()});var Yk=H((Jpt,aY)=>{E();var V8e=Math.pow(2,30)-1;aY.exports=function(t,e){if(typeof t!="number")throw new TypeError("Iterations not a number");if(t<0)throw new TypeError("Bad iterations");if(typeof e!="number")throw new TypeError("Key length not a number");if(e<0||e>V8e||e!==e)throw new TypeError("Bad key length")}});var Qk=H((Qpt,fY)=>{E();var DS;globalThis.process&&globalThis.process.browser?DS="utf-8":globalThis.process&&globalThis.process.version?(cY=parseInt(j.default.version.split(".")[0].slice(1),10),DS=cY>=6?"utf-8":"binary"):DS="utf-8";var cY;fY.exports=DS});var e9=H((e0t,uY)=>{E();var Xk=Fr().Buffer;uY.exports=function(t,e,r){if(Xk.isBuffer(t))return t;if(typeof t=="string")return Xk.from(t,e);if(ArrayBuffer.isView(t))return Xk.from(t.buffer);throw new TypeError(r+" must be a string, a Buffer, a typed array or a DataView")}});var t9=H((r0t,pY)=>{E();var H8e=Wk(),Z8e=hS(),J8e=gS(),xm=Fr().Buffer,Y8e=Yk(),lY=Qk(),dY=e9(),Q8e=xm.alloc(128),CS={md5:16,sha1:20,sha224:28,sha256:32,sha384:48,sha512:64,rmd160:20,ripemd160:20};function hY(t,e,r){var n=X8e(t),i=t==="sha512"||t==="sha384"?128:64;e.length>i?e=n(e):e.length<i&&(e=xm.concat([e,Q8e],i));for(var o=xm.allocUnsafe(i+CS[t]),s=xm.allocUnsafe(i+CS[t]),a=0;a<i;a++)o[a]=e[a]^54,s[a]=e[a]^92;var d=xm.allocUnsafe(i+r+4);o.copy(d,0,0,i),this.ipad1=d,this.ipad2=o,this.opad=s,this.alg=t,this.blocksize=i,this.hash=n,this.size=CS[t]}hY.prototype.run=function(t,e){t.copy(e,this.blocksize);var r=this.hash(e);return r.copy(this.opad,this.blocksize),this.hash(this.opad)};function X8e(t){function e(n){return J8e(t).update(n).digest()}function r(n){return new Z8e().update(n).digest()}return t==="rmd160"||t==="ripemd160"?r:t==="md5"?H8e:e}function e4e(t,e,r,n,i){Y8e(r,n),t=dY(t,lY,"Password"),e=dY(e,lY,"Salt"),i=i||"sha1";var o=new hY(i,t,e.length),s=xm.allocUnsafe(n),a=xm.allocUnsafe(e.length+4);e.copy(a,0,0,e.length);for(var d=0,m=CS[i],p=Math.ceil(n/m),w=1;w<=p;w++){a.writeUInt32BE(w,e.length);for(var P=o.run(a,o.ipad1),S=P,M=1;M<r;M++){S=o.run(S,o.ipad2);for(var A=0;A<m;A++)P[A]^=S[A]}P.copy(s,d),d+=m}return s}pY.exports=e4e});var _Y=H((i0t,wY)=>{E();var vY=Fr().Buffer,t4e=Yk(),mY=Qk(),yY=t9(),gY=e9(),jS,z2=globalThis.crypto&&globalThis.crypto.subtle,r4e={sha:"SHA-1","sha-1":"SHA-1",sha1:"SHA-1",sha256:"SHA-256","sha-256":"SHA-256",sha384:"SHA-384","sha-384":"SHA-384","sha-512":"SHA-512",sha512:"SHA-512"},r9=[];function n4e(t){if(globalThis.process&&!globalThis.process.browser||!z2||!z2.importKey||!z2.deriveBits)return Promise.resolve(!1);if(r9[t]!==void 0)return r9[t];jS=jS||vY.alloc(8);var e=bY(jS,jS,10,128,t).then(function(){return!0}).catch(function(){return!1});return r9[t]=e,e}var Em;function n9(){return Em||(globalThis.process&&globalThis.process.nextTick?Em=globalThis.process.nextTick:globalThis.queueMicrotask?Em=globalThis.queueMicrotask:globalThis.setImmediate?Em=globalThis.setImmediate:Em=globalThis.setTimeout,Em)}function bY(t,e,r,n,i){return z2.importKey("raw",t,{name:"PBKDF2"},!1,["deriveBits"]).then(function(o){return z2.deriveBits({name:"PBKDF2",salt:e,iterations:r,hash:{name:i}},o,n<<3)}).then(function(o){return vY.from(o)})}function i4e(t,e){t.then(function(r){n9()(function(){e(null,r)})},function(r){n9()(function(){e(r)})})}wY.exports=function(t,e,r,n,i,o){typeof i=="function"&&(o=i,i=void 0),i=i||"sha1";var s=r4e[i.toLowerCase()];if(!s||typeof globalThis.Promise!="function"){n9()(function(){var a;try{a=yY(t,e,r,n,i)}catch(d){return o(d)}o(null,a)});return}if(t4e(r,n),t=gY(t,mY,"Password"),e=gY(e,mY,"Salt"),typeof o!="function")throw new Error("No callback provided to pbkdf2");i4e(n4e(s).then(function(a){return a?bY(t,e,r,n,s):yY(t,e,r,n,i)}),o)}});var o9=H(i9=>{E();i9.pbkdf2=_Y();i9.pbkdf2Sync=t9()});var s9=H(Bc=>{"use strict";E();Bc.readUInt32BE=function(e,r){var n=e[0+r]<<24|e[1+r]<<16|e[2+r]<<8|e[3+r];return n>>>0};Bc.writeUInt32BE=function(e,r,n){e[0+n]=r>>>24,e[1+n]=r>>>16&255,e[2+n]=r>>>8&255,e[3+n]=r&255};Bc.ip=function(e,r,n,i){for(var o=0,s=0,a=6;a>=0;a-=2){for(var d=0;d<=24;d+=8)o<<=1,o|=r>>>d+a&1;for(var d=0;d<=24;d+=8)o<<=1,o|=e>>>d+a&1}for(var a=6;a>=0;a-=2){for(var d=1;d<=25;d+=8)s<<=1,s|=r>>>d+a&1;for(var d=1;d<=25;d+=8)s<<=1,s|=e>>>d+a&1}n[i+0]=o>>>0,n[i+1]=s>>>0};Bc.rip=function(e,r,n,i){for(var o=0,s=0,a=0;a<4;a++)for(var d=24;d>=0;d-=8)o<<=1,o|=r>>>d+a&1,o<<=1,o|=e>>>d+a&1;for(var a=4;a<8;a++)for(var d=24;d>=0;d-=8)s<<=1,s|=r>>>d+a&1,s<<=1,s|=e>>>d+a&1;n[i+0]=o>>>0,n[i+1]=s>>>0};Bc.pc1=function(e,r,n,i){for(var o=0,s=0,a=7;a>=5;a--){for(var d=0;d<=24;d+=8)o<<=1,o|=r>>d+a&1;for(var d=0;d<=24;d+=8)o<<=1,o|=e>>d+a&1}for(var d=0;d<=24;d+=8)o<<=1,o|=r>>d+a&1;for(var a=1;a<=3;a++){for(var d=0;d<=24;d+=8)s<<=1,s|=r>>d+a&1;for(var d=0;d<=24;d+=8)s<<=1,s|=e>>d+a&1}for(var d=0;d<=24;d+=8)s<<=1,s|=e>>d+a&1;n[i+0]=o>>>0,n[i+1]=s>>>0};Bc.r28shl=function(e,r){return e<<r&268435455|e>>>28-r};var NS=[14,11,17,4,27,23,25,0,13,22,7,18,5,9,16,24,2,20,12,21,1,8,15,26,15,4,25,19,9,1,26,16,5,11,23,8,12,7,17,0,22,3,10,14,6,20,27,24];Bc.pc2=function(e,r,n,i){for(var o=0,s=0,a=NS.length>>>1,d=0;d<a;d++)o<<=1,o|=e>>>NS[d]&1;for(var d=a;d<NS.length;d++)s<<=1,s|=r>>>NS[d]&1;n[i+0]=o>>>0,n[i+1]=s>>>0};Bc.expand=function(e,r,n){var i=0,o=0;i=(e&1)<<5|e>>>27;for(var s=23;s>=15;s-=4)i<<=6,i|=e>>>s&63;for(var s=11;s>=3;s-=4)o|=e>>>s&63,o<<=6;o|=(e&31)<<1|e>>>31,r[n+0]=i>>>0,r[n+1]=o>>>0};var xY=[14,0,4,15,13,7,1,4,2,14,15,2,11,13,8,1,3,10,10,6,6,12,12,11,5,9,9,5,0,3,7,8,4,15,1,12,14,8,8,2,13,4,6,9,2,1,11,7,15,5,12,11,9,3,7,14,3,10,10,0,5,6,0,13,15,3,1,13,8,4,14,7,6,15,11,2,3,8,4,14,9,12,7,0,2,1,13,10,12,6,0,9,5,11,10,5,0,13,14,8,7,10,11,1,10,3,4,15,13,4,1,2,5,11,8,6,12,7,6,12,9,0,3,5,2,14,15,9,10,13,0,7,9,0,14,9,6,3,3,4,15,6,5,10,1,2,13,8,12,5,7,14,11,12,4,11,2,15,8,1,13,1,6,10,4,13,9,0,8,6,15,9,3,8,0,7,11,4,1,15,2,14,12,3,5,11,10,5,14,2,7,12,7,13,13,8,14,11,3,5,0,6,6,15,9,0,10,3,1,4,2,7,8,2,5,12,11,1,12,10,4,14,15,9,10,3,6,15,9,0,0,6,12,10,11,1,7,13,13,8,15,9,1,4,3,5,14,11,5,12,2,7,8,2,4,14,2,14,12,11,4,2,1,12,7,4,10,7,11,13,6,1,8,5,5,0,3,15,15,10,13,3,0,9,14,8,9,6,4,11,2,8,1,12,11,7,10,1,13,14,7,2,8,13,15,6,9,15,12,0,5,9,6,10,3,4,0,5,14,3,12,10,1,15,10,4,15,2,9,7,2,12,6,9,8,5,0,6,13,1,3,13,4,14,14,0,7,11,5,3,11,8,9,4,14,3,15,2,5,12,2,9,8,5,12,15,3,10,7,11,0,14,4,1,10,7,1,6,13,0,11,8,6,13,4,13,11,0,2,11,14,7,15,4,0,9,8,1,13,10,3,14,12,3,9,5,7,12,5,2,10,15,6,8,1,6,1,6,4,11,11,13,13,8,12,1,3,4,7,10,14,7,10,9,15,5,6,0,8,15,0,14,5,2,9,3,2,12,13,1,2,15,8,13,4,8,6,10,15,3,11,7,1,4,10,12,9,5,3,6,14,11,5,0,0,14,12,9,7,2,7,2,11,1,4,14,1,7,9,4,12,10,14,8,2,13,0,15,6,12,10,9,13,0,15,3,3,5,5,6,8,11];Bc.substitute=function(e,r){for(var n=0,i=0;i<4;i++){var o=e>>>18-i*6&63,s=xY[i*64+o];n<<=4,n|=s}for(var i=0;i<4;i++){var o=r>>>18-i*6&63,s=xY[4*64+i*64+o];n<<=4,n|=s}return n>>>0};var EY=[16,25,12,11,3,20,4,15,31,17,9,6,27,14,1,22,30,24,8,18,0,5,29,23,13,19,2,26,10,21,28,7];Bc.permute=function(e){for(var r=0,n=0;n<EY.length;n++)r<<=1,r|=e>>>EY[n]&1;return r>>>0};Bc.padSplit=function(e,r,n){for(var i=e.toString(2);i.length<r;)i="0"+i;for(var o=[],s=0;s<r;s+=n)o.push(i.slice(s,s+n));return o.join(" ")}});var Ja=H((u0t,MY)=>{E();MY.exports=SY;function SY(t,e){if(!t)throw new Error(e||"Assertion failed")}SY.equal=function(e,r,n){if(e!=r)throw new Error(n||"Assertion failed: "+e+" != "+r)}});var qS=H((d0t,PY)=>{"use strict";E();var o4e=Ja();function Dc(t){this.options=t,this.type=this.options.type,this.blockSize=8,this._init(),this.buffer=new Array(this.blockSize),this.bufferOff=0,this.padding=t.padding!==!1}PY.exports=Dc;Dc.prototype._init=function(){};Dc.prototype.update=function(e){return e.length===0?[]:this.type==="decrypt"?this._updateDecrypt(e):this._updateEncrypt(e)};Dc.prototype._buffer=function(e,r){for(var n=Math.min(this.buffer.length-this.bufferOff,e.length-r),i=0;i<n;i++)this.buffer[this.bufferOff+i]=e[r+i];return this.bufferOff+=n,n};Dc.prototype._flushBuffer=function(e,r){return this._update(this.buffer,0,e,r),this.bufferOff=0,this.blockSize};Dc.prototype._updateEncrypt=function(e){var r=0,n=0,i=(this.bufferOff+e.length)/this.blockSize|0,o=new Array(i*this.blockSize);this.bufferOff!==0&&(r+=this._buffer(e,r),this.bufferOff===this.buffer.length&&(n+=this._flushBuffer(o,n)));for(var s=e.length-(e.length-r)%this.blockSize;r<s;r+=this.blockSize)this._update(e,r,o,n),n+=this.blockSize;for(;r<e.length;r++,this.bufferOff++)this.buffer[this.bufferOff]=e[r];return o};Dc.prototype._updateDecrypt=function(e){for(var r=0,n=0,i=Math.ceil((this.bufferOff+e.length)/this.blockSize)-1,o=new Array(i*this.blockSize);i>0;i--)r+=this._buffer(e,r),n+=this._flushBuffer(o,n);return r+=this._buffer(e,r),o};Dc.prototype.final=function(e){var r;e&&(r=this.update(e));var n;return this.type==="encrypt"?n=this._finalEncrypt():n=this._finalDecrypt(),r?r.concat(n):n};Dc.prototype._pad=function(e,r){if(r===0)return!1;for(;r<e.length;)e[r++]=0;return!0};Dc.prototype._finalEncrypt=function(){if(!this._pad(this.buffer,this.bufferOff))return[];var e=new Array(this.blockSize);return this._update(this.buffer,0,e,0),e};Dc.prototype._unpad=function(e){return e};Dc.prototype._finalDecrypt=function(){o4e.equal(this.bufferOff,this.blockSize,"Not enough data to decrypt");var e=new Array(this.blockSize);return this._flushBuffer(e,0),this._unpad(e)}});var a9=H((p0t,RY)=>{"use strict";E();var AY=Ja(),s4e=It(),co=s9(),TY=qS();function a4e(){this.tmp=new Array(2),this.keys=null}function zu(t){TY.call(this,t);var e=new a4e;this._desState=e,this.deriveKeys(e,t.key)}s4e(zu,TY);RY.exports=zu;zu.create=function(e){return new zu(e)};var c4e=[1,1,2,2,2,2,2,2,1,2,2,2,2,2,2,1];zu.prototype.deriveKeys=function(e,r){e.keys=new Array(16*2),AY.equal(r.length,this.blockSize,"Invalid key length");var n=co.readUInt32BE(r,0),i=co.readUInt32BE(r,4);co.pc1(n,i,e.tmp,0),n=e.tmp[0],i=e.tmp[1];for(var o=0;o<e.keys.length;o+=2){var s=c4e[o>>>1];n=co.r28shl(n,s),i=co.r28shl(i,s),co.pc2(n,i,e.keys,o)}};zu.prototype._update=function(e,r,n,i){var o=this._desState,s=co.readUInt32BE(e,r),a=co.readUInt32BE(e,r+4);co.ip(s,a,o.tmp,0),s=o.tmp[0],a=o.tmp[1],this.type==="encrypt"?this._encrypt(o,s,a,o.tmp,0):this._decrypt(o,s,a,o.tmp,0),s=o.tmp[0],a=o.tmp[1],co.writeUInt32BE(n,s,i),co.writeUInt32BE(n,a,i+4)};zu.prototype._pad=function(e,r){if(this.padding===!1)return!1;for(var n=e.length-r,i=r;i<e.length;i++)e[i]=n;return!0};zu.prototype._unpad=function(e){if(this.padding===!1)return e;for(var r=e[e.length-1],n=e.length-r;n<e.length;n++)AY.equal(e[n],r);return e.slice(0,e.length-r)};zu.prototype._encrypt=function(e,r,n,i,o){for(var s=r,a=n,d=0;d<e.keys.length;d+=2){var m=e.keys[d],p=e.keys[d+1];co.expand(a,e.tmp,0),m^=e.tmp[0],p^=e.tmp[1];var w=co.substitute(m,p),P=co.permute(w),S=a;a=(s^P)>>>0,s=S}co.rip(a,s,i,o)};zu.prototype._decrypt=function(e,r,n,i,o){for(var s=n,a=r,d=e.keys.length-2;d>=0;d-=2){var m=e.keys[d],p=e.keys[d+1];co.expand(s,e.tmp,0),m^=e.tmp[0],p^=e.tmp[1];var w=co.substitute(m,p),P=co.permute(w),S=s;s=(a^P)>>>0,a=S}co.rip(s,a,i,o)}});var kY=H(IY=>{"use strict";E();var f4e=Ja(),u4e=It(),$S={};function l4e(t){f4e.equal(t.length,8,"Invalid IV length"),this.iv=new Array(8);for(var e=0;e<this.iv.length;e++)this.iv[e]=t[e]}function d4e(t){function e(o){t.call(this,o),this._cbcInit()}u4e(e,t);for(var r=Object.keys($S),n=0;n<r.length;n++){var i=r[n];e.prototype[i]=$S[i]}return e.create=function(s){return new e(s)},e}IY.instantiate=d4e;$S._cbcInit=function(){var e=new l4e(this.options.iv);this._cbcState=e};$S._update=function(e,r,n,i){var o=this._cbcState,s=this.constructor.super_.prototype,a=o.iv;if(this.type==="encrypt"){for(var d=0;d<this.blockSize;d++)a[d]^=e[r+d];s._update.call(this,a,0,n,i);for(var d=0;d<this.blockSize;d++)a[d]=n[i+d]}else{s._update.call(this,e,r,n,i);for(var d=0;d<this.blockSize;d++)n[i+d]^=a[d];for(var d=0;d<this.blockSize;d++)a[d]=e[r+d]}}});var DY=H((v0t,BY)=>{"use strict";E();var h4e=Ja(),p4e=It(),OY=qS(),sp=a9();function m4e(t,e){h4e.equal(e.length,24,"Invalid key length");var r=e.slice(0,8),n=e.slice(8,16),i=e.slice(16,24);t==="encrypt"?this.ciphers=[sp.create({type:"encrypt",key:r}),sp.create({type:"decrypt",key:n}),sp.create({type:"encrypt",key:i})]:this.ciphers=[sp.create({type:"decrypt",key:i}),sp.create({type:"encrypt",key:n}),sp.create({type:"decrypt",key:r})]}function Sm(t){OY.call(this,t);var e=new m4e(this.type,this.options.key);this._edeState=e}p4e(Sm,OY);BY.exports=Sm;Sm.create=function(e){return new Sm(e)};Sm.prototype._update=function(e,r,n,i){var o=this._edeState;o.ciphers[0]._update(e,r,n,i),o.ciphers[1]._update(n,i,n,i),o.ciphers[2]._update(n,i,n,i)};Sm.prototype._pad=sp.prototype._pad;Sm.prototype._unpad=sp.prototype._unpad});var CY=H(Dv=>{"use strict";E();Dv.utils=s9();Dv.Cipher=qS();Dv.DES=a9();Dv.CBC=kY();Dv.EDE=DY()});var qY=H((x0t,NY)=>{E();var jY=Sd(),Md=CY(),y4e=It(),Mm=Fr().Buffer,K2={"des-ede3-cbc":Md.CBC.instantiate(Md.EDE),"des-ede3":Md.EDE,"des-ede-cbc":Md.CBC.instantiate(Md.EDE),"des-ede":Md.EDE,"des-cbc":Md.CBC.instantiate(Md.DES),"des-ecb":Md.DES};K2.des=K2["des-cbc"];K2.des3=K2["des-ede3-cbc"];NY.exports=LS;y4e(LS,jY);function LS(t){jY.call(this);var e=t.mode.toLowerCase(),r=K2[e],n;t.decrypt?n="decrypt":n="encrypt";var i=t.key;Mm.isBuffer(i)||(i=Mm.from(i)),(e==="des-ede"||e==="des-ede-cbc")&&(i=Mm.concat([i,i.slice(0,8)]));var o=t.iv;Mm.isBuffer(o)||(o=Mm.from(o)),this._des=r.create({key:i,iv:o,type:n})}LS.prototype._update=function(t){return Mm.from(this._des.update(t))};LS.prototype._final=function(){return Mm.from(this._des.final())}});var $Y=H(c9=>{E();c9.encrypt=function(t,e){return t._cipher.encryptBlock(e)};c9.decrypt=function(t,e){return t._cipher.decryptBlock(e)}});var Cv=H((P0t,LY)=>{E();LY.exports=function(e,r){for(var n=Math.min(e.length,r.length),i=new $.Buffer(n),o=0;o<n;++o)i[o]=e[o]^r[o];return i}});var FY=H(f9=>{E();var UY=Cv();f9.encrypt=function(t,e){var r=UY(e,t._prev);return t._prev=t._cipher.encryptBlock(r),t._prev};f9.decrypt=function(t,e){var r=t._prev;t._prev=e;var n=t._cipher.decryptBlock(e);return UY(n,r)}});var GY=H(KY=>{E();var G2=Fr().Buffer,g4e=Cv();function zY(t,e,r){var n=e.length,i=g4e(e,t._cache);return t._cache=t._cache.slice(n),t._prev=G2.concat([t._prev,r?e:i]),i}KY.encrypt=function(t,e,r){for(var n=G2.allocUnsafe(0),i;e.length;)if(t._cache.length===0&&(t._cache=t._cipher.encryptBlock(t._prev),t._prev=G2.allocUnsafe(0)),t._cache.length<=e.length)i=t._cache.length,n=G2.concat([n,zY(t,e.slice(0,i),r)]),e=e.slice(i);else{n=G2.concat([n,zY(t,e,r)]);break}return n}});var VY=H(WY=>{E();var u9=Fr().Buffer;function v4e(t,e,r){var n=t._cipher.encryptBlock(t._prev),i=n[0]^e;return t._prev=u9.concat([t._prev.slice(1),u9.from([r?e:i])]),i}WY.encrypt=function(t,e,r){for(var n=e.length,i=u9.allocUnsafe(n),o=-1;++o<n;)i[o]=v4e(t,e[o],r);return i}});var ZY=H(HY=>{E();var US=Fr().Buffer;function b4e(t,e,r){for(var n,i=-1,o=8,s=0,a,d;++i<o;)n=t._cipher.encryptBlock(t._prev),a=e&1<<7-i?128:0,d=n[0]^a,s+=(d&128)>>i%8,t._prev=w4e(t._prev,r?a:d);return s}function w4e(t,e){var r=t.length,n=-1,i=US.allocUnsafe(t.length);for(t=US.concat([t,US.from([e])]);++n<r;)i[n]=t[n]<<1|t[n+1]>>7;return i}HY.encrypt=function(t,e,r){for(var n=e.length,i=US.allocUnsafe(n),o=-1;++o<n;)i[o]=b4e(t,e[o],r);return i}});var YY=H(JY=>{E();var _4e=Cv();function x4e(t){return t._prev=t._cipher.encryptBlock(t._prev),t._prev}JY.encrypt=function(t,e){for(;t._cache.length<e.length;)t._cache=$.Buffer.concat([t._cache,x4e(t)]);var r=t._cache.slice(0,e.length);return t._cache=t._cache.slice(e.length),_4e(e,r)}});var l9=H((q0t,QY)=>{E();function E4e(t){for(var e=t.length,r;e--;)if(r=t.readUInt8(e),r===255)t.writeUInt8(0,e);else{r++,t.writeUInt8(r,e);break}}QY.exports=E4e});var h9=H(eQ=>{E();var S4e=Cv(),XY=Fr().Buffer,M4e=l9();function P4e(t){var e=t._cipher.encryptBlockRaw(t._prev);return M4e(t._prev),e}var d9=16;eQ.encrypt=function(t,e){var r=Math.ceil(e.length/d9),n=t._cache.length;t._cache=XY.concat([t._cache,XY.allocUnsafe(r*d9)]);for(var i=0;i<r;i++){var o=P4e(t),s=n+i*d9;t._cache.writeUInt32BE(o[0],s+0),t._cache.writeUInt32BE(o[1],s+4),t._cache.writeUInt32BE(o[2],s+8),t._cache.writeUInt32BE(o[3],s+12)}var a=t._cache.slice(0,e.length);return t._cache=t._cache.slice(e.length),S4e(e,a)}});var p9=H((F0t,A4e)=>{A4e.exports={"aes-128-ecb":{cipher:"AES",key:128,iv:0,mode:"ECB",type:"block"},"aes-192-ecb":{cipher:"AES",key:192,iv:0,mode:"ECB",type:"block"},"aes-256-ecb":{cipher:"AES",key:256,iv:0,mode:"ECB",type:"block"},"aes-128-cbc":{cipher:"AES",key:128,iv:16,mode:"CBC",type:"block"},"aes-192-cbc":{cipher:"AES",key:192,iv:16,mode:"CBC",type:"block"},"aes-256-cbc":{cipher:"AES",key:256,iv:16,mode:"CBC",type:"block"},aes128:{cipher:"AES",key:128,iv:16,mode:"CBC",type:"block"},aes192:{cipher:"AES",key:192,iv:16,mode:"CBC",type:"block"},aes256:{cipher:"AES",key:256,iv:16,mode:"CBC",type:"block"},"aes-128-cfb":{cipher:"AES",key:128,iv:16,mode:"CFB",type:"stream"},"aes-192-cfb":{cipher:"AES",key:192,iv:16,mode:"CFB",type:"stream"},"aes-256-cfb":{cipher:"AES",key:256,iv:16,mode:"CFB",type:"stream"},"aes-128-cfb8":{cipher:"AES",key:128,iv:16,mode:"CFB8",type:"stream"},"aes-192-cfb8":{cipher:"AES",key:192,iv:16,mode:"CFB8",type:"stream"},"aes-256-cfb8":{cipher:"AES",key:256,iv:16,mode:"CFB8",type:"stream"},"aes-128-cfb1":{cipher:"AES",key:128,iv:16,mode:"CFB1",type:"stream"},"aes-192-cfb1":{cipher:"AES",key:192,iv:16,mode:"CFB1",type:"stream"},"aes-256-cfb1":{cipher:"AES",key:256,iv:16,mode:"CFB1",type:"stream"},"aes-128-ofb":{cipher:"AES",key:128,iv:16,mode:"OFB",type:"stream"},"aes-192-ofb":{cipher:"AES",key:192,iv:16,mode:"OFB",type:"stream"},"aes-256-ofb":{cipher:"AES",key:256,iv:16,mode:"OFB",type:"stream"},"aes-128-ctr":{cipher:"AES",key:128,iv:16,mode:"CTR",type:"stream"},"aes-192-ctr":{cipher:"AES",key:192,iv:16,mode:"CTR",type:"stream"},"aes-256-ctr":{cipher:"AES",key:256,iv:16,mode:"CTR",type:"stream"},"aes-128-gcm":{cipher:"AES",key:128,iv:12,mode:"GCM",type:"auth"},"aes-192-gcm":{cipher:"AES",key:192,iv:12,mode:"GCM",type:"auth"},"aes-256-gcm":{cipher:"AES",key:256,iv:12,mode:"GCM",type:"auth"}}});var zS=H((z0t,tQ)=>{E();var T4e={ECB:$Y(),CBC:FY(),CFB:GY(),CFB8:VY(),CFB1:ZY(),OFB:YY(),CTR:h9(),GCM:h9()},FS=p9();for(m9 in FS)FS[m9].module=T4e[FS[m9].mode];var m9;tQ.exports=FS});var W2=H((G0t,nQ)=>{E();var KS=Fr().Buffer;function g9(t){KS.isBuffer(t)||(t=KS.from(t));for(var e=t.length/4|0,r=new Array(e),n=0;n<e;n++)r[n]=t.readUInt32BE(n*4);return r}function y9(t){for(var e=0;e<t.length;t++)t[e]=0}function rQ(t,e,r,n,i){for(var o=r[0],s=r[1],a=r[2],d=r[3],m=t[0]^e[0],p=t[1]^e[1],w=t[2]^e[2],P=t[3]^e[3],S,M,A,B,I=4,C=1;C<i;C++)S=o[m>>>24]^s[p>>>16&255]^a[w>>>8&255]^d[P&255]^e[I++],M=o[p>>>24]^s[w>>>16&255]^a[P>>>8&255]^d[m&255]^e[I++],A=o[w>>>24]^s[P>>>16&255]^a[m>>>8&255]^d[p&255]^e[I++],B=o[P>>>24]^s[m>>>16&255]^a[p>>>8&255]^d[w&255]^e[I++],m=S,p=M,w=A,P=B;return S=(n[m>>>24]<<24|n[p>>>16&255]<<16|n[w>>>8&255]<<8|n[P&255])^e[I++],M=(n[p>>>24]<<24|n[w>>>16&255]<<16|n[P>>>8&255]<<8|n[m&255])^e[I++],A=(n[w>>>24]<<24|n[P>>>16&255]<<16|n[m>>>8&255]<<8|n[p&255])^e[I++],B=(n[P>>>24]<<24|n[m>>>16&255]<<16|n[p>>>8&255]<<8|n[w&255])^e[I++],S=S>>>0,M=M>>>0,A=A>>>0,B=B>>>0,[S,M,A,B]}var R4e=[0,1,2,4,8,16,32,64,128,27,54],Yi=function(){for(var t=new Array(256),e=0;e<256;e++)e<128?t[e]=e<<1:t[e]=e<<1^283;for(var r=[],n=[],i=[[],[],[],[]],o=[[],[],[],[]],s=0,a=0,d=0;d<256;++d){var m=a^a<<1^a<<2^a<<3^a<<4;m=m>>>8^m&255^99,r[s]=m,n[m]=s;var p=t[s],w=t[p],P=t[w],S=t[m]*257^m*16843008;i[0][s]=S<<24|S>>>8,i[1][s]=S<<16|S>>>16,i[2][s]=S<<8|S>>>24,i[3][s]=S,S=P*16843009^w*65537^p*257^s*16843008,o[0][m]=S<<24|S>>>8,o[1][m]=S<<16|S>>>16,o[2][m]=S<<8|S>>>24,o[3][m]=S,s===0?s=a=1:(s=p^t[t[t[P^p]]],a^=t[t[a]])}return{SBOX:r,INV_SBOX:n,SUB_MIX:i,INV_SUB_MIX:o}}();function Cc(t){this._key=g9(t),this._reset()}Cc.blockSize=4*4;Cc.keySize=256/8;Cc.prototype.blockSize=Cc.blockSize;Cc.prototype.keySize=Cc.keySize;Cc.prototype._reset=function(){for(var t=this._key,e=t.length,r=e+6,n=(r+1)*4,i=[],o=0;o<e;o++)i[o]=t[o];for(o=e;o<n;o++){var s=i[o-1];o%e===0?(s=s<<8|s>>>24,s=Yi.SBOX[s>>>24]<<24|Yi.SBOX[s>>>16&255]<<16|Yi.SBOX[s>>>8&255]<<8|Yi.SBOX[s&255],s^=R4e[o/e|0]<<24):e>6&&o%e===4&&(s=Yi.SBOX[s>>>24]<<24|Yi.SBOX[s>>>16&255]<<16|Yi.SBOX[s>>>8&255]<<8|Yi.SBOX[s&255]),i[o]=i[o-e]^s}for(var a=[],d=0;d<n;d++){var m=n-d,p=i[m-(d%4?0:4)];d<4||m<=4?a[d]=p:a[d]=Yi.INV_SUB_MIX[0][Yi.SBOX[p>>>24]]^Yi.INV_SUB_MIX[1][Yi.SBOX[p>>>16&255]]^Yi.INV_SUB_MIX[2][Yi.SBOX[p>>>8&255]]^Yi.INV_SUB_MIX[3][Yi.SBOX[p&255]]}this._nRounds=r,this._keySchedule=i,this._invKeySchedule=a};Cc.prototype.encryptBlockRaw=function(t){return t=g9(t),rQ(t,this._keySchedule,Yi.SUB_MIX,Yi.SBOX,this._nRounds)};Cc.prototype.encryptBlock=function(t){var e=this.encryptBlockRaw(t),r=KS.allocUnsafe(16);return r.writeUInt32BE(e[0],0),r.writeUInt32BE(e[1],4),r.writeUInt32BE(e[2],8),r.writeUInt32BE(e[3],12),r};Cc.prototype.decryptBlock=function(t){t=g9(t);var e=t[1];t[1]=t[3],t[3]=e;var r=rQ(t,this._invKeySchedule,Yi.INV_SUB_MIX,Yi.INV_SBOX,this._nRounds),n=KS.allocUnsafe(16);return n.writeUInt32BE(r[0],0),n.writeUInt32BE(r[3],4),n.writeUInt32BE(r[2],8),n.writeUInt32BE(r[1],12),n};Cc.prototype.scrub=function(){y9(this._keySchedule),y9(this._invKeySchedule),y9(this._key)};nQ.exports.AES=Cc});var sQ=H((V0t,oQ)=>{E();var jv=Fr().Buffer,I4e=jv.alloc(16,0);function k4e(t){return[t.readUInt32BE(0),t.readUInt32BE(4),t.readUInt32BE(8),t.readUInt32BE(12)]}function iQ(t){var e=jv.allocUnsafe(16);return e.writeUInt32BE(t[0]>>>0,0),e.writeUInt32BE(t[1]>>>0,4),e.writeUInt32BE(t[2]>>>0,8),e.writeUInt32BE(t[3]>>>0,12),e}function V2(t){this.h=t,this.state=jv.alloc(16,0),this.cache=jv.allocUnsafe(0)}V2.prototype.ghash=function(t){for(var e=-1;++e<t.length;)this.state[e]^=t[e];this._multiply()};V2.prototype._multiply=function(){for(var t=k4e(this.h),e=[0,0,0,0],r,n,i,o=-1;++o<128;){for(n=(this.state[~~(o/8)]&1<<7-o%8)!==0,n&&(e[0]^=t[0],e[1]^=t[1],e[2]^=t[2],e[3]^=t[3]),i=(t[3]&1)!==0,r=3;r>0;r--)t[r]=t[r]>>>1|(t[r-1]&1)<<31;t[0]=t[0]>>>1,i&&(t[0]=t[0]^225<<24)}this.state=iQ(e)};V2.prototype.update=function(t){this.cache=jv.concat([this.cache,t]);for(var e;this.cache.length>=16;)e=this.cache.slice(0,16),this.cache=this.cache.slice(16),this.ghash(e)};V2.prototype.final=function(t,e){return this.cache.length&&this.ghash(jv.concat([this.cache,I4e],16)),this.ghash(iQ([0,t,0,e])),this.state};oQ.exports=V2});var v9=H((Z0t,fQ)=>{E();var O4e=W2(),xa=Fr().Buffer,aQ=Sd(),B4e=It(),cQ=sQ(),D4e=Cv(),C4e=l9();function j4e(t,e){var r=0;t.length!==e.length&&r++;for(var n=Math.min(t.length,e.length),i=0;i<n;++i)r+=t[i]^e[i];return r}function N4e(t,e,r){if(e.length===12)return t._finID=xa.concat([e,xa.from([0,0,0,1])]),xa.concat([e,xa.from([0,0,0,2])]);var n=new cQ(r),i=e.length,o=i%16;n.update(e),o&&(o=16-o,n.update(xa.alloc(o,0))),n.update(xa.alloc(8,0));var s=i*8,a=xa.alloc(8);a.writeUIntBE(s,0,8),n.update(a),t._finID=n.state;var d=xa.from(t._finID);return C4e(d),d}function Pm(t,e,r,n){aQ.call(this);var i=xa.alloc(4,0);this._cipher=new O4e.AES(e);var o=this._cipher.encryptBlock(i);this._ghash=new cQ(o),r=N4e(this,r,o),this._prev=xa.from(r),this._cache=xa.allocUnsafe(0),this._secCache=xa.allocUnsafe(0),this._decrypt=n,this._alen=0,this._len=0,this._mode=t,this._authTag=null,this._called=!1}B4e(Pm,aQ);Pm.prototype._update=function(t){if(!this._called&&this._alen){var e=16-this._alen%16;e<16&&(e=xa.alloc(e,0),this._ghash.update(e))}this._called=!0;var r=this._mode.encrypt(this,t);return this._decrypt?this._ghash.update(t):this._ghash.update(r),this._len+=t.length,r};Pm.prototype._final=function(){if(this._decrypt&&!this._authTag)throw new Error("Unsupported state or unable to authenticate data");var t=D4e(this._ghash.final(this._alen*8,this._len*8),this._cipher.encryptBlock(this._finID));if(this._decrypt&&j4e(t,this._authTag))throw new Error("Unsupported state or unable to authenticate data");this._authTag=t,this._cipher.scrub()};Pm.prototype.getAuthTag=function(){if(this._decrypt||!xa.isBuffer(this._authTag))throw new Error("Attempting to get auth tag in unsupported state");return this._authTag};Pm.prototype.setAuthTag=function(e){if(!this._decrypt)throw new Error("Attempting to set auth tag in unsupported state");this._authTag=e};Pm.prototype.setAAD=function(e){if(this._called)throw new Error("Attempting to set AAD in unsupported state");this._ghash.update(e),this._alen+=e.length};fQ.exports=Pm});var w9=H((Y0t,lQ)=>{E();var q4e=W2(),b9=Fr().Buffer,uQ=Sd(),$4e=It();function GS(t,e,r,n){uQ.call(this),this._cipher=new q4e.AES(e),this._prev=b9.from(r),this._cache=b9.allocUnsafe(0),this._secCache=b9.allocUnsafe(0),this._decrypt=n,this._mode=t}$4e(GS,uQ);GS.prototype._update=function(t){return this._mode.encrypt(this,t,this._decrypt)};GS.prototype._final=function(){this._cipher.scrub()};lQ.exports=GS});var H2=H((X0t,dQ)=>{E();var Am=Fr().Buffer,L4e=lS();function U4e(t,e,r,n){if(Am.isBuffer(t)||(t=Am.from(t,"binary")),e&&(Am.isBuffer(e)||(e=Am.from(e,"binary")),e.length!==8))throw new RangeError("salt should be Buffer with 8 byte length");for(var i=r/8,o=Am.alloc(i),s=Am.alloc(n||0),a=Am.alloc(0);i>0||n>0;){var d=new L4e;d.update(a),d.update(t),e&&d.update(e),a=d.digest();var m=0;if(i>0){var p=o.length-i;m=Math.min(i,a.length),a.copy(o,p,0,m),i-=m}if(m<a.length&&n>0){var w=s.length-n,P=Math.min(n,a.length-m);a.copy(s,w,m,m+P),n-=P}}return a.fill(0),{key:o,iv:s}}dQ.exports=U4e});var yQ=H(_9=>{E();var hQ=zS(),F4e=v9(),Pd=Fr().Buffer,z4e=w9(),pQ=Sd(),K4e=W2(),G4e=H2(),W4e=It();function Z2(t,e,r){pQ.call(this),this._cache=new WS,this._cipher=new K4e.AES(e),this._prev=Pd.from(r),this._mode=t,this._autopadding=!0}W4e(Z2,pQ);Z2.prototype._update=function(t){this._cache.add(t);for(var e,r,n=[];e=this._cache.get();)r=this._mode.encrypt(this,e),n.push(r);return Pd.concat(n)};var V4e=Pd.alloc(16,16);Z2.prototype._final=function(){var t=this._cache.flush();if(this._autopadding)return t=this._mode.encrypt(this,t),this._cipher.scrub(),t;if(!t.equals(V4e))throw this._cipher.scrub(),new Error("data not multiple of block length")};Z2.prototype.setAutoPadding=function(t){return this._autopadding=!!t,this};function WS(){this.cache=Pd.allocUnsafe(0)}WS.prototype.add=function(t){this.cache=Pd.concat([this.cache,t])};WS.prototype.get=function(){if(this.cache.length>15){var t=this.cache.slice(0,16);return this.cache=this.cache.slice(16),t}return null};WS.prototype.flush=function(){for(var t=16-this.cache.length,e=Pd.allocUnsafe(t),r=-1;++r<t;)e.writeUInt8(t,r);return Pd.concat([this.cache,e])};function mQ(t,e,r){var n=hQ[t.toLowerCase()];if(!n)throw new TypeError("invalid suite type");if(typeof e=="string"&&(e=Pd.from(e)),e.length!==n.key/8)throw new TypeError("invalid key length "+e.length);if(typeof r=="string"&&(r=Pd.from(r)),n.mode!=="GCM"&&r.length!==n.iv)throw new TypeError("invalid iv length "+r.length);return n.type==="stream"?new z4e(n.module,e,r):n.type==="auth"?new F4e(n.module,e,r):new Z2(n.module,e,r)}function H4e(t,e){var r=hQ[t.toLowerCase()];if(!r)throw new TypeError("invalid suite type");var n=G4e(e,!1,r.key,r.iv);return mQ(t,n.key,n.iv)}_9.createCipheriv=mQ;_9.createCipher=H4e});var wQ=H(x9=>{E();var Z4e=v9(),Nv=Fr().Buffer,gQ=zS(),J4e=w9(),vQ=Sd(),Y4e=W2(),Q4e=H2(),X4e=It();function J2(t,e,r){vQ.call(this),this._cache=new VS,this._last=void 0,this._cipher=new Y4e.AES(e),this._prev=Nv.from(r),this._mode=t,this._autopadding=!0}X4e(J2,vQ);J2.prototype._update=function(t){this._cache.add(t);for(var e,r,n=[];e=this._cache.get(this._autopadding);)r=this._mode.decrypt(this,e),n.push(r);return Nv.concat(n)};J2.prototype._final=function(){var t=this._cache.flush();if(this._autopadding)return ePe(this._mode.decrypt(this,t));if(t)throw new Error("data not multiple of block length")};J2.prototype.setAutoPadding=function(t){return this._autopadding=!!t,this};function VS(){this.cache=Nv.allocUnsafe(0)}VS.prototype.add=function(t){this.cache=Nv.concat([this.cache,t])};VS.prototype.get=function(t){var e;if(t){if(this.cache.length>16)return e=this.cache.slice(0,16),this.cache=this.cache.slice(16),e}else if(this.cache.length>=16)return e=this.cache.slice(0,16),this.cache=this.cache.slice(16),e;return null};VS.prototype.flush=function(){if(this.cache.length)return this.cache};function ePe(t){var e=t[15];if(e<1||e>16)throw new Error("unable to decrypt data");for(var r=-1;++r<e;)if(t[r+(16-e)]!==e)throw new Error("unable to decrypt data");if(e!==16)return t.slice(0,16-e)}function bQ(t,e,r){var n=gQ[t.toLowerCase()];if(!n)throw new TypeError("invalid suite type");if(typeof r=="string"&&(r=Nv.from(r)),n.mode!=="GCM"&&r.length!==n.iv)throw new TypeError("invalid iv length "+r.length);if(typeof e=="string"&&(e=Nv.from(e)),e.length!==n.key/8)throw new TypeError("invalid key length "+e.length);return n.type==="stream"?new J4e(n.module,e,r,!0):n.type==="auth"?new Z4e(n.module,e,r,!0):new J2(n.module,e,r)}function tPe(t,e){var r=gQ[t.toLowerCase()];if(!r)throw new TypeError("invalid suite type");var n=Q4e(e,!1,r.key,r.iv);return bQ(t,n.key,n.iv)}x9.createDecipher=tPe;x9.createDecipheriv=bQ});var HS=H(Of=>{E();var _Q=yQ(),xQ=wQ(),rPe=p9();function nPe(){return Object.keys(rPe)}Of.createCipher=Of.Cipher=_Q.createCipher;Of.createCipheriv=Of.Cipheriv=_Q.createCipheriv;Of.createDecipher=Of.Decipher=xQ.createDecipher;Of.createDecipheriv=Of.Decipheriv=xQ.createDecipheriv;Of.listCiphers=Of.getCiphers=nPe});var EQ=H(Ad=>{E();Ad["des-ecb"]={key:8,iv:0};Ad["des-cbc"]=Ad.des={key:8,iv:8};Ad["des-ede3-cbc"]=Ad.des3={key:24,iv:8};Ad["des-ede3"]={key:24,iv:0};Ad["des-ede-cbc"]={key:16,iv:8};Ad["des-ede"]={key:16,iv:0}});var TQ=H(Bf=>{E();var SQ=qY(),E9=HS(),ap=zS(),Td=EQ(),MQ=H2();function iPe(t,e){t=t.toLowerCase();var r,n;if(ap[t])r=ap[t].key,n=ap[t].iv;else if(Td[t])r=Td[t].key*8,n=Td[t].iv;else throw new TypeError("invalid suite type");var i=MQ(e,!1,r,n);return PQ(t,i.key,i.iv)}function oPe(t,e){t=t.toLowerCase();var r,n;if(ap[t])r=ap[t].key,n=ap[t].iv;else if(Td[t])r=Td[t].key*8,n=Td[t].iv;else throw new TypeError("invalid suite type");var i=MQ(e,!1,r,n);return AQ(t,i.key,i.iv)}function PQ(t,e,r){if(t=t.toLowerCase(),ap[t])return E9.createCipheriv(t,e,r);if(Td[t])return new SQ({key:e,iv:r,mode:t});throw new TypeError("invalid suite type")}function AQ(t,e,r){if(t=t.toLowerCase(),ap[t])return E9.createDecipheriv(t,e,r);if(Td[t])return new SQ({key:e,iv:r,mode:t,decrypt:!0});throw new TypeError("invalid suite type")}function sPe(){return Object.keys(Td).concat(E9.getCiphers())}Bf.createCipher=Bf.Cipher=iPe;Bf.createCipheriv=Bf.Cipheriv=PQ;Bf.createDecipher=Bf.Decipher=oPe;Bf.createDecipheriv=Bf.Decipheriv=AQ;Bf.listCiphers=Bf.getCiphers=sPe});var M9=H((RQ,S9)=>{E();(function(t,e){"use strict";function r(x,c){if(!x)throw new Error(c||"Assertion failed")}function n(x,c){x.super_=c;var u=function(){};u.prototype=c.prototype,x.prototype=new u,x.prototype.constructor=x}function i(x,c,u){if(i.isBN(x))return x;this.negative=0,this.words=null,this.length=0,this.red=null,x!==null&&((c==="le"||c==="be")&&(u=c,c=10),this._init(x||0,c||10,u||"be"))}typeof t=="object"?t.exports=i:e.BN=i,i.BN=i,i.wordSize=26;var o;try{typeof window<"u"&&typeof window.Buffer<"u"?o=window.Buffer:o=sr().Buffer}catch{}i.isBN=function(c){return c instanceof i?!0:c!==null&&typeof c=="object"&&c.constructor.wordSize===i.wordSize&&Array.isArray(c.words)},i.max=function(c,u){return c.cmp(u)>0?c:u},i.min=function(c,u){return c.cmp(u)<0?c:u},i.prototype._init=function(c,u,y){if(typeof c=="number")return this._initNumber(c,u,y);if(typeof c=="object")return this._initArray(c,u,y);u==="hex"&&(u=16),r(u===(u|0)&&u>=2&&u<=36),c=c.toString().replace(/\s+/g,"");var l=0;c[0]==="-"&&(l++,this.negative=1),l<c.length&&(u===16?this._parseHex(c,l,y):(this._parseBase(c,u,l),y==="le"&&this._initArray(this.toArray(),u,y)))},i.prototype._initNumber=function(c,u,y){c<0&&(this.negative=1,c=-c),c<67108864?(this.words=[c&67108863],this.length=1):c<4503599627370496?(this.words=[c&67108863,c/67108864&67108863],this.length=2):(r(c<9007199254740992),this.words=[c&67108863,c/67108864&67108863,1],this.length=3),y==="le"&&this._initArray(this.toArray(),u,y)},i.prototype._initArray=function(c,u,y){if(r(typeof c.length=="number"),c.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(c.length/3),this.words=new Array(this.length);for(var l=0;l<this.length;l++)this.words[l]=0;var h,b,_=0;if(y==="be")for(l=c.length-1,h=0;l>=0;l-=3)b=c[l]|c[l-1]<<8|c[l-2]<<16,this.words[h]|=b<<_&67108863,this.words[h+1]=b>>>26-_&67108863,_+=24,_>=26&&(_-=26,h++);else if(y==="le")for(l=0,h=0;l<c.length;l+=3)b=c[l]|c[l+1]<<8|c[l+2]<<16,this.words[h]|=b<<_&67108863,this.words[h+1]=b>>>26-_&67108863,_+=24,_>=26&&(_-=26,h++);return this.strip()};function s(x,c){var u=x.charCodeAt(c);return u>=65&&u<=70?u-55:u>=97&&u<=102?u-87:u-48&15}function a(x,c,u){var y=s(x,u);return u-1>=c&&(y|=s(x,u-1)<<4),y}i.prototype._parseHex=function(c,u,y){this.length=Math.ceil((c.length-u)/6),this.words=new Array(this.length);for(var l=0;l<this.length;l++)this.words[l]=0;var h=0,b=0,_;if(y==="be")for(l=c.length-1;l>=u;l-=2)_=a(c,u,l)<<h,this.words[b]|=_&67108863,h>=18?(h-=18,b+=1,this.words[b]|=_>>>26):h+=8;else{var g=c.length-u;for(l=g%2===0?u+1:u;l<c.length;l+=2)_=a(c,u,l)<<h,this.words[b]|=_&67108863,h>=18?(h-=18,b+=1,this.words[b]|=_>>>26):h+=8}this.strip()};function d(x,c,u,y){for(var l=0,h=Math.min(x.length,u),b=c;b<h;b++){var _=x.charCodeAt(b)-48;l*=y,_>=49?l+=_-49+10:_>=17?l+=_-17+10:l+=_}return l}i.prototype._parseBase=function(c,u,y){this.words=[0],this.length=1;for(var l=0,h=1;h<=67108863;h*=u)l++;l--,h=h/u|0;for(var b=c.length-y,_=b%l,g=Math.min(b,b-_)+y,f=0,v=y;v<g;v+=l)f=d(c,v,v+l,u),this.imuln(h),this.words[0]+f<67108864?this.words[0]+=f:this._iaddn(f);if(_!==0){var O=1;for(f=d(c,v,c.length,u),v=0;v<_;v++)O*=u;this.imuln(O),this.words[0]+f<67108864?this.words[0]+=f:this._iaddn(f)}this.strip()},i.prototype.copy=function(c){c.words=new Array(this.length);for(var u=0;u<this.length;u++)c.words[u]=this.words[u];c.length=this.length,c.negative=this.negative,c.red=this.red},i.prototype.clone=function(){var c=new i(null);return this.copy(c),c},i.prototype._expand=function(c){for(;this.length<c;)this.words[this.length++]=0;return this},i.prototype.strip=function(){for(;this.length>1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},i.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},i.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var m=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],p=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],w=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];i.prototype.toString=function(c,u){c=c||10,u=u|0||1;var y;if(c===16||c==="hex"){y="";for(var l=0,h=0,b=0;b<this.length;b++){var _=this.words[b],g=((_<<l|h)&16777215).toString(16);h=_>>>24-l&16777215,h!==0||b!==this.length-1?y=m[6-g.length]+g+y:y=g+y,l+=2,l>=26&&(l-=26,b--)}for(h!==0&&(y=h.toString(16)+y);y.length%u!==0;)y="0"+y;return this.negative!==0&&(y="-"+y),y}if(c===(c|0)&&c>=2&&c<=36){var f=p[c],v=w[c];y="";var O=this.clone();for(O.negative=0;!O.isZero();){var T=O.modn(v).toString(c);O=O.idivn(v),O.isZero()?y=T+y:y=m[f-T.length]+T+y}for(this.isZero()&&(y="0"+y);y.length%u!==0;)y="0"+y;return this.negative!==0&&(y="-"+y),y}r(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var c=this.words[0];return this.length===2?c+=this.words[1]*67108864:this.length===3&&this.words[2]===1?c+=4503599627370496+this.words[1]*67108864:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-c:c},i.prototype.toJSON=function(){return this.toString(16)},i.prototype.toBuffer=function(c,u){return r(typeof o<"u"),this.toArrayLike(o,c,u)},i.prototype.toArray=function(c,u){return this.toArrayLike(Array,c,u)},i.prototype.toArrayLike=function(c,u,y){var l=this.byteLength(),h=y||Math.max(1,l);r(l<=h,"byte array longer than desired length"),r(h>0,"Requested array length <= 0"),this.strip();var b=u==="le",_=new c(h),g,f,v=this.clone();if(b){for(f=0;!v.isZero();f++)g=v.andln(255),v.iushrn(8),_[f]=g;for(;f<h;f++)_[f]=0}else{for(f=0;f<h-l;f++)_[f]=0;for(f=0;!v.isZero();f++)g=v.andln(255),v.iushrn(8),_[h-f-1]=g}return _},Math.clz32?i.prototype._countBits=function(c){return 32-Math.clz32(c)}:i.prototype._countBits=function(c){var u=c,y=0;return u>=4096&&(y+=13,u>>>=13),u>=64&&(y+=7,u>>>=7),u>=8&&(y+=4,u>>>=4),u>=2&&(y+=2,u>>>=2),y+u},i.prototype._zeroBits=function(c){if(c===0)return 26;var u=c,y=0;return u&8191||(y+=13,u>>>=13),u&127||(y+=7,u>>>=7),u&15||(y+=4,u>>>=4),u&3||(y+=2,u>>>=2),u&1||y++,y},i.prototype.bitLength=function(){var c=this.words[this.length-1],u=this._countBits(c);return(this.length-1)*26+u};function P(x){for(var c=new Array(x.bitLength()),u=0;u<c.length;u++){var y=u/26|0,l=u%26;c[u]=(x.words[y]&1<<l)>>>l}return c}i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var c=0,u=0;u<this.length;u++){var y=this._zeroBits(this.words[u]);if(c+=y,y!==26)break}return c},i.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},i.prototype.toTwos=function(c){return this.negative!==0?this.abs().inotn(c).iaddn(1):this.clone()},i.prototype.fromTwos=function(c){return this.testn(c-1)?this.notn(c).iaddn(1).ineg():this.clone()},i.prototype.isNeg=function(){return this.negative!==0},i.prototype.neg=function(){return this.clone().ineg()},i.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},i.prototype.iuor=function(c){for(;this.length<c.length;)this.words[this.length++]=0;for(var u=0;u<c.length;u++)this.words[u]=this.words[u]|c.words[u];return this.strip()},i.prototype.ior=function(c){return r((this.negative|c.negative)===0),this.iuor(c)},i.prototype.or=function(c){return this.length>c.length?this.clone().ior(c):c.clone().ior(this)},i.prototype.uor=function(c){return this.length>c.length?this.clone().iuor(c):c.clone().iuor(this)},i.prototype.iuand=function(c){var u;this.length>c.length?u=c:u=this;for(var y=0;y<u.length;y++)this.words[y]=this.words[y]&c.words[y];return this.length=u.length,this.strip()},i.prototype.iand=function(c){return r((this.negative|c.negative)===0),this.iuand(c)},i.prototype.and=function(c){return this.length>c.length?this.clone().iand(c):c.clone().iand(this)},i.prototype.uand=function(c){return this.length>c.length?this.clone().iuand(c):c.clone().iuand(this)},i.prototype.iuxor=function(c){var u,y;this.length>c.length?(u=this,y=c):(u=c,y=this);for(var l=0;l<y.length;l++)this.words[l]=u.words[l]^y.words[l];if(this!==u)for(;l<u.length;l++)this.words[l]=u.words[l];return this.length=u.length,this.strip()},i.prototype.ixor=function(c){return r((this.negative|c.negative)===0),this.iuxor(c)},i.prototype.xor=function(c){return this.length>c.length?this.clone().ixor(c):c.clone().ixor(this)},i.prototype.uxor=function(c){return this.length>c.length?this.clone().iuxor(c):c.clone().iuxor(this)},i.prototype.inotn=function(c){r(typeof c=="number"&&c>=0);var u=Math.ceil(c/26)|0,y=c%26;this._expand(u),y>0&&u--;for(var l=0;l<u;l++)this.words[l]=~this.words[l]&67108863;return y>0&&(this.words[l]=~this.words[l]&67108863>>26-y),this.strip()},i.prototype.notn=function(c){return this.clone().inotn(c)},i.prototype.setn=function(c,u){r(typeof c=="number"&&c>=0);var y=c/26|0,l=c%26;return this._expand(y+1),u?this.words[y]=this.words[y]|1<<l:this.words[y]=this.words[y]&~(1<<l),this.strip()},i.prototype.iadd=function(c){var u;if(this.negative!==0&&c.negative===0)return this.negative=0,u=this.isub(c),this.negative^=1,this._normSign();if(this.negative===0&&c.negative!==0)return c.negative=0,u=this.isub(c),c.negative=1,u._normSign();var y,l;this.length>c.length?(y=this,l=c):(y=c,l=this);for(var h=0,b=0;b<l.length;b++)u=(y.words[b]|0)+(l.words[b]|0)+h,this.words[b]=u&67108863,h=u>>>26;for(;h!==0&&b<y.length;b++)u=(y.words[b]|0)+h,this.words[b]=u&67108863,h=u>>>26;if(this.length=y.length,h!==0)this.words[this.length]=h,this.length++;else if(y!==this)for(;b<y.length;b++)this.words[b]=y.words[b];return this},i.prototype.add=function(c){var u;return c.negative!==0&&this.negative===0?(c.negative=0,u=this.sub(c),c.negative^=1,u):c.negative===0&&this.negative!==0?(this.negative=0,u=c.sub(this),this.negative=1,u):this.length>c.length?this.clone().iadd(c):c.clone().iadd(this)},i.prototype.isub=function(c){if(c.negative!==0){c.negative=0;var u=this.iadd(c);return c.negative=1,u._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(c),this.negative=1,this._normSign();var y=this.cmp(c);if(y===0)return this.negative=0,this.length=1,this.words[0]=0,this;var l,h;y>0?(l=this,h=c):(l=c,h=this);for(var b=0,_=0;_<h.length;_++)u=(l.words[_]|0)-(h.words[_]|0)+b,b=u>>26,this.words[_]=u&67108863;for(;b!==0&&_<l.length;_++)u=(l.words[_]|0)+b,b=u>>26,this.words[_]=u&67108863;if(b===0&&_<l.length&&l!==this)for(;_<l.length;_++)this.words[_]=l.words[_];return this.length=Math.max(this.length,_),l!==this&&(this.negative=1),this.strip()},i.prototype.sub=function(c){return this.clone().isub(c)};function S(x,c,u){u.negative=c.negative^x.negative;var y=x.length+c.length|0;u.length=y,y=y-1|0;var l=x.words[0]|0,h=c.words[0]|0,b=l*h,_=b&67108863,g=b/67108864|0;u.words[0]=_;for(var f=1;f<y;f++){for(var v=g>>>26,O=g&67108863,T=Math.min(f,c.length-1),R=Math.max(0,f-x.length+1);R<=T;R++){var z=f-R|0;l=x.words[z]|0,h=c.words[R]|0,b=l*h+O,v+=b/67108864|0,O=b&67108863}u.words[f]=O|0,g=v|0}return g!==0?u.words[f]=g|0:u.length--,u.strip()}var M=function(c,u,y){var l=c.words,h=u.words,b=y.words,_=0,g,f,v,O=l[0]|0,T=O&8191,R=O>>>13,z=l[1]|0,V=z&8191,W=z>>>13,Z=l[2]|0,J=Z&8191,X=Z>>>13,Ee=l[3]|0,re=Ee&8191,ne=Ee>>>13,qe=l[4]|0,ce=qe&8191,ye=qe>>>13,Ne=l[5]|0,ie=Ne&8191,oe=Ne>>>13,ze=l[6]|0,le=ze&8191,me=ze>>>13,ot=l[7]|0,ue=ot&8191,he=ot>>>13,lt=l[8]|0,se=lt&8191,fe=lt>>>13,Lt=l[9]|0,ge=Lt&8191,ve=Lt>>>13,on=h[0]|0,xe=on&8191,Pe=on>>>13,jr=h[1]|0,Se=jr&8191,_e=jr>>>13,Mn=h[2]|0,Me=Mn&8191,Te=Mn>>>13,vi=h[3]|0,Ae=vi&8191,Be=vi>>>13,Pn=h[4]|0,De=Pn&8191,Ie=Pn>>>13,bi=h[5]|0,Re=bi&8191,ke=bi>>>13,wi=h[6]|0,Oe=wi&8191,Ce=wi>>>13,oi=h[7]|0,Q=oi&8191,Y=oi>>>13,ae=h[8]|0,ee=ae&8191,te=ae>>>13,Ke=h[9]|0,de=Ke&8191,pe=Ke>>>13;y.negative=c.negative^u.negative,y.length=19,g=Math.imul(T,xe),f=Math.imul(T,Pe),f=f+Math.imul(R,xe)|0,v=Math.imul(R,Pe);var bt=(_+g|0)+((f&8191)<<13)|0;_=(v+(f>>>13)|0)+(bt>>>26)|0,bt&=67108863,g=Math.imul(V,xe),f=Math.imul(V,Pe),f=f+Math.imul(W,xe)|0,v=Math.imul(W,Pe),g=g+Math.imul(T,Se)|0,f=f+Math.imul(T,_e)|0,f=f+Math.imul(R,Se)|0,v=v+Math.imul(R,_e)|0;var st=(_+g|0)+((f&8191)<<13)|0;_=(v+(f>>>13)|0)+(st>>>26)|0,st&=67108863,g=Math.imul(J,xe),f=Math.imul(J,Pe),f=f+Math.imul(X,xe)|0,v=Math.imul(X,Pe),g=g+Math.imul(V,Se)|0,f=f+Math.imul(V,_e)|0,f=f+Math.imul(W,Se)|0,v=v+Math.imul(W,_e)|0,g=g+Math.imul(T,Me)|0,f=f+Math.imul(T,Te)|0,f=f+Math.imul(R,Me)|0,v=v+Math.imul(R,Te)|0;var Ve=(_+g|0)+((f&8191)<<13)|0;_=(v+(f>>>13)|0)+(Ve>>>26)|0,Ve&=67108863,g=Math.imul(re,xe),f=Math.imul(re,Pe),f=f+Math.imul(ne,xe)|0,v=Math.imul(ne,Pe),g=g+Math.imul(J,Se)|0,f=f+Math.imul(J,_e)|0,f=f+Math.imul(X,Se)|0,v=v+Math.imul(X,_e)|0,g=g+Math.imul(V,Me)|0,f=f+Math.imul(V,Te)|0,f=f+Math.imul(W,Me)|0,v=v+Math.imul(W,Te)|0,g=g+Math.imul(T,Ae)|0,f=f+Math.imul(T,Be)|0,f=f+Math.imul(R,Ae)|0,v=v+Math.imul(R,Be)|0;var Tt=(_+g|0)+((f&8191)<<13)|0;_=(v+(f>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,g=Math.imul(ce,xe),f=Math.imul(ce,Pe),f=f+Math.imul(ye,xe)|0,v=Math.imul(ye,Pe),g=g+Math.imul(re,Se)|0,f=f+Math.imul(re,_e)|0,f=f+Math.imul(ne,Se)|0,v=v+Math.imul(ne,_e)|0,g=g+Math.imul(J,Me)|0,f=f+Math.imul(J,Te)|0,f=f+Math.imul(X,Me)|0,v=v+Math.imul(X,Te)|0,g=g+Math.imul(V,Ae)|0,f=f+Math.imul(V,Be)|0,f=f+Math.imul(W,Ae)|0,v=v+Math.imul(W,Be)|0,g=g+Math.imul(T,De)|0,f=f+Math.imul(T,Ie)|0,f=f+Math.imul(R,De)|0,v=v+Math.imul(R,Ie)|0;var Ut=(_+g|0)+((f&8191)<<13)|0;_=(v+(f>>>13)|0)+(Ut>>>26)|0,Ut&=67108863,g=Math.imul(ie,xe),f=Math.imul(ie,Pe),f=f+Math.imul(oe,xe)|0,v=Math.imul(oe,Pe),g=g+Math.imul(ce,Se)|0,f=f+Math.imul(ce,_e)|0,f=f+Math.imul(ye,Se)|0,v=v+Math.imul(ye,_e)|0,g=g+Math.imul(re,Me)|0,f=f+Math.imul(re,Te)|0,f=f+Math.imul(ne,Me)|0,v=v+Math.imul(ne,Te)|0,g=g+Math.imul(J,Ae)|0,f=f+Math.imul(J,Be)|0,f=f+Math.imul(X,Ae)|0,v=v+Math.imul(X,Be)|0,g=g+Math.imul(V,De)|0,f=f+Math.imul(V,Ie)|0,f=f+Math.imul(W,De)|0,v=v+Math.imul(W,Ie)|0,g=g+Math.imul(T,Re)|0,f=f+Math.imul(T,ke)|0,f=f+Math.imul(R,Re)|0,v=v+Math.imul(R,ke)|0;var Pt=(_+g|0)+((f&8191)<<13)|0;_=(v+(f>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,g=Math.imul(le,xe),f=Math.imul(le,Pe),f=f+Math.imul(me,xe)|0,v=Math.imul(me,Pe),g=g+Math.imul(ie,Se)|0,f=f+Math.imul(ie,_e)|0,f=f+Math.imul(oe,Se)|0,v=v+Math.imul(oe,_e)|0,g=g+Math.imul(ce,Me)|0,f=f+Math.imul(ce,Te)|0,f=f+Math.imul(ye,Me)|0,v=v+Math.imul(ye,Te)|0,g=g+Math.imul(re,Ae)|0,f=f+Math.imul(re,Be)|0,f=f+Math.imul(ne,Ae)|0,v=v+Math.imul(ne,Be)|0,g=g+Math.imul(J,De)|0,f=f+Math.imul(J,Ie)|0,f=f+Math.imul(X,De)|0,v=v+Math.imul(X,Ie)|0,g=g+Math.imul(V,Re)|0,f=f+Math.imul(V,ke)|0,f=f+Math.imul(W,Re)|0,v=v+Math.imul(W,ke)|0,g=g+Math.imul(T,Oe)|0,f=f+Math.imul(T,Ce)|0,f=f+Math.imul(R,Oe)|0,v=v+Math.imul(R,Ce)|0;var yt=(_+g|0)+((f&8191)<<13)|0;_=(v+(f>>>13)|0)+(yt>>>26)|0,yt&=67108863,g=Math.imul(ue,xe),f=Math.imul(ue,Pe),f=f+Math.imul(he,xe)|0,v=Math.imul(he,Pe),g=g+Math.imul(le,Se)|0,f=f+Math.imul(le,_e)|0,f=f+Math.imul(me,Se)|0,v=v+Math.imul(me,_e)|0,g=g+Math.imul(ie,Me)|0,f=f+Math.imul(ie,Te)|0,f=f+Math.imul(oe,Me)|0,v=v+Math.imul(oe,Te)|0,g=g+Math.imul(ce,Ae)|0,f=f+Math.imul(ce,Be)|0,f=f+Math.imul(ye,Ae)|0,v=v+Math.imul(ye,Be)|0,g=g+Math.imul(re,De)|0,f=f+Math.imul(re,Ie)|0,f=f+Math.imul(ne,De)|0,v=v+Math.imul(ne,Ie)|0,g=g+Math.imul(J,Re)|0,f=f+Math.imul(J,ke)|0,f=f+Math.imul(X,Re)|0,v=v+Math.imul(X,ke)|0,g=g+Math.imul(V,Oe)|0,f=f+Math.imul(V,Ce)|0,f=f+Math.imul(W,Oe)|0,v=v+Math.imul(W,Ce)|0,g=g+Math.imul(T,Q)|0,f=f+Math.imul(T,Y)|0,f=f+Math.imul(R,Q)|0,v=v+Math.imul(R,Y)|0;var Rt=(_+g|0)+((f&8191)<<13)|0;_=(v+(f>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,g=Math.imul(se,xe),f=Math.imul(se,Pe),f=f+Math.imul(fe,xe)|0,v=Math.imul(fe,Pe),g=g+Math.imul(ue,Se)|0,f=f+Math.imul(ue,_e)|0,f=f+Math.imul(he,Se)|0,v=v+Math.imul(he,_e)|0,g=g+Math.imul(le,Me)|0,f=f+Math.imul(le,Te)|0,f=f+Math.imul(me,Me)|0,v=v+Math.imul(me,Te)|0,g=g+Math.imul(ie,Ae)|0,f=f+Math.imul(ie,Be)|0,f=f+Math.imul(oe,Ae)|0,v=v+Math.imul(oe,Be)|0,g=g+Math.imul(ce,De)|0,f=f+Math.imul(ce,Ie)|0,f=f+Math.imul(ye,De)|0,v=v+Math.imul(ye,Ie)|0,g=g+Math.imul(re,Re)|0,f=f+Math.imul(re,ke)|0,f=f+Math.imul(ne,Re)|0,v=v+Math.imul(ne,ke)|0,g=g+Math.imul(J,Oe)|0,f=f+Math.imul(J,Ce)|0,f=f+Math.imul(X,Oe)|0,v=v+Math.imul(X,Ce)|0,g=g+Math.imul(V,Q)|0,f=f+Math.imul(V,Y)|0,f=f+Math.imul(W,Q)|0,v=v+Math.imul(W,Y)|0,g=g+Math.imul(T,ee)|0,f=f+Math.imul(T,te)|0,f=f+Math.imul(R,ee)|0,v=v+Math.imul(R,te)|0;var _t=(_+g|0)+((f&8191)<<13)|0;_=(v+(f>>>13)|0)+(_t>>>26)|0,_t&=67108863,g=Math.imul(ge,xe),f=Math.imul(ge,Pe),f=f+Math.imul(ve,xe)|0,v=Math.imul(ve,Pe),g=g+Math.imul(se,Se)|0,f=f+Math.imul(se,_e)|0,f=f+Math.imul(fe,Se)|0,v=v+Math.imul(fe,_e)|0,g=g+Math.imul(ue,Me)|0,f=f+Math.imul(ue,Te)|0,f=f+Math.imul(he,Me)|0,v=v+Math.imul(he,Te)|0,g=g+Math.imul(le,Ae)|0,f=f+Math.imul(le,Be)|0,f=f+Math.imul(me,Ae)|0,v=v+Math.imul(me,Be)|0,g=g+Math.imul(ie,De)|0,f=f+Math.imul(ie,Ie)|0,f=f+Math.imul(oe,De)|0,v=v+Math.imul(oe,Ie)|0,g=g+Math.imul(ce,Re)|0,f=f+Math.imul(ce,ke)|0,f=f+Math.imul(ye,Re)|0,v=v+Math.imul(ye,ke)|0,g=g+Math.imul(re,Oe)|0,f=f+Math.imul(re,Ce)|0,f=f+Math.imul(ne,Oe)|0,v=v+Math.imul(ne,Ce)|0,g=g+Math.imul(J,Q)|0,f=f+Math.imul(J,Y)|0,f=f+Math.imul(X,Q)|0,v=v+Math.imul(X,Y)|0,g=g+Math.imul(V,ee)|0,f=f+Math.imul(V,te)|0,f=f+Math.imul(W,ee)|0,v=v+Math.imul(W,te)|0,g=g+Math.imul(T,de)|0,f=f+Math.imul(T,pe)|0,f=f+Math.imul(R,de)|0,v=v+Math.imul(R,pe)|0;var Lr=(_+g|0)+((f&8191)<<13)|0;_=(v+(f>>>13)|0)+(Lr>>>26)|0,Lr&=67108863,g=Math.imul(ge,Se),f=Math.imul(ge,_e),f=f+Math.imul(ve,Se)|0,v=Math.imul(ve,_e),g=g+Math.imul(se,Me)|0,f=f+Math.imul(se,Te)|0,f=f+Math.imul(fe,Me)|0,v=v+Math.imul(fe,Te)|0,g=g+Math.imul(ue,Ae)|0,f=f+Math.imul(ue,Be)|0,f=f+Math.imul(he,Ae)|0,v=v+Math.imul(he,Be)|0,g=g+Math.imul(le,De)|0,f=f+Math.imul(le,Ie)|0,f=f+Math.imul(me,De)|0,v=v+Math.imul(me,Ie)|0,g=g+Math.imul(ie,Re)|0,f=f+Math.imul(ie,ke)|0,f=f+Math.imul(oe,Re)|0,v=v+Math.imul(oe,ke)|0,g=g+Math.imul(ce,Oe)|0,f=f+Math.imul(ce,Ce)|0,f=f+Math.imul(ye,Oe)|0,v=v+Math.imul(ye,Ce)|0,g=g+Math.imul(re,Q)|0,f=f+Math.imul(re,Y)|0,f=f+Math.imul(ne,Q)|0,v=v+Math.imul(ne,Y)|0,g=g+Math.imul(J,ee)|0,f=f+Math.imul(J,te)|0,f=f+Math.imul(X,ee)|0,v=v+Math.imul(X,te)|0,g=g+Math.imul(V,de)|0,f=f+Math.imul(V,pe)|0,f=f+Math.imul(W,de)|0,v=v+Math.imul(W,pe)|0;var nr=(_+g|0)+((f&8191)<<13)|0;_=(v+(f>>>13)|0)+(nr>>>26)|0,nr&=67108863,g=Math.imul(ge,Me),f=Math.imul(ge,Te),f=f+Math.imul(ve,Me)|0,v=Math.imul(ve,Te),g=g+Math.imul(se,Ae)|0,f=f+Math.imul(se,Be)|0,f=f+Math.imul(fe,Ae)|0,v=v+Math.imul(fe,Be)|0,g=g+Math.imul(ue,De)|0,f=f+Math.imul(ue,Ie)|0,f=f+Math.imul(he,De)|0,v=v+Math.imul(he,Ie)|0,g=g+Math.imul(le,Re)|0,f=f+Math.imul(le,ke)|0,f=f+Math.imul(me,Re)|0,v=v+Math.imul(me,ke)|0,g=g+Math.imul(ie,Oe)|0,f=f+Math.imul(ie,Ce)|0,f=f+Math.imul(oe,Oe)|0,v=v+Math.imul(oe,Ce)|0,g=g+Math.imul(ce,Q)|0,f=f+Math.imul(ce,Y)|0,f=f+Math.imul(ye,Q)|0,v=v+Math.imul(ye,Y)|0,g=g+Math.imul(re,ee)|0,f=f+Math.imul(re,te)|0,f=f+Math.imul(ne,ee)|0,v=v+Math.imul(ne,te)|0,g=g+Math.imul(J,de)|0,f=f+Math.imul(J,pe)|0,f=f+Math.imul(X,de)|0,v=v+Math.imul(X,pe)|0;var lr=(_+g|0)+((f&8191)<<13)|0;_=(v+(f>>>13)|0)+(lr>>>26)|0,lr&=67108863,g=Math.imul(ge,Ae),f=Math.imul(ge,Be),f=f+Math.imul(ve,Ae)|0,v=Math.imul(ve,Be),g=g+Math.imul(se,De)|0,f=f+Math.imul(se,Ie)|0,f=f+Math.imul(fe,De)|0,v=v+Math.imul(fe,Ie)|0,g=g+Math.imul(ue,Re)|0,f=f+Math.imul(ue,ke)|0,f=f+Math.imul(he,Re)|0,v=v+Math.imul(he,ke)|0,g=g+Math.imul(le,Oe)|0,f=f+Math.imul(le,Ce)|0,f=f+Math.imul(me,Oe)|0,v=v+Math.imul(me,Ce)|0,g=g+Math.imul(ie,Q)|0,f=f+Math.imul(ie,Y)|0,f=f+Math.imul(oe,Q)|0,v=v+Math.imul(oe,Y)|0,g=g+Math.imul(ce,ee)|0,f=f+Math.imul(ce,te)|0,f=f+Math.imul(ye,ee)|0,v=v+Math.imul(ye,te)|0,g=g+Math.imul(re,de)|0,f=f+Math.imul(re,pe)|0,f=f+Math.imul(ne,de)|0,v=v+Math.imul(ne,pe)|0;var xt=(_+g|0)+((f&8191)<<13)|0;_=(v+(f>>>13)|0)+(xt>>>26)|0,xt&=67108863,g=Math.imul(ge,De),f=Math.imul(ge,Ie),f=f+Math.imul(ve,De)|0,v=Math.imul(ve,Ie),g=g+Math.imul(se,Re)|0,f=f+Math.imul(se,ke)|0,f=f+Math.imul(fe,Re)|0,v=v+Math.imul(fe,ke)|0,g=g+Math.imul(ue,Oe)|0,f=f+Math.imul(ue,Ce)|0,f=f+Math.imul(he,Oe)|0,v=v+Math.imul(he,Ce)|0,g=g+Math.imul(le,Q)|0,f=f+Math.imul(le,Y)|0,f=f+Math.imul(me,Q)|0,v=v+Math.imul(me,Y)|0,g=g+Math.imul(ie,ee)|0,f=f+Math.imul(ie,te)|0,f=f+Math.imul(oe,ee)|0,v=v+Math.imul(oe,te)|0,g=g+Math.imul(ce,de)|0,f=f+Math.imul(ce,pe)|0,f=f+Math.imul(ye,de)|0,v=v+Math.imul(ye,pe)|0;var ir=(_+g|0)+((f&8191)<<13)|0;_=(v+(f>>>13)|0)+(ir>>>26)|0,ir&=67108863,g=Math.imul(ge,Re),f=Math.imul(ge,ke),f=f+Math.imul(ve,Re)|0,v=Math.imul(ve,ke),g=g+Math.imul(se,Oe)|0,f=f+Math.imul(se,Ce)|0,f=f+Math.imul(fe,Oe)|0,v=v+Math.imul(fe,Ce)|0,g=g+Math.imul(ue,Q)|0,f=f+Math.imul(ue,Y)|0,f=f+Math.imul(he,Q)|0,v=v+Math.imul(he,Y)|0,g=g+Math.imul(le,ee)|0,f=f+Math.imul(le,te)|0,f=f+Math.imul(me,ee)|0,v=v+Math.imul(me,te)|0,g=g+Math.imul(ie,de)|0,f=f+Math.imul(ie,pe)|0,f=f+Math.imul(oe,de)|0,v=v+Math.imul(oe,pe)|0;var dr=(_+g|0)+((f&8191)<<13)|0;_=(v+(f>>>13)|0)+(dr>>>26)|0,dr&=67108863,g=Math.imul(ge,Oe),f=Math.imul(ge,Ce),f=f+Math.imul(ve,Oe)|0,v=Math.imul(ve,Ce),g=g+Math.imul(se,Q)|0,f=f+Math.imul(se,Y)|0,f=f+Math.imul(fe,Q)|0,v=v+Math.imul(fe,Y)|0,g=g+Math.imul(ue,ee)|0,f=f+Math.imul(ue,te)|0,f=f+Math.imul(he,ee)|0,v=v+Math.imul(he,te)|0,g=g+Math.imul(le,de)|0,f=f+Math.imul(le,pe)|0,f=f+Math.imul(me,de)|0,v=v+Math.imul(me,pe)|0;var Er=(_+g|0)+((f&8191)<<13)|0;_=(v+(f>>>13)|0)+(Er>>>26)|0,Er&=67108863,g=Math.imul(ge,Q),f=Math.imul(ge,Y),f=f+Math.imul(ve,Q)|0,v=Math.imul(ve,Y),g=g+Math.imul(se,ee)|0,f=f+Math.imul(se,te)|0,f=f+Math.imul(fe,ee)|0,v=v+Math.imul(fe,te)|0,g=g+Math.imul(ue,de)|0,f=f+Math.imul(ue,pe)|0,f=f+Math.imul(he,de)|0,v=v+Math.imul(he,pe)|0;var Ur=(_+g|0)+((f&8191)<<13)|0;_=(v+(f>>>13)|0)+(Ur>>>26)|0,Ur&=67108863,g=Math.imul(ge,ee),f=Math.imul(ge,te),f=f+Math.imul(ve,ee)|0,v=Math.imul(ve,te),g=g+Math.imul(se,de)|0,f=f+Math.imul(se,pe)|0,f=f+Math.imul(fe,de)|0,v=v+Math.imul(fe,pe)|0;var Rr=(_+g|0)+((f&8191)<<13)|0;_=(v+(f>>>13)|0)+(Rr>>>26)|0,Rr&=67108863,g=Math.imul(ge,de),f=Math.imul(ge,pe),f=f+Math.imul(ve,de)|0,v=Math.imul(ve,pe);var Hr=(_+g|0)+((f&8191)<<13)|0;return _=(v+(f>>>13)|0)+(Hr>>>26)|0,Hr&=67108863,b[0]=bt,b[1]=st,b[2]=Ve,b[3]=Tt,b[4]=Ut,b[5]=Pt,b[6]=yt,b[7]=Rt,b[8]=_t,b[9]=Lr,b[10]=nr,b[11]=lr,b[12]=xt,b[13]=ir,b[14]=dr,b[15]=Er,b[16]=Ur,b[17]=Rr,b[18]=Hr,_!==0&&(b[19]=_,y.length++),y};Math.imul||(M=S);function A(x,c,u){u.negative=c.negative^x.negative,u.length=x.length+c.length;for(var y=0,l=0,h=0;h<u.length-1;h++){var b=l;l=0;for(var _=y&67108863,g=Math.min(h,c.length-1),f=Math.max(0,h-x.length+1);f<=g;f++){var v=h-f,O=x.words[v]|0,T=c.words[f]|0,R=O*T,z=R&67108863;b=b+(R/67108864|0)|0,z=z+_|0,_=z&67108863,b=b+(z>>>26)|0,l+=b>>>26,b&=67108863}u.words[h]=_,y=b,b=l}return y!==0?u.words[h]=y:u.length--,u.strip()}function B(x,c,u){var y=new I;return y.mulp(x,c,u)}i.prototype.mulTo=function(c,u){var y,l=this.length+c.length;return this.length===10&&c.length===10?y=M(this,c,u):l<63?y=S(this,c,u):l<1024?y=A(this,c,u):y=B(this,c,u),y};function I(x,c){this.x=x,this.y=c}I.prototype.makeRBT=function(c){for(var u=new Array(c),y=i.prototype._countBits(c)-1,l=0;l<c;l++)u[l]=this.revBin(l,y,c);return u},I.prototype.revBin=function(c,u,y){if(c===0||c===y-1)return c;for(var l=0,h=0;h<u;h++)l|=(c&1)<<u-h-1,c>>=1;return l},I.prototype.permute=function(c,u,y,l,h,b){for(var _=0;_<b;_++)l[_]=u[c[_]],h[_]=y[c[_]]},I.prototype.transform=function(c,u,y,l,h,b){this.permute(b,c,u,y,l,h);for(var _=1;_<h;_<<=1)for(var g=_<<1,f=Math.cos(2*Math.PI/g),v=Math.sin(2*Math.PI/g),O=0;O<h;O+=g)for(var T=f,R=v,z=0;z<_;z++){var V=y[O+z],W=l[O+z],Z=y[O+z+_],J=l[O+z+_],X=T*Z-R*J;J=T*J+R*Z,Z=X,y[O+z]=V+Z,l[O+z]=W+J,y[O+z+_]=V-Z,l[O+z+_]=W-J,z!==g&&(X=f*T-v*R,R=f*R+v*T,T=X)}},I.prototype.guessLen13b=function(c,u){var y=Math.max(u,c)|1,l=y&1,h=0;for(y=y/2|0;y;y=y>>>1)h++;return 1<<h+1+l},I.prototype.conjugate=function(c,u,y){if(!(y<=1))for(var l=0;l<y/2;l++){var h=c[l];c[l]=c[y-l-1],c[y-l-1]=h,h=u[l],u[l]=-u[y-l-1],u[y-l-1]=-h}},I.prototype.normalize13b=function(c,u){for(var y=0,l=0;l<u/2;l++){var h=Math.round(c[2*l+1]/u)*8192+Math.round(c[2*l]/u)+y;c[l]=h&67108863,h<67108864?y=0:y=h/67108864|0}return c},I.prototype.convert13b=function(c,u,y,l){for(var h=0,b=0;b<u;b++)h=h+(c[b]|0),y[2*b]=h&8191,h=h>>>13,y[2*b+1]=h&8191,h=h>>>13;for(b=2*u;b<l;++b)y[b]=0;r(h===0),r((h&-8192)===0)},I.prototype.stub=function(c){for(var u=new Array(c),y=0;y<c;y++)u[y]=0;return u},I.prototype.mulp=function(c,u,y){var l=2*this.guessLen13b(c.length,u.length),h=this.makeRBT(l),b=this.stub(l),_=new Array(l),g=new Array(l),f=new Array(l),v=new Array(l),O=new Array(l),T=new Array(l),R=y.words;R.length=l,this.convert13b(c.words,c.length,_,l),this.convert13b(u.words,u.length,v,l),this.transform(_,b,g,f,l,h),this.transform(v,b,O,T,l,h);for(var z=0;z<l;z++){var V=g[z]*O[z]-f[z]*T[z];f[z]=g[z]*T[z]+f[z]*O[z],g[z]=V}return this.conjugate(g,f,l),this.transform(g,f,R,b,l,h),this.conjugate(R,b,l),this.normalize13b(R,l),y.negative=c.negative^u.negative,y.length=c.length+u.length,y.strip()},i.prototype.mul=function(c){var u=new i(null);return u.words=new Array(this.length+c.length),this.mulTo(c,u)},i.prototype.mulf=function(c){var u=new i(null);return u.words=new Array(this.length+c.length),B(this,c,u)},i.prototype.imul=function(c){return this.clone().mulTo(c,this)},i.prototype.imuln=function(c){r(typeof c=="number"),r(c<67108864);for(var u=0,y=0;y<this.length;y++){var l=(this.words[y]|0)*c,h=(l&67108863)+(u&67108863);u>>=26,u+=l/67108864|0,u+=h>>>26,this.words[y]=h&67108863}return u!==0&&(this.words[y]=u,this.length++),this},i.prototype.muln=function(c){return this.clone().imuln(c)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(c){var u=P(c);if(u.length===0)return new i(1);for(var y=this,l=0;l<u.length&&u[l]===0;l++,y=y.sqr());if(++l<u.length)for(var h=y.sqr();l<u.length;l++,h=h.sqr())u[l]!==0&&(y=y.mul(h));return y},i.prototype.iushln=function(c){r(typeof c=="number"&&c>=0);var u=c%26,y=(c-u)/26,l=67108863>>>26-u<<26-u,h;if(u!==0){var b=0;for(h=0;h<this.length;h++){var _=this.words[h]&l,g=(this.words[h]|0)-_<<u;this.words[h]=g|b,b=_>>>26-u}b&&(this.words[h]=b,this.length++)}if(y!==0){for(h=this.length-1;h>=0;h--)this.words[h+y]=this.words[h];for(h=0;h<y;h++)this.words[h]=0;this.length+=y}return this.strip()},i.prototype.ishln=function(c){return r(this.negative===0),this.iushln(c)},i.prototype.iushrn=function(c,u,y){r(typeof c=="number"&&c>=0);var l;u?l=(u-u%26)/26:l=0;var h=c%26,b=Math.min((c-h)/26,this.length),_=67108863^67108863>>>h<<h,g=y;if(l-=b,l=Math.max(0,l),g){for(var f=0;f<b;f++)g.words[f]=this.words[f];g.length=b}if(b!==0)if(this.length>b)for(this.length-=b,f=0;f<this.length;f++)this.words[f]=this.words[f+b];else this.words[0]=0,this.length=1;var v=0;for(f=this.length-1;f>=0&&(v!==0||f>=l);f--){var O=this.words[f]|0;this.words[f]=v<<26-h|O>>>h,v=O&_}return g&&v!==0&&(g.words[g.length++]=v),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},i.prototype.ishrn=function(c,u,y){return r(this.negative===0),this.iushrn(c,u,y)},i.prototype.shln=function(c){return this.clone().ishln(c)},i.prototype.ushln=function(c){return this.clone().iushln(c)},i.prototype.shrn=function(c){return this.clone().ishrn(c)},i.prototype.ushrn=function(c){return this.clone().iushrn(c)},i.prototype.testn=function(c){r(typeof c=="number"&&c>=0);var u=c%26,y=(c-u)/26,l=1<<u;if(this.length<=y)return!1;var h=this.words[y];return!!(h&l)},i.prototype.imaskn=function(c){r(typeof c=="number"&&c>=0);var u=c%26,y=(c-u)/26;if(r(this.negative===0,"imaskn works only with positive numbers"),this.length<=y)return this;if(u!==0&&y++,this.length=Math.min(y,this.length),u!==0){var l=67108863^67108863>>>u<<u;this.words[this.length-1]&=l}return this.strip()},i.prototype.maskn=function(c){return this.clone().imaskn(c)},i.prototype.iaddn=function(c){return r(typeof c=="number"),r(c<67108864),c<0?this.isubn(-c):this.negative!==0?this.length===1&&(this.words[0]|0)<c?(this.words[0]=c-(this.words[0]|0),this.negative=0,this):(this.negative=0,this.isubn(c),this.negative=1,this):this._iaddn(c)},i.prototype._iaddn=function(c){this.words[0]+=c;for(var u=0;u<this.length&&this.words[u]>=67108864;u++)this.words[u]-=67108864,u===this.length-1?this.words[u+1]=1:this.words[u+1]++;return this.length=Math.max(this.length,u+1),this},i.prototype.isubn=function(c){if(r(typeof c=="number"),r(c<67108864),c<0)return this.iaddn(-c);if(this.negative!==0)return this.negative=0,this.iaddn(c),this.negative=1,this;if(this.words[0]-=c,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var u=0;u<this.length&&this.words[u]<0;u++)this.words[u]+=67108864,this.words[u+1]-=1;return this.strip()},i.prototype.addn=function(c){return this.clone().iaddn(c)},i.prototype.subn=function(c){return this.clone().isubn(c)},i.prototype.iabs=function(){return this.negative=0,this},i.prototype.abs=function(){return this.clone().iabs()},i.prototype._ishlnsubmul=function(c,u,y){var l=c.length+y,h;this._expand(l);var b,_=0;for(h=0;h<c.length;h++){b=(this.words[h+y]|0)+_;var g=(c.words[h]|0)*u;b-=g&67108863,_=(b>>26)-(g/67108864|0),this.words[h+y]=b&67108863}for(;h<this.length-y;h++)b=(this.words[h+y]|0)+_,_=b>>26,this.words[h+y]=b&67108863;if(_===0)return this.strip();for(r(_===-1),_=0,h=0;h<this.length;h++)b=-(this.words[h]|0)+_,_=b>>26,this.words[h]=b&67108863;return this.negative=1,this.strip()},i.prototype._wordDiv=function(c,u){var y=this.length-c.length,l=this.clone(),h=c,b=h.words[h.length-1]|0,_=this._countBits(b);y=26-_,y!==0&&(h=h.ushln(y),l.iushln(y),b=h.words[h.length-1]|0);var g=l.length-h.length,f;if(u!=="mod"){f=new i(null),f.length=g+1,f.words=new Array(f.length);for(var v=0;v<f.length;v++)f.words[v]=0}var O=l.clone()._ishlnsubmul(h,1,g);O.negative===0&&(l=O,f&&(f.words[g]=1));for(var T=g-1;T>=0;T--){var R=(l.words[h.length+T]|0)*67108864+(l.words[h.length+T-1]|0);for(R=Math.min(R/b|0,67108863),l._ishlnsubmul(h,R,T);l.negative!==0;)R--,l.negative=0,l._ishlnsubmul(h,1,T),l.isZero()||(l.negative^=1);f&&(f.words[T]=R)}return f&&f.strip(),l.strip(),u!=="div"&&y!==0&&l.iushrn(y),{div:f||null,mod:l}},i.prototype.divmod=function(c,u,y){if(r(!c.isZero()),this.isZero())return{div:new i(0),mod:new i(0)};var l,h,b;return this.negative!==0&&c.negative===0?(b=this.neg().divmod(c,u),u!=="mod"&&(l=b.div.neg()),u!=="div"&&(h=b.mod.neg(),y&&h.negative!==0&&h.iadd(c)),{div:l,mod:h}):this.negative===0&&c.negative!==0?(b=this.divmod(c.neg(),u),u!=="mod"&&(l=b.div.neg()),{div:l,mod:b.mod}):this.negative&c.negative?(b=this.neg().divmod(c.neg(),u),u!=="div"&&(h=b.mod.neg(),y&&h.negative!==0&&h.isub(c)),{div:b.div,mod:h}):c.length>this.length||this.cmp(c)<0?{div:new i(0),mod:this}:c.length===1?u==="div"?{div:this.divn(c.words[0]),mod:null}:u==="mod"?{div:null,mod:new i(this.modn(c.words[0]))}:{div:this.divn(c.words[0]),mod:new i(this.modn(c.words[0]))}:this._wordDiv(c,u)},i.prototype.div=function(c){return this.divmod(c,"div",!1).div},i.prototype.mod=function(c){return this.divmod(c,"mod",!1).mod},i.prototype.umod=function(c){return this.divmod(c,"mod",!0).mod},i.prototype.divRound=function(c){var u=this.divmod(c);if(u.mod.isZero())return u.div;var y=u.div.negative!==0?u.mod.isub(c):u.mod,l=c.ushrn(1),h=c.andln(1),b=y.cmp(l);return b<0||h===1&&b===0?u.div:u.div.negative!==0?u.div.isubn(1):u.div.iaddn(1)},i.prototype.modn=function(c){r(c<=67108863);for(var u=(1<<26)%c,y=0,l=this.length-1;l>=0;l--)y=(u*y+(this.words[l]|0))%c;return y},i.prototype.idivn=function(c){r(c<=67108863);for(var u=0,y=this.length-1;y>=0;y--){var l=(this.words[y]|0)+u*67108864;this.words[y]=l/c|0,u=l%c}return this.strip()},i.prototype.divn=function(c){return this.clone().idivn(c)},i.prototype.egcd=function(c){r(c.negative===0),r(!c.isZero());var u=this,y=c.clone();u.negative!==0?u=u.umod(c):u=u.clone();for(var l=new i(1),h=new i(0),b=new i(0),_=new i(1),g=0;u.isEven()&&y.isEven();)u.iushrn(1),y.iushrn(1),++g;for(var f=y.clone(),v=u.clone();!u.isZero();){for(var O=0,T=1;!(u.words[0]&T)&&O<26;++O,T<<=1);if(O>0)for(u.iushrn(O);O-- >0;)(l.isOdd()||h.isOdd())&&(l.iadd(f),h.isub(v)),l.iushrn(1),h.iushrn(1);for(var R=0,z=1;!(y.words[0]&z)&&R<26;++R,z<<=1);if(R>0)for(y.iushrn(R);R-- >0;)(b.isOdd()||_.isOdd())&&(b.iadd(f),_.isub(v)),b.iushrn(1),_.iushrn(1);u.cmp(y)>=0?(u.isub(y),l.isub(b),h.isub(_)):(y.isub(u),b.isub(l),_.isub(h))}return{a:b,b:_,gcd:y.iushln(g)}},i.prototype._invmp=function(c){r(c.negative===0),r(!c.isZero());var u=this,y=c.clone();u.negative!==0?u=u.umod(c):u=u.clone();for(var l=new i(1),h=new i(0),b=y.clone();u.cmpn(1)>0&&y.cmpn(1)>0;){for(var _=0,g=1;!(u.words[0]&g)&&_<26;++_,g<<=1);if(_>0)for(u.iushrn(_);_-- >0;)l.isOdd()&&l.iadd(b),l.iushrn(1);for(var f=0,v=1;!(y.words[0]&v)&&f<26;++f,v<<=1);if(f>0)for(y.iushrn(f);f-- >0;)h.isOdd()&&h.iadd(b),h.iushrn(1);u.cmp(y)>=0?(u.isub(y),l.isub(h)):(y.isub(u),h.isub(l))}var O;return u.cmpn(1)===0?O=l:O=h,O.cmpn(0)<0&&O.iadd(c),O},i.prototype.gcd=function(c){if(this.isZero())return c.abs();if(c.isZero())return this.abs();var u=this.clone(),y=c.clone();u.negative=0,y.negative=0;for(var l=0;u.isEven()&&y.isEven();l++)u.iushrn(1),y.iushrn(1);do{for(;u.isEven();)u.iushrn(1);for(;y.isEven();)y.iushrn(1);var h=u.cmp(y);if(h<0){var b=u;u=y,y=b}else if(h===0||y.cmpn(1)===0)break;u.isub(y)}while(!0);return y.iushln(l)},i.prototype.invm=function(c){return this.egcd(c).a.umod(c)},i.prototype.isEven=function(){return(this.words[0]&1)===0},i.prototype.isOdd=function(){return(this.words[0]&1)===1},i.prototype.andln=function(c){return this.words[0]&c},i.prototype.bincn=function(c){r(typeof c=="number");var u=c%26,y=(c-u)/26,l=1<<u;if(this.length<=y)return this._expand(y+1),this.words[y]|=l,this;for(var h=l,b=y;h!==0&&b<this.length;b++){var _=this.words[b]|0;_+=h,h=_>>>26,_&=67108863,this.words[b]=_}return h!==0&&(this.words[b]=h,this.length++),this},i.prototype.isZero=function(){return this.length===1&&this.words[0]===0},i.prototype.cmpn=function(c){var u=c<0;if(this.negative!==0&&!u)return-1;if(this.negative===0&&u)return 1;this.strip();var y;if(this.length>1)y=1;else{u&&(c=-c),r(c<=67108863,"Number is too big");var l=this.words[0]|0;y=l===c?0:l<c?-1:1}return this.negative!==0?-y|0:y},i.prototype.cmp=function(c){if(this.negative!==0&&c.negative===0)return-1;if(this.negative===0&&c.negative!==0)return 1;var u=this.ucmp(c);return this.negative!==0?-u|0:u},i.prototype.ucmp=function(c){if(this.length>c.length)return 1;if(this.length<c.length)return-1;for(var u=0,y=this.length-1;y>=0;y--){var l=this.words[y]|0,h=c.words[y]|0;if(l!==h){l<h?u=-1:l>h&&(u=1);break}}return u},i.prototype.gtn=function(c){return this.cmpn(c)===1},i.prototype.gt=function(c){return this.cmp(c)===1},i.prototype.gten=function(c){return this.cmpn(c)>=0},i.prototype.gte=function(c){return this.cmp(c)>=0},i.prototype.ltn=function(c){return this.cmpn(c)===-1},i.prototype.lt=function(c){return this.cmp(c)===-1},i.prototype.lten=function(c){return this.cmpn(c)<=0},i.prototype.lte=function(c){return this.cmp(c)<=0},i.prototype.eqn=function(c){return this.cmpn(c)===0},i.prototype.eq=function(c){return this.cmp(c)===0},i.red=function(c){return new N(c)},i.prototype.toRed=function(c){return r(!this.red,"Already a number in reduction context"),r(this.negative===0,"red works only with positives"),c.convertTo(this)._forceRed(c)},i.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(c){return this.red=c,this},i.prototype.forceRed=function(c){return r(!this.red,"Already a number in reduction context"),this._forceRed(c)},i.prototype.redAdd=function(c){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,c)},i.prototype.redIAdd=function(c){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,c)},i.prototype.redSub=function(c){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,c)},i.prototype.redISub=function(c){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,c)},i.prototype.redShl=function(c){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,c)},i.prototype.redMul=function(c){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,c),this.red.mul(this,c)},i.prototype.redIMul=function(c){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,c),this.red.imul(this,c)},i.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(c){return r(this.red&&!c.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,c)};var C={k256:null,p224:null,p192:null,p25519:null};function k(x,c){this.name=x,this.p=new i(c,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}k.prototype._tmp=function(){var c=new i(null);return c.words=new Array(Math.ceil(this.n/13)),c},k.prototype.ireduce=function(c){var u=c,y;do this.split(u,this.tmp),u=this.imulK(u),u=u.iadd(this.tmp),y=u.bitLength();while(y>this.n);var l=y<this.n?-1:u.ucmp(this.p);return l===0?(u.words[0]=0,u.length=1):l>0?u.isub(this.p):u.strip!==void 0?u.strip():u._strip(),u},k.prototype.split=function(c,u){c.iushrn(this.n,0,u)},k.prototype.imulK=function(c){return c.imul(this.k)};function q(){k.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}n(q,k),q.prototype.split=function(c,u){for(var y=4194303,l=Math.min(c.length,9),h=0;h<l;h++)u.words[h]=c.words[h];if(u.length=l,c.length<=9){c.words[0]=0,c.length=1;return}var b=c.words[9];for(u.words[u.length++]=b&y,h=10;h<c.length;h++){var _=c.words[h]|0;c.words[h-10]=(_&y)<<4|b>>>22,b=_}b>>>=22,c.words[h-10]=b,b===0&&c.length>10?c.length-=10:c.length-=9},q.prototype.imulK=function(c){c.words[c.length]=0,c.words[c.length+1]=0,c.length+=2;for(var u=0,y=0;y<c.length;y++){var l=c.words[y]|0;u+=l*977,c.words[y]=u&67108863,u=l*64+(u/67108864|0)}return c.words[c.length-1]===0&&(c.length--,c.words[c.length-1]===0&&c.length--),c};function L(){k.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}n(L,k);function U(){k.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}n(U,k);function F(){k.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}n(F,k),F.prototype.imulK=function(c){for(var u=0,y=0;y<c.length;y++){var l=(c.words[y]|0)*19+u,h=l&67108863;l>>>=26,c.words[y]=h,u=l}return u!==0&&(c.words[c.length++]=u),c},i._prime=function(c){if(C[c])return C[c];var u;if(c==="k256")u=new q;else if(c==="p224")u=new L;else if(c==="p192")u=new U;else if(c==="p25519")u=new F;else throw new Error("Unknown prime "+c);return C[c]=u,u};function N(x){if(typeof x=="string"){var c=i._prime(x);this.m=c.p,this.prime=c}else r(x.gtn(1),"modulus must be greater than 1"),this.m=x,this.prime=null}N.prototype._verify1=function(c){r(c.negative===0,"red works only with positives"),r(c.red,"red works only with red numbers")},N.prototype._verify2=function(c,u){r((c.negative|u.negative)===0,"red works only with positives"),r(c.red&&c.red===u.red,"red works only with red numbers")},N.prototype.imod=function(c){return this.prime?this.prime.ireduce(c)._forceRed(this):c.umod(this.m)._forceRed(this)},N.prototype.neg=function(c){return c.isZero()?c.clone():this.m.sub(c)._forceRed(this)},N.prototype.add=function(c,u){this._verify2(c,u);var y=c.add(u);return y.cmp(this.m)>=0&&y.isub(this.m),y._forceRed(this)},N.prototype.iadd=function(c,u){this._verify2(c,u);var y=c.iadd(u);return y.cmp(this.m)>=0&&y.isub(this.m),y},N.prototype.sub=function(c,u){this._verify2(c,u);var y=c.sub(u);return y.cmpn(0)<0&&y.iadd(this.m),y._forceRed(this)},N.prototype.isub=function(c,u){this._verify2(c,u);var y=c.isub(u);return y.cmpn(0)<0&&y.iadd(this.m),y},N.prototype.shl=function(c,u){return this._verify1(c),this.imod(c.ushln(u))},N.prototype.imul=function(c,u){return this._verify2(c,u),this.imod(c.imul(u))},N.prototype.mul=function(c,u){return this._verify2(c,u),this.imod(c.mul(u))},N.prototype.isqr=function(c){return this.imul(c,c.clone())},N.prototype.sqr=function(c){return this.mul(c,c)},N.prototype.sqrt=function(c){if(c.isZero())return c.clone();var u=this.m.andln(3);if(r(u%2===1),u===3){var y=this.m.add(new i(1)).iushrn(2);return this.pow(c,y)}for(var l=this.m.subn(1),h=0;!l.isZero()&&l.andln(1)===0;)h++,l.iushrn(1);r(!l.isZero());var b=new i(1).toRed(this),_=b.redNeg(),g=this.m.subn(1).iushrn(1),f=this.m.bitLength();for(f=new i(2*f*f).toRed(this);this.pow(f,g).cmp(_)!==0;)f.redIAdd(_);for(var v=this.pow(f,l),O=this.pow(c,l.addn(1).iushrn(1)),T=this.pow(c,l),R=h;T.cmp(b)!==0;){for(var z=T,V=0;z.cmp(b)!==0;V++)z=z.redSqr();r(V<R);var W=this.pow(v,new i(1).iushln(R-V-1));O=O.redMul(W),v=W.redSqr(),T=T.redMul(v),R=V}return O},N.prototype.invm=function(c){var u=c._invmp(this.m);return u.negative!==0?(u.negative=0,this.imod(u).redNeg()):this.imod(u)},N.prototype.pow=function(c,u){if(u.isZero())return new i(1).toRed(this);if(u.cmpn(1)===0)return c.clone();var y=4,l=new Array(1<<y);l[0]=new i(1).toRed(this),l[1]=c;for(var h=2;h<l.length;h++)l[h]=this.mul(l[h-1],c);var b=l[0],_=0,g=0,f=u.bitLength()%26;for(f===0&&(f=26),h=u.length-1;h>=0;h--){for(var v=u.words[h],O=f-1;O>=0;O--){var T=v>>O&1;if(b!==l[0]&&(b=this.sqr(b)),T===0&&_===0){g=0;continue}_<<=1,_|=T,g++,!(g!==y&&(h!==0||O!==0))&&(b=this.mul(b,l[_]),g=0,_=0)}f=26}return b},N.prototype.convertTo=function(c){var u=c.umod(this.m);return u===c?u.clone():u},N.prototype.convertFrom=function(c){var u=c.clone();return u.red=null,u},i.mont=function(c){return new G(c)};function G(x){N.call(this,x),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new i(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}n(G,N),G.prototype.convertTo=function(c){return this.imod(c.ushln(this.shift))},G.prototype.convertFrom=function(c){var u=this.imod(c.mul(this.rinv));return u.red=null,u},G.prototype.imul=function(c,u){if(c.isZero()||u.isZero())return c.words[0]=0,c.length=1,c;var y=c.imul(u),l=y.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),h=y.isub(l).iushrn(this.shift),b=h;return h.cmp(this.m)>=0?b=h.isub(this.m):h.cmpn(0)<0&&(b=h.iadd(this.m)),b._forceRed(this)},G.prototype.mul=function(c,u){if(c.isZero()||u.isZero())return new i(0)._forceRed(this);var y=c.mul(u),l=y.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),h=y.isub(l).iushrn(this.shift),b=h;return h.cmp(this.m)>=0?b=h.isub(this.m):h.cmpn(0)<0&&(b=h.iadd(this.m)),b._forceRed(this)},G.prototype.invm=function(c){var u=this.imod(c._invmp(this.m).mul(this.r2));return u._forceRed(this)}})(typeof S9>"u"||S9,RQ)});var kQ=H((IQ,P9)=>{E();(function(t,e){"use strict";function r(x,c){if(!x)throw new Error(c||"Assertion failed")}function n(x,c){x.super_=c;var u=function(){};u.prototype=c.prototype,x.prototype=new u,x.prototype.constructor=x}function i(x,c,u){if(i.isBN(x))return x;this.negative=0,this.words=null,this.length=0,this.red=null,x!==null&&((c==="le"||c==="be")&&(u=c,c=10),this._init(x||0,c||10,u||"be"))}typeof t=="object"?t.exports=i:e.BN=i,i.BN=i,i.wordSize=26;var o;try{typeof window<"u"&&typeof window.Buffer<"u"?o=window.Buffer:o=sr().Buffer}catch{}i.isBN=function(c){return c instanceof i?!0:c!==null&&typeof c=="object"&&c.constructor.wordSize===i.wordSize&&Array.isArray(c.words)},i.max=function(c,u){return c.cmp(u)>0?c:u},i.min=function(c,u){return c.cmp(u)<0?c:u},i.prototype._init=function(c,u,y){if(typeof c=="number")return this._initNumber(c,u,y);if(typeof c=="object")return this._initArray(c,u,y);u==="hex"&&(u=16),r(u===(u|0)&&u>=2&&u<=36),c=c.toString().replace(/\s+/g,"");var l=0;c[0]==="-"&&(l++,this.negative=1),l<c.length&&(u===16?this._parseHex(c,l,y):(this._parseBase(c,u,l),y==="le"&&this._initArray(this.toArray(),u,y)))},i.prototype._initNumber=function(c,u,y){c<0&&(this.negative=1,c=-c),c<67108864?(this.words=[c&67108863],this.length=1):c<4503599627370496?(this.words=[c&67108863,c/67108864&67108863],this.length=2):(r(c<9007199254740992),this.words=[c&67108863,c/67108864&67108863,1],this.length=3),y==="le"&&this._initArray(this.toArray(),u,y)},i.prototype._initArray=function(c,u,y){if(r(typeof c.length=="number"),c.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(c.length/3),this.words=new Array(this.length);for(var l=0;l<this.length;l++)this.words[l]=0;var h,b,_=0;if(y==="be")for(l=c.length-1,h=0;l>=0;l-=3)b=c[l]|c[l-1]<<8|c[l-2]<<16,this.words[h]|=b<<_&67108863,this.words[h+1]=b>>>26-_&67108863,_+=24,_>=26&&(_-=26,h++);else if(y==="le")for(l=0,h=0;l<c.length;l+=3)b=c[l]|c[l+1]<<8|c[l+2]<<16,this.words[h]|=b<<_&67108863,this.words[h+1]=b>>>26-_&67108863,_+=24,_>=26&&(_-=26,h++);return this.strip()};function s(x,c){var u=x.charCodeAt(c);return u>=65&&u<=70?u-55:u>=97&&u<=102?u-87:u-48&15}function a(x,c,u){var y=s(x,u);return u-1>=c&&(y|=s(x,u-1)<<4),y}i.prototype._parseHex=function(c,u,y){this.length=Math.ceil((c.length-u)/6),this.words=new Array(this.length);for(var l=0;l<this.length;l++)this.words[l]=0;var h=0,b=0,_;if(y==="be")for(l=c.length-1;l>=u;l-=2)_=a(c,u,l)<<h,this.words[b]|=_&67108863,h>=18?(h-=18,b+=1,this.words[b]|=_>>>26):h+=8;else{var g=c.length-u;for(l=g%2===0?u+1:u;l<c.length;l+=2)_=a(c,u,l)<<h,this.words[b]|=_&67108863,h>=18?(h-=18,b+=1,this.words[b]|=_>>>26):h+=8}this.strip()};function d(x,c,u,y){for(var l=0,h=Math.min(x.length,u),b=c;b<h;b++){var _=x.charCodeAt(b)-48;l*=y,_>=49?l+=_-49+10:_>=17?l+=_-17+10:l+=_}return l}i.prototype._parseBase=function(c,u,y){this.words=[0],this.length=1;for(var l=0,h=1;h<=67108863;h*=u)l++;l--,h=h/u|0;for(var b=c.length-y,_=b%l,g=Math.min(b,b-_)+y,f=0,v=y;v<g;v+=l)f=d(c,v,v+l,u),this.imuln(h),this.words[0]+f<67108864?this.words[0]+=f:this._iaddn(f);if(_!==0){var O=1;for(f=d(c,v,c.length,u),v=0;v<_;v++)O*=u;this.imuln(O),this.words[0]+f<67108864?this.words[0]+=f:this._iaddn(f)}this.strip()},i.prototype.copy=function(c){c.words=new Array(this.length);for(var u=0;u<this.length;u++)c.words[u]=this.words[u];c.length=this.length,c.negative=this.negative,c.red=this.red},i.prototype.clone=function(){var c=new i(null);return this.copy(c),c},i.prototype._expand=function(c){for(;this.length<c;)this.words[this.length++]=0;return this},i.prototype.strip=function(){for(;this.length>1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},i.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},i.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var m=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],p=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],w=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];i.prototype.toString=function(c,u){c=c||10,u=u|0||1;var y;if(c===16||c==="hex"){y="";for(var l=0,h=0,b=0;b<this.length;b++){var _=this.words[b],g=((_<<l|h)&16777215).toString(16);h=_>>>24-l&16777215,h!==0||b!==this.length-1?y=m[6-g.length]+g+y:y=g+y,l+=2,l>=26&&(l-=26,b--)}for(h!==0&&(y=h.toString(16)+y);y.length%u!==0;)y="0"+y;return this.negative!==0&&(y="-"+y),y}if(c===(c|0)&&c>=2&&c<=36){var f=p[c],v=w[c];y="";var O=this.clone();for(O.negative=0;!O.isZero();){var T=O.modn(v).toString(c);O=O.idivn(v),O.isZero()?y=T+y:y=m[f-T.length]+T+y}for(this.isZero()&&(y="0"+y);y.length%u!==0;)y="0"+y;return this.negative!==0&&(y="-"+y),y}r(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var c=this.words[0];return this.length===2?c+=this.words[1]*67108864:this.length===3&&this.words[2]===1?c+=4503599627370496+this.words[1]*67108864:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-c:c},i.prototype.toJSON=function(){return this.toString(16)},i.prototype.toBuffer=function(c,u){return r(typeof o<"u"),this.toArrayLike(o,c,u)},i.prototype.toArray=function(c,u){return this.toArrayLike(Array,c,u)},i.prototype.toArrayLike=function(c,u,y){var l=this.byteLength(),h=y||Math.max(1,l);r(l<=h,"byte array longer than desired length"),r(h>0,"Requested array length <= 0"),this.strip();var b=u==="le",_=new c(h),g,f,v=this.clone();if(b){for(f=0;!v.isZero();f++)g=v.andln(255),v.iushrn(8),_[f]=g;for(;f<h;f++)_[f]=0}else{for(f=0;f<h-l;f++)_[f]=0;for(f=0;!v.isZero();f++)g=v.andln(255),v.iushrn(8),_[h-f-1]=g}return _},Math.clz32?i.prototype._countBits=function(c){return 32-Math.clz32(c)}:i.prototype._countBits=function(c){var u=c,y=0;return u>=4096&&(y+=13,u>>>=13),u>=64&&(y+=7,u>>>=7),u>=8&&(y+=4,u>>>=4),u>=2&&(y+=2,u>>>=2),y+u},i.prototype._zeroBits=function(c){if(c===0)return 26;var u=c,y=0;return u&8191||(y+=13,u>>>=13),u&127||(y+=7,u>>>=7),u&15||(y+=4,u>>>=4),u&3||(y+=2,u>>>=2),u&1||y++,y},i.prototype.bitLength=function(){var c=this.words[this.length-1],u=this._countBits(c);return(this.length-1)*26+u};function P(x){for(var c=new Array(x.bitLength()),u=0;u<c.length;u++){var y=u/26|0,l=u%26;c[u]=(x.words[y]&1<<l)>>>l}return c}i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var c=0,u=0;u<this.length;u++){var y=this._zeroBits(this.words[u]);if(c+=y,y!==26)break}return c},i.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},i.prototype.toTwos=function(c){return this.negative!==0?this.abs().inotn(c).iaddn(1):this.clone()},i.prototype.fromTwos=function(c){return this.testn(c-1)?this.notn(c).iaddn(1).ineg():this.clone()},i.prototype.isNeg=function(){return this.negative!==0},i.prototype.neg=function(){return this.clone().ineg()},i.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},i.prototype.iuor=function(c){for(;this.length<c.length;)this.words[this.length++]=0;for(var u=0;u<c.length;u++)this.words[u]=this.words[u]|c.words[u];return this.strip()},i.prototype.ior=function(c){return r((this.negative|c.negative)===0),this.iuor(c)},i.prototype.or=function(c){return this.length>c.length?this.clone().ior(c):c.clone().ior(this)},i.prototype.uor=function(c){return this.length>c.length?this.clone().iuor(c):c.clone().iuor(this)},i.prototype.iuand=function(c){var u;this.length>c.length?u=c:u=this;for(var y=0;y<u.length;y++)this.words[y]=this.words[y]&c.words[y];return this.length=u.length,this.strip()},i.prototype.iand=function(c){return r((this.negative|c.negative)===0),this.iuand(c)},i.prototype.and=function(c){return this.length>c.length?this.clone().iand(c):c.clone().iand(this)},i.prototype.uand=function(c){return this.length>c.length?this.clone().iuand(c):c.clone().iuand(this)},i.prototype.iuxor=function(c){var u,y;this.length>c.length?(u=this,y=c):(u=c,y=this);for(var l=0;l<y.length;l++)this.words[l]=u.words[l]^y.words[l];if(this!==u)for(;l<u.length;l++)this.words[l]=u.words[l];return this.length=u.length,this.strip()},i.prototype.ixor=function(c){return r((this.negative|c.negative)===0),this.iuxor(c)},i.prototype.xor=function(c){return this.length>c.length?this.clone().ixor(c):c.clone().ixor(this)},i.prototype.uxor=function(c){return this.length>c.length?this.clone().iuxor(c):c.clone().iuxor(this)},i.prototype.inotn=function(c){r(typeof c=="number"&&c>=0);var u=Math.ceil(c/26)|0,y=c%26;this._expand(u),y>0&&u--;for(var l=0;l<u;l++)this.words[l]=~this.words[l]&67108863;return y>0&&(this.words[l]=~this.words[l]&67108863>>26-y),this.strip()},i.prototype.notn=function(c){return this.clone().inotn(c)},i.prototype.setn=function(c,u){r(typeof c=="number"&&c>=0);var y=c/26|0,l=c%26;return this._expand(y+1),u?this.words[y]=this.words[y]|1<<l:this.words[y]=this.words[y]&~(1<<l),this.strip()},i.prototype.iadd=function(c){var u;if(this.negative!==0&&c.negative===0)return this.negative=0,u=this.isub(c),this.negative^=1,this._normSign();if(this.negative===0&&c.negative!==0)return c.negative=0,u=this.isub(c),c.negative=1,u._normSign();var y,l;this.length>c.length?(y=this,l=c):(y=c,l=this);for(var h=0,b=0;b<l.length;b++)u=(y.words[b]|0)+(l.words[b]|0)+h,this.words[b]=u&67108863,h=u>>>26;for(;h!==0&&b<y.length;b++)u=(y.words[b]|0)+h,this.words[b]=u&67108863,h=u>>>26;if(this.length=y.length,h!==0)this.words[this.length]=h,this.length++;else if(y!==this)for(;b<y.length;b++)this.words[b]=y.words[b];return this},i.prototype.add=function(c){var u;return c.negative!==0&&this.negative===0?(c.negative=0,u=this.sub(c),c.negative^=1,u):c.negative===0&&this.negative!==0?(this.negative=0,u=c.sub(this),this.negative=1,u):this.length>c.length?this.clone().iadd(c):c.clone().iadd(this)},i.prototype.isub=function(c){if(c.negative!==0){c.negative=0;var u=this.iadd(c);return c.negative=1,u._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(c),this.negative=1,this._normSign();var y=this.cmp(c);if(y===0)return this.negative=0,this.length=1,this.words[0]=0,this;var l,h;y>0?(l=this,h=c):(l=c,h=this);for(var b=0,_=0;_<h.length;_++)u=(l.words[_]|0)-(h.words[_]|0)+b,b=u>>26,this.words[_]=u&67108863;for(;b!==0&&_<l.length;_++)u=(l.words[_]|0)+b,b=u>>26,this.words[_]=u&67108863;if(b===0&&_<l.length&&l!==this)for(;_<l.length;_++)this.words[_]=l.words[_];return this.length=Math.max(this.length,_),l!==this&&(this.negative=1),this.strip()},i.prototype.sub=function(c){return this.clone().isub(c)};function S(x,c,u){u.negative=c.negative^x.negative;var y=x.length+c.length|0;u.length=y,y=y-1|0;var l=x.words[0]|0,h=c.words[0]|0,b=l*h,_=b&67108863,g=b/67108864|0;u.words[0]=_;for(var f=1;f<y;f++){for(var v=g>>>26,O=g&67108863,T=Math.min(f,c.length-1),R=Math.max(0,f-x.length+1);R<=T;R++){var z=f-R|0;l=x.words[z]|0,h=c.words[R]|0,b=l*h+O,v+=b/67108864|0,O=b&67108863}u.words[f]=O|0,g=v|0}return g!==0?u.words[f]=g|0:u.length--,u.strip()}var M=function(c,u,y){var l=c.words,h=u.words,b=y.words,_=0,g,f,v,O=l[0]|0,T=O&8191,R=O>>>13,z=l[1]|0,V=z&8191,W=z>>>13,Z=l[2]|0,J=Z&8191,X=Z>>>13,Ee=l[3]|0,re=Ee&8191,ne=Ee>>>13,qe=l[4]|0,ce=qe&8191,ye=qe>>>13,Ne=l[5]|0,ie=Ne&8191,oe=Ne>>>13,ze=l[6]|0,le=ze&8191,me=ze>>>13,ot=l[7]|0,ue=ot&8191,he=ot>>>13,lt=l[8]|0,se=lt&8191,fe=lt>>>13,Lt=l[9]|0,ge=Lt&8191,ve=Lt>>>13,on=h[0]|0,xe=on&8191,Pe=on>>>13,jr=h[1]|0,Se=jr&8191,_e=jr>>>13,Mn=h[2]|0,Me=Mn&8191,Te=Mn>>>13,vi=h[3]|0,Ae=vi&8191,Be=vi>>>13,Pn=h[4]|0,De=Pn&8191,Ie=Pn>>>13,bi=h[5]|0,Re=bi&8191,ke=bi>>>13,wi=h[6]|0,Oe=wi&8191,Ce=wi>>>13,oi=h[7]|0,Q=oi&8191,Y=oi>>>13,ae=h[8]|0,ee=ae&8191,te=ae>>>13,Ke=h[9]|0,de=Ke&8191,pe=Ke>>>13;y.negative=c.negative^u.negative,y.length=19,g=Math.imul(T,xe),f=Math.imul(T,Pe),f=f+Math.imul(R,xe)|0,v=Math.imul(R,Pe);var bt=(_+g|0)+((f&8191)<<13)|0;_=(v+(f>>>13)|0)+(bt>>>26)|0,bt&=67108863,g=Math.imul(V,xe),f=Math.imul(V,Pe),f=f+Math.imul(W,xe)|0,v=Math.imul(W,Pe),g=g+Math.imul(T,Se)|0,f=f+Math.imul(T,_e)|0,f=f+Math.imul(R,Se)|0,v=v+Math.imul(R,_e)|0;var st=(_+g|0)+((f&8191)<<13)|0;_=(v+(f>>>13)|0)+(st>>>26)|0,st&=67108863,g=Math.imul(J,xe),f=Math.imul(J,Pe),f=f+Math.imul(X,xe)|0,v=Math.imul(X,Pe),g=g+Math.imul(V,Se)|0,f=f+Math.imul(V,_e)|0,f=f+Math.imul(W,Se)|0,v=v+Math.imul(W,_e)|0,g=g+Math.imul(T,Me)|0,f=f+Math.imul(T,Te)|0,f=f+Math.imul(R,Me)|0,v=v+Math.imul(R,Te)|0;var Ve=(_+g|0)+((f&8191)<<13)|0;_=(v+(f>>>13)|0)+(Ve>>>26)|0,Ve&=67108863,g=Math.imul(re,xe),f=Math.imul(re,Pe),f=f+Math.imul(ne,xe)|0,v=Math.imul(ne,Pe),g=g+Math.imul(J,Se)|0,f=f+Math.imul(J,_e)|0,f=f+Math.imul(X,Se)|0,v=v+Math.imul(X,_e)|0,g=g+Math.imul(V,Me)|0,f=f+Math.imul(V,Te)|0,f=f+Math.imul(W,Me)|0,v=v+Math.imul(W,Te)|0,g=g+Math.imul(T,Ae)|0,f=f+Math.imul(T,Be)|0,f=f+Math.imul(R,Ae)|0,v=v+Math.imul(R,Be)|0;var Tt=(_+g|0)+((f&8191)<<13)|0;_=(v+(f>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,g=Math.imul(ce,xe),f=Math.imul(ce,Pe),f=f+Math.imul(ye,xe)|0,v=Math.imul(ye,Pe),g=g+Math.imul(re,Se)|0,f=f+Math.imul(re,_e)|0,f=f+Math.imul(ne,Se)|0,v=v+Math.imul(ne,_e)|0,g=g+Math.imul(J,Me)|0,f=f+Math.imul(J,Te)|0,f=f+Math.imul(X,Me)|0,v=v+Math.imul(X,Te)|0,g=g+Math.imul(V,Ae)|0,f=f+Math.imul(V,Be)|0,f=f+Math.imul(W,Ae)|0,v=v+Math.imul(W,Be)|0,g=g+Math.imul(T,De)|0,f=f+Math.imul(T,Ie)|0,f=f+Math.imul(R,De)|0,v=v+Math.imul(R,Ie)|0;var Ut=(_+g|0)+((f&8191)<<13)|0;_=(v+(f>>>13)|0)+(Ut>>>26)|0,Ut&=67108863,g=Math.imul(ie,xe),f=Math.imul(ie,Pe),f=f+Math.imul(oe,xe)|0,v=Math.imul(oe,Pe),g=g+Math.imul(ce,Se)|0,f=f+Math.imul(ce,_e)|0,f=f+Math.imul(ye,Se)|0,v=v+Math.imul(ye,_e)|0,g=g+Math.imul(re,Me)|0,f=f+Math.imul(re,Te)|0,f=f+Math.imul(ne,Me)|0,v=v+Math.imul(ne,Te)|0,g=g+Math.imul(J,Ae)|0,f=f+Math.imul(J,Be)|0,f=f+Math.imul(X,Ae)|0,v=v+Math.imul(X,Be)|0,g=g+Math.imul(V,De)|0,f=f+Math.imul(V,Ie)|0,f=f+Math.imul(W,De)|0,v=v+Math.imul(W,Ie)|0,g=g+Math.imul(T,Re)|0,f=f+Math.imul(T,ke)|0,f=f+Math.imul(R,Re)|0,v=v+Math.imul(R,ke)|0;var Pt=(_+g|0)+((f&8191)<<13)|0;_=(v+(f>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,g=Math.imul(le,xe),f=Math.imul(le,Pe),f=f+Math.imul(me,xe)|0,v=Math.imul(me,Pe),g=g+Math.imul(ie,Se)|0,f=f+Math.imul(ie,_e)|0,f=f+Math.imul(oe,Se)|0,v=v+Math.imul(oe,_e)|0,g=g+Math.imul(ce,Me)|0,f=f+Math.imul(ce,Te)|0,f=f+Math.imul(ye,Me)|0,v=v+Math.imul(ye,Te)|0,g=g+Math.imul(re,Ae)|0,f=f+Math.imul(re,Be)|0,f=f+Math.imul(ne,Ae)|0,v=v+Math.imul(ne,Be)|0,g=g+Math.imul(J,De)|0,f=f+Math.imul(J,Ie)|0,f=f+Math.imul(X,De)|0,v=v+Math.imul(X,Ie)|0,g=g+Math.imul(V,Re)|0,f=f+Math.imul(V,ke)|0,f=f+Math.imul(W,Re)|0,v=v+Math.imul(W,ke)|0,g=g+Math.imul(T,Oe)|0,f=f+Math.imul(T,Ce)|0,f=f+Math.imul(R,Oe)|0,v=v+Math.imul(R,Ce)|0;var yt=(_+g|0)+((f&8191)<<13)|0;_=(v+(f>>>13)|0)+(yt>>>26)|0,yt&=67108863,g=Math.imul(ue,xe),f=Math.imul(ue,Pe),f=f+Math.imul(he,xe)|0,v=Math.imul(he,Pe),g=g+Math.imul(le,Se)|0,f=f+Math.imul(le,_e)|0,f=f+Math.imul(me,Se)|0,v=v+Math.imul(me,_e)|0,g=g+Math.imul(ie,Me)|0,f=f+Math.imul(ie,Te)|0,f=f+Math.imul(oe,Me)|0,v=v+Math.imul(oe,Te)|0,g=g+Math.imul(ce,Ae)|0,f=f+Math.imul(ce,Be)|0,f=f+Math.imul(ye,Ae)|0,v=v+Math.imul(ye,Be)|0,g=g+Math.imul(re,De)|0,f=f+Math.imul(re,Ie)|0,f=f+Math.imul(ne,De)|0,v=v+Math.imul(ne,Ie)|0,g=g+Math.imul(J,Re)|0,f=f+Math.imul(J,ke)|0,f=f+Math.imul(X,Re)|0,v=v+Math.imul(X,ke)|0,g=g+Math.imul(V,Oe)|0,f=f+Math.imul(V,Ce)|0,f=f+Math.imul(W,Oe)|0,v=v+Math.imul(W,Ce)|0,g=g+Math.imul(T,Q)|0,f=f+Math.imul(T,Y)|0,f=f+Math.imul(R,Q)|0,v=v+Math.imul(R,Y)|0;var Rt=(_+g|0)+((f&8191)<<13)|0;_=(v+(f>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,g=Math.imul(se,xe),f=Math.imul(se,Pe),f=f+Math.imul(fe,xe)|0,v=Math.imul(fe,Pe),g=g+Math.imul(ue,Se)|0,f=f+Math.imul(ue,_e)|0,f=f+Math.imul(he,Se)|0,v=v+Math.imul(he,_e)|0,g=g+Math.imul(le,Me)|0,f=f+Math.imul(le,Te)|0,f=f+Math.imul(me,Me)|0,v=v+Math.imul(me,Te)|0,g=g+Math.imul(ie,Ae)|0,f=f+Math.imul(ie,Be)|0,f=f+Math.imul(oe,Ae)|0,v=v+Math.imul(oe,Be)|0,g=g+Math.imul(ce,De)|0,f=f+Math.imul(ce,Ie)|0,f=f+Math.imul(ye,De)|0,v=v+Math.imul(ye,Ie)|0,g=g+Math.imul(re,Re)|0,f=f+Math.imul(re,ke)|0,f=f+Math.imul(ne,Re)|0,v=v+Math.imul(ne,ke)|0,g=g+Math.imul(J,Oe)|0,f=f+Math.imul(J,Ce)|0,f=f+Math.imul(X,Oe)|0,v=v+Math.imul(X,Ce)|0,g=g+Math.imul(V,Q)|0,f=f+Math.imul(V,Y)|0,f=f+Math.imul(W,Q)|0,v=v+Math.imul(W,Y)|0,g=g+Math.imul(T,ee)|0,f=f+Math.imul(T,te)|0,f=f+Math.imul(R,ee)|0,v=v+Math.imul(R,te)|0;var _t=(_+g|0)+((f&8191)<<13)|0;_=(v+(f>>>13)|0)+(_t>>>26)|0,_t&=67108863,g=Math.imul(ge,xe),f=Math.imul(ge,Pe),f=f+Math.imul(ve,xe)|0,v=Math.imul(ve,Pe),g=g+Math.imul(se,Se)|0,f=f+Math.imul(se,_e)|0,f=f+Math.imul(fe,Se)|0,v=v+Math.imul(fe,_e)|0,g=g+Math.imul(ue,Me)|0,f=f+Math.imul(ue,Te)|0,f=f+Math.imul(he,Me)|0,v=v+Math.imul(he,Te)|0,g=g+Math.imul(le,Ae)|0,f=f+Math.imul(le,Be)|0,f=f+Math.imul(me,Ae)|0,v=v+Math.imul(me,Be)|0,g=g+Math.imul(ie,De)|0,f=f+Math.imul(ie,Ie)|0,f=f+Math.imul(oe,De)|0,v=v+Math.imul(oe,Ie)|0,g=g+Math.imul(ce,Re)|0,f=f+Math.imul(ce,ke)|0,f=f+Math.imul(ye,Re)|0,v=v+Math.imul(ye,ke)|0,g=g+Math.imul(re,Oe)|0,f=f+Math.imul(re,Ce)|0,f=f+Math.imul(ne,Oe)|0,v=v+Math.imul(ne,Ce)|0,g=g+Math.imul(J,Q)|0,f=f+Math.imul(J,Y)|0,f=f+Math.imul(X,Q)|0,v=v+Math.imul(X,Y)|0,g=g+Math.imul(V,ee)|0,f=f+Math.imul(V,te)|0,f=f+Math.imul(W,ee)|0,v=v+Math.imul(W,te)|0,g=g+Math.imul(T,de)|0,f=f+Math.imul(T,pe)|0,f=f+Math.imul(R,de)|0,v=v+Math.imul(R,pe)|0;var Lr=(_+g|0)+((f&8191)<<13)|0;_=(v+(f>>>13)|0)+(Lr>>>26)|0,Lr&=67108863,g=Math.imul(ge,Se),f=Math.imul(ge,_e),f=f+Math.imul(ve,Se)|0,v=Math.imul(ve,_e),g=g+Math.imul(se,Me)|0,f=f+Math.imul(se,Te)|0,f=f+Math.imul(fe,Me)|0,v=v+Math.imul(fe,Te)|0,g=g+Math.imul(ue,Ae)|0,f=f+Math.imul(ue,Be)|0,f=f+Math.imul(he,Ae)|0,v=v+Math.imul(he,Be)|0,g=g+Math.imul(le,De)|0,f=f+Math.imul(le,Ie)|0,f=f+Math.imul(me,De)|0,v=v+Math.imul(me,Ie)|0,g=g+Math.imul(ie,Re)|0,f=f+Math.imul(ie,ke)|0,f=f+Math.imul(oe,Re)|0,v=v+Math.imul(oe,ke)|0,g=g+Math.imul(ce,Oe)|0,f=f+Math.imul(ce,Ce)|0,f=f+Math.imul(ye,Oe)|0,v=v+Math.imul(ye,Ce)|0,g=g+Math.imul(re,Q)|0,f=f+Math.imul(re,Y)|0,f=f+Math.imul(ne,Q)|0,v=v+Math.imul(ne,Y)|0,g=g+Math.imul(J,ee)|0,f=f+Math.imul(J,te)|0,f=f+Math.imul(X,ee)|0,v=v+Math.imul(X,te)|0,g=g+Math.imul(V,de)|0,f=f+Math.imul(V,pe)|0,f=f+Math.imul(W,de)|0,v=v+Math.imul(W,pe)|0;var nr=(_+g|0)+((f&8191)<<13)|0;_=(v+(f>>>13)|0)+(nr>>>26)|0,nr&=67108863,g=Math.imul(ge,Me),f=Math.imul(ge,Te),f=f+Math.imul(ve,Me)|0,v=Math.imul(ve,Te),g=g+Math.imul(se,Ae)|0,f=f+Math.imul(se,Be)|0,f=f+Math.imul(fe,Ae)|0,v=v+Math.imul(fe,Be)|0,g=g+Math.imul(ue,De)|0,f=f+Math.imul(ue,Ie)|0,f=f+Math.imul(he,De)|0,v=v+Math.imul(he,Ie)|0,g=g+Math.imul(le,Re)|0,f=f+Math.imul(le,ke)|0,f=f+Math.imul(me,Re)|0,v=v+Math.imul(me,ke)|0,g=g+Math.imul(ie,Oe)|0,f=f+Math.imul(ie,Ce)|0,f=f+Math.imul(oe,Oe)|0,v=v+Math.imul(oe,Ce)|0,g=g+Math.imul(ce,Q)|0,f=f+Math.imul(ce,Y)|0,f=f+Math.imul(ye,Q)|0,v=v+Math.imul(ye,Y)|0,g=g+Math.imul(re,ee)|0,f=f+Math.imul(re,te)|0,f=f+Math.imul(ne,ee)|0,v=v+Math.imul(ne,te)|0,g=g+Math.imul(J,de)|0,f=f+Math.imul(J,pe)|0,f=f+Math.imul(X,de)|0,v=v+Math.imul(X,pe)|0;var lr=(_+g|0)+((f&8191)<<13)|0;_=(v+(f>>>13)|0)+(lr>>>26)|0,lr&=67108863,g=Math.imul(ge,Ae),f=Math.imul(ge,Be),f=f+Math.imul(ve,Ae)|0,v=Math.imul(ve,Be),g=g+Math.imul(se,De)|0,f=f+Math.imul(se,Ie)|0,f=f+Math.imul(fe,De)|0,v=v+Math.imul(fe,Ie)|0,g=g+Math.imul(ue,Re)|0,f=f+Math.imul(ue,ke)|0,f=f+Math.imul(he,Re)|0,v=v+Math.imul(he,ke)|0,g=g+Math.imul(le,Oe)|0,f=f+Math.imul(le,Ce)|0,f=f+Math.imul(me,Oe)|0,v=v+Math.imul(me,Ce)|0,g=g+Math.imul(ie,Q)|0,f=f+Math.imul(ie,Y)|0,f=f+Math.imul(oe,Q)|0,v=v+Math.imul(oe,Y)|0,g=g+Math.imul(ce,ee)|0,f=f+Math.imul(ce,te)|0,f=f+Math.imul(ye,ee)|0,v=v+Math.imul(ye,te)|0,g=g+Math.imul(re,de)|0,f=f+Math.imul(re,pe)|0,f=f+Math.imul(ne,de)|0,v=v+Math.imul(ne,pe)|0;var xt=(_+g|0)+((f&8191)<<13)|0;_=(v+(f>>>13)|0)+(xt>>>26)|0,xt&=67108863,g=Math.imul(ge,De),f=Math.imul(ge,Ie),f=f+Math.imul(ve,De)|0,v=Math.imul(ve,Ie),g=g+Math.imul(se,Re)|0,f=f+Math.imul(se,ke)|0,f=f+Math.imul(fe,Re)|0,v=v+Math.imul(fe,ke)|0,g=g+Math.imul(ue,Oe)|0,f=f+Math.imul(ue,Ce)|0,f=f+Math.imul(he,Oe)|0,v=v+Math.imul(he,Ce)|0,g=g+Math.imul(le,Q)|0,f=f+Math.imul(le,Y)|0,f=f+Math.imul(me,Q)|0,v=v+Math.imul(me,Y)|0,g=g+Math.imul(ie,ee)|0,f=f+Math.imul(ie,te)|0,f=f+Math.imul(oe,ee)|0,v=v+Math.imul(oe,te)|0,g=g+Math.imul(ce,de)|0,f=f+Math.imul(ce,pe)|0,f=f+Math.imul(ye,de)|0,v=v+Math.imul(ye,pe)|0;var ir=(_+g|0)+((f&8191)<<13)|0;_=(v+(f>>>13)|0)+(ir>>>26)|0,ir&=67108863,g=Math.imul(ge,Re),f=Math.imul(ge,ke),f=f+Math.imul(ve,Re)|0,v=Math.imul(ve,ke),g=g+Math.imul(se,Oe)|0,f=f+Math.imul(se,Ce)|0,f=f+Math.imul(fe,Oe)|0,v=v+Math.imul(fe,Ce)|0,g=g+Math.imul(ue,Q)|0,f=f+Math.imul(ue,Y)|0,f=f+Math.imul(he,Q)|0,v=v+Math.imul(he,Y)|0,g=g+Math.imul(le,ee)|0,f=f+Math.imul(le,te)|0,f=f+Math.imul(me,ee)|0,v=v+Math.imul(me,te)|0,g=g+Math.imul(ie,de)|0,f=f+Math.imul(ie,pe)|0,f=f+Math.imul(oe,de)|0,v=v+Math.imul(oe,pe)|0;var dr=(_+g|0)+((f&8191)<<13)|0;_=(v+(f>>>13)|0)+(dr>>>26)|0,dr&=67108863,g=Math.imul(ge,Oe),f=Math.imul(ge,Ce),f=f+Math.imul(ve,Oe)|0,v=Math.imul(ve,Ce),g=g+Math.imul(se,Q)|0,f=f+Math.imul(se,Y)|0,f=f+Math.imul(fe,Q)|0,v=v+Math.imul(fe,Y)|0,g=g+Math.imul(ue,ee)|0,f=f+Math.imul(ue,te)|0,f=f+Math.imul(he,ee)|0,v=v+Math.imul(he,te)|0,g=g+Math.imul(le,de)|0,f=f+Math.imul(le,pe)|0,f=f+Math.imul(me,de)|0,v=v+Math.imul(me,pe)|0;var Er=(_+g|0)+((f&8191)<<13)|0;_=(v+(f>>>13)|0)+(Er>>>26)|0,Er&=67108863,g=Math.imul(ge,Q),f=Math.imul(ge,Y),f=f+Math.imul(ve,Q)|0,v=Math.imul(ve,Y),g=g+Math.imul(se,ee)|0,f=f+Math.imul(se,te)|0,f=f+Math.imul(fe,ee)|0,v=v+Math.imul(fe,te)|0,g=g+Math.imul(ue,de)|0,f=f+Math.imul(ue,pe)|0,f=f+Math.imul(he,de)|0,v=v+Math.imul(he,pe)|0;var Ur=(_+g|0)+((f&8191)<<13)|0;_=(v+(f>>>13)|0)+(Ur>>>26)|0,Ur&=67108863,g=Math.imul(ge,ee),f=Math.imul(ge,te),f=f+Math.imul(ve,ee)|0,v=Math.imul(ve,te),g=g+Math.imul(se,de)|0,f=f+Math.imul(se,pe)|0,f=f+Math.imul(fe,de)|0,v=v+Math.imul(fe,pe)|0;var Rr=(_+g|0)+((f&8191)<<13)|0;_=(v+(f>>>13)|0)+(Rr>>>26)|0,Rr&=67108863,g=Math.imul(ge,de),f=Math.imul(ge,pe),f=f+Math.imul(ve,de)|0,v=Math.imul(ve,pe);var Hr=(_+g|0)+((f&8191)<<13)|0;return _=(v+(f>>>13)|0)+(Hr>>>26)|0,Hr&=67108863,b[0]=bt,b[1]=st,b[2]=Ve,b[3]=Tt,b[4]=Ut,b[5]=Pt,b[6]=yt,b[7]=Rt,b[8]=_t,b[9]=Lr,b[10]=nr,b[11]=lr,b[12]=xt,b[13]=ir,b[14]=dr,b[15]=Er,b[16]=Ur,b[17]=Rr,b[18]=Hr,_!==0&&(b[19]=_,y.length++),y};Math.imul||(M=S);function A(x,c,u){u.negative=c.negative^x.negative,u.length=x.length+c.length;for(var y=0,l=0,h=0;h<u.length-1;h++){var b=l;l=0;for(var _=y&67108863,g=Math.min(h,c.length-1),f=Math.max(0,h-x.length+1);f<=g;f++){var v=h-f,O=x.words[v]|0,T=c.words[f]|0,R=O*T,z=R&67108863;b=b+(R/67108864|0)|0,z=z+_|0,_=z&67108863,b=b+(z>>>26)|0,l+=b>>>26,b&=67108863}u.words[h]=_,y=b,b=l}return y!==0?u.words[h]=y:u.length--,u.strip()}function B(x,c,u){var y=new I;return y.mulp(x,c,u)}i.prototype.mulTo=function(c,u){var y,l=this.length+c.length;return this.length===10&&c.length===10?y=M(this,c,u):l<63?y=S(this,c,u):l<1024?y=A(this,c,u):y=B(this,c,u),y};function I(x,c){this.x=x,this.y=c}I.prototype.makeRBT=function(c){for(var u=new Array(c),y=i.prototype._countBits(c)-1,l=0;l<c;l++)u[l]=this.revBin(l,y,c);return u},I.prototype.revBin=function(c,u,y){if(c===0||c===y-1)return c;for(var l=0,h=0;h<u;h++)l|=(c&1)<<u-h-1,c>>=1;return l},I.prototype.permute=function(c,u,y,l,h,b){for(var _=0;_<b;_++)l[_]=u[c[_]],h[_]=y[c[_]]},I.prototype.transform=function(c,u,y,l,h,b){this.permute(b,c,u,y,l,h);for(var _=1;_<h;_<<=1)for(var g=_<<1,f=Math.cos(2*Math.PI/g),v=Math.sin(2*Math.PI/g),O=0;O<h;O+=g)for(var T=f,R=v,z=0;z<_;z++){var V=y[O+z],W=l[O+z],Z=y[O+z+_],J=l[O+z+_],X=T*Z-R*J;J=T*J+R*Z,Z=X,y[O+z]=V+Z,l[O+z]=W+J,y[O+z+_]=V-Z,l[O+z+_]=W-J,z!==g&&(X=f*T-v*R,R=f*R+v*T,T=X)}},I.prototype.guessLen13b=function(c,u){var y=Math.max(u,c)|1,l=y&1,h=0;for(y=y/2|0;y;y=y>>>1)h++;return 1<<h+1+l},I.prototype.conjugate=function(c,u,y){if(!(y<=1))for(var l=0;l<y/2;l++){var h=c[l];c[l]=c[y-l-1],c[y-l-1]=h,h=u[l],u[l]=-u[y-l-1],u[y-l-1]=-h}},I.prototype.normalize13b=function(c,u){for(var y=0,l=0;l<u/2;l++){var h=Math.round(c[2*l+1]/u)*8192+Math.round(c[2*l]/u)+y;c[l]=h&67108863,h<67108864?y=0:y=h/67108864|0}return c},I.prototype.convert13b=function(c,u,y,l){for(var h=0,b=0;b<u;b++)h=h+(c[b]|0),y[2*b]=h&8191,h=h>>>13,y[2*b+1]=h&8191,h=h>>>13;for(b=2*u;b<l;++b)y[b]=0;r(h===0),r((h&-8192)===0)},I.prototype.stub=function(c){for(var u=new Array(c),y=0;y<c;y++)u[y]=0;return u},I.prototype.mulp=function(c,u,y){var l=2*this.guessLen13b(c.length,u.length),h=this.makeRBT(l),b=this.stub(l),_=new Array(l),g=new Array(l),f=new Array(l),v=new Array(l),O=new Array(l),T=new Array(l),R=y.words;R.length=l,this.convert13b(c.words,c.length,_,l),this.convert13b(u.words,u.length,v,l),this.transform(_,b,g,f,l,h),this.transform(v,b,O,T,l,h);for(var z=0;z<l;z++){var V=g[z]*O[z]-f[z]*T[z];f[z]=g[z]*T[z]+f[z]*O[z],g[z]=V}return this.conjugate(g,f,l),this.transform(g,f,R,b,l,h),this.conjugate(R,b,l),this.normalize13b(R,l),y.negative=c.negative^u.negative,y.length=c.length+u.length,y.strip()},i.prototype.mul=function(c){var u=new i(null);return u.words=new Array(this.length+c.length),this.mulTo(c,u)},i.prototype.mulf=function(c){var u=new i(null);return u.words=new Array(this.length+c.length),B(this,c,u)},i.prototype.imul=function(c){return this.clone().mulTo(c,this)},i.prototype.imuln=function(c){r(typeof c=="number"),r(c<67108864);for(var u=0,y=0;y<this.length;y++){var l=(this.words[y]|0)*c,h=(l&67108863)+(u&67108863);u>>=26,u+=l/67108864|0,u+=h>>>26,this.words[y]=h&67108863}return u!==0&&(this.words[y]=u,this.length++),this},i.prototype.muln=function(c){return this.clone().imuln(c)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(c){var u=P(c);if(u.length===0)return new i(1);for(var y=this,l=0;l<u.length&&u[l]===0;l++,y=y.sqr());if(++l<u.length)for(var h=y.sqr();l<u.length;l++,h=h.sqr())u[l]!==0&&(y=y.mul(h));return y},i.prototype.iushln=function(c){r(typeof c=="number"&&c>=0);var u=c%26,y=(c-u)/26,l=67108863>>>26-u<<26-u,h;if(u!==0){var b=0;for(h=0;h<this.length;h++){var _=this.words[h]&l,g=(this.words[h]|0)-_<<u;this.words[h]=g|b,b=_>>>26-u}b&&(this.words[h]=b,this.length++)}if(y!==0){for(h=this.length-1;h>=0;h--)this.words[h+y]=this.words[h];for(h=0;h<y;h++)this.words[h]=0;this.length+=y}return this.strip()},i.prototype.ishln=function(c){return r(this.negative===0),this.iushln(c)},i.prototype.iushrn=function(c,u,y){r(typeof c=="number"&&c>=0);var l;u?l=(u-u%26)/26:l=0;var h=c%26,b=Math.min((c-h)/26,this.length),_=67108863^67108863>>>h<<h,g=y;if(l-=b,l=Math.max(0,l),g){for(var f=0;f<b;f++)g.words[f]=this.words[f];g.length=b}if(b!==0)if(this.length>b)for(this.length-=b,f=0;f<this.length;f++)this.words[f]=this.words[f+b];else this.words[0]=0,this.length=1;var v=0;for(f=this.length-1;f>=0&&(v!==0||f>=l);f--){var O=this.words[f]|0;this.words[f]=v<<26-h|O>>>h,v=O&_}return g&&v!==0&&(g.words[g.length++]=v),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},i.prototype.ishrn=function(c,u,y){return r(this.negative===0),this.iushrn(c,u,y)},i.prototype.shln=function(c){return this.clone().ishln(c)},i.prototype.ushln=function(c){return this.clone().iushln(c)},i.prototype.shrn=function(c){return this.clone().ishrn(c)},i.prototype.ushrn=function(c){return this.clone().iushrn(c)},i.prototype.testn=function(c){r(typeof c=="number"&&c>=0);var u=c%26,y=(c-u)/26,l=1<<u;if(this.length<=y)return!1;var h=this.words[y];return!!(h&l)},i.prototype.imaskn=function(c){r(typeof c=="number"&&c>=0);var u=c%26,y=(c-u)/26;if(r(this.negative===0,"imaskn works only with positive numbers"),this.length<=y)return this;if(u!==0&&y++,this.length=Math.min(y,this.length),u!==0){var l=67108863^67108863>>>u<<u;this.words[this.length-1]&=l}return this.strip()},i.prototype.maskn=function(c){return this.clone().imaskn(c)},i.prototype.iaddn=function(c){return r(typeof c=="number"),r(c<67108864),c<0?this.isubn(-c):this.negative!==0?this.length===1&&(this.words[0]|0)<c?(this.words[0]=c-(this.words[0]|0),this.negative=0,this):(this.negative=0,this.isubn(c),this.negative=1,this):this._iaddn(c)},i.prototype._iaddn=function(c){this.words[0]+=c;for(var u=0;u<this.length&&this.words[u]>=67108864;u++)this.words[u]-=67108864,u===this.length-1?this.words[u+1]=1:this.words[u+1]++;return this.length=Math.max(this.length,u+1),this},i.prototype.isubn=function(c){if(r(typeof c=="number"),r(c<67108864),c<0)return this.iaddn(-c);if(this.negative!==0)return this.negative=0,this.iaddn(c),this.negative=1,this;if(this.words[0]-=c,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var u=0;u<this.length&&this.words[u]<0;u++)this.words[u]+=67108864,this.words[u+1]-=1;return this.strip()},i.prototype.addn=function(c){return this.clone().iaddn(c)},i.prototype.subn=function(c){return this.clone().isubn(c)},i.prototype.iabs=function(){return this.negative=0,this},i.prototype.abs=function(){return this.clone().iabs()},i.prototype._ishlnsubmul=function(c,u,y){var l=c.length+y,h;this._expand(l);var b,_=0;for(h=0;h<c.length;h++){b=(this.words[h+y]|0)+_;var g=(c.words[h]|0)*u;b-=g&67108863,_=(b>>26)-(g/67108864|0),this.words[h+y]=b&67108863}for(;h<this.length-y;h++)b=(this.words[h+y]|0)+_,_=b>>26,this.words[h+y]=b&67108863;if(_===0)return this.strip();for(r(_===-1),_=0,h=0;h<this.length;h++)b=-(this.words[h]|0)+_,_=b>>26,this.words[h]=b&67108863;return this.negative=1,this.strip()},i.prototype._wordDiv=function(c,u){var y=this.length-c.length,l=this.clone(),h=c,b=h.words[h.length-1]|0,_=this._countBits(b);y=26-_,y!==0&&(h=h.ushln(y),l.iushln(y),b=h.words[h.length-1]|0);var g=l.length-h.length,f;if(u!=="mod"){f=new i(null),f.length=g+1,f.words=new Array(f.length);for(var v=0;v<f.length;v++)f.words[v]=0}var O=l.clone()._ishlnsubmul(h,1,g);O.negative===0&&(l=O,f&&(f.words[g]=1));for(var T=g-1;T>=0;T--){var R=(l.words[h.length+T]|0)*67108864+(l.words[h.length+T-1]|0);for(R=Math.min(R/b|0,67108863),l._ishlnsubmul(h,R,T);l.negative!==0;)R--,l.negative=0,l._ishlnsubmul(h,1,T),l.isZero()||(l.negative^=1);f&&(f.words[T]=R)}return f&&f.strip(),l.strip(),u!=="div"&&y!==0&&l.iushrn(y),{div:f||null,mod:l}},i.prototype.divmod=function(c,u,y){if(r(!c.isZero()),this.isZero())return{div:new i(0),mod:new i(0)};var l,h,b;return this.negative!==0&&c.negative===0?(b=this.neg().divmod(c,u),u!=="mod"&&(l=b.div.neg()),u!=="div"&&(h=b.mod.neg(),y&&h.negative!==0&&h.iadd(c)),{div:l,mod:h}):this.negative===0&&c.negative!==0?(b=this.divmod(c.neg(),u),u!=="mod"&&(l=b.div.neg()),{div:l,mod:b.mod}):this.negative&c.negative?(b=this.neg().divmod(c.neg(),u),u!=="div"&&(h=b.mod.neg(),y&&h.negative!==0&&h.isub(c)),{div:b.div,mod:h}):c.length>this.length||this.cmp(c)<0?{div:new i(0),mod:this}:c.length===1?u==="div"?{div:this.divn(c.words[0]),mod:null}:u==="mod"?{div:null,mod:new i(this.modn(c.words[0]))}:{div:this.divn(c.words[0]),mod:new i(this.modn(c.words[0]))}:this._wordDiv(c,u)},i.prototype.div=function(c){return this.divmod(c,"div",!1).div},i.prototype.mod=function(c){return this.divmod(c,"mod",!1).mod},i.prototype.umod=function(c){return this.divmod(c,"mod",!0).mod},i.prototype.divRound=function(c){var u=this.divmod(c);if(u.mod.isZero())return u.div;var y=u.div.negative!==0?u.mod.isub(c):u.mod,l=c.ushrn(1),h=c.andln(1),b=y.cmp(l);return b<0||h===1&&b===0?u.div:u.div.negative!==0?u.div.isubn(1):u.div.iaddn(1)},i.prototype.modn=function(c){r(c<=67108863);for(var u=(1<<26)%c,y=0,l=this.length-1;l>=0;l--)y=(u*y+(this.words[l]|0))%c;return y},i.prototype.idivn=function(c){r(c<=67108863);for(var u=0,y=this.length-1;y>=0;y--){var l=(this.words[y]|0)+u*67108864;this.words[y]=l/c|0,u=l%c}return this.strip()},i.prototype.divn=function(c){return this.clone().idivn(c)},i.prototype.egcd=function(c){r(c.negative===0),r(!c.isZero());var u=this,y=c.clone();u.negative!==0?u=u.umod(c):u=u.clone();for(var l=new i(1),h=new i(0),b=new i(0),_=new i(1),g=0;u.isEven()&&y.isEven();)u.iushrn(1),y.iushrn(1),++g;for(var f=y.clone(),v=u.clone();!u.isZero();){for(var O=0,T=1;!(u.words[0]&T)&&O<26;++O,T<<=1);if(O>0)for(u.iushrn(O);O-- >0;)(l.isOdd()||h.isOdd())&&(l.iadd(f),h.isub(v)),l.iushrn(1),h.iushrn(1);for(var R=0,z=1;!(y.words[0]&z)&&R<26;++R,z<<=1);if(R>0)for(y.iushrn(R);R-- >0;)(b.isOdd()||_.isOdd())&&(b.iadd(f),_.isub(v)),b.iushrn(1),_.iushrn(1);u.cmp(y)>=0?(u.isub(y),l.isub(b),h.isub(_)):(y.isub(u),b.isub(l),_.isub(h))}return{a:b,b:_,gcd:y.iushln(g)}},i.prototype._invmp=function(c){r(c.negative===0),r(!c.isZero());var u=this,y=c.clone();u.negative!==0?u=u.umod(c):u=u.clone();for(var l=new i(1),h=new i(0),b=y.clone();u.cmpn(1)>0&&y.cmpn(1)>0;){for(var _=0,g=1;!(u.words[0]&g)&&_<26;++_,g<<=1);if(_>0)for(u.iushrn(_);_-- >0;)l.isOdd()&&l.iadd(b),l.iushrn(1);for(var f=0,v=1;!(y.words[0]&v)&&f<26;++f,v<<=1);if(f>0)for(y.iushrn(f);f-- >0;)h.isOdd()&&h.iadd(b),h.iushrn(1);u.cmp(y)>=0?(u.isub(y),l.isub(h)):(y.isub(u),h.isub(l))}var O;return u.cmpn(1)===0?O=l:O=h,O.cmpn(0)<0&&O.iadd(c),O},i.prototype.gcd=function(c){if(this.isZero())return c.abs();if(c.isZero())return this.abs();var u=this.clone(),y=c.clone();u.negative=0,y.negative=0;for(var l=0;u.isEven()&&y.isEven();l++)u.iushrn(1),y.iushrn(1);do{for(;u.isEven();)u.iushrn(1);for(;y.isEven();)y.iushrn(1);var h=u.cmp(y);if(h<0){var b=u;u=y,y=b}else if(h===0||y.cmpn(1)===0)break;u.isub(y)}while(!0);return y.iushln(l)},i.prototype.invm=function(c){return this.egcd(c).a.umod(c)},i.prototype.isEven=function(){return(this.words[0]&1)===0},i.prototype.isOdd=function(){return(this.words[0]&1)===1},i.prototype.andln=function(c){return this.words[0]&c},i.prototype.bincn=function(c){r(typeof c=="number");var u=c%26,y=(c-u)/26,l=1<<u;if(this.length<=y)return this._expand(y+1),this.words[y]|=l,this;for(var h=l,b=y;h!==0&&b<this.length;b++){var _=this.words[b]|0;_+=h,h=_>>>26,_&=67108863,this.words[b]=_}return h!==0&&(this.words[b]=h,this.length++),this},i.prototype.isZero=function(){return this.length===1&&this.words[0]===0},i.prototype.cmpn=function(c){var u=c<0;if(this.negative!==0&&!u)return-1;if(this.negative===0&&u)return 1;this.strip();var y;if(this.length>1)y=1;else{u&&(c=-c),r(c<=67108863,"Number is too big");var l=this.words[0]|0;y=l===c?0:l<c?-1:1}return this.negative!==0?-y|0:y},i.prototype.cmp=function(c){if(this.negative!==0&&c.negative===0)return-1;if(this.negative===0&&c.negative!==0)return 1;var u=this.ucmp(c);return this.negative!==0?-u|0:u},i.prototype.ucmp=function(c){if(this.length>c.length)return 1;if(this.length<c.length)return-1;for(var u=0,y=this.length-1;y>=0;y--){var l=this.words[y]|0,h=c.words[y]|0;if(l!==h){l<h?u=-1:l>h&&(u=1);break}}return u},i.prototype.gtn=function(c){return this.cmpn(c)===1},i.prototype.gt=function(c){return this.cmp(c)===1},i.prototype.gten=function(c){return this.cmpn(c)>=0},i.prototype.gte=function(c){return this.cmp(c)>=0},i.prototype.ltn=function(c){return this.cmpn(c)===-1},i.prototype.lt=function(c){return this.cmp(c)===-1},i.prototype.lten=function(c){return this.cmpn(c)<=0},i.prototype.lte=function(c){return this.cmp(c)<=0},i.prototype.eqn=function(c){return this.cmpn(c)===0},i.prototype.eq=function(c){return this.cmp(c)===0},i.red=function(c){return new N(c)},i.prototype.toRed=function(c){return r(!this.red,"Already a number in reduction context"),r(this.negative===0,"red works only with positives"),c.convertTo(this)._forceRed(c)},i.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(c){return this.red=c,this},i.prototype.forceRed=function(c){return r(!this.red,"Already a number in reduction context"),this._forceRed(c)},i.prototype.redAdd=function(c){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,c)},i.prototype.redIAdd=function(c){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,c)},i.prototype.redSub=function(c){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,c)},i.prototype.redISub=function(c){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,c)},i.prototype.redShl=function(c){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,c)},i.prototype.redMul=function(c){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,c),this.red.mul(this,c)},i.prototype.redIMul=function(c){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,c),this.red.imul(this,c)},i.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(c){return r(this.red&&!c.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,c)};var C={k256:null,p224:null,p192:null,p25519:null};function k(x,c){this.name=x,this.p=new i(c,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}k.prototype._tmp=function(){var c=new i(null);return c.words=new Array(Math.ceil(this.n/13)),c},k.prototype.ireduce=function(c){var u=c,y;do this.split(u,this.tmp),u=this.imulK(u),u=u.iadd(this.tmp),y=u.bitLength();while(y>this.n);var l=y<this.n?-1:u.ucmp(this.p);return l===0?(u.words[0]=0,u.length=1):l>0?u.isub(this.p):u.strip!==void 0?u.strip():u._strip(),u},k.prototype.split=function(c,u){c.iushrn(this.n,0,u)},k.prototype.imulK=function(c){return c.imul(this.k)};function q(){k.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}n(q,k),q.prototype.split=function(c,u){for(var y=4194303,l=Math.min(c.length,9),h=0;h<l;h++)u.words[h]=c.words[h];if(u.length=l,c.length<=9){c.words[0]=0,c.length=1;return}var b=c.words[9];for(u.words[u.length++]=b&y,h=10;h<c.length;h++){var _=c.words[h]|0;c.words[h-10]=(_&y)<<4|b>>>22,b=_}b>>>=22,c.words[h-10]=b,b===0&&c.length>10?c.length-=10:c.length-=9},q.prototype.imulK=function(c){c.words[c.length]=0,c.words[c.length+1]=0,c.length+=2;for(var u=0,y=0;y<c.length;y++){var l=c.words[y]|0;u+=l*977,c.words[y]=u&67108863,u=l*64+(u/67108864|0)}return c.words[c.length-1]===0&&(c.length--,c.words[c.length-1]===0&&c.length--),c};function L(){k.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}n(L,k);function U(){k.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}n(U,k);function F(){k.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}n(F,k),F.prototype.imulK=function(c){for(var u=0,y=0;y<c.length;y++){var l=(c.words[y]|0)*19+u,h=l&67108863;l>>>=26,c.words[y]=h,u=l}return u!==0&&(c.words[c.length++]=u),c},i._prime=function(c){if(C[c])return C[c];var u;if(c==="k256")u=new q;else if(c==="p224")u=new L;else if(c==="p192")u=new U;else if(c==="p25519")u=new F;else throw new Error("Unknown prime "+c);return C[c]=u,u};function N(x){if(typeof x=="string"){var c=i._prime(x);this.m=c.p,this.prime=c}else r(x.gtn(1),"modulus must be greater than 1"),this.m=x,this.prime=null}N.prototype._verify1=function(c){r(c.negative===0,"red works only with positives"),r(c.red,"red works only with red numbers")},N.prototype._verify2=function(c,u){r((c.negative|u.negative)===0,"red works only with positives"),r(c.red&&c.red===u.red,"red works only with red numbers")},N.prototype.imod=function(c){return this.prime?this.prime.ireduce(c)._forceRed(this):c.umod(this.m)._forceRed(this)},N.prototype.neg=function(c){return c.isZero()?c.clone():this.m.sub(c)._forceRed(this)},N.prototype.add=function(c,u){this._verify2(c,u);var y=c.add(u);return y.cmp(this.m)>=0&&y.isub(this.m),y._forceRed(this)},N.prototype.iadd=function(c,u){this._verify2(c,u);var y=c.iadd(u);return y.cmp(this.m)>=0&&y.isub(this.m),y},N.prototype.sub=function(c,u){this._verify2(c,u);var y=c.sub(u);return y.cmpn(0)<0&&y.iadd(this.m),y._forceRed(this)},N.prototype.isub=function(c,u){this._verify2(c,u);var y=c.isub(u);return y.cmpn(0)<0&&y.iadd(this.m),y},N.prototype.shl=function(c,u){return this._verify1(c),this.imod(c.ushln(u))},N.prototype.imul=function(c,u){return this._verify2(c,u),this.imod(c.imul(u))},N.prototype.mul=function(c,u){return this._verify2(c,u),this.imod(c.mul(u))},N.prototype.isqr=function(c){return this.imul(c,c.clone())},N.prototype.sqr=function(c){return this.mul(c,c)},N.prototype.sqrt=function(c){if(c.isZero())return c.clone();var u=this.m.andln(3);if(r(u%2===1),u===3){var y=this.m.add(new i(1)).iushrn(2);return this.pow(c,y)}for(var l=this.m.subn(1),h=0;!l.isZero()&&l.andln(1)===0;)h++,l.iushrn(1);r(!l.isZero());var b=new i(1).toRed(this),_=b.redNeg(),g=this.m.subn(1).iushrn(1),f=this.m.bitLength();for(f=new i(2*f*f).toRed(this);this.pow(f,g).cmp(_)!==0;)f.redIAdd(_);for(var v=this.pow(f,l),O=this.pow(c,l.addn(1).iushrn(1)),T=this.pow(c,l),R=h;T.cmp(b)!==0;){for(var z=T,V=0;z.cmp(b)!==0;V++)z=z.redSqr();r(V<R);var W=this.pow(v,new i(1).iushln(R-V-1));O=O.redMul(W),v=W.redSqr(),T=T.redMul(v),R=V}return O},N.prototype.invm=function(c){var u=c._invmp(this.m);return u.negative!==0?(u.negative=0,this.imod(u).redNeg()):this.imod(u)},N.prototype.pow=function(c,u){if(u.isZero())return new i(1).toRed(this);if(u.cmpn(1)===0)return c.clone();var y=4,l=new Array(1<<y);l[0]=new i(1).toRed(this),l[1]=c;for(var h=2;h<l.length;h++)l[h]=this.mul(l[h-1],c);var b=l[0],_=0,g=0,f=u.bitLength()%26;for(f===0&&(f=26),h=u.length-1;h>=0;h--){for(var v=u.words[h],O=f-1;O>=0;O--){var T=v>>O&1;if(b!==l[0]&&(b=this.sqr(b)),T===0&&_===0){g=0;continue}_<<=1,_|=T,g++,!(g!==y&&(h!==0||O!==0))&&(b=this.mul(b,l[_]),g=0,_=0)}f=26}return b},N.prototype.convertTo=function(c){var u=c.umod(this.m);return u===c?u.clone():u},N.prototype.convertFrom=function(c){var u=c.clone();return u.red=null,u},i.mont=function(c){return new G(c)};function G(x){N.call(this,x),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new i(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}n(G,N),G.prototype.convertTo=function(c){return this.imod(c.ushln(this.shift))},G.prototype.convertFrom=function(c){var u=this.imod(c.mul(this.rinv));return u.red=null,u},G.prototype.imul=function(c,u){if(c.isZero()||u.isZero())return c.words[0]=0,c.length=1,c;var y=c.imul(u),l=y.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),h=y.isub(l).iushrn(this.shift),b=h;return h.cmp(this.m)>=0?b=h.isub(this.m):h.cmpn(0)<0&&(b=h.iadd(this.m)),b._forceRed(this)},G.prototype.mul=function(c,u){if(c.isZero()||u.isZero())return new i(0)._forceRed(this);var y=c.mul(u),l=y.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),h=y.isub(l).iushrn(this.shift),b=h;return h.cmp(this.m)>=0?b=h.isub(this.m):h.cmpn(0)<0&&(b=h.iadd(this.m)),b._forceRed(this)},G.prototype.invm=function(c){var u=this.imod(c._invmp(this.m).mul(this.r2));return u._forceRed(this)}})(typeof P9>"u"||P9,IQ)});var ZS=H((hmt,R9)=>{E();var A9;R9.exports=function(e){return A9||(A9=new cp(null)),A9.generate(e)};function cp(t){this.rand=t}R9.exports.Rand=cp;cp.prototype.generate=function(e){return this._rand(e)};cp.prototype._rand=function(e){if(this.rand.getBytes)return this.rand.getBytes(e);for(var r=new Uint8Array(e),n=0;n<r.length;n++)r[n]=this.rand.getByte();return r};if(typeof self=="object")self.crypto&&self.crypto.getRandomValues?cp.prototype._rand=function(e){var r=new Uint8Array(e);return self.crypto.getRandomValues(r),r}:self.msCrypto&&self.msCrypto.getRandomValues?cp.prototype._rand=function(e){var r=new Uint8Array(e);return self.msCrypto.getRandomValues(r),r}:typeof window=="object"&&(cp.prototype._rand=function(){throw new Error("Not implemented yet")});else try{if(T9=JS(),typeof T9.randomBytes!="function")throw new Error("Not supported");cp.prototype._rand=function(e){return T9.randomBytes(e)}}catch{}var T9});var I9=H((mmt,OQ)=>{E();var Tm=kQ(),aPe=ZS();function Rm(t){this.rand=t||new aPe.Rand}OQ.exports=Rm;Rm.create=function(e){return new Rm(e)};Rm.prototype._randbelow=function(e){var r=e.bitLength(),n=Math.ceil(r/8);do var i=new Tm(this.rand.generate(n));while(i.cmp(e)>=0);return i};Rm.prototype._randrange=function(e,r){var n=r.sub(e);return e.add(this._randbelow(n))};Rm.prototype.test=function(e,r,n){var i=e.bitLength(),o=Tm.mont(e),s=new Tm(1).toRed(o);r||(r=Math.max(1,i/48|0));for(var a=e.subn(1),d=0;!a.testn(d);d++);for(var m=e.shrn(d),p=a.toRed(o),w=!0;r>0;r--){var P=this._randrange(new Tm(2),a);n&&n(P);var S=P.toRed(o).redPow(m);if(!(S.cmp(s)===0||S.cmp(p)===0)){for(var M=1;M<d;M++){if(S=S.redSqr(),S.cmp(s)===0)return!1;if(S.cmp(p)===0)break}if(M===d)return!1}}return w};Rm.prototype.getDivisor=function(e,r){var n=e.bitLength(),i=Tm.mont(e),o=new Tm(1).toRed(i);r||(r=Math.max(1,n/48|0));for(var s=e.subn(1),a=0;!s.testn(a);a++);for(var d=e.shrn(a),m=s.toRed(i);r>0;r--){var p=this._randrange(new Tm(2),s),w=e.gcd(p);if(w.cmpn(1)!==0)return w;var P=p.toRed(i).redPow(d);if(!(P.cmp(o)===0||P.cmp(m)===0)){for(var S=1;S<a;S++){if(P=P.redSqr(),P.cmp(o)===0)return P.fromRed().subn(1).gcd(e);if(P.cmp(m)===0)break}if(S===a)return P=P.redSqr(),P.fromRed().subn(1).gcd(e)}}return!1}});var j9=H((_mt,CQ)=>{E();var cPe=em();CQ.exports=C9;C9.simpleSieve=B9;C9.fermatTest=D9;var Wo=M9(),fPe=new Wo(24),uPe=I9(),BQ=new uPe,lPe=new Wo(1),O9=new Wo(2),dPe=new Wo(5),gmt=new Wo(16),vmt=new Wo(8),hPe=new Wo(10),pPe=new Wo(3),bmt=new Wo(7),mPe=new Wo(11),DQ=new Wo(4),wmt=new Wo(12),k9=null;function yPe(){if(k9!==null)return k9;var t=1048576,e=[];e[0]=2;for(var r=1,n=3;n<t;n+=2){for(var i=Math.ceil(Math.sqrt(n)),o=0;o<r&&e[o]<=i&&n%e[o]!==0;o++);r!==o&&e[o]<=i||(e[r++]=n)}return k9=e,e}function B9(t){for(var e=yPe(),r=0;r<e.length;r++)if(t.modn(e[r])===0)return t.cmpn(e[r])===0;return!0}function D9(t){var e=Wo.mont(t);return O9.toRed(e).redPow(t.subn(1)).fromRed().cmpn(1)===0}function C9(t,e){if(t<16)return e===2||e===5?new Wo([140,123]):new Wo([140,39]);e=new Wo(e);for(var r,n;;){for(r=new Wo(cPe(Math.ceil(t/8)));r.bitLength()>t;)r.ishrn(1);if(r.isEven()&&r.iadd(lPe),r.testn(1)||r.iadd(O9),e.cmp(O9)){if(!e.cmp(dPe))for(;r.mod(hPe).cmp(pPe);)r.iadd(DQ)}else for(;r.mod(fPe).cmp(mPe);)r.iadd(DQ);if(n=r.shrn(1),B9(n)&&B9(r)&&D9(n)&&D9(r)&&BQ.test(n)&&BQ.test(r))return r}}});var jQ=H((Emt,gPe)=>{gPe.exports={modp1:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a63a3620ffffffffffffffff"},modp2:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece65381ffffffffffffffff"},modp5:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca237327ffffffffffffffff"},modp14:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aacaa68ffffffffffffffff"},modp15:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a93ad2caffffffffffffffff"},modp16:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c934063199ffffffffffffffff"},modp17:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dcc4024ffffffffffffffff"},modp18:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dbe115974a3926f12fee5e438777cb6a932df8cd8bec4d073b931ba3bc832b68d9dd300741fa7bf8afc47ed2576f6936ba424663aab639c5ae4f5683423b4742bf1c978238f16cbe39d652de3fdb8befc848ad922222e04a4037c0713eb57a81a23f0c73473fc646cea306b4bcbc8862f8385ddfa9d4b7fa2c087e879683303ed5bdd3a062b3cf5b3a278a66d2a13f83f44f82ddf310ee074ab6a364597e899a0255dc164f31cc50846851df9ab48195ded7ea1b1d510bd7ee74d73faf36bc31ecfa268359046f4eb879f924009438b481c6cd7889a002ed5ee382bc9190da6fc026e479558e4475677e9aa9e3050e2765694dfc81f56e880b96e7160c980dd98edd3dfffffffffffffffff"}}});var LQ=H((Smt,$Q)=>{E();var jc=M9(),vPe=I9(),NQ=new vPe,bPe=new jc(24),wPe=new jc(11),_Pe=new jc(10),xPe=new jc(3),EPe=new jc(7),qQ=j9(),SPe=em();$Q.exports=Rd;function MPe(t,e){return e=e||"utf8",$.Buffer.isBuffer(t)||(t=new $.Buffer(t,e)),this._pub=new jc(t),this}function PPe(t,e){return e=e||"utf8",$.Buffer.isBuffer(t)||(t=new $.Buffer(t,e)),this._priv=new jc(t),this}var YS={};function APe(t,e){var r=e.toString("hex"),n=[r,t.toString(16)].join("_");if(n in YS)return YS[n];var i=0;if(t.isEven()||!qQ.simpleSieve||!qQ.fermatTest(t)||!NQ.test(t))return i+=1,r==="02"||r==="05"?i+=8:i+=4,YS[n]=i,i;NQ.test(t.shrn(1))||(i+=2);var o;switch(r){case"02":t.mod(bPe).cmp(wPe)&&(i+=8);break;case"05":o=t.mod(_Pe),o.cmp(xPe)&&o.cmp(EPe)&&(i+=8);break;default:i+=4}return YS[n]=i,i}function Rd(t,e,r){this.setGenerator(e),this.__prime=new jc(t),this._prime=jc.mont(this.__prime),this._primeLen=t.length,this._pub=void 0,this._priv=void 0,this._primeCode=void 0,r?(this.setPublicKey=MPe,this.setPrivateKey=PPe):this._primeCode=8}Object.defineProperty(Rd.prototype,"verifyError",{enumerable:!0,get:function(){return typeof this._primeCode!="number"&&(this._primeCode=APe(this.__prime,this.__gen)),this._primeCode}});Rd.prototype.generateKeys=function(){return this._priv||(this._priv=new jc(SPe(this._primeLen))),this._pub=this._gen.toRed(this._prime).redPow(this._priv).fromRed(),this.getPublicKey()};Rd.prototype.computeSecret=function(t){t=new jc(t),t=t.toRed(this._prime);var e=t.redPow(this._priv).fromRed(),r=new $.Buffer(e.toArray()),n=this.getPrime();if(r.length<n.length){var i=new $.Buffer(n.length-r.length);i.fill(0),r=$.Buffer.concat([i,r])}return r};Rd.prototype.getPublicKey=function(e){return QS(this._pub,e)};Rd.prototype.getPrivateKey=function(e){return QS(this._priv,e)};Rd.prototype.getPrime=function(t){return QS(this.__prime,t)};Rd.prototype.getGenerator=function(t){return QS(this._gen,t)};Rd.prototype.setGenerator=function(t,e){return e=e||"utf8",$.Buffer.isBuffer(t)||(t=new $.Buffer(t,e)),this.__gen=t,this._gen=new jc(t),this};function QS(t,e){var r=new $.Buffer(t.toArray());return e?r.toString(e):r}});var zQ=H(qv=>{E();var TPe=j9(),UQ=jQ(),N9=LQ();function RPe(t){var e=new $.Buffer(UQ[t].prime,"hex"),r=new $.Buffer(UQ[t].gen,"hex");return new N9(e,r)}var IPe={binary:!0,hex:!0,base64:!0};function FQ(t,e,r,n){return $.Buffer.isBuffer(e)||IPe[e]===void 0?FQ(t,"binary",e,r):(e=e||"binary",n=n||"binary",r=r||new $.Buffer([2]),$.Buffer.isBuffer(r)||(r=new $.Buffer(r,n)),typeof t=="number"?new N9(TPe(t,r),r,!0):($.Buffer.isBuffer(t)||(t=new $.Buffer(t,e)),new N9(t,r,!0)))}qv.DiffieHellmanGroup=qv.createDiffieHellmanGroup=qv.getDiffieHellman=RPe;qv.createDiffieHellman=qv.DiffieHellman=FQ});var eM=H((q9,GQ)=>{E();var XS=sr(),Ku=XS.Buffer;function KQ(t,e){for(var r in t)e[r]=t[r]}Ku.from&&Ku.alloc&&Ku.allocUnsafe&&Ku.allocUnsafeSlow?GQ.exports=XS:(KQ(XS,q9),q9.Buffer=Im);function Im(t,e,r){return Ku(t,e,r)}Im.prototype=Object.create(Ku.prototype);KQ(Ku,Im);Im.from=function(t,e,r){if(typeof t=="number")throw new TypeError("Argument must not be a number");return Ku(t,e,r)};Im.alloc=function(t,e,r){if(typeof t!="number")throw new TypeError("Argument must be a number");var n=Ku(t);return e!==void 0?typeof r=="string"?n.fill(e,r):n.fill(e):n.fill(0),n};Im.allocUnsafe=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return Ku(t)};Im.allocUnsafeSlow=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return XS.SlowBuffer(t)}});var $9=H((Rmt,WQ)=>{E();WQ.exports=Go().EventEmitter});var QQ=H((kmt,YQ)=>{"use strict";E();function VQ(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function HQ(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?VQ(Object(r),!0).forEach(function(n){kPe(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):VQ(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function kPe(t,e,r){return e=JQ(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function OPe(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function ZQ(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,JQ(n.key),n)}}function BPe(t,e,r){return e&&ZQ(t.prototype,e),r&&ZQ(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function JQ(t){var e=DPe(t,"string");return typeof e=="symbol"?e:String(e)}function DPe(t,e){if(typeof t!="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var CPe=sr(),tM=CPe.Buffer,jPe=am(),L9=jPe.inspect,NPe=L9&&L9.custom||"inspect";function qPe(t,e,r){tM.prototype.copy.call(t,e,r)}YQ.exports=function(){function t(){OPe(this,t),this.head=null,this.tail=null,this.length=0}return BPe(t,[{key:"push",value:function(r){var n={data:r,next:null};this.length>0?this.tail.next=n:this.head=n,this.tail=n,++this.length}},{key:"unshift",value:function(r){var n={data:r,next:this.head};this.length===0&&(this.tail=n),this.head=n,++this.length}},{key:"shift",value:function(){if(this.length!==0){var r=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,r}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(r){if(this.length===0)return"";for(var n=this.head,i=""+n.data;n=n.next;)i+=r+n.data;return i}},{key:"concat",value:function(r){if(this.length===0)return tM.alloc(0);for(var n=tM.allocUnsafe(r>>>0),i=this.head,o=0;i;)qPe(i.data,n,o),o+=i.data.length,i=i.next;return n}},{key:"consume",value:function(r,n){var i;return r<this.head.data.length?(i=this.head.data.slice(0,r),this.head.data=this.head.data.slice(r)):r===this.head.data.length?i=this.shift():i=n?this._getString(r):this._getBuffer(r),i}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(r){var n=this.head,i=1,o=n.data;for(r-=o.length;n=n.next;){var s=n.data,a=r>s.length?s.length:r;if(a===s.length?o+=s:o+=s.slice(0,r),r-=a,r===0){a===s.length?(++i,n.next?this.head=n.next:this.head=this.tail=null):(this.head=n,n.data=s.slice(a));break}++i}return this.length-=i,o}},{key:"_getBuffer",value:function(r){var n=tM.allocUnsafe(r),i=this.head,o=1;for(i.data.copy(n),r-=i.data.length;i=i.next;){var s=i.data,a=r>s.length?s.length:r;if(s.copy(n,n.length-r,0,a),r-=a,r===0){a===s.length?(++o,i.next?this.head=i.next:this.head=this.tail=null):(this.head=i,i.data=s.slice(a));break}++o}return this.length-=o,n}},{key:NPe,value:function(r,n){return L9(this,HQ(HQ({},n),{},{depth:0,customInspect:!1}))}}]),t}()});var F9=H((Bmt,eX)=>{"use strict";E();function $Pe(t,e){var r=this,n=this._readableState&&this._readableState.destroyed,i=this._writableState&&this._writableState.destroyed;return n||i?(e?e(t):t&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,j.default.nextTick(U9,this,t)):j.default.nextTick(U9,this,t)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(t||null,function(o){!e&&o?r._writableState?r._writableState.errorEmitted?j.default.nextTick(rM,r):(r._writableState.errorEmitted=!0,j.default.nextTick(XQ,r,o)):j.default.nextTick(XQ,r,o):e?(j.default.nextTick(rM,r),e(o)):j.default.nextTick(rM,r)}),this)}function XQ(t,e){U9(t,e),rM(t)}function rM(t){t._writableState&&!t._writableState.emitClose||t._readableState&&!t._readableState.emitClose||t.emit("close")}function LPe(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}function U9(t,e){t.emit("error",e)}function UPe(t,e){var r=t._readableState,n=t._writableState;r&&r.autoDestroy||n&&n.autoDestroy?t.destroy(e):t.emit("error",e)}eX.exports={destroy:$Pe,undestroy:LPe,errorOrDestroy:UPe}});var km=H((Cmt,nX)=>{"use strict";E();function FPe(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}var rX={};function Nc(t,e,r){r||(r=Error);function n(o,s,a){return typeof e=="string"?e:e(o,s,a)}var i=function(o){FPe(s,o);function s(a,d,m){return o.call(this,n(a,d,m))||this}return s}(r);i.prototype.name=r.name,i.prototype.code=t,rX[t]=i}function tX(t,e){if(Array.isArray(t)){var r=t.length;return t=t.map(function(n){return String(n)}),r>2?"one of ".concat(e," ").concat(t.slice(0,r-1).join(", "),", or ")+t[r-1]:r===2?"one of ".concat(e," ").concat(t[0]," or ").concat(t[1]):"of ".concat(e," ").concat(t[0])}else return"of ".concat(e," ").concat(String(t))}function zPe(t,e,r){return t.substr(!r||r<0?0:+r,e.length)===e}function KPe(t,e,r){return(r===void 0||r>t.length)&&(r=t.length),t.substring(r-e.length,r)===e}function GPe(t,e,r){return typeof r!="number"&&(r=0),r+e.length>t.length?!1:t.indexOf(e,r)!==-1}Nc("ERR_INVALID_OPT_VALUE",function(t,e){return'The value "'+e+'" is invalid for option "'+t+'"'},TypeError);Nc("ERR_INVALID_ARG_TYPE",function(t,e,r){var n;typeof e=="string"&&zPe(e,"not ")?(n="must not be",e=e.replace(/^not /,"")):n="must be";var i;if(KPe(t," argument"))i="The ".concat(t," ").concat(n," ").concat(tX(e,"type"));else{var o=GPe(t,".")?"property":"argument";i='The "'.concat(t,'" ').concat(o," ").concat(n," ").concat(tX(e,"type"))}return i+=". Received type ".concat(typeof r),i},TypeError);Nc("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF");Nc("ERR_METHOD_NOT_IMPLEMENTED",function(t){return"The "+t+" method is not implemented"});Nc("ERR_STREAM_PREMATURE_CLOSE","Premature close");Nc("ERR_STREAM_DESTROYED",function(t){return"Cannot call "+t+" after a stream was destroyed"});Nc("ERR_MULTIPLE_CALLBACK","Callback called multiple times");Nc("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable");Nc("ERR_STREAM_WRITE_AFTER_END","write after end");Nc("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError);Nc("ERR_UNKNOWN_ENCODING",function(t){return"Unknown encoding: "+t},TypeError);Nc("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event");nX.exports.codes=rX});var z9=H((Nmt,iX)=>{"use strict";E();var WPe=km().codes.ERR_INVALID_OPT_VALUE;function VPe(t,e,r){return t.highWaterMark!=null?t.highWaterMark:e?t[r]:null}function HPe(t,e,r,n){var i=VPe(e,n,r);if(i!=null){if(!(isFinite(i)&&Math.floor(i)===i)||i<0){var o=n?r:"highWaterMark";throw new WPe(o,i)}return Math.floor(i)}return t.objectMode?16:16*1024}iX.exports={getHighWaterMark:HPe}});var W9=H(($mt,uX)=>{"use strict";E();uX.exports=Ai;function sX(t){var e=this;this.next=null,this.entry=null,this.finish=function(){_Ae(e,t)}}var $v;Ai.WritableState=Q2;var ZPe={deprecate:H6()},aX=$9(),iM=sr().Buffer,JPe=(typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function YPe(t){return iM.from(t)}function QPe(t){return iM.isBuffer(t)||t instanceof JPe}var G9=F9(),XPe=z9(),eAe=XPe.getHighWaterMark,fp=km().codes,tAe=fp.ERR_INVALID_ARG_TYPE,rAe=fp.ERR_METHOD_NOT_IMPLEMENTED,nAe=fp.ERR_MULTIPLE_CALLBACK,iAe=fp.ERR_STREAM_CANNOT_PIPE,oAe=fp.ERR_STREAM_DESTROYED,sAe=fp.ERR_STREAM_NULL_VALUES,aAe=fp.ERR_STREAM_WRITE_AFTER_END,cAe=fp.ERR_UNKNOWN_ENCODING,Lv=G9.errorOrDestroy;It()(Ai,aX);function fAe(){}function Q2(t,e,r){$v=$v||Om(),t=t||{},typeof r!="boolean"&&(r=e instanceof $v),this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.writableObjectMode),this.highWaterMark=eAe(this,t,"writableHighWaterMark",r),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var n=t.decodeStrings===!1;this.decodeStrings=!n,this.defaultEncoding=t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(i){yAe(e,i)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=t.emitClose!==!1,this.autoDestroy=!!t.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new sX(this)}Q2.prototype.getBuffer=function(){for(var e=this.bufferedRequest,r=[];e;)r.push(e),e=e.next;return r};(function(){try{Object.defineProperty(Q2.prototype,"buffer",{get:ZPe.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}})();var nM;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(nM=Function.prototype[Symbol.hasInstance],Object.defineProperty(Ai,Symbol.hasInstance,{value:function(e){return nM.call(this,e)?!0:this!==Ai?!1:e&&e._writableState instanceof Q2}})):nM=function(e){return e instanceof this};function Ai(t){$v=$v||Om();var e=this instanceof $v;if(!e&&!nM.call(Ai,this))return new Ai(t);this._writableState=new Q2(t,this,e),this.writable=!0,t&&(typeof t.write=="function"&&(this._write=t.write),typeof t.writev=="function"&&(this._writev=t.writev),typeof t.destroy=="function"&&(this._destroy=t.destroy),typeof t.final=="function"&&(this._final=t.final)),aX.call(this)}Ai.prototype.pipe=function(){Lv(this,new iAe)};function uAe(t,e){var r=new aAe;Lv(t,r),j.default.nextTick(e,r)}function lAe(t,e,r,n){var i;return r===null?i=new sAe:typeof r!="string"&&!e.objectMode&&(i=new tAe("chunk",["string","Buffer"],r)),i?(Lv(t,i),j.default.nextTick(n,i),!1):!0}Ai.prototype.write=function(t,e,r){var n=this._writableState,i=!1,o=!n.objectMode&&QPe(t);return o&&!iM.isBuffer(t)&&(t=YPe(t)),typeof e=="function"&&(r=e,e=null),o?e="buffer":e||(e=n.defaultEncoding),typeof r!="function"&&(r=fAe),n.ending?uAe(this,r):(o||lAe(this,n,t,r))&&(n.pendingcb++,i=hAe(this,n,o,t,e,r)),i};Ai.prototype.cork=function(){this._writableState.corked++};Ai.prototype.uncork=function(){var t=this._writableState;t.corked&&(t.corked--,!t.writing&&!t.corked&&!t.bufferProcessing&&t.bufferedRequest&&cX(this,t))};Ai.prototype.setDefaultEncoding=function(e){if(typeof e=="string"&&(e=e.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase())>-1))throw new cAe(e);return this._writableState.defaultEncoding=e,this};Object.defineProperty(Ai.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});function dAe(t,e,r){return!t.objectMode&&t.decodeStrings!==!1&&typeof e=="string"&&(e=iM.from(e,r)),e}Object.defineProperty(Ai.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function hAe(t,e,r,n,i,o){if(!r){var s=dAe(e,n,i);n!==s&&(r=!0,i="buffer",n=s)}var a=e.objectMode?1:n.length;e.length+=a;var d=e.length<e.highWaterMark;if(d||(e.needDrain=!0),e.writing||e.corked){var m=e.lastBufferedRequest;e.lastBufferedRequest={chunk:n,encoding:i,isBuf:r,callback:o,next:null},m?m.next=e.lastBufferedRequest:e.bufferedRequest=e.lastBufferedRequest,e.bufferedRequestCount+=1}else K9(t,e,!1,a,n,i,o);return d}function K9(t,e,r,n,i,o,s){e.writelen=n,e.writecb=s,e.writing=!0,e.sync=!0,e.destroyed?e.onwrite(new oAe("write")):r?t._writev(i,e.onwrite):t._write(i,o,e.onwrite),e.sync=!1}function pAe(t,e,r,n,i){--e.pendingcb,r?(j.default.nextTick(i,n),j.default.nextTick(Y2,t,e),t._writableState.errorEmitted=!0,Lv(t,n)):(i(n),t._writableState.errorEmitted=!0,Lv(t,n),Y2(t,e))}function mAe(t){t.writing=!1,t.writecb=null,t.length-=t.writelen,t.writelen=0}function yAe(t,e){var r=t._writableState,n=r.sync,i=r.writecb;if(typeof i!="function")throw new nAe;if(mAe(r),e)pAe(t,r,n,e,i);else{var o=fX(r)||t.destroyed;!o&&!r.corked&&!r.bufferProcessing&&r.bufferedRequest&&cX(t,r),n?j.default.nextTick(oX,t,r,o,i):oX(t,r,o,i)}}function oX(t,e,r,n){r||gAe(t,e),e.pendingcb--,n(),Y2(t,e)}function gAe(t,e){e.length===0&&e.needDrain&&(e.needDrain=!1,t.emit("drain"))}function cX(t,e){e.bufferProcessing=!0;var r=e.bufferedRequest;if(t._writev&&r&&r.next){var n=e.bufferedRequestCount,i=new Array(n),o=e.corkedRequestsFree;o.entry=r;for(var s=0,a=!0;r;)i[s]=r,r.isBuf||(a=!1),r=r.next,s+=1;i.allBuffers=a,K9(t,e,!0,e.length,i,"",o.finish),e.pendingcb++,e.lastBufferedRequest=null,o.next?(e.corkedRequestsFree=o.next,o.next=null):e.corkedRequestsFree=new sX(e),e.bufferedRequestCount=0}else{for(;r;){var d=r.chunk,m=r.encoding,p=r.callback,w=e.objectMode?1:d.length;if(K9(t,e,!1,w,d,m,p),r=r.next,e.bufferedRequestCount--,e.writing)break}r===null&&(e.lastBufferedRequest=null)}e.bufferedRequest=r,e.bufferProcessing=!1}Ai.prototype._write=function(t,e,r){r(new rAe("_write()"))};Ai.prototype._writev=null;Ai.prototype.end=function(t,e,r){var n=this._writableState;return typeof t=="function"?(r=t,t=null,e=null):typeof e=="function"&&(r=e,e=null),t!=null&&this.write(t,e),n.corked&&(n.corked=1,this.uncork()),n.ending||wAe(this,n,r),this};Object.defineProperty(Ai.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}});function fX(t){return t.ending&&t.length===0&&t.bufferedRequest===null&&!t.finished&&!t.writing}function vAe(t,e){t._final(function(r){e.pendingcb--,r&&Lv(t,r),e.prefinished=!0,t.emit("prefinish"),Y2(t,e)})}function bAe(t,e){!e.prefinished&&!e.finalCalled&&(typeof t._final=="function"&&!e.destroyed?(e.pendingcb++,e.finalCalled=!0,j.default.nextTick(vAe,t,e)):(e.prefinished=!0,t.emit("prefinish")))}function Y2(t,e){var r=fX(e);if(r&&(bAe(t,e),e.pendingcb===0&&(e.finished=!0,t.emit("finish"),e.autoDestroy))){var n=t._readableState;(!n||n.autoDestroy&&n.endEmitted)&&t.destroy()}return r}function wAe(t,e,r){e.ending=!0,Y2(t,e),r&&(e.finished?j.default.nextTick(r):t.once("finish",r)),e.ended=!0,t.writable=!1}function _Ae(t,e,r){var n=t.entry;for(t.entry=null;n;){var i=n.callback;e.pendingcb--,i(r),n=n.next}e.corkedRequestsFree.next=t}Object.defineProperty(Ai.prototype,"destroyed",{enumerable:!1,get:function(){return this._writableState===void 0?!1:this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}});Ai.prototype.destroy=G9.destroy;Ai.prototype._undestroy=G9.undestroy;Ai.prototype._destroy=function(t,e){e(t)}});var Om=H((Umt,dX)=>{"use strict";E();var xAe=Object.keys||function(t){var e=[];for(var r in t)e.push(r);return e};dX.exports=Gu;var lX=Z9(),H9=W9();It()(Gu,lX);for(V9=xAe(H9.prototype),oM=0;oM<V9.length;oM++)sM=V9[oM],Gu.prototype[sM]||(Gu.prototype[sM]=H9.prototype[sM]);var V9,sM,oM;function Gu(t){if(!(this instanceof Gu))return new Gu(t);lX.call(this,t),H9.call(this,t),this.allowHalfOpen=!0,t&&(t.readable===!1&&(this.readable=!1),t.writable===!1&&(this.writable=!1),t.allowHalfOpen===!1&&(this.allowHalfOpen=!1,this.once("end",EAe)))}Object.defineProperty(Gu.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});Object.defineProperty(Gu.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});Object.defineProperty(Gu.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}});function EAe(){this._writableState.ended||j.default.nextTick(SAe,this)}function SAe(t){t.end()}Object.defineProperty(Gu.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set:function(e){this._readableState===void 0||this._writableState===void 0||(this._readableState.destroyed=e,this._writableState.destroyed=e)}})});var aM=H((zmt,mX)=>{"use strict";E();var hX=km().codes.ERR_STREAM_PREMATURE_CLOSE;function MAe(t){var e=!1;return function(){if(!e){e=!0;for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];t.apply(this,n)}}}function PAe(){}function AAe(t){return t.setHeader&&typeof t.abort=="function"}function pX(t,e,r){if(typeof e=="function")return pX(t,null,e);e||(e={}),r=MAe(r||PAe);var n=e.readable||e.readable!==!1&&t.readable,i=e.writable||e.writable!==!1&&t.writable,o=function(){t.writable||a()},s=t._writableState&&t._writableState.finished,a=function(){i=!1,s=!0,n||r.call(t)},d=t._readableState&&t._readableState.endEmitted,m=function(){n=!1,d=!0,i||r.call(t)},p=function(M){r.call(t,M)},w=function(){var M;if(n&&!d)return(!t._readableState||!t._readableState.ended)&&(M=new hX),r.call(t,M);if(i&&!s)return(!t._writableState||!t._writableState.ended)&&(M=new hX),r.call(t,M)},P=function(){t.req.on("finish",a)};return AAe(t)?(t.on("complete",a),t.on("abort",w),t.req?P():t.on("request",P)):i&&!t._writableState&&(t.on("end",o),t.on("close",o)),t.on("end",m),t.on("finish",a),e.error!==!1&&t.on("error",p),t.on("close",w),function(){t.removeListener("complete",a),t.removeListener("abort",w),t.removeListener("request",P),t.req&&t.req.removeListener("finish",a),t.removeListener("end",o),t.removeListener("close",o),t.removeListener("finish",a),t.removeListener("end",m),t.removeListener("error",p),t.removeListener("close",w)}}mX.exports=pX});var gX=H((Gmt,yX)=>{"use strict";E();var cM;function up(t,e,r){return e=TAe(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function TAe(t){var e=RAe(t,"string");return typeof e=="symbol"?e:String(e)}function RAe(t,e){if(typeof t!="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var IAe=aM(),lp=Symbol("lastResolve"),Bm=Symbol("lastReject"),X2=Symbol("error"),fM=Symbol("ended"),Dm=Symbol("lastPromise"),J9=Symbol("handlePromise"),Cm=Symbol("stream");function dp(t,e){return{value:t,done:e}}function kAe(t){var e=t[lp];if(e!==null){var r=t[Cm].read();r!==null&&(t[Dm]=null,t[lp]=null,t[Bm]=null,e(dp(r,!1)))}}function OAe(t){j.default.nextTick(kAe,t)}function BAe(t,e){return function(r,n){t.then(function(){if(e[fM]){r(dp(void 0,!0));return}e[J9](r,n)},n)}}var DAe=Object.getPrototypeOf(function(){}),CAe=Object.setPrototypeOf((cM={get stream(){return this[Cm]},next:function(){var e=this,r=this[X2];if(r!==null)return Promise.reject(r);if(this[fM])return Promise.resolve(dp(void 0,!0));if(this[Cm].destroyed)return new Promise(function(s,a){j.default.nextTick(function(){e[X2]?a(e[X2]):s(dp(void 0,!0))})});var n=this[Dm],i;if(n)i=new Promise(BAe(n,this));else{var o=this[Cm].read();if(o!==null)return Promise.resolve(dp(o,!1));i=new Promise(this[J9])}return this[Dm]=i,i}},up(cM,Symbol.asyncIterator,function(){return this}),up(cM,"return",function(){var e=this;return new Promise(function(r,n){e[Cm].destroy(null,function(i){if(i){n(i);return}r(dp(void 0,!0))})})}),cM),DAe),jAe=function(e){var r,n=Object.create(CAe,(r={},up(r,Cm,{value:e,writable:!0}),up(r,lp,{value:null,writable:!0}),up(r,Bm,{value:null,writable:!0}),up(r,X2,{value:null,writable:!0}),up(r,fM,{value:e._readableState.endEmitted,writable:!0}),up(r,J9,{value:function(o,s){var a=n[Cm].read();a?(n[Dm]=null,n[lp]=null,n[Bm]=null,o(dp(a,!1))):(n[lp]=o,n[Bm]=s)},writable:!0}),r));return n[Dm]=null,IAe(e,function(i){if(i&&i.code!=="ERR_STREAM_PREMATURE_CLOSE"){var o=n[Bm];o!==null&&(n[Dm]=null,n[lp]=null,n[Bm]=null,o(i)),n[X2]=i;return}var s=n[lp];s!==null&&(n[Dm]=null,n[lp]=null,n[Bm]=null,s(dp(void 0,!0))),n[fM]=!0}),e.on("readable",OAe.bind(null,n)),n};yX.exports=jAe});var bX=H((Vmt,vX)=>{E();vX.exports=function(){throw new Error("Readable.from is not available in the browser")}});var Z9=H((Jmt,RX)=>{"use strict";E();RX.exports=Qr;var Uv;Qr.ReadableState=EX;var Zmt=Go().EventEmitter,xX=function(e,r){return e.listeners(r).length},t_=$9(),uM=sr().Buffer,NAe=(typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function qAe(t){return uM.from(t)}function $Ae(t){return uM.isBuffer(t)||t instanceof NAe}var Y9=am(),Pr;Y9&&Y9.debuglog?Pr=Y9.debuglog("stream"):Pr=function(){};var LAe=QQ(),i7=F9(),UAe=z9(),FAe=UAe.getHighWaterMark,lM=km().codes,zAe=lM.ERR_INVALID_ARG_TYPE,KAe=lM.ERR_STREAM_PUSH_AFTER_EOF,GAe=lM.ERR_METHOD_NOT_IMPLEMENTED,WAe=lM.ERR_STREAM_UNSHIFT_AFTER_END_EVENT,Fv,Q9,X9;It()(Qr,t_);var e_=i7.errorOrDestroy,e7=["error","close","destroy","pause","resume"];function VAe(t,e,r){if(typeof t.prependListener=="function")return t.prependListener(e,r);!t._events||!t._events[e]?t.on(e,r):Array.isArray(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]}function EX(t,e,r){Uv=Uv||Om(),t=t||{},typeof r!="boolean"&&(r=e instanceof Uv),this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.readableObjectMode),this.highWaterMark=FAe(this,t,"readableHighWaterMark",r),this.buffer=new LAe,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=t.emitClose!==!1,this.autoDestroy=!!t.autoDestroy,this.destroyed=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(Fv||(Fv=Uu().StringDecoder),this.decoder=new Fv(t.encoding),this.encoding=t.encoding)}function Qr(t){if(Uv=Uv||Om(),!(this instanceof Qr))return new Qr(t);var e=this instanceof Uv;this._readableState=new EX(t,this,e),this.readable=!0,t&&(typeof t.read=="function"&&(this._read=t.read),typeof t.destroy=="function"&&(this._destroy=t.destroy)),t_.call(this)}Object.defineProperty(Qr.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0?!1:this._readableState.destroyed},set:function(e){this._readableState&&(this._readableState.destroyed=e)}});Qr.prototype.destroy=i7.destroy;Qr.prototype._undestroy=i7.undestroy;Qr.prototype._destroy=function(t,e){e(t)};Qr.prototype.push=function(t,e){var r=this._readableState,n;return r.objectMode?n=!0:typeof t=="string"&&(e=e||r.defaultEncoding,e!==r.encoding&&(t=uM.from(t,e),e=""),n=!0),SX(this,t,e,!1,n)};Qr.prototype.unshift=function(t){return SX(this,t,null,!0,!1)};function SX(t,e,r,n,i){Pr("readableAddChunk",e);var o=t._readableState;if(e===null)o.reading=!1,JAe(t,o);else{var s;if(i||(s=HAe(o,e)),s)e_(t,s);else if(o.objectMode||e&&e.length>0)if(typeof e!="string"&&!o.objectMode&&Object.getPrototypeOf(e)!==uM.prototype&&(e=qAe(e)),n)o.endEmitted?e_(t,new WAe):t7(t,o,e,!0);else if(o.ended)e_(t,new KAe);else{if(o.destroyed)return!1;o.reading=!1,o.decoder&&!r?(e=o.decoder.write(e),o.objectMode||e.length!==0?t7(t,o,e,!1):n7(t,o)):t7(t,o,e,!1)}else n||(o.reading=!1,n7(t,o))}return!o.ended&&(o.length<o.highWaterMark||o.length===0)}function t7(t,e,r,n){e.flowing&&e.length===0&&!e.sync?(e.awaitDrain=0,t.emit("data",r)):(e.length+=e.objectMode?1:r.length,n?e.buffer.unshift(r):e.buffer.push(r),e.needReadable&&dM(t)),n7(t,e)}function HAe(t,e){var r;return!$Ae(e)&&typeof e!="string"&&e!==void 0&&!t.objectMode&&(r=new zAe("chunk",["string","Buffer","Uint8Array"],e)),r}Qr.prototype.isPaused=function(){return this._readableState.flowing===!1};Qr.prototype.setEncoding=function(t){Fv||(Fv=Uu().StringDecoder);var e=new Fv(t);this._readableState.decoder=e,this._readableState.encoding=this._readableState.decoder.encoding;for(var r=this._readableState.buffer.head,n="";r!==null;)n+=e.write(r.data),r=r.next;return this._readableState.buffer.clear(),n!==""&&this._readableState.buffer.push(n),this._readableState.length=n.length,this};var wX=1073741824;function ZAe(t){return t>=wX?t=wX:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}function _X(t,e){return t<=0||e.length===0&&e.ended?0:e.objectMode?1:t!==t?e.flowing&&e.length?e.buffer.head.data.length:e.length:(t>e.highWaterMark&&(e.highWaterMark=ZAe(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}Qr.prototype.read=function(t){Pr("read",t),t=parseInt(t,10);var e=this._readableState,r=t;if(t!==0&&(e.emittedReadable=!1),t===0&&e.needReadable&&((e.highWaterMark!==0?e.length>=e.highWaterMark:e.length>0)||e.ended))return Pr("read: emitReadable",e.length,e.ended),e.length===0&&e.ended?r7(this):dM(this),null;if(t=_X(t,e),t===0&&e.ended)return e.length===0&&r7(this),null;var n=e.needReadable;Pr("need readable",n),(e.length===0||e.length-t<e.highWaterMark)&&(n=!0,Pr("length less than watermark",n)),e.ended||e.reading?(n=!1,Pr("reading or ended",n)):n&&(Pr("do read"),e.reading=!0,e.sync=!0,e.length===0&&(e.needReadable=!0),this._read(e.highWaterMark),e.sync=!1,e.reading||(t=_X(r,e)));var i;return t>0?i=AX(t,e):i=null,i===null?(e.needReadable=e.length<=e.highWaterMark,t=0):(e.length-=t,e.awaitDrain=0),e.length===0&&(e.ended||(e.needReadable=!0),r!==t&&e.ended&&r7(this)),i!==null&&this.emit("data",i),i};function JAe(t,e){if(Pr("onEofChunk"),!e.ended){if(e.decoder){var r=e.decoder.end();r&&r.length&&(e.buffer.push(r),e.length+=e.objectMode?1:r.length)}e.ended=!0,e.sync?dM(t):(e.needReadable=!1,e.emittedReadable||(e.emittedReadable=!0,MX(t)))}}function dM(t){var e=t._readableState;Pr("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||(Pr("emitReadable",e.flowing),e.emittedReadable=!0,j.default.nextTick(MX,t))}function MX(t){var e=t._readableState;Pr("emitReadable_",e.destroyed,e.length,e.ended),!e.destroyed&&(e.length||e.ended)&&(t.emit("readable"),e.emittedReadable=!1),e.needReadable=!e.flowing&&!e.ended&&e.length<=e.highWaterMark,o7(t)}function n7(t,e){e.readingMore||(e.readingMore=!0,j.default.nextTick(YAe,t,e))}function YAe(t,e){for(;!e.reading&&!e.ended&&(e.length<e.highWaterMark||e.flowing&&e.length===0);){var r=e.length;if(Pr("maybeReadMore read 0"),t.read(0),r===e.length)break}e.readingMore=!1}Qr.prototype._read=function(t){e_(this,new GAe("_read()"))};Qr.prototype.pipe=function(t,e){var r=this,n=this._readableState;switch(n.pipesCount){case 0:n.pipes=t;break;case 1:n.pipes=[n.pipes,t];break;default:n.pipes.push(t);break}n.pipesCount+=1,Pr("pipe count=%d opts=%j",n.pipesCount,e);var i=(!e||e.end!==!1)&&t!==j.default.stdout&&t!==j.default.stderr,o=i?a:A;n.endEmitted?j.default.nextTick(o):r.once("end",o),t.on("unpipe",s);function s(B,I){Pr("onunpipe"),B===r&&I&&I.hasUnpiped===!1&&(I.hasUnpiped=!0,p())}function a(){Pr("onend"),t.end()}var d=QAe(r);t.on("drain",d);var m=!1;function p(){Pr("cleanup"),t.removeListener("close",S),t.removeListener("finish",M),t.removeListener("drain",d),t.removeListener("error",P),t.removeListener("unpipe",s),r.removeListener("end",a),r.removeListener("end",A),r.removeListener("data",w),m=!0,n.awaitDrain&&(!t._writableState||t._writableState.needDrain)&&d()}r.on("data",w);function w(B){Pr("ondata");var I=t.write(B);Pr("dest.write",I),I===!1&&((n.pipesCount===1&&n.pipes===t||n.pipesCount>1&&TX(n.pipes,t)!==-1)&&!m&&(Pr("false write response, pause",n.awaitDrain),n.awaitDrain++),r.pause())}function P(B){Pr("onerror",B),A(),t.removeListener("error",P),xX(t,"error")===0&&e_(t,B)}VAe(t,"error",P);function S(){t.removeListener("finish",M),A()}t.once("close",S);function M(){Pr("onfinish"),t.removeListener("close",S),A()}t.once("finish",M);function A(){Pr("unpipe"),r.unpipe(t)}return t.emit("pipe",r),n.flowing||(Pr("pipe resume"),r.resume()),t};function QAe(t){return function(){var r=t._readableState;Pr("pipeOnDrain",r.awaitDrain),r.awaitDrain&&r.awaitDrain--,r.awaitDrain===0&&xX(t,"data")&&(r.flowing=!0,o7(t))}}Qr.prototype.unpipe=function(t){var e=this._readableState,r={hasUnpiped:!1};if(e.pipesCount===0)return this;if(e.pipesCount===1)return t&&t!==e.pipes?this:(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this,r),this);if(!t){var n=e.pipes,i=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var o=0;o<i;o++)n[o].emit("unpipe",this,{hasUnpiped:!1});return this}var s=TX(e.pipes,t);return s===-1?this:(e.pipes.splice(s,1),e.pipesCount-=1,e.pipesCount===1&&(e.pipes=e.pipes[0]),t.emit("unpipe",this,r),this)};Qr.prototype.on=function(t,e){var r=t_.prototype.on.call(this,t,e),n=this._readableState;return t==="data"?(n.readableListening=this.listenerCount("readable")>0,n.flowing!==!1&&this.resume()):t==="readable"&&!n.endEmitted&&!n.readableListening&&(n.readableListening=n.needReadable=!0,n.flowing=!1,n.emittedReadable=!1,Pr("on readable",n.length,n.reading),n.length?dM(this):n.reading||j.default.nextTick(XAe,this)),r};Qr.prototype.addListener=Qr.prototype.on;Qr.prototype.removeListener=function(t,e){var r=t_.prototype.removeListener.call(this,t,e);return t==="readable"&&j.default.nextTick(PX,this),r};Qr.prototype.removeAllListeners=function(t){var e=t_.prototype.removeAllListeners.apply(this,arguments);return(t==="readable"||t===void 0)&&j.default.nextTick(PX,this),e};function PX(t){var e=t._readableState;e.readableListening=t.listenerCount("readable")>0,e.resumeScheduled&&!e.paused?e.flowing=!0:t.listenerCount("data")>0&&t.resume()}function XAe(t){Pr("readable nexttick read 0"),t.read(0)}Qr.prototype.resume=function(){var t=this._readableState;return t.flowing||(Pr("resume"),t.flowing=!t.readableListening,eTe(this,t)),t.paused=!1,this};function eTe(t,e){e.resumeScheduled||(e.resumeScheduled=!0,j.default.nextTick(tTe,t,e))}function tTe(t,e){Pr("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),o7(t),e.flowing&&!e.reading&&t.read(0)}Qr.prototype.pause=function(){return Pr("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(Pr("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this};function o7(t){var e=t._readableState;for(Pr("flow",e.flowing);e.flowing&&t.read()!==null;);}Qr.prototype.wrap=function(t){var e=this,r=this._readableState,n=!1;t.on("end",function(){if(Pr("wrapped end"),r.decoder&&!r.ended){var s=r.decoder.end();s&&s.length&&e.push(s)}e.push(null)}),t.on("data",function(s){if(Pr("wrapped data"),r.decoder&&(s=r.decoder.write(s)),!(r.objectMode&&s==null)&&!(!r.objectMode&&(!s||!s.length))){var a=e.push(s);a||(n=!0,t.pause())}});for(var i in t)this[i]===void 0&&typeof t[i]=="function"&&(this[i]=function(a){return function(){return t[a].apply(t,arguments)}}(i));for(var o=0;o<e7.length;o++)t.on(e7[o],this.emit.bind(this,e7[o]));return this._read=function(s){Pr("wrapped _read",s),n&&(n=!1,t.resume())},this};typeof Symbol=="function"&&(Qr.prototype[Symbol.asyncIterator]=function(){return Q9===void 0&&(Q9=gX()),Q9(this)});Object.defineProperty(Qr.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}});Object.defineProperty(Qr.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}});Object.defineProperty(Qr.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(e){this._readableState&&(this._readableState.flowing=e)}});Qr._fromList=AX;Object.defineProperty(Qr.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}});function AX(t,e){if(e.length===0)return null;var r;return e.objectMode?r=e.buffer.shift():!t||t>=e.length?(e.decoder?r=e.buffer.join(""):e.buffer.length===1?r=e.buffer.first():r=e.buffer.concat(e.length),e.buffer.clear()):r=e.buffer.consume(t,e.decoder),r}function r7(t){var e=t._readableState;Pr("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,j.default.nextTick(rTe,e,t))}function rTe(t,e){if(Pr("endReadableNT",t.endEmitted,t.length),!t.endEmitted&&t.length===0&&(t.endEmitted=!0,e.readable=!1,e.emit("end"),t.autoDestroy)){var r=e._writableState;(!r||r.autoDestroy&&r.finished)&&e.destroy()}}typeof Symbol=="function"&&(Qr.from=function(t,e){return X9===void 0&&(X9=bX()),X9(Qr,t,e)});function TX(t,e){for(var r=0,n=t.length;r<n;r++)if(t[r]===e)return r;return-1}});var s7=H((Qmt,kX)=>{"use strict";E();kX.exports=Id;var hM=km().codes,nTe=hM.ERR_METHOD_NOT_IMPLEMENTED,iTe=hM.ERR_MULTIPLE_CALLBACK,oTe=hM.ERR_TRANSFORM_ALREADY_TRANSFORMING,sTe=hM.ERR_TRANSFORM_WITH_LENGTH_0,pM=Om();It()(Id,pM);function aTe(t,e){var r=this._transformState;r.transforming=!1;var n=r.writecb;if(n===null)return this.emit("error",new iTe);r.writechunk=null,r.writecb=null,e!=null&&this.push(e),n(t);var i=this._readableState;i.reading=!1,(i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}function Id(t){if(!(this instanceof Id))return new Id(t);pM.call(this,t),this._transformState={afterTransform:aTe.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,t&&(typeof t.transform=="function"&&(this._transform=t.transform),typeof t.flush=="function"&&(this._flush=t.flush)),this.on("prefinish",cTe)}function cTe(){var t=this;typeof this._flush=="function"&&!this._readableState.destroyed?this._flush(function(e,r){IX(t,e,r)}):IX(this,null,null)}Id.prototype.push=function(t,e){return this._transformState.needTransform=!1,pM.prototype.push.call(this,t,e)};Id.prototype._transform=function(t,e,r){r(new nTe("_transform()"))};Id.prototype._write=function(t,e,r){var n=this._transformState;if(n.writecb=r,n.writechunk=t,n.writeencoding=e,!n.transforming){var i=this._readableState;(n.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}};Id.prototype._read=function(t){var e=this._transformState;e.writechunk!==null&&!e.transforming?(e.transforming=!0,this._transform(e.writechunk,e.writeencoding,e.afterTransform)):e.needTransform=!0};Id.prototype._destroy=function(t,e){pM.prototype._destroy.call(this,t,function(r){e(r)})};function IX(t,e,r){if(e)return t.emit("error",e);if(r!=null&&t.push(r),t._writableState.length)throw new sTe;if(t._transformState.transforming)throw new oTe;return t.push(null)}});var DX=H((eyt,BX)=>{"use strict";E();BX.exports=r_;var OX=s7();It()(r_,OX);function r_(t){if(!(this instanceof r_))return new r_(t);OX.call(this,t)}r_.prototype._transform=function(t,e,r){r(null,t)}});var $X=H((ryt,qX)=>{"use strict";E();var a7;function fTe(t){var e=!1;return function(){e||(e=!0,t.apply(void 0,arguments))}}var NX=km().codes,uTe=NX.ERR_MISSING_ARGS,lTe=NX.ERR_STREAM_DESTROYED;function CX(t){if(t)throw t}function dTe(t){return t.setHeader&&typeof t.abort=="function"}function hTe(t,e,r,n){n=fTe(n);var i=!1;t.on("close",function(){i=!0}),a7===void 0&&(a7=aM()),a7(t,{readable:e,writable:r},function(s){if(s)return n(s);i=!0,n()});var o=!1;return function(s){if(!i&&!o){if(o=!0,dTe(t))return t.abort();if(typeof t.destroy=="function")return t.destroy();n(s||new lTe("pipe"))}}}function jX(t){t()}function pTe(t,e){return t.pipe(e)}function mTe(t){return!t.length||typeof t[t.length-1]!="function"?CX:t.pop()}function yTe(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];var n=mTe(e);if(Array.isArray(e[0])&&(e=e[0]),e.length<2)throw new uTe("streams");var i,o=e.map(function(s,a){var d=a<e.length-1,m=a>0;return hTe(s,d,m,function(p){i||(i=p),p&&o.forEach(jX),!d&&(o.forEach(jX),n(i))})});return e.reduce(pTe)}qX.exports=yTe});var UX=H((qc,LX)=>{E();qc=LX.exports=Z9();qc.Stream=qc;qc.Readable=qc;qc.Writable=W9();qc.Duplex=Om();qc.Transform=s7();qc.PassThrough=DX();qc.finished=aM();qc.pipeline=$X()});var mM=H((FX,c7)=>{E();(function(t,e){"use strict";function r(y,l){if(!y)throw new Error(l||"Assertion failed")}function n(y,l){y.super_=l;var h=function(){};h.prototype=l.prototype,y.prototype=new h,y.prototype.constructor=y}function i(y,l,h){if(i.isBN(y))return y;this.negative=0,this.words=null,this.length=0,this.red=null,y!==null&&((l==="le"||l==="be")&&(h=l,l=10),this._init(y||0,l||10,h||"be"))}typeof t=="object"?t.exports=i:e.BN=i,i.BN=i,i.wordSize=26;var o;try{typeof window<"u"&&typeof window.Buffer<"u"?o=window.Buffer:o=sr().Buffer}catch{}i.isBN=function(l){return l instanceof i?!0:l!==null&&typeof l=="object"&&l.constructor.wordSize===i.wordSize&&Array.isArray(l.words)},i.max=function(l,h){return l.cmp(h)>0?l:h},i.min=function(l,h){return l.cmp(h)<0?l:h},i.prototype._init=function(l,h,b){if(typeof l=="number")return this._initNumber(l,h,b);if(typeof l=="object")return this._initArray(l,h,b);h==="hex"&&(h=16),r(h===(h|0)&&h>=2&&h<=36),l=l.toString().replace(/\s+/g,"");var _=0;l[0]==="-"&&(_++,this.negative=1),_<l.length&&(h===16?this._parseHex(l,_,b):(this._parseBase(l,h,_),b==="le"&&this._initArray(this.toArray(),h,b)))},i.prototype._initNumber=function(l,h,b){l<0&&(this.negative=1,l=-l),l<67108864?(this.words=[l&67108863],this.length=1):l<4503599627370496?(this.words=[l&67108863,l/67108864&67108863],this.length=2):(r(l<9007199254740992),this.words=[l&67108863,l/67108864&67108863,1],this.length=3),b==="le"&&this._initArray(this.toArray(),h,b)},i.prototype._initArray=function(l,h,b){if(r(typeof l.length=="number"),l.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(l.length/3),this.words=new Array(this.length);for(var _=0;_<this.length;_++)this.words[_]=0;var g,f,v=0;if(b==="be")for(_=l.length-1,g=0;_>=0;_-=3)f=l[_]|l[_-1]<<8|l[_-2]<<16,this.words[g]|=f<<v&67108863,this.words[g+1]=f>>>26-v&67108863,v+=24,v>=26&&(v-=26,g++);else if(b==="le")for(_=0,g=0;_<l.length;_+=3)f=l[_]|l[_+1]<<8|l[_+2]<<16,this.words[g]|=f<<v&67108863,this.words[g+1]=f>>>26-v&67108863,v+=24,v>=26&&(v-=26,g++);return this._strip()};function s(y,l){var h=y.charCodeAt(l);if(h>=48&&h<=57)return h-48;if(h>=65&&h<=70)return h-55;if(h>=97&&h<=102)return h-87;r(!1,"Invalid character in "+y)}function a(y,l,h){var b=s(y,h);return h-1>=l&&(b|=s(y,h-1)<<4),b}i.prototype._parseHex=function(l,h,b){this.length=Math.ceil((l.length-h)/6),this.words=new Array(this.length);for(var _=0;_<this.length;_++)this.words[_]=0;var g=0,f=0,v;if(b==="be")for(_=l.length-1;_>=h;_-=2)v=a(l,h,_)<<g,this.words[f]|=v&67108863,g>=18?(g-=18,f+=1,this.words[f]|=v>>>26):g+=8;else{var O=l.length-h;for(_=O%2===0?h+1:h;_<l.length;_+=2)v=a(l,h,_)<<g,this.words[f]|=v&67108863,g>=18?(g-=18,f+=1,this.words[f]|=v>>>26):g+=8}this._strip()};function d(y,l,h,b){for(var _=0,g=0,f=Math.min(y.length,h),v=l;v<f;v++){var O=y.charCodeAt(v)-48;_*=b,O>=49?g=O-49+10:O>=17?g=O-17+10:g=O,r(O>=0&&g<b,"Invalid character"),_+=g}return _}i.prototype._parseBase=function(l,h,b){this.words=[0],this.length=1;for(var _=0,g=1;g<=67108863;g*=h)_++;_--,g=g/h|0;for(var f=l.length-b,v=f%_,O=Math.min(f,f-v)+b,T=0,R=b;R<O;R+=_)T=d(l,R,R+_,h),this.imuln(g),this.words[0]+T<67108864?this.words[0]+=T:this._iaddn(T);if(v!==0){var z=1;for(T=d(l,R,l.length,h),R=0;R<v;R++)z*=h;this.imuln(z),this.words[0]+T<67108864?this.words[0]+=T:this._iaddn(T)}this._strip()},i.prototype.copy=function(l){l.words=new Array(this.length);for(var h=0;h<this.length;h++)l.words[h]=this.words[h];l.length=this.length,l.negative=this.negative,l.red=this.red};function m(y,l){y.words=l.words,y.length=l.length,y.negative=l.negative,y.red=l.red}if(i.prototype._move=function(l){m(l,this)},i.prototype.clone=function(){var l=new i(null);return this.copy(l),l},i.prototype._expand=function(l){for(;this.length<l;)this.words[this.length++]=0;return this},i.prototype._strip=function(){for(;this.length>1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},i.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{i.prototype[Symbol.for("nodejs.util.inspect.custom")]=p}catch{i.prototype.inspect=p}else i.prototype.inspect=p;function p(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var w=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],P=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],S=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];i.prototype.toString=function(l,h){l=l||10,h=h|0||1;var b;if(l===16||l==="hex"){b="";for(var _=0,g=0,f=0;f<this.length;f++){var v=this.words[f],O=((v<<_|g)&16777215).toString(16);g=v>>>24-_&16777215,_+=2,_>=26&&(_-=26,f--),g!==0||f!==this.length-1?b=w[6-O.length]+O+b:b=O+b}for(g!==0&&(b=g.toString(16)+b);b.length%h!==0;)b="0"+b;return this.negative!==0&&(b="-"+b),b}if(l===(l|0)&&l>=2&&l<=36){var T=P[l],R=S[l];b="";var z=this.clone();for(z.negative=0;!z.isZero();){var V=z.modrn(R).toString(l);z=z.idivn(R),z.isZero()?b=V+b:b=w[T-V.length]+V+b}for(this.isZero()&&(b="0"+b);b.length%h!==0;)b="0"+b;return this.negative!==0&&(b="-"+b),b}r(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var l=this.words[0];return this.length===2?l+=this.words[1]*67108864:this.length===3&&this.words[2]===1?l+=4503599627370496+this.words[1]*67108864:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-l:l},i.prototype.toJSON=function(){return this.toString(16,2)},o&&(i.prototype.toBuffer=function(l,h){return this.toArrayLike(o,l,h)}),i.prototype.toArray=function(l,h){return this.toArrayLike(Array,l,h)};var M=function(l,h){return l.allocUnsafe?l.allocUnsafe(h):new l(h)};i.prototype.toArrayLike=function(l,h,b){this._strip();var _=this.byteLength(),g=b||Math.max(1,_);r(_<=g,"byte array longer than desired length"),r(g>0,"Requested array length <= 0");var f=M(l,g),v=h==="le"?"LE":"BE";return this["_toArrayLike"+v](f,_),f},i.prototype._toArrayLikeLE=function(l,h){for(var b=0,_=0,g=0,f=0;g<this.length;g++){var v=this.words[g]<<f|_;l[b++]=v&255,b<l.length&&(l[b++]=v>>8&255),b<l.length&&(l[b++]=v>>16&255),f===6?(b<l.length&&(l[b++]=v>>24&255),_=0,f=0):(_=v>>>24,f+=2)}if(b<l.length)for(l[b++]=_;b<l.length;)l[b++]=0},i.prototype._toArrayLikeBE=function(l,h){for(var b=l.length-1,_=0,g=0,f=0;g<this.length;g++){var v=this.words[g]<<f|_;l[b--]=v&255,b>=0&&(l[b--]=v>>8&255),b>=0&&(l[b--]=v>>16&255),f===6?(b>=0&&(l[b--]=v>>24&255),_=0,f=0):(_=v>>>24,f+=2)}if(b>=0)for(l[b--]=_;b>=0;)l[b--]=0},Math.clz32?i.prototype._countBits=function(l){return 32-Math.clz32(l)}:i.prototype._countBits=function(l){var h=l,b=0;return h>=4096&&(b+=13,h>>>=13),h>=64&&(b+=7,h>>>=7),h>=8&&(b+=4,h>>>=4),h>=2&&(b+=2,h>>>=2),b+h},i.prototype._zeroBits=function(l){if(l===0)return 26;var h=l,b=0;return h&8191||(b+=13,h>>>=13),h&127||(b+=7,h>>>=7),h&15||(b+=4,h>>>=4),h&3||(b+=2,h>>>=2),h&1||b++,b},i.prototype.bitLength=function(){var l=this.words[this.length-1],h=this._countBits(l);return(this.length-1)*26+h};function A(y){for(var l=new Array(y.bitLength()),h=0;h<l.length;h++){var b=h/26|0,_=h%26;l[h]=y.words[b]>>>_&1}return l}i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var l=0,h=0;h<this.length;h++){var b=this._zeroBits(this.words[h]);if(l+=b,b!==26)break}return l},i.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},i.prototype.toTwos=function(l){return this.negative!==0?this.abs().inotn(l).iaddn(1):this.clone()},i.prototype.fromTwos=function(l){return this.testn(l-1)?this.notn(l).iaddn(1).ineg():this.clone()},i.prototype.isNeg=function(){return this.negative!==0},i.prototype.neg=function(){return this.clone().ineg()},i.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},i.prototype.iuor=function(l){for(;this.length<l.length;)this.words[this.length++]=0;for(var h=0;h<l.length;h++)this.words[h]=this.words[h]|l.words[h];return this._strip()},i.prototype.ior=function(l){return r((this.negative|l.negative)===0),this.iuor(l)},i.prototype.or=function(l){return this.length>l.length?this.clone().ior(l):l.clone().ior(this)},i.prototype.uor=function(l){return this.length>l.length?this.clone().iuor(l):l.clone().iuor(this)},i.prototype.iuand=function(l){var h;this.length>l.length?h=l:h=this;for(var b=0;b<h.length;b++)this.words[b]=this.words[b]&l.words[b];return this.length=h.length,this._strip()},i.prototype.iand=function(l){return r((this.negative|l.negative)===0),this.iuand(l)},i.prototype.and=function(l){return this.length>l.length?this.clone().iand(l):l.clone().iand(this)},i.prototype.uand=function(l){return this.length>l.length?this.clone().iuand(l):l.clone().iuand(this)},i.prototype.iuxor=function(l){var h,b;this.length>l.length?(h=this,b=l):(h=l,b=this);for(var _=0;_<b.length;_++)this.words[_]=h.words[_]^b.words[_];if(this!==h)for(;_<h.length;_++)this.words[_]=h.words[_];return this.length=h.length,this._strip()},i.prototype.ixor=function(l){return r((this.negative|l.negative)===0),this.iuxor(l)},i.prototype.xor=function(l){return this.length>l.length?this.clone().ixor(l):l.clone().ixor(this)},i.prototype.uxor=function(l){return this.length>l.length?this.clone().iuxor(l):l.clone().iuxor(this)},i.prototype.inotn=function(l){r(typeof l=="number"&&l>=0);var h=Math.ceil(l/26)|0,b=l%26;this._expand(h),b>0&&h--;for(var _=0;_<h;_++)this.words[_]=~this.words[_]&67108863;return b>0&&(this.words[_]=~this.words[_]&67108863>>26-b),this._strip()},i.prototype.notn=function(l){return this.clone().inotn(l)},i.prototype.setn=function(l,h){r(typeof l=="number"&&l>=0);var b=l/26|0,_=l%26;return this._expand(b+1),h?this.words[b]=this.words[b]|1<<_:this.words[b]=this.words[b]&~(1<<_),this._strip()},i.prototype.iadd=function(l){var h;if(this.negative!==0&&l.negative===0)return this.negative=0,h=this.isub(l),this.negative^=1,this._normSign();if(this.negative===0&&l.negative!==0)return l.negative=0,h=this.isub(l),l.negative=1,h._normSign();var b,_;this.length>l.length?(b=this,_=l):(b=l,_=this);for(var g=0,f=0;f<_.length;f++)h=(b.words[f]|0)+(_.words[f]|0)+g,this.words[f]=h&67108863,g=h>>>26;for(;g!==0&&f<b.length;f++)h=(b.words[f]|0)+g,this.words[f]=h&67108863,g=h>>>26;if(this.length=b.length,g!==0)this.words[this.length]=g,this.length++;else if(b!==this)for(;f<b.length;f++)this.words[f]=b.words[f];return this},i.prototype.add=function(l){var h;return l.negative!==0&&this.negative===0?(l.negative=0,h=this.sub(l),l.negative^=1,h):l.negative===0&&this.negative!==0?(this.negative=0,h=l.sub(this),this.negative=1,h):this.length>l.length?this.clone().iadd(l):l.clone().iadd(this)},i.prototype.isub=function(l){if(l.negative!==0){l.negative=0;var h=this.iadd(l);return l.negative=1,h._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(l),this.negative=1,this._normSign();var b=this.cmp(l);if(b===0)return this.negative=0,this.length=1,this.words[0]=0,this;var _,g;b>0?(_=this,g=l):(_=l,g=this);for(var f=0,v=0;v<g.length;v++)h=(_.words[v]|0)-(g.words[v]|0)+f,f=h>>26,this.words[v]=h&67108863;for(;f!==0&&v<_.length;v++)h=(_.words[v]|0)+f,f=h>>26,this.words[v]=h&67108863;if(f===0&&v<_.length&&_!==this)for(;v<_.length;v++)this.words[v]=_.words[v];return this.length=Math.max(this.length,v),_!==this&&(this.negative=1),this._strip()},i.prototype.sub=function(l){return this.clone().isub(l)};function B(y,l,h){h.negative=l.negative^y.negative;var b=y.length+l.length|0;h.length=b,b=b-1|0;var _=y.words[0]|0,g=l.words[0]|0,f=_*g,v=f&67108863,O=f/67108864|0;h.words[0]=v;for(var T=1;T<b;T++){for(var R=O>>>26,z=O&67108863,V=Math.min(T,l.length-1),W=Math.max(0,T-y.length+1);W<=V;W++){var Z=T-W|0;_=y.words[Z]|0,g=l.words[W]|0,f=_*g+z,R+=f/67108864|0,z=f&67108863}h.words[T]=z|0,O=R|0}return O!==0?h.words[T]=O|0:h.length--,h._strip()}var I=function(l,h,b){var _=l.words,g=h.words,f=b.words,v=0,O,T,R,z=_[0]|0,V=z&8191,W=z>>>13,Z=_[1]|0,J=Z&8191,X=Z>>>13,Ee=_[2]|0,re=Ee&8191,ne=Ee>>>13,qe=_[3]|0,ce=qe&8191,ye=qe>>>13,Ne=_[4]|0,ie=Ne&8191,oe=Ne>>>13,ze=_[5]|0,le=ze&8191,me=ze>>>13,ot=_[6]|0,ue=ot&8191,he=ot>>>13,lt=_[7]|0,se=lt&8191,fe=lt>>>13,Lt=_[8]|0,ge=Lt&8191,ve=Lt>>>13,on=_[9]|0,xe=on&8191,Pe=on>>>13,jr=g[0]|0,Se=jr&8191,_e=jr>>>13,Mn=g[1]|0,Me=Mn&8191,Te=Mn>>>13,vi=g[2]|0,Ae=vi&8191,Be=vi>>>13,Pn=g[3]|0,De=Pn&8191,Ie=Pn>>>13,bi=g[4]|0,Re=bi&8191,ke=bi>>>13,wi=g[5]|0,Oe=wi&8191,Ce=wi>>>13,oi=g[6]|0,Q=oi&8191,Y=oi>>>13,ae=g[7]|0,ee=ae&8191,te=ae>>>13,Ke=g[8]|0,de=Ke&8191,pe=Ke>>>13,bt=g[9]|0,st=bt&8191,Ve=bt>>>13;b.negative=l.negative^h.negative,b.length=19,O=Math.imul(V,Se),T=Math.imul(V,_e),T=T+Math.imul(W,Se)|0,R=Math.imul(W,_e);var Tt=(v+O|0)+((T&8191)<<13)|0;v=(R+(T>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,O=Math.imul(J,Se),T=Math.imul(J,_e),T=T+Math.imul(X,Se)|0,R=Math.imul(X,_e),O=O+Math.imul(V,Me)|0,T=T+Math.imul(V,Te)|0,T=T+Math.imul(W,Me)|0,R=R+Math.imul(W,Te)|0;var Ut=(v+O|0)+((T&8191)<<13)|0;v=(R+(T>>>13)|0)+(Ut>>>26)|0,Ut&=67108863,O=Math.imul(re,Se),T=Math.imul(re,_e),T=T+Math.imul(ne,Se)|0,R=Math.imul(ne,_e),O=O+Math.imul(J,Me)|0,T=T+Math.imul(J,Te)|0,T=T+Math.imul(X,Me)|0,R=R+Math.imul(X,Te)|0,O=O+Math.imul(V,Ae)|0,T=T+Math.imul(V,Be)|0,T=T+Math.imul(W,Ae)|0,R=R+Math.imul(W,Be)|0;var Pt=(v+O|0)+((T&8191)<<13)|0;v=(R+(T>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,O=Math.imul(ce,Se),T=Math.imul(ce,_e),T=T+Math.imul(ye,Se)|0,R=Math.imul(ye,_e),O=O+Math.imul(re,Me)|0,T=T+Math.imul(re,Te)|0,T=T+Math.imul(ne,Me)|0,R=R+Math.imul(ne,Te)|0,O=O+Math.imul(J,Ae)|0,T=T+Math.imul(J,Be)|0,T=T+Math.imul(X,Ae)|0,R=R+Math.imul(X,Be)|0,O=O+Math.imul(V,De)|0,T=T+Math.imul(V,Ie)|0,T=T+Math.imul(W,De)|0,R=R+Math.imul(W,Ie)|0;var yt=(v+O|0)+((T&8191)<<13)|0;v=(R+(T>>>13)|0)+(yt>>>26)|0,yt&=67108863,O=Math.imul(ie,Se),T=Math.imul(ie,_e),T=T+Math.imul(oe,Se)|0,R=Math.imul(oe,_e),O=O+Math.imul(ce,Me)|0,T=T+Math.imul(ce,Te)|0,T=T+Math.imul(ye,Me)|0,R=R+Math.imul(ye,Te)|0,O=O+Math.imul(re,Ae)|0,T=T+Math.imul(re,Be)|0,T=T+Math.imul(ne,Ae)|0,R=R+Math.imul(ne,Be)|0,O=O+Math.imul(J,De)|0,T=T+Math.imul(J,Ie)|0,T=T+Math.imul(X,De)|0,R=R+Math.imul(X,Ie)|0,O=O+Math.imul(V,Re)|0,T=T+Math.imul(V,ke)|0,T=T+Math.imul(W,Re)|0,R=R+Math.imul(W,ke)|0;var Rt=(v+O|0)+((T&8191)<<13)|0;v=(R+(T>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,O=Math.imul(le,Se),T=Math.imul(le,_e),T=T+Math.imul(me,Se)|0,R=Math.imul(me,_e),O=O+Math.imul(ie,Me)|0,T=T+Math.imul(ie,Te)|0,T=T+Math.imul(oe,Me)|0,R=R+Math.imul(oe,Te)|0,O=O+Math.imul(ce,Ae)|0,T=T+Math.imul(ce,Be)|0,T=T+Math.imul(ye,Ae)|0,R=R+Math.imul(ye,Be)|0,O=O+Math.imul(re,De)|0,T=T+Math.imul(re,Ie)|0,T=T+Math.imul(ne,De)|0,R=R+Math.imul(ne,Ie)|0,O=O+Math.imul(J,Re)|0,T=T+Math.imul(J,ke)|0,T=T+Math.imul(X,Re)|0,R=R+Math.imul(X,ke)|0,O=O+Math.imul(V,Oe)|0,T=T+Math.imul(V,Ce)|0,T=T+Math.imul(W,Oe)|0,R=R+Math.imul(W,Ce)|0;var _t=(v+O|0)+((T&8191)<<13)|0;v=(R+(T>>>13)|0)+(_t>>>26)|0,_t&=67108863,O=Math.imul(ue,Se),T=Math.imul(ue,_e),T=T+Math.imul(he,Se)|0,R=Math.imul(he,_e),O=O+Math.imul(le,Me)|0,T=T+Math.imul(le,Te)|0,T=T+Math.imul(me,Me)|0,R=R+Math.imul(me,Te)|0,O=O+Math.imul(ie,Ae)|0,T=T+Math.imul(ie,Be)|0,T=T+Math.imul(oe,Ae)|0,R=R+Math.imul(oe,Be)|0,O=O+Math.imul(ce,De)|0,T=T+Math.imul(ce,Ie)|0,T=T+Math.imul(ye,De)|0,R=R+Math.imul(ye,Ie)|0,O=O+Math.imul(re,Re)|0,T=T+Math.imul(re,ke)|0,T=T+Math.imul(ne,Re)|0,R=R+Math.imul(ne,ke)|0,O=O+Math.imul(J,Oe)|0,T=T+Math.imul(J,Ce)|0,T=T+Math.imul(X,Oe)|0,R=R+Math.imul(X,Ce)|0,O=O+Math.imul(V,Q)|0,T=T+Math.imul(V,Y)|0,T=T+Math.imul(W,Q)|0,R=R+Math.imul(W,Y)|0;var Lr=(v+O|0)+((T&8191)<<13)|0;v=(R+(T>>>13)|0)+(Lr>>>26)|0,Lr&=67108863,O=Math.imul(se,Se),T=Math.imul(se,_e),T=T+Math.imul(fe,Se)|0,R=Math.imul(fe,_e),O=O+Math.imul(ue,Me)|0,T=T+Math.imul(ue,Te)|0,T=T+Math.imul(he,Me)|0,R=R+Math.imul(he,Te)|0,O=O+Math.imul(le,Ae)|0,T=T+Math.imul(le,Be)|0,T=T+Math.imul(me,Ae)|0,R=R+Math.imul(me,Be)|0,O=O+Math.imul(ie,De)|0,T=T+Math.imul(ie,Ie)|0,T=T+Math.imul(oe,De)|0,R=R+Math.imul(oe,Ie)|0,O=O+Math.imul(ce,Re)|0,T=T+Math.imul(ce,ke)|0,T=T+Math.imul(ye,Re)|0,R=R+Math.imul(ye,ke)|0,O=O+Math.imul(re,Oe)|0,T=T+Math.imul(re,Ce)|0,T=T+Math.imul(ne,Oe)|0,R=R+Math.imul(ne,Ce)|0,O=O+Math.imul(J,Q)|0,T=T+Math.imul(J,Y)|0,T=T+Math.imul(X,Q)|0,R=R+Math.imul(X,Y)|0,O=O+Math.imul(V,ee)|0,T=T+Math.imul(V,te)|0,T=T+Math.imul(W,ee)|0,R=R+Math.imul(W,te)|0;var nr=(v+O|0)+((T&8191)<<13)|0;v=(R+(T>>>13)|0)+(nr>>>26)|0,nr&=67108863,O=Math.imul(ge,Se),T=Math.imul(ge,_e),T=T+Math.imul(ve,Se)|0,R=Math.imul(ve,_e),O=O+Math.imul(se,Me)|0,T=T+Math.imul(se,Te)|0,T=T+Math.imul(fe,Me)|0,R=R+Math.imul(fe,Te)|0,O=O+Math.imul(ue,Ae)|0,T=T+Math.imul(ue,Be)|0,T=T+Math.imul(he,Ae)|0,R=R+Math.imul(he,Be)|0,O=O+Math.imul(le,De)|0,T=T+Math.imul(le,Ie)|0,T=T+Math.imul(me,De)|0,R=R+Math.imul(me,Ie)|0,O=O+Math.imul(ie,Re)|0,T=T+Math.imul(ie,ke)|0,T=T+Math.imul(oe,Re)|0,R=R+Math.imul(oe,ke)|0,O=O+Math.imul(ce,Oe)|0,T=T+Math.imul(ce,Ce)|0,T=T+Math.imul(ye,Oe)|0,R=R+Math.imul(ye,Ce)|0,O=O+Math.imul(re,Q)|0,T=T+Math.imul(re,Y)|0,T=T+Math.imul(ne,Q)|0,R=R+Math.imul(ne,Y)|0,O=O+Math.imul(J,ee)|0,T=T+Math.imul(J,te)|0,T=T+Math.imul(X,ee)|0,R=R+Math.imul(X,te)|0,O=O+Math.imul(V,de)|0,T=T+Math.imul(V,pe)|0,T=T+Math.imul(W,de)|0,R=R+Math.imul(W,pe)|0;var lr=(v+O|0)+((T&8191)<<13)|0;v=(R+(T>>>13)|0)+(lr>>>26)|0,lr&=67108863,O=Math.imul(xe,Se),T=Math.imul(xe,_e),T=T+Math.imul(Pe,Se)|0,R=Math.imul(Pe,_e),O=O+Math.imul(ge,Me)|0,T=T+Math.imul(ge,Te)|0,T=T+Math.imul(ve,Me)|0,R=R+Math.imul(ve,Te)|0,O=O+Math.imul(se,Ae)|0,T=T+Math.imul(se,Be)|0,T=T+Math.imul(fe,Ae)|0,R=R+Math.imul(fe,Be)|0,O=O+Math.imul(ue,De)|0,T=T+Math.imul(ue,Ie)|0,T=T+Math.imul(he,De)|0,R=R+Math.imul(he,Ie)|0,O=O+Math.imul(le,Re)|0,T=T+Math.imul(le,ke)|0,T=T+Math.imul(me,Re)|0,R=R+Math.imul(me,ke)|0,O=O+Math.imul(ie,Oe)|0,T=T+Math.imul(ie,Ce)|0,T=T+Math.imul(oe,Oe)|0,R=R+Math.imul(oe,Ce)|0,O=O+Math.imul(ce,Q)|0,T=T+Math.imul(ce,Y)|0,T=T+Math.imul(ye,Q)|0,R=R+Math.imul(ye,Y)|0,O=O+Math.imul(re,ee)|0,T=T+Math.imul(re,te)|0,T=T+Math.imul(ne,ee)|0,R=R+Math.imul(ne,te)|0,O=O+Math.imul(J,de)|0,T=T+Math.imul(J,pe)|0,T=T+Math.imul(X,de)|0,R=R+Math.imul(X,pe)|0,O=O+Math.imul(V,st)|0,T=T+Math.imul(V,Ve)|0,T=T+Math.imul(W,st)|0,R=R+Math.imul(W,Ve)|0;var xt=(v+O|0)+((T&8191)<<13)|0;v=(R+(T>>>13)|0)+(xt>>>26)|0,xt&=67108863,O=Math.imul(xe,Me),T=Math.imul(xe,Te),T=T+Math.imul(Pe,Me)|0,R=Math.imul(Pe,Te),O=O+Math.imul(ge,Ae)|0,T=T+Math.imul(ge,Be)|0,T=T+Math.imul(ve,Ae)|0,R=R+Math.imul(ve,Be)|0,O=O+Math.imul(se,De)|0,T=T+Math.imul(se,Ie)|0,T=T+Math.imul(fe,De)|0,R=R+Math.imul(fe,Ie)|0,O=O+Math.imul(ue,Re)|0,T=T+Math.imul(ue,ke)|0,T=T+Math.imul(he,Re)|0,R=R+Math.imul(he,ke)|0,O=O+Math.imul(le,Oe)|0,T=T+Math.imul(le,Ce)|0,T=T+Math.imul(me,Oe)|0,R=R+Math.imul(me,Ce)|0,O=O+Math.imul(ie,Q)|0,T=T+Math.imul(ie,Y)|0,T=T+Math.imul(oe,Q)|0,R=R+Math.imul(oe,Y)|0,O=O+Math.imul(ce,ee)|0,T=T+Math.imul(ce,te)|0,T=T+Math.imul(ye,ee)|0,R=R+Math.imul(ye,te)|0,O=O+Math.imul(re,de)|0,T=T+Math.imul(re,pe)|0,T=T+Math.imul(ne,de)|0,R=R+Math.imul(ne,pe)|0,O=O+Math.imul(J,st)|0,T=T+Math.imul(J,Ve)|0,T=T+Math.imul(X,st)|0,R=R+Math.imul(X,Ve)|0;var ir=(v+O|0)+((T&8191)<<13)|0;v=(R+(T>>>13)|0)+(ir>>>26)|0,ir&=67108863,O=Math.imul(xe,Ae),T=Math.imul(xe,Be),T=T+Math.imul(Pe,Ae)|0,R=Math.imul(Pe,Be),O=O+Math.imul(ge,De)|0,T=T+Math.imul(ge,Ie)|0,T=T+Math.imul(ve,De)|0,R=R+Math.imul(ve,Ie)|0,O=O+Math.imul(se,Re)|0,T=T+Math.imul(se,ke)|0,T=T+Math.imul(fe,Re)|0,R=R+Math.imul(fe,ke)|0,O=O+Math.imul(ue,Oe)|0,T=T+Math.imul(ue,Ce)|0,T=T+Math.imul(he,Oe)|0,R=R+Math.imul(he,Ce)|0,O=O+Math.imul(le,Q)|0,T=T+Math.imul(le,Y)|0,T=T+Math.imul(me,Q)|0,R=R+Math.imul(me,Y)|0,O=O+Math.imul(ie,ee)|0,T=T+Math.imul(ie,te)|0,T=T+Math.imul(oe,ee)|0,R=R+Math.imul(oe,te)|0,O=O+Math.imul(ce,de)|0,T=T+Math.imul(ce,pe)|0,T=T+Math.imul(ye,de)|0,R=R+Math.imul(ye,pe)|0,O=O+Math.imul(re,st)|0,T=T+Math.imul(re,Ve)|0,T=T+Math.imul(ne,st)|0,R=R+Math.imul(ne,Ve)|0;var dr=(v+O|0)+((T&8191)<<13)|0;v=(R+(T>>>13)|0)+(dr>>>26)|0,dr&=67108863,O=Math.imul(xe,De),T=Math.imul(xe,Ie),T=T+Math.imul(Pe,De)|0,R=Math.imul(Pe,Ie),O=O+Math.imul(ge,Re)|0,T=T+Math.imul(ge,ke)|0,T=T+Math.imul(ve,Re)|0,R=R+Math.imul(ve,ke)|0,O=O+Math.imul(se,Oe)|0,T=T+Math.imul(se,Ce)|0,T=T+Math.imul(fe,Oe)|0,R=R+Math.imul(fe,Ce)|0,O=O+Math.imul(ue,Q)|0,T=T+Math.imul(ue,Y)|0,T=T+Math.imul(he,Q)|0,R=R+Math.imul(he,Y)|0,O=O+Math.imul(le,ee)|0,T=T+Math.imul(le,te)|0,T=T+Math.imul(me,ee)|0,R=R+Math.imul(me,te)|0,O=O+Math.imul(ie,de)|0,T=T+Math.imul(ie,pe)|0,T=T+Math.imul(oe,de)|0,R=R+Math.imul(oe,pe)|0,O=O+Math.imul(ce,st)|0,T=T+Math.imul(ce,Ve)|0,T=T+Math.imul(ye,st)|0,R=R+Math.imul(ye,Ve)|0;var Er=(v+O|0)+((T&8191)<<13)|0;v=(R+(T>>>13)|0)+(Er>>>26)|0,Er&=67108863,O=Math.imul(xe,Re),T=Math.imul(xe,ke),T=T+Math.imul(Pe,Re)|0,R=Math.imul(Pe,ke),O=O+Math.imul(ge,Oe)|0,T=T+Math.imul(ge,Ce)|0,T=T+Math.imul(ve,Oe)|0,R=R+Math.imul(ve,Ce)|0,O=O+Math.imul(se,Q)|0,T=T+Math.imul(se,Y)|0,T=T+Math.imul(fe,Q)|0,R=R+Math.imul(fe,Y)|0,O=O+Math.imul(ue,ee)|0,T=T+Math.imul(ue,te)|0,T=T+Math.imul(he,ee)|0,R=R+Math.imul(he,te)|0,O=O+Math.imul(le,de)|0,T=T+Math.imul(le,pe)|0,T=T+Math.imul(me,de)|0,R=R+Math.imul(me,pe)|0,O=O+Math.imul(ie,st)|0,T=T+Math.imul(ie,Ve)|0,T=T+Math.imul(oe,st)|0,R=R+Math.imul(oe,Ve)|0;var Ur=(v+O|0)+((T&8191)<<13)|0;v=(R+(T>>>13)|0)+(Ur>>>26)|0,Ur&=67108863,O=Math.imul(xe,Oe),T=Math.imul(xe,Ce),T=T+Math.imul(Pe,Oe)|0,R=Math.imul(Pe,Ce),O=O+Math.imul(ge,Q)|0,T=T+Math.imul(ge,Y)|0,T=T+Math.imul(ve,Q)|0,R=R+Math.imul(ve,Y)|0,O=O+Math.imul(se,ee)|0,T=T+Math.imul(se,te)|0,T=T+Math.imul(fe,ee)|0,R=R+Math.imul(fe,te)|0,O=O+Math.imul(ue,de)|0,T=T+Math.imul(ue,pe)|0,T=T+Math.imul(he,de)|0,R=R+Math.imul(he,pe)|0,O=O+Math.imul(le,st)|0,T=T+Math.imul(le,Ve)|0,T=T+Math.imul(me,st)|0,R=R+Math.imul(me,Ve)|0;var Rr=(v+O|0)+((T&8191)<<13)|0;v=(R+(T>>>13)|0)+(Rr>>>26)|0,Rr&=67108863,O=Math.imul(xe,Q),T=Math.imul(xe,Y),T=T+Math.imul(Pe,Q)|0,R=Math.imul(Pe,Y),O=O+Math.imul(ge,ee)|0,T=T+Math.imul(ge,te)|0,T=T+Math.imul(ve,ee)|0,R=R+Math.imul(ve,te)|0,O=O+Math.imul(se,de)|0,T=T+Math.imul(se,pe)|0,T=T+Math.imul(fe,de)|0,R=R+Math.imul(fe,pe)|0,O=O+Math.imul(ue,st)|0,T=T+Math.imul(ue,Ve)|0,T=T+Math.imul(he,st)|0,R=R+Math.imul(he,Ve)|0;var Hr=(v+O|0)+((T&8191)<<13)|0;v=(R+(T>>>13)|0)+(Hr>>>26)|0,Hr&=67108863,O=Math.imul(xe,ee),T=Math.imul(xe,te),T=T+Math.imul(Pe,ee)|0,R=Math.imul(Pe,te),O=O+Math.imul(ge,de)|0,T=T+Math.imul(ge,pe)|0,T=T+Math.imul(ve,de)|0,R=R+Math.imul(ve,pe)|0,O=O+Math.imul(se,st)|0,T=T+Math.imul(se,Ve)|0,T=T+Math.imul(fe,st)|0,R=R+Math.imul(fe,Ve)|0;var Ih=(v+O|0)+((T&8191)<<13)|0;v=(R+(T>>>13)|0)+(Ih>>>26)|0,Ih&=67108863,O=Math.imul(xe,de),T=Math.imul(xe,pe),T=T+Math.imul(Pe,de)|0,R=Math.imul(Pe,pe),O=O+Math.imul(ge,st)|0,T=T+Math.imul(ge,Ve)|0,T=T+Math.imul(ve,st)|0,R=R+Math.imul(ve,Ve)|0;var kh=(v+O|0)+((T&8191)<<13)|0;v=(R+(T>>>13)|0)+(kh>>>26)|0,kh&=67108863,O=Math.imul(xe,st),T=Math.imul(xe,Ve),T=T+Math.imul(Pe,st)|0,R=Math.imul(Pe,Ve);var xu=(v+O|0)+((T&8191)<<13)|0;return v=(R+(T>>>13)|0)+(xu>>>26)|0,xu&=67108863,f[0]=Tt,f[1]=Ut,f[2]=Pt,f[3]=yt,f[4]=Rt,f[5]=_t,f[6]=Lr,f[7]=nr,f[8]=lr,f[9]=xt,f[10]=ir,f[11]=dr,f[12]=Er,f[13]=Ur,f[14]=Rr,f[15]=Hr,f[16]=Ih,f[17]=kh,f[18]=xu,v!==0&&(f[19]=v,b.length++),b};Math.imul||(I=B);function C(y,l,h){h.negative=l.negative^y.negative,h.length=y.length+l.length;for(var b=0,_=0,g=0;g<h.length-1;g++){var f=_;_=0;for(var v=b&67108863,O=Math.min(g,l.length-1),T=Math.max(0,g-y.length+1);T<=O;T++){var R=g-T,z=y.words[R]|0,V=l.words[T]|0,W=z*V,Z=W&67108863;f=f+(W/67108864|0)|0,Z=Z+v|0,v=Z&67108863,f=f+(Z>>>26)|0,_+=f>>>26,f&=67108863}h.words[g]=v,b=f,f=_}return b!==0?h.words[g]=b:h.length--,h._strip()}function k(y,l,h){return C(y,l,h)}i.prototype.mulTo=function(l,h){var b,_=this.length+l.length;return this.length===10&&l.length===10?b=I(this,l,h):_<63?b=B(this,l,h):_<1024?b=C(this,l,h):b=k(this,l,h),b};function q(y,l){this.x=y,this.y=l}q.prototype.makeRBT=function(l){for(var h=new Array(l),b=i.prototype._countBits(l)-1,_=0;_<l;_++)h[_]=this.revBin(_,b,l);return h},q.prototype.revBin=function(l,h,b){if(l===0||l===b-1)return l;for(var _=0,g=0;g<h;g++)_|=(l&1)<<h-g-1,l>>=1;return _},q.prototype.permute=function(l,h,b,_,g,f){for(var v=0;v<f;v++)_[v]=h[l[v]],g[v]=b[l[v]]},q.prototype.transform=function(l,h,b,_,g,f){this.permute(f,l,h,b,_,g);for(var v=1;v<g;v<<=1)for(var O=v<<1,T=Math.cos(2*Math.PI/O),R=Math.sin(2*Math.PI/O),z=0;z<g;z+=O)for(var V=T,W=R,Z=0;Z<v;Z++){var J=b[z+Z],X=_[z+Z],Ee=b[z+Z+v],re=_[z+Z+v],ne=V*Ee-W*re;re=V*re+W*Ee,Ee=ne,b[z+Z]=J+Ee,_[z+Z]=X+re,b[z+Z+v]=J-Ee,_[z+Z+v]=X-re,Z!==O&&(ne=T*V-R*W,W=T*W+R*V,V=ne)}},q.prototype.guessLen13b=function(l,h){var b=Math.max(h,l)|1,_=b&1,g=0;for(b=b/2|0;b;b=b>>>1)g++;return 1<<g+1+_},q.prototype.conjugate=function(l,h,b){if(!(b<=1))for(var _=0;_<b/2;_++){var g=l[_];l[_]=l[b-_-1],l[b-_-1]=g,g=h[_],h[_]=-h[b-_-1],h[b-_-1]=-g}},q.prototype.normalize13b=function(l,h){for(var b=0,_=0;_<h/2;_++){var g=Math.round(l[2*_+1]/h)*8192+Math.round(l[2*_]/h)+b;l[_]=g&67108863,g<67108864?b=0:b=g/67108864|0}return l},q.prototype.convert13b=function(l,h,b,_){for(var g=0,f=0;f<h;f++)g=g+(l[f]|0),b[2*f]=g&8191,g=g>>>13,b[2*f+1]=g&8191,g=g>>>13;for(f=2*h;f<_;++f)b[f]=0;r(g===0),r((g&-8192)===0)},q.prototype.stub=function(l){for(var h=new Array(l),b=0;b<l;b++)h[b]=0;return h},q.prototype.mulp=function(l,h,b){var _=2*this.guessLen13b(l.length,h.length),g=this.makeRBT(_),f=this.stub(_),v=new Array(_),O=new Array(_),T=new Array(_),R=new Array(_),z=new Array(_),V=new Array(_),W=b.words;W.length=_,this.convert13b(l.words,l.length,v,_),this.convert13b(h.words,h.length,R,_),this.transform(v,f,O,T,_,g),this.transform(R,f,z,V,_,g);for(var Z=0;Z<_;Z++){var J=O[Z]*z[Z]-T[Z]*V[Z];T[Z]=O[Z]*V[Z]+T[Z]*z[Z],O[Z]=J}return this.conjugate(O,T,_),this.transform(O,T,W,f,_,g),this.conjugate(W,f,_),this.normalize13b(W,_),b.negative=l.negative^h.negative,b.length=l.length+h.length,b._strip()},i.prototype.mul=function(l){var h=new i(null);return h.words=new Array(this.length+l.length),this.mulTo(l,h)},i.prototype.mulf=function(l){var h=new i(null);return h.words=new Array(this.length+l.length),k(this,l,h)},i.prototype.imul=function(l){return this.clone().mulTo(l,this)},i.prototype.imuln=function(l){var h=l<0;h&&(l=-l),r(typeof l=="number"),r(l<67108864);for(var b=0,_=0;_<this.length;_++){var g=(this.words[_]|0)*l,f=(g&67108863)+(b&67108863);b>>=26,b+=g/67108864|0,b+=f>>>26,this.words[_]=f&67108863}return b!==0&&(this.words[_]=b,this.length++),h?this.ineg():this},i.prototype.muln=function(l){return this.clone().imuln(l)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(l){var h=A(l);if(h.length===0)return new i(1);for(var b=this,_=0;_<h.length&&h[_]===0;_++,b=b.sqr());if(++_<h.length)for(var g=b.sqr();_<h.length;_++,g=g.sqr())h[_]!==0&&(b=b.mul(g));return b},i.prototype.iushln=function(l){r(typeof l=="number"&&l>=0);var h=l%26,b=(l-h)/26,_=67108863>>>26-h<<26-h,g;if(h!==0){var f=0;for(g=0;g<this.length;g++){var v=this.words[g]&_,O=(this.words[g]|0)-v<<h;this.words[g]=O|f,f=v>>>26-h}f&&(this.words[g]=f,this.length++)}if(b!==0){for(g=this.length-1;g>=0;g--)this.words[g+b]=this.words[g];for(g=0;g<b;g++)this.words[g]=0;this.length+=b}return this._strip()},i.prototype.ishln=function(l){return r(this.negative===0),this.iushln(l)},i.prototype.iushrn=function(l,h,b){r(typeof l=="number"&&l>=0);var _;h?_=(h-h%26)/26:_=0;var g=l%26,f=Math.min((l-g)/26,this.length),v=67108863^67108863>>>g<<g,O=b;if(_-=f,_=Math.max(0,_),O){for(var T=0;T<f;T++)O.words[T]=this.words[T];O.length=f}if(f!==0)if(this.length>f)for(this.length-=f,T=0;T<this.length;T++)this.words[T]=this.words[T+f];else this.words[0]=0,this.length=1;var R=0;for(T=this.length-1;T>=0&&(R!==0||T>=_);T--){var z=this.words[T]|0;this.words[T]=R<<26-g|z>>>g,R=z&v}return O&&R!==0&&(O.words[O.length++]=R),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},i.prototype.ishrn=function(l,h,b){return r(this.negative===0),this.iushrn(l,h,b)},i.prototype.shln=function(l){return this.clone().ishln(l)},i.prototype.ushln=function(l){return this.clone().iushln(l)},i.prototype.shrn=function(l){return this.clone().ishrn(l)},i.prototype.ushrn=function(l){return this.clone().iushrn(l)},i.prototype.testn=function(l){r(typeof l=="number"&&l>=0);var h=l%26,b=(l-h)/26,_=1<<h;if(this.length<=b)return!1;var g=this.words[b];return!!(g&_)},i.prototype.imaskn=function(l){r(typeof l=="number"&&l>=0);var h=l%26,b=(l-h)/26;if(r(this.negative===0,"imaskn works only with positive numbers"),this.length<=b)return this;if(h!==0&&b++,this.length=Math.min(b,this.length),h!==0){var _=67108863^67108863>>>h<<h;this.words[this.length-1]&=_}return this._strip()},i.prototype.maskn=function(l){return this.clone().imaskn(l)},i.prototype.iaddn=function(l){return r(typeof l=="number"),r(l<67108864),l<0?this.isubn(-l):this.negative!==0?this.length===1&&(this.words[0]|0)<=l?(this.words[0]=l-(this.words[0]|0),this.negative=0,this):(this.negative=0,this.isubn(l),this.negative=1,this):this._iaddn(l)},i.prototype._iaddn=function(l){this.words[0]+=l;for(var h=0;h<this.length&&this.words[h]>=67108864;h++)this.words[h]-=67108864,h===this.length-1?this.words[h+1]=1:this.words[h+1]++;return this.length=Math.max(this.length,h+1),this},i.prototype.isubn=function(l){if(r(typeof l=="number"),r(l<67108864),l<0)return this.iaddn(-l);if(this.negative!==0)return this.negative=0,this.iaddn(l),this.negative=1,this;if(this.words[0]-=l,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var h=0;h<this.length&&this.words[h]<0;h++)this.words[h]+=67108864,this.words[h+1]-=1;return this._strip()},i.prototype.addn=function(l){return this.clone().iaddn(l)},i.prototype.subn=function(l){return this.clone().isubn(l)},i.prototype.iabs=function(){return this.negative=0,this},i.prototype.abs=function(){return this.clone().iabs()},i.prototype._ishlnsubmul=function(l,h,b){var _=l.length+b,g;this._expand(_);var f,v=0;for(g=0;g<l.length;g++){f=(this.words[g+b]|0)+v;var O=(l.words[g]|0)*h;f-=O&67108863,v=(f>>26)-(O/67108864|0),this.words[g+b]=f&67108863}for(;g<this.length-b;g++)f=(this.words[g+b]|0)+v,v=f>>26,this.words[g+b]=f&67108863;if(v===0)return this._strip();for(r(v===-1),v=0,g=0;g<this.length;g++)f=-(this.words[g]|0)+v,v=f>>26,this.words[g]=f&67108863;return this.negative=1,this._strip()},i.prototype._wordDiv=function(l,h){var b=this.length-l.length,_=this.clone(),g=l,f=g.words[g.length-1]|0,v=this._countBits(f);b=26-v,b!==0&&(g=g.ushln(b),_.iushln(b),f=g.words[g.length-1]|0);var O=_.length-g.length,T;if(h!=="mod"){T=new i(null),T.length=O+1,T.words=new Array(T.length);for(var R=0;R<T.length;R++)T.words[R]=0}var z=_.clone()._ishlnsubmul(g,1,O);z.negative===0&&(_=z,T&&(T.words[O]=1));for(var V=O-1;V>=0;V--){var W=(_.words[g.length+V]|0)*67108864+(_.words[g.length+V-1]|0);for(W=Math.min(W/f|0,67108863),_._ishlnsubmul(g,W,V);_.negative!==0;)W--,_.negative=0,_._ishlnsubmul(g,1,V),_.isZero()||(_.negative^=1);T&&(T.words[V]=W)}return T&&T._strip(),_._strip(),h!=="div"&&b!==0&&_.iushrn(b),{div:T||null,mod:_}},i.prototype.divmod=function(l,h,b){if(r(!l.isZero()),this.isZero())return{div:new i(0),mod:new i(0)};var _,g,f;return this.negative!==0&&l.negative===0?(f=this.neg().divmod(l,h),h!=="mod"&&(_=f.div.neg()),h!=="div"&&(g=f.mod.neg(),b&&g.negative!==0&&g.iadd(l)),{div:_,mod:g}):this.negative===0&&l.negative!==0?(f=this.divmod(l.neg(),h),h!=="mod"&&(_=f.div.neg()),{div:_,mod:f.mod}):this.negative&l.negative?(f=this.neg().divmod(l.neg(),h),h!=="div"&&(g=f.mod.neg(),b&&g.negative!==0&&g.isub(l)),{div:f.div,mod:g}):l.length>this.length||this.cmp(l)<0?{div:new i(0),mod:this}:l.length===1?h==="div"?{div:this.divn(l.words[0]),mod:null}:h==="mod"?{div:null,mod:new i(this.modrn(l.words[0]))}:{div:this.divn(l.words[0]),mod:new i(this.modrn(l.words[0]))}:this._wordDiv(l,h)},i.prototype.div=function(l){return this.divmod(l,"div",!1).div},i.prototype.mod=function(l){return this.divmod(l,"mod",!1).mod},i.prototype.umod=function(l){return this.divmod(l,"mod",!0).mod},i.prototype.divRound=function(l){var h=this.divmod(l);if(h.mod.isZero())return h.div;var b=h.div.negative!==0?h.mod.isub(l):h.mod,_=l.ushrn(1),g=l.andln(1),f=b.cmp(_);return f<0||g===1&&f===0?h.div:h.div.negative!==0?h.div.isubn(1):h.div.iaddn(1)},i.prototype.modrn=function(l){var h=l<0;h&&(l=-l),r(l<=67108863);for(var b=(1<<26)%l,_=0,g=this.length-1;g>=0;g--)_=(b*_+(this.words[g]|0))%l;return h?-_:_},i.prototype.modn=function(l){return this.modrn(l)},i.prototype.idivn=function(l){var h=l<0;h&&(l=-l),r(l<=67108863);for(var b=0,_=this.length-1;_>=0;_--){var g=(this.words[_]|0)+b*67108864;this.words[_]=g/l|0,b=g%l}return this._strip(),h?this.ineg():this},i.prototype.divn=function(l){return this.clone().idivn(l)},i.prototype.egcd=function(l){r(l.negative===0),r(!l.isZero());var h=this,b=l.clone();h.negative!==0?h=h.umod(l):h=h.clone();for(var _=new i(1),g=new i(0),f=new i(0),v=new i(1),O=0;h.isEven()&&b.isEven();)h.iushrn(1),b.iushrn(1),++O;for(var T=b.clone(),R=h.clone();!h.isZero();){for(var z=0,V=1;!(h.words[0]&V)&&z<26;++z,V<<=1);if(z>0)for(h.iushrn(z);z-- >0;)(_.isOdd()||g.isOdd())&&(_.iadd(T),g.isub(R)),_.iushrn(1),g.iushrn(1);for(var W=0,Z=1;!(b.words[0]&Z)&&W<26;++W,Z<<=1);if(W>0)for(b.iushrn(W);W-- >0;)(f.isOdd()||v.isOdd())&&(f.iadd(T),v.isub(R)),f.iushrn(1),v.iushrn(1);h.cmp(b)>=0?(h.isub(b),_.isub(f),g.isub(v)):(b.isub(h),f.isub(_),v.isub(g))}return{a:f,b:v,gcd:b.iushln(O)}},i.prototype._invmp=function(l){r(l.negative===0),r(!l.isZero());var h=this,b=l.clone();h.negative!==0?h=h.umod(l):h=h.clone();for(var _=new i(1),g=new i(0),f=b.clone();h.cmpn(1)>0&&b.cmpn(1)>0;){for(var v=0,O=1;!(h.words[0]&O)&&v<26;++v,O<<=1);if(v>0)for(h.iushrn(v);v-- >0;)_.isOdd()&&_.iadd(f),_.iushrn(1);for(var T=0,R=1;!(b.words[0]&R)&&T<26;++T,R<<=1);if(T>0)for(b.iushrn(T);T-- >0;)g.isOdd()&&g.iadd(f),g.iushrn(1);h.cmp(b)>=0?(h.isub(b),_.isub(g)):(b.isub(h),g.isub(_))}var z;return h.cmpn(1)===0?z=_:z=g,z.cmpn(0)<0&&z.iadd(l),z},i.prototype.gcd=function(l){if(this.isZero())return l.abs();if(l.isZero())return this.abs();var h=this.clone(),b=l.clone();h.negative=0,b.negative=0;for(var _=0;h.isEven()&&b.isEven();_++)h.iushrn(1),b.iushrn(1);do{for(;h.isEven();)h.iushrn(1);for(;b.isEven();)b.iushrn(1);var g=h.cmp(b);if(g<0){var f=h;h=b,b=f}else if(g===0||b.cmpn(1)===0)break;h.isub(b)}while(!0);return b.iushln(_)},i.prototype.invm=function(l){return this.egcd(l).a.umod(l)},i.prototype.isEven=function(){return(this.words[0]&1)===0},i.prototype.isOdd=function(){return(this.words[0]&1)===1},i.prototype.andln=function(l){return this.words[0]&l},i.prototype.bincn=function(l){r(typeof l=="number");var h=l%26,b=(l-h)/26,_=1<<h;if(this.length<=b)return this._expand(b+1),this.words[b]|=_,this;for(var g=_,f=b;g!==0&&f<this.length;f++){var v=this.words[f]|0;v+=g,g=v>>>26,v&=67108863,this.words[f]=v}return g!==0&&(this.words[f]=g,this.length++),this},i.prototype.isZero=function(){return this.length===1&&this.words[0]===0},i.prototype.cmpn=function(l){var h=l<0;if(this.negative!==0&&!h)return-1;if(this.negative===0&&h)return 1;this._strip();var b;if(this.length>1)b=1;else{h&&(l=-l),r(l<=67108863,"Number is too big");var _=this.words[0]|0;b=_===l?0:_<l?-1:1}return this.negative!==0?-b|0:b},i.prototype.cmp=function(l){if(this.negative!==0&&l.negative===0)return-1;if(this.negative===0&&l.negative!==0)return 1;var h=this.ucmp(l);return this.negative!==0?-h|0:h},i.prototype.ucmp=function(l){if(this.length>l.length)return 1;if(this.length<l.length)return-1;for(var h=0,b=this.length-1;b>=0;b--){var _=this.words[b]|0,g=l.words[b]|0;if(_!==g){_<g?h=-1:_>g&&(h=1);break}}return h},i.prototype.gtn=function(l){return this.cmpn(l)===1},i.prototype.gt=function(l){return this.cmp(l)===1},i.prototype.gten=function(l){return this.cmpn(l)>=0},i.prototype.gte=function(l){return this.cmp(l)>=0},i.prototype.ltn=function(l){return this.cmpn(l)===-1},i.prototype.lt=function(l){return this.cmp(l)===-1},i.prototype.lten=function(l){return this.cmpn(l)<=0},i.prototype.lte=function(l){return this.cmp(l)<=0},i.prototype.eqn=function(l){return this.cmpn(l)===0},i.prototype.eq=function(l){return this.cmp(l)===0},i.red=function(l){return new c(l)},i.prototype.toRed=function(l){return r(!this.red,"Already a number in reduction context"),r(this.negative===0,"red works only with positives"),l.convertTo(this)._forceRed(l)},i.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(l){return this.red=l,this},i.prototype.forceRed=function(l){return r(!this.red,"Already a number in reduction context"),this._forceRed(l)},i.prototype.redAdd=function(l){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,l)},i.prototype.redIAdd=function(l){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,l)},i.prototype.redSub=function(l){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,l)},i.prototype.redISub=function(l){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,l)},i.prototype.redShl=function(l){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,l)},i.prototype.redMul=function(l){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,l),this.red.mul(this,l)},i.prototype.redIMul=function(l){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,l),this.red.imul(this,l)},i.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(l){return r(this.red&&!l.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,l)};var L={k256:null,p224:null,p192:null,p25519:null};function U(y,l){this.name=y,this.p=new i(l,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}U.prototype._tmp=function(){var l=new i(null);return l.words=new Array(Math.ceil(this.n/13)),l},U.prototype.ireduce=function(l){var h=l,b;do this.split(h,this.tmp),h=this.imulK(h),h=h.iadd(this.tmp),b=h.bitLength();while(b>this.n);var _=b<this.n?-1:h.ucmp(this.p);return _===0?(h.words[0]=0,h.length=1):_>0?h.isub(this.p):h.strip!==void 0?h.strip():h._strip(),h},U.prototype.split=function(l,h){l.iushrn(this.n,0,h)},U.prototype.imulK=function(l){return l.imul(this.k)};function F(){U.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}n(F,U),F.prototype.split=function(l,h){for(var b=4194303,_=Math.min(l.length,9),g=0;g<_;g++)h.words[g]=l.words[g];if(h.length=_,l.length<=9){l.words[0]=0,l.length=1;return}var f=l.words[9];for(h.words[h.length++]=f&b,g=10;g<l.length;g++){var v=l.words[g]|0;l.words[g-10]=(v&b)<<4|f>>>22,f=v}f>>>=22,l.words[g-10]=f,f===0&&l.length>10?l.length-=10:l.length-=9},F.prototype.imulK=function(l){l.words[l.length]=0,l.words[l.length+1]=0,l.length+=2;for(var h=0,b=0;b<l.length;b++){var _=l.words[b]|0;h+=_*977,l.words[b]=h&67108863,h=_*64+(h/67108864|0)}return l.words[l.length-1]===0&&(l.length--,l.words[l.length-1]===0&&l.length--),l};function N(){U.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}n(N,U);function G(){U.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}n(G,U);function x(){U.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}n(x,U),x.prototype.imulK=function(l){for(var h=0,b=0;b<l.length;b++){var _=(l.words[b]|0)*19+h,g=_&67108863;_>>>=26,l.words[b]=g,h=_}return h!==0&&(l.words[l.length++]=h),l},i._prime=function(l){if(L[l])return L[l];var h;if(l==="k256")h=new F;else if(l==="p224")h=new N;else if(l==="p192")h=new G;else if(l==="p25519")h=new x;else throw new Error("Unknown prime "+l);return L[l]=h,h};function c(y){if(typeof y=="string"){var l=i._prime(y);this.m=l.p,this.prime=l}else r(y.gtn(1),"modulus must be greater than 1"),this.m=y,this.prime=null}c.prototype._verify1=function(l){r(l.negative===0,"red works only with positives"),r(l.red,"red works only with red numbers")},c.prototype._verify2=function(l,h){r((l.negative|h.negative)===0,"red works only with positives"),r(l.red&&l.red===h.red,"red works only with red numbers")},c.prototype.imod=function(l){return this.prime?this.prime.ireduce(l)._forceRed(this):(m(l,l.umod(this.m)._forceRed(this)),l)},c.prototype.neg=function(l){return l.isZero()?l.clone():this.m.sub(l)._forceRed(this)},c.prototype.add=function(l,h){this._verify2(l,h);var b=l.add(h);return b.cmp(this.m)>=0&&b.isub(this.m),b._forceRed(this)},c.prototype.iadd=function(l,h){this._verify2(l,h);var b=l.iadd(h);return b.cmp(this.m)>=0&&b.isub(this.m),b},c.prototype.sub=function(l,h){this._verify2(l,h);var b=l.sub(h);return b.cmpn(0)<0&&b.iadd(this.m),b._forceRed(this)},c.prototype.isub=function(l,h){this._verify2(l,h);var b=l.isub(h);return b.cmpn(0)<0&&b.iadd(this.m),b},c.prototype.shl=function(l,h){return this._verify1(l),this.imod(l.ushln(h))},c.prototype.imul=function(l,h){return this._verify2(l,h),this.imod(l.imul(h))},c.prototype.mul=function(l,h){return this._verify2(l,h),this.imod(l.mul(h))},c.prototype.isqr=function(l){return this.imul(l,l.clone())},c.prototype.sqr=function(l){return this.mul(l,l)},c.prototype.sqrt=function(l){if(l.isZero())return l.clone();var h=this.m.andln(3);if(r(h%2===1),h===3){var b=this.m.add(new i(1)).iushrn(2);return this.pow(l,b)}for(var _=this.m.subn(1),g=0;!_.isZero()&&_.andln(1)===0;)g++,_.iushrn(1);r(!_.isZero());var f=new i(1).toRed(this),v=f.redNeg(),O=this.m.subn(1).iushrn(1),T=this.m.bitLength();for(T=new i(2*T*T).toRed(this);this.pow(T,O).cmp(v)!==0;)T.redIAdd(v);for(var R=this.pow(T,_),z=this.pow(l,_.addn(1).iushrn(1)),V=this.pow(l,_),W=g;V.cmp(f)!==0;){for(var Z=V,J=0;Z.cmp(f)!==0;J++)Z=Z.redSqr();r(J<W);var X=this.pow(R,new i(1).iushln(W-J-1));z=z.redMul(X),R=X.redSqr(),V=V.redMul(R),W=J}return z},c.prototype.invm=function(l){var h=l._invmp(this.m);return h.negative!==0?(h.negative=0,this.imod(h).redNeg()):this.imod(h)},c.prototype.pow=function(l,h){if(h.isZero())return new i(1).toRed(this);if(h.cmpn(1)===0)return l.clone();var b=4,_=new Array(1<<b);_[0]=new i(1).toRed(this),_[1]=l;for(var g=2;g<_.length;g++)_[g]=this.mul(_[g-1],l);var f=_[0],v=0,O=0,T=h.bitLength()%26;for(T===0&&(T=26),g=h.length-1;g>=0;g--){for(var R=h.words[g],z=T-1;z>=0;z--){var V=R>>z&1;if(f!==_[0]&&(f=this.sqr(f)),V===0&&v===0){O=0;continue}v<<=1,v|=V,O++,!(O!==b&&(g!==0||z!==0))&&(f=this.mul(f,_[v]),O=0,v=0)}T=26}return f},c.prototype.convertTo=function(l){var h=l.umod(this.m);return h===l?h.clone():h},c.prototype.convertFrom=function(l){var h=l.clone();return h.red=null,h},i.mont=function(l){return new u(l)};function u(y){c.call(this,y),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new i(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}n(u,c),u.prototype.convertTo=function(l){return this.imod(l.ushln(this.shift))},u.prototype.convertFrom=function(l){var h=this.imod(l.mul(this.rinv));return h.red=null,h},u.prototype.imul=function(l,h){if(l.isZero()||h.isZero())return l.words[0]=0,l.length=1,l;var b=l.imul(h),_=b.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),g=b.isub(_).iushrn(this.shift),f=g;return g.cmp(this.m)>=0?f=g.isub(this.m):g.cmpn(0)<0&&(f=g.iadd(this.m)),f._forceRed(this)},u.prototype.mul=function(l,h){if(l.isZero()||h.isZero())return new i(0)._forceRed(this);var b=l.mul(h),_=b.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),g=b.isub(_).iushrn(this.shift),f=g;return g.cmp(this.m)>=0?f=g.isub(this.m):g.cmpn(0)<0&&(f=g.iadd(this.m)),f._forceRed(this)},u.prototype.invm=function(l){var h=this.imod(l._invmp(this.m).mul(this.r2));return h._forceRed(this)}})(typeof c7>"u"||c7,FX)});var yM=H((syt,GX)=>{E();var zv=mM(),gTe=em();function vTe(t){var e=zX(t),r=e.toRed(zv.mont(t.modulus)).redPow(new zv(t.publicExponent)).fromRed();return{blinder:r,unblinder:e.invm(t.modulus)}}function zX(t){var e=t.modulus.byteLength(),r;do r=new zv(gTe(e));while(r.cmp(t.modulus)>=0||!r.umod(t.prime1)||!r.umod(t.prime2));return r}function KX(t,e){var r=vTe(e),n=e.modulus.byteLength(),i=new zv(t).mul(r.blinder).umod(e.modulus),o=i.toRed(zv.mont(e.prime1)),s=i.toRed(zv.mont(e.prime2)),a=e.coefficient,d=e.prime1,m=e.prime2,p=o.redPow(e.exponent1).fromRed(),w=s.redPow(e.exponent2).fromRed(),P=p.isub(w).imul(a).umod(d).imul(m);return w.iadd(P).imul(r.unblinder).umod(e.modulus).toArrayLike($.Buffer,"be",n)}KX.getr=zX;GX.exports=KX});var WX=H((cyt,bTe)=>{bTe.exports={name:"elliptic",version:"6.5.4",description:"EC cryptography",main:"lib/elliptic.js",files:["lib"],scripts:{lint:"eslint lib test","lint:fix":"npm run lint -- --fix",unit:"istanbul test _mocha --reporter=spec test/index.js",test:"npm run lint && npm run unit",version:"grunt dist && git add dist/"},repository:{type:"git",url:"git@github.com:indutny/elliptic"},keywords:["EC","Elliptic","curve","Cryptography"],author:"Fedor Indutny <fedor@indutny.com>",license:"MIT",bugs:{url:"https://github.com/indutny/elliptic/issues"},homepage:"https://github.com/indutny/elliptic",devDependencies:{brfs:"^2.0.2",coveralls:"^3.1.0",eslint:"^7.6.0",grunt:"^1.2.1","grunt-browserify":"^5.3.0","grunt-cli":"^1.3.2","grunt-contrib-connect":"^3.0.0","grunt-contrib-copy":"^1.0.0","grunt-contrib-uglify":"^5.0.0","grunt-mocha-istanbul":"^5.0.2","grunt-saucelabs":"^9.0.1",istanbul:"^0.4.5",mocha:"^8.0.1"},dependencies:{"bn.js":"^4.11.9",brorand:"^1.1.0","hash.js":"^1.0.0","hmac-drbg":"^1.0.1",inherits:"^2.0.4","minimalistic-assert":"^1.0.1","minimalistic-crypto-utils":"^1.0.1"}}});var Wu=H((VX,f7)=>{E();(function(t,e){"use strict";function r(x,c){if(!x)throw new Error(c||"Assertion failed")}function n(x,c){x.super_=c;var u=function(){};u.prototype=c.prototype,x.prototype=new u,x.prototype.constructor=x}function i(x,c,u){if(i.isBN(x))return x;this.negative=0,this.words=null,this.length=0,this.red=null,x!==null&&((c==="le"||c==="be")&&(u=c,c=10),this._init(x||0,c||10,u||"be"))}typeof t=="object"?t.exports=i:e.BN=i,i.BN=i,i.wordSize=26;var o;try{typeof window<"u"&&typeof window.Buffer<"u"?o=window.Buffer:o=sr().Buffer}catch{}i.isBN=function(c){return c instanceof i?!0:c!==null&&typeof c=="object"&&c.constructor.wordSize===i.wordSize&&Array.isArray(c.words)},i.max=function(c,u){return c.cmp(u)>0?c:u},i.min=function(c,u){return c.cmp(u)<0?c:u},i.prototype._init=function(c,u,y){if(typeof c=="number")return this._initNumber(c,u,y);if(typeof c=="object")return this._initArray(c,u,y);u==="hex"&&(u=16),r(u===(u|0)&&u>=2&&u<=36),c=c.toString().replace(/\s+/g,"");var l=0;c[0]==="-"&&(l++,this.negative=1),l<c.length&&(u===16?this._parseHex(c,l,y):(this._parseBase(c,u,l),y==="le"&&this._initArray(this.toArray(),u,y)))},i.prototype._initNumber=function(c,u,y){c<0&&(this.negative=1,c=-c),c<67108864?(this.words=[c&67108863],this.length=1):c<4503599627370496?(this.words=[c&67108863,c/67108864&67108863],this.length=2):(r(c<9007199254740992),this.words=[c&67108863,c/67108864&67108863,1],this.length=3),y==="le"&&this._initArray(this.toArray(),u,y)},i.prototype._initArray=function(c,u,y){if(r(typeof c.length=="number"),c.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(c.length/3),this.words=new Array(this.length);for(var l=0;l<this.length;l++)this.words[l]=0;var h,b,_=0;if(y==="be")for(l=c.length-1,h=0;l>=0;l-=3)b=c[l]|c[l-1]<<8|c[l-2]<<16,this.words[h]|=b<<_&67108863,this.words[h+1]=b>>>26-_&67108863,_+=24,_>=26&&(_-=26,h++);else if(y==="le")for(l=0,h=0;l<c.length;l+=3)b=c[l]|c[l+1]<<8|c[l+2]<<16,this.words[h]|=b<<_&67108863,this.words[h+1]=b>>>26-_&67108863,_+=24,_>=26&&(_-=26,h++);return this.strip()};function s(x,c){var u=x.charCodeAt(c);return u>=65&&u<=70?u-55:u>=97&&u<=102?u-87:u-48&15}function a(x,c,u){var y=s(x,u);return u-1>=c&&(y|=s(x,u-1)<<4),y}i.prototype._parseHex=function(c,u,y){this.length=Math.ceil((c.length-u)/6),this.words=new Array(this.length);for(var l=0;l<this.length;l++)this.words[l]=0;var h=0,b=0,_;if(y==="be")for(l=c.length-1;l>=u;l-=2)_=a(c,u,l)<<h,this.words[b]|=_&67108863,h>=18?(h-=18,b+=1,this.words[b]|=_>>>26):h+=8;else{var g=c.length-u;for(l=g%2===0?u+1:u;l<c.length;l+=2)_=a(c,u,l)<<h,this.words[b]|=_&67108863,h>=18?(h-=18,b+=1,this.words[b]|=_>>>26):h+=8}this.strip()};function d(x,c,u,y){for(var l=0,h=Math.min(x.length,u),b=c;b<h;b++){var _=x.charCodeAt(b)-48;l*=y,_>=49?l+=_-49+10:_>=17?l+=_-17+10:l+=_}return l}i.prototype._parseBase=function(c,u,y){this.words=[0],this.length=1;for(var l=0,h=1;h<=67108863;h*=u)l++;l--,h=h/u|0;for(var b=c.length-y,_=b%l,g=Math.min(b,b-_)+y,f=0,v=y;v<g;v+=l)f=d(c,v,v+l,u),this.imuln(h),this.words[0]+f<67108864?this.words[0]+=f:this._iaddn(f);if(_!==0){var O=1;for(f=d(c,v,c.length,u),v=0;v<_;v++)O*=u;this.imuln(O),this.words[0]+f<67108864?this.words[0]+=f:this._iaddn(f)}this.strip()},i.prototype.copy=function(c){c.words=new Array(this.length);for(var u=0;u<this.length;u++)c.words[u]=this.words[u];c.length=this.length,c.negative=this.negative,c.red=this.red},i.prototype.clone=function(){var c=new i(null);return this.copy(c),c},i.prototype._expand=function(c){for(;this.length<c;)this.words[this.length++]=0;return this},i.prototype.strip=function(){for(;this.length>1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},i.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},i.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var m=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],p=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],w=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];i.prototype.toString=function(c,u){c=c||10,u=u|0||1;var y;if(c===16||c==="hex"){y="";for(var l=0,h=0,b=0;b<this.length;b++){var _=this.words[b],g=((_<<l|h)&16777215).toString(16);h=_>>>24-l&16777215,h!==0||b!==this.length-1?y=m[6-g.length]+g+y:y=g+y,l+=2,l>=26&&(l-=26,b--)}for(h!==0&&(y=h.toString(16)+y);y.length%u!==0;)y="0"+y;return this.negative!==0&&(y="-"+y),y}if(c===(c|0)&&c>=2&&c<=36){var f=p[c],v=w[c];y="";var O=this.clone();for(O.negative=0;!O.isZero();){var T=O.modn(v).toString(c);O=O.idivn(v),O.isZero()?y=T+y:y=m[f-T.length]+T+y}for(this.isZero()&&(y="0"+y);y.length%u!==0;)y="0"+y;return this.negative!==0&&(y="-"+y),y}r(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var c=this.words[0];return this.length===2?c+=this.words[1]*67108864:this.length===3&&this.words[2]===1?c+=4503599627370496+this.words[1]*67108864:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-c:c},i.prototype.toJSON=function(){return this.toString(16)},i.prototype.toBuffer=function(c,u){return r(typeof o<"u"),this.toArrayLike(o,c,u)},i.prototype.toArray=function(c,u){return this.toArrayLike(Array,c,u)},i.prototype.toArrayLike=function(c,u,y){var l=this.byteLength(),h=y||Math.max(1,l);r(l<=h,"byte array longer than desired length"),r(h>0,"Requested array length <= 0"),this.strip();var b=u==="le",_=new c(h),g,f,v=this.clone();if(b){for(f=0;!v.isZero();f++)g=v.andln(255),v.iushrn(8),_[f]=g;for(;f<h;f++)_[f]=0}else{for(f=0;f<h-l;f++)_[f]=0;for(f=0;!v.isZero();f++)g=v.andln(255),v.iushrn(8),_[h-f-1]=g}return _},Math.clz32?i.prototype._countBits=function(c){return 32-Math.clz32(c)}:i.prototype._countBits=function(c){var u=c,y=0;return u>=4096&&(y+=13,u>>>=13),u>=64&&(y+=7,u>>>=7),u>=8&&(y+=4,u>>>=4),u>=2&&(y+=2,u>>>=2),y+u},i.prototype._zeroBits=function(c){if(c===0)return 26;var u=c,y=0;return u&8191||(y+=13,u>>>=13),u&127||(y+=7,u>>>=7),u&15||(y+=4,u>>>=4),u&3||(y+=2,u>>>=2),u&1||y++,y},i.prototype.bitLength=function(){var c=this.words[this.length-1],u=this._countBits(c);return(this.length-1)*26+u};function P(x){for(var c=new Array(x.bitLength()),u=0;u<c.length;u++){var y=u/26|0,l=u%26;c[u]=(x.words[y]&1<<l)>>>l}return c}i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var c=0,u=0;u<this.length;u++){var y=this._zeroBits(this.words[u]);if(c+=y,y!==26)break}return c},i.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},i.prototype.toTwos=function(c){return this.negative!==0?this.abs().inotn(c).iaddn(1):this.clone()},i.prototype.fromTwos=function(c){return this.testn(c-1)?this.notn(c).iaddn(1).ineg():this.clone()},i.prototype.isNeg=function(){return this.negative!==0},i.prototype.neg=function(){return this.clone().ineg()},i.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},i.prototype.iuor=function(c){for(;this.length<c.length;)this.words[this.length++]=0;for(var u=0;u<c.length;u++)this.words[u]=this.words[u]|c.words[u];return this.strip()},i.prototype.ior=function(c){return r((this.negative|c.negative)===0),this.iuor(c)},i.prototype.or=function(c){return this.length>c.length?this.clone().ior(c):c.clone().ior(this)},i.prototype.uor=function(c){return this.length>c.length?this.clone().iuor(c):c.clone().iuor(this)},i.prototype.iuand=function(c){var u;this.length>c.length?u=c:u=this;for(var y=0;y<u.length;y++)this.words[y]=this.words[y]&c.words[y];return this.length=u.length,this.strip()},i.prototype.iand=function(c){return r((this.negative|c.negative)===0),this.iuand(c)},i.prototype.and=function(c){return this.length>c.length?this.clone().iand(c):c.clone().iand(this)},i.prototype.uand=function(c){return this.length>c.length?this.clone().iuand(c):c.clone().iuand(this)},i.prototype.iuxor=function(c){var u,y;this.length>c.length?(u=this,y=c):(u=c,y=this);for(var l=0;l<y.length;l++)this.words[l]=u.words[l]^y.words[l];if(this!==u)for(;l<u.length;l++)this.words[l]=u.words[l];return this.length=u.length,this.strip()},i.prototype.ixor=function(c){return r((this.negative|c.negative)===0),this.iuxor(c)},i.prototype.xor=function(c){return this.length>c.length?this.clone().ixor(c):c.clone().ixor(this)},i.prototype.uxor=function(c){return this.length>c.length?this.clone().iuxor(c):c.clone().iuxor(this)},i.prototype.inotn=function(c){r(typeof c=="number"&&c>=0);var u=Math.ceil(c/26)|0,y=c%26;this._expand(u),y>0&&u--;for(var l=0;l<u;l++)this.words[l]=~this.words[l]&67108863;return y>0&&(this.words[l]=~this.words[l]&67108863>>26-y),this.strip()},i.prototype.notn=function(c){return this.clone().inotn(c)},i.prototype.setn=function(c,u){r(typeof c=="number"&&c>=0);var y=c/26|0,l=c%26;return this._expand(y+1),u?this.words[y]=this.words[y]|1<<l:this.words[y]=this.words[y]&~(1<<l),this.strip()},i.prototype.iadd=function(c){var u;if(this.negative!==0&&c.negative===0)return this.negative=0,u=this.isub(c),this.negative^=1,this._normSign();if(this.negative===0&&c.negative!==0)return c.negative=0,u=this.isub(c),c.negative=1,u._normSign();var y,l;this.length>c.length?(y=this,l=c):(y=c,l=this);for(var h=0,b=0;b<l.length;b++)u=(y.words[b]|0)+(l.words[b]|0)+h,this.words[b]=u&67108863,h=u>>>26;for(;h!==0&&b<y.length;b++)u=(y.words[b]|0)+h,this.words[b]=u&67108863,h=u>>>26;if(this.length=y.length,h!==0)this.words[this.length]=h,this.length++;else if(y!==this)for(;b<y.length;b++)this.words[b]=y.words[b];return this},i.prototype.add=function(c){var u;return c.negative!==0&&this.negative===0?(c.negative=0,u=this.sub(c),c.negative^=1,u):c.negative===0&&this.negative!==0?(this.negative=0,u=c.sub(this),this.negative=1,u):this.length>c.length?this.clone().iadd(c):c.clone().iadd(this)},i.prototype.isub=function(c){if(c.negative!==0){c.negative=0;var u=this.iadd(c);return c.negative=1,u._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(c),this.negative=1,this._normSign();var y=this.cmp(c);if(y===0)return this.negative=0,this.length=1,this.words[0]=0,this;var l,h;y>0?(l=this,h=c):(l=c,h=this);for(var b=0,_=0;_<h.length;_++)u=(l.words[_]|0)-(h.words[_]|0)+b,b=u>>26,this.words[_]=u&67108863;for(;b!==0&&_<l.length;_++)u=(l.words[_]|0)+b,b=u>>26,this.words[_]=u&67108863;if(b===0&&_<l.length&&l!==this)for(;_<l.length;_++)this.words[_]=l.words[_];return this.length=Math.max(this.length,_),l!==this&&(this.negative=1),this.strip()},i.prototype.sub=function(c){return this.clone().isub(c)};function S(x,c,u){u.negative=c.negative^x.negative;var y=x.length+c.length|0;u.length=y,y=y-1|0;var l=x.words[0]|0,h=c.words[0]|0,b=l*h,_=b&67108863,g=b/67108864|0;u.words[0]=_;for(var f=1;f<y;f++){for(var v=g>>>26,O=g&67108863,T=Math.min(f,c.length-1),R=Math.max(0,f-x.length+1);R<=T;R++){var z=f-R|0;l=x.words[z]|0,h=c.words[R]|0,b=l*h+O,v+=b/67108864|0,O=b&67108863}u.words[f]=O|0,g=v|0}return g!==0?u.words[f]=g|0:u.length--,u.strip()}var M=function(c,u,y){var l=c.words,h=u.words,b=y.words,_=0,g,f,v,O=l[0]|0,T=O&8191,R=O>>>13,z=l[1]|0,V=z&8191,W=z>>>13,Z=l[2]|0,J=Z&8191,X=Z>>>13,Ee=l[3]|0,re=Ee&8191,ne=Ee>>>13,qe=l[4]|0,ce=qe&8191,ye=qe>>>13,Ne=l[5]|0,ie=Ne&8191,oe=Ne>>>13,ze=l[6]|0,le=ze&8191,me=ze>>>13,ot=l[7]|0,ue=ot&8191,he=ot>>>13,lt=l[8]|0,se=lt&8191,fe=lt>>>13,Lt=l[9]|0,ge=Lt&8191,ve=Lt>>>13,on=h[0]|0,xe=on&8191,Pe=on>>>13,jr=h[1]|0,Se=jr&8191,_e=jr>>>13,Mn=h[2]|0,Me=Mn&8191,Te=Mn>>>13,vi=h[3]|0,Ae=vi&8191,Be=vi>>>13,Pn=h[4]|0,De=Pn&8191,Ie=Pn>>>13,bi=h[5]|0,Re=bi&8191,ke=bi>>>13,wi=h[6]|0,Oe=wi&8191,Ce=wi>>>13,oi=h[7]|0,Q=oi&8191,Y=oi>>>13,ae=h[8]|0,ee=ae&8191,te=ae>>>13,Ke=h[9]|0,de=Ke&8191,pe=Ke>>>13;y.negative=c.negative^u.negative,y.length=19,g=Math.imul(T,xe),f=Math.imul(T,Pe),f=f+Math.imul(R,xe)|0,v=Math.imul(R,Pe);var bt=(_+g|0)+((f&8191)<<13)|0;_=(v+(f>>>13)|0)+(bt>>>26)|0,bt&=67108863,g=Math.imul(V,xe),f=Math.imul(V,Pe),f=f+Math.imul(W,xe)|0,v=Math.imul(W,Pe),g=g+Math.imul(T,Se)|0,f=f+Math.imul(T,_e)|0,f=f+Math.imul(R,Se)|0,v=v+Math.imul(R,_e)|0;var st=(_+g|0)+((f&8191)<<13)|0;_=(v+(f>>>13)|0)+(st>>>26)|0,st&=67108863,g=Math.imul(J,xe),f=Math.imul(J,Pe),f=f+Math.imul(X,xe)|0,v=Math.imul(X,Pe),g=g+Math.imul(V,Se)|0,f=f+Math.imul(V,_e)|0,f=f+Math.imul(W,Se)|0,v=v+Math.imul(W,_e)|0,g=g+Math.imul(T,Me)|0,f=f+Math.imul(T,Te)|0,f=f+Math.imul(R,Me)|0,v=v+Math.imul(R,Te)|0;var Ve=(_+g|0)+((f&8191)<<13)|0;_=(v+(f>>>13)|0)+(Ve>>>26)|0,Ve&=67108863,g=Math.imul(re,xe),f=Math.imul(re,Pe),f=f+Math.imul(ne,xe)|0,v=Math.imul(ne,Pe),g=g+Math.imul(J,Se)|0,f=f+Math.imul(J,_e)|0,f=f+Math.imul(X,Se)|0,v=v+Math.imul(X,_e)|0,g=g+Math.imul(V,Me)|0,f=f+Math.imul(V,Te)|0,f=f+Math.imul(W,Me)|0,v=v+Math.imul(W,Te)|0,g=g+Math.imul(T,Ae)|0,f=f+Math.imul(T,Be)|0,f=f+Math.imul(R,Ae)|0,v=v+Math.imul(R,Be)|0;var Tt=(_+g|0)+((f&8191)<<13)|0;_=(v+(f>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,g=Math.imul(ce,xe),f=Math.imul(ce,Pe),f=f+Math.imul(ye,xe)|0,v=Math.imul(ye,Pe),g=g+Math.imul(re,Se)|0,f=f+Math.imul(re,_e)|0,f=f+Math.imul(ne,Se)|0,v=v+Math.imul(ne,_e)|0,g=g+Math.imul(J,Me)|0,f=f+Math.imul(J,Te)|0,f=f+Math.imul(X,Me)|0,v=v+Math.imul(X,Te)|0,g=g+Math.imul(V,Ae)|0,f=f+Math.imul(V,Be)|0,f=f+Math.imul(W,Ae)|0,v=v+Math.imul(W,Be)|0,g=g+Math.imul(T,De)|0,f=f+Math.imul(T,Ie)|0,f=f+Math.imul(R,De)|0,v=v+Math.imul(R,Ie)|0;var Ut=(_+g|0)+((f&8191)<<13)|0;_=(v+(f>>>13)|0)+(Ut>>>26)|0,Ut&=67108863,g=Math.imul(ie,xe),f=Math.imul(ie,Pe),f=f+Math.imul(oe,xe)|0,v=Math.imul(oe,Pe),g=g+Math.imul(ce,Se)|0,f=f+Math.imul(ce,_e)|0,f=f+Math.imul(ye,Se)|0,v=v+Math.imul(ye,_e)|0,g=g+Math.imul(re,Me)|0,f=f+Math.imul(re,Te)|0,f=f+Math.imul(ne,Me)|0,v=v+Math.imul(ne,Te)|0,g=g+Math.imul(J,Ae)|0,f=f+Math.imul(J,Be)|0,f=f+Math.imul(X,Ae)|0,v=v+Math.imul(X,Be)|0,g=g+Math.imul(V,De)|0,f=f+Math.imul(V,Ie)|0,f=f+Math.imul(W,De)|0,v=v+Math.imul(W,Ie)|0,g=g+Math.imul(T,Re)|0,f=f+Math.imul(T,ke)|0,f=f+Math.imul(R,Re)|0,v=v+Math.imul(R,ke)|0;var Pt=(_+g|0)+((f&8191)<<13)|0;_=(v+(f>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,g=Math.imul(le,xe),f=Math.imul(le,Pe),f=f+Math.imul(me,xe)|0,v=Math.imul(me,Pe),g=g+Math.imul(ie,Se)|0,f=f+Math.imul(ie,_e)|0,f=f+Math.imul(oe,Se)|0,v=v+Math.imul(oe,_e)|0,g=g+Math.imul(ce,Me)|0,f=f+Math.imul(ce,Te)|0,f=f+Math.imul(ye,Me)|0,v=v+Math.imul(ye,Te)|0,g=g+Math.imul(re,Ae)|0,f=f+Math.imul(re,Be)|0,f=f+Math.imul(ne,Ae)|0,v=v+Math.imul(ne,Be)|0,g=g+Math.imul(J,De)|0,f=f+Math.imul(J,Ie)|0,f=f+Math.imul(X,De)|0,v=v+Math.imul(X,Ie)|0,g=g+Math.imul(V,Re)|0,f=f+Math.imul(V,ke)|0,f=f+Math.imul(W,Re)|0,v=v+Math.imul(W,ke)|0,g=g+Math.imul(T,Oe)|0,f=f+Math.imul(T,Ce)|0,f=f+Math.imul(R,Oe)|0,v=v+Math.imul(R,Ce)|0;var yt=(_+g|0)+((f&8191)<<13)|0;_=(v+(f>>>13)|0)+(yt>>>26)|0,yt&=67108863,g=Math.imul(ue,xe),f=Math.imul(ue,Pe),f=f+Math.imul(he,xe)|0,v=Math.imul(he,Pe),g=g+Math.imul(le,Se)|0,f=f+Math.imul(le,_e)|0,f=f+Math.imul(me,Se)|0,v=v+Math.imul(me,_e)|0,g=g+Math.imul(ie,Me)|0,f=f+Math.imul(ie,Te)|0,f=f+Math.imul(oe,Me)|0,v=v+Math.imul(oe,Te)|0,g=g+Math.imul(ce,Ae)|0,f=f+Math.imul(ce,Be)|0,f=f+Math.imul(ye,Ae)|0,v=v+Math.imul(ye,Be)|0,g=g+Math.imul(re,De)|0,f=f+Math.imul(re,Ie)|0,f=f+Math.imul(ne,De)|0,v=v+Math.imul(ne,Ie)|0,g=g+Math.imul(J,Re)|0,f=f+Math.imul(J,ke)|0,f=f+Math.imul(X,Re)|0,v=v+Math.imul(X,ke)|0,g=g+Math.imul(V,Oe)|0,f=f+Math.imul(V,Ce)|0,f=f+Math.imul(W,Oe)|0,v=v+Math.imul(W,Ce)|0,g=g+Math.imul(T,Q)|0,f=f+Math.imul(T,Y)|0,f=f+Math.imul(R,Q)|0,v=v+Math.imul(R,Y)|0;var Rt=(_+g|0)+((f&8191)<<13)|0;_=(v+(f>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,g=Math.imul(se,xe),f=Math.imul(se,Pe),f=f+Math.imul(fe,xe)|0,v=Math.imul(fe,Pe),g=g+Math.imul(ue,Se)|0,f=f+Math.imul(ue,_e)|0,f=f+Math.imul(he,Se)|0,v=v+Math.imul(he,_e)|0,g=g+Math.imul(le,Me)|0,f=f+Math.imul(le,Te)|0,f=f+Math.imul(me,Me)|0,v=v+Math.imul(me,Te)|0,g=g+Math.imul(ie,Ae)|0,f=f+Math.imul(ie,Be)|0,f=f+Math.imul(oe,Ae)|0,v=v+Math.imul(oe,Be)|0,g=g+Math.imul(ce,De)|0,f=f+Math.imul(ce,Ie)|0,f=f+Math.imul(ye,De)|0,v=v+Math.imul(ye,Ie)|0,g=g+Math.imul(re,Re)|0,f=f+Math.imul(re,ke)|0,f=f+Math.imul(ne,Re)|0,v=v+Math.imul(ne,ke)|0,g=g+Math.imul(J,Oe)|0,f=f+Math.imul(J,Ce)|0,f=f+Math.imul(X,Oe)|0,v=v+Math.imul(X,Ce)|0,g=g+Math.imul(V,Q)|0,f=f+Math.imul(V,Y)|0,f=f+Math.imul(W,Q)|0,v=v+Math.imul(W,Y)|0,g=g+Math.imul(T,ee)|0,f=f+Math.imul(T,te)|0,f=f+Math.imul(R,ee)|0,v=v+Math.imul(R,te)|0;var _t=(_+g|0)+((f&8191)<<13)|0;_=(v+(f>>>13)|0)+(_t>>>26)|0,_t&=67108863,g=Math.imul(ge,xe),f=Math.imul(ge,Pe),f=f+Math.imul(ve,xe)|0,v=Math.imul(ve,Pe),g=g+Math.imul(se,Se)|0,f=f+Math.imul(se,_e)|0,f=f+Math.imul(fe,Se)|0,v=v+Math.imul(fe,_e)|0,g=g+Math.imul(ue,Me)|0,f=f+Math.imul(ue,Te)|0,f=f+Math.imul(he,Me)|0,v=v+Math.imul(he,Te)|0,g=g+Math.imul(le,Ae)|0,f=f+Math.imul(le,Be)|0,f=f+Math.imul(me,Ae)|0,v=v+Math.imul(me,Be)|0,g=g+Math.imul(ie,De)|0,f=f+Math.imul(ie,Ie)|0,f=f+Math.imul(oe,De)|0,v=v+Math.imul(oe,Ie)|0,g=g+Math.imul(ce,Re)|0,f=f+Math.imul(ce,ke)|0,f=f+Math.imul(ye,Re)|0,v=v+Math.imul(ye,ke)|0,g=g+Math.imul(re,Oe)|0,f=f+Math.imul(re,Ce)|0,f=f+Math.imul(ne,Oe)|0,v=v+Math.imul(ne,Ce)|0,g=g+Math.imul(J,Q)|0,f=f+Math.imul(J,Y)|0,f=f+Math.imul(X,Q)|0,v=v+Math.imul(X,Y)|0,g=g+Math.imul(V,ee)|0,f=f+Math.imul(V,te)|0,f=f+Math.imul(W,ee)|0,v=v+Math.imul(W,te)|0,g=g+Math.imul(T,de)|0,f=f+Math.imul(T,pe)|0,f=f+Math.imul(R,de)|0,v=v+Math.imul(R,pe)|0;var Lr=(_+g|0)+((f&8191)<<13)|0;_=(v+(f>>>13)|0)+(Lr>>>26)|0,Lr&=67108863,g=Math.imul(ge,Se),f=Math.imul(ge,_e),f=f+Math.imul(ve,Se)|0,v=Math.imul(ve,_e),g=g+Math.imul(se,Me)|0,f=f+Math.imul(se,Te)|0,f=f+Math.imul(fe,Me)|0,v=v+Math.imul(fe,Te)|0,g=g+Math.imul(ue,Ae)|0,f=f+Math.imul(ue,Be)|0,f=f+Math.imul(he,Ae)|0,v=v+Math.imul(he,Be)|0,g=g+Math.imul(le,De)|0,f=f+Math.imul(le,Ie)|0,f=f+Math.imul(me,De)|0,v=v+Math.imul(me,Ie)|0,g=g+Math.imul(ie,Re)|0,f=f+Math.imul(ie,ke)|0,f=f+Math.imul(oe,Re)|0,v=v+Math.imul(oe,ke)|0,g=g+Math.imul(ce,Oe)|0,f=f+Math.imul(ce,Ce)|0,f=f+Math.imul(ye,Oe)|0,v=v+Math.imul(ye,Ce)|0,g=g+Math.imul(re,Q)|0,f=f+Math.imul(re,Y)|0,f=f+Math.imul(ne,Q)|0,v=v+Math.imul(ne,Y)|0,g=g+Math.imul(J,ee)|0,f=f+Math.imul(J,te)|0,f=f+Math.imul(X,ee)|0,v=v+Math.imul(X,te)|0,g=g+Math.imul(V,de)|0,f=f+Math.imul(V,pe)|0,f=f+Math.imul(W,de)|0,v=v+Math.imul(W,pe)|0;var nr=(_+g|0)+((f&8191)<<13)|0;_=(v+(f>>>13)|0)+(nr>>>26)|0,nr&=67108863,g=Math.imul(ge,Me),f=Math.imul(ge,Te),f=f+Math.imul(ve,Me)|0,v=Math.imul(ve,Te),g=g+Math.imul(se,Ae)|0,f=f+Math.imul(se,Be)|0,f=f+Math.imul(fe,Ae)|0,v=v+Math.imul(fe,Be)|0,g=g+Math.imul(ue,De)|0,f=f+Math.imul(ue,Ie)|0,f=f+Math.imul(he,De)|0,v=v+Math.imul(he,Ie)|0,g=g+Math.imul(le,Re)|0,f=f+Math.imul(le,ke)|0,f=f+Math.imul(me,Re)|0,v=v+Math.imul(me,ke)|0,g=g+Math.imul(ie,Oe)|0,f=f+Math.imul(ie,Ce)|0,f=f+Math.imul(oe,Oe)|0,v=v+Math.imul(oe,Ce)|0,g=g+Math.imul(ce,Q)|0,f=f+Math.imul(ce,Y)|0,f=f+Math.imul(ye,Q)|0,v=v+Math.imul(ye,Y)|0,g=g+Math.imul(re,ee)|0,f=f+Math.imul(re,te)|0,f=f+Math.imul(ne,ee)|0,v=v+Math.imul(ne,te)|0,g=g+Math.imul(J,de)|0,f=f+Math.imul(J,pe)|0,f=f+Math.imul(X,de)|0,v=v+Math.imul(X,pe)|0;var lr=(_+g|0)+((f&8191)<<13)|0;_=(v+(f>>>13)|0)+(lr>>>26)|0,lr&=67108863,g=Math.imul(ge,Ae),f=Math.imul(ge,Be),f=f+Math.imul(ve,Ae)|0,v=Math.imul(ve,Be),g=g+Math.imul(se,De)|0,f=f+Math.imul(se,Ie)|0,f=f+Math.imul(fe,De)|0,v=v+Math.imul(fe,Ie)|0,g=g+Math.imul(ue,Re)|0,f=f+Math.imul(ue,ke)|0,f=f+Math.imul(he,Re)|0,v=v+Math.imul(he,ke)|0,g=g+Math.imul(le,Oe)|0,f=f+Math.imul(le,Ce)|0,f=f+Math.imul(me,Oe)|0,v=v+Math.imul(me,Ce)|0,g=g+Math.imul(ie,Q)|0,f=f+Math.imul(ie,Y)|0,f=f+Math.imul(oe,Q)|0,v=v+Math.imul(oe,Y)|0,g=g+Math.imul(ce,ee)|0,f=f+Math.imul(ce,te)|0,f=f+Math.imul(ye,ee)|0,v=v+Math.imul(ye,te)|0,g=g+Math.imul(re,de)|0,f=f+Math.imul(re,pe)|0,f=f+Math.imul(ne,de)|0,v=v+Math.imul(ne,pe)|0;var xt=(_+g|0)+((f&8191)<<13)|0;_=(v+(f>>>13)|0)+(xt>>>26)|0,xt&=67108863,g=Math.imul(ge,De),f=Math.imul(ge,Ie),f=f+Math.imul(ve,De)|0,v=Math.imul(ve,Ie),g=g+Math.imul(se,Re)|0,f=f+Math.imul(se,ke)|0,f=f+Math.imul(fe,Re)|0,v=v+Math.imul(fe,ke)|0,g=g+Math.imul(ue,Oe)|0,f=f+Math.imul(ue,Ce)|0,f=f+Math.imul(he,Oe)|0,v=v+Math.imul(he,Ce)|0,g=g+Math.imul(le,Q)|0,f=f+Math.imul(le,Y)|0,f=f+Math.imul(me,Q)|0,v=v+Math.imul(me,Y)|0,g=g+Math.imul(ie,ee)|0,f=f+Math.imul(ie,te)|0,f=f+Math.imul(oe,ee)|0,v=v+Math.imul(oe,te)|0,g=g+Math.imul(ce,de)|0,f=f+Math.imul(ce,pe)|0,f=f+Math.imul(ye,de)|0,v=v+Math.imul(ye,pe)|0;var ir=(_+g|0)+((f&8191)<<13)|0;_=(v+(f>>>13)|0)+(ir>>>26)|0,ir&=67108863,g=Math.imul(ge,Re),f=Math.imul(ge,ke),f=f+Math.imul(ve,Re)|0,v=Math.imul(ve,ke),g=g+Math.imul(se,Oe)|0,f=f+Math.imul(se,Ce)|0,f=f+Math.imul(fe,Oe)|0,v=v+Math.imul(fe,Ce)|0,g=g+Math.imul(ue,Q)|0,f=f+Math.imul(ue,Y)|0,f=f+Math.imul(he,Q)|0,v=v+Math.imul(he,Y)|0,g=g+Math.imul(le,ee)|0,f=f+Math.imul(le,te)|0,f=f+Math.imul(me,ee)|0,v=v+Math.imul(me,te)|0,g=g+Math.imul(ie,de)|0,f=f+Math.imul(ie,pe)|0,f=f+Math.imul(oe,de)|0,v=v+Math.imul(oe,pe)|0;var dr=(_+g|0)+((f&8191)<<13)|0;_=(v+(f>>>13)|0)+(dr>>>26)|0,dr&=67108863,g=Math.imul(ge,Oe),f=Math.imul(ge,Ce),f=f+Math.imul(ve,Oe)|0,v=Math.imul(ve,Ce),g=g+Math.imul(se,Q)|0,f=f+Math.imul(se,Y)|0,f=f+Math.imul(fe,Q)|0,v=v+Math.imul(fe,Y)|0,g=g+Math.imul(ue,ee)|0,f=f+Math.imul(ue,te)|0,f=f+Math.imul(he,ee)|0,v=v+Math.imul(he,te)|0,g=g+Math.imul(le,de)|0,f=f+Math.imul(le,pe)|0,f=f+Math.imul(me,de)|0,v=v+Math.imul(me,pe)|0;var Er=(_+g|0)+((f&8191)<<13)|0;_=(v+(f>>>13)|0)+(Er>>>26)|0,Er&=67108863,g=Math.imul(ge,Q),f=Math.imul(ge,Y),f=f+Math.imul(ve,Q)|0,v=Math.imul(ve,Y),g=g+Math.imul(se,ee)|0,f=f+Math.imul(se,te)|0,f=f+Math.imul(fe,ee)|0,v=v+Math.imul(fe,te)|0,g=g+Math.imul(ue,de)|0,f=f+Math.imul(ue,pe)|0,f=f+Math.imul(he,de)|0,v=v+Math.imul(he,pe)|0;var Ur=(_+g|0)+((f&8191)<<13)|0;_=(v+(f>>>13)|0)+(Ur>>>26)|0,Ur&=67108863,g=Math.imul(ge,ee),f=Math.imul(ge,te),f=f+Math.imul(ve,ee)|0,v=Math.imul(ve,te),g=g+Math.imul(se,de)|0,f=f+Math.imul(se,pe)|0,f=f+Math.imul(fe,de)|0,v=v+Math.imul(fe,pe)|0;var Rr=(_+g|0)+((f&8191)<<13)|0;_=(v+(f>>>13)|0)+(Rr>>>26)|0,Rr&=67108863,g=Math.imul(ge,de),f=Math.imul(ge,pe),f=f+Math.imul(ve,de)|0,v=Math.imul(ve,pe);var Hr=(_+g|0)+((f&8191)<<13)|0;return _=(v+(f>>>13)|0)+(Hr>>>26)|0,Hr&=67108863,b[0]=bt,b[1]=st,b[2]=Ve,b[3]=Tt,b[4]=Ut,b[5]=Pt,b[6]=yt,b[7]=Rt,b[8]=_t,b[9]=Lr,b[10]=nr,b[11]=lr,b[12]=xt,b[13]=ir,b[14]=dr,b[15]=Er,b[16]=Ur,b[17]=Rr,b[18]=Hr,_!==0&&(b[19]=_,y.length++),y};Math.imul||(M=S);function A(x,c,u){u.negative=c.negative^x.negative,u.length=x.length+c.length;for(var y=0,l=0,h=0;h<u.length-1;h++){var b=l;l=0;for(var _=y&67108863,g=Math.min(h,c.length-1),f=Math.max(0,h-x.length+1);f<=g;f++){var v=h-f,O=x.words[v]|0,T=c.words[f]|0,R=O*T,z=R&67108863;b=b+(R/67108864|0)|0,z=z+_|0,_=z&67108863,b=b+(z>>>26)|0,l+=b>>>26,b&=67108863}u.words[h]=_,y=b,b=l}return y!==0?u.words[h]=y:u.length--,u.strip()}function B(x,c,u){var y=new I;return y.mulp(x,c,u)}i.prototype.mulTo=function(c,u){var y,l=this.length+c.length;return this.length===10&&c.length===10?y=M(this,c,u):l<63?y=S(this,c,u):l<1024?y=A(this,c,u):y=B(this,c,u),y};function I(x,c){this.x=x,this.y=c}I.prototype.makeRBT=function(c){for(var u=new Array(c),y=i.prototype._countBits(c)-1,l=0;l<c;l++)u[l]=this.revBin(l,y,c);return u},I.prototype.revBin=function(c,u,y){if(c===0||c===y-1)return c;for(var l=0,h=0;h<u;h++)l|=(c&1)<<u-h-1,c>>=1;return l},I.prototype.permute=function(c,u,y,l,h,b){for(var _=0;_<b;_++)l[_]=u[c[_]],h[_]=y[c[_]]},I.prototype.transform=function(c,u,y,l,h,b){this.permute(b,c,u,y,l,h);for(var _=1;_<h;_<<=1)for(var g=_<<1,f=Math.cos(2*Math.PI/g),v=Math.sin(2*Math.PI/g),O=0;O<h;O+=g)for(var T=f,R=v,z=0;z<_;z++){var V=y[O+z],W=l[O+z],Z=y[O+z+_],J=l[O+z+_],X=T*Z-R*J;J=T*J+R*Z,Z=X,y[O+z]=V+Z,l[O+z]=W+J,y[O+z+_]=V-Z,l[O+z+_]=W-J,z!==g&&(X=f*T-v*R,R=f*R+v*T,T=X)}},I.prototype.guessLen13b=function(c,u){var y=Math.max(u,c)|1,l=y&1,h=0;for(y=y/2|0;y;y=y>>>1)h++;return 1<<h+1+l},I.prototype.conjugate=function(c,u,y){if(!(y<=1))for(var l=0;l<y/2;l++){var h=c[l];c[l]=c[y-l-1],c[y-l-1]=h,h=u[l],u[l]=-u[y-l-1],u[y-l-1]=-h}},I.prototype.normalize13b=function(c,u){for(var y=0,l=0;l<u/2;l++){var h=Math.round(c[2*l+1]/u)*8192+Math.round(c[2*l]/u)+y;c[l]=h&67108863,h<67108864?y=0:y=h/67108864|0}return c},I.prototype.convert13b=function(c,u,y,l){for(var h=0,b=0;b<u;b++)h=h+(c[b]|0),y[2*b]=h&8191,h=h>>>13,y[2*b+1]=h&8191,h=h>>>13;for(b=2*u;b<l;++b)y[b]=0;r(h===0),r((h&-8192)===0)},I.prototype.stub=function(c){for(var u=new Array(c),y=0;y<c;y++)u[y]=0;return u},I.prototype.mulp=function(c,u,y){var l=2*this.guessLen13b(c.length,u.length),h=this.makeRBT(l),b=this.stub(l),_=new Array(l),g=new Array(l),f=new Array(l),v=new Array(l),O=new Array(l),T=new Array(l),R=y.words;R.length=l,this.convert13b(c.words,c.length,_,l),this.convert13b(u.words,u.length,v,l),this.transform(_,b,g,f,l,h),this.transform(v,b,O,T,l,h);for(var z=0;z<l;z++){var V=g[z]*O[z]-f[z]*T[z];f[z]=g[z]*T[z]+f[z]*O[z],g[z]=V}return this.conjugate(g,f,l),this.transform(g,f,R,b,l,h),this.conjugate(R,b,l),this.normalize13b(R,l),y.negative=c.negative^u.negative,y.length=c.length+u.length,y.strip()},i.prototype.mul=function(c){var u=new i(null);return u.words=new Array(this.length+c.length),this.mulTo(c,u)},i.prototype.mulf=function(c){var u=new i(null);return u.words=new Array(this.length+c.length),B(this,c,u)},i.prototype.imul=function(c){return this.clone().mulTo(c,this)},i.prototype.imuln=function(c){r(typeof c=="number"),r(c<67108864);for(var u=0,y=0;y<this.length;y++){var l=(this.words[y]|0)*c,h=(l&67108863)+(u&67108863);u>>=26,u+=l/67108864|0,u+=h>>>26,this.words[y]=h&67108863}return u!==0&&(this.words[y]=u,this.length++),this},i.prototype.muln=function(c){return this.clone().imuln(c)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(c){var u=P(c);if(u.length===0)return new i(1);for(var y=this,l=0;l<u.length&&u[l]===0;l++,y=y.sqr());if(++l<u.length)for(var h=y.sqr();l<u.length;l++,h=h.sqr())u[l]!==0&&(y=y.mul(h));return y},i.prototype.iushln=function(c){r(typeof c=="number"&&c>=0);var u=c%26,y=(c-u)/26,l=67108863>>>26-u<<26-u,h;if(u!==0){var b=0;for(h=0;h<this.length;h++){var _=this.words[h]&l,g=(this.words[h]|0)-_<<u;this.words[h]=g|b,b=_>>>26-u}b&&(this.words[h]=b,this.length++)}if(y!==0){for(h=this.length-1;h>=0;h--)this.words[h+y]=this.words[h];for(h=0;h<y;h++)this.words[h]=0;this.length+=y}return this.strip()},i.prototype.ishln=function(c){return r(this.negative===0),this.iushln(c)},i.prototype.iushrn=function(c,u,y){r(typeof c=="number"&&c>=0);var l;u?l=(u-u%26)/26:l=0;var h=c%26,b=Math.min((c-h)/26,this.length),_=67108863^67108863>>>h<<h,g=y;if(l-=b,l=Math.max(0,l),g){for(var f=0;f<b;f++)g.words[f]=this.words[f];g.length=b}if(b!==0)if(this.length>b)for(this.length-=b,f=0;f<this.length;f++)this.words[f]=this.words[f+b];else this.words[0]=0,this.length=1;var v=0;for(f=this.length-1;f>=0&&(v!==0||f>=l);f--){var O=this.words[f]|0;this.words[f]=v<<26-h|O>>>h,v=O&_}return g&&v!==0&&(g.words[g.length++]=v),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},i.prototype.ishrn=function(c,u,y){return r(this.negative===0),this.iushrn(c,u,y)},i.prototype.shln=function(c){return this.clone().ishln(c)},i.prototype.ushln=function(c){return this.clone().iushln(c)},i.prototype.shrn=function(c){return this.clone().ishrn(c)},i.prototype.ushrn=function(c){return this.clone().iushrn(c)},i.prototype.testn=function(c){r(typeof c=="number"&&c>=0);var u=c%26,y=(c-u)/26,l=1<<u;if(this.length<=y)return!1;var h=this.words[y];return!!(h&l)},i.prototype.imaskn=function(c){r(typeof c=="number"&&c>=0);var u=c%26,y=(c-u)/26;if(r(this.negative===0,"imaskn works only with positive numbers"),this.length<=y)return this;if(u!==0&&y++,this.length=Math.min(y,this.length),u!==0){var l=67108863^67108863>>>u<<u;this.words[this.length-1]&=l}return this.strip()},i.prototype.maskn=function(c){return this.clone().imaskn(c)},i.prototype.iaddn=function(c){return r(typeof c=="number"),r(c<67108864),c<0?this.isubn(-c):this.negative!==0?this.length===1&&(this.words[0]|0)<c?(this.words[0]=c-(this.words[0]|0),this.negative=0,this):(this.negative=0,this.isubn(c),this.negative=1,this):this._iaddn(c)},i.prototype._iaddn=function(c){this.words[0]+=c;for(var u=0;u<this.length&&this.words[u]>=67108864;u++)this.words[u]-=67108864,u===this.length-1?this.words[u+1]=1:this.words[u+1]++;return this.length=Math.max(this.length,u+1),this},i.prototype.isubn=function(c){if(r(typeof c=="number"),r(c<67108864),c<0)return this.iaddn(-c);if(this.negative!==0)return this.negative=0,this.iaddn(c),this.negative=1,this;if(this.words[0]-=c,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var u=0;u<this.length&&this.words[u]<0;u++)this.words[u]+=67108864,this.words[u+1]-=1;return this.strip()},i.prototype.addn=function(c){return this.clone().iaddn(c)},i.prototype.subn=function(c){return this.clone().isubn(c)},i.prototype.iabs=function(){return this.negative=0,this},i.prototype.abs=function(){return this.clone().iabs()},i.prototype._ishlnsubmul=function(c,u,y){var l=c.length+y,h;this._expand(l);var b,_=0;for(h=0;h<c.length;h++){b=(this.words[h+y]|0)+_;var g=(c.words[h]|0)*u;b-=g&67108863,_=(b>>26)-(g/67108864|0),this.words[h+y]=b&67108863}for(;h<this.length-y;h++)b=(this.words[h+y]|0)+_,_=b>>26,this.words[h+y]=b&67108863;if(_===0)return this.strip();for(r(_===-1),_=0,h=0;h<this.length;h++)b=-(this.words[h]|0)+_,_=b>>26,this.words[h]=b&67108863;return this.negative=1,this.strip()},i.prototype._wordDiv=function(c,u){var y=this.length-c.length,l=this.clone(),h=c,b=h.words[h.length-1]|0,_=this._countBits(b);y=26-_,y!==0&&(h=h.ushln(y),l.iushln(y),b=h.words[h.length-1]|0);var g=l.length-h.length,f;if(u!=="mod"){f=new i(null),f.length=g+1,f.words=new Array(f.length);for(var v=0;v<f.length;v++)f.words[v]=0}var O=l.clone()._ishlnsubmul(h,1,g);O.negative===0&&(l=O,f&&(f.words[g]=1));for(var T=g-1;T>=0;T--){var R=(l.words[h.length+T]|0)*67108864+(l.words[h.length+T-1]|0);for(R=Math.min(R/b|0,67108863),l._ishlnsubmul(h,R,T);l.negative!==0;)R--,l.negative=0,l._ishlnsubmul(h,1,T),l.isZero()||(l.negative^=1);f&&(f.words[T]=R)}return f&&f.strip(),l.strip(),u!=="div"&&y!==0&&l.iushrn(y),{div:f||null,mod:l}},i.prototype.divmod=function(c,u,y){if(r(!c.isZero()),this.isZero())return{div:new i(0),mod:new i(0)};var l,h,b;return this.negative!==0&&c.negative===0?(b=this.neg().divmod(c,u),u!=="mod"&&(l=b.div.neg()),u!=="div"&&(h=b.mod.neg(),y&&h.negative!==0&&h.iadd(c)),{div:l,mod:h}):this.negative===0&&c.negative!==0?(b=this.divmod(c.neg(),u),u!=="mod"&&(l=b.div.neg()),{div:l,mod:b.mod}):this.negative&c.negative?(b=this.neg().divmod(c.neg(),u),u!=="div"&&(h=b.mod.neg(),y&&h.negative!==0&&h.isub(c)),{div:b.div,mod:h}):c.length>this.length||this.cmp(c)<0?{div:new i(0),mod:this}:c.length===1?u==="div"?{div:this.divn(c.words[0]),mod:null}:u==="mod"?{div:null,mod:new i(this.modn(c.words[0]))}:{div:this.divn(c.words[0]),mod:new i(this.modn(c.words[0]))}:this._wordDiv(c,u)},i.prototype.div=function(c){return this.divmod(c,"div",!1).div},i.prototype.mod=function(c){return this.divmod(c,"mod",!1).mod},i.prototype.umod=function(c){return this.divmod(c,"mod",!0).mod},i.prototype.divRound=function(c){var u=this.divmod(c);if(u.mod.isZero())return u.div;var y=u.div.negative!==0?u.mod.isub(c):u.mod,l=c.ushrn(1),h=c.andln(1),b=y.cmp(l);return b<0||h===1&&b===0?u.div:u.div.negative!==0?u.div.isubn(1):u.div.iaddn(1)},i.prototype.modn=function(c){r(c<=67108863);for(var u=(1<<26)%c,y=0,l=this.length-1;l>=0;l--)y=(u*y+(this.words[l]|0))%c;return y},i.prototype.idivn=function(c){r(c<=67108863);for(var u=0,y=this.length-1;y>=0;y--){var l=(this.words[y]|0)+u*67108864;this.words[y]=l/c|0,u=l%c}return this.strip()},i.prototype.divn=function(c){return this.clone().idivn(c)},i.prototype.egcd=function(c){r(c.negative===0),r(!c.isZero());var u=this,y=c.clone();u.negative!==0?u=u.umod(c):u=u.clone();for(var l=new i(1),h=new i(0),b=new i(0),_=new i(1),g=0;u.isEven()&&y.isEven();)u.iushrn(1),y.iushrn(1),++g;for(var f=y.clone(),v=u.clone();!u.isZero();){for(var O=0,T=1;!(u.words[0]&T)&&O<26;++O,T<<=1);if(O>0)for(u.iushrn(O);O-- >0;)(l.isOdd()||h.isOdd())&&(l.iadd(f),h.isub(v)),l.iushrn(1),h.iushrn(1);for(var R=0,z=1;!(y.words[0]&z)&&R<26;++R,z<<=1);if(R>0)for(y.iushrn(R);R-- >0;)(b.isOdd()||_.isOdd())&&(b.iadd(f),_.isub(v)),b.iushrn(1),_.iushrn(1);u.cmp(y)>=0?(u.isub(y),l.isub(b),h.isub(_)):(y.isub(u),b.isub(l),_.isub(h))}return{a:b,b:_,gcd:y.iushln(g)}},i.prototype._invmp=function(c){r(c.negative===0),r(!c.isZero());var u=this,y=c.clone();u.negative!==0?u=u.umod(c):u=u.clone();for(var l=new i(1),h=new i(0),b=y.clone();u.cmpn(1)>0&&y.cmpn(1)>0;){for(var _=0,g=1;!(u.words[0]&g)&&_<26;++_,g<<=1);if(_>0)for(u.iushrn(_);_-- >0;)l.isOdd()&&l.iadd(b),l.iushrn(1);for(var f=0,v=1;!(y.words[0]&v)&&f<26;++f,v<<=1);if(f>0)for(y.iushrn(f);f-- >0;)h.isOdd()&&h.iadd(b),h.iushrn(1);u.cmp(y)>=0?(u.isub(y),l.isub(h)):(y.isub(u),h.isub(l))}var O;return u.cmpn(1)===0?O=l:O=h,O.cmpn(0)<0&&O.iadd(c),O},i.prototype.gcd=function(c){if(this.isZero())return c.abs();if(c.isZero())return this.abs();var u=this.clone(),y=c.clone();u.negative=0,y.negative=0;for(var l=0;u.isEven()&&y.isEven();l++)u.iushrn(1),y.iushrn(1);do{for(;u.isEven();)u.iushrn(1);for(;y.isEven();)y.iushrn(1);var h=u.cmp(y);if(h<0){var b=u;u=y,y=b}else if(h===0||y.cmpn(1)===0)break;u.isub(y)}while(!0);return y.iushln(l)},i.prototype.invm=function(c){return this.egcd(c).a.umod(c)},i.prototype.isEven=function(){return(this.words[0]&1)===0},i.prototype.isOdd=function(){return(this.words[0]&1)===1},i.prototype.andln=function(c){return this.words[0]&c},i.prototype.bincn=function(c){r(typeof c=="number");var u=c%26,y=(c-u)/26,l=1<<u;if(this.length<=y)return this._expand(y+1),this.words[y]|=l,this;for(var h=l,b=y;h!==0&&b<this.length;b++){var _=this.words[b]|0;_+=h,h=_>>>26,_&=67108863,this.words[b]=_}return h!==0&&(this.words[b]=h,this.length++),this},i.prototype.isZero=function(){return this.length===1&&this.words[0]===0},i.prototype.cmpn=function(c){var u=c<0;if(this.negative!==0&&!u)return-1;if(this.negative===0&&u)return 1;this.strip();var y;if(this.length>1)y=1;else{u&&(c=-c),r(c<=67108863,"Number is too big");var l=this.words[0]|0;y=l===c?0:l<c?-1:1}return this.negative!==0?-y|0:y},i.prototype.cmp=function(c){if(this.negative!==0&&c.negative===0)return-1;if(this.negative===0&&c.negative!==0)return 1;var u=this.ucmp(c);return this.negative!==0?-u|0:u},i.prototype.ucmp=function(c){if(this.length>c.length)return 1;if(this.length<c.length)return-1;for(var u=0,y=this.length-1;y>=0;y--){var l=this.words[y]|0,h=c.words[y]|0;if(l!==h){l<h?u=-1:l>h&&(u=1);break}}return u},i.prototype.gtn=function(c){return this.cmpn(c)===1},i.prototype.gt=function(c){return this.cmp(c)===1},i.prototype.gten=function(c){return this.cmpn(c)>=0},i.prototype.gte=function(c){return this.cmp(c)>=0},i.prototype.ltn=function(c){return this.cmpn(c)===-1},i.prototype.lt=function(c){return this.cmp(c)===-1},i.prototype.lten=function(c){return this.cmpn(c)<=0},i.prototype.lte=function(c){return this.cmp(c)<=0},i.prototype.eqn=function(c){return this.cmpn(c)===0},i.prototype.eq=function(c){return this.cmp(c)===0},i.red=function(c){return new N(c)},i.prototype.toRed=function(c){return r(!this.red,"Already a number in reduction context"),r(this.negative===0,"red works only with positives"),c.convertTo(this)._forceRed(c)},i.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(c){return this.red=c,this},i.prototype.forceRed=function(c){return r(!this.red,"Already a number in reduction context"),this._forceRed(c)},i.prototype.redAdd=function(c){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,c)},i.prototype.redIAdd=function(c){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,c)},i.prototype.redSub=function(c){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,c)},i.prototype.redISub=function(c){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,c)},i.prototype.redShl=function(c){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,c)},i.prototype.redMul=function(c){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,c),this.red.mul(this,c)},i.prototype.redIMul=function(c){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,c),this.red.imul(this,c)},i.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(c){return r(this.red&&!c.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,c)};var C={k256:null,p224:null,p192:null,p25519:null};function k(x,c){this.name=x,this.p=new i(c,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}k.prototype._tmp=function(){var c=new i(null);return c.words=new Array(Math.ceil(this.n/13)),c},k.prototype.ireduce=function(c){var u=c,y;do this.split(u,this.tmp),u=this.imulK(u),u=u.iadd(this.tmp),y=u.bitLength();while(y>this.n);var l=y<this.n?-1:u.ucmp(this.p);return l===0?(u.words[0]=0,u.length=1):l>0?u.isub(this.p):u.strip!==void 0?u.strip():u._strip(),u},k.prototype.split=function(c,u){c.iushrn(this.n,0,u)},k.prototype.imulK=function(c){return c.imul(this.k)};function q(){k.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}n(q,k),q.prototype.split=function(c,u){for(var y=4194303,l=Math.min(c.length,9),h=0;h<l;h++)u.words[h]=c.words[h];if(u.length=l,c.length<=9){c.words[0]=0,c.length=1;return}var b=c.words[9];for(u.words[u.length++]=b&y,h=10;h<c.length;h++){var _=c.words[h]|0;c.words[h-10]=(_&y)<<4|b>>>22,b=_}b>>>=22,c.words[h-10]=b,b===0&&c.length>10?c.length-=10:c.length-=9},q.prototype.imulK=function(c){c.words[c.length]=0,c.words[c.length+1]=0,c.length+=2;for(var u=0,y=0;y<c.length;y++){var l=c.words[y]|0;u+=l*977,c.words[y]=u&67108863,u=l*64+(u/67108864|0)}return c.words[c.length-1]===0&&(c.length--,c.words[c.length-1]===0&&c.length--),c};function L(){k.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}n(L,k);function U(){k.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}n(U,k);function F(){k.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}n(F,k),F.prototype.imulK=function(c){for(var u=0,y=0;y<c.length;y++){var l=(c.words[y]|0)*19+u,h=l&67108863;l>>>=26,c.words[y]=h,u=l}return u!==0&&(c.words[c.length++]=u),c},i._prime=function(c){if(C[c])return C[c];var u;if(c==="k256")u=new q;else if(c==="p224")u=new L;else if(c==="p192")u=new U;else if(c==="p25519")u=new F;else throw new Error("Unknown prime "+c);return C[c]=u,u};function N(x){if(typeof x=="string"){var c=i._prime(x);this.m=c.p,this.prime=c}else r(x.gtn(1),"modulus must be greater than 1"),this.m=x,this.prime=null}N.prototype._verify1=function(c){r(c.negative===0,"red works only with positives"),r(c.red,"red works only with red numbers")},N.prototype._verify2=function(c,u){r((c.negative|u.negative)===0,"red works only with positives"),r(c.red&&c.red===u.red,"red works only with red numbers")},N.prototype.imod=function(c){return this.prime?this.prime.ireduce(c)._forceRed(this):c.umod(this.m)._forceRed(this)},N.prototype.neg=function(c){return c.isZero()?c.clone():this.m.sub(c)._forceRed(this)},N.prototype.add=function(c,u){this._verify2(c,u);var y=c.add(u);return y.cmp(this.m)>=0&&y.isub(this.m),y._forceRed(this)},N.prototype.iadd=function(c,u){this._verify2(c,u);var y=c.iadd(u);return y.cmp(this.m)>=0&&y.isub(this.m),y},N.prototype.sub=function(c,u){this._verify2(c,u);var y=c.sub(u);return y.cmpn(0)<0&&y.iadd(this.m),y._forceRed(this)},N.prototype.isub=function(c,u){this._verify2(c,u);var y=c.isub(u);return y.cmpn(0)<0&&y.iadd(this.m),y},N.prototype.shl=function(c,u){return this._verify1(c),this.imod(c.ushln(u))},N.prototype.imul=function(c,u){return this._verify2(c,u),this.imod(c.imul(u))},N.prototype.mul=function(c,u){return this._verify2(c,u),this.imod(c.mul(u))},N.prototype.isqr=function(c){return this.imul(c,c.clone())},N.prototype.sqr=function(c){return this.mul(c,c)},N.prototype.sqrt=function(c){if(c.isZero())return c.clone();var u=this.m.andln(3);if(r(u%2===1),u===3){var y=this.m.add(new i(1)).iushrn(2);return this.pow(c,y)}for(var l=this.m.subn(1),h=0;!l.isZero()&&l.andln(1)===0;)h++,l.iushrn(1);r(!l.isZero());var b=new i(1).toRed(this),_=b.redNeg(),g=this.m.subn(1).iushrn(1),f=this.m.bitLength();for(f=new i(2*f*f).toRed(this);this.pow(f,g).cmp(_)!==0;)f.redIAdd(_);for(var v=this.pow(f,l),O=this.pow(c,l.addn(1).iushrn(1)),T=this.pow(c,l),R=h;T.cmp(b)!==0;){for(var z=T,V=0;z.cmp(b)!==0;V++)z=z.redSqr();r(V<R);var W=this.pow(v,new i(1).iushln(R-V-1));O=O.redMul(W),v=W.redSqr(),T=T.redMul(v),R=V}return O},N.prototype.invm=function(c){var u=c._invmp(this.m);return u.negative!==0?(u.negative=0,this.imod(u).redNeg()):this.imod(u)},N.prototype.pow=function(c,u){if(u.isZero())return new i(1).toRed(this);if(u.cmpn(1)===0)return c.clone();var y=4,l=new Array(1<<y);l[0]=new i(1).toRed(this),l[1]=c;for(var h=2;h<l.length;h++)l[h]=this.mul(l[h-1],c);var b=l[0],_=0,g=0,f=u.bitLength()%26;for(f===0&&(f=26),h=u.length-1;h>=0;h--){for(var v=u.words[h],O=f-1;O>=0;O--){var T=v>>O&1;if(b!==l[0]&&(b=this.sqr(b)),T===0&&_===0){g=0;continue}_<<=1,_|=T,g++,!(g!==y&&(h!==0||O!==0))&&(b=this.mul(b,l[_]),g=0,_=0)}f=26}return b},N.prototype.convertTo=function(c){var u=c.umod(this.m);return u===c?u.clone():u},N.prototype.convertFrom=function(c){var u=c.clone();return u.red=null,u},i.mont=function(c){return new G(c)};function G(x){N.call(this,x),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new i(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}n(G,N),G.prototype.convertTo=function(c){return this.imod(c.ushln(this.shift))},G.prototype.convertFrom=function(c){var u=this.imod(c.mul(this.rinv));return u.red=null,u},G.prototype.imul=function(c,u){if(c.isZero()||u.isZero())return c.words[0]=0,c.length=1,c;var y=c.imul(u),l=y.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),h=y.isub(l).iushrn(this.shift),b=h;return h.cmp(this.m)>=0?b=h.isub(this.m):h.cmpn(0)<0&&(b=h.iadd(this.m)),b._forceRed(this)},G.prototype.mul=function(c,u){if(c.isZero()||u.isZero())return new i(0)._forceRed(this);var y=c.mul(u),l=y.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),h=y.isub(l).iushrn(this.shift),b=h;return h.cmp(this.m)>=0?b=h.isub(this.m):h.cmpn(0)<0&&(b=h.iadd(this.m)),b._forceRed(this)},G.prototype.invm=function(c){var u=this.imod(c._invmp(this.m).mul(this.r2));return u._forceRed(this)}})(typeof f7>"u"||f7,VX)});var u7=H(JX=>{"use strict";E();var gM=JX;function wTe(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var r=[];if(typeof t!="string"){for(var n=0;n<t.length;n++)r[n]=t[n]|0;return r}if(e==="hex"){t=t.replace(/[^a-z0-9]+/ig,""),t.length%2!==0&&(t="0"+t);for(var n=0;n<t.length;n+=2)r.push(parseInt(t[n]+t[n+1],16))}else for(var n=0;n<t.length;n++){var i=t.charCodeAt(n),o=i>>8,s=i&255;o?r.push(o,s):r.push(s)}return r}gM.toArray=wTe;function HX(t){return t.length===1?"0"+t:t}gM.zero2=HX;function ZX(t){for(var e="",r=0;r<t.length;r++)e+=HX(t[r].toString(16));return e}gM.toHex=ZX;gM.encode=function(e,r){return r==="hex"?ZX(e):e}});var Ya=H(YX=>{"use strict";E();var Df=YX,_Te=Wu(),xTe=Ja(),vM=u7();Df.assert=xTe;Df.toArray=vM.toArray;Df.zero2=vM.zero2;Df.toHex=vM.toHex;Df.encode=vM.encode;function ETe(t,e,r){var n=new Array(Math.max(t.bitLength(),r)+1);n.fill(0);for(var i=1<<e+1,o=t.clone(),s=0;s<n.length;s++){var a,d=o.andln(i-1);o.isOdd()?(d>(i>>1)-1?a=(i>>1)-d:a=d,o.isubn(a)):a=0,n[s]=a,o.iushrn(1)}return n}Df.getNAF=ETe;function STe(t,e){var r=[[],[]];t=t.clone(),e=e.clone();for(var n=0,i=0,o;t.cmpn(-n)>0||e.cmpn(-i)>0;){var s=t.andln(3)+n&3,a=e.andln(3)+i&3;s===3&&(s=-1),a===3&&(a=-1);var d;s&1?(o=t.andln(7)+n&7,(o===3||o===5)&&a===2?d=-s:d=s):d=0,r[0].push(d);var m;a&1?(o=e.andln(7)+i&7,(o===3||o===5)&&s===2?m=-a:m=a):m=0,r[1].push(m),2*n===d+1&&(n=1-n),2*i===m+1&&(i=1-i),t.iushrn(1),e.iushrn(1)}return r}Df.getJSF=STe;function MTe(t,e,r){var n="_"+e;t.prototype[e]=function(){return this[n]!==void 0?this[n]:this[n]=r.call(this)}}Df.cachedProperty=MTe;function PTe(t){return typeof t=="string"?Df.toArray(t,"hex"):t}Df.parseBytes=PTe;function ATe(t){return new _Te(t,"hex","le")}Df.intFromLE=ATe});var i_=H((pyt,QX)=>{"use strict";E();var jm=Wu(),n_=Ya(),bM=n_.getNAF,TTe=n_.getJSF,wM=n_.assert;function hp(t,e){this.type=t,this.p=new jm(e.p,16),this.red=e.prime?jm.red(e.prime):jm.mont(this.p),this.zero=new jm(0).toRed(this.red),this.one=new jm(1).toRed(this.red),this.two=new jm(2).toRed(this.red),this.n=e.n&&new jm(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}QX.exports=hp;hp.prototype.point=function(){throw new Error("Not implemented")};hp.prototype.validate=function(){throw new Error("Not implemented")};hp.prototype._fixedNafMul=function(e,r){wM(e.precomputed);var n=e._getDoubles(),i=bM(r,1,this._bitLength),o=(1<<n.step+1)-(n.step%2===0?2:1);o/=3;var s=[],a,d;for(a=0;a<i.length;a+=n.step){d=0;for(var m=a+n.step-1;m>=a;m--)d=(d<<1)+i[m];s.push(d)}for(var p=this.jpoint(null,null,null),w=this.jpoint(null,null,null),P=o;P>0;P--){for(a=0;a<s.length;a++)d=s[a],d===P?w=w.mixedAdd(n.points[a]):d===-P&&(w=w.mixedAdd(n.points[a].neg()));p=p.add(w)}return p.toP()};hp.prototype._wnafMul=function(e,r){var n=4,i=e._getNAFPoints(n);n=i.wnd;for(var o=i.points,s=bM(r,n,this._bitLength),a=this.jpoint(null,null,null),d=s.length-1;d>=0;d--){for(var m=0;d>=0&&s[d]===0;d--)m++;if(d>=0&&m++,a=a.dblp(m),d<0)break;var p=s[d];wM(p!==0),e.type==="affine"?p>0?a=a.mixedAdd(o[p-1>>1]):a=a.mixedAdd(o[-p-1>>1].neg()):p>0?a=a.add(o[p-1>>1]):a=a.add(o[-p-1>>1].neg())}return e.type==="affine"?a.toP():a};hp.prototype._wnafMulAdd=function(e,r,n,i,o){var s=this._wnafT1,a=this._wnafT2,d=this._wnafT3,m=0,p,w,P;for(p=0;p<i;p++){P=r[p];var S=P._getNAFPoints(e);s[p]=S.wnd,a[p]=S.points}for(p=i-1;p>=1;p-=2){var M=p-1,A=p;if(s[M]!==1||s[A]!==1){d[M]=bM(n[M],s[M],this._bitLength),d[A]=bM(n[A],s[A],this._bitLength),m=Math.max(d[M].length,m),m=Math.max(d[A].length,m);continue}var B=[r[M],null,null,r[A]];r[M].y.cmp(r[A].y)===0?(B[1]=r[M].add(r[A]),B[2]=r[M].toJ().mixedAdd(r[A].neg())):r[M].y.cmp(r[A].y.redNeg())===0?(B[1]=r[M].toJ().mixedAdd(r[A]),B[2]=r[M].add(r[A].neg())):(B[1]=r[M].toJ().mixedAdd(r[A]),B[2]=r[M].toJ().mixedAdd(r[A].neg()));var I=[-3,-1,-5,-7,0,7,5,1,3],C=TTe(n[M],n[A]);for(m=Math.max(C[0].length,m),d[M]=new Array(m),d[A]=new Array(m),w=0;w<m;w++){var k=C[0][w]|0,q=C[1][w]|0;d[M][w]=I[(k+1)*3+(q+1)],d[A][w]=0,a[M]=B}}var L=this.jpoint(null,null,null),U=this._wnafT4;for(p=m;p>=0;p--){for(var F=0;p>=0;){var N=!0;for(w=0;w<i;w++)U[w]=d[w][p]|0,U[w]!==0&&(N=!1);if(!N)break;F++,p--}if(p>=0&&F++,L=L.dblp(F),p<0)break;for(w=0;w<i;w++){var G=U[w];G!==0&&(G>0?P=a[w][G-1>>1]:G<0&&(P=a[w][-G-1>>1].neg()),P.type==="affine"?L=L.mixedAdd(P):L=L.add(P))}}for(p=0;p<i;p++)a[p]=null;return o?L:L.toP()};function $c(t,e){this.curve=t,this.type=e,this.precomputed=null}hp.BasePoint=$c;$c.prototype.eq=function(){throw new Error("Not implemented")};$c.prototype.validate=function(){return this.curve.validate(this)};hp.prototype.decodePoint=function(e,r){e=n_.toArray(e,r);var n=this.p.byteLength();if((e[0]===4||e[0]===6||e[0]===7)&&e.length-1===2*n){e[0]===6?wM(e[e.length-1]%2===0):e[0]===7&&wM(e[e.length-1]%2===1);var i=this.point(e.slice(1,1+n),e.slice(1+n,1+2*n));return i}else if((e[0]===2||e[0]===3)&&e.length-1===n)return this.pointFromX(e.slice(1,1+n),e[0]===3);throw new Error("Unknown point format")};$c.prototype.encodeCompressed=function(e){return this.encode(e,!0)};$c.prototype._encode=function(e){var r=this.curve.p.byteLength(),n=this.getX().toArray("be",r);return e?[this.getY().isEven()?2:3].concat(n):[4].concat(n,this.getY().toArray("be",r))};$c.prototype.encode=function(e,r){return n_.encode(this._encode(r),e)};$c.prototype.precompute=function(e){if(this.precomputed)return this;var r={doubles:null,naf:null,beta:null};return r.naf=this._getNAFPoints(8),r.doubles=this._getDoubles(4,e),r.beta=this._getBeta(),this.precomputed=r,this};$c.prototype._hasDoubles=function(e){if(!this.precomputed)return!1;var r=this.precomputed.doubles;return r?r.points.length>=Math.ceil((e.bitLength()+1)/r.step):!1};$c.prototype._getDoubles=function(e,r){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var n=[this],i=this,o=0;o<r;o+=e){for(var s=0;s<e;s++)i=i.dbl();n.push(i)}return{step:e,points:n}};$c.prototype._getNAFPoints=function(e){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var r=[this],n=(1<<e)-1,i=n===1?null:this.dbl(),o=1;o<n;o++)r[o]=r[o-1].add(i);return{wnd:e,points:r}};$c.prototype._getBeta=function(){return null};$c.prototype.dblp=function(e){for(var r=this,n=0;n<e;n++)r=r.dbl();return r}});var eee=H((yyt,XX)=>{"use strict";E();var RTe=Ya(),Ti=Wu(),l7=It(),Kv=i_(),ITe=RTe.assert;function Lc(t){Kv.call(this,"short",t),this.a=new Ti(t.a,16).toRed(this.red),this.b=new Ti(t.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=this.a.fromRed().cmpn(0)===0,this.threeA=this.a.fromRed().sub(this.p).cmpn(-3)===0,this.endo=this._getEndomorphism(t),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}l7(Lc,Kv);XX.exports=Lc;Lc.prototype._getEndomorphism=function(e){if(!(!this.zeroA||!this.g||!this.n||this.p.modn(3)!==1)){var r,n;if(e.beta)r=new Ti(e.beta,16).toRed(this.red);else{var i=this._getEndoRoots(this.p);r=i[0].cmp(i[1])<0?i[0]:i[1],r=r.toRed(this.red)}if(e.lambda)n=new Ti(e.lambda,16);else{var o=this._getEndoRoots(this.n);this.g.mul(o[0]).x.cmp(this.g.x.redMul(r))===0?n=o[0]:(n=o[1],ITe(this.g.mul(n).x.cmp(this.g.x.redMul(r))===0))}var s;return e.basis?s=e.basis.map(function(a){return{a:new Ti(a.a,16),b:new Ti(a.b,16)}}):s=this._getEndoBasis(n),{beta:r,lambda:n,basis:s}}};Lc.prototype._getEndoRoots=function(e){var r=e===this.p?this.red:Ti.mont(e),n=new Ti(2).toRed(r).redInvm(),i=n.redNeg(),o=new Ti(3).toRed(r).redNeg().redSqrt().redMul(n),s=i.redAdd(o).fromRed(),a=i.redSub(o).fromRed();return[s,a]};Lc.prototype._getEndoBasis=function(e){for(var r=this.n.ushrn(Math.floor(this.n.bitLength()/2)),n=e,i=this.n.clone(),o=new Ti(1),s=new Ti(0),a=new Ti(0),d=new Ti(1),m,p,w,P,S,M,A,B=0,I,C;n.cmpn(0)!==0;){var k=i.div(n);I=i.sub(k.mul(n)),C=a.sub(k.mul(o));var q=d.sub(k.mul(s));if(!w&&I.cmp(r)<0)m=A.neg(),p=o,w=I.neg(),P=C;else if(w&&++B===2)break;A=I,i=n,n=I,a=o,o=C,d=s,s=q}S=I.neg(),M=C;var L=w.sqr().add(P.sqr()),U=S.sqr().add(M.sqr());return U.cmp(L)>=0&&(S=m,M=p),w.negative&&(w=w.neg(),P=P.neg()),S.negative&&(S=S.neg(),M=M.neg()),[{a:w,b:P},{a:S,b:M}]};Lc.prototype._endoSplit=function(e){var r=this.endo.basis,n=r[0],i=r[1],o=i.b.mul(e).divRound(this.n),s=n.b.neg().mul(e).divRound(this.n),a=o.mul(n.a),d=s.mul(i.a),m=o.mul(n.b),p=s.mul(i.b),w=e.sub(a).sub(d),P=m.add(p).neg();return{k1:w,k2:P}};Lc.prototype.pointFromX=function(e,r){e=new Ti(e,16),e.red||(e=e.toRed(this.red));var n=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),i=n.redSqrt();if(i.redSqr().redSub(n).cmp(this.zero)!==0)throw new Error("invalid point");var o=i.fromRed().isOdd();return(r&&!o||!r&&o)&&(i=i.redNeg()),this.point(e,i)};Lc.prototype.validate=function(e){if(e.inf)return!0;var r=e.x,n=e.y,i=this.a.redMul(r),o=r.redSqr().redMul(r).redIAdd(i).redIAdd(this.b);return n.redSqr().redISub(o).cmpn(0)===0};Lc.prototype._endoWnafMulAdd=function(e,r,n){for(var i=this._endoWnafT1,o=this._endoWnafT2,s=0;s<e.length;s++){var a=this._endoSplit(r[s]),d=e[s],m=d._getBeta();a.k1.negative&&(a.k1.ineg(),d=d.neg(!0)),a.k2.negative&&(a.k2.ineg(),m=m.neg(!0)),i[s*2]=d,i[s*2+1]=m,o[s*2]=a.k1,o[s*2+1]=a.k2}for(var p=this._wnafMulAdd(1,i,o,s*2,n),w=0;w<s*2;w++)i[w]=null,o[w]=null;return p};function Io(t,e,r,n){Kv.BasePoint.call(this,t,"affine"),e===null&&r===null?(this.x=null,this.y=null,this.inf=!0):(this.x=new Ti(e,16),this.y=new Ti(r,16),n&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}l7(Io,Kv.BasePoint);Lc.prototype.point=function(e,r,n){return new Io(this,e,r,n)};Lc.prototype.pointFromJSON=function(e,r){return Io.fromJSON(this,e,r)};Io.prototype._getBeta=function(){if(this.curve.endo){var e=this.precomputed;if(e&&e.beta)return e.beta;var r=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(e){var n=this.curve,i=function(o){return n.point(o.x.redMul(n.endo.beta),o.y)};e.beta=r,r.precomputed={beta:null,naf:e.naf&&{wnd:e.naf.wnd,points:e.naf.points.map(i)},doubles:e.doubles&&{step:e.doubles.step,points:e.doubles.points.map(i)}}}return r}};Io.prototype.toJSON=function(){return this.precomputed?[this.x,this.y,this.precomputed&&{doubles:this.precomputed.doubles&&{step:this.precomputed.doubles.step,points:this.precomputed.doubles.points.slice(1)},naf:this.precomputed.naf&&{wnd:this.precomputed.naf.wnd,points:this.precomputed.naf.points.slice(1)}}]:[this.x,this.y]};Io.fromJSON=function(e,r,n){typeof r=="string"&&(r=JSON.parse(r));var i=e.point(r[0],r[1],n);if(!r[2])return i;function o(a){return e.point(a[0],a[1],n)}var s=r[2];return i.precomputed={beta:null,doubles:s.doubles&&{step:s.doubles.step,points:[i].concat(s.doubles.points.map(o))},naf:s.naf&&{wnd:s.naf.wnd,points:[i].concat(s.naf.points.map(o))}},i};Io.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+">"};Io.prototype.isInfinity=function(){return this.inf};Io.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(this.x.cmp(e.x)===0)return this.curve.point(null,null);var r=this.y.redSub(e.y);r.cmpn(0)!==0&&(r=r.redMul(this.x.redSub(e.x).redInvm()));var n=r.redSqr().redISub(this.x).redISub(e.x),i=r.redMul(this.x.redSub(n)).redISub(this.y);return this.curve.point(n,i)};Io.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(e.cmpn(0)===0)return this.curve.point(null,null);var r=this.curve.a,n=this.x.redSqr(),i=e.redInvm(),o=n.redAdd(n).redIAdd(n).redIAdd(r).redMul(i),s=o.redSqr().redISub(this.x.redAdd(this.x)),a=o.redMul(this.x.redSub(s)).redISub(this.y);return this.curve.point(s,a)};Io.prototype.getX=function(){return this.x.fromRed()};Io.prototype.getY=function(){return this.y.fromRed()};Io.prototype.mul=function(e){return e=new Ti(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)};Io.prototype.mulAdd=function(e,r,n){var i=[this,r],o=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,o):this.curve._wnafMulAdd(1,i,o,2)};Io.prototype.jmulAdd=function(e,r,n){var i=[this,r],o=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,o,!0):this.curve._wnafMulAdd(1,i,o,2,!0)};Io.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||this.x.cmp(e.x)===0&&this.y.cmp(e.y)===0)};Io.prototype.neg=function(e){if(this.inf)return this;var r=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var n=this.precomputed,i=function(o){return o.neg()};r.precomputed={naf:n.naf&&{wnd:n.naf.wnd,points:n.naf.points.map(i)},doubles:n.doubles&&{step:n.doubles.step,points:n.doubles.points.map(i)}}}return r};Io.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var e=this.curve.jpoint(this.x,this.y,this.curve.one);return e};function Vo(t,e,r,n){Kv.BasePoint.call(this,t,"jacobian"),e===null&&r===null&&n===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new Ti(0)):(this.x=new Ti(e,16),this.y=new Ti(r,16),this.z=new Ti(n,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}l7(Vo,Kv.BasePoint);Lc.prototype.jpoint=function(e,r,n){return new Vo(this,e,r,n)};Vo.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),r=e.redSqr(),n=this.x.redMul(r),i=this.y.redMul(r).redMul(e);return this.curve.point(n,i)};Vo.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)};Vo.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var r=e.z.redSqr(),n=this.z.redSqr(),i=this.x.redMul(r),o=e.x.redMul(n),s=this.y.redMul(r.redMul(e.z)),a=e.y.redMul(n.redMul(this.z)),d=i.redSub(o),m=s.redSub(a);if(d.cmpn(0)===0)return m.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var p=d.redSqr(),w=p.redMul(d),P=i.redMul(p),S=m.redSqr().redIAdd(w).redISub(P).redISub(P),M=m.redMul(P.redISub(S)).redISub(s.redMul(w)),A=this.z.redMul(e.z).redMul(d);return this.curve.jpoint(S,M,A)};Vo.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var r=this.z.redSqr(),n=this.x,i=e.x.redMul(r),o=this.y,s=e.y.redMul(r).redMul(this.z),a=n.redSub(i),d=o.redSub(s);if(a.cmpn(0)===0)return d.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var m=a.redSqr(),p=m.redMul(a),w=n.redMul(m),P=d.redSqr().redIAdd(p).redISub(w).redISub(w),S=d.redMul(w.redISub(P)).redISub(o.redMul(p)),M=this.z.redMul(a);return this.curve.jpoint(P,S,M)};Vo.prototype.dblp=function(e){if(e===0)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var r;if(this.curve.zeroA||this.curve.threeA){var n=this;for(r=0;r<e;r++)n=n.dbl();return n}var i=this.curve.a,o=this.curve.tinv,s=this.x,a=this.y,d=this.z,m=d.redSqr().redSqr(),p=a.redAdd(a);for(r=0;r<e;r++){var w=s.redSqr(),P=p.redSqr(),S=P.redSqr(),M=w.redAdd(w).redIAdd(w).redIAdd(i.redMul(m)),A=s.redMul(P),B=M.redSqr().redISub(A.redAdd(A)),I=A.redISub(B),C=M.redMul(I);C=C.redIAdd(C).redISub(S);var k=p.redMul(d);r+1<e&&(m=m.redMul(S)),s=B,d=k,p=C}return this.curve.jpoint(s,p.redMul(o),d)};Vo.prototype.dbl=function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()};Vo.prototype._zeroDbl=function(){var e,r,n;if(this.zOne){var i=this.x.redSqr(),o=this.y.redSqr(),s=o.redSqr(),a=this.x.redAdd(o).redSqr().redISub(i).redISub(s);a=a.redIAdd(a);var d=i.redAdd(i).redIAdd(i),m=d.redSqr().redISub(a).redISub(a),p=s.redIAdd(s);p=p.redIAdd(p),p=p.redIAdd(p),e=m,r=d.redMul(a.redISub(m)).redISub(p),n=this.y.redAdd(this.y)}else{var w=this.x.redSqr(),P=this.y.redSqr(),S=P.redSqr(),M=this.x.redAdd(P).redSqr().redISub(w).redISub(S);M=M.redIAdd(M);var A=w.redAdd(w).redIAdd(w),B=A.redSqr(),I=S.redIAdd(S);I=I.redIAdd(I),I=I.redIAdd(I),e=B.redISub(M).redISub(M),r=A.redMul(M.redISub(e)).redISub(I),n=this.y.redMul(this.z),n=n.redIAdd(n)}return this.curve.jpoint(e,r,n)};Vo.prototype._threeDbl=function(){var e,r,n;if(this.zOne){var i=this.x.redSqr(),o=this.y.redSqr(),s=o.redSqr(),a=this.x.redAdd(o).redSqr().redISub(i).redISub(s);a=a.redIAdd(a);var d=i.redAdd(i).redIAdd(i).redIAdd(this.curve.a),m=d.redSqr().redISub(a).redISub(a);e=m;var p=s.redIAdd(s);p=p.redIAdd(p),p=p.redIAdd(p),r=d.redMul(a.redISub(m)).redISub(p),n=this.y.redAdd(this.y)}else{var w=this.z.redSqr(),P=this.y.redSqr(),S=this.x.redMul(P),M=this.x.redSub(w).redMul(this.x.redAdd(w));M=M.redAdd(M).redIAdd(M);var A=S.redIAdd(S);A=A.redIAdd(A);var B=A.redAdd(A);e=M.redSqr().redISub(B),n=this.y.redAdd(this.z).redSqr().redISub(P).redISub(w);var I=P.redSqr();I=I.redIAdd(I),I=I.redIAdd(I),I=I.redIAdd(I),r=M.redMul(A.redISub(e)).redISub(I)}return this.curve.jpoint(e,r,n)};Vo.prototype._dbl=function(){var e=this.curve.a,r=this.x,n=this.y,i=this.z,o=i.redSqr().redSqr(),s=r.redSqr(),a=n.redSqr(),d=s.redAdd(s).redIAdd(s).redIAdd(e.redMul(o)),m=r.redAdd(r);m=m.redIAdd(m);var p=m.redMul(a),w=d.redSqr().redISub(p.redAdd(p)),P=p.redISub(w),S=a.redSqr();S=S.redIAdd(S),S=S.redIAdd(S),S=S.redIAdd(S);var M=d.redMul(P).redISub(S),A=n.redAdd(n).redMul(i);return this.curve.jpoint(w,M,A)};Vo.prototype.trpl=function(){if(!this.curve.zeroA)return this.dbl().add(this);var e=this.x.redSqr(),r=this.y.redSqr(),n=this.z.redSqr(),i=r.redSqr(),o=e.redAdd(e).redIAdd(e),s=o.redSqr(),a=this.x.redAdd(r).redSqr().redISub(e).redISub(i);a=a.redIAdd(a),a=a.redAdd(a).redIAdd(a),a=a.redISub(s);var d=a.redSqr(),m=i.redIAdd(i);m=m.redIAdd(m),m=m.redIAdd(m),m=m.redIAdd(m);var p=o.redIAdd(a).redSqr().redISub(s).redISub(d).redISub(m),w=r.redMul(p);w=w.redIAdd(w),w=w.redIAdd(w);var P=this.x.redMul(d).redISub(w);P=P.redIAdd(P),P=P.redIAdd(P);var S=this.y.redMul(p.redMul(m.redISub(p)).redISub(a.redMul(d)));S=S.redIAdd(S),S=S.redIAdd(S),S=S.redIAdd(S);var M=this.z.redAdd(a).redSqr().redISub(n).redISub(d);return this.curve.jpoint(P,S,M)};Vo.prototype.mul=function(e,r){return e=new Ti(e,r),this.curve._wnafMul(this,e)};Vo.prototype.eq=function(e){if(e.type==="affine")return this.eq(e.toJ());if(this===e)return!0;var r=this.z.redSqr(),n=e.z.redSqr();if(this.x.redMul(n).redISub(e.x.redMul(r)).cmpn(0)!==0)return!1;var i=r.redMul(this.z),o=n.redMul(e.z);return this.y.redMul(o).redISub(e.y.redMul(i)).cmpn(0)===0};Vo.prototype.eqXToP=function(e){var r=this.z.redSqr(),n=e.toRed(this.curve.red).redMul(r);if(this.x.cmp(n)===0)return!0;for(var i=e.clone(),o=this.curve.redN.redMul(r);;){if(i.iadd(this.curve.n),i.cmp(this.curve.p)>=0)return!1;if(n.redIAdd(o),this.x.cmp(n)===0)return!0}};Vo.prototype.inspect=function(){return this.isInfinity()?"<EC JPoint Infinity>":"<EC JPoint x: "+this.x.toString(16,2)+" y: "+this.y.toString(16,2)+" z: "+this.z.toString(16,2)+">"};Vo.prototype.isInfinity=function(){return this.z.cmpn(0)===0}});var nee=H((vyt,ree)=>{"use strict";E();var Gv=Wu(),tee=It(),_M=i_(),kTe=Ya();function Wv(t){_M.call(this,"mont",t),this.a=new Gv(t.a,16).toRed(this.red),this.b=new Gv(t.b,16).toRed(this.red),this.i4=new Gv(4).toRed(this.red).redInvm(),this.two=new Gv(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}tee(Wv,_M);ree.exports=Wv;Wv.prototype.validate=function(e){var r=e.normalize().x,n=r.redSqr(),i=n.redMul(r).redAdd(n.redMul(this.a)).redAdd(r),o=i.redSqrt();return o.redSqr().cmp(i)===0};function ko(t,e,r){_M.BasePoint.call(this,t,"projective"),e===null&&r===null?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new Gv(e,16),this.z=new Gv(r,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}tee(ko,_M.BasePoint);Wv.prototype.decodePoint=function(e,r){return this.point(kTe.toArray(e,r),1)};Wv.prototype.point=function(e,r){return new ko(this,e,r)};Wv.prototype.pointFromJSON=function(e){return ko.fromJSON(this,e)};ko.prototype.precompute=function(){};ko.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())};ko.fromJSON=function(e,r){return new ko(e,r[0],r[1]||e.one)};ko.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"};ko.prototype.isInfinity=function(){return this.z.cmpn(0)===0};ko.prototype.dbl=function(){var e=this.x.redAdd(this.z),r=e.redSqr(),n=this.x.redSub(this.z),i=n.redSqr(),o=r.redSub(i),s=r.redMul(i),a=o.redMul(i.redAdd(this.curve.a24.redMul(o)));return this.curve.point(s,a)};ko.prototype.add=function(){throw new Error("Not supported on Montgomery curve")};ko.prototype.diffAdd=function(e,r){var n=this.x.redAdd(this.z),i=this.x.redSub(this.z),o=e.x.redAdd(e.z),s=e.x.redSub(e.z),a=s.redMul(n),d=o.redMul(i),m=r.z.redMul(a.redAdd(d).redSqr()),p=r.x.redMul(a.redISub(d).redSqr());return this.curve.point(m,p)};ko.prototype.mul=function(e){for(var r=e.clone(),n=this,i=this.curve.point(null,null),o=this,s=[];r.cmpn(0)!==0;r.iushrn(1))s.push(r.andln(1));for(var a=s.length-1;a>=0;a--)s[a]===0?(n=n.diffAdd(i,o),i=i.dbl()):(i=n.diffAdd(i,o),n=n.dbl());return i};ko.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")};ko.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")};ko.prototype.eq=function(e){return this.getX().cmp(e.getX())===0};ko.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this};ko.prototype.getX=function(){return this.normalize(),this.x.fromRed()}});var see=H((wyt,oee)=>{"use strict";E();var OTe=Ya(),kd=Wu(),iee=It(),xM=i_(),BTe=OTe.assert;function Vu(t){this.twisted=(t.a|0)!==1,this.mOneA=this.twisted&&(t.a|0)===-1,this.extended=this.mOneA,xM.call(this,"edwards",t),this.a=new kd(t.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new kd(t.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new kd(t.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),BTe(!this.twisted||this.c.fromRed().cmpn(1)===0),this.oneC=(t.c|0)===1}iee(Vu,xM);oee.exports=Vu;Vu.prototype._mulA=function(e){return this.mOneA?e.redNeg():this.a.redMul(e)};Vu.prototype._mulC=function(e){return this.oneC?e:this.c.redMul(e)};Vu.prototype.jpoint=function(e,r,n,i){return this.point(e,r,n,i)};Vu.prototype.pointFromX=function(e,r){e=new kd(e,16),e.red||(e=e.toRed(this.red));var n=e.redSqr(),i=this.c2.redSub(this.a.redMul(n)),o=this.one.redSub(this.c2.redMul(this.d).redMul(n)),s=i.redMul(o.redInvm()),a=s.redSqrt();if(a.redSqr().redSub(s).cmp(this.zero)!==0)throw new Error("invalid point");var d=a.fromRed().isOdd();return(r&&!d||!r&&d)&&(a=a.redNeg()),this.point(e,a)};Vu.prototype.pointFromY=function(e,r){e=new kd(e,16),e.red||(e=e.toRed(this.red));var n=e.redSqr(),i=n.redSub(this.c2),o=n.redMul(this.d).redMul(this.c2).redSub(this.a),s=i.redMul(o.redInvm());if(s.cmp(this.zero)===0){if(r)throw new Error("invalid point");return this.point(this.zero,e)}var a=s.redSqrt();if(a.redSqr().redSub(s).cmp(this.zero)!==0)throw new Error("invalid point");return a.fromRed().isOdd()!==r&&(a=a.redNeg()),this.point(a,e)};Vu.prototype.validate=function(e){if(e.isInfinity())return!0;e.normalize();var r=e.x.redSqr(),n=e.y.redSqr(),i=r.redMul(this.a).redAdd(n),o=this.c2.redMul(this.one.redAdd(this.d.redMul(r).redMul(n)));return i.cmp(o)===0};function Cn(t,e,r,n,i){xM.BasePoint.call(this,t,"projective"),e===null&&r===null&&n===null?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new kd(e,16),this.y=new kd(r,16),this.z=n?new kd(n,16):this.curve.one,this.t=i&&new kd(i,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}iee(Cn,xM.BasePoint);Vu.prototype.pointFromJSON=function(e){return Cn.fromJSON(this,e)};Vu.prototype.point=function(e,r,n,i){return new Cn(this,e,r,n,i)};Cn.fromJSON=function(e,r){return new Cn(e,r[0],r[1],r[2])};Cn.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"};Cn.prototype.isInfinity=function(){return this.x.cmpn(0)===0&&(this.y.cmp(this.z)===0||this.zOne&&this.y.cmp(this.curve.c)===0)};Cn.prototype._extDbl=function(){var e=this.x.redSqr(),r=this.y.redSqr(),n=this.z.redSqr();n=n.redIAdd(n);var i=this.curve._mulA(e),o=this.x.redAdd(this.y).redSqr().redISub(e).redISub(r),s=i.redAdd(r),a=s.redSub(n),d=i.redSub(r),m=o.redMul(a),p=s.redMul(d),w=o.redMul(d),P=a.redMul(s);return this.curve.point(m,p,P,w)};Cn.prototype._projDbl=function(){var e=this.x.redAdd(this.y).redSqr(),r=this.x.redSqr(),n=this.y.redSqr(),i,o,s,a,d,m;if(this.curve.twisted){a=this.curve._mulA(r);var p=a.redAdd(n);this.zOne?(i=e.redSub(r).redSub(n).redMul(p.redSub(this.curve.two)),o=p.redMul(a.redSub(n)),s=p.redSqr().redSub(p).redSub(p)):(d=this.z.redSqr(),m=p.redSub(d).redISub(d),i=e.redSub(r).redISub(n).redMul(m),o=p.redMul(a.redSub(n)),s=p.redMul(m))}else a=r.redAdd(n),d=this.curve._mulC(this.z).redSqr(),m=a.redSub(d).redSub(d),i=this.curve._mulC(e.redISub(a)).redMul(m),o=this.curve._mulC(a).redMul(r.redISub(n)),s=a.redMul(m);return this.curve.point(i,o,s)};Cn.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()};Cn.prototype._extAdd=function(e){var r=this.y.redSub(this.x).redMul(e.y.redSub(e.x)),n=this.y.redAdd(this.x).redMul(e.y.redAdd(e.x)),i=this.t.redMul(this.curve.dd).redMul(e.t),o=this.z.redMul(e.z.redAdd(e.z)),s=n.redSub(r),a=o.redSub(i),d=o.redAdd(i),m=n.redAdd(r),p=s.redMul(a),w=d.redMul(m),P=s.redMul(m),S=a.redMul(d);return this.curve.point(p,w,S,P)};Cn.prototype._projAdd=function(e){var r=this.z.redMul(e.z),n=r.redSqr(),i=this.x.redMul(e.x),o=this.y.redMul(e.y),s=this.curve.d.redMul(i).redMul(o),a=n.redSub(s),d=n.redAdd(s),m=this.x.redAdd(this.y).redMul(e.x.redAdd(e.y)).redISub(i).redISub(o),p=r.redMul(a).redMul(m),w,P;return this.curve.twisted?(w=r.redMul(d).redMul(o.redSub(this.curve._mulA(i))),P=a.redMul(d)):(w=r.redMul(d).redMul(o.redSub(i)),P=this.curve._mulC(a).redMul(d)),this.curve.point(p,w,P)};Cn.prototype.add=function(e){return this.isInfinity()?e:e.isInfinity()?this:this.curve.extended?this._extAdd(e):this._projAdd(e)};Cn.prototype.mul=function(e){return this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve._wnafMul(this,e)};Cn.prototype.mulAdd=function(e,r,n){return this.curve._wnafMulAdd(1,[this,r],[e,n],2,!1)};Cn.prototype.jmulAdd=function(e,r,n){return this.curve._wnafMulAdd(1,[this,r],[e,n],2,!0)};Cn.prototype.normalize=function(){if(this.zOne)return this;var e=this.z.redInvm();return this.x=this.x.redMul(e),this.y=this.y.redMul(e),this.t&&(this.t=this.t.redMul(e)),this.z=this.curve.one,this.zOne=!0,this};Cn.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())};Cn.prototype.getX=function(){return this.normalize(),this.x.fromRed()};Cn.prototype.getY=function(){return this.normalize(),this.y.fromRed()};Cn.prototype.eq=function(e){return this===e||this.getX().cmp(e.getX())===0&&this.getY().cmp(e.getY())===0};Cn.prototype.eqXToP=function(e){var r=e.toRed(this.curve.red).redMul(this.z);if(this.x.cmp(r)===0)return!0;for(var n=e.clone(),i=this.curve.redN.redMul(this.z);;){if(n.iadd(this.curve.n),n.cmp(this.curve.p)>=0)return!1;if(r.redIAdd(i),this.x.cmp(r)===0)return!0}};Cn.prototype.toP=Cn.prototype.normalize;Cn.prototype.mixedAdd=Cn.prototype.add});var d7=H(aee=>{"use strict";E();var EM=aee;EM.base=i_();EM.short=eee();EM.mont=nee();EM.edwards=see()});var Cf=H(An=>{"use strict";E();var DTe=Ja(),CTe=It();An.inherits=CTe;function jTe(t,e){return(t.charCodeAt(e)&64512)!==55296||e<0||e+1>=t.length?!1:(t.charCodeAt(e+1)&64512)===56320}function NTe(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var r=[];if(typeof t=="string")if(e){if(e==="hex")for(t=t.replace(/[^a-z0-9]+/ig,""),t.length%2!==0&&(t="0"+t),i=0;i<t.length;i+=2)r.push(parseInt(t[i]+t[i+1],16))}else for(var n=0,i=0;i<t.length;i++){var o=t.charCodeAt(i);o<128?r[n++]=o:o<2048?(r[n++]=o>>6|192,r[n++]=o&63|128):jTe(t,i)?(o=65536+((o&1023)<<10)+(t.charCodeAt(++i)&1023),r[n++]=o>>18|240,r[n++]=o>>12&63|128,r[n++]=o>>6&63|128,r[n++]=o&63|128):(r[n++]=o>>12|224,r[n++]=o>>6&63|128,r[n++]=o&63|128)}else for(i=0;i<t.length;i++)r[i]=t[i]|0;return r}An.toArray=NTe;function qTe(t){for(var e="",r=0;r<t.length;r++)e+=fee(t[r].toString(16));return e}An.toHex=qTe;function cee(t){var e=t>>>24|t>>>8&65280|t<<8&16711680|(t&255)<<24;return e>>>0}An.htonl=cee;function $Te(t,e){for(var r="",n=0;n<t.length;n++){var i=t[n];e==="little"&&(i=cee(i)),r+=uee(i.toString(16))}return r}An.toHex32=$Te;function fee(t){return t.length===1?"0"+t:t}An.zero2=fee;function uee(t){return t.length===7?"0"+t:t.length===6?"00"+t:t.length===5?"000"+t:t.length===4?"0000"+t:t.length===3?"00000"+t:t.length===2?"000000"+t:t.length===1?"0000000"+t:t}An.zero8=uee;function LTe(t,e,r,n){var i=r-e;DTe(i%4===0);for(var o=new Array(i/4),s=0,a=e;s<o.length;s++,a+=4){var d;n==="big"?d=t[a]<<24|t[a+1]<<16|t[a+2]<<8|t[a+3]:d=t[a+3]<<24|t[a+2]<<16|t[a+1]<<8|t[a],o[s]=d>>>0}return o}An.join32=LTe;function UTe(t,e){for(var r=new Array(t.length*4),n=0,i=0;n<t.length;n++,i+=4){var o=t[n];e==="big"?(r[i]=o>>>24,r[i+1]=o>>>16&255,r[i+2]=o>>>8&255,r[i+3]=o&255):(r[i+3]=o>>>24,r[i+2]=o>>>16&255,r[i+1]=o>>>8&255,r[i]=o&255)}return r}An.split32=UTe;function FTe(t,e){return t>>>e|t<<32-e}An.rotr32=FTe;function zTe(t,e){return t<<e|t>>>32-e}An.rotl32=zTe;function KTe(t,e){return t+e>>>0}An.sum32=KTe;function GTe(t,e,r){return t+e+r>>>0}An.sum32_3=GTe;function WTe(t,e,r,n){return t+e+r+n>>>0}An.sum32_4=WTe;function VTe(t,e,r,n,i){return t+e+r+n+i>>>0}An.sum32_5=VTe;function HTe(t,e,r,n){var i=t[e],o=t[e+1],s=n+o>>>0,a=(s<n?1:0)+r+i;t[e]=a>>>0,t[e+1]=s}An.sum64=HTe;function ZTe(t,e,r,n){var i=e+n>>>0,o=(i<e?1:0)+t+r;return o>>>0}An.sum64_hi=ZTe;function JTe(t,e,r,n){var i=e+n;return i>>>0}An.sum64_lo=JTe;function YTe(t,e,r,n,i,o,s,a){var d=0,m=e;m=m+n>>>0,d+=m<e?1:0,m=m+o>>>0,d+=m<o?1:0,m=m+a>>>0,d+=m<a?1:0;var p=t+r+i+s+d;return p>>>0}An.sum64_4_hi=YTe;function QTe(t,e,r,n,i,o,s,a){var d=e+n+o+a;return d>>>0}An.sum64_4_lo=QTe;function XTe(t,e,r,n,i,o,s,a,d,m){var p=0,w=e;w=w+n>>>0,p+=w<e?1:0,w=w+o>>>0,p+=w<o?1:0,w=w+a>>>0,p+=w<a?1:0,w=w+m>>>0,p+=w<m?1:0;var P=t+r+i+s+d+p;return P>>>0}An.sum64_5_hi=XTe;function eRe(t,e,r,n,i,o,s,a,d,m){var p=e+n+o+a+m;return p>>>0}An.sum64_5_lo=eRe;function tRe(t,e,r){var n=e<<32-r|t>>>r;return n>>>0}An.rotr64_hi=tRe;function rRe(t,e,r){var n=t<<32-r|e>>>r;return n>>>0}An.rotr64_lo=rRe;function nRe(t,e,r){return t>>>r}An.shr64_hi=nRe;function iRe(t,e,r){var n=t<<32-r|e>>>r;return n>>>0}An.shr64_lo=iRe});var Vv=H(dee=>{"use strict";E();var lee=Cf(),oRe=Ja();function SM(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}dee.BlockHash=SM;SM.prototype.update=function(e,r){if(e=lee.toArray(e,r),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){e=this.pending;var n=e.length%this._delta8;this.pending=e.slice(e.length-n,e.length),this.pending.length===0&&(this.pending=null),e=lee.join32(e,0,e.length-n,this.endian);for(var i=0;i<e.length;i+=this._delta32)this._update(e,i,i+this._delta32)}return this};SM.prototype.digest=function(e){return this.update(this._pad()),oRe(this.pending===null),this._digest(e)};SM.prototype._pad=function(){var e=this.pendingTotal,r=this._delta8,n=r-(e+this.padLength)%r,i=new Array(n+this.padLength);i[0]=128;for(var o=1;o<n;o++)i[o]=0;if(e<<=3,this.endian==="big"){for(var s=8;s<this.padLength;s++)i[o++]=0;i[o++]=0,i[o++]=0,i[o++]=0,i[o++]=0,i[o++]=e>>>24&255,i[o++]=e>>>16&255,i[o++]=e>>>8&255,i[o++]=e&255}else for(i[o++]=e&255,i[o++]=e>>>8&255,i[o++]=e>>>16&255,i[o++]=e>>>24&255,i[o++]=0,i[o++]=0,i[o++]=0,i[o++]=0,s=8;s<this.padLength;s++)i[o++]=0;return i}});var h7=H(Od=>{"use strict";E();var sRe=Cf(),Hu=sRe.rotr32;function aRe(t,e,r,n){if(t===0)return hee(e,r,n);if(t===1||t===3)return mee(e,r,n);if(t===2)return pee(e,r,n)}Od.ft_1=aRe;function hee(t,e,r){return t&e^~t&r}Od.ch32=hee;function pee(t,e,r){return t&e^t&r^e&r}Od.maj32=pee;function mee(t,e,r){return t^e^r}Od.p32=mee;function cRe(t){return Hu(t,2)^Hu(t,13)^Hu(t,22)}Od.s0_256=cRe;function fRe(t){return Hu(t,6)^Hu(t,11)^Hu(t,25)}Od.s1_256=fRe;function uRe(t){return Hu(t,7)^Hu(t,18)^t>>>3}Od.g0_256=uRe;function lRe(t){return Hu(t,17)^Hu(t,19)^t>>>10}Od.g1_256=lRe});var vee=H((Iyt,gee)=>{"use strict";E();var Hv=Cf(),dRe=Vv(),hRe=h7(),p7=Hv.rotl32,o_=Hv.sum32,pRe=Hv.sum32_5,mRe=hRe.ft_1,yee=dRe.BlockHash,yRe=[1518500249,1859775393,2400959708,3395469782];function Zu(){if(!(this instanceof Zu))return new Zu;yee.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}Hv.inherits(Zu,yee);gee.exports=Zu;Zu.blockSize=512;Zu.outSize=160;Zu.hmacStrength=80;Zu.padLength=64;Zu.prototype._update=function(e,r){for(var n=this.W,i=0;i<16;i++)n[i]=e[r+i];for(;i<n.length;i++)n[i]=p7(n[i-3]^n[i-8]^n[i-14]^n[i-16],1);var o=this.h[0],s=this.h[1],a=this.h[2],d=this.h[3],m=this.h[4];for(i=0;i<n.length;i++){var p=~~(i/20),w=pRe(p7(o,5),mRe(p,s,a,d),m,n[i],yRe[p]);m=d,d=a,a=p7(s,30),s=o,o=w}this.h[0]=o_(this.h[0],o),this.h[1]=o_(this.h[1],s),this.h[2]=o_(this.h[2],a),this.h[3]=o_(this.h[3],d),this.h[4]=o_(this.h[4],m)};Zu.prototype._digest=function(e){return e==="hex"?Hv.toHex32(this.h,"big"):Hv.split32(this.h,"big")}});var m7=H((Oyt,wee)=>{"use strict";E();var Zv=Cf(),gRe=Vv(),Jv=h7(),vRe=Ja(),jf=Zv.sum32,bRe=Zv.sum32_4,wRe=Zv.sum32_5,_Re=Jv.ch32,xRe=Jv.maj32,ERe=Jv.s0_256,SRe=Jv.s1_256,MRe=Jv.g0_256,PRe=Jv.g1_256,bee=gRe.BlockHash,ARe=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];function Ju(){if(!(this instanceof Ju))return new Ju;bee.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=ARe,this.W=new Array(64)}Zv.inherits(Ju,bee);wee.exports=Ju;Ju.blockSize=512;Ju.outSize=256;Ju.hmacStrength=192;Ju.padLength=64;Ju.prototype._update=function(e,r){for(var n=this.W,i=0;i<16;i++)n[i]=e[r+i];for(;i<n.length;i++)n[i]=bRe(PRe(n[i-2]),n[i-7],MRe(n[i-15]),n[i-16]);var o=this.h[0],s=this.h[1],a=this.h[2],d=this.h[3],m=this.h[4],p=this.h[5],w=this.h[6],P=this.h[7];for(vRe(this.k.length===n.length),i=0;i<n.length;i++){var S=wRe(P,SRe(m),_Re(m,p,w),this.k[i],n[i]),M=jf(ERe(o),xRe(o,s,a));P=w,w=p,p=m,m=jf(d,S),d=a,a=s,s=o,o=jf(S,M)}this.h[0]=jf(this.h[0],o),this.h[1]=jf(this.h[1],s),this.h[2]=jf(this.h[2],a),this.h[3]=jf(this.h[3],d),this.h[4]=jf(this.h[4],m),this.h[5]=jf(this.h[5],p),this.h[6]=jf(this.h[6],w),this.h[7]=jf(this.h[7],P)};Ju.prototype._digest=function(e){return e==="hex"?Zv.toHex32(this.h,"big"):Zv.split32(this.h,"big")}});var Eee=H((Dyt,xee)=>{"use strict";E();var y7=Cf(),_ee=m7();function Bd(){if(!(this instanceof Bd))return new Bd;_ee.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}y7.inherits(Bd,_ee);xee.exports=Bd;Bd.blockSize=512;Bd.outSize=224;Bd.hmacStrength=192;Bd.padLength=64;Bd.prototype._digest=function(e){return e==="hex"?y7.toHex32(this.h.slice(0,7),"big"):y7.split32(this.h.slice(0,7),"big")}});var b7=H((jyt,Aee)=>{"use strict";E();var Ea=Cf(),TRe=Vv(),RRe=Ja(),Yu=Ea.rotr64_hi,Qu=Ea.rotr64_lo,See=Ea.shr64_hi,Mee=Ea.shr64_lo,pp=Ea.sum64,g7=Ea.sum64_hi,v7=Ea.sum64_lo,IRe=Ea.sum64_4_hi,kRe=Ea.sum64_4_lo,ORe=Ea.sum64_5_hi,BRe=Ea.sum64_5_lo,Pee=TRe.BlockHash,DRe=[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 Nf(){if(!(this instanceof Nf))return new Nf;Pee.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=DRe,this.W=new Array(160)}Ea.inherits(Nf,Pee);Aee.exports=Nf;Nf.blockSize=1024;Nf.outSize=512;Nf.hmacStrength=192;Nf.padLength=128;Nf.prototype._prepareBlock=function(e,r){for(var n=this.W,i=0;i<32;i++)n[i]=e[r+i];for(;i<n.length;i+=2){var o=GRe(n[i-4],n[i-3]),s=WRe(n[i-4],n[i-3]),a=n[i-14],d=n[i-13],m=zRe(n[i-30],n[i-29]),p=KRe(n[i-30],n[i-29]),w=n[i-32],P=n[i-31];n[i]=IRe(o,s,a,d,m,p,w,P),n[i+1]=kRe(o,s,a,d,m,p,w,P)}};Nf.prototype._update=function(e,r){this._prepareBlock(e,r);var n=this.W,i=this.h[0],o=this.h[1],s=this.h[2],a=this.h[3],d=this.h[4],m=this.h[5],p=this.h[6],w=this.h[7],P=this.h[8],S=this.h[9],M=this.h[10],A=this.h[11],B=this.h[12],I=this.h[13],C=this.h[14],k=this.h[15];RRe(this.k.length===n.length);for(var q=0;q<n.length;q+=2){var L=C,U=k,F=URe(P,S),N=FRe(P,S),G=CRe(P,S,M,A,B,I),x=jRe(P,S,M,A,B,I),c=this.k[q],u=this.k[q+1],y=n[q],l=n[q+1],h=ORe(L,U,F,N,G,x,c,u,y,l),b=BRe(L,U,F,N,G,x,c,u,y,l);L=$Re(i,o),U=LRe(i,o),F=NRe(i,o,s,a,d,m),N=qRe(i,o,s,a,d,m);var _=g7(L,U,F,N),g=v7(L,U,F,N);C=B,k=I,B=M,I=A,M=P,A=S,P=g7(p,w,h,b),S=v7(w,w,h,b),p=d,w=m,d=s,m=a,s=i,a=o,i=g7(h,b,_,g),o=v7(h,b,_,g)}pp(this.h,0,i,o),pp(this.h,2,s,a),pp(this.h,4,d,m),pp(this.h,6,p,w),pp(this.h,8,P,S),pp(this.h,10,M,A),pp(this.h,12,B,I),pp(this.h,14,C,k)};Nf.prototype._digest=function(e){return e==="hex"?Ea.toHex32(this.h,"big"):Ea.split32(this.h,"big")};function CRe(t,e,r,n,i){var o=t&r^~t&i;return o<0&&(o+=4294967296),o}function jRe(t,e,r,n,i,o){var s=e&n^~e&o;return s<0&&(s+=4294967296),s}function NRe(t,e,r,n,i){var o=t&r^t&i^r&i;return o<0&&(o+=4294967296),o}function qRe(t,e,r,n,i,o){var s=e&n^e&o^n&o;return s<0&&(s+=4294967296),s}function $Re(t,e){var r=Yu(t,e,28),n=Yu(e,t,2),i=Yu(e,t,7),o=r^n^i;return o<0&&(o+=4294967296),o}function LRe(t,e){var r=Qu(t,e,28),n=Qu(e,t,2),i=Qu(e,t,7),o=r^n^i;return o<0&&(o+=4294967296),o}function URe(t,e){var r=Yu(t,e,14),n=Yu(t,e,18),i=Yu(e,t,9),o=r^n^i;return o<0&&(o+=4294967296),o}function FRe(t,e){var r=Qu(t,e,14),n=Qu(t,e,18),i=Qu(e,t,9),o=r^n^i;return o<0&&(o+=4294967296),o}function zRe(t,e){var r=Yu(t,e,1),n=Yu(t,e,8),i=See(t,e,7),o=r^n^i;return o<0&&(o+=4294967296),o}function KRe(t,e){var r=Qu(t,e,1),n=Qu(t,e,8),i=Mee(t,e,7),o=r^n^i;return o<0&&(o+=4294967296),o}function GRe(t,e){var r=Yu(t,e,19),n=Yu(e,t,29),i=See(t,e,6),o=r^n^i;return o<0&&(o+=4294967296),o}function WRe(t,e){var r=Qu(t,e,19),n=Qu(e,t,29),i=Mee(t,e,6),o=r^n^i;return o<0&&(o+=4294967296),o}});var Iee=H((qyt,Ree)=>{"use strict";E();var w7=Cf(),Tee=b7();function Dd(){if(!(this instanceof Dd))return new Dd;Tee.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}w7.inherits(Dd,Tee);Ree.exports=Dd;Dd.blockSize=1024;Dd.outSize=384;Dd.hmacStrength=192;Dd.padLength=128;Dd.prototype._digest=function(e){return e==="hex"?w7.toHex32(this.h.slice(0,12),"big"):w7.split32(this.h.slice(0,12),"big")}});var kee=H(Yv=>{"use strict";E();Yv.sha1=vee();Yv.sha224=Eee();Yv.sha256=m7();Yv.sha384=Iee();Yv.sha512=b7()});var Nee=H(jee=>{"use strict";E();var Nm=Cf(),VRe=Vv(),MM=Nm.rotl32,Oee=Nm.sum32,s_=Nm.sum32_3,Bee=Nm.sum32_4,Cee=VRe.BlockHash;function Xu(){if(!(this instanceof Xu))return new Xu;Cee.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}Nm.inherits(Xu,Cee);jee.ripemd160=Xu;Xu.blockSize=512;Xu.outSize=160;Xu.hmacStrength=192;Xu.padLength=64;Xu.prototype._update=function(e,r){for(var n=this.h[0],i=this.h[1],o=this.h[2],s=this.h[3],a=this.h[4],d=n,m=i,p=o,w=s,P=a,S=0;S<80;S++){var M=Oee(MM(Bee(n,Dee(S,i,o,s),e[JRe[S]+r],HRe(S)),QRe[S]),a);n=a,a=s,s=MM(o,10),o=i,i=M,M=Oee(MM(Bee(d,Dee(79-S,m,p,w),e[YRe[S]+r],ZRe(S)),XRe[S]),P),d=P,P=w,w=MM(p,10),p=m,m=M}M=s_(this.h[1],o,w),this.h[1]=s_(this.h[2],s,P),this.h[2]=s_(this.h[3],a,d),this.h[3]=s_(this.h[4],n,m),this.h[4]=s_(this.h[0],i,p),this.h[0]=M};Xu.prototype._digest=function(e){return e==="hex"?Nm.toHex32(this.h,"little"):Nm.split32(this.h,"little")};function Dee(t,e,r,n){return t<=15?e^r^n:t<=31?e&r|~e&n:t<=47?(e|~r)^n:t<=63?e&n|r&~n:e^(r|~n)}function HRe(t){return t<=15?0:t<=31?1518500249:t<=47?1859775393:t<=63?2400959708:2840853838}function ZRe(t){return t<=15?1352829926:t<=31?1548603684:t<=47?1836072691:t<=63?2053994217:0}var JRe=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],YRe=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],QRe=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],XRe=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]});var $ee=H((Kyt,qee)=>{"use strict";E();var eIe=Cf(),tIe=Ja();function Qv(t,e,r){if(!(this instanceof Qv))return new Qv(t,e,r);this.Hash=t,this.blockSize=t.blockSize/8,this.outSize=t.outSize/8,this.inner=null,this.outer=null,this._init(eIe.toArray(e,r))}qee.exports=Qv;Qv.prototype._init=function(e){e.length>this.blockSize&&(e=new this.Hash().update(e).digest()),tIe(e.length<=this.blockSize);for(var r=e.length;r<this.blockSize;r++)e.push(0);for(r=0;r<e.length;r++)e[r]^=54;for(this.inner=new this.Hash().update(e),r=0;r<e.length;r++)e[r]^=106;this.outer=new this.Hash().update(e)};Qv.prototype.update=function(e,r){return this.inner.update(e,r),this};Qv.prototype.digest=function(e){return this.outer.update(this.inner.digest()),this.outer.digest(e)}});var PM=H(Lee=>{E();var Ho=Lee;Ho.utils=Cf();Ho.common=Vv();Ho.sha=kee();Ho.ripemd=Nee();Ho.hmac=$ee();Ho.sha1=Ho.sha.sha1;Ho.sha256=Ho.sha.sha256;Ho.sha224=Ho.sha.sha224;Ho.sha384=Ho.sha.sha384;Ho.sha512=Ho.sha.sha512;Ho.ripemd160=Ho.ripemd.ripemd160});var Fee=H((Hyt,Uee)=>{E();Uee.exports={doubles:{step:4,points:[["e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a","f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821"],["8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508","11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf"],["175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739","d3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695"],["363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640","4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9"],["8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c","4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36"],["723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda","96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f"],["eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa","5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999"],["100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0","cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09"],["e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d","9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d"],["feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d","e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088"],["da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1","9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d"],["53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0","5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8"],["8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047","10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a"],["385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862","283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453"],["6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7","7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160"],["3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd","56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0"],["85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83","7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6"],["948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a","53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589"],["6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8","bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17"],["e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d","4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda"],["e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725","7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd"],["213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754","4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2"],["4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c","17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6"],["fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6","6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f"],["76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39","c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01"],["c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891","893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3"],["d895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b","febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f"],["b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03","2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7"],["e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d","eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78"],["a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070","7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1"],["90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4","e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150"],["8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da","662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82"],["e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11","1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc"],["8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e","efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b"],["e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41","2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51"],["b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef","67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45"],["d68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8","db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120"],["324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d","648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84"],["4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96","35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d"],["9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd","ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d"],["6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5","9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8"],["a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266","40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8"],["7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71","34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac"],["928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac","c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f"],["85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751","1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962"],["ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e","493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907"],["827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241","c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec"],["eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3","be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d"],["e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f","4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414"],["1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19","aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd"],["146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be","b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0"],["fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9","6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811"],["da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2","8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1"],["a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13","7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c"],["174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c","ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73"],["959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba","2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd"],["d2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151","e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405"],["64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073","d99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589"],["8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458","38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e"],["13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b","69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27"],["bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366","d3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1"],["8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa","40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482"],["8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0","620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945"],["dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787","7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573"],["f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e","ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82"]]},naf:{wnd:7,points:[["f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9","388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672"],["2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4","d8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6"],["5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc","6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da"],["acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe","cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37"],["774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb","d984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b"],["f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8","ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81"],["d7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e","581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58"],["defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34","4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77"],["2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c","85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a"],["352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5","321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c"],["2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f","2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67"],["9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714","73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402"],["daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729","a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55"],["c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db","2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482"],["6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4","e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82"],["1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5","b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396"],["605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479","2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49"],["62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d","80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf"],["80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f","1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a"],["7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb","d0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7"],["d528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9","eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933"],["49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963","758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a"],["77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74","958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6"],["f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530","e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37"],["463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b","5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e"],["f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247","cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6"],["caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1","cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476"],["2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120","4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40"],["7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435","91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61"],["754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18","673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683"],["e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8","59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5"],["186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb","3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b"],["df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f","55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417"],["5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143","efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868"],["290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba","e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a"],["af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45","f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6"],["766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a","744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996"],["59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e","c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e"],["f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8","e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d"],["7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c","30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2"],["948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519","e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e"],["7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab","100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437"],["3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca","ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311"],["d3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf","8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4"],["1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610","68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575"],["733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4","f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d"],["15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c","d56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d"],["a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940","edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629"],["e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980","a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06"],["311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3","66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374"],["34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf","9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee"],["f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63","4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1"],["d7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448","fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b"],["32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf","5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661"],["7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5","8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6"],["ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6","8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e"],["16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5","5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d"],["eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99","f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc"],["78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51","f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4"],["494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5","42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c"],["a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5","204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b"],["c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997","4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913"],["841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881","73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154"],["5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5","39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865"],["36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66","d2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc"],["336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726","ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224"],["8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede","6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e"],["1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94","60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6"],["85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31","3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511"],["29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51","b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b"],["a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252","ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2"],["4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5","cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c"],["d24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b","6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3"],["ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4","322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d"],["af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f","6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700"],["e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889","2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4"],["591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246","b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196"],["11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984","998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4"],["3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a","b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257"],["cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030","bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13"],["c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197","6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096"],["c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593","c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38"],["a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef","21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f"],["347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38","60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448"],["da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a","49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a"],["c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111","5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4"],["4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502","7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437"],["3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea","be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7"],["cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26","8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d"],["b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986","39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a"],["d4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e","62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54"],["48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4","25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77"],["dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda","ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517"],["6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859","cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10"],["e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f","f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125"],["eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c","6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e"],["13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942","fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1"],["ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a","1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2"],["b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80","5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423"],["ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d","438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8"],["8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1","cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758"],["52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63","c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375"],["e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352","6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d"],["7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193","ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec"],["5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00","9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0"],["32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58","ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c"],["e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7","d3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4"],["8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8","c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f"],["4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e","67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649"],["3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d","cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826"],["674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b","299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5"],["d32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f","f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87"],["30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6","462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b"],["be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297","62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc"],["93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a","7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c"],["b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c","ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f"],["d5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52","4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a"],["d3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb","bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46"],["463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065","bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f"],["7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917","603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03"],["74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9","cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08"],["30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3","553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8"],["9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57","712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373"],["176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66","ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3"],["75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8","9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8"],["809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721","9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1"],["1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180","4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9"]]}}});var AM=H(Gee=>{"use strict";E();var x7=Gee,mp=PM(),_7=d7(),rIe=Ya(),zee=rIe.assert;function Kee(t){t.type==="short"?this.curve=new _7.short(t):t.type==="edwards"?this.curve=new _7.edwards(t):this.curve=new _7.mont(t),this.g=this.curve.g,this.n=this.curve.n,this.hash=t.hash,zee(this.g.validate(),"Invalid curve"),zee(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}x7.PresetCurve=Kee;function yp(t,e){Object.defineProperty(x7,t,{configurable:!0,enumerable:!0,get:function(){var r=new Kee(e);return Object.defineProperty(x7,t,{configurable:!0,enumerable:!0,value:r}),r}})}yp("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:mp.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]});yp("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:mp.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]});yp("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:mp.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]});yp("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:mp.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]});yp("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:mp.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]});yp("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:mp.sha256,gRed:!1,g:["9"]});yp("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:mp.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var E7;try{E7=Fee()}catch{E7=void 0}yp("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:mp.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",E7]})});var Hee=H((Qyt,Vee)=>{"use strict";E();var nIe=PM(),qm=u7(),Wee=Ja();function gp(t){if(!(this instanceof gp))return new gp(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=qm.toArray(t.entropy,t.entropyEnc||"hex"),r=qm.toArray(t.nonce,t.nonceEnc||"hex"),n=qm.toArray(t.pers,t.persEnc||"hex");Wee(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,r,n)}Vee.exports=gp;gp.prototype._init=function(e,r,n){var i=e.concat(r).concat(n);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var o=0;o<this.V.length;o++)this.K[o]=0,this.V[o]=1;this._update(i),this._reseed=1,this.reseedInterval=281474976710656};gp.prototype._hmac=function(){return new nIe.hmac(this.hash,this.K)};gp.prototype._update=function(e){var r=this._hmac().update(this.V).update([0]);e&&(r=r.update(e)),this.K=r.digest(),this.V=this._hmac().update(this.V).digest(),e&&(this.K=this._hmac().update(this.V).update([1]).update(e).digest(),this.V=this._hmac().update(this.V).digest())};gp.prototype.reseed=function(e,r,n,i){typeof r!="string"&&(i=n,n=r,r=null),e=qm.toArray(e,r),n=qm.toArray(n,i),Wee(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(n||[])),this._reseed=1};gp.prototype.generate=function(e,r,n,i){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof r!="string"&&(i=n,n=r,r=null),n&&(n=qm.toArray(n,i||"hex"),this._update(n));for(var o=[];o.length<e;)this.V=this._hmac().update(this.V).digest(),o=o.concat(this.V);var s=o.slice(0,e);return this._update(n),this._reseed++,qm.encode(s,r)}});var Jee=H((egt,Zee)=>{"use strict";E();var iIe=Wu(),oIe=Ya(),S7=oIe.assert;function Bs(t,e){this.ec=t,this.priv=null,this.pub=null,e.priv&&this._importPrivate(e.priv,e.privEnc),e.pub&&this._importPublic(e.pub,e.pubEnc)}Zee.exports=Bs;Bs.fromPublic=function(e,r,n){return r instanceof Bs?r:new Bs(e,{pub:r,pubEnc:n})};Bs.fromPrivate=function(e,r,n){return r instanceof Bs?r:new Bs(e,{priv:r,privEnc:n})};Bs.prototype.validate=function(){var e=this.getPublic();return e.isInfinity()?{result:!1,reason:"Invalid public key"}:e.validate()?e.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}};Bs.prototype.getPublic=function(e,r){return typeof e=="string"&&(r=e,e=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),r?this.pub.encode(r,e):this.pub};Bs.prototype.getPrivate=function(e){return e==="hex"?this.priv.toString(16,2):this.priv};Bs.prototype._importPrivate=function(e,r){this.priv=new iIe(e,r||16),this.priv=this.priv.umod(this.ec.curve.n)};Bs.prototype._importPublic=function(e,r){if(e.x||e.y){this.ec.curve.type==="mont"?S7(e.x,"Need x coordinate"):(this.ec.curve.type==="short"||this.ec.curve.type==="edwards")&&S7(e.x&&e.y,"Need both x and y coordinate"),this.pub=this.ec.curve.point(e.x,e.y);return}this.pub=this.ec.curve.decodePoint(e,r)};Bs.prototype.derive=function(e){return e.validate()||S7(e.validate(),"public point not validated"),e.mul(this.priv).getX()};Bs.prototype.sign=function(e,r,n){return this.ec.sign(e,this,r,n)};Bs.prototype.verify=function(e,r){return this.ec.verify(e,r,this)};Bs.prototype.inspect=function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"}});var Xee=H((rgt,Qee)=>{"use strict";E();var TM=Wu(),A7=Ya(),sIe=A7.assert;function RM(t,e){if(t instanceof RM)return t;this._importDER(t,e)||(sIe(t.r&&t.s,"Signature without r or s"),this.r=new TM(t.r,16),this.s=new TM(t.s,16),t.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}Qee.exports=RM;function aIe(){this.place=0}function M7(t,e){var r=t[e.place++];if(!(r&128))return r;var n=r&15;if(n===0||n>4)return!1;for(var i=0,o=0,s=e.place;o<n;o++,s++)i<<=8,i|=t[s],i>>>=0;return i<=127?!1:(e.place=s,i)}function Yee(t){for(var e=0,r=t.length-1;!t[e]&&!(t[e+1]&128)&&e<r;)e++;return e===0?t:t.slice(e)}RM.prototype._importDER=function(e,r){e=A7.toArray(e,r);var n=new aIe;if(e[n.place++]!==48)return!1;var i=M7(e,n);if(i===!1||i+n.place!==e.length||e[n.place++]!==2)return!1;var o=M7(e,n);if(o===!1)return!1;var s=e.slice(n.place,o+n.place);if(n.place+=o,e[n.place++]!==2)return!1;var a=M7(e,n);if(a===!1||e.length!==a+n.place)return!1;var d=e.slice(n.place,a+n.place);if(s[0]===0)if(s[1]&128)s=s.slice(1);else return!1;if(d[0]===0)if(d[1]&128)d=d.slice(1);else return!1;return this.r=new TM(s),this.s=new TM(d),this.recoveryParam=null,!0};function P7(t,e){if(e<128){t.push(e);return}var r=1+(Math.log(e)/Math.LN2>>>3);for(t.push(r|128);--r;)t.push(e>>>(r<<3)&255);t.push(e)}RM.prototype.toDER=function(e){var r=this.r.toArray(),n=this.s.toArray();for(r[0]&128&&(r=[0].concat(r)),n[0]&128&&(n=[0].concat(n)),r=Yee(r),n=Yee(n);!n[0]&&!(n[1]&128);)n=n.slice(1);var i=[2];P7(i,r.length),i=i.concat(r),i.push(2),P7(i,n.length);var o=i.concat(n),s=[48];return P7(s,o.length),s=s.concat(o),A7.encode(s,e)}});var nte=H((igt,rte)=>{"use strict";E();var $m=Wu(),ete=Hee(),cIe=Ya(),T7=AM(),fIe=ZS(),tte=cIe.assert,R7=Jee(),IM=Xee();function Uc(t){if(!(this instanceof Uc))return new Uc(t);typeof t=="string"&&(tte(Object.prototype.hasOwnProperty.call(T7,t),"Unknown curve "+t),t=T7[t]),t instanceof T7.PresetCurve&&(t={curve:t}),this.curve=t.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=t.curve.g,this.g.precompute(t.curve.n.bitLength()+1),this.hash=t.hash||t.curve.hash}rte.exports=Uc;Uc.prototype.keyPair=function(e){return new R7(this,e)};Uc.prototype.keyFromPrivate=function(e,r){return R7.fromPrivate(this,e,r)};Uc.prototype.keyFromPublic=function(e,r){return R7.fromPublic(this,e,r)};Uc.prototype.genKeyPair=function(e){e||(e={});for(var r=new ete({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||fIe(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),n=this.n.byteLength(),i=this.n.sub(new $m(2));;){var o=new $m(r.generate(n));if(!(o.cmp(i)>0))return o.iaddn(1),this.keyFromPrivate(o)}};Uc.prototype._truncateToN=function(e,r){var n=e.byteLength()*8-this.n.bitLength();return n>0&&(e=e.ushrn(n)),!r&&e.cmp(this.n)>=0?e.sub(this.n):e};Uc.prototype.sign=function(e,r,n,i){typeof n=="object"&&(i=n,n=null),i||(i={}),r=this.keyFromPrivate(r,n),e=this._truncateToN(new $m(e,16));for(var o=this.n.byteLength(),s=r.getPrivate().toArray("be",o),a=e.toArray("be",o),d=new ete({hash:this.hash,entropy:s,nonce:a,pers:i.pers,persEnc:i.persEnc||"utf8"}),m=this.n.sub(new $m(1)),p=0;;p++){var w=i.k?i.k(p):new $m(d.generate(this.n.byteLength()));if(w=this._truncateToN(w,!0),!(w.cmpn(1)<=0||w.cmp(m)>=0)){var P=this.g.mul(w);if(!P.isInfinity()){var S=P.getX(),M=S.umod(this.n);if(M.cmpn(0)!==0){var A=w.invm(this.n).mul(M.mul(r.getPrivate()).iadd(e));if(A=A.umod(this.n),A.cmpn(0)!==0){var B=(P.getY().isOdd()?1:0)|(S.cmp(M)!==0?2:0);return i.canonical&&A.cmp(this.nh)>0&&(A=this.n.sub(A),B^=1),new IM({r:M,s:A,recoveryParam:B})}}}}}};Uc.prototype.verify=function(e,r,n,i){e=this._truncateToN(new $m(e,16)),n=this.keyFromPublic(n,i),r=new IM(r,"hex");var o=r.r,s=r.s;if(o.cmpn(1)<0||o.cmp(this.n)>=0||s.cmpn(1)<0||s.cmp(this.n)>=0)return!1;var a=s.invm(this.n),d=a.mul(e).umod(this.n),m=a.mul(o).umod(this.n),p;return this.curve._maxwellTrick?(p=this.g.jmulAdd(d,n.getPublic(),m),p.isInfinity()?!1:p.eqXToP(o)):(p=this.g.mulAdd(d,n.getPublic(),m),p.isInfinity()?!1:p.getX().umod(this.n).cmp(o)===0)};Uc.prototype.recoverPubKey=function(t,e,r,n){tte((3&r)===r,"The recovery param is more than two bits"),e=new IM(e,n);var i=this.n,o=new $m(t),s=e.r,a=e.s,d=r&1,m=r>>1;if(s.cmp(this.curve.p.umod(this.curve.n))>=0&&m)throw new Error("Unable to find sencond key candinate");m?s=this.curve.pointFromX(s.add(this.curve.n),d):s=this.curve.pointFromX(s,d);var p=e.r.invm(i),w=i.sub(o).mul(p).umod(i),P=a.mul(p).umod(i);return this.g.mulAdd(w,s,P)};Uc.prototype.getKeyRecoveryParam=function(t,e,r,n){if(e=new IM(e,n),e.recoveryParam!==null)return e.recoveryParam;for(var i=0;i<4;i++){var o;try{o=this.recoverPubKey(t,e,i)}catch{continue}if(o.eq(r))return i}throw new Error("Unable to find valid recovery factor")}});var ate=H((sgt,ste)=>{"use strict";E();var a_=Ya(),ote=a_.assert,ite=a_.parseBytes,Xv=a_.cachedProperty;function Oo(t,e){this.eddsa=t,this._secret=ite(e.secret),t.isPoint(e.pub)?this._pub=e.pub:this._pubBytes=ite(e.pub)}Oo.fromPublic=function(e,r){return r instanceof Oo?r:new Oo(e,{pub:r})};Oo.fromSecret=function(e,r){return r instanceof Oo?r:new Oo(e,{secret:r})};Oo.prototype.secret=function(){return this._secret};Xv(Oo,"pubBytes",function(){return this.eddsa.encodePoint(this.pub())});Xv(Oo,"pub",function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())});Xv(Oo,"privBytes",function(){var e=this.eddsa,r=this.hash(),n=e.encodingLength-1,i=r.slice(0,e.encodingLength);return i[0]&=248,i[n]&=127,i[n]|=64,i});Xv(Oo,"priv",function(){return this.eddsa.decodeInt(this.privBytes())});Xv(Oo,"hash",function(){return this.eddsa.hash().update(this.secret()).digest()});Xv(Oo,"messagePrefix",function(){return this.hash().slice(this.eddsa.encodingLength)});Oo.prototype.sign=function(e){return ote(this._secret,"KeyPair can only verify"),this.eddsa.sign(e,this)};Oo.prototype.verify=function(e,r){return this.eddsa.verify(e,r,this)};Oo.prototype.getSecret=function(e){return ote(this._secret,"KeyPair is public only"),a_.encode(this.secret(),e)};Oo.prototype.getPublic=function(e){return a_.encode(this.pubBytes(),e)};ste.exports=Oo});var fte=H((cgt,cte)=>{"use strict";E();var uIe=Wu(),kM=Ya(),lIe=kM.assert,OM=kM.cachedProperty,dIe=kM.parseBytes;function Lm(t,e){this.eddsa=t,typeof e!="object"&&(e=dIe(e)),Array.isArray(e)&&(e={R:e.slice(0,t.encodingLength),S:e.slice(t.encodingLength)}),lIe(e.R&&e.S,"Signature without R or S"),t.isPoint(e.R)&&(this._R=e.R),e.S instanceof uIe&&(this._S=e.S),this._Rencoded=Array.isArray(e.R)?e.R:e.Rencoded,this._Sencoded=Array.isArray(e.S)?e.S:e.Sencoded}OM(Lm,"S",function(){return this.eddsa.decodeInt(this.Sencoded())});OM(Lm,"R",function(){return this.eddsa.decodePoint(this.Rencoded())});OM(Lm,"Rencoded",function(){return this.eddsa.encodePoint(this.R())});OM(Lm,"Sencoded",function(){return this.eddsa.encodeInt(this.S())});Lm.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())};Lm.prototype.toHex=function(){return kM.encode(this.toBytes(),"hex").toUpperCase()};cte.exports=Lm});var pte=H((ugt,hte)=>{"use strict";E();var hIe=PM(),pIe=AM(),eb=Ya(),mIe=eb.assert,lte=eb.parseBytes,dte=ate(),ute=fte();function Sa(t){if(mIe(t==="ed25519","only tested with ed25519 so far"),!(this instanceof Sa))return new Sa(t);t=pIe[t].curve,this.curve=t,this.g=t.g,this.g.precompute(t.n.bitLength()+1),this.pointClass=t.point().constructor,this.encodingLength=Math.ceil(t.n.bitLength()/8),this.hash=hIe.sha512}hte.exports=Sa;Sa.prototype.sign=function(e,r){e=lte(e);var n=this.keyFromSecret(r),i=this.hashInt(n.messagePrefix(),e),o=this.g.mul(i),s=this.encodePoint(o),a=this.hashInt(s,n.pubBytes(),e).mul(n.priv()),d=i.add(a).umod(this.curve.n);return this.makeSignature({R:o,S:d,Rencoded:s})};Sa.prototype.verify=function(e,r,n){e=lte(e),r=this.makeSignature(r);var i=this.keyFromPublic(n),o=this.hashInt(r.Rencoded(),i.pubBytes(),e),s=this.g.mul(r.S()),a=r.R().add(i.pub().mul(o));return a.eq(s)};Sa.prototype.hashInt=function(){for(var e=this.hash(),r=0;r<arguments.length;r++)e.update(arguments[r]);return eb.intFromLE(e.digest()).umod(this.curve.n)};Sa.prototype.keyFromPublic=function(e){return dte.fromPublic(this,e)};Sa.prototype.keyFromSecret=function(e){return dte.fromSecret(this,e)};Sa.prototype.makeSignature=function(e){return e instanceof ute?e:new ute(this,e)};Sa.prototype.encodePoint=function(e){var r=e.getY().toArray("le",this.encodingLength);return r[this.encodingLength-1]|=e.getX().isOdd()?128:0,r};Sa.prototype.decodePoint=function(e){e=eb.parseBytes(e);var r=e.length-1,n=e.slice(0,r).concat(e[r]&-129),i=(e[r]&128)!==0,o=eb.intFromLE(n);return this.curve.pointFromY(o,i)};Sa.prototype.encodeInt=function(e){return e.toArray("le",this.encodingLength)};Sa.prototype.decodeInt=function(e){return eb.intFromLE(e)};Sa.prototype.isPoint=function(e){return e instanceof this.pointClass}});var BM=H(mte=>{"use strict";E();var Um=mte;Um.version=WX().version;Um.utils=Ya();Um.rand=ZS();Um.curve=d7();Um.curves=AM();Um.ec=nte();Um.eddsa=pte()});var k7=H((yte,I7)=>{E();(function(t,e){"use strict";function r(x,c){if(!x)throw new Error(c||"Assertion failed")}function n(x,c){x.super_=c;var u=function(){};u.prototype=c.prototype,x.prototype=new u,x.prototype.constructor=x}function i(x,c,u){if(i.isBN(x))return x;this.negative=0,this.words=null,this.length=0,this.red=null,x!==null&&((c==="le"||c==="be")&&(u=c,c=10),this._init(x||0,c||10,u||"be"))}typeof t=="object"?t.exports=i:e.BN=i,i.BN=i,i.wordSize=26;var o;try{typeof window<"u"&&typeof window.Buffer<"u"?o=window.Buffer:o=sr().Buffer}catch{}i.isBN=function(c){return c instanceof i?!0:c!==null&&typeof c=="object"&&c.constructor.wordSize===i.wordSize&&Array.isArray(c.words)},i.max=function(c,u){return c.cmp(u)>0?c:u},i.min=function(c,u){return c.cmp(u)<0?c:u},i.prototype._init=function(c,u,y){if(typeof c=="number")return this._initNumber(c,u,y);if(typeof c=="object")return this._initArray(c,u,y);u==="hex"&&(u=16),r(u===(u|0)&&u>=2&&u<=36),c=c.toString().replace(/\s+/g,"");var l=0;c[0]==="-"&&(l++,this.negative=1),l<c.length&&(u===16?this._parseHex(c,l,y):(this._parseBase(c,u,l),y==="le"&&this._initArray(this.toArray(),u,y)))},i.prototype._initNumber=function(c,u,y){c<0&&(this.negative=1,c=-c),c<67108864?(this.words=[c&67108863],this.length=1):c<4503599627370496?(this.words=[c&67108863,c/67108864&67108863],this.length=2):(r(c<9007199254740992),this.words=[c&67108863,c/67108864&67108863,1],this.length=3),y==="le"&&this._initArray(this.toArray(),u,y)},i.prototype._initArray=function(c,u,y){if(r(typeof c.length=="number"),c.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(c.length/3),this.words=new Array(this.length);for(var l=0;l<this.length;l++)this.words[l]=0;var h,b,_=0;if(y==="be")for(l=c.length-1,h=0;l>=0;l-=3)b=c[l]|c[l-1]<<8|c[l-2]<<16,this.words[h]|=b<<_&67108863,this.words[h+1]=b>>>26-_&67108863,_+=24,_>=26&&(_-=26,h++);else if(y==="le")for(l=0,h=0;l<c.length;l+=3)b=c[l]|c[l+1]<<8|c[l+2]<<16,this.words[h]|=b<<_&67108863,this.words[h+1]=b>>>26-_&67108863,_+=24,_>=26&&(_-=26,h++);return this.strip()};function s(x,c){var u=x.charCodeAt(c);return u>=65&&u<=70?u-55:u>=97&&u<=102?u-87:u-48&15}function a(x,c,u){var y=s(x,u);return u-1>=c&&(y|=s(x,u-1)<<4),y}i.prototype._parseHex=function(c,u,y){this.length=Math.ceil((c.length-u)/6),this.words=new Array(this.length);for(var l=0;l<this.length;l++)this.words[l]=0;var h=0,b=0,_;if(y==="be")for(l=c.length-1;l>=u;l-=2)_=a(c,u,l)<<h,this.words[b]|=_&67108863,h>=18?(h-=18,b+=1,this.words[b]|=_>>>26):h+=8;else{var g=c.length-u;for(l=g%2===0?u+1:u;l<c.length;l+=2)_=a(c,u,l)<<h,this.words[b]|=_&67108863,h>=18?(h-=18,b+=1,this.words[b]|=_>>>26):h+=8}this.strip()};function d(x,c,u,y){for(var l=0,h=Math.min(x.length,u),b=c;b<h;b++){var _=x.charCodeAt(b)-48;l*=y,_>=49?l+=_-49+10:_>=17?l+=_-17+10:l+=_}return l}i.prototype._parseBase=function(c,u,y){this.words=[0],this.length=1;for(var l=0,h=1;h<=67108863;h*=u)l++;l--,h=h/u|0;for(var b=c.length-y,_=b%l,g=Math.min(b,b-_)+y,f=0,v=y;v<g;v+=l)f=d(c,v,v+l,u),this.imuln(h),this.words[0]+f<67108864?this.words[0]+=f:this._iaddn(f);if(_!==0){var O=1;for(f=d(c,v,c.length,u),v=0;v<_;v++)O*=u;this.imuln(O),this.words[0]+f<67108864?this.words[0]+=f:this._iaddn(f)}this.strip()},i.prototype.copy=function(c){c.words=new Array(this.length);for(var u=0;u<this.length;u++)c.words[u]=this.words[u];c.length=this.length,c.negative=this.negative,c.red=this.red},i.prototype.clone=function(){var c=new i(null);return this.copy(c),c},i.prototype._expand=function(c){for(;this.length<c;)this.words[this.length++]=0;return this},i.prototype.strip=function(){for(;this.length>1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},i.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},i.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var m=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],p=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],w=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];i.prototype.toString=function(c,u){c=c||10,u=u|0||1;var y;if(c===16||c==="hex"){y="";for(var l=0,h=0,b=0;b<this.length;b++){var _=this.words[b],g=((_<<l|h)&16777215).toString(16);h=_>>>24-l&16777215,h!==0||b!==this.length-1?y=m[6-g.length]+g+y:y=g+y,l+=2,l>=26&&(l-=26,b--)}for(h!==0&&(y=h.toString(16)+y);y.length%u!==0;)y="0"+y;return this.negative!==0&&(y="-"+y),y}if(c===(c|0)&&c>=2&&c<=36){var f=p[c],v=w[c];y="";var O=this.clone();for(O.negative=0;!O.isZero();){var T=O.modn(v).toString(c);O=O.idivn(v),O.isZero()?y=T+y:y=m[f-T.length]+T+y}for(this.isZero()&&(y="0"+y);y.length%u!==0;)y="0"+y;return this.negative!==0&&(y="-"+y),y}r(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var c=this.words[0];return this.length===2?c+=this.words[1]*67108864:this.length===3&&this.words[2]===1?c+=4503599627370496+this.words[1]*67108864:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-c:c},i.prototype.toJSON=function(){return this.toString(16)},i.prototype.toBuffer=function(c,u){return r(typeof o<"u"),this.toArrayLike(o,c,u)},i.prototype.toArray=function(c,u){return this.toArrayLike(Array,c,u)},i.prototype.toArrayLike=function(c,u,y){var l=this.byteLength(),h=y||Math.max(1,l);r(l<=h,"byte array longer than desired length"),r(h>0,"Requested array length <= 0"),this.strip();var b=u==="le",_=new c(h),g,f,v=this.clone();if(b){for(f=0;!v.isZero();f++)g=v.andln(255),v.iushrn(8),_[f]=g;for(;f<h;f++)_[f]=0}else{for(f=0;f<h-l;f++)_[f]=0;for(f=0;!v.isZero();f++)g=v.andln(255),v.iushrn(8),_[h-f-1]=g}return _},Math.clz32?i.prototype._countBits=function(c){return 32-Math.clz32(c)}:i.prototype._countBits=function(c){var u=c,y=0;return u>=4096&&(y+=13,u>>>=13),u>=64&&(y+=7,u>>>=7),u>=8&&(y+=4,u>>>=4),u>=2&&(y+=2,u>>>=2),y+u},i.prototype._zeroBits=function(c){if(c===0)return 26;var u=c,y=0;return u&8191||(y+=13,u>>>=13),u&127||(y+=7,u>>>=7),u&15||(y+=4,u>>>=4),u&3||(y+=2,u>>>=2),u&1||y++,y},i.prototype.bitLength=function(){var c=this.words[this.length-1],u=this._countBits(c);return(this.length-1)*26+u};function P(x){for(var c=new Array(x.bitLength()),u=0;u<c.length;u++){var y=u/26|0,l=u%26;c[u]=(x.words[y]&1<<l)>>>l}return c}i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var c=0,u=0;u<this.length;u++){var y=this._zeroBits(this.words[u]);if(c+=y,y!==26)break}return c},i.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},i.prototype.toTwos=function(c){return this.negative!==0?this.abs().inotn(c).iaddn(1):this.clone()},i.prototype.fromTwos=function(c){return this.testn(c-1)?this.notn(c).iaddn(1).ineg():this.clone()},i.prototype.isNeg=function(){return this.negative!==0},i.prototype.neg=function(){return this.clone().ineg()},i.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},i.prototype.iuor=function(c){for(;this.length<c.length;)this.words[this.length++]=0;for(var u=0;u<c.length;u++)this.words[u]=this.words[u]|c.words[u];return this.strip()},i.prototype.ior=function(c){return r((this.negative|c.negative)===0),this.iuor(c)},i.prototype.or=function(c){return this.length>c.length?this.clone().ior(c):c.clone().ior(this)},i.prototype.uor=function(c){return this.length>c.length?this.clone().iuor(c):c.clone().iuor(this)},i.prototype.iuand=function(c){var u;this.length>c.length?u=c:u=this;for(var y=0;y<u.length;y++)this.words[y]=this.words[y]&c.words[y];return this.length=u.length,this.strip()},i.prototype.iand=function(c){return r((this.negative|c.negative)===0),this.iuand(c)},i.prototype.and=function(c){return this.length>c.length?this.clone().iand(c):c.clone().iand(this)},i.prototype.uand=function(c){return this.length>c.length?this.clone().iuand(c):c.clone().iuand(this)},i.prototype.iuxor=function(c){var u,y;this.length>c.length?(u=this,y=c):(u=c,y=this);for(var l=0;l<y.length;l++)this.words[l]=u.words[l]^y.words[l];if(this!==u)for(;l<u.length;l++)this.words[l]=u.words[l];return this.length=u.length,this.strip()},i.prototype.ixor=function(c){return r((this.negative|c.negative)===0),this.iuxor(c)},i.prototype.xor=function(c){return this.length>c.length?this.clone().ixor(c):c.clone().ixor(this)},i.prototype.uxor=function(c){return this.length>c.length?this.clone().iuxor(c):c.clone().iuxor(this)},i.prototype.inotn=function(c){r(typeof c=="number"&&c>=0);var u=Math.ceil(c/26)|0,y=c%26;this._expand(u),y>0&&u--;for(var l=0;l<u;l++)this.words[l]=~this.words[l]&67108863;return y>0&&(this.words[l]=~this.words[l]&67108863>>26-y),this.strip()},i.prototype.notn=function(c){return this.clone().inotn(c)},i.prototype.setn=function(c,u){r(typeof c=="number"&&c>=0);var y=c/26|0,l=c%26;return this._expand(y+1),u?this.words[y]=this.words[y]|1<<l:this.words[y]=this.words[y]&~(1<<l),this.strip()},i.prototype.iadd=function(c){var u;if(this.negative!==0&&c.negative===0)return this.negative=0,u=this.isub(c),this.negative^=1,this._normSign();if(this.negative===0&&c.negative!==0)return c.negative=0,u=this.isub(c),c.negative=1,u._normSign();var y,l;this.length>c.length?(y=this,l=c):(y=c,l=this);for(var h=0,b=0;b<l.length;b++)u=(y.words[b]|0)+(l.words[b]|0)+h,this.words[b]=u&67108863,h=u>>>26;for(;h!==0&&b<y.length;b++)u=(y.words[b]|0)+h,this.words[b]=u&67108863,h=u>>>26;if(this.length=y.length,h!==0)this.words[this.length]=h,this.length++;else if(y!==this)for(;b<y.length;b++)this.words[b]=y.words[b];return this},i.prototype.add=function(c){var u;return c.negative!==0&&this.negative===0?(c.negative=0,u=this.sub(c),c.negative^=1,u):c.negative===0&&this.negative!==0?(this.negative=0,u=c.sub(this),this.negative=1,u):this.length>c.length?this.clone().iadd(c):c.clone().iadd(this)},i.prototype.isub=function(c){if(c.negative!==0){c.negative=0;var u=this.iadd(c);return c.negative=1,u._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(c),this.negative=1,this._normSign();var y=this.cmp(c);if(y===0)return this.negative=0,this.length=1,this.words[0]=0,this;var l,h;y>0?(l=this,h=c):(l=c,h=this);for(var b=0,_=0;_<h.length;_++)u=(l.words[_]|0)-(h.words[_]|0)+b,b=u>>26,this.words[_]=u&67108863;for(;b!==0&&_<l.length;_++)u=(l.words[_]|0)+b,b=u>>26,this.words[_]=u&67108863;if(b===0&&_<l.length&&l!==this)for(;_<l.length;_++)this.words[_]=l.words[_];return this.length=Math.max(this.length,_),l!==this&&(this.negative=1),this.strip()},i.prototype.sub=function(c){return this.clone().isub(c)};function S(x,c,u){u.negative=c.negative^x.negative;var y=x.length+c.length|0;u.length=y,y=y-1|0;var l=x.words[0]|0,h=c.words[0]|0,b=l*h,_=b&67108863,g=b/67108864|0;u.words[0]=_;for(var f=1;f<y;f++){for(var v=g>>>26,O=g&67108863,T=Math.min(f,c.length-1),R=Math.max(0,f-x.length+1);R<=T;R++){var z=f-R|0;l=x.words[z]|0,h=c.words[R]|0,b=l*h+O,v+=b/67108864|0,O=b&67108863}u.words[f]=O|0,g=v|0}return g!==0?u.words[f]=g|0:u.length--,u.strip()}var M=function(c,u,y){var l=c.words,h=u.words,b=y.words,_=0,g,f,v,O=l[0]|0,T=O&8191,R=O>>>13,z=l[1]|0,V=z&8191,W=z>>>13,Z=l[2]|0,J=Z&8191,X=Z>>>13,Ee=l[3]|0,re=Ee&8191,ne=Ee>>>13,qe=l[4]|0,ce=qe&8191,ye=qe>>>13,Ne=l[5]|0,ie=Ne&8191,oe=Ne>>>13,ze=l[6]|0,le=ze&8191,me=ze>>>13,ot=l[7]|0,ue=ot&8191,he=ot>>>13,lt=l[8]|0,se=lt&8191,fe=lt>>>13,Lt=l[9]|0,ge=Lt&8191,ve=Lt>>>13,on=h[0]|0,xe=on&8191,Pe=on>>>13,jr=h[1]|0,Se=jr&8191,_e=jr>>>13,Mn=h[2]|0,Me=Mn&8191,Te=Mn>>>13,vi=h[3]|0,Ae=vi&8191,Be=vi>>>13,Pn=h[4]|0,De=Pn&8191,Ie=Pn>>>13,bi=h[5]|0,Re=bi&8191,ke=bi>>>13,wi=h[6]|0,Oe=wi&8191,Ce=wi>>>13,oi=h[7]|0,Q=oi&8191,Y=oi>>>13,ae=h[8]|0,ee=ae&8191,te=ae>>>13,Ke=h[9]|0,de=Ke&8191,pe=Ke>>>13;y.negative=c.negative^u.negative,y.length=19,g=Math.imul(T,xe),f=Math.imul(T,Pe),f=f+Math.imul(R,xe)|0,v=Math.imul(R,Pe);var bt=(_+g|0)+((f&8191)<<13)|0;_=(v+(f>>>13)|0)+(bt>>>26)|0,bt&=67108863,g=Math.imul(V,xe),f=Math.imul(V,Pe),f=f+Math.imul(W,xe)|0,v=Math.imul(W,Pe),g=g+Math.imul(T,Se)|0,f=f+Math.imul(T,_e)|0,f=f+Math.imul(R,Se)|0,v=v+Math.imul(R,_e)|0;var st=(_+g|0)+((f&8191)<<13)|0;_=(v+(f>>>13)|0)+(st>>>26)|0,st&=67108863,g=Math.imul(J,xe),f=Math.imul(J,Pe),f=f+Math.imul(X,xe)|0,v=Math.imul(X,Pe),g=g+Math.imul(V,Se)|0,f=f+Math.imul(V,_e)|0,f=f+Math.imul(W,Se)|0,v=v+Math.imul(W,_e)|0,g=g+Math.imul(T,Me)|0,f=f+Math.imul(T,Te)|0,f=f+Math.imul(R,Me)|0,v=v+Math.imul(R,Te)|0;var Ve=(_+g|0)+((f&8191)<<13)|0;_=(v+(f>>>13)|0)+(Ve>>>26)|0,Ve&=67108863,g=Math.imul(re,xe),f=Math.imul(re,Pe),f=f+Math.imul(ne,xe)|0,v=Math.imul(ne,Pe),g=g+Math.imul(J,Se)|0,f=f+Math.imul(J,_e)|0,f=f+Math.imul(X,Se)|0,v=v+Math.imul(X,_e)|0,g=g+Math.imul(V,Me)|0,f=f+Math.imul(V,Te)|0,f=f+Math.imul(W,Me)|0,v=v+Math.imul(W,Te)|0,g=g+Math.imul(T,Ae)|0,f=f+Math.imul(T,Be)|0,f=f+Math.imul(R,Ae)|0,v=v+Math.imul(R,Be)|0;var Tt=(_+g|0)+((f&8191)<<13)|0;_=(v+(f>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,g=Math.imul(ce,xe),f=Math.imul(ce,Pe),f=f+Math.imul(ye,xe)|0,v=Math.imul(ye,Pe),g=g+Math.imul(re,Se)|0,f=f+Math.imul(re,_e)|0,f=f+Math.imul(ne,Se)|0,v=v+Math.imul(ne,_e)|0,g=g+Math.imul(J,Me)|0,f=f+Math.imul(J,Te)|0,f=f+Math.imul(X,Me)|0,v=v+Math.imul(X,Te)|0,g=g+Math.imul(V,Ae)|0,f=f+Math.imul(V,Be)|0,f=f+Math.imul(W,Ae)|0,v=v+Math.imul(W,Be)|0,g=g+Math.imul(T,De)|0,f=f+Math.imul(T,Ie)|0,f=f+Math.imul(R,De)|0,v=v+Math.imul(R,Ie)|0;var Ut=(_+g|0)+((f&8191)<<13)|0;_=(v+(f>>>13)|0)+(Ut>>>26)|0,Ut&=67108863,g=Math.imul(ie,xe),f=Math.imul(ie,Pe),f=f+Math.imul(oe,xe)|0,v=Math.imul(oe,Pe),g=g+Math.imul(ce,Se)|0,f=f+Math.imul(ce,_e)|0,f=f+Math.imul(ye,Se)|0,v=v+Math.imul(ye,_e)|0,g=g+Math.imul(re,Me)|0,f=f+Math.imul(re,Te)|0,f=f+Math.imul(ne,Me)|0,v=v+Math.imul(ne,Te)|0,g=g+Math.imul(J,Ae)|0,f=f+Math.imul(J,Be)|0,f=f+Math.imul(X,Ae)|0,v=v+Math.imul(X,Be)|0,g=g+Math.imul(V,De)|0,f=f+Math.imul(V,Ie)|0,f=f+Math.imul(W,De)|0,v=v+Math.imul(W,Ie)|0,g=g+Math.imul(T,Re)|0,f=f+Math.imul(T,ke)|0,f=f+Math.imul(R,Re)|0,v=v+Math.imul(R,ke)|0;var Pt=(_+g|0)+((f&8191)<<13)|0;_=(v+(f>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,g=Math.imul(le,xe),f=Math.imul(le,Pe),f=f+Math.imul(me,xe)|0,v=Math.imul(me,Pe),g=g+Math.imul(ie,Se)|0,f=f+Math.imul(ie,_e)|0,f=f+Math.imul(oe,Se)|0,v=v+Math.imul(oe,_e)|0,g=g+Math.imul(ce,Me)|0,f=f+Math.imul(ce,Te)|0,f=f+Math.imul(ye,Me)|0,v=v+Math.imul(ye,Te)|0,g=g+Math.imul(re,Ae)|0,f=f+Math.imul(re,Be)|0,f=f+Math.imul(ne,Ae)|0,v=v+Math.imul(ne,Be)|0,g=g+Math.imul(J,De)|0,f=f+Math.imul(J,Ie)|0,f=f+Math.imul(X,De)|0,v=v+Math.imul(X,Ie)|0,g=g+Math.imul(V,Re)|0,f=f+Math.imul(V,ke)|0,f=f+Math.imul(W,Re)|0,v=v+Math.imul(W,ke)|0,g=g+Math.imul(T,Oe)|0,f=f+Math.imul(T,Ce)|0,f=f+Math.imul(R,Oe)|0,v=v+Math.imul(R,Ce)|0;var yt=(_+g|0)+((f&8191)<<13)|0;_=(v+(f>>>13)|0)+(yt>>>26)|0,yt&=67108863,g=Math.imul(ue,xe),f=Math.imul(ue,Pe),f=f+Math.imul(he,xe)|0,v=Math.imul(he,Pe),g=g+Math.imul(le,Se)|0,f=f+Math.imul(le,_e)|0,f=f+Math.imul(me,Se)|0,v=v+Math.imul(me,_e)|0,g=g+Math.imul(ie,Me)|0,f=f+Math.imul(ie,Te)|0,f=f+Math.imul(oe,Me)|0,v=v+Math.imul(oe,Te)|0,g=g+Math.imul(ce,Ae)|0,f=f+Math.imul(ce,Be)|0,f=f+Math.imul(ye,Ae)|0,v=v+Math.imul(ye,Be)|0,g=g+Math.imul(re,De)|0,f=f+Math.imul(re,Ie)|0,f=f+Math.imul(ne,De)|0,v=v+Math.imul(ne,Ie)|0,g=g+Math.imul(J,Re)|0,f=f+Math.imul(J,ke)|0,f=f+Math.imul(X,Re)|0,v=v+Math.imul(X,ke)|0,g=g+Math.imul(V,Oe)|0,f=f+Math.imul(V,Ce)|0,f=f+Math.imul(W,Oe)|0,v=v+Math.imul(W,Ce)|0,g=g+Math.imul(T,Q)|0,f=f+Math.imul(T,Y)|0,f=f+Math.imul(R,Q)|0,v=v+Math.imul(R,Y)|0;var Rt=(_+g|0)+((f&8191)<<13)|0;_=(v+(f>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,g=Math.imul(se,xe),f=Math.imul(se,Pe),f=f+Math.imul(fe,xe)|0,v=Math.imul(fe,Pe),g=g+Math.imul(ue,Se)|0,f=f+Math.imul(ue,_e)|0,f=f+Math.imul(he,Se)|0,v=v+Math.imul(he,_e)|0,g=g+Math.imul(le,Me)|0,f=f+Math.imul(le,Te)|0,f=f+Math.imul(me,Me)|0,v=v+Math.imul(me,Te)|0,g=g+Math.imul(ie,Ae)|0,f=f+Math.imul(ie,Be)|0,f=f+Math.imul(oe,Ae)|0,v=v+Math.imul(oe,Be)|0,g=g+Math.imul(ce,De)|0,f=f+Math.imul(ce,Ie)|0,f=f+Math.imul(ye,De)|0,v=v+Math.imul(ye,Ie)|0,g=g+Math.imul(re,Re)|0,f=f+Math.imul(re,ke)|0,f=f+Math.imul(ne,Re)|0,v=v+Math.imul(ne,ke)|0,g=g+Math.imul(J,Oe)|0,f=f+Math.imul(J,Ce)|0,f=f+Math.imul(X,Oe)|0,v=v+Math.imul(X,Ce)|0,g=g+Math.imul(V,Q)|0,f=f+Math.imul(V,Y)|0,f=f+Math.imul(W,Q)|0,v=v+Math.imul(W,Y)|0,g=g+Math.imul(T,ee)|0,f=f+Math.imul(T,te)|0,f=f+Math.imul(R,ee)|0,v=v+Math.imul(R,te)|0;var _t=(_+g|0)+((f&8191)<<13)|0;_=(v+(f>>>13)|0)+(_t>>>26)|0,_t&=67108863,g=Math.imul(ge,xe),f=Math.imul(ge,Pe),f=f+Math.imul(ve,xe)|0,v=Math.imul(ve,Pe),g=g+Math.imul(se,Se)|0,f=f+Math.imul(se,_e)|0,f=f+Math.imul(fe,Se)|0,v=v+Math.imul(fe,_e)|0,g=g+Math.imul(ue,Me)|0,f=f+Math.imul(ue,Te)|0,f=f+Math.imul(he,Me)|0,v=v+Math.imul(he,Te)|0,g=g+Math.imul(le,Ae)|0,f=f+Math.imul(le,Be)|0,f=f+Math.imul(me,Ae)|0,v=v+Math.imul(me,Be)|0,g=g+Math.imul(ie,De)|0,f=f+Math.imul(ie,Ie)|0,f=f+Math.imul(oe,De)|0,v=v+Math.imul(oe,Ie)|0,g=g+Math.imul(ce,Re)|0,f=f+Math.imul(ce,ke)|0,f=f+Math.imul(ye,Re)|0,v=v+Math.imul(ye,ke)|0,g=g+Math.imul(re,Oe)|0,f=f+Math.imul(re,Ce)|0,f=f+Math.imul(ne,Oe)|0,v=v+Math.imul(ne,Ce)|0,g=g+Math.imul(J,Q)|0,f=f+Math.imul(J,Y)|0,f=f+Math.imul(X,Q)|0,v=v+Math.imul(X,Y)|0,g=g+Math.imul(V,ee)|0,f=f+Math.imul(V,te)|0,f=f+Math.imul(W,ee)|0,v=v+Math.imul(W,te)|0,g=g+Math.imul(T,de)|0,f=f+Math.imul(T,pe)|0,f=f+Math.imul(R,de)|0,v=v+Math.imul(R,pe)|0;var Lr=(_+g|0)+((f&8191)<<13)|0;_=(v+(f>>>13)|0)+(Lr>>>26)|0,Lr&=67108863,g=Math.imul(ge,Se),f=Math.imul(ge,_e),f=f+Math.imul(ve,Se)|0,v=Math.imul(ve,_e),g=g+Math.imul(se,Me)|0,f=f+Math.imul(se,Te)|0,f=f+Math.imul(fe,Me)|0,v=v+Math.imul(fe,Te)|0,g=g+Math.imul(ue,Ae)|0,f=f+Math.imul(ue,Be)|0,f=f+Math.imul(he,Ae)|0,v=v+Math.imul(he,Be)|0,g=g+Math.imul(le,De)|0,f=f+Math.imul(le,Ie)|0,f=f+Math.imul(me,De)|0,v=v+Math.imul(me,Ie)|0,g=g+Math.imul(ie,Re)|0,f=f+Math.imul(ie,ke)|0,f=f+Math.imul(oe,Re)|0,v=v+Math.imul(oe,ke)|0,g=g+Math.imul(ce,Oe)|0,f=f+Math.imul(ce,Ce)|0,f=f+Math.imul(ye,Oe)|0,v=v+Math.imul(ye,Ce)|0,g=g+Math.imul(re,Q)|0,f=f+Math.imul(re,Y)|0,f=f+Math.imul(ne,Q)|0,v=v+Math.imul(ne,Y)|0,g=g+Math.imul(J,ee)|0,f=f+Math.imul(J,te)|0,f=f+Math.imul(X,ee)|0,v=v+Math.imul(X,te)|0,g=g+Math.imul(V,de)|0,f=f+Math.imul(V,pe)|0,f=f+Math.imul(W,de)|0,v=v+Math.imul(W,pe)|0;var nr=(_+g|0)+((f&8191)<<13)|0;_=(v+(f>>>13)|0)+(nr>>>26)|0,nr&=67108863,g=Math.imul(ge,Me),f=Math.imul(ge,Te),f=f+Math.imul(ve,Me)|0,v=Math.imul(ve,Te),g=g+Math.imul(se,Ae)|0,f=f+Math.imul(se,Be)|0,f=f+Math.imul(fe,Ae)|0,v=v+Math.imul(fe,Be)|0,g=g+Math.imul(ue,De)|0,f=f+Math.imul(ue,Ie)|0,f=f+Math.imul(he,De)|0,v=v+Math.imul(he,Ie)|0,g=g+Math.imul(le,Re)|0,f=f+Math.imul(le,ke)|0,f=f+Math.imul(me,Re)|0,v=v+Math.imul(me,ke)|0,g=g+Math.imul(ie,Oe)|0,f=f+Math.imul(ie,Ce)|0,f=f+Math.imul(oe,Oe)|0,v=v+Math.imul(oe,Ce)|0,g=g+Math.imul(ce,Q)|0,f=f+Math.imul(ce,Y)|0,f=f+Math.imul(ye,Q)|0,v=v+Math.imul(ye,Y)|0,g=g+Math.imul(re,ee)|0,f=f+Math.imul(re,te)|0,f=f+Math.imul(ne,ee)|0,v=v+Math.imul(ne,te)|0,g=g+Math.imul(J,de)|0,f=f+Math.imul(J,pe)|0,f=f+Math.imul(X,de)|0,v=v+Math.imul(X,pe)|0;var lr=(_+g|0)+((f&8191)<<13)|0;_=(v+(f>>>13)|0)+(lr>>>26)|0,lr&=67108863,g=Math.imul(ge,Ae),f=Math.imul(ge,Be),f=f+Math.imul(ve,Ae)|0,v=Math.imul(ve,Be),g=g+Math.imul(se,De)|0,f=f+Math.imul(se,Ie)|0,f=f+Math.imul(fe,De)|0,v=v+Math.imul(fe,Ie)|0,g=g+Math.imul(ue,Re)|0,f=f+Math.imul(ue,ke)|0,f=f+Math.imul(he,Re)|0,v=v+Math.imul(he,ke)|0,g=g+Math.imul(le,Oe)|0,f=f+Math.imul(le,Ce)|0,f=f+Math.imul(me,Oe)|0,v=v+Math.imul(me,Ce)|0,g=g+Math.imul(ie,Q)|0,f=f+Math.imul(ie,Y)|0,f=f+Math.imul(oe,Q)|0,v=v+Math.imul(oe,Y)|0,g=g+Math.imul(ce,ee)|0,f=f+Math.imul(ce,te)|0,f=f+Math.imul(ye,ee)|0,v=v+Math.imul(ye,te)|0,g=g+Math.imul(re,de)|0,f=f+Math.imul(re,pe)|0,f=f+Math.imul(ne,de)|0,v=v+Math.imul(ne,pe)|0;var xt=(_+g|0)+((f&8191)<<13)|0;_=(v+(f>>>13)|0)+(xt>>>26)|0,xt&=67108863,g=Math.imul(ge,De),f=Math.imul(ge,Ie),f=f+Math.imul(ve,De)|0,v=Math.imul(ve,Ie),g=g+Math.imul(se,Re)|0,f=f+Math.imul(se,ke)|0,f=f+Math.imul(fe,Re)|0,v=v+Math.imul(fe,ke)|0,g=g+Math.imul(ue,Oe)|0,f=f+Math.imul(ue,Ce)|0,f=f+Math.imul(he,Oe)|0,v=v+Math.imul(he,Ce)|0,g=g+Math.imul(le,Q)|0,f=f+Math.imul(le,Y)|0,f=f+Math.imul(me,Q)|0,v=v+Math.imul(me,Y)|0,g=g+Math.imul(ie,ee)|0,f=f+Math.imul(ie,te)|0,f=f+Math.imul(oe,ee)|0,v=v+Math.imul(oe,te)|0,g=g+Math.imul(ce,de)|0,f=f+Math.imul(ce,pe)|0,f=f+Math.imul(ye,de)|0,v=v+Math.imul(ye,pe)|0;var ir=(_+g|0)+((f&8191)<<13)|0;_=(v+(f>>>13)|0)+(ir>>>26)|0,ir&=67108863,g=Math.imul(ge,Re),f=Math.imul(ge,ke),f=f+Math.imul(ve,Re)|0,v=Math.imul(ve,ke),g=g+Math.imul(se,Oe)|0,f=f+Math.imul(se,Ce)|0,f=f+Math.imul(fe,Oe)|0,v=v+Math.imul(fe,Ce)|0,g=g+Math.imul(ue,Q)|0,f=f+Math.imul(ue,Y)|0,f=f+Math.imul(he,Q)|0,v=v+Math.imul(he,Y)|0,g=g+Math.imul(le,ee)|0,f=f+Math.imul(le,te)|0,f=f+Math.imul(me,ee)|0,v=v+Math.imul(me,te)|0,g=g+Math.imul(ie,de)|0,f=f+Math.imul(ie,pe)|0,f=f+Math.imul(oe,de)|0,v=v+Math.imul(oe,pe)|0;var dr=(_+g|0)+((f&8191)<<13)|0;_=(v+(f>>>13)|0)+(dr>>>26)|0,dr&=67108863,g=Math.imul(ge,Oe),f=Math.imul(ge,Ce),f=f+Math.imul(ve,Oe)|0,v=Math.imul(ve,Ce),g=g+Math.imul(se,Q)|0,f=f+Math.imul(se,Y)|0,f=f+Math.imul(fe,Q)|0,v=v+Math.imul(fe,Y)|0,g=g+Math.imul(ue,ee)|0,f=f+Math.imul(ue,te)|0,f=f+Math.imul(he,ee)|0,v=v+Math.imul(he,te)|0,g=g+Math.imul(le,de)|0,f=f+Math.imul(le,pe)|0,f=f+Math.imul(me,de)|0,v=v+Math.imul(me,pe)|0;var Er=(_+g|0)+((f&8191)<<13)|0;_=(v+(f>>>13)|0)+(Er>>>26)|0,Er&=67108863,g=Math.imul(ge,Q),f=Math.imul(ge,Y),f=f+Math.imul(ve,Q)|0,v=Math.imul(ve,Y),g=g+Math.imul(se,ee)|0,f=f+Math.imul(se,te)|0,f=f+Math.imul(fe,ee)|0,v=v+Math.imul(fe,te)|0,g=g+Math.imul(ue,de)|0,f=f+Math.imul(ue,pe)|0,f=f+Math.imul(he,de)|0,v=v+Math.imul(he,pe)|0;var Ur=(_+g|0)+((f&8191)<<13)|0;_=(v+(f>>>13)|0)+(Ur>>>26)|0,Ur&=67108863,g=Math.imul(ge,ee),f=Math.imul(ge,te),f=f+Math.imul(ve,ee)|0,v=Math.imul(ve,te),g=g+Math.imul(se,de)|0,f=f+Math.imul(se,pe)|0,f=f+Math.imul(fe,de)|0,v=v+Math.imul(fe,pe)|0;var Rr=(_+g|0)+((f&8191)<<13)|0;_=(v+(f>>>13)|0)+(Rr>>>26)|0,Rr&=67108863,g=Math.imul(ge,de),f=Math.imul(ge,pe),f=f+Math.imul(ve,de)|0,v=Math.imul(ve,pe);var Hr=(_+g|0)+((f&8191)<<13)|0;return _=(v+(f>>>13)|0)+(Hr>>>26)|0,Hr&=67108863,b[0]=bt,b[1]=st,b[2]=Ve,b[3]=Tt,b[4]=Ut,b[5]=Pt,b[6]=yt,b[7]=Rt,b[8]=_t,b[9]=Lr,b[10]=nr,b[11]=lr,b[12]=xt,b[13]=ir,b[14]=dr,b[15]=Er,b[16]=Ur,b[17]=Rr,b[18]=Hr,_!==0&&(b[19]=_,y.length++),y};Math.imul||(M=S);function A(x,c,u){u.negative=c.negative^x.negative,u.length=x.length+c.length;for(var y=0,l=0,h=0;h<u.length-1;h++){var b=l;l=0;for(var _=y&67108863,g=Math.min(h,c.length-1),f=Math.max(0,h-x.length+1);f<=g;f++){var v=h-f,O=x.words[v]|0,T=c.words[f]|0,R=O*T,z=R&67108863;b=b+(R/67108864|0)|0,z=z+_|0,_=z&67108863,b=b+(z>>>26)|0,l+=b>>>26,b&=67108863}u.words[h]=_,y=b,b=l}return y!==0?u.words[h]=y:u.length--,u.strip()}function B(x,c,u){var y=new I;return y.mulp(x,c,u)}i.prototype.mulTo=function(c,u){var y,l=this.length+c.length;return this.length===10&&c.length===10?y=M(this,c,u):l<63?y=S(this,c,u):l<1024?y=A(this,c,u):y=B(this,c,u),y};function I(x,c){this.x=x,this.y=c}I.prototype.makeRBT=function(c){for(var u=new Array(c),y=i.prototype._countBits(c)-1,l=0;l<c;l++)u[l]=this.revBin(l,y,c);return u},I.prototype.revBin=function(c,u,y){if(c===0||c===y-1)return c;for(var l=0,h=0;h<u;h++)l|=(c&1)<<u-h-1,c>>=1;return l},I.prototype.permute=function(c,u,y,l,h,b){for(var _=0;_<b;_++)l[_]=u[c[_]],h[_]=y[c[_]]},I.prototype.transform=function(c,u,y,l,h,b){this.permute(b,c,u,y,l,h);for(var _=1;_<h;_<<=1)for(var g=_<<1,f=Math.cos(2*Math.PI/g),v=Math.sin(2*Math.PI/g),O=0;O<h;O+=g)for(var T=f,R=v,z=0;z<_;z++){var V=y[O+z],W=l[O+z],Z=y[O+z+_],J=l[O+z+_],X=T*Z-R*J;J=T*J+R*Z,Z=X,y[O+z]=V+Z,l[O+z]=W+J,y[O+z+_]=V-Z,l[O+z+_]=W-J,z!==g&&(X=f*T-v*R,R=f*R+v*T,T=X)}},I.prototype.guessLen13b=function(c,u){var y=Math.max(u,c)|1,l=y&1,h=0;for(y=y/2|0;y;y=y>>>1)h++;return 1<<h+1+l},I.prototype.conjugate=function(c,u,y){if(!(y<=1))for(var l=0;l<y/2;l++){var h=c[l];c[l]=c[y-l-1],c[y-l-1]=h,h=u[l],u[l]=-u[y-l-1],u[y-l-1]=-h}},I.prototype.normalize13b=function(c,u){for(var y=0,l=0;l<u/2;l++){var h=Math.round(c[2*l+1]/u)*8192+Math.round(c[2*l]/u)+y;c[l]=h&67108863,h<67108864?y=0:y=h/67108864|0}return c},I.prototype.convert13b=function(c,u,y,l){for(var h=0,b=0;b<u;b++)h=h+(c[b]|0),y[2*b]=h&8191,h=h>>>13,y[2*b+1]=h&8191,h=h>>>13;for(b=2*u;b<l;++b)y[b]=0;r(h===0),r((h&-8192)===0)},I.prototype.stub=function(c){for(var u=new Array(c),y=0;y<c;y++)u[y]=0;return u},I.prototype.mulp=function(c,u,y){var l=2*this.guessLen13b(c.length,u.length),h=this.makeRBT(l),b=this.stub(l),_=new Array(l),g=new Array(l),f=new Array(l),v=new Array(l),O=new Array(l),T=new Array(l),R=y.words;R.length=l,this.convert13b(c.words,c.length,_,l),this.convert13b(u.words,u.length,v,l),this.transform(_,b,g,f,l,h),this.transform(v,b,O,T,l,h);for(var z=0;z<l;z++){var V=g[z]*O[z]-f[z]*T[z];f[z]=g[z]*T[z]+f[z]*O[z],g[z]=V}return this.conjugate(g,f,l),this.transform(g,f,R,b,l,h),this.conjugate(R,b,l),this.normalize13b(R,l),y.negative=c.negative^u.negative,y.length=c.length+u.length,y.strip()},i.prototype.mul=function(c){var u=new i(null);return u.words=new Array(this.length+c.length),this.mulTo(c,u)},i.prototype.mulf=function(c){var u=new i(null);return u.words=new Array(this.length+c.length),B(this,c,u)},i.prototype.imul=function(c){return this.clone().mulTo(c,this)},i.prototype.imuln=function(c){r(typeof c=="number"),r(c<67108864);for(var u=0,y=0;y<this.length;y++){var l=(this.words[y]|0)*c,h=(l&67108863)+(u&67108863);u>>=26,u+=l/67108864|0,u+=h>>>26,this.words[y]=h&67108863}return u!==0&&(this.words[y]=u,this.length++),this},i.prototype.muln=function(c){return this.clone().imuln(c)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(c){var u=P(c);if(u.length===0)return new i(1);for(var y=this,l=0;l<u.length&&u[l]===0;l++,y=y.sqr());if(++l<u.length)for(var h=y.sqr();l<u.length;l++,h=h.sqr())u[l]!==0&&(y=y.mul(h));return y},i.prototype.iushln=function(c){r(typeof c=="number"&&c>=0);var u=c%26,y=(c-u)/26,l=67108863>>>26-u<<26-u,h;if(u!==0){var b=0;for(h=0;h<this.length;h++){var _=this.words[h]&l,g=(this.words[h]|0)-_<<u;this.words[h]=g|b,b=_>>>26-u}b&&(this.words[h]=b,this.length++)}if(y!==0){for(h=this.length-1;h>=0;h--)this.words[h+y]=this.words[h];for(h=0;h<y;h++)this.words[h]=0;this.length+=y}return this.strip()},i.prototype.ishln=function(c){return r(this.negative===0),this.iushln(c)},i.prototype.iushrn=function(c,u,y){r(typeof c=="number"&&c>=0);var l;u?l=(u-u%26)/26:l=0;var h=c%26,b=Math.min((c-h)/26,this.length),_=67108863^67108863>>>h<<h,g=y;if(l-=b,l=Math.max(0,l),g){for(var f=0;f<b;f++)g.words[f]=this.words[f];g.length=b}if(b!==0)if(this.length>b)for(this.length-=b,f=0;f<this.length;f++)this.words[f]=this.words[f+b];else this.words[0]=0,this.length=1;var v=0;for(f=this.length-1;f>=0&&(v!==0||f>=l);f--){var O=this.words[f]|0;this.words[f]=v<<26-h|O>>>h,v=O&_}return g&&v!==0&&(g.words[g.length++]=v),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},i.prototype.ishrn=function(c,u,y){return r(this.negative===0),this.iushrn(c,u,y)},i.prototype.shln=function(c){return this.clone().ishln(c)},i.prototype.ushln=function(c){return this.clone().iushln(c)},i.prototype.shrn=function(c){return this.clone().ishrn(c)},i.prototype.ushrn=function(c){return this.clone().iushrn(c)},i.prototype.testn=function(c){r(typeof c=="number"&&c>=0);var u=c%26,y=(c-u)/26,l=1<<u;if(this.length<=y)return!1;var h=this.words[y];return!!(h&l)},i.prototype.imaskn=function(c){r(typeof c=="number"&&c>=0);var u=c%26,y=(c-u)/26;if(r(this.negative===0,"imaskn works only with positive numbers"),this.length<=y)return this;if(u!==0&&y++,this.length=Math.min(y,this.length),u!==0){var l=67108863^67108863>>>u<<u;this.words[this.length-1]&=l}return this.strip()},i.prototype.maskn=function(c){return this.clone().imaskn(c)},i.prototype.iaddn=function(c){return r(typeof c=="number"),r(c<67108864),c<0?this.isubn(-c):this.negative!==0?this.length===1&&(this.words[0]|0)<c?(this.words[0]=c-(this.words[0]|0),this.negative=0,this):(this.negative=0,this.isubn(c),this.negative=1,this):this._iaddn(c)},i.prototype._iaddn=function(c){this.words[0]+=c;for(var u=0;u<this.length&&this.words[u]>=67108864;u++)this.words[u]-=67108864,u===this.length-1?this.words[u+1]=1:this.words[u+1]++;return this.length=Math.max(this.length,u+1),this},i.prototype.isubn=function(c){if(r(typeof c=="number"),r(c<67108864),c<0)return this.iaddn(-c);if(this.negative!==0)return this.negative=0,this.iaddn(c),this.negative=1,this;if(this.words[0]-=c,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var u=0;u<this.length&&this.words[u]<0;u++)this.words[u]+=67108864,this.words[u+1]-=1;return this.strip()},i.prototype.addn=function(c){return this.clone().iaddn(c)},i.prototype.subn=function(c){return this.clone().isubn(c)},i.prototype.iabs=function(){return this.negative=0,this},i.prototype.abs=function(){return this.clone().iabs()},i.prototype._ishlnsubmul=function(c,u,y){var l=c.length+y,h;this._expand(l);var b,_=0;for(h=0;h<c.length;h++){b=(this.words[h+y]|0)+_;var g=(c.words[h]|0)*u;b-=g&67108863,_=(b>>26)-(g/67108864|0),this.words[h+y]=b&67108863}for(;h<this.length-y;h++)b=(this.words[h+y]|0)+_,_=b>>26,this.words[h+y]=b&67108863;if(_===0)return this.strip();for(r(_===-1),_=0,h=0;h<this.length;h++)b=-(this.words[h]|0)+_,_=b>>26,this.words[h]=b&67108863;return this.negative=1,this.strip()},i.prototype._wordDiv=function(c,u){var y=this.length-c.length,l=this.clone(),h=c,b=h.words[h.length-1]|0,_=this._countBits(b);y=26-_,y!==0&&(h=h.ushln(y),l.iushln(y),b=h.words[h.length-1]|0);var g=l.length-h.length,f;if(u!=="mod"){f=new i(null),f.length=g+1,f.words=new Array(f.length);for(var v=0;v<f.length;v++)f.words[v]=0}var O=l.clone()._ishlnsubmul(h,1,g);O.negative===0&&(l=O,f&&(f.words[g]=1));for(var T=g-1;T>=0;T--){var R=(l.words[h.length+T]|0)*67108864+(l.words[h.length+T-1]|0);for(R=Math.min(R/b|0,67108863),l._ishlnsubmul(h,R,T);l.negative!==0;)R--,l.negative=0,l._ishlnsubmul(h,1,T),l.isZero()||(l.negative^=1);f&&(f.words[T]=R)}return f&&f.strip(),l.strip(),u!=="div"&&y!==0&&l.iushrn(y),{div:f||null,mod:l}},i.prototype.divmod=function(c,u,y){if(r(!c.isZero()),this.isZero())return{div:new i(0),mod:new i(0)};var l,h,b;return this.negative!==0&&c.negative===0?(b=this.neg().divmod(c,u),u!=="mod"&&(l=b.div.neg()),u!=="div"&&(h=b.mod.neg(),y&&h.negative!==0&&h.iadd(c)),{div:l,mod:h}):this.negative===0&&c.negative!==0?(b=this.divmod(c.neg(),u),u!=="mod"&&(l=b.div.neg()),{div:l,mod:b.mod}):this.negative&c.negative?(b=this.neg().divmod(c.neg(),u),u!=="div"&&(h=b.mod.neg(),y&&h.negative!==0&&h.isub(c)),{div:b.div,mod:h}):c.length>this.length||this.cmp(c)<0?{div:new i(0),mod:this}:c.length===1?u==="div"?{div:this.divn(c.words[0]),mod:null}:u==="mod"?{div:null,mod:new i(this.modn(c.words[0]))}:{div:this.divn(c.words[0]),mod:new i(this.modn(c.words[0]))}:this._wordDiv(c,u)},i.prototype.div=function(c){return this.divmod(c,"div",!1).div},i.prototype.mod=function(c){return this.divmod(c,"mod",!1).mod},i.prototype.umod=function(c){return this.divmod(c,"mod",!0).mod},i.prototype.divRound=function(c){var u=this.divmod(c);if(u.mod.isZero())return u.div;var y=u.div.negative!==0?u.mod.isub(c):u.mod,l=c.ushrn(1),h=c.andln(1),b=y.cmp(l);return b<0||h===1&&b===0?u.div:u.div.negative!==0?u.div.isubn(1):u.div.iaddn(1)},i.prototype.modn=function(c){r(c<=67108863);for(var u=(1<<26)%c,y=0,l=this.length-1;l>=0;l--)y=(u*y+(this.words[l]|0))%c;return y},i.prototype.idivn=function(c){r(c<=67108863);for(var u=0,y=this.length-1;y>=0;y--){var l=(this.words[y]|0)+u*67108864;this.words[y]=l/c|0,u=l%c}return this.strip()},i.prototype.divn=function(c){return this.clone().idivn(c)},i.prototype.egcd=function(c){r(c.negative===0),r(!c.isZero());var u=this,y=c.clone();u.negative!==0?u=u.umod(c):u=u.clone();for(var l=new i(1),h=new i(0),b=new i(0),_=new i(1),g=0;u.isEven()&&y.isEven();)u.iushrn(1),y.iushrn(1),++g;for(var f=y.clone(),v=u.clone();!u.isZero();){for(var O=0,T=1;!(u.words[0]&T)&&O<26;++O,T<<=1);if(O>0)for(u.iushrn(O);O-- >0;)(l.isOdd()||h.isOdd())&&(l.iadd(f),h.isub(v)),l.iushrn(1),h.iushrn(1);for(var R=0,z=1;!(y.words[0]&z)&&R<26;++R,z<<=1);if(R>0)for(y.iushrn(R);R-- >0;)(b.isOdd()||_.isOdd())&&(b.iadd(f),_.isub(v)),b.iushrn(1),_.iushrn(1);u.cmp(y)>=0?(u.isub(y),l.isub(b),h.isub(_)):(y.isub(u),b.isub(l),_.isub(h))}return{a:b,b:_,gcd:y.iushln(g)}},i.prototype._invmp=function(c){r(c.negative===0),r(!c.isZero());var u=this,y=c.clone();u.negative!==0?u=u.umod(c):u=u.clone();for(var l=new i(1),h=new i(0),b=y.clone();u.cmpn(1)>0&&y.cmpn(1)>0;){for(var _=0,g=1;!(u.words[0]&g)&&_<26;++_,g<<=1);if(_>0)for(u.iushrn(_);_-- >0;)l.isOdd()&&l.iadd(b),l.iushrn(1);for(var f=0,v=1;!(y.words[0]&v)&&f<26;++f,v<<=1);if(f>0)for(y.iushrn(f);f-- >0;)h.isOdd()&&h.iadd(b),h.iushrn(1);u.cmp(y)>=0?(u.isub(y),l.isub(h)):(y.isub(u),h.isub(l))}var O;return u.cmpn(1)===0?O=l:O=h,O.cmpn(0)<0&&O.iadd(c),O},i.prototype.gcd=function(c){if(this.isZero())return c.abs();if(c.isZero())return this.abs();var u=this.clone(),y=c.clone();u.negative=0,y.negative=0;for(var l=0;u.isEven()&&y.isEven();l++)u.iushrn(1),y.iushrn(1);do{for(;u.isEven();)u.iushrn(1);for(;y.isEven();)y.iushrn(1);var h=u.cmp(y);if(h<0){var b=u;u=y,y=b}else if(h===0||y.cmpn(1)===0)break;u.isub(y)}while(!0);return y.iushln(l)},i.prototype.invm=function(c){return this.egcd(c).a.umod(c)},i.prototype.isEven=function(){return(this.words[0]&1)===0},i.prototype.isOdd=function(){return(this.words[0]&1)===1},i.prototype.andln=function(c){return this.words[0]&c},i.prototype.bincn=function(c){r(typeof c=="number");var u=c%26,y=(c-u)/26,l=1<<u;if(this.length<=y)return this._expand(y+1),this.words[y]|=l,this;for(var h=l,b=y;h!==0&&b<this.length;b++){var _=this.words[b]|0;_+=h,h=_>>>26,_&=67108863,this.words[b]=_}return h!==0&&(this.words[b]=h,this.length++),this},i.prototype.isZero=function(){return this.length===1&&this.words[0]===0},i.prototype.cmpn=function(c){var u=c<0;if(this.negative!==0&&!u)return-1;if(this.negative===0&&u)return 1;this.strip();var y;if(this.length>1)y=1;else{u&&(c=-c),r(c<=67108863,"Number is too big");var l=this.words[0]|0;y=l===c?0:l<c?-1:1}return this.negative!==0?-y|0:y},i.prototype.cmp=function(c){if(this.negative!==0&&c.negative===0)return-1;if(this.negative===0&&c.negative!==0)return 1;var u=this.ucmp(c);return this.negative!==0?-u|0:u},i.prototype.ucmp=function(c){if(this.length>c.length)return 1;if(this.length<c.length)return-1;for(var u=0,y=this.length-1;y>=0;y--){var l=this.words[y]|0,h=c.words[y]|0;if(l!==h){l<h?u=-1:l>h&&(u=1);break}}return u},i.prototype.gtn=function(c){return this.cmpn(c)===1},i.prototype.gt=function(c){return this.cmp(c)===1},i.prototype.gten=function(c){return this.cmpn(c)>=0},i.prototype.gte=function(c){return this.cmp(c)>=0},i.prototype.ltn=function(c){return this.cmpn(c)===-1},i.prototype.lt=function(c){return this.cmp(c)===-1},i.prototype.lten=function(c){return this.cmpn(c)<=0},i.prototype.lte=function(c){return this.cmp(c)<=0},i.prototype.eqn=function(c){return this.cmpn(c)===0},i.prototype.eq=function(c){return this.cmp(c)===0},i.red=function(c){return new N(c)},i.prototype.toRed=function(c){return r(!this.red,"Already a number in reduction context"),r(this.negative===0,"red works only with positives"),c.convertTo(this)._forceRed(c)},i.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(c){return this.red=c,this},i.prototype.forceRed=function(c){return r(!this.red,"Already a number in reduction context"),this._forceRed(c)},i.prototype.redAdd=function(c){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,c)},i.prototype.redIAdd=function(c){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,c)},i.prototype.redSub=function(c){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,c)},i.prototype.redISub=function(c){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,c)},i.prototype.redShl=function(c){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,c)},i.prototype.redMul=function(c){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,c),this.red.mul(this,c)},i.prototype.redIMul=function(c){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,c),this.red.imul(this,c)},i.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(c){return r(this.red&&!c.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,c)};var C={k256:null,p224:null,p192:null,p25519:null};function k(x,c){this.name=x,this.p=new i(c,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}k.prototype._tmp=function(){var c=new i(null);return c.words=new Array(Math.ceil(this.n/13)),c},k.prototype.ireduce=function(c){var u=c,y;do this.split(u,this.tmp),u=this.imulK(u),u=u.iadd(this.tmp),y=u.bitLength();while(y>this.n);var l=y<this.n?-1:u.ucmp(this.p);return l===0?(u.words[0]=0,u.length=1):l>0?u.isub(this.p):u.strip!==void 0?u.strip():u._strip(),u},k.prototype.split=function(c,u){c.iushrn(this.n,0,u)},k.prototype.imulK=function(c){return c.imul(this.k)};function q(){k.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}n(q,k),q.prototype.split=function(c,u){for(var y=4194303,l=Math.min(c.length,9),h=0;h<l;h++)u.words[h]=c.words[h];if(u.length=l,c.length<=9){c.words[0]=0,c.length=1;return}var b=c.words[9];for(u.words[u.length++]=b&y,h=10;h<c.length;h++){var _=c.words[h]|0;c.words[h-10]=(_&y)<<4|b>>>22,b=_}b>>>=22,c.words[h-10]=b,b===0&&c.length>10?c.length-=10:c.length-=9},q.prototype.imulK=function(c){c.words[c.length]=0,c.words[c.length+1]=0,c.length+=2;for(var u=0,y=0;y<c.length;y++){var l=c.words[y]|0;u+=l*977,c.words[y]=u&67108863,u=l*64+(u/67108864|0)}return c.words[c.length-1]===0&&(c.length--,c.words[c.length-1]===0&&c.length--),c};function L(){k.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}n(L,k);function U(){k.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}n(U,k);function F(){k.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}n(F,k),F.prototype.imulK=function(c){for(var u=0,y=0;y<c.length;y++){var l=(c.words[y]|0)*19+u,h=l&67108863;l>>>=26,c.words[y]=h,u=l}return u!==0&&(c.words[c.length++]=u),c},i._prime=function(c){if(C[c])return C[c];var u;if(c==="k256")u=new q;else if(c==="p224")u=new L;else if(c==="p192")u=new U;else if(c==="p25519")u=new F;else throw new Error("Unknown prime "+c);return C[c]=u,u};function N(x){if(typeof x=="string"){var c=i._prime(x);this.m=c.p,this.prime=c}else r(x.gtn(1),"modulus must be greater than 1"),this.m=x,this.prime=null}N.prototype._verify1=function(c){r(c.negative===0,"red works only with positives"),r(c.red,"red works only with red numbers")},N.prototype._verify2=function(c,u){r((c.negative|u.negative)===0,"red works only with positives"),r(c.red&&c.red===u.red,"red works only with red numbers")},N.prototype.imod=function(c){return this.prime?this.prime.ireduce(c)._forceRed(this):c.umod(this.m)._forceRed(this)},N.prototype.neg=function(c){return c.isZero()?c.clone():this.m.sub(c)._forceRed(this)},N.prototype.add=function(c,u){this._verify2(c,u);var y=c.add(u);return y.cmp(this.m)>=0&&y.isub(this.m),y._forceRed(this)},N.prototype.iadd=function(c,u){this._verify2(c,u);var y=c.iadd(u);return y.cmp(this.m)>=0&&y.isub(this.m),y},N.prototype.sub=function(c,u){this._verify2(c,u);var y=c.sub(u);return y.cmpn(0)<0&&y.iadd(this.m),y._forceRed(this)},N.prototype.isub=function(c,u){this._verify2(c,u);var y=c.isub(u);return y.cmpn(0)<0&&y.iadd(this.m),y},N.prototype.shl=function(c,u){return this._verify1(c),this.imod(c.ushln(u))},N.prototype.imul=function(c,u){return this._verify2(c,u),this.imod(c.imul(u))},N.prototype.mul=function(c,u){return this._verify2(c,u),this.imod(c.mul(u))},N.prototype.isqr=function(c){return this.imul(c,c.clone())},N.prototype.sqr=function(c){return this.mul(c,c)},N.prototype.sqrt=function(c){if(c.isZero())return c.clone();var u=this.m.andln(3);if(r(u%2===1),u===3){var y=this.m.add(new i(1)).iushrn(2);return this.pow(c,y)}for(var l=this.m.subn(1),h=0;!l.isZero()&&l.andln(1)===0;)h++,l.iushrn(1);r(!l.isZero());var b=new i(1).toRed(this),_=b.redNeg(),g=this.m.subn(1).iushrn(1),f=this.m.bitLength();for(f=new i(2*f*f).toRed(this);this.pow(f,g).cmp(_)!==0;)f.redIAdd(_);for(var v=this.pow(f,l),O=this.pow(c,l.addn(1).iushrn(1)),T=this.pow(c,l),R=h;T.cmp(b)!==0;){for(var z=T,V=0;z.cmp(b)!==0;V++)z=z.redSqr();r(V<R);var W=this.pow(v,new i(1).iushln(R-V-1));O=O.redMul(W),v=W.redSqr(),T=T.redMul(v),R=V}return O},N.prototype.invm=function(c){var u=c._invmp(this.m);return u.negative!==0?(u.negative=0,this.imod(u).redNeg()):this.imod(u)},N.prototype.pow=function(c,u){if(u.isZero())return new i(1).toRed(this);if(u.cmpn(1)===0)return c.clone();var y=4,l=new Array(1<<y);l[0]=new i(1).toRed(this),l[1]=c;for(var h=2;h<l.length;h++)l[h]=this.mul(l[h-1],c);var b=l[0],_=0,g=0,f=u.bitLength()%26;for(f===0&&(f=26),h=u.length-1;h>=0;h--){for(var v=u.words[h],O=f-1;O>=0;O--){var T=v>>O&1;if(b!==l[0]&&(b=this.sqr(b)),T===0&&_===0){g=0;continue}_<<=1,_|=T,g++,!(g!==y&&(h!==0||O!==0))&&(b=this.mul(b,l[_]),g=0,_=0)}f=26}return b},N.prototype.convertTo=function(c){var u=c.umod(this.m);return u===c?u.clone():u},N.prototype.convertFrom=function(c){var u=c.clone();return u.red=null,u},i.mont=function(c){return new G(c)};function G(x){N.call(this,x),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new i(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}n(G,N),G.prototype.convertTo=function(c){return this.imod(c.ushln(this.shift))},G.prototype.convertFrom=function(c){var u=this.imod(c.mul(this.rinv));return u.red=null,u},G.prototype.imul=function(c,u){if(c.isZero()||u.isZero())return c.words[0]=0,c.length=1,c;var y=c.imul(u),l=y.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),h=y.isub(l).iushrn(this.shift),b=h;return h.cmp(this.m)>=0?b=h.isub(this.m):h.cmpn(0)<0&&(b=h.iadd(this.m)),b._forceRed(this)},G.prototype.mul=function(c,u){if(c.isZero()||u.isZero())return new i(0)._forceRed(this);var y=c.mul(u),l=y.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),h=y.isub(l).iushrn(this.shift),b=h;return h.cmp(this.m)>=0?b=h.isub(this.m):h.cmpn(0)<0&&(b=h.iadd(this.m)),b._forceRed(this)},G.prototype.invm=function(c){var u=this.imod(c._invmp(this.m).mul(this.r2));return u._forceRed(this)}})(typeof I7>"u"||I7,yte)});var CM=H((mgt,gte)=>{"use strict";E();var DM=sr(),tb=DM.Buffer,Fc={},zc;for(zc in DM)DM.hasOwnProperty(zc)&&(zc==="SlowBuffer"||zc==="Buffer"||(Fc[zc]=DM[zc]));var rb=Fc.Buffer={};for(zc in tb)tb.hasOwnProperty(zc)&&(zc==="allocUnsafe"||zc==="allocUnsafeSlow"||(rb[zc]=tb[zc]));Fc.Buffer.prototype=tb.prototype;(!rb.from||rb.from===Uint8Array.from)&&(rb.from=function(t,e,r){if(typeof t=="number")throw new TypeError('The "value" argument must not be of type number. Received type '+typeof t);if(t&&typeof t.length>"u")throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);return tb(t,e,r)});rb.alloc||(rb.alloc=function(t,e,r){if(typeof t!="number")throw new TypeError('The "size" argument must be of type number. Received type '+typeof t);if(t<0||t>=2*(1<<30))throw new RangeError('The value "'+t+'" is invalid for option "size"');var n=tb(t);return!e||e.length===0?n.fill(0):typeof r=="string"?n.fill(e,r):n.fill(e),n});if(!Fc.kStringMaxLength)try{Fc.kStringMaxLength=j.default.binding("buffer").kStringMaxLength}catch{}Fc.constants||(Fc.constants={MAX_LENGTH:Fc.kMaxLength},Fc.kStringMaxLength&&(Fc.constants.MAX_STRING_LENGTH=Fc.kStringMaxLength));gte.exports=Fc});var jM=H(vte=>{"use strict";E();var yIe=It();function Kc(t){this._reporterState={obj:null,path:[],options:t||{},errors:[]}}vte.Reporter=Kc;Kc.prototype.isError=function(e){return e instanceof nb};Kc.prototype.save=function(){let e=this._reporterState;return{obj:e.obj,pathLen:e.path.length}};Kc.prototype.restore=function(e){let r=this._reporterState;r.obj=e.obj,r.path=r.path.slice(0,e.pathLen)};Kc.prototype.enterKey=function(e){return this._reporterState.path.push(e)};Kc.prototype.exitKey=function(e){let r=this._reporterState;r.path=r.path.slice(0,e-1)};Kc.prototype.leaveKey=function(e,r,n){let i=this._reporterState;this.exitKey(e),i.obj!==null&&(i.obj[r]=n)};Kc.prototype.path=function(){return this._reporterState.path.join("/")};Kc.prototype.enterObject=function(){let e=this._reporterState,r=e.obj;return e.obj={},r};Kc.prototype.leaveObject=function(e){let r=this._reporterState,n=r.obj;return r.obj=e,n};Kc.prototype.error=function(e){let r,n=this._reporterState,i=e instanceof nb;if(i?r=e:r=new nb(n.path.map(function(o){return"["+JSON.stringify(o)+"]"}).join(""),e.message||e,e.stack),!n.options.partial)throw r;return i||n.errors.push(r),r};Kc.prototype.wrapResult=function(e){let r=this._reporterState;return r.options.partial?{result:this.isError(e)?null:e,errors:r.errors}:e};function nb(t,e){this.path=t,this.rethrow(e)}yIe(nb,Error);nb.prototype.rethrow=function(e){if(this.message=e+" at: "+(this.path||"(shallow)"),Error.captureStackTrace&&Error.captureStackTrace(this,nb),!this.stack)try{throw new Error(this.message)}catch(r){this.stack=r.stack}return this}});var sb=H(O7=>{"use strict";E();var gIe=It(),NM=jM().Reporter,ib=CM().Buffer;function Gc(t,e){if(NM.call(this,e),!ib.isBuffer(t)){this.error("Input not Buffer");return}this.base=t,this.offset=0,this.length=t.length}gIe(Gc,NM);O7.DecoderBuffer=Gc;Gc.isDecoderBuffer=function(e){return e instanceof Gc?!0:typeof e=="object"&&ib.isBuffer(e.base)&&e.constructor.name==="DecoderBuffer"&&typeof e.offset=="number"&&typeof e.length=="number"&&typeof e.save=="function"&&typeof e.restore=="function"&&typeof e.isEmpty=="function"&&typeof e.readUInt8=="function"&&typeof e.skip=="function"&&typeof e.raw=="function"};Gc.prototype.save=function(){return{offset:this.offset,reporter:NM.prototype.save.call(this)}};Gc.prototype.restore=function(e){let r=new Gc(this.base);return r.offset=e.offset,r.length=this.offset,this.offset=e.offset,NM.prototype.restore.call(this,e.reporter),r};Gc.prototype.isEmpty=function(){return this.offset===this.length};Gc.prototype.readUInt8=function(e){return this.offset+1<=this.length?this.base.readUInt8(this.offset++,!0):this.error(e||"DecoderBuffer overrun")};Gc.prototype.skip=function(e,r){if(!(this.offset+e<=this.length))return this.error(r||"DecoderBuffer overrun");let n=new Gc(this.base);return n._reporterState=this._reporterState,n.offset=this.offset,n.length=this.offset+e,this.offset+=e,n};Gc.prototype.raw=function(e){return this.base.slice(e?e.offset:this.offset,this.length)};function ob(t,e){if(Array.isArray(t))this.length=0,this.value=t.map(function(r){return ob.isEncoderBuffer(r)||(r=new ob(r,e)),this.length+=r.length,r},this);else if(typeof t=="number"){if(!(0<=t&&t<=255))return e.error("non-byte EncoderBuffer value");this.value=t,this.length=1}else if(typeof t=="string")this.value=t,this.length=ib.byteLength(t);else if(ib.isBuffer(t))this.value=t,this.length=t.length;else return e.error("Unsupported type: "+typeof t)}O7.EncoderBuffer=ob;ob.isEncoderBuffer=function(e){return e instanceof ob?!0:typeof e=="object"&&e.constructor.name==="EncoderBuffer"&&typeof e.length=="number"&&typeof e.join=="function"};ob.prototype.join=function(e,r){return e||(e=ib.alloc(this.length)),r||(r=0),this.length===0||(Array.isArray(this.value)?this.value.forEach(function(n){n.join(e,r),r+=n.length}):(typeof this.value=="number"?e[r]=this.value:typeof this.value=="string"?e.write(this.value,r):ib.isBuffer(this.value)&&this.value.copy(e,r),r+=this.length)),e}});var qM=H((_gt,wte)=>{"use strict";E();var vIe=jM().Reporter,bIe=sb().EncoderBuffer,wIe=sb().DecoderBuffer,ea=Ja(),bte=["seq","seqof","set","setof","objid","bool","gentime","utctime","null_","enum","int","objDesc","bitstr","bmpstr","charstr","genstr","graphstr","ia5str","iso646str","numstr","octstr","printstr","t61str","unistr","utf8str","videostr"],_Ie=["key","obj","use","optional","explicit","implicit","def","choice","any","contains"].concat(bte),xIe=["_peekTag","_decodeTag","_use","_decodeStr","_decodeObjid","_decodeTime","_decodeNull","_decodeInt","_decodeBool","_decodeList","_encodeComposite","_encodeStr","_encodeObjid","_encodeTime","_encodeNull","_encodeInt","_encodeBool"];function vn(t,e,r){let n={};this._baseState=n,n.name=r,n.enc=t,n.parent=e||null,n.children=null,n.tag=null,n.args=null,n.reverseArgs=null,n.choice=null,n.optional=!1,n.any=!1,n.obj=!1,n.use=null,n.useDecoder=null,n.key=null,n.default=null,n.explicit=null,n.implicit=null,n.contains=null,n.parent||(n.children=[],this._wrap())}wte.exports=vn;var EIe=["enc","parent","children","tag","args","reverseArgs","choice","optional","any","obj","use","alteredUse","key","default","explicit","implicit","contains"];vn.prototype.clone=function(){let e=this._baseState,r={};EIe.forEach(function(i){r[i]=e[i]});let n=new this.constructor(r.parent);return n._baseState=r,n};vn.prototype._wrap=function(){let e=this._baseState;_Ie.forEach(function(r){this[r]=function(){let i=new this.constructor(this);return e.children.push(i),i[r].apply(i,arguments)}},this)};vn.prototype._init=function(e){let r=this._baseState;ea(r.parent===null),e.call(this),r.children=r.children.filter(function(n){return n._baseState.parent===this},this),ea.equal(r.children.length,1,"Root node can have only one child")};vn.prototype._useArgs=function(e){let r=this._baseState,n=e.filter(function(i){return i instanceof this.constructor},this);e=e.filter(function(i){return!(i instanceof this.constructor)},this),n.length!==0&&(ea(r.children===null),r.children=n,n.forEach(function(i){i._baseState.parent=this},this)),e.length!==0&&(ea(r.args===null),r.args=e,r.reverseArgs=e.map(function(i){if(typeof i!="object"||i.constructor!==Object)return i;let o={};return Object.keys(i).forEach(function(s){s==(s|0)&&(s|=0);let a=i[s];o[a]=s}),o}))};xIe.forEach(function(t){vn.prototype[t]=function(){let r=this._baseState;throw new Error(t+" not implemented for encoding: "+r.enc)}});bte.forEach(function(t){vn.prototype[t]=function(){let r=this._baseState,n=Array.prototype.slice.call(arguments);return ea(r.tag===null),r.tag=t,this._useArgs(n),this}});vn.prototype.use=function(e){ea(e);let r=this._baseState;return ea(r.use===null),r.use=e,this};vn.prototype.optional=function(){let e=this._baseState;return e.optional=!0,this};vn.prototype.def=function(e){let r=this._baseState;return ea(r.default===null),r.default=e,r.optional=!0,this};vn.prototype.explicit=function(e){let r=this._baseState;return ea(r.explicit===null&&r.implicit===null),r.explicit=e,this};vn.prototype.implicit=function(e){let r=this._baseState;return ea(r.explicit===null&&r.implicit===null),r.implicit=e,this};vn.prototype.obj=function(){let e=this._baseState,r=Array.prototype.slice.call(arguments);return e.obj=!0,r.length!==0&&this._useArgs(r),this};vn.prototype.key=function(e){let r=this._baseState;return ea(r.key===null),r.key=e,this};vn.prototype.any=function(){let e=this._baseState;return e.any=!0,this};vn.prototype.choice=function(e){let r=this._baseState;return ea(r.choice===null),r.choice=e,this._useArgs(Object.keys(e).map(function(n){return e[n]})),this};vn.prototype.contains=function(e){let r=this._baseState;return ea(r.use===null),r.contains=e,this};vn.prototype._decode=function(e,r){let n=this._baseState;if(n.parent===null)return e.wrapResult(n.children[0]._decode(e,r));let i=n.default,o=!0,s=null;if(n.key!==null&&(s=e.enterKey(n.key)),n.optional){let d=null;if(n.explicit!==null?d=n.explicit:n.implicit!==null?d=n.implicit:n.tag!==null&&(d=n.tag),d===null&&!n.any){let m=e.save();try{n.choice===null?this._decodeGeneric(n.tag,e,r):this._decodeChoice(e,r),o=!0}catch{o=!1}e.restore(m)}else if(o=this._peekTag(e,d,n.any),e.isError(o))return o}let a;if(n.obj&&o&&(a=e.enterObject()),o){if(n.explicit!==null){let m=this._decodeTag(e,n.explicit);if(e.isError(m))return m;e=m}let d=e.offset;if(n.use===null&&n.choice===null){let m;n.any&&(m=e.save());let p=this._decodeTag(e,n.implicit!==null?n.implicit:n.tag,n.any);if(e.isError(p))return p;n.any?i=e.raw(m):e=p}if(r&&r.track&&n.tag!==null&&r.track(e.path(),d,e.length,"tagged"),r&&r.track&&n.tag!==null&&r.track(e.path(),e.offset,e.length,"content"),n.any||(n.choice===null?i=this._decodeGeneric(n.tag,e,r):i=this._decodeChoice(e,r)),e.isError(i))return i;if(!n.any&&n.choice===null&&n.children!==null&&n.children.forEach(function(p){p._decode(e,r)}),n.contains&&(n.tag==="octstr"||n.tag==="bitstr")){let m=new wIe(i);i=this._getUse(n.contains,e._reporterState.obj)._decode(m,r)}}return n.obj&&o&&(i=e.leaveObject(a)),n.key!==null&&(i!==null||o===!0)?e.leaveKey(s,n.key,i):s!==null&&e.exitKey(s),i};vn.prototype._decodeGeneric=function(e,r,n){let i=this._baseState;return e==="seq"||e==="set"?null:e==="seqof"||e==="setof"?this._decodeList(r,e,i.args[0],n):/str$/.test(e)?this._decodeStr(r,e,n):e==="objid"&&i.args?this._decodeObjid(r,i.args[0],i.args[1],n):e==="objid"?this._decodeObjid(r,null,null,n):e==="gentime"||e==="utctime"?this._decodeTime(r,e,n):e==="null_"?this._decodeNull(r,n):e==="bool"?this._decodeBool(r,n):e==="objDesc"?this._decodeStr(r,e,n):e==="int"||e==="enum"?this._decodeInt(r,i.args&&i.args[0],n):i.use!==null?this._getUse(i.use,r._reporterState.obj)._decode(r,n):r.error("unknown tag: "+e)};vn.prototype._getUse=function(e,r){let n=this._baseState;return n.useDecoder=this._use(e,r),ea(n.useDecoder._baseState.parent===null),n.useDecoder=n.useDecoder._baseState.children[0],n.implicit!==n.useDecoder._baseState.implicit&&(n.useDecoder=n.useDecoder.clone(),n.useDecoder._baseState.implicit=n.implicit),n.useDecoder};vn.prototype._decodeChoice=function(e,r){let n=this._baseState,i=null,o=!1;return Object.keys(n.choice).some(function(s){let a=e.save(),d=n.choice[s];try{let m=d._decode(e,r);if(e.isError(m))return!1;i={type:s,value:m},o=!0}catch{return e.restore(a),!1}return!0},this),o?i:e.error("Choice not matched")};vn.prototype._createEncoderBuffer=function(e){return new bIe(e,this.reporter)};vn.prototype._encode=function(e,r,n){let i=this._baseState;if(i.default!==null&&i.default===e)return;let o=this._encodeValue(e,r,n);if(o!==void 0&&!this._skipDefault(o,r,n))return o};vn.prototype._encodeValue=function(e,r,n){let i=this._baseState;if(i.parent===null)return i.children[0]._encode(e,r||new vIe);let o=null;if(this.reporter=r,i.optional&&e===void 0)if(i.default!==null)e=i.default;else return;let s=null,a=!1;if(i.any)o=this._createEncoderBuffer(e);else if(i.choice)o=this._encodeChoice(e,r);else if(i.contains)s=this._getUse(i.contains,n)._encode(e,r),a=!0;else if(i.children)s=i.children.map(function(d){if(d._baseState.tag==="null_")return d._encode(null,r,e);if(d._baseState.key===null)return r.error("Child should have a key");let m=r.enterKey(d._baseState.key);if(typeof e!="object")return r.error("Child expected, but input is not object");let p=d._encode(e[d._baseState.key],r,e);return r.leaveKey(m),p},this).filter(function(d){return d}),s=this._createEncoderBuffer(s);else if(i.tag==="seqof"||i.tag==="setof"){if(!(i.args&&i.args.length===1))return r.error("Too many args for : "+i.tag);if(!Array.isArray(e))return r.error("seqof/setof, but data is not Array");let d=this.clone();d._baseState.implicit=null,s=this._createEncoderBuffer(e.map(function(m){let p=this._baseState;return this._getUse(p.args[0],e)._encode(m,r)},d))}else i.use!==null?o=this._getUse(i.use,n)._encode(e,r):(s=this._encodePrimitive(i.tag,e),a=!0);if(!i.any&&i.choice===null){let d=i.implicit!==null?i.implicit:i.tag,m=i.implicit===null?"universal":"context";d===null?i.use===null&&r.error("Tag could be omitted only for .use()"):i.use===null&&(o=this._encodeComposite(d,a,m,s))}return i.explicit!==null&&(o=this._encodeComposite(i.explicit,!1,"context",o)),o};vn.prototype._encodeChoice=function(e,r){let n=this._baseState,i=n.choice[e.type];return i||ea(!1,e.type+" not found in "+JSON.stringify(Object.keys(n.choice))),i._encode(e.value,r)};vn.prototype._encodePrimitive=function(e,r){let n=this._baseState;if(/str$/.test(e))return this._encodeStr(r,e);if(e==="objid"&&n.args)return this._encodeObjid(r,n.reverseArgs[0],n.args[1]);if(e==="objid")return this._encodeObjid(r,null,null);if(e==="gentime"||e==="utctime")return this._encodeTime(r,e);if(e==="null_")return this._encodeNull();if(e==="int"||e==="enum")return this._encodeInt(r,n.args&&n.reverseArgs[0]);if(e==="bool")return this._encodeBool(r);if(e==="objDesc")return this._encodeStr(r,e);throw new Error("Unsupported tag: "+e)};vn.prototype._isNumstr=function(e){return/^[0-9 ]*$/.test(e)};vn.prototype._isPrintstr=function(e){return/^[A-Za-z0-9 '()+,-./:=?]*$/.test(e)}});var $M=H(Fm=>{"use strict";E();function _te(t){let e={};return Object.keys(t).forEach(function(r){(r|0)==r&&(r=r|0);let n=t[r];e[n]=r}),e}Fm.tagClass={0:"universal",1:"application",2:"context",3:"private"};Fm.tagClassByName=_te(Fm.tagClass);Fm.tag={0:"end",1:"bool",2:"int",3:"bitstr",4:"octstr",5:"null_",6:"objid",7:"objDesc",8:"external",9:"real",10:"enum",11:"embed",12:"utf8str",13:"relativeOid",16:"seq",17:"set",18:"numstr",19:"printstr",20:"t61str",21:"videostr",22:"ia5str",23:"utctime",24:"gentime",25:"graphstr",26:"iso646str",27:"genstr",28:"unistr",29:"charstr",30:"bmpstr"};Fm.tagByName=_te(Fm.tag)});var D7=H((Mgt,Ste)=>{"use strict";E();var SIe=It(),Cd=CM().Buffer,xte=qM(),B7=$M();function Ete(t){this.enc="der",this.name=t.name,this.entity=t,this.tree=new qf,this.tree._init(t.body)}Ste.exports=Ete;Ete.prototype.encode=function(e,r){return this.tree._encode(e,r).join()};function qf(t){xte.call(this,"der",t)}SIe(qf,xte);qf.prototype._encodeComposite=function(e,r,n,i){let o=MIe(e,r,n,this.reporter);if(i.length<128){let d=Cd.alloc(2);return d[0]=o,d[1]=i.length,this._createEncoderBuffer([d,i])}let s=1;for(let d=i.length;d>=256;d>>=8)s++;let a=Cd.alloc(1+1+s);a[0]=o,a[1]=128|s;for(let d=1+s,m=i.length;m>0;d--,m>>=8)a[d]=m&255;return this._createEncoderBuffer([a,i])};qf.prototype._encodeStr=function(e,r){if(r==="bitstr")return this._createEncoderBuffer([e.unused|0,e.data]);if(r==="bmpstr"){let n=Cd.alloc(e.length*2);for(let i=0;i<e.length;i++)n.writeUInt16BE(e.charCodeAt(i),i*2);return this._createEncoderBuffer(n)}else return r==="numstr"?this._isNumstr(e)?this._createEncoderBuffer(e):this.reporter.error("Encoding of string type: numstr supports only digits and space"):r==="printstr"?this._isPrintstr(e)?this._createEncoderBuffer(e):this.reporter.error("Encoding of string type: printstr supports only latin upper and lower case letters, digits, space, apostrophe, left and rigth parenthesis, plus sign, comma, hyphen, dot, slash, colon, equal sign, question mark"):/str$/.test(r)?this._createEncoderBuffer(e):r==="objDesc"?this._createEncoderBuffer(e):this.reporter.error("Encoding of string type: "+r+" unsupported")};qf.prototype._encodeObjid=function(e,r,n){if(typeof e=="string"){if(!r)return this.reporter.error("string objid given, but no values map found");if(!r.hasOwnProperty(e))return this.reporter.error("objid not found in values map");e=r[e].split(/[\s.]+/g);for(let a=0;a<e.length;a++)e[a]|=0}else if(Array.isArray(e)){e=e.slice();for(let a=0;a<e.length;a++)e[a]|=0}if(!Array.isArray(e))return this.reporter.error("objid() should be either array or string, got: "+JSON.stringify(e));if(!n){if(e[1]>=40)return this.reporter.error("Second objid identifier OOB");e.splice(0,2,e[0]*40+e[1])}let i=0;for(let a=0;a<e.length;a++){let d=e[a];for(i++;d>=128;d>>=7)i++}let o=Cd.alloc(i),s=o.length-1;for(let a=e.length-1;a>=0;a--){let d=e[a];for(o[s--]=d&127;(d>>=7)>0;)o[s--]=128|d&127}return this._createEncoderBuffer(o)};function Wc(t){return t<10?"0"+t:t}qf.prototype._encodeTime=function(e,r){let n,i=new Date(e);return r==="gentime"?n=[Wc(i.getUTCFullYear()),Wc(i.getUTCMonth()+1),Wc(i.getUTCDate()),Wc(i.getUTCHours()),Wc(i.getUTCMinutes()),Wc(i.getUTCSeconds()),"Z"].join(""):r==="utctime"?n=[Wc(i.getUTCFullYear()%100),Wc(i.getUTCMonth()+1),Wc(i.getUTCDate()),Wc(i.getUTCHours()),Wc(i.getUTCMinutes()),Wc(i.getUTCSeconds()),"Z"].join(""):this.reporter.error("Encoding "+r+" time is not supported yet"),this._encodeStr(n,"octstr")};qf.prototype._encodeNull=function(){return this._createEncoderBuffer("")};qf.prototype._encodeInt=function(e,r){if(typeof e=="string"){if(!r)return this.reporter.error("String int or enum given, but no values map");if(!r.hasOwnProperty(e))return this.reporter.error("Values map doesn't contain: "+JSON.stringify(e));e=r[e]}if(typeof e!="number"&&!Cd.isBuffer(e)){let o=e.toArray();!e.sign&&o[0]&128&&o.unshift(0),e=Cd.from(o)}if(Cd.isBuffer(e)){let o=e.length;e.length===0&&o++;let s=Cd.alloc(o);return e.copy(s),e.length===0&&(s[0]=0),this._createEncoderBuffer(s)}if(e<128)return this._createEncoderBuffer(e);if(e<256)return this._createEncoderBuffer([0,e]);let n=1;for(let o=e;o>=256;o>>=8)n++;let i=new Array(n);for(let o=i.length-1;o>=0;o--)i[o]=e&255,e>>=8;return i[0]&128&&i.unshift(0),this._createEncoderBuffer(Cd.from(i))};qf.prototype._encodeBool=function(e){return this._createEncoderBuffer(e?255:0)};qf.prototype._use=function(e,r){return typeof e=="function"&&(e=e(r)),e._getEncoder("der").tree};qf.prototype._skipDefault=function(e,r,n){let i=this._baseState,o;if(i.default===null)return!1;let s=e.join();if(i.defaultBuffer===void 0&&(i.defaultBuffer=this._encodeValue(i.default,r,n).join()),s.length!==i.defaultBuffer.length)return!1;for(o=0;o<s.length;o++)if(s[o]!==i.defaultBuffer[o])return!1;return!0};function MIe(t,e,r,n){let i;if(t==="seqof"?t="seq":t==="setof"&&(t="set"),B7.tagByName.hasOwnProperty(t))i=B7.tagByName[t];else if(typeof t=="number"&&(t|0)===t)i=t;else return n.error("Unknown tag: "+t);return i>=31?n.error("Multi-octet tag encoding unsupported"):(e||(i|=32),i|=B7.tagClassByName[r||"universal"]<<6,i)}});var Pte=H((Agt,Mte)=>{"use strict";E();var PIe=It(),C7=D7();function j7(t){C7.call(this,t),this.enc="pem"}PIe(j7,C7);Mte.exports=j7;j7.prototype.encode=function(e,r){let i=C7.prototype.encode.call(this,e).toString("base64"),o=["-----BEGIN "+r.label+"-----"];for(let s=0;s<i.length;s+=64)o.push(i.slice(s,s+64));return o.push("-----END "+r.label+"-----"),o.join(`
`)}});var N7=H(Tte=>{"use strict";E();var Ate=Tte;Ate.der=D7();Ate.pem=Pte()});var $7=H((kgt,Dte)=>{"use strict";E();var AIe=It(),TIe=k7(),Rte=sb().DecoderBuffer,kte=qM(),Ite=$M();function Ote(t){this.enc="der",this.name=t.name,this.entity=t,this.tree=new Qa,this.tree._init(t.body)}Dte.exports=Ote;Ote.prototype.decode=function(e,r){return Rte.isDecoderBuffer(e)||(e=new Rte(e,r)),this.tree._decode(e,r)};function Qa(t){kte.call(this,"der",t)}AIe(Qa,kte);Qa.prototype._peekTag=function(e,r,n){if(e.isEmpty())return!1;let i=e.save(),o=q7(e,'Failed to peek tag: "'+r+'"');return e.isError(o)?o:(e.restore(i),o.tag===r||o.tagStr===r||o.tagStr+"of"===r||n)};Qa.prototype._decodeTag=function(e,r,n){let i=q7(e,'Failed to decode tag of "'+r+'"');if(e.isError(i))return i;let o=Bte(e,i.primitive,'Failed to get length of "'+r+'"');if(e.isError(o))return o;if(!n&&i.tag!==r&&i.tagStr!==r&&i.tagStr+"of"!==r)return e.error('Failed to match tag: "'+r+'"');if(i.primitive||o!==null)return e.skip(o,'Failed to match body of: "'+r+'"');let s=e.save(),a=this._skipUntilEnd(e,'Failed to skip indefinite length body: "'+this.tag+'"');return e.isError(a)?a:(o=e.offset-s.offset,e.restore(s),e.skip(o,'Failed to match body of: "'+r+'"'))};Qa.prototype._skipUntilEnd=function(e,r){for(;;){let n=q7(e,r);if(e.isError(n))return n;let i=Bte(e,n.primitive,r);if(e.isError(i))return i;let o;if(n.primitive||i!==null?o=e.skip(i):o=this._skipUntilEnd(e,r),e.isError(o))return o;if(n.tagStr==="end")break}};Qa.prototype._decodeList=function(e,r,n,i){let o=[];for(;!e.isEmpty();){let s=this._peekTag(e,"end");if(e.isError(s))return s;let a=n.decode(e,"der",i);if(e.isError(a)&&s)break;o.push(a)}return o};Qa.prototype._decodeStr=function(e,r){if(r==="bitstr"){let n=e.readUInt8();return e.isError(n)?n:{unused:n,data:e.raw()}}else if(r==="bmpstr"){let n=e.raw();if(n.length%2===1)return e.error("Decoding of string type: bmpstr length mismatch");let i="";for(let o=0;o<n.length/2;o++)i+=String.fromCharCode(n.readUInt16BE(o*2));return i}else if(r==="numstr"){let n=e.raw().toString("ascii");return this._isNumstr(n)?n:e.error("Decoding of string type: numstr unsupported characters")}else{if(r==="octstr")return e.raw();if(r==="objDesc")return e.raw();if(r==="printstr"){let n=e.raw().toString("ascii");return this._isPrintstr(n)?n:e.error("Decoding of string type: printstr unsupported characters")}else return/str$/.test(r)?e.raw().toString():e.error("Decoding of string type: "+r+" unsupported")}};Qa.prototype._decodeObjid=function(e,r,n){let i,o=[],s=0,a=0;for(;!e.isEmpty();)a=e.readUInt8(),s<<=7,s|=a&127,a&128||(o.push(s),s=0);a&128&&o.push(s);let d=o[0]/40|0,m=o[0]%40;if(n?i=o:i=[d,m].concat(o.slice(1)),r){let p=r[i.join(" ")];p===void 0&&(p=r[i.join(".")]),p!==void 0&&(i=p)}return i};Qa.prototype._decodeTime=function(e,r){let n=e.raw().toString(),i,o,s,a,d,m;if(r==="gentime")i=n.slice(0,4)|0,o=n.slice(4,6)|0,s=n.slice(6,8)|0,a=n.slice(8,10)|0,d=n.slice(10,12)|0,m=n.slice(12,14)|0;else if(r==="utctime")i=n.slice(0,2)|0,o=n.slice(2,4)|0,s=n.slice(4,6)|0,a=n.slice(6,8)|0,d=n.slice(8,10)|0,m=n.slice(10,12)|0,i<70?i=2e3+i:i=1900+i;else return e.error("Decoding "+r+" time is not supported yet");return Date.UTC(i,o-1,s,a,d,m,0)};Qa.prototype._decodeNull=function(){return null};Qa.prototype._decodeBool=function(e){let r=e.readUInt8();return e.isError(r)?r:r!==0};Qa.prototype._decodeInt=function(e,r){let n=e.raw(),i=new TIe(n);return r&&(i=r[i.toString(10)]||i),i};Qa.prototype._use=function(e,r){return typeof e=="function"&&(e=e(r)),e._getDecoder("der").tree};function q7(t,e){let r=t.readUInt8(e);if(t.isError(r))return r;let n=Ite.tagClass[r>>6],i=(r&32)===0;if((r&31)===31){let s=r;for(r=0;(s&128)===128;){if(s=t.readUInt8(e),t.isError(s))return s;r<<=7,r|=s&127}}else r&=31;let o=Ite.tag[r];return{cls:n,primitive:i,tag:r,tagStr:o}}function Bte(t,e,r){let n=t.readUInt8(r);if(t.isError(n))return n;if(!e&&n===128)return null;if(!(n&128))return n;let i=n&127;if(i>4)return t.error("length octect is too long");n=0;for(let o=0;o<i;o++){n<<=8;let s=t.readUInt8(r);if(t.isError(s))return s;n|=s}return n}});var jte=H((Bgt,Cte)=>{"use strict";E();var RIe=It(),IIe=CM().Buffer,L7=$7();function U7(t){L7.call(this,t),this.enc="pem"}RIe(U7,L7);Cte.exports=U7;U7.prototype.decode=function(e,r){let n=e.toString().split(/[\r\n]+/g),i=r.label.toUpperCase(),o=/^-----(BEGIN|END) ([^-]+)-----$/,s=-1,a=-1;for(let p=0;p<n.length;p++){let w=n[p].match(o);if(w!==null&&w[2]===i)if(s===-1){if(w[1]!=="BEGIN")break;s=p}else{if(w[1]!=="END")break;a=p;break}}if(s===-1||a===-1)throw new Error("PEM section not found for: "+i);let d=n.slice(s+1,a).join("");d.replace(/[^a-z0-9+/=]+/gi,"");let m=IIe.from(d,"base64");return L7.prototype.decode.call(this,m,r)}});var F7=H(qte=>{"use strict";E();var Nte=qte;Nte.der=$7();Nte.pem=jte()});var Lte=H($te=>{"use strict";E();var kIe=N7(),OIe=F7(),BIe=It(),DIe=$te;DIe.define=function(e,r){return new ab(e,r)};function ab(t,e){this.name=t,this.body=e,this.decoders={},this.encoders={}}ab.prototype._createNamed=function(e){let r=this.name;function n(i){this._initNamed(i,r)}return BIe(n,e),n.prototype._initNamed=function(o,s){e.call(this,o,s)},new n(this)};ab.prototype._getDecoder=function(e){return e=e||"der",this.decoders.hasOwnProperty(e)||(this.decoders[e]=this._createNamed(OIe[e])),this.decoders[e]};ab.prototype.decode=function(e,r,n){return this._getDecoder(r).decode(e,n)};ab.prototype._getEncoder=function(e){return e=e||"der",this.encoders.hasOwnProperty(e)||(this.encoders[e]=this._createNamed(kIe[e])),this.encoders[e]};ab.prototype.encode=function(e,r,n){return this._getEncoder(r).encode(e,n)}});var Fte=H(Ute=>{"use strict";E();var LM=Ute;LM.Reporter=jM().Reporter;LM.DecoderBuffer=sb().DecoderBuffer;LM.EncoderBuffer=sb().EncoderBuffer;LM.Node=qM()});var Gte=H(Kte=>{"use strict";E();var zte=Kte;zte._reverse=function(e){let r={};return Object.keys(e).forEach(function(n){(n|0)==n&&(n=n|0);let i=e[n];r[i]=n}),r};zte.der=$M()});var z7=H(Wte=>{"use strict";E();var cb=Wte;cb.bignum=k7();cb.define=Lte().define;cb.base=Fte();cb.constants=Gte();cb.decoders=F7();cb.encoders=N7()});var Jte=H((Ggt,Zte)=>{"use strict";E();var $f=z7(),Vte=$f.define("Time",function(){this.choice({utcTime:this.utctime(),generalTime:this.gentime()})}),CIe=$f.define("AttributeTypeValue",function(){this.seq().obj(this.key("type").objid(),this.key("value").any())}),K7=$f.define("AlgorithmIdentifier",function(){this.seq().obj(this.key("algorithm").objid(),this.key("parameters").optional(),this.key("curve").objid().optional())}),jIe=$f.define("SubjectPublicKeyInfo",function(){this.seq().obj(this.key("algorithm").use(K7),this.key("subjectPublicKey").bitstr())}),NIe=$f.define("RelativeDistinguishedName",function(){this.setof(CIe)}),qIe=$f.define("RDNSequence",function(){this.seqof(NIe)}),Hte=$f.define("Name",function(){this.choice({rdnSequence:this.use(qIe)})}),$Ie=$f.define("Validity",function(){this.seq().obj(this.key("notBefore").use(Vte),this.key("notAfter").use(Vte))}),LIe=$f.define("Extension",function(){this.seq().obj(this.key("extnID").objid(),this.key("critical").bool().def(!1),this.key("extnValue").octstr())}),UIe=$f.define("TBSCertificate",function(){this.seq().obj(this.key("version").explicit(0).int().optional(),this.key("serialNumber").int(),this.key("signature").use(K7),this.key("issuer").use(Hte),this.key("validity").use($Ie),this.key("subject").use(Hte),this.key("subjectPublicKeyInfo").use(jIe),this.key("issuerUniqueID").implicit(1).bitstr().optional(),this.key("subjectUniqueID").implicit(2).bitstr().optional(),this.key("extensions").explicit(3).seqof(LIe).optional())}),FIe=$f.define("X509Certificate",function(){this.seq().obj(this.key("tbsCertificate").use(UIe),this.key("signatureAlgorithm").use(K7),this.key("signatureValue").bitstr())});Zte.exports=FIe});var Qte=H(Uf=>{"use strict";E();var Lf=z7();Uf.certificate=Jte();var zIe=Lf.define("RSAPrivateKey",function(){this.seq().obj(this.key("version").int(),this.key("modulus").int(),this.key("publicExponent").int(),this.key("privateExponent").int(),this.key("prime1").int(),this.key("prime2").int(),this.key("exponent1").int(),this.key("exponent2").int(),this.key("coefficient").int())});Uf.RSAPrivateKey=zIe;var KIe=Lf.define("RSAPublicKey",function(){this.seq().obj(this.key("modulus").int(),this.key("publicExponent").int())});Uf.RSAPublicKey=KIe;var GIe=Lf.define("SubjectPublicKeyInfo",function(){this.seq().obj(this.key("algorithm").use(Yte),this.key("subjectPublicKey").bitstr())});Uf.PublicKey=GIe;var Yte=Lf.define("AlgorithmIdentifier",function(){this.seq().obj(this.key("algorithm").objid(),this.key("none").null_().optional(),this.key("curve").objid().optional(),this.key("params").seq().obj(this.key("p").int(),this.key("q").int(),this.key("g").int()).optional())}),WIe=Lf.define("PrivateKeyInfo",function(){this.seq().obj(this.key("version").int(),this.key("algorithm").use(Yte),this.key("subjectPrivateKey").octstr())});Uf.PrivateKey=WIe;var VIe=Lf.define("EncryptedPrivateKeyInfo",function(){this.seq().obj(this.key("algorithm").seq().obj(this.key("id").objid(),this.key("decrypt").seq().obj(this.key("kde").seq().obj(this.key("id").objid(),this.key("kdeparams").seq().obj(this.key("salt").octstr(),this.key("iters").int())),this.key("cipher").seq().obj(this.key("algo").objid(),this.key("iv").octstr()))),this.key("subjectPrivateKey").octstr())});Uf.EncryptedPrivateKey=VIe;var HIe=Lf.define("DSAPrivateKey",function(){this.seq().obj(this.key("version").int(),this.key("p").int(),this.key("q").int(),this.key("g").int(),this.key("pub_key").int(),this.key("priv_key").int())});Uf.DSAPrivateKey=HIe;Uf.DSAparam=Lf.define("DSAparam",function(){this.int()});var ZIe=Lf.define("ECPrivateKey",function(){this.seq().obj(this.key("version").int(),this.key("privateKey").octstr(),this.key("parameters").optional().explicit(0).use(JIe),this.key("publicKey").optional().explicit(1).bitstr())});Uf.ECPrivateKey=ZIe;var JIe=Lf.define("ECParameters",function(){this.choice({namedCurve:this.objid()})});Uf.signature=Lf.define("signature",function(){this.seq().obj(this.key("r").int(),this.key("s").int())})});var Xte=H((Zgt,YIe)=>{YIe.exports={"2.16.840.1.101.3.4.1.1":"aes-128-ecb","2.16.840.1.101.3.4.1.2":"aes-128-cbc","2.16.840.1.101.3.4.1.3":"aes-128-ofb","2.16.840.1.101.3.4.1.4":"aes-128-cfb","2.16.840.1.101.3.4.1.21":"aes-192-ecb","2.16.840.1.101.3.4.1.22":"aes-192-cbc","2.16.840.1.101.3.4.1.23":"aes-192-ofb","2.16.840.1.101.3.4.1.24":"aes-192-cfb","2.16.840.1.101.3.4.1.41":"aes-256-ecb","2.16.840.1.101.3.4.1.42":"aes-256-cbc","2.16.840.1.101.3.4.1.43":"aes-256-ofb","2.16.840.1.101.3.4.1.44":"aes-256-cfb"}});var tre=H((Jgt,ere)=>{E();var QIe=/Proc-Type: 4,ENCRYPTED[\n\r]+DEK-Info: AES-((?:128)|(?:192)|(?:256))-CBC,([0-9A-H]+)[\n\r]+([0-9A-z\n\r+/=]+)[\n\r]+/m,XIe=/^-----BEGIN ((?:.*? KEY)|CERTIFICATE)-----/m,eke=/^-----BEGIN ((?:.*? KEY)|CERTIFICATE)-----([0-9A-z\n\r+/=]+)-----END \1-----$/m,tke=H2(),rke=HS(),UM=Fr().Buffer;ere.exports=function(t,e){var r=t.toString(),n=r.match(QIe),i;if(n){var s="aes"+n[1],a=UM.from(n[2],"hex"),d=UM.from(n[3].replace(/[\r\n]/g,""),"base64"),m=tke(e,a.slice(0,8),parseInt(n[1],10)).key,p=[],w=rke.createDecipheriv(s,m,a);p.push(w.update(d)),p.push(w.final()),i=UM.concat(p)}else{var o=r.match(eke);i=UM.from(o[2].replace(/[\r\n]/g,""),"base64")}var P=r.match(XIe)[1];return{tag:P,data:i}}});var c_=H((Qgt,nre)=>{E();var Ma=Qte(),nke=Xte(),ike=tre(),oke=HS(),ske=o9(),G7=Fr().Buffer;nre.exports=rre;function rre(t){var e;typeof t=="object"&&!G7.isBuffer(t)&&(e=t.passphrase,t=t.key),typeof t=="string"&&(t=G7.from(t));var r=ike(t,e),n=r.tag,i=r.data,o,s;switch(n){case"CERTIFICATE":s=Ma.certificate.decode(i,"der").tbsCertificate.subjectPublicKeyInfo;case"PUBLIC KEY":switch(s||(s=Ma.PublicKey.decode(i,"der")),o=s.algorithm.algorithm.join("."),o){case"1.2.840.113549.1.1.1":return Ma.RSAPublicKey.decode(s.subjectPublicKey.data,"der");case"1.2.840.10045.2.1":return s.subjectPrivateKey=s.subjectPublicKey,{type:"ec",data:s};case"1.2.840.10040.4.1":return s.algorithm.params.pub_key=Ma.DSAparam.decode(s.subjectPublicKey.data,"der"),{type:"dsa",data:s.algorithm.params};default:throw new Error("unknown key id "+o)}case"ENCRYPTED PRIVATE KEY":i=Ma.EncryptedPrivateKey.decode(i,"der"),i=ake(i,e);case"PRIVATE KEY":switch(s=Ma.PrivateKey.decode(i,"der"),o=s.algorithm.algorithm.join("."),o){case"1.2.840.113549.1.1.1":return Ma.RSAPrivateKey.decode(s.subjectPrivateKey,"der");case"1.2.840.10045.2.1":return{curve:s.algorithm.curve,privateKey:Ma.ECPrivateKey.decode(s.subjectPrivateKey,"der").privateKey};case"1.2.840.10040.4.1":return s.algorithm.params.priv_key=Ma.DSAparam.decode(s.subjectPrivateKey,"der"),{type:"dsa",params:s.algorithm.params};default:throw new Error("unknown key id "+o)}case"RSA PUBLIC KEY":return Ma.RSAPublicKey.decode(i,"der");case"RSA PRIVATE KEY":return Ma.RSAPrivateKey.decode(i,"der");case"DSA PRIVATE KEY":return{type:"dsa",params:Ma.DSAPrivateKey.decode(i,"der")};case"EC PRIVATE KEY":return i=Ma.ECPrivateKey.decode(i,"der"),{curve:i.parameters.value,privateKey:i.privateKey};default:throw new Error("unknown key type "+n)}}rre.signature=Ma.signature;function ake(t,e){var r=t.algorithm.decrypt.kde.kdeparams.salt,n=parseInt(t.algorithm.decrypt.kde.kdeparams.iters.toString(),10),i=nke[t.algorithm.decrypt.cipher.algo.join(".")],o=t.algorithm.decrypt.cipher.iv,s=t.subjectPrivateKey,a=parseInt(i.split("-")[1],10)/8,d=ske.pbkdf2Sync(e,r,n,a,"sha1"),m=oke.createDecipheriv(i,d,o),p=[];return p.push(m.update(s)),p.push(m.final()),G7.concat(p)}});var W7=H((evt,cke)=>{cke.exports={"1.3.132.0.10":"secp256k1","1.3.132.0.33":"p224","1.2.840.10045.3.1.1":"p192","1.2.840.10045.3.1.7":"p256","1.3.132.0.34":"p384","1.3.132.0.35":"p521"}});var sre=H((tvt,zM)=>{"use strict";E();var Ds=eM().Buffer,zm=Zk(),fke=yM(),uke=BM().ec,FM=mM(),lke=c_(),dke=W7(),hke=1;function pke(t,e,r,n,i){var o=lke(e);if(o.curve){if(n!=="ecdsa"&&n!=="ecdsa/rsa")throw new Error("wrong private key type");return mke(t,o)}else if(o.type==="dsa"){if(n!=="dsa")throw new Error("wrong private key type");return yke(t,o,r)}if(n!=="rsa"&&n!=="ecdsa/rsa")throw new Error("wrong private key type");if(e.padding!==void 0&&e.padding!==hke)throw new Error("illegal or unsupported padding mode");t=Ds.concat([i,t]);for(var s=o.modulus.byteLength(),a=[0,1];t.length+a.length+1<s;)a.push(255);a.push(0);for(var d=-1;++d<t.length;)a.push(t[d]);var m=fke(a,o);return m}function mke(t,e){var r=dke[e.curve.join(".")];if(!r)throw new Error("unknown curve "+e.curve.join("."));var n=new uke(r),i=n.keyFromPrivate(e.privateKey),o=i.sign(t);return Ds.from(o.toDER())}function yke(t,e,r){for(var n=e.params.priv_key,i=e.params.p,o=e.params.q,s=e.params.g,a=new FM(0),d,m=V7(t,o).mod(o),p=!1,w=ire(n,o,t,r);p===!1;)d=ore(o,w,r),a=bke(s,d,i,o),p=d.invm(o).imul(m.add(n.mul(a))).mod(o),p.cmpn(0)===0&&(p=!1,a=new FM(0));return gke(a,p)}function gke(t,e){t=t.toArray(),e=e.toArray(),t[0]&128&&(t=[0].concat(t)),e[0]&128&&(e=[0].concat(e));var r=t.length+e.length+4,n=[48,r,2,t.length];return n=n.concat(t,[2,e.length],e),Ds.from(n)}function ire(t,e,r,n){if(t=Ds.from(t.toArray()),t.length<e.byteLength()){var i=Ds.alloc(e.byteLength()-t.length);t=Ds.concat([i,t])}var o=r.length,s=vke(r,e),a=Ds.alloc(o);a.fill(1);var d=Ds.alloc(o);return d=zm(n,d).update(a).update(Ds.from([0])).update(t).update(s).digest(),a=zm(n,d).update(a).digest(),d=zm(n,d).update(a).update(Ds.from([1])).update(t).update(s).digest(),a=zm(n,d).update(a).digest(),{k:d,v:a}}function V7(t,e){var r=new FM(t),n=(t.length<<3)-e.bitLength();return n>0&&r.ishrn(n),r}function vke(t,e){t=V7(t,e),t=t.mod(e);var r=Ds.from(t.toArray());if(r.length<e.byteLength()){var n=Ds.alloc(e.byteLength()-r.length);r=Ds.concat([n,r])}return r}function ore(t,e,r){var n,i;do{for(n=Ds.alloc(0);n.length*8<t.bitLength();)e.v=zm(r,e.k).update(e.v).digest(),n=Ds.concat([n,e.v]);i=V7(n,t),e.k=zm(r,e.k).update(e.v).update(Ds.from([0])).digest(),e.v=zm(r,e.k).update(e.v).digest()}while(i.cmp(t)!==-1);return i}function bke(t,e,r,n){return t.toRed(FM.mont(r)).redPow(e).fromRed().mod(n)}zM.exports=pke;zM.exports.getKey=ire;zM.exports.makeKey=ore});var ure=H((nvt,fre)=>{"use strict";E();var H7=eM().Buffer,f_=mM(),wke=BM().ec,cre=c_(),_ke=W7();function xke(t,e,r,n,i){var o=cre(r);if(o.type==="ec"){if(n!=="ecdsa"&&n!=="ecdsa/rsa")throw new Error("wrong public key type");return Eke(t,e,o)}else if(o.type==="dsa"){if(n!=="dsa")throw new Error("wrong public key type");return Ske(t,e,o)}if(n!=="rsa"&&n!=="ecdsa/rsa")throw new Error("wrong public key type");e=H7.concat([i,e]);for(var s=o.modulus.byteLength(),a=[1],d=0;e.length+a.length+2<s;)a.push(255),d+=1;a.push(0);for(var m=-1;++m<e.length;)a.push(e[m]);a=H7.from(a);var p=f_.mont(o.modulus);t=new f_(t).toRed(p),t=t.redPow(new f_(o.publicExponent)),t=H7.from(t.fromRed().toArray());var w=d<8?1:0;for(s=Math.min(t.length,a.length),t.length!==a.length&&(w=1),m=-1;++m<s;)w|=t[m]^a[m];return w===0}function Eke(t,e,r){var n=_ke[r.data.algorithm.curve.join(".")];if(!n)throw new Error("unknown curve "+r.data.algorithm.curve.join("."));var i=new wke(n),o=r.data.subjectPrivateKey.data;return i.verify(e,t,o)}function Ske(t,e,r){var n=r.data.p,i=r.data.q,o=r.data.g,s=r.data.pub_key,a=cre.signature.decode(t,"der"),d=a.s,m=a.r;are(d,i),are(m,i);var p=f_.mont(n),w=d.invm(i),P=o.toRed(p).redPow(new f_(e).mul(w).mod(i)).fromRed().mul(s.toRed(p).redPow(m.mul(w).mod(i)).fromRed()).mod(n).mod(i);return P.cmp(m)===0}function are(t,e){if(t.cmpn(0)<=0)throw new Error("invalid sig");if(t.cmp(e)>=0)throw new Error("invalid sig")}fre.exports=xke});var yre=H((ovt,mre)=>{"use strict";E();var KM=eM().Buffer,hre=Ov(),GM=UX(),pre=It(),Mke=sre(),Pke=ure(),Km=Jk();Object.keys(Km).forEach(function(t){Km[t].id=KM.from(Km[t].id,"hex"),Km[t.toLowerCase()]=Km[t]});function u_(t){GM.Writable.call(this);var e=Km[t];if(!e)throw new Error("Unknown message digest");this._hashType=e.hash,this._hash=hre(e.hash),this._tag=e.id,this._signType=e.sign}pre(u_,GM.Writable);u_.prototype._write=function(e,r,n){this._hash.update(e),n()};u_.prototype.update=function(e,r){return this._hash.update(typeof e=="string"?KM.from(e,r):e),this};u_.prototype.sign=function(e,r){this.end();var n=this._hash.digest(),i=Mke(n,e,this._hashType,this._signType,this._tag);return r?i.toString(r):i};function l_(t){GM.Writable.call(this);var e=Km[t];if(!e)throw new Error("Unknown message digest");this._hash=hre(e.hash),this._tag=e.id,this._signType=e.sign}pre(l_,GM.Writable);l_.prototype._write=function(e,r,n){this._hash.update(e),n()};l_.prototype.update=function(e,r){return this._hash.update(typeof e=="string"?KM.from(e,r):e),this};l_.prototype.verify=function(e,r,n){var i=typeof r=="string"?KM.from(r,n):r;this.end();var o=this._hash.digest();return Pke(i,o,e,this._signType,this._tag)};function lre(t){return new u_(t)}function dre(t){return new l_(t)}mre.exports={Sign:lre,Verify:dre,createSign:lre,createVerify:dre}});var vre=H((gre,Z7)=>{E();(function(t,e){"use strict";function r(x,c){if(!x)throw new Error(c||"Assertion failed")}function n(x,c){x.super_=c;var u=function(){};u.prototype=c.prototype,x.prototype=new u,x.prototype.constructor=x}function i(x,c,u){if(i.isBN(x))return x;this.negative=0,this.words=null,this.length=0,this.red=null,x!==null&&((c==="le"||c==="be")&&(u=c,c=10),this._init(x||0,c||10,u||"be"))}typeof t=="object"?t.exports=i:e.BN=i,i.BN=i,i.wordSize=26;var o;try{typeof window<"u"&&typeof window.Buffer<"u"?o=window.Buffer:o=sr().Buffer}catch{}i.isBN=function(c){return c instanceof i?!0:c!==null&&typeof c=="object"&&c.constructor.wordSize===i.wordSize&&Array.isArray(c.words)},i.max=function(c,u){return c.cmp(u)>0?c:u},i.min=function(c,u){return c.cmp(u)<0?c:u},i.prototype._init=function(c,u,y){if(typeof c=="number")return this._initNumber(c,u,y);if(typeof c=="object")return this._initArray(c,u,y);u==="hex"&&(u=16),r(u===(u|0)&&u>=2&&u<=36),c=c.toString().replace(/\s+/g,"");var l=0;c[0]==="-"&&(l++,this.negative=1),l<c.length&&(u===16?this._parseHex(c,l,y):(this._parseBase(c,u,l),y==="le"&&this._initArray(this.toArray(),u,y)))},i.prototype._initNumber=function(c,u,y){c<0&&(this.negative=1,c=-c),c<67108864?(this.words=[c&67108863],this.length=1):c<4503599627370496?(this.words=[c&67108863,c/67108864&67108863],this.length=2):(r(c<9007199254740992),this.words=[c&67108863,c/67108864&67108863,1],this.length=3),y==="le"&&this._initArray(this.toArray(),u,y)},i.prototype._initArray=function(c,u,y){if(r(typeof c.length=="number"),c.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(c.length/3),this.words=new Array(this.length);for(var l=0;l<this.length;l++)this.words[l]=0;var h,b,_=0;if(y==="be")for(l=c.length-1,h=0;l>=0;l-=3)b=c[l]|c[l-1]<<8|c[l-2]<<16,this.words[h]|=b<<_&67108863,this.words[h+1]=b>>>26-_&67108863,_+=24,_>=26&&(_-=26,h++);else if(y==="le")for(l=0,h=0;l<c.length;l+=3)b=c[l]|c[l+1]<<8|c[l+2]<<16,this.words[h]|=b<<_&67108863,this.words[h+1]=b>>>26-_&67108863,_+=24,_>=26&&(_-=26,h++);return this.strip()};function s(x,c){var u=x.charCodeAt(c);return u>=65&&u<=70?u-55:u>=97&&u<=102?u-87:u-48&15}function a(x,c,u){var y=s(x,u);return u-1>=c&&(y|=s(x,u-1)<<4),y}i.prototype._parseHex=function(c,u,y){this.length=Math.ceil((c.length-u)/6),this.words=new Array(this.length);for(var l=0;l<this.length;l++)this.words[l]=0;var h=0,b=0,_;if(y==="be")for(l=c.length-1;l>=u;l-=2)_=a(c,u,l)<<h,this.words[b]|=_&67108863,h>=18?(h-=18,b+=1,this.words[b]|=_>>>26):h+=8;else{var g=c.length-u;for(l=g%2===0?u+1:u;l<c.length;l+=2)_=a(c,u,l)<<h,this.words[b]|=_&67108863,h>=18?(h-=18,b+=1,this.words[b]|=_>>>26):h+=8}this.strip()};function d(x,c,u,y){for(var l=0,h=Math.min(x.length,u),b=c;b<h;b++){var _=x.charCodeAt(b)-48;l*=y,_>=49?l+=_-49+10:_>=17?l+=_-17+10:l+=_}return l}i.prototype._parseBase=function(c,u,y){this.words=[0],this.length=1;for(var l=0,h=1;h<=67108863;h*=u)l++;l--,h=h/u|0;for(var b=c.length-y,_=b%l,g=Math.min(b,b-_)+y,f=0,v=y;v<g;v+=l)f=d(c,v,v+l,u),this.imuln(h),this.words[0]+f<67108864?this.words[0]+=f:this._iaddn(f);if(_!==0){var O=1;for(f=d(c,v,c.length,u),v=0;v<_;v++)O*=u;this.imuln(O),this.words[0]+f<67108864?this.words[0]+=f:this._iaddn(f)}this.strip()},i.prototype.copy=function(c){c.words=new Array(this.length);for(var u=0;u<this.length;u++)c.words[u]=this.words[u];c.length=this.length,c.negative=this.negative,c.red=this.red},i.prototype.clone=function(){var c=new i(null);return this.copy(c),c},i.prototype._expand=function(c){for(;this.length<c;)this.words[this.length++]=0;return this},i.prototype.strip=function(){for(;this.length>1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},i.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},i.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var m=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],p=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],w=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];i.prototype.toString=function(c,u){c=c||10,u=u|0||1;var y;if(c===16||c==="hex"){y="";for(var l=0,h=0,b=0;b<this.length;b++){var _=this.words[b],g=((_<<l|h)&16777215).toString(16);h=_>>>24-l&16777215,h!==0||b!==this.length-1?y=m[6-g.length]+g+y:y=g+y,l+=2,l>=26&&(l-=26,b--)}for(h!==0&&(y=h.toString(16)+y);y.length%u!==0;)y="0"+y;return this.negative!==0&&(y="-"+y),y}if(c===(c|0)&&c>=2&&c<=36){var f=p[c],v=w[c];y="";var O=this.clone();for(O.negative=0;!O.isZero();){var T=O.modn(v).toString(c);O=O.idivn(v),O.isZero()?y=T+y:y=m[f-T.length]+T+y}for(this.isZero()&&(y="0"+y);y.length%u!==0;)y="0"+y;return this.negative!==0&&(y="-"+y),y}r(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var c=this.words[0];return this.length===2?c+=this.words[1]*67108864:this.length===3&&this.words[2]===1?c+=4503599627370496+this.words[1]*67108864:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-c:c},i.prototype.toJSON=function(){return this.toString(16)},i.prototype.toBuffer=function(c,u){return r(typeof o<"u"),this.toArrayLike(o,c,u)},i.prototype.toArray=function(c,u){return this.toArrayLike(Array,c,u)},i.prototype.toArrayLike=function(c,u,y){var l=this.byteLength(),h=y||Math.max(1,l);r(l<=h,"byte array longer than desired length"),r(h>0,"Requested array length <= 0"),this.strip();var b=u==="le",_=new c(h),g,f,v=this.clone();if(b){for(f=0;!v.isZero();f++)g=v.andln(255),v.iushrn(8),_[f]=g;for(;f<h;f++)_[f]=0}else{for(f=0;f<h-l;f++)_[f]=0;for(f=0;!v.isZero();f++)g=v.andln(255),v.iushrn(8),_[h-f-1]=g}return _},Math.clz32?i.prototype._countBits=function(c){return 32-Math.clz32(c)}:i.prototype._countBits=function(c){var u=c,y=0;return u>=4096&&(y+=13,u>>>=13),u>=64&&(y+=7,u>>>=7),u>=8&&(y+=4,u>>>=4),u>=2&&(y+=2,u>>>=2),y+u},i.prototype._zeroBits=function(c){if(c===0)return 26;var u=c,y=0;return u&8191||(y+=13,u>>>=13),u&127||(y+=7,u>>>=7),u&15||(y+=4,u>>>=4),u&3||(y+=2,u>>>=2),u&1||y++,y},i.prototype.bitLength=function(){var c=this.words[this.length-1],u=this._countBits(c);return(this.length-1)*26+u};function P(x){for(var c=new Array(x.bitLength()),u=0;u<c.length;u++){var y=u/26|0,l=u%26;c[u]=(x.words[y]&1<<l)>>>l}return c}i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var c=0,u=0;u<this.length;u++){var y=this._zeroBits(this.words[u]);if(c+=y,y!==26)break}return c},i.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},i.prototype.toTwos=function(c){return this.negative!==0?this.abs().inotn(c).iaddn(1):this.clone()},i.prototype.fromTwos=function(c){return this.testn(c-1)?this.notn(c).iaddn(1).ineg():this.clone()},i.prototype.isNeg=function(){return this.negative!==0},i.prototype.neg=function(){return this.clone().ineg()},i.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},i.prototype.iuor=function(c){for(;this.length<c.length;)this.words[this.length++]=0;for(var u=0;u<c.length;u++)this.words[u]=this.words[u]|c.words[u];return this.strip()},i.prototype.ior=function(c){return r((this.negative|c.negative)===0),this.iuor(c)},i.prototype.or=function(c){return this.length>c.length?this.clone().ior(c):c.clone().ior(this)},i.prototype.uor=function(c){return this.length>c.length?this.clone().iuor(c):c.clone().iuor(this)},i.prototype.iuand=function(c){var u;this.length>c.length?u=c:u=this;for(var y=0;y<u.length;y++)this.words[y]=this.words[y]&c.words[y];return this.length=u.length,this.strip()},i.prototype.iand=function(c){return r((this.negative|c.negative)===0),this.iuand(c)},i.prototype.and=function(c){return this.length>c.length?this.clone().iand(c):c.clone().iand(this)},i.prototype.uand=function(c){return this.length>c.length?this.clone().iuand(c):c.clone().iuand(this)},i.prototype.iuxor=function(c){var u,y;this.length>c.length?(u=this,y=c):(u=c,y=this);for(var l=0;l<y.length;l++)this.words[l]=u.words[l]^y.words[l];if(this!==u)for(;l<u.length;l++)this.words[l]=u.words[l];return this.length=u.length,this.strip()},i.prototype.ixor=function(c){return r((this.negative|c.negative)===0),this.iuxor(c)},i.prototype.xor=function(c){return this.length>c.length?this.clone().ixor(c):c.clone().ixor(this)},i.prototype.uxor=function(c){return this.length>c.length?this.clone().iuxor(c):c.clone().iuxor(this)},i.prototype.inotn=function(c){r(typeof c=="number"&&c>=0);var u=Math.ceil(c/26)|0,y=c%26;this._expand(u),y>0&&u--;for(var l=0;l<u;l++)this.words[l]=~this.words[l]&67108863;return y>0&&(this.words[l]=~this.words[l]&67108863>>26-y),this.strip()},i.prototype.notn=function(c){return this.clone().inotn(c)},i.prototype.setn=function(c,u){r(typeof c=="number"&&c>=0);var y=c/26|0,l=c%26;return this._expand(y+1),u?this.words[y]=this.words[y]|1<<l:this.words[y]=this.words[y]&~(1<<l),this.strip()},i.prototype.iadd=function(c){var u;if(this.negative!==0&&c.negative===0)return this.negative=0,u=this.isub(c),this.negative^=1,this._normSign();if(this.negative===0&&c.negative!==0)return c.negative=0,u=this.isub(c),c.negative=1,u._normSign();var y,l;this.length>c.length?(y=this,l=c):(y=c,l=this);for(var h=0,b=0;b<l.length;b++)u=(y.words[b]|0)+(l.words[b]|0)+h,this.words[b]=u&67108863,h=u>>>26;for(;h!==0&&b<y.length;b++)u=(y.words[b]|0)+h,this.words[b]=u&67108863,h=u>>>26;if(this.length=y.length,h!==0)this.words[this.length]=h,this.length++;else if(y!==this)for(;b<y.length;b++)this.words[b]=y.words[b];return this},i.prototype.add=function(c){var u;return c.negative!==0&&this.negative===0?(c.negative=0,u=this.sub(c),c.negative^=1,u):c.negative===0&&this.negative!==0?(this.negative=0,u=c.sub(this),this.negative=1,u):this.length>c.length?this.clone().iadd(c):c.clone().iadd(this)},i.prototype.isub=function(c){if(c.negative!==0){c.negative=0;var u=this.iadd(c);return c.negative=1,u._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(c),this.negative=1,this._normSign();var y=this.cmp(c);if(y===0)return this.negative=0,this.length=1,this.words[0]=0,this;var l,h;y>0?(l=this,h=c):(l=c,h=this);for(var b=0,_=0;_<h.length;_++)u=(l.words[_]|0)-(h.words[_]|0)+b,b=u>>26,this.words[_]=u&67108863;for(;b!==0&&_<l.length;_++)u=(l.words[_]|0)+b,b=u>>26,this.words[_]=u&67108863;if(b===0&&_<l.length&&l!==this)for(;_<l.length;_++)this.words[_]=l.words[_];return this.length=Math.max(this.length,_),l!==this&&(this.negative=1),this.strip()},i.prototype.sub=function(c){return this.clone().isub(c)};function S(x,c,u){u.negative=c.negative^x.negative;var y=x.length+c.length|0;u.length=y,y=y-1|0;var l=x.words[0]|0,h=c.words[0]|0,b=l*h,_=b&67108863,g=b/67108864|0;u.words[0]=_;for(var f=1;f<y;f++){for(var v=g>>>26,O=g&67108863,T=Math.min(f,c.length-1),R=Math.max(0,f-x.length+1);R<=T;R++){var z=f-R|0;l=x.words[z]|0,h=c.words[R]|0,b=l*h+O,v+=b/67108864|0,O=b&67108863}u.words[f]=O|0,g=v|0}return g!==0?u.words[f]=g|0:u.length--,u.strip()}var M=function(c,u,y){var l=c.words,h=u.words,b=y.words,_=0,g,f,v,O=l[0]|0,T=O&8191,R=O>>>13,z=l[1]|0,V=z&8191,W=z>>>13,Z=l[2]|0,J=Z&8191,X=Z>>>13,Ee=l[3]|0,re=Ee&8191,ne=Ee>>>13,qe=l[4]|0,ce=qe&8191,ye=qe>>>13,Ne=l[5]|0,ie=Ne&8191,oe=Ne>>>13,ze=l[6]|0,le=ze&8191,me=ze>>>13,ot=l[7]|0,ue=ot&8191,he=ot>>>13,lt=l[8]|0,se=lt&8191,fe=lt>>>13,Lt=l[9]|0,ge=Lt&8191,ve=Lt>>>13,on=h[0]|0,xe=on&8191,Pe=on>>>13,jr=h[1]|0,Se=jr&8191,_e=jr>>>13,Mn=h[2]|0,Me=Mn&8191,Te=Mn>>>13,vi=h[3]|0,Ae=vi&8191,Be=vi>>>13,Pn=h[4]|0,De=Pn&8191,Ie=Pn>>>13,bi=h[5]|0,Re=bi&8191,ke=bi>>>13,wi=h[6]|0,Oe=wi&8191,Ce=wi>>>13,oi=h[7]|0,Q=oi&8191,Y=oi>>>13,ae=h[8]|0,ee=ae&8191,te=ae>>>13,Ke=h[9]|0,de=Ke&8191,pe=Ke>>>13;y.negative=c.negative^u.negative,y.length=19,g=Math.imul(T,xe),f=Math.imul(T,Pe),f=f+Math.imul(R,xe)|0,v=Math.imul(R,Pe);var bt=(_+g|0)+((f&8191)<<13)|0;_=(v+(f>>>13)|0)+(bt>>>26)|0,bt&=67108863,g=Math.imul(V,xe),f=Math.imul(V,Pe),f=f+Math.imul(W,xe)|0,v=Math.imul(W,Pe),g=g+Math.imul(T,Se)|0,f=f+Math.imul(T,_e)|0,f=f+Math.imul(R,Se)|0,v=v+Math.imul(R,_e)|0;var st=(_+g|0)+((f&8191)<<13)|0;_=(v+(f>>>13)|0)+(st>>>26)|0,st&=67108863,g=Math.imul(J,xe),f=Math.imul(J,Pe),f=f+Math.imul(X,xe)|0,v=Math.imul(X,Pe),g=g+Math.imul(V,Se)|0,f=f+Math.imul(V,_e)|0,f=f+Math.imul(W,Se)|0,v=v+Math.imul(W,_e)|0,g=g+Math.imul(T,Me)|0,f=f+Math.imul(T,Te)|0,f=f+Math.imul(R,Me)|0,v=v+Math.imul(R,Te)|0;var Ve=(_+g|0)+((f&8191)<<13)|0;_=(v+(f>>>13)|0)+(Ve>>>26)|0,Ve&=67108863,g=Math.imul(re,xe),f=Math.imul(re,Pe),f=f+Math.imul(ne,xe)|0,v=Math.imul(ne,Pe),g=g+Math.imul(J,Se)|0,f=f+Math.imul(J,_e)|0,f=f+Math.imul(X,Se)|0,v=v+Math.imul(X,_e)|0,g=g+Math.imul(V,Me)|0,f=f+Math.imul(V,Te)|0,f=f+Math.imul(W,Me)|0,v=v+Math.imul(W,Te)|0,g=g+Math.imul(T,Ae)|0,f=f+Math.imul(T,Be)|0,f=f+Math.imul(R,Ae)|0,v=v+Math.imul(R,Be)|0;var Tt=(_+g|0)+((f&8191)<<13)|0;_=(v+(f>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,g=Math.imul(ce,xe),f=Math.imul(ce,Pe),f=f+Math.imul(ye,xe)|0,v=Math.imul(ye,Pe),g=g+Math.imul(re,Se)|0,f=f+Math.imul(re,_e)|0,f=f+Math.imul(ne,Se)|0,v=v+Math.imul(ne,_e)|0,g=g+Math.imul(J,Me)|0,f=f+Math.imul(J,Te)|0,f=f+Math.imul(X,Me)|0,v=v+Math.imul(X,Te)|0,g=g+Math.imul(V,Ae)|0,f=f+Math.imul(V,Be)|0,f=f+Math.imul(W,Ae)|0,v=v+Math.imul(W,Be)|0,g=g+Math.imul(T,De)|0,f=f+Math.imul(T,Ie)|0,f=f+Math.imul(R,De)|0,v=v+Math.imul(R,Ie)|0;var Ut=(_+g|0)+((f&8191)<<13)|0;_=(v+(f>>>13)|0)+(Ut>>>26)|0,Ut&=67108863,g=Math.imul(ie,xe),f=Math.imul(ie,Pe),f=f+Math.imul(oe,xe)|0,v=Math.imul(oe,Pe),g=g+Math.imul(ce,Se)|0,f=f+Math.imul(ce,_e)|0,f=f+Math.imul(ye,Se)|0,v=v+Math.imul(ye,_e)|0,g=g+Math.imul(re,Me)|0,f=f+Math.imul(re,Te)|0,f=f+Math.imul(ne,Me)|0,v=v+Math.imul(ne,Te)|0,g=g+Math.imul(J,Ae)|0,f=f+Math.imul(J,Be)|0,f=f+Math.imul(X,Ae)|0,v=v+Math.imul(X,Be)|0,g=g+Math.imul(V,De)|0,f=f+Math.imul(V,Ie)|0,f=f+Math.imul(W,De)|0,v=v+Math.imul(W,Ie)|0,g=g+Math.imul(T,Re)|0,f=f+Math.imul(T,ke)|0,f=f+Math.imul(R,Re)|0,v=v+Math.imul(R,ke)|0;var Pt=(_+g|0)+((f&8191)<<13)|0;_=(v+(f>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,g=Math.imul(le,xe),f=Math.imul(le,Pe),f=f+Math.imul(me,xe)|0,v=Math.imul(me,Pe),g=g+Math.imul(ie,Se)|0,f=f+Math.imul(ie,_e)|0,f=f+Math.imul(oe,Se)|0,v=v+Math.imul(oe,_e)|0,g=g+Math.imul(ce,Me)|0,f=f+Math.imul(ce,Te)|0,f=f+Math.imul(ye,Me)|0,v=v+Math.imul(ye,Te)|0,g=g+Math.imul(re,Ae)|0,f=f+Math.imul(re,Be)|0,f=f+Math.imul(ne,Ae)|0,v=v+Math.imul(ne,Be)|0,g=g+Math.imul(J,De)|0,f=f+Math.imul(J,Ie)|0,f=f+Math.imul(X,De)|0,v=v+Math.imul(X,Ie)|0,g=g+Math.imul(V,Re)|0,f=f+Math.imul(V,ke)|0,f=f+Math.imul(W,Re)|0,v=v+Math.imul(W,ke)|0,g=g+Math.imul(T,Oe)|0,f=f+Math.imul(T,Ce)|0,f=f+Math.imul(R,Oe)|0,v=v+Math.imul(R,Ce)|0;var yt=(_+g|0)+((f&8191)<<13)|0;_=(v+(f>>>13)|0)+(yt>>>26)|0,yt&=67108863,g=Math.imul(ue,xe),f=Math.imul(ue,Pe),f=f+Math.imul(he,xe)|0,v=Math.imul(he,Pe),g=g+Math.imul(le,Se)|0,f=f+Math.imul(le,_e)|0,f=f+Math.imul(me,Se)|0,v=v+Math.imul(me,_e)|0,g=g+Math.imul(ie,Me)|0,f=f+Math.imul(ie,Te)|0,f=f+Math.imul(oe,Me)|0,v=v+Math.imul(oe,Te)|0,g=g+Math.imul(ce,Ae)|0,f=f+Math.imul(ce,Be)|0,f=f+Math.imul(ye,Ae)|0,v=v+Math.imul(ye,Be)|0,g=g+Math.imul(re,De)|0,f=f+Math.imul(re,Ie)|0,f=f+Math.imul(ne,De)|0,v=v+Math.imul(ne,Ie)|0,g=g+Math.imul(J,Re)|0,f=f+Math.imul(J,ke)|0,f=f+Math.imul(X,Re)|0,v=v+Math.imul(X,ke)|0,g=g+Math.imul(V,Oe)|0,f=f+Math.imul(V,Ce)|0,f=f+Math.imul(W,Oe)|0,v=v+Math.imul(W,Ce)|0,g=g+Math.imul(T,Q)|0,f=f+Math.imul(T,Y)|0,f=f+Math.imul(R,Q)|0,v=v+Math.imul(R,Y)|0;var Rt=(_+g|0)+((f&8191)<<13)|0;_=(v+(f>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,g=Math.imul(se,xe),f=Math.imul(se,Pe),f=f+Math.imul(fe,xe)|0,v=Math.imul(fe,Pe),g=g+Math.imul(ue,Se)|0,f=f+Math.imul(ue,_e)|0,f=f+Math.imul(he,Se)|0,v=v+Math.imul(he,_e)|0,g=g+Math.imul(le,Me)|0,f=f+Math.imul(le,Te)|0,f=f+Math.imul(me,Me)|0,v=v+Math.imul(me,Te)|0,g=g+Math.imul(ie,Ae)|0,f=f+Math.imul(ie,Be)|0,f=f+Math.imul(oe,Ae)|0,v=v+Math.imul(oe,Be)|0,g=g+Math.imul(ce,De)|0,f=f+Math.imul(ce,Ie)|0,f=f+Math.imul(ye,De)|0,v=v+Math.imul(ye,Ie)|0,g=g+Math.imul(re,Re)|0,f=f+Math.imul(re,ke)|0,f=f+Math.imul(ne,Re)|0,v=v+Math.imul(ne,ke)|0,g=g+Math.imul(J,Oe)|0,f=f+Math.imul(J,Ce)|0,f=f+Math.imul(X,Oe)|0,v=v+Math.imul(X,Ce)|0,g=g+Math.imul(V,Q)|0,f=f+Math.imul(V,Y)|0,f=f+Math.imul(W,Q)|0,v=v+Math.imul(W,Y)|0,g=g+Math.imul(T,ee)|0,f=f+Math.imul(T,te)|0,f=f+Math.imul(R,ee)|0,v=v+Math.imul(R,te)|0;var _t=(_+g|0)+((f&8191)<<13)|0;_=(v+(f>>>13)|0)+(_t>>>26)|0,_t&=67108863,g=Math.imul(ge,xe),f=Math.imul(ge,Pe),f=f+Math.imul(ve,xe)|0,v=Math.imul(ve,Pe),g=g+Math.imul(se,Se)|0,f=f+Math.imul(se,_e)|0,f=f+Math.imul(fe,Se)|0,v=v+Math.imul(fe,_e)|0,g=g+Math.imul(ue,Me)|0,f=f+Math.imul(ue,Te)|0,f=f+Math.imul(he,Me)|0,v=v+Math.imul(he,Te)|0,g=g+Math.imul(le,Ae)|0,f=f+Math.imul(le,Be)|0,f=f+Math.imul(me,Ae)|0,v=v+Math.imul(me,Be)|0,g=g+Math.imul(ie,De)|0,f=f+Math.imul(ie,Ie)|0,f=f+Math.imul(oe,De)|0,v=v+Math.imul(oe,Ie)|0,g=g+Math.imul(ce,Re)|0,f=f+Math.imul(ce,ke)|0,f=f+Math.imul(ye,Re)|0,v=v+Math.imul(ye,ke)|0,g=g+Math.imul(re,Oe)|0,f=f+Math.imul(re,Ce)|0,f=f+Math.imul(ne,Oe)|0,v=v+Math.imul(ne,Ce)|0,g=g+Math.imul(J,Q)|0,f=f+Math.imul(J,Y)|0,f=f+Math.imul(X,Q)|0,v=v+Math.imul(X,Y)|0,g=g+Math.imul(V,ee)|0,f=f+Math.imul(V,te)|0,f=f+Math.imul(W,ee)|0,v=v+Math.imul(W,te)|0,g=g+Math.imul(T,de)|0,f=f+Math.imul(T,pe)|0,f=f+Math.imul(R,de)|0,v=v+Math.imul(R,pe)|0;var Lr=(_+g|0)+((f&8191)<<13)|0;_=(v+(f>>>13)|0)+(Lr>>>26)|0,Lr&=67108863,g=Math.imul(ge,Se),f=Math.imul(ge,_e),f=f+Math.imul(ve,Se)|0,v=Math.imul(ve,_e),g=g+Math.imul(se,Me)|0,f=f+Math.imul(se,Te)|0,f=f+Math.imul(fe,Me)|0,v=v+Math.imul(fe,Te)|0,g=g+Math.imul(ue,Ae)|0,f=f+Math.imul(ue,Be)|0,f=f+Math.imul(he,Ae)|0,v=v+Math.imul(he,Be)|0,g=g+Math.imul(le,De)|0,f=f+Math.imul(le,Ie)|0,f=f+Math.imul(me,De)|0,v=v+Math.imul(me,Ie)|0,g=g+Math.imul(ie,Re)|0,f=f+Math.imul(ie,ke)|0,f=f+Math.imul(oe,Re)|0,v=v+Math.imul(oe,ke)|0,g=g+Math.imul(ce,Oe)|0,f=f+Math.imul(ce,Ce)|0,f=f+Math.imul(ye,Oe)|0,v=v+Math.imul(ye,Ce)|0,g=g+Math.imul(re,Q)|0,f=f+Math.imul(re,Y)|0,f=f+Math.imul(ne,Q)|0,v=v+Math.imul(ne,Y)|0,g=g+Math.imul(J,ee)|0,f=f+Math.imul(J,te)|0,f=f+Math.imul(X,ee)|0,v=v+Math.imul(X,te)|0,g=g+Math.imul(V,de)|0,f=f+Math.imul(V,pe)|0,f=f+Math.imul(W,de)|0,v=v+Math.imul(W,pe)|0;var nr=(_+g|0)+((f&8191)<<13)|0;_=(v+(f>>>13)|0)+(nr>>>26)|0,nr&=67108863,g=Math.imul(ge,Me),f=Math.imul(ge,Te),f=f+Math.imul(ve,Me)|0,v=Math.imul(ve,Te),g=g+Math.imul(se,Ae)|0,f=f+Math.imul(se,Be)|0,f=f+Math.imul(fe,Ae)|0,v=v+Math.imul(fe,Be)|0,g=g+Math.imul(ue,De)|0,f=f+Math.imul(ue,Ie)|0,f=f+Math.imul(he,De)|0,v=v+Math.imul(he,Ie)|0,g=g+Math.imul(le,Re)|0,f=f+Math.imul(le,ke)|0,f=f+Math.imul(me,Re)|0,v=v+Math.imul(me,ke)|0,g=g+Math.imul(ie,Oe)|0,f=f+Math.imul(ie,Ce)|0,f=f+Math.imul(oe,Oe)|0,v=v+Math.imul(oe,Ce)|0,g=g+Math.imul(ce,Q)|0,f=f+Math.imul(ce,Y)|0,f=f+Math.imul(ye,Q)|0,v=v+Math.imul(ye,Y)|0,g=g+Math.imul(re,ee)|0,f=f+Math.imul(re,te)|0,f=f+Math.imul(ne,ee)|0,v=v+Math.imul(ne,te)|0,g=g+Math.imul(J,de)|0,f=f+Math.imul(J,pe)|0,f=f+Math.imul(X,de)|0,v=v+Math.imul(X,pe)|0;var lr=(_+g|0)+((f&8191)<<13)|0;_=(v+(f>>>13)|0)+(lr>>>26)|0,lr&=67108863,g=Math.imul(ge,Ae),f=Math.imul(ge,Be),f=f+Math.imul(ve,Ae)|0,v=Math.imul(ve,Be),g=g+Math.imul(se,De)|0,f=f+Math.imul(se,Ie)|0,f=f+Math.imul(fe,De)|0,v=v+Math.imul(fe,Ie)|0,g=g+Math.imul(ue,Re)|0,f=f+Math.imul(ue,ke)|0,f=f+Math.imul(he,Re)|0,v=v+Math.imul(he,ke)|0,g=g+Math.imul(le,Oe)|0,f=f+Math.imul(le,Ce)|0,f=f+Math.imul(me,Oe)|0,v=v+Math.imul(me,Ce)|0,g=g+Math.imul(ie,Q)|0,f=f+Math.imul(ie,Y)|0,f=f+Math.imul(oe,Q)|0,v=v+Math.imul(oe,Y)|0,g=g+Math.imul(ce,ee)|0,f=f+Math.imul(ce,te)|0,f=f+Math.imul(ye,ee)|0,v=v+Math.imul(ye,te)|0,g=g+Math.imul(re,de)|0,f=f+Math.imul(re,pe)|0,f=f+Math.imul(ne,de)|0,v=v+Math.imul(ne,pe)|0;var xt=(_+g|0)+((f&8191)<<13)|0;_=(v+(f>>>13)|0)+(xt>>>26)|0,xt&=67108863,g=Math.imul(ge,De),f=Math.imul(ge,Ie),f=f+Math.imul(ve,De)|0,v=Math.imul(ve,Ie),g=g+Math.imul(se,Re)|0,f=f+Math.imul(se,ke)|0,f=f+Math.imul(fe,Re)|0,v=v+Math.imul(fe,ke)|0,g=g+Math.imul(ue,Oe)|0,f=f+Math.imul(ue,Ce)|0,f=f+Math.imul(he,Oe)|0,v=v+Math.imul(he,Ce)|0,g=g+Math.imul(le,Q)|0,f=f+Math.imul(le,Y)|0,f=f+Math.imul(me,Q)|0,v=v+Math.imul(me,Y)|0,g=g+Math.imul(ie,ee)|0,f=f+Math.imul(ie,te)|0,f=f+Math.imul(oe,ee)|0,v=v+Math.imul(oe,te)|0,g=g+Math.imul(ce,de)|0,f=f+Math.imul(ce,pe)|0,f=f+Math.imul(ye,de)|0,v=v+Math.imul(ye,pe)|0;var ir=(_+g|0)+((f&8191)<<13)|0;_=(v+(f>>>13)|0)+(ir>>>26)|0,ir&=67108863,g=Math.imul(ge,Re),f=Math.imul(ge,ke),f=f+Math.imul(ve,Re)|0,v=Math.imul(ve,ke),g=g+Math.imul(se,Oe)|0,f=f+Math.imul(se,Ce)|0,f=f+Math.imul(fe,Oe)|0,v=v+Math.imul(fe,Ce)|0,g=g+Math.imul(ue,Q)|0,f=f+Math.imul(ue,Y)|0,f=f+Math.imul(he,Q)|0,v=v+Math.imul(he,Y)|0,g=g+Math.imul(le,ee)|0,f=f+Math.imul(le,te)|0,f=f+Math.imul(me,ee)|0,v=v+Math.imul(me,te)|0,g=g+Math.imul(ie,de)|0,f=f+Math.imul(ie,pe)|0,f=f+Math.imul(oe,de)|0,v=v+Math.imul(oe,pe)|0;var dr=(_+g|0)+((f&8191)<<13)|0;_=(v+(f>>>13)|0)+(dr>>>26)|0,dr&=67108863,g=Math.imul(ge,Oe),f=Math.imul(ge,Ce),f=f+Math.imul(ve,Oe)|0,v=Math.imul(ve,Ce),g=g+Math.imul(se,Q)|0,f=f+Math.imul(se,Y)|0,f=f+Math.imul(fe,Q)|0,v=v+Math.imul(fe,Y)|0,g=g+Math.imul(ue,ee)|0,f=f+Math.imul(ue,te)|0,f=f+Math.imul(he,ee)|0,v=v+Math.imul(he,te)|0,g=g+Math.imul(le,de)|0,f=f+Math.imul(le,pe)|0,f=f+Math.imul(me,de)|0,v=v+Math.imul(me,pe)|0;var Er=(_+g|0)+((f&8191)<<13)|0;_=(v+(f>>>13)|0)+(Er>>>26)|0,Er&=67108863,g=Math.imul(ge,Q),f=Math.imul(ge,Y),f=f+Math.imul(ve,Q)|0,v=Math.imul(ve,Y),g=g+Math.imul(se,ee)|0,f=f+Math.imul(se,te)|0,f=f+Math.imul(fe,ee)|0,v=v+Math.imul(fe,te)|0,g=g+Math.imul(ue,de)|0,f=f+Math.imul(ue,pe)|0,f=f+Math.imul(he,de)|0,v=v+Math.imul(he,pe)|0;var Ur=(_+g|0)+((f&8191)<<13)|0;_=(v+(f>>>13)|0)+(Ur>>>26)|0,Ur&=67108863,g=Math.imul(ge,ee),f=Math.imul(ge,te),f=f+Math.imul(ve,ee)|0,v=Math.imul(ve,te),g=g+Math.imul(se,de)|0,f=f+Math.imul(se,pe)|0,f=f+Math.imul(fe,de)|0,v=v+Math.imul(fe,pe)|0;var Rr=(_+g|0)+((f&8191)<<13)|0;_=(v+(f>>>13)|0)+(Rr>>>26)|0,Rr&=67108863,g=Math.imul(ge,de),f=Math.imul(ge,pe),f=f+Math.imul(ve,de)|0,v=Math.imul(ve,pe);var Hr=(_+g|0)+((f&8191)<<13)|0;return _=(v+(f>>>13)|0)+(Hr>>>26)|0,Hr&=67108863,b[0]=bt,b[1]=st,b[2]=Ve,b[3]=Tt,b[4]=Ut,b[5]=Pt,b[6]=yt,b[7]=Rt,b[8]=_t,b[9]=Lr,b[10]=nr,b[11]=lr,b[12]=xt,b[13]=ir,b[14]=dr,b[15]=Er,b[16]=Ur,b[17]=Rr,b[18]=Hr,_!==0&&(b[19]=_,y.length++),y};Math.imul||(M=S);function A(x,c,u){u.negative=c.negative^x.negative,u.length=x.length+c.length;for(var y=0,l=0,h=0;h<u.length-1;h++){var b=l;l=0;for(var _=y&67108863,g=Math.min(h,c.length-1),f=Math.max(0,h-x.length+1);f<=g;f++){var v=h-f,O=x.words[v]|0,T=c.words[f]|0,R=O*T,z=R&67108863;b=b+(R/67108864|0)|0,z=z+_|0,_=z&67108863,b=b+(z>>>26)|0,l+=b>>>26,b&=67108863}u.words[h]=_,y=b,b=l}return y!==0?u.words[h]=y:u.length--,u.strip()}function B(x,c,u){var y=new I;return y.mulp(x,c,u)}i.prototype.mulTo=function(c,u){var y,l=this.length+c.length;return this.length===10&&c.length===10?y=M(this,c,u):l<63?y=S(this,c,u):l<1024?y=A(this,c,u):y=B(this,c,u),y};function I(x,c){this.x=x,this.y=c}I.prototype.makeRBT=function(c){for(var u=new Array(c),y=i.prototype._countBits(c)-1,l=0;l<c;l++)u[l]=this.revBin(l,y,c);return u},I.prototype.revBin=function(c,u,y){if(c===0||c===y-1)return c;for(var l=0,h=0;h<u;h++)l|=(c&1)<<u-h-1,c>>=1;return l},I.prototype.permute=function(c,u,y,l,h,b){for(var _=0;_<b;_++)l[_]=u[c[_]],h[_]=y[c[_]]},I.prototype.transform=function(c,u,y,l,h,b){this.permute(b,c,u,y,l,h);for(var _=1;_<h;_<<=1)for(var g=_<<1,f=Math.cos(2*Math.PI/g),v=Math.sin(2*Math.PI/g),O=0;O<h;O+=g)for(var T=f,R=v,z=0;z<_;z++){var V=y[O+z],W=l[O+z],Z=y[O+z+_],J=l[O+z+_],X=T*Z-R*J;J=T*J+R*Z,Z=X,y[O+z]=V+Z,l[O+z]=W+J,y[O+z+_]=V-Z,l[O+z+_]=W-J,z!==g&&(X=f*T-v*R,R=f*R+v*T,T=X)}},I.prototype.guessLen13b=function(c,u){var y=Math.max(u,c)|1,l=y&1,h=0;for(y=y/2|0;y;y=y>>>1)h++;return 1<<h+1+l},I.prototype.conjugate=function(c,u,y){if(!(y<=1))for(var l=0;l<y/2;l++){var h=c[l];c[l]=c[y-l-1],c[y-l-1]=h,h=u[l],u[l]=-u[y-l-1],u[y-l-1]=-h}},I.prototype.normalize13b=function(c,u){for(var y=0,l=0;l<u/2;l++){var h=Math.round(c[2*l+1]/u)*8192+Math.round(c[2*l]/u)+y;c[l]=h&67108863,h<67108864?y=0:y=h/67108864|0}return c},I.prototype.convert13b=function(c,u,y,l){for(var h=0,b=0;b<u;b++)h=h+(c[b]|0),y[2*b]=h&8191,h=h>>>13,y[2*b+1]=h&8191,h=h>>>13;for(b=2*u;b<l;++b)y[b]=0;r(h===0),r((h&-8192)===0)},I.prototype.stub=function(c){for(var u=new Array(c),y=0;y<c;y++)u[y]=0;return u},I.prototype.mulp=function(c,u,y){var l=2*this.guessLen13b(c.length,u.length),h=this.makeRBT(l),b=this.stub(l),_=new Array(l),g=new Array(l),f=new Array(l),v=new Array(l),O=new Array(l),T=new Array(l),R=y.words;R.length=l,this.convert13b(c.words,c.length,_,l),this.convert13b(u.words,u.length,v,l),this.transform(_,b,g,f,l,h),this.transform(v,b,O,T,l,h);for(var z=0;z<l;z++){var V=g[z]*O[z]-f[z]*T[z];f[z]=g[z]*T[z]+f[z]*O[z],g[z]=V}return this.conjugate(g,f,l),this.transform(g,f,R,b,l,h),this.conjugate(R,b,l),this.normalize13b(R,l),y.negative=c.negative^u.negative,y.length=c.length+u.length,y.strip()},i.prototype.mul=function(c){var u=new i(null);return u.words=new Array(this.length+c.length),this.mulTo(c,u)},i.prototype.mulf=function(c){var u=new i(null);return u.words=new Array(this.length+c.length),B(this,c,u)},i.prototype.imul=function(c){return this.clone().mulTo(c,this)},i.prototype.imuln=function(c){r(typeof c=="number"),r(c<67108864);for(var u=0,y=0;y<this.length;y++){var l=(this.words[y]|0)*c,h=(l&67108863)+(u&67108863);u>>=26,u+=l/67108864|0,u+=h>>>26,this.words[y]=h&67108863}return u!==0&&(this.words[y]=u,this.length++),this},i.prototype.muln=function(c){return this.clone().imuln(c)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(c){var u=P(c);if(u.length===0)return new i(1);for(var y=this,l=0;l<u.length&&u[l]===0;l++,y=y.sqr());if(++l<u.length)for(var h=y.sqr();l<u.length;l++,h=h.sqr())u[l]!==0&&(y=y.mul(h));return y},i.prototype.iushln=function(c){r(typeof c=="number"&&c>=0);var u=c%26,y=(c-u)/26,l=67108863>>>26-u<<26-u,h;if(u!==0){var b=0;for(h=0;h<this.length;h++){var _=this.words[h]&l,g=(this.words[h]|0)-_<<u;this.words[h]=g|b,b=_>>>26-u}b&&(this.words[h]=b,this.length++)}if(y!==0){for(h=this.length-1;h>=0;h--)this.words[h+y]=this.words[h];for(h=0;h<y;h++)this.words[h]=0;this.length+=y}return this.strip()},i.prototype.ishln=function(c){return r(this.negative===0),this.iushln(c)},i.prototype.iushrn=function(c,u,y){r(typeof c=="number"&&c>=0);var l;u?l=(u-u%26)/26:l=0;var h=c%26,b=Math.min((c-h)/26,this.length),_=67108863^67108863>>>h<<h,g=y;if(l-=b,l=Math.max(0,l),g){for(var f=0;f<b;f++)g.words[f]=this.words[f];g.length=b}if(b!==0)if(this.length>b)for(this.length-=b,f=0;f<this.length;f++)this.words[f]=this.words[f+b];else this.words[0]=0,this.length=1;var v=0;for(f=this.length-1;f>=0&&(v!==0||f>=l);f--){var O=this.words[f]|0;this.words[f]=v<<26-h|O>>>h,v=O&_}return g&&v!==0&&(g.words[g.length++]=v),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},i.prototype.ishrn=function(c,u,y){return r(this.negative===0),this.iushrn(c,u,y)},i.prototype.shln=function(c){return this.clone().ishln(c)},i.prototype.ushln=function(c){return this.clone().iushln(c)},i.prototype.shrn=function(c){return this.clone().ishrn(c)},i.prototype.ushrn=function(c){return this.clone().iushrn(c)},i.prototype.testn=function(c){r(typeof c=="number"&&c>=0);var u=c%26,y=(c-u)/26,l=1<<u;if(this.length<=y)return!1;var h=this.words[y];return!!(h&l)},i.prototype.imaskn=function(c){r(typeof c=="number"&&c>=0);var u=c%26,y=(c-u)/26;if(r(this.negative===0,"imaskn works only with positive numbers"),this.length<=y)return this;if(u!==0&&y++,this.length=Math.min(y,this.length),u!==0){var l=67108863^67108863>>>u<<u;this.words[this.length-1]&=l}return this.strip()},i.prototype.maskn=function(c){return this.clone().imaskn(c)},i.prototype.iaddn=function(c){return r(typeof c=="number"),r(c<67108864),c<0?this.isubn(-c):this.negative!==0?this.length===1&&(this.words[0]|0)<c?(this.words[0]=c-(this.words[0]|0),this.negative=0,this):(this.negative=0,this.isubn(c),this.negative=1,this):this._iaddn(c)},i.prototype._iaddn=function(c){this.words[0]+=c;for(var u=0;u<this.length&&this.words[u]>=67108864;u++)this.words[u]-=67108864,u===this.length-1?this.words[u+1]=1:this.words[u+1]++;return this.length=Math.max(this.length,u+1),this},i.prototype.isubn=function(c){if(r(typeof c=="number"),r(c<67108864),c<0)return this.iaddn(-c);if(this.negative!==0)return this.negative=0,this.iaddn(c),this.negative=1,this;if(this.words[0]-=c,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var u=0;u<this.length&&this.words[u]<0;u++)this.words[u]+=67108864,this.words[u+1]-=1;return this.strip()},i.prototype.addn=function(c){return this.clone().iaddn(c)},i.prototype.subn=function(c){return this.clone().isubn(c)},i.prototype.iabs=function(){return this.negative=0,this},i.prototype.abs=function(){return this.clone().iabs()},i.prototype._ishlnsubmul=function(c,u,y){var l=c.length+y,h;this._expand(l);var b,_=0;for(h=0;h<c.length;h++){b=(this.words[h+y]|0)+_;var g=(c.words[h]|0)*u;b-=g&67108863,_=(b>>26)-(g/67108864|0),this.words[h+y]=b&67108863}for(;h<this.length-y;h++)b=(this.words[h+y]|0)+_,_=b>>26,this.words[h+y]=b&67108863;if(_===0)return this.strip();for(r(_===-1),_=0,h=0;h<this.length;h++)b=-(this.words[h]|0)+_,_=b>>26,this.words[h]=b&67108863;return this.negative=1,this.strip()},i.prototype._wordDiv=function(c,u){var y=this.length-c.length,l=this.clone(),h=c,b=h.words[h.length-1]|0,_=this._countBits(b);y=26-_,y!==0&&(h=h.ushln(y),l.iushln(y),b=h.words[h.length-1]|0);var g=l.length-h.length,f;if(u!=="mod"){f=new i(null),f.length=g+1,f.words=new Array(f.length);for(var v=0;v<f.length;v++)f.words[v]=0}var O=l.clone()._ishlnsubmul(h,1,g);O.negative===0&&(l=O,f&&(f.words[g]=1));for(var T=g-1;T>=0;T--){var R=(l.words[h.length+T]|0)*67108864+(l.words[h.length+T-1]|0);for(R=Math.min(R/b|0,67108863),l._ishlnsubmul(h,R,T);l.negative!==0;)R--,l.negative=0,l._ishlnsubmul(h,1,T),l.isZero()||(l.negative^=1);f&&(f.words[T]=R)}return f&&f.strip(),l.strip(),u!=="div"&&y!==0&&l.iushrn(y),{div:f||null,mod:l}},i.prototype.divmod=function(c,u,y){if(r(!c.isZero()),this.isZero())return{div:new i(0),mod:new i(0)};var l,h,b;return this.negative!==0&&c.negative===0?(b=this.neg().divmod(c,u),u!=="mod"&&(l=b.div.neg()),u!=="div"&&(h=b.mod.neg(),y&&h.negative!==0&&h.iadd(c)),{div:l,mod:h}):this.negative===0&&c.negative!==0?(b=this.divmod(c.neg(),u),u!=="mod"&&(l=b.div.neg()),{div:l,mod:b.mod}):this.negative&c.negative?(b=this.neg().divmod(c.neg(),u),u!=="div"&&(h=b.mod.neg(),y&&h.negative!==0&&h.isub(c)),{div:b.div,mod:h}):c.length>this.length||this.cmp(c)<0?{div:new i(0),mod:this}:c.length===1?u==="div"?{div:this.divn(c.words[0]),mod:null}:u==="mod"?{div:null,mod:new i(this.modn(c.words[0]))}:{div:this.divn(c.words[0]),mod:new i(this.modn(c.words[0]))}:this._wordDiv(c,u)},i.prototype.div=function(c){return this.divmod(c,"div",!1).div},i.prototype.mod=function(c){return this.divmod(c,"mod",!1).mod},i.prototype.umod=function(c){return this.divmod(c,"mod",!0).mod},i.prototype.divRound=function(c){var u=this.divmod(c);if(u.mod.isZero())return u.div;var y=u.div.negative!==0?u.mod.isub(c):u.mod,l=c.ushrn(1),h=c.andln(1),b=y.cmp(l);return b<0||h===1&&b===0?u.div:u.div.negative!==0?u.div.isubn(1):u.div.iaddn(1)},i.prototype.modn=function(c){r(c<=67108863);for(var u=(1<<26)%c,y=0,l=this.length-1;l>=0;l--)y=(u*y+(this.words[l]|0))%c;return y},i.prototype.idivn=function(c){r(c<=67108863);for(var u=0,y=this.length-1;y>=0;y--){var l=(this.words[y]|0)+u*67108864;this.words[y]=l/c|0,u=l%c}return this.strip()},i.prototype.divn=function(c){return this.clone().idivn(c)},i.prototype.egcd=function(c){r(c.negative===0),r(!c.isZero());var u=this,y=c.clone();u.negative!==0?u=u.umod(c):u=u.clone();for(var l=new i(1),h=new i(0),b=new i(0),_=new i(1),g=0;u.isEven()&&y.isEven();)u.iushrn(1),y.iushrn(1),++g;for(var f=y.clone(),v=u.clone();!u.isZero();){for(var O=0,T=1;!(u.words[0]&T)&&O<26;++O,T<<=1);if(O>0)for(u.iushrn(O);O-- >0;)(l.isOdd()||h.isOdd())&&(l.iadd(f),h.isub(v)),l.iushrn(1),h.iushrn(1);for(var R=0,z=1;!(y.words[0]&z)&&R<26;++R,z<<=1);if(R>0)for(y.iushrn(R);R-- >0;)(b.isOdd()||_.isOdd())&&(b.iadd(f),_.isub(v)),b.iushrn(1),_.iushrn(1);u.cmp(y)>=0?(u.isub(y),l.isub(b),h.isub(_)):(y.isub(u),b.isub(l),_.isub(h))}return{a:b,b:_,gcd:y.iushln(g)}},i.prototype._invmp=function(c){r(c.negative===0),r(!c.isZero());var u=this,y=c.clone();u.negative!==0?u=u.umod(c):u=u.clone();for(var l=new i(1),h=new i(0),b=y.clone();u.cmpn(1)>0&&y.cmpn(1)>0;){for(var _=0,g=1;!(u.words[0]&g)&&_<26;++_,g<<=1);if(_>0)for(u.iushrn(_);_-- >0;)l.isOdd()&&l.iadd(b),l.iushrn(1);for(var f=0,v=1;!(y.words[0]&v)&&f<26;++f,v<<=1);if(f>0)for(y.iushrn(f);f-- >0;)h.isOdd()&&h.iadd(b),h.iushrn(1);u.cmp(y)>=0?(u.isub(y),l.isub(h)):(y.isub(u),h.isub(l))}var O;return u.cmpn(1)===0?O=l:O=h,O.cmpn(0)<0&&O.iadd(c),O},i.prototype.gcd=function(c){if(this.isZero())return c.abs();if(c.isZero())return this.abs();var u=this.clone(),y=c.clone();u.negative=0,y.negative=0;for(var l=0;u.isEven()&&y.isEven();l++)u.iushrn(1),y.iushrn(1);do{for(;u.isEven();)u.iushrn(1);for(;y.isEven();)y.iushrn(1);var h=u.cmp(y);if(h<0){var b=u;u=y,y=b}else if(h===0||y.cmpn(1)===0)break;u.isub(y)}while(!0);return y.iushln(l)},i.prototype.invm=function(c){return this.egcd(c).a.umod(c)},i.prototype.isEven=function(){return(this.words[0]&1)===0},i.prototype.isOdd=function(){return(this.words[0]&1)===1},i.prototype.andln=function(c){return this.words[0]&c},i.prototype.bincn=function(c){r(typeof c=="number");var u=c%26,y=(c-u)/26,l=1<<u;if(this.length<=y)return this._expand(y+1),this.words[y]|=l,this;for(var h=l,b=y;h!==0&&b<this.length;b++){var _=this.words[b]|0;_+=h,h=_>>>26,_&=67108863,this.words[b]=_}return h!==0&&(this.words[b]=h,this.length++),this},i.prototype.isZero=function(){return this.length===1&&this.words[0]===0},i.prototype.cmpn=function(c){var u=c<0;if(this.negative!==0&&!u)return-1;if(this.negative===0&&u)return 1;this.strip();var y;if(this.length>1)y=1;else{u&&(c=-c),r(c<=67108863,"Number is too big");var l=this.words[0]|0;y=l===c?0:l<c?-1:1}return this.negative!==0?-y|0:y},i.prototype.cmp=function(c){if(this.negative!==0&&c.negative===0)return-1;if(this.negative===0&&c.negative!==0)return 1;var u=this.ucmp(c);return this.negative!==0?-u|0:u},i.prototype.ucmp=function(c){if(this.length>c.length)return 1;if(this.length<c.length)return-1;for(var u=0,y=this.length-1;y>=0;y--){var l=this.words[y]|0,h=c.words[y]|0;if(l!==h){l<h?u=-1:l>h&&(u=1);break}}return u},i.prototype.gtn=function(c){return this.cmpn(c)===1},i.prototype.gt=function(c){return this.cmp(c)===1},i.prototype.gten=function(c){return this.cmpn(c)>=0},i.prototype.gte=function(c){return this.cmp(c)>=0},i.prototype.ltn=function(c){return this.cmpn(c)===-1},i.prototype.lt=function(c){return this.cmp(c)===-1},i.prototype.lten=function(c){return this.cmpn(c)<=0},i.prototype.lte=function(c){return this.cmp(c)<=0},i.prototype.eqn=function(c){return this.cmpn(c)===0},i.prototype.eq=function(c){return this.cmp(c)===0},i.red=function(c){return new N(c)},i.prototype.toRed=function(c){return r(!this.red,"Already a number in reduction context"),r(this.negative===0,"red works only with positives"),c.convertTo(this)._forceRed(c)},i.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(c){return this.red=c,this},i.prototype.forceRed=function(c){return r(!this.red,"Already a number in reduction context"),this._forceRed(c)},i.prototype.redAdd=function(c){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,c)},i.prototype.redIAdd=function(c){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,c)},i.prototype.redSub=function(c){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,c)},i.prototype.redISub=function(c){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,c)},i.prototype.redShl=function(c){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,c)},i.prototype.redMul=function(c){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,c),this.red.mul(this,c)},i.prototype.redIMul=function(c){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,c),this.red.imul(this,c)},i.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(c){return r(this.red&&!c.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,c)};var C={k256:null,p224:null,p192:null,p25519:null};function k(x,c){this.name=x,this.p=new i(c,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}k.prototype._tmp=function(){var c=new i(null);return c.words=new Array(Math.ceil(this.n/13)),c},k.prototype.ireduce=function(c){var u=c,y;do this.split(u,this.tmp),u=this.imulK(u),u=u.iadd(this.tmp),y=u.bitLength();while(y>this.n);var l=y<this.n?-1:u.ucmp(this.p);return l===0?(u.words[0]=0,u.length=1):l>0?u.isub(this.p):u.strip!==void 0?u.strip():u._strip(),u},k.prototype.split=function(c,u){c.iushrn(this.n,0,u)},k.prototype.imulK=function(c){return c.imul(this.k)};function q(){k.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}n(q,k),q.prototype.split=function(c,u){for(var y=4194303,l=Math.min(c.length,9),h=0;h<l;h++)u.words[h]=c.words[h];if(u.length=l,c.length<=9){c.words[0]=0,c.length=1;return}var b=c.words[9];for(u.words[u.length++]=b&y,h=10;h<c.length;h++){var _=c.words[h]|0;c.words[h-10]=(_&y)<<4|b>>>22,b=_}b>>>=22,c.words[h-10]=b,b===0&&c.length>10?c.length-=10:c.length-=9},q.prototype.imulK=function(c){c.words[c.length]=0,c.words[c.length+1]=0,c.length+=2;for(var u=0,y=0;y<c.length;y++){var l=c.words[y]|0;u+=l*977,c.words[y]=u&67108863,u=l*64+(u/67108864|0)}return c.words[c.length-1]===0&&(c.length--,c.words[c.length-1]===0&&c.length--),c};function L(){k.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}n(L,k);function U(){k.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}n(U,k);function F(){k.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}n(F,k),F.prototype.imulK=function(c){for(var u=0,y=0;y<c.length;y++){var l=(c.words[y]|0)*19+u,h=l&67108863;l>>>=26,c.words[y]=h,u=l}return u!==0&&(c.words[c.length++]=u),c},i._prime=function(c){if(C[c])return C[c];var u;if(c==="k256")u=new q;else if(c==="p224")u=new L;else if(c==="p192")u=new U;else if(c==="p25519")u=new F;else throw new Error("Unknown prime "+c);return C[c]=u,u};function N(x){if(typeof x=="string"){var c=i._prime(x);this.m=c.p,this.prime=c}else r(x.gtn(1),"modulus must be greater than 1"),this.m=x,this.prime=null}N.prototype._verify1=function(c){r(c.negative===0,"red works only with positives"),r(c.red,"red works only with red numbers")},N.prototype._verify2=function(c,u){r((c.negative|u.negative)===0,"red works only with positives"),r(c.red&&c.red===u.red,"red works only with red numbers")},N.prototype.imod=function(c){return this.prime?this.prime.ireduce(c)._forceRed(this):c.umod(this.m)._forceRed(this)},N.prototype.neg=function(c){return c.isZero()?c.clone():this.m.sub(c)._forceRed(this)},N.prototype.add=function(c,u){this._verify2(c,u);var y=c.add(u);return y.cmp(this.m)>=0&&y.isub(this.m),y._forceRed(this)},N.prototype.iadd=function(c,u){this._verify2(c,u);var y=c.iadd(u);return y.cmp(this.m)>=0&&y.isub(this.m),y},N.prototype.sub=function(c,u){this._verify2(c,u);var y=c.sub(u);return y.cmpn(0)<0&&y.iadd(this.m),y._forceRed(this)},N.prototype.isub=function(c,u){this._verify2(c,u);var y=c.isub(u);return y.cmpn(0)<0&&y.iadd(this.m),y},N.prototype.shl=function(c,u){return this._verify1(c),this.imod(c.ushln(u))},N.prototype.imul=function(c,u){return this._verify2(c,u),this.imod(c.imul(u))},N.prototype.mul=function(c,u){return this._verify2(c,u),this.imod(c.mul(u))},N.prototype.isqr=function(c){return this.imul(c,c.clone())},N.prototype.sqr=function(c){return this.mul(c,c)},N.prototype.sqrt=function(c){if(c.isZero())return c.clone();var u=this.m.andln(3);if(r(u%2===1),u===3){var y=this.m.add(new i(1)).iushrn(2);return this.pow(c,y)}for(var l=this.m.subn(1),h=0;!l.isZero()&&l.andln(1)===0;)h++,l.iushrn(1);r(!l.isZero());var b=new i(1).toRed(this),_=b.redNeg(),g=this.m.subn(1).iushrn(1),f=this.m.bitLength();for(f=new i(2*f*f).toRed(this);this.pow(f,g).cmp(_)!==0;)f.redIAdd(_);for(var v=this.pow(f,l),O=this.pow(c,l.addn(1).iushrn(1)),T=this.pow(c,l),R=h;T.cmp(b)!==0;){for(var z=T,V=0;z.cmp(b)!==0;V++)z=z.redSqr();r(V<R);var W=this.pow(v,new i(1).iushln(R-V-1));O=O.redMul(W),v=W.redSqr(),T=T.redMul(v),R=V}return O},N.prototype.invm=function(c){var u=c._invmp(this.m);return u.negative!==0?(u.negative=0,this.imod(u).redNeg()):this.imod(u)},N.prototype.pow=function(c,u){if(u.isZero())return new i(1).toRed(this);if(u.cmpn(1)===0)return c.clone();var y=4,l=new Array(1<<y);l[0]=new i(1).toRed(this),l[1]=c;for(var h=2;h<l.length;h++)l[h]=this.mul(l[h-1],c);var b=l[0],_=0,g=0,f=u.bitLength()%26;for(f===0&&(f=26),h=u.length-1;h>=0;h--){for(var v=u.words[h],O=f-1;O>=0;O--){var T=v>>O&1;if(b!==l[0]&&(b=this.sqr(b)),T===0&&_===0){g=0;continue}_<<=1,_|=T,g++,!(g!==y&&(h!==0||O!==0))&&(b=this.mul(b,l[_]),g=0,_=0)}f=26}return b},N.prototype.convertTo=function(c){var u=c.umod(this.m);return u===c?u.clone():u},N.prototype.convertFrom=function(c){var u=c.clone();return u.red=null,u},i.mont=function(c){return new G(c)};function G(x){N.call(this,x),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new i(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}n(G,N),G.prototype.convertTo=function(c){return this.imod(c.ushln(this.shift))},G.prototype.convertFrom=function(c){var u=this.imod(c.mul(this.rinv));return u.red=null,u},G.prototype.imul=function(c,u){if(c.isZero()||u.isZero())return c.words[0]=0,c.length=1,c;var y=c.imul(u),l=y.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),h=y.isub(l).iushrn(this.shift),b=h;return h.cmp(this.m)>=0?b=h.isub(this.m):h.cmpn(0)<0&&(b=h.iadd(this.m)),b._forceRed(this)},G.prototype.mul=function(c,u){if(c.isZero()||u.isZero())return new i(0)._forceRed(this);var y=c.mul(u),l=y.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),h=y.isub(l).iushrn(this.shift),b=h;return h.cmp(this.m)>=0?b=h.isub(this.m):h.cmpn(0)<0&&(b=h.iadd(this.m)),b._forceRed(this)},G.prototype.invm=function(c){var u=this.imod(c._invmp(this.m).mul(this.r2));return u._forceRed(this)}})(typeof Z7>"u"||Z7,gre)});var wre=H((cvt,bre)=>{E();var Ake=BM(),Tke=vre();bre.exports=function(e){return new Gm(e)};var Xa={secp256k1:{name:"secp256k1",byteLength:32},secp224r1:{name:"p224",byteLength:28},prime256v1:{name:"p256",byteLength:32},prime192v1:{name:"p192",byteLength:24},ed25519:{name:"ed25519",byteLength:32},secp384r1:{name:"p384",byteLength:48},secp521r1:{name:"p521",byteLength:66}};Xa.p224=Xa.secp224r1;Xa.p256=Xa.secp256r1=Xa.prime256v1;Xa.p192=Xa.secp192r1=Xa.prime192v1;Xa.p384=Xa.secp384r1;Xa.p521=Xa.secp521r1;function Gm(t){this.curveType=Xa[t],this.curveType||(this.curveType={name:t}),this.curve=new Ake.ec(this.curveType.name),this.keys=void 0}Gm.prototype.generateKeys=function(t,e){return this.keys=this.curve.genKeyPair(),this.getPublicKey(t,e)};Gm.prototype.computeSecret=function(t,e,r){e=e||"utf8",$.Buffer.isBuffer(t)||(t=new $.Buffer(t,e));var n=this.curve.keyFromPublic(t).getPublic(),i=n.mul(this.keys.getPrivate()).getX();return J7(i,r,this.curveType.byteLength)};Gm.prototype.getPublicKey=function(t,e){var r=this.keys.getPublic(e==="compressed",!0);return e==="hybrid"&&(r[r.length-1]%2?r[0]=7:r[0]=6),J7(r,t)};Gm.prototype.getPrivateKey=function(t){return J7(this.keys.getPrivate(),t)};Gm.prototype.setPublicKey=function(t,e){return e=e||"utf8",$.Buffer.isBuffer(t)||(t=new $.Buffer(t,e)),this.keys._importPublic(t),this};Gm.prototype.setPrivateKey=function(t,e){e=e||"utf8",$.Buffer.isBuffer(t)||(t=new $.Buffer(t,e));var r=new Tke(t);return r=r.toString(16),this.keys=this.curve.genKeyPair(),this.keys._importPrivate(r),this};function J7(t,e,r){Array.isArray(t)||(t=t.toArray());var n=new $.Buffer(t);if(r&&n.length<r){var i=new $.Buffer(r-n.length);i.fill(0),n=$.Buffer.concat([i,n])}return e?n.toString(e):n}});var Q7=H((uvt,_re)=>{E();var Rke=Ov(),Y7=Fr().Buffer;_re.exports=function(t,e){for(var r=Y7.alloc(0),n=0,i;r.length<e;)i=Ike(n++),r=Y7.concat([r,Rke("sha1").update(t).update(i).digest()]);return r.slice(0,e)};function Ike(t){var e=Y7.allocUnsafe(4);return e.writeUInt32BE(t,0),e}});var X7=H((dvt,xre)=>{E();xre.exports=function(e,r){for(var n=e.length,i=-1;++i<n;)e[i]^=r[i];return e}});var WM=H((Ere,eO)=>{E();(function(t,e){"use strict";function r(x,c){if(!x)throw new Error(c||"Assertion failed")}function n(x,c){x.super_=c;var u=function(){};u.prototype=c.prototype,x.prototype=new u,x.prototype.constructor=x}function i(x,c,u){if(i.isBN(x))return x;this.negative=0,this.words=null,this.length=0,this.red=null,x!==null&&((c==="le"||c==="be")&&(u=c,c=10),this._init(x||0,c||10,u||"be"))}typeof t=="object"?t.exports=i:e.BN=i,i.BN=i,i.wordSize=26;var o;try{typeof window<"u"&&typeof window.Buffer<"u"?o=window.Buffer:o=sr().Buffer}catch{}i.isBN=function(c){return c instanceof i?!0:c!==null&&typeof c=="object"&&c.constructor.wordSize===i.wordSize&&Array.isArray(c.words)},i.max=function(c,u){return c.cmp(u)>0?c:u},i.min=function(c,u){return c.cmp(u)<0?c:u},i.prototype._init=function(c,u,y){if(typeof c=="number")return this._initNumber(c,u,y);if(typeof c=="object")return this._initArray(c,u,y);u==="hex"&&(u=16),r(u===(u|0)&&u>=2&&u<=36),c=c.toString().replace(/\s+/g,"");var l=0;c[0]==="-"&&(l++,this.negative=1),l<c.length&&(u===16?this._parseHex(c,l,y):(this._parseBase(c,u,l),y==="le"&&this._initArray(this.toArray(),u,y)))},i.prototype._initNumber=function(c,u,y){c<0&&(this.negative=1,c=-c),c<67108864?(this.words=[c&67108863],this.length=1):c<4503599627370496?(this.words=[c&67108863,c/67108864&67108863],this.length=2):(r(c<9007199254740992),this.words=[c&67108863,c/67108864&67108863,1],this.length=3),y==="le"&&this._initArray(this.toArray(),u,y)},i.prototype._initArray=function(c,u,y){if(r(typeof c.length=="number"),c.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(c.length/3),this.words=new Array(this.length);for(var l=0;l<this.length;l++)this.words[l]=0;var h,b,_=0;if(y==="be")for(l=c.length-1,h=0;l>=0;l-=3)b=c[l]|c[l-1]<<8|c[l-2]<<16,this.words[h]|=b<<_&67108863,this.words[h+1]=b>>>26-_&67108863,_+=24,_>=26&&(_-=26,h++);else if(y==="le")for(l=0,h=0;l<c.length;l+=3)b=c[l]|c[l+1]<<8|c[l+2]<<16,this.words[h]|=b<<_&67108863,this.words[h+1]=b>>>26-_&67108863,_+=24,_>=26&&(_-=26,h++);return this.strip()};function s(x,c){var u=x.charCodeAt(c);return u>=65&&u<=70?u-55:u>=97&&u<=102?u-87:u-48&15}function a(x,c,u){var y=s(x,u);return u-1>=c&&(y|=s(x,u-1)<<4),y}i.prototype._parseHex=function(c,u,y){this.length=Math.ceil((c.length-u)/6),this.words=new Array(this.length);for(var l=0;l<this.length;l++)this.words[l]=0;var h=0,b=0,_;if(y==="be")for(l=c.length-1;l>=u;l-=2)_=a(c,u,l)<<h,this.words[b]|=_&67108863,h>=18?(h-=18,b+=1,this.words[b]|=_>>>26):h+=8;else{var g=c.length-u;for(l=g%2===0?u+1:u;l<c.length;l+=2)_=a(c,u,l)<<h,this.words[b]|=_&67108863,h>=18?(h-=18,b+=1,this.words[b]|=_>>>26):h+=8}this.strip()};function d(x,c,u,y){for(var l=0,h=Math.min(x.length,u),b=c;b<h;b++){var _=x.charCodeAt(b)-48;l*=y,_>=49?l+=_-49+10:_>=17?l+=_-17+10:l+=_}return l}i.prototype._parseBase=function(c,u,y){this.words=[0],this.length=1;for(var l=0,h=1;h<=67108863;h*=u)l++;l--,h=h/u|0;for(var b=c.length-y,_=b%l,g=Math.min(b,b-_)+y,f=0,v=y;v<g;v+=l)f=d(c,v,v+l,u),this.imuln(h),this.words[0]+f<67108864?this.words[0]+=f:this._iaddn(f);if(_!==0){var O=1;for(f=d(c,v,c.length,u),v=0;v<_;v++)O*=u;this.imuln(O),this.words[0]+f<67108864?this.words[0]+=f:this._iaddn(f)}this.strip()},i.prototype.copy=function(c){c.words=new Array(this.length);for(var u=0;u<this.length;u++)c.words[u]=this.words[u];c.length=this.length,c.negative=this.negative,c.red=this.red},i.prototype.clone=function(){var c=new i(null);return this.copy(c),c},i.prototype._expand=function(c){for(;this.length<c;)this.words[this.length++]=0;return this},i.prototype.strip=function(){for(;this.length>1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},i.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},i.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var m=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],p=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],w=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];i.prototype.toString=function(c,u){c=c||10,u=u|0||1;var y;if(c===16||c==="hex"){y="";for(var l=0,h=0,b=0;b<this.length;b++){var _=this.words[b],g=((_<<l|h)&16777215).toString(16);h=_>>>24-l&16777215,h!==0||b!==this.length-1?y=m[6-g.length]+g+y:y=g+y,l+=2,l>=26&&(l-=26,b--)}for(h!==0&&(y=h.toString(16)+y);y.length%u!==0;)y="0"+y;return this.negative!==0&&(y="-"+y),y}if(c===(c|0)&&c>=2&&c<=36){var f=p[c],v=w[c];y="";var O=this.clone();for(O.negative=0;!O.isZero();){var T=O.modn(v).toString(c);O=O.idivn(v),O.isZero()?y=T+y:y=m[f-T.length]+T+y}for(this.isZero()&&(y="0"+y);y.length%u!==0;)y="0"+y;return this.negative!==0&&(y="-"+y),y}r(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var c=this.words[0];return this.length===2?c+=this.words[1]*67108864:this.length===3&&this.words[2]===1?c+=4503599627370496+this.words[1]*67108864:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-c:c},i.prototype.toJSON=function(){return this.toString(16)},i.prototype.toBuffer=function(c,u){return r(typeof o<"u"),this.toArrayLike(o,c,u)},i.prototype.toArray=function(c,u){return this.toArrayLike(Array,c,u)},i.prototype.toArrayLike=function(c,u,y){var l=this.byteLength(),h=y||Math.max(1,l);r(l<=h,"byte array longer than desired length"),r(h>0,"Requested array length <= 0"),this.strip();var b=u==="le",_=new c(h),g,f,v=this.clone();if(b){for(f=0;!v.isZero();f++)g=v.andln(255),v.iushrn(8),_[f]=g;for(;f<h;f++)_[f]=0}else{for(f=0;f<h-l;f++)_[f]=0;for(f=0;!v.isZero();f++)g=v.andln(255),v.iushrn(8),_[h-f-1]=g}return _},Math.clz32?i.prototype._countBits=function(c){return 32-Math.clz32(c)}:i.prototype._countBits=function(c){var u=c,y=0;return u>=4096&&(y+=13,u>>>=13),u>=64&&(y+=7,u>>>=7),u>=8&&(y+=4,u>>>=4),u>=2&&(y+=2,u>>>=2),y+u},i.prototype._zeroBits=function(c){if(c===0)return 26;var u=c,y=0;return u&8191||(y+=13,u>>>=13),u&127||(y+=7,u>>>=7),u&15||(y+=4,u>>>=4),u&3||(y+=2,u>>>=2),u&1||y++,y},i.prototype.bitLength=function(){var c=this.words[this.length-1],u=this._countBits(c);return(this.length-1)*26+u};function P(x){for(var c=new Array(x.bitLength()),u=0;u<c.length;u++){var y=u/26|0,l=u%26;c[u]=(x.words[y]&1<<l)>>>l}return c}i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var c=0,u=0;u<this.length;u++){var y=this._zeroBits(this.words[u]);if(c+=y,y!==26)break}return c},i.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},i.prototype.toTwos=function(c){return this.negative!==0?this.abs().inotn(c).iaddn(1):this.clone()},i.prototype.fromTwos=function(c){return this.testn(c-1)?this.notn(c).iaddn(1).ineg():this.clone()},i.prototype.isNeg=function(){return this.negative!==0},i.prototype.neg=function(){return this.clone().ineg()},i.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},i.prototype.iuor=function(c){for(;this.length<c.length;)this.words[this.length++]=0;for(var u=0;u<c.length;u++)this.words[u]=this.words[u]|c.words[u];return this.strip()},i.prototype.ior=function(c){return r((this.negative|c.negative)===0),this.iuor(c)},i.prototype.or=function(c){return this.length>c.length?this.clone().ior(c):c.clone().ior(this)},i.prototype.uor=function(c){return this.length>c.length?this.clone().iuor(c):c.clone().iuor(this)},i.prototype.iuand=function(c){var u;this.length>c.length?u=c:u=this;for(var y=0;y<u.length;y++)this.words[y]=this.words[y]&c.words[y];return this.length=u.length,this.strip()},i.prototype.iand=function(c){return r((this.negative|c.negative)===0),this.iuand(c)},i.prototype.and=function(c){return this.length>c.length?this.clone().iand(c):c.clone().iand(this)},i.prototype.uand=function(c){return this.length>c.length?this.clone().iuand(c):c.clone().iuand(this)},i.prototype.iuxor=function(c){var u,y;this.length>c.length?(u=this,y=c):(u=c,y=this);for(var l=0;l<y.length;l++)this.words[l]=u.words[l]^y.words[l];if(this!==u)for(;l<u.length;l++)this.words[l]=u.words[l];return this.length=u.length,this.strip()},i.prototype.ixor=function(c){return r((this.negative|c.negative)===0),this.iuxor(c)},i.prototype.xor=function(c){return this.length>c.length?this.clone().ixor(c):c.clone().ixor(this)},i.prototype.uxor=function(c){return this.length>c.length?this.clone().iuxor(c):c.clone().iuxor(this)},i.prototype.inotn=function(c){r(typeof c=="number"&&c>=0);var u=Math.ceil(c/26)|0,y=c%26;this._expand(u),y>0&&u--;for(var l=0;l<u;l++)this.words[l]=~this.words[l]&67108863;return y>0&&(this.words[l]=~this.words[l]&67108863>>26-y),this.strip()},i.prototype.notn=function(c){return this.clone().inotn(c)},i.prototype.setn=function(c,u){r(typeof c=="number"&&c>=0);var y=c/26|0,l=c%26;return this._expand(y+1),u?this.words[y]=this.words[y]|1<<l:this.words[y]=this.words[y]&~(1<<l),this.strip()},i.prototype.iadd=function(c){var u;if(this.negative!==0&&c.negative===0)return this.negative=0,u=this.isub(c),this.negative^=1,this._normSign();if(this.negative===0&&c.negative!==0)return c.negative=0,u=this.isub(c),c.negative=1,u._normSign();var y,l;this.length>c.length?(y=this,l=c):(y=c,l=this);for(var h=0,b=0;b<l.length;b++)u=(y.words[b]|0)+(l.words[b]|0)+h,this.words[b]=u&67108863,h=u>>>26;for(;h!==0&&b<y.length;b++)u=(y.words[b]|0)+h,this.words[b]=u&67108863,h=u>>>26;if(this.length=y.length,h!==0)this.words[this.length]=h,this.length++;else if(y!==this)for(;b<y.length;b++)this.words[b]=y.words[b];return this},i.prototype.add=function(c){var u;return c.negative!==0&&this.negative===0?(c.negative=0,u=this.sub(c),c.negative^=1,u):c.negative===0&&this.negative!==0?(this.negative=0,u=c.sub(this),this.negative=1,u):this.length>c.length?this.clone().iadd(c):c.clone().iadd(this)},i.prototype.isub=function(c){if(c.negative!==0){c.negative=0;var u=this.iadd(c);return c.negative=1,u._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(c),this.negative=1,this._normSign();var y=this.cmp(c);if(y===0)return this.negative=0,this.length=1,this.words[0]=0,this;var l,h;y>0?(l=this,h=c):(l=c,h=this);for(var b=0,_=0;_<h.length;_++)u=(l.words[_]|0)-(h.words[_]|0)+b,b=u>>26,this.words[_]=u&67108863;for(;b!==0&&_<l.length;_++)u=(l.words[_]|0)+b,b=u>>26,this.words[_]=u&67108863;if(b===0&&_<l.length&&l!==this)for(;_<l.length;_++)this.words[_]=l.words[_];return this.length=Math.max(this.length,_),l!==this&&(this.negative=1),this.strip()},i.prototype.sub=function(c){return this.clone().isub(c)};function S(x,c,u){u.negative=c.negative^x.negative;var y=x.length+c.length|0;u.length=y,y=y-1|0;var l=x.words[0]|0,h=c.words[0]|0,b=l*h,_=b&67108863,g=b/67108864|0;u.words[0]=_;for(var f=1;f<y;f++){for(var v=g>>>26,O=g&67108863,T=Math.min(f,c.length-1),R=Math.max(0,f-x.length+1);R<=T;R++){var z=f-R|0;l=x.words[z]|0,h=c.words[R]|0,b=l*h+O,v+=b/67108864|0,O=b&67108863}u.words[f]=O|0,g=v|0}return g!==0?u.words[f]=g|0:u.length--,u.strip()}var M=function(c,u,y){var l=c.words,h=u.words,b=y.words,_=0,g,f,v,O=l[0]|0,T=O&8191,R=O>>>13,z=l[1]|0,V=z&8191,W=z>>>13,Z=l[2]|0,J=Z&8191,X=Z>>>13,Ee=l[3]|0,re=Ee&8191,ne=Ee>>>13,qe=l[4]|0,ce=qe&8191,ye=qe>>>13,Ne=l[5]|0,ie=Ne&8191,oe=Ne>>>13,ze=l[6]|0,le=ze&8191,me=ze>>>13,ot=l[7]|0,ue=ot&8191,he=ot>>>13,lt=l[8]|0,se=lt&8191,fe=lt>>>13,Lt=l[9]|0,ge=Lt&8191,ve=Lt>>>13,on=h[0]|0,xe=on&8191,Pe=on>>>13,jr=h[1]|0,Se=jr&8191,_e=jr>>>13,Mn=h[2]|0,Me=Mn&8191,Te=Mn>>>13,vi=h[3]|0,Ae=vi&8191,Be=vi>>>13,Pn=h[4]|0,De=Pn&8191,Ie=Pn>>>13,bi=h[5]|0,Re=bi&8191,ke=bi>>>13,wi=h[6]|0,Oe=wi&8191,Ce=wi>>>13,oi=h[7]|0,Q=oi&8191,Y=oi>>>13,ae=h[8]|0,ee=ae&8191,te=ae>>>13,Ke=h[9]|0,de=Ke&8191,pe=Ke>>>13;y.negative=c.negative^u.negative,y.length=19,g=Math.imul(T,xe),f=Math.imul(T,Pe),f=f+Math.imul(R,xe)|0,v=Math.imul(R,Pe);var bt=(_+g|0)+((f&8191)<<13)|0;_=(v+(f>>>13)|0)+(bt>>>26)|0,bt&=67108863,g=Math.imul(V,xe),f=Math.imul(V,Pe),f=f+Math.imul(W,xe)|0,v=Math.imul(W,Pe),g=g+Math.imul(T,Se)|0,f=f+Math.imul(T,_e)|0,f=f+Math.imul(R,Se)|0,v=v+Math.imul(R,_e)|0;var st=(_+g|0)+((f&8191)<<13)|0;_=(v+(f>>>13)|0)+(st>>>26)|0,st&=67108863,g=Math.imul(J,xe),f=Math.imul(J,Pe),f=f+Math.imul(X,xe)|0,v=Math.imul(X,Pe),g=g+Math.imul(V,Se)|0,f=f+Math.imul(V,_e)|0,f=f+Math.imul(W,Se)|0,v=v+Math.imul(W,_e)|0,g=g+Math.imul(T,Me)|0,f=f+Math.imul(T,Te)|0,f=f+Math.imul(R,Me)|0,v=v+Math.imul(R,Te)|0;var Ve=(_+g|0)+((f&8191)<<13)|0;_=(v+(f>>>13)|0)+(Ve>>>26)|0,Ve&=67108863,g=Math.imul(re,xe),f=Math.imul(re,Pe),f=f+Math.imul(ne,xe)|0,v=Math.imul(ne,Pe),g=g+Math.imul(J,Se)|0,f=f+Math.imul(J,_e)|0,f=f+Math.imul(X,Se)|0,v=v+Math.imul(X,_e)|0,g=g+Math.imul(V,Me)|0,f=f+Math.imul(V,Te)|0,f=f+Math.imul(W,Me)|0,v=v+Math.imul(W,Te)|0,g=g+Math.imul(T,Ae)|0,f=f+Math.imul(T,Be)|0,f=f+Math.imul(R,Ae)|0,v=v+Math.imul(R,Be)|0;var Tt=(_+g|0)+((f&8191)<<13)|0;_=(v+(f>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,g=Math.imul(ce,xe),f=Math.imul(ce,Pe),f=f+Math.imul(ye,xe)|0,v=Math.imul(ye,Pe),g=g+Math.imul(re,Se)|0,f=f+Math.imul(re,_e)|0,f=f+Math.imul(ne,Se)|0,v=v+Math.imul(ne,_e)|0,g=g+Math.imul(J,Me)|0,f=f+Math.imul(J,Te)|0,f=f+Math.imul(X,Me)|0,v=v+Math.imul(X,Te)|0,g=g+Math.imul(V,Ae)|0,f=f+Math.imul(V,Be)|0,f=f+Math.imul(W,Ae)|0,v=v+Math.imul(W,Be)|0,g=g+Math.imul(T,De)|0,f=f+Math.imul(T,Ie)|0,f=f+Math.imul(R,De)|0,v=v+Math.imul(R,Ie)|0;var Ut=(_+g|0)+((f&8191)<<13)|0;_=(v+(f>>>13)|0)+(Ut>>>26)|0,Ut&=67108863,g=Math.imul(ie,xe),f=Math.imul(ie,Pe),f=f+Math.imul(oe,xe)|0,v=Math.imul(oe,Pe),g=g+Math.imul(ce,Se)|0,f=f+Math.imul(ce,_e)|0,f=f+Math.imul(ye,Se)|0,v=v+Math.imul(ye,_e)|0,g=g+Math.imul(re,Me)|0,f=f+Math.imul(re,Te)|0,f=f+Math.imul(ne,Me)|0,v=v+Math.imul(ne,Te)|0,g=g+Math.imul(J,Ae)|0,f=f+Math.imul(J,Be)|0,f=f+Math.imul(X,Ae)|0,v=v+Math.imul(X,Be)|0,g=g+Math.imul(V,De)|0,f=f+Math.imul(V,Ie)|0,f=f+Math.imul(W,De)|0,v=v+Math.imul(W,Ie)|0,g=g+Math.imul(T,Re)|0,f=f+Math.imul(T,ke)|0,f=f+Math.imul(R,Re)|0,v=v+Math.imul(R,ke)|0;var Pt=(_+g|0)+((f&8191)<<13)|0;_=(v+(f>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,g=Math.imul(le,xe),f=Math.imul(le,Pe),f=f+Math.imul(me,xe)|0,v=Math.imul(me,Pe),g=g+Math.imul(ie,Se)|0,f=f+Math.imul(ie,_e)|0,f=f+Math.imul(oe,Se)|0,v=v+Math.imul(oe,_e)|0,g=g+Math.imul(ce,Me)|0,f=f+Math.imul(ce,Te)|0,f=f+Math.imul(ye,Me)|0,v=v+Math.imul(ye,Te)|0,g=g+Math.imul(re,Ae)|0,f=f+Math.imul(re,Be)|0,f=f+Math.imul(ne,Ae)|0,v=v+Math.imul(ne,Be)|0,g=g+Math.imul(J,De)|0,f=f+Math.imul(J,Ie)|0,f=f+Math.imul(X,De)|0,v=v+Math.imul(X,Ie)|0,g=g+Math.imul(V,Re)|0,f=f+Math.imul(V,ke)|0,f=f+Math.imul(W,Re)|0,v=v+Math.imul(W,ke)|0,g=g+Math.imul(T,Oe)|0,f=f+Math.imul(T,Ce)|0,f=f+Math.imul(R,Oe)|0,v=v+Math.imul(R,Ce)|0;var yt=(_+g|0)+((f&8191)<<13)|0;_=(v+(f>>>13)|0)+(yt>>>26)|0,yt&=67108863,g=Math.imul(ue,xe),f=Math.imul(ue,Pe),f=f+Math.imul(he,xe)|0,v=Math.imul(he,Pe),g=g+Math.imul(le,Se)|0,f=f+Math.imul(le,_e)|0,f=f+Math.imul(me,Se)|0,v=v+Math.imul(me,_e)|0,g=g+Math.imul(ie,Me)|0,f=f+Math.imul(ie,Te)|0,f=f+Math.imul(oe,Me)|0,v=v+Math.imul(oe,Te)|0,g=g+Math.imul(ce,Ae)|0,f=f+Math.imul(ce,Be)|0,f=f+Math.imul(ye,Ae)|0,v=v+Math.imul(ye,Be)|0,g=g+Math.imul(re,De)|0,f=f+Math.imul(re,Ie)|0,f=f+Math.imul(ne,De)|0,v=v+Math.imul(ne,Ie)|0,g=g+Math.imul(J,Re)|0,f=f+Math.imul(J,ke)|0,f=f+Math.imul(X,Re)|0,v=v+Math.imul(X,ke)|0,g=g+Math.imul(V,Oe)|0,f=f+Math.imul(V,Ce)|0,f=f+Math.imul(W,Oe)|0,v=v+Math.imul(W,Ce)|0,g=g+Math.imul(T,Q)|0,f=f+Math.imul(T,Y)|0,f=f+Math.imul(R,Q)|0,v=v+Math.imul(R,Y)|0;var Rt=(_+g|0)+((f&8191)<<13)|0;_=(v+(f>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,g=Math.imul(se,xe),f=Math.imul(se,Pe),f=f+Math.imul(fe,xe)|0,v=Math.imul(fe,Pe),g=g+Math.imul(ue,Se)|0,f=f+Math.imul(ue,_e)|0,f=f+Math.imul(he,Se)|0,v=v+Math.imul(he,_e)|0,g=g+Math.imul(le,Me)|0,f=f+Math.imul(le,Te)|0,f=f+Math.imul(me,Me)|0,v=v+Math.imul(me,Te)|0,g=g+Math.imul(ie,Ae)|0,f=f+Math.imul(ie,Be)|0,f=f+Math.imul(oe,Ae)|0,v=v+Math.imul(oe,Be)|0,g=g+Math.imul(ce,De)|0,f=f+Math.imul(ce,Ie)|0,f=f+Math.imul(ye,De)|0,v=v+Math.imul(ye,Ie)|0,g=g+Math.imul(re,Re)|0,f=f+Math.imul(re,ke)|0,f=f+Math.imul(ne,Re)|0,v=v+Math.imul(ne,ke)|0,g=g+Math.imul(J,Oe)|0,f=f+Math.imul(J,Ce)|0,f=f+Math.imul(X,Oe)|0,v=v+Math.imul(X,Ce)|0,g=g+Math.imul(V,Q)|0,f=f+Math.imul(V,Y)|0,f=f+Math.imul(W,Q)|0,v=v+Math.imul(W,Y)|0,g=g+Math.imul(T,ee)|0,f=f+Math.imul(T,te)|0,f=f+Math.imul(R,ee)|0,v=v+Math.imul(R,te)|0;var _t=(_+g|0)+((f&8191)<<13)|0;_=(v+(f>>>13)|0)+(_t>>>26)|0,_t&=67108863,g=Math.imul(ge,xe),f=Math.imul(ge,Pe),f=f+Math.imul(ve,xe)|0,v=Math.imul(ve,Pe),g=g+Math.imul(se,Se)|0,f=f+Math.imul(se,_e)|0,f=f+Math.imul(fe,Se)|0,v=v+Math.imul(fe,_e)|0,g=g+Math.imul(ue,Me)|0,f=f+Math.imul(ue,Te)|0,f=f+Math.imul(he,Me)|0,v=v+Math.imul(he,Te)|0,g=g+Math.imul(le,Ae)|0,f=f+Math.imul(le,Be)|0,f=f+Math.imul(me,Ae)|0,v=v+Math.imul(me,Be)|0,g=g+Math.imul(ie,De)|0,f=f+Math.imul(ie,Ie)|0,f=f+Math.imul(oe,De)|0,v=v+Math.imul(oe,Ie)|0,g=g+Math.imul(ce,Re)|0,f=f+Math.imul(ce,ke)|0,f=f+Math.imul(ye,Re)|0,v=v+Math.imul(ye,ke)|0,g=g+Math.imul(re,Oe)|0,f=f+Math.imul(re,Ce)|0,f=f+Math.imul(ne,Oe)|0,v=v+Math.imul(ne,Ce)|0,g=g+Math.imul(J,Q)|0,f=f+Math.imul(J,Y)|0,f=f+Math.imul(X,Q)|0,v=v+Math.imul(X,Y)|0,g=g+Math.imul(V,ee)|0,f=f+Math.imul(V,te)|0,f=f+Math.imul(W,ee)|0,v=v+Math.imul(W,te)|0,g=g+Math.imul(T,de)|0,f=f+Math.imul(T,pe)|0,f=f+Math.imul(R,de)|0,v=v+Math.imul(R,pe)|0;var Lr=(_+g|0)+((f&8191)<<13)|0;_=(v+(f>>>13)|0)+(Lr>>>26)|0,Lr&=67108863,g=Math.imul(ge,Se),f=Math.imul(ge,_e),f=f+Math.imul(ve,Se)|0,v=Math.imul(ve,_e),g=g+Math.imul(se,Me)|0,f=f+Math.imul(se,Te)|0,f=f+Math.imul(fe,Me)|0,v=v+Math.imul(fe,Te)|0,g=g+Math.imul(ue,Ae)|0,f=f+Math.imul(ue,Be)|0,f=f+Math.imul(he,Ae)|0,v=v+Math.imul(he,Be)|0,g=g+Math.imul(le,De)|0,f=f+Math.imul(le,Ie)|0,f=f+Math.imul(me,De)|0,v=v+Math.imul(me,Ie)|0,g=g+Math.imul(ie,Re)|0,f=f+Math.imul(ie,ke)|0,f=f+Math.imul(oe,Re)|0,v=v+Math.imul(oe,ke)|0,g=g+Math.imul(ce,Oe)|0,f=f+Math.imul(ce,Ce)|0,f=f+Math.imul(ye,Oe)|0,v=v+Math.imul(ye,Ce)|0,g=g+Math.imul(re,Q)|0,f=f+Math.imul(re,Y)|0,f=f+Math.imul(ne,Q)|0,v=v+Math.imul(ne,Y)|0,g=g+Math.imul(J,ee)|0,f=f+Math.imul(J,te)|0,f=f+Math.imul(X,ee)|0,v=v+Math.imul(X,te)|0,g=g+Math.imul(V,de)|0,f=f+Math.imul(V,pe)|0,f=f+Math.imul(W,de)|0,v=v+Math.imul(W,pe)|0;var nr=(_+g|0)+((f&8191)<<13)|0;_=(v+(f>>>13)|0)+(nr>>>26)|0,nr&=67108863,g=Math.imul(ge,Me),f=Math.imul(ge,Te),f=f+Math.imul(ve,Me)|0,v=Math.imul(ve,Te),g=g+Math.imul(se,Ae)|0,f=f+Math.imul(se,Be)|0,f=f+Math.imul(fe,Ae)|0,v=v+Math.imul(fe,Be)|0,g=g+Math.imul(ue,De)|0,f=f+Math.imul(ue,Ie)|0,f=f+Math.imul(he,De)|0,v=v+Math.imul(he,Ie)|0,g=g+Math.imul(le,Re)|0,f=f+Math.imul(le,ke)|0,f=f+Math.imul(me,Re)|0,v=v+Math.imul(me,ke)|0,g=g+Math.imul(ie,Oe)|0,f=f+Math.imul(ie,Ce)|0,f=f+Math.imul(oe,Oe)|0,v=v+Math.imul(oe,Ce)|0,g=g+Math.imul(ce,Q)|0,f=f+Math.imul(ce,Y)|0,f=f+Math.imul(ye,Q)|0,v=v+Math.imul(ye,Y)|0,g=g+Math.imul(re,ee)|0,f=f+Math.imul(re,te)|0,f=f+Math.imul(ne,ee)|0,v=v+Math.imul(ne,te)|0,g=g+Math.imul(J,de)|0,f=f+Math.imul(J,pe)|0,f=f+Math.imul(X,de)|0,v=v+Math.imul(X,pe)|0;var lr=(_+g|0)+((f&8191)<<13)|0;_=(v+(f>>>13)|0)+(lr>>>26)|0,lr&=67108863,g=Math.imul(ge,Ae),f=Math.imul(ge,Be),f=f+Math.imul(ve,Ae)|0,v=Math.imul(ve,Be),g=g+Math.imul(se,De)|0,f=f+Math.imul(se,Ie)|0,f=f+Math.imul(fe,De)|0,v=v+Math.imul(fe,Ie)|0,g=g+Math.imul(ue,Re)|0,f=f+Math.imul(ue,ke)|0,f=f+Math.imul(he,Re)|0,v=v+Math.imul(he,ke)|0,g=g+Math.imul(le,Oe)|0,f=f+Math.imul(le,Ce)|0,f=f+Math.imul(me,Oe)|0,v=v+Math.imul(me,Ce)|0,g=g+Math.imul(ie,Q)|0,f=f+Math.imul(ie,Y)|0,f=f+Math.imul(oe,Q)|0,v=v+Math.imul(oe,Y)|0,g=g+Math.imul(ce,ee)|0,f=f+Math.imul(ce,te)|0,f=f+Math.imul(ye,ee)|0,v=v+Math.imul(ye,te)|0,g=g+Math.imul(re,de)|0,f=f+Math.imul(re,pe)|0,f=f+Math.imul(ne,de)|0,v=v+Math.imul(ne,pe)|0;var xt=(_+g|0)+((f&8191)<<13)|0;_=(v+(f>>>13)|0)+(xt>>>26)|0,xt&=67108863,g=Math.imul(ge,De),f=Math.imul(ge,Ie),f=f+Math.imul(ve,De)|0,v=Math.imul(ve,Ie),g=g+Math.imul(se,Re)|0,f=f+Math.imul(se,ke)|0,f=f+Math.imul(fe,Re)|0,v=v+Math.imul(fe,ke)|0,g=g+Math.imul(ue,Oe)|0,f=f+Math.imul(ue,Ce)|0,f=f+Math.imul(he,Oe)|0,v=v+Math.imul(he,Ce)|0,g=g+Math.imul(le,Q)|0,f=f+Math.imul(le,Y)|0,f=f+Math.imul(me,Q)|0,v=v+Math.imul(me,Y)|0,g=g+Math.imul(ie,ee)|0,f=f+Math.imul(ie,te)|0,f=f+Math.imul(oe,ee)|0,v=v+Math.imul(oe,te)|0,g=g+Math.imul(ce,de)|0,f=f+Math.imul(ce,pe)|0,f=f+Math.imul(ye,de)|0,v=v+Math.imul(ye,pe)|0;var ir=(_+g|0)+((f&8191)<<13)|0;_=(v+(f>>>13)|0)+(ir>>>26)|0,ir&=67108863,g=Math.imul(ge,Re),f=Math.imul(ge,ke),f=f+Math.imul(ve,Re)|0,v=Math.imul(ve,ke),g=g+Math.imul(se,Oe)|0,f=f+Math.imul(se,Ce)|0,f=f+Math.imul(fe,Oe)|0,v=v+Math.imul(fe,Ce)|0,g=g+Math.imul(ue,Q)|0,f=f+Math.imul(ue,Y)|0,f=f+Math.imul(he,Q)|0,v=v+Math.imul(he,Y)|0,g=g+Math.imul(le,ee)|0,f=f+Math.imul(le,te)|0,f=f+Math.imul(me,ee)|0,v=v+Math.imul(me,te)|0,g=g+Math.imul(ie,de)|0,f=f+Math.imul(ie,pe)|0,f=f+Math.imul(oe,de)|0,v=v+Math.imul(oe,pe)|0;var dr=(_+g|0)+((f&8191)<<13)|0;_=(v+(f>>>13)|0)+(dr>>>26)|0,dr&=67108863,g=Math.imul(ge,Oe),f=Math.imul(ge,Ce),f=f+Math.imul(ve,Oe)|0,v=Math.imul(ve,Ce),g=g+Math.imul(se,Q)|0,f=f+Math.imul(se,Y)|0,f=f+Math.imul(fe,Q)|0,v=v+Math.imul(fe,Y)|0,g=g+Math.imul(ue,ee)|0,f=f+Math.imul(ue,te)|0,f=f+Math.imul(he,ee)|0,v=v+Math.imul(he,te)|0,g=g+Math.imul(le,de)|0,f=f+Math.imul(le,pe)|0,f=f+Math.imul(me,de)|0,v=v+Math.imul(me,pe)|0;var Er=(_+g|0)+((f&8191)<<13)|0;_=(v+(f>>>13)|0)+(Er>>>26)|0,Er&=67108863,g=Math.imul(ge,Q),f=Math.imul(ge,Y),f=f+Math.imul(ve,Q)|0,v=Math.imul(ve,Y),g=g+Math.imul(se,ee)|0,f=f+Math.imul(se,te)|0,f=f+Math.imul(fe,ee)|0,v=v+Math.imul(fe,te)|0,g=g+Math.imul(ue,de)|0,f=f+Math.imul(ue,pe)|0,f=f+Math.imul(he,de)|0,v=v+Math.imul(he,pe)|0;var Ur=(_+g|0)+((f&8191)<<13)|0;_=(v+(f>>>13)|0)+(Ur>>>26)|0,Ur&=67108863,g=Math.imul(ge,ee),f=Math.imul(ge,te),f=f+Math.imul(ve,ee)|0,v=Math.imul(ve,te),g=g+Math.imul(se,de)|0,f=f+Math.imul(se,pe)|0,f=f+Math.imul(fe,de)|0,v=v+Math.imul(fe,pe)|0;var Rr=(_+g|0)+((f&8191)<<13)|0;_=(v+(f>>>13)|0)+(Rr>>>26)|0,Rr&=67108863,g=Math.imul(ge,de),f=Math.imul(ge,pe),f=f+Math.imul(ve,de)|0,v=Math.imul(ve,pe);var Hr=(_+g|0)+((f&8191)<<13)|0;return _=(v+(f>>>13)|0)+(Hr>>>26)|0,Hr&=67108863,b[0]=bt,b[1]=st,b[2]=Ve,b[3]=Tt,b[4]=Ut,b[5]=Pt,b[6]=yt,b[7]=Rt,b[8]=_t,b[9]=Lr,b[10]=nr,b[11]=lr,b[12]=xt,b[13]=ir,b[14]=dr,b[15]=Er,b[16]=Ur,b[17]=Rr,b[18]=Hr,_!==0&&(b[19]=_,y.length++),y};Math.imul||(M=S);function A(x,c,u){u.negative=c.negative^x.negative,u.length=x.length+c.length;for(var y=0,l=0,h=0;h<u.length-1;h++){var b=l;l=0;for(var _=y&67108863,g=Math.min(h,c.length-1),f=Math.max(0,h-x.length+1);f<=g;f++){var v=h-f,O=x.words[v]|0,T=c.words[f]|0,R=O*T,z=R&67108863;b=b+(R/67108864|0)|0,z=z+_|0,_=z&67108863,b=b+(z>>>26)|0,l+=b>>>26,b&=67108863}u.words[h]=_,y=b,b=l}return y!==0?u.words[h]=y:u.length--,u.strip()}function B(x,c,u){var y=new I;return y.mulp(x,c,u)}i.prototype.mulTo=function(c,u){var y,l=this.length+c.length;return this.length===10&&c.length===10?y=M(this,c,u):l<63?y=S(this,c,u):l<1024?y=A(this,c,u):y=B(this,c,u),y};function I(x,c){this.x=x,this.y=c}I.prototype.makeRBT=function(c){for(var u=new Array(c),y=i.prototype._countBits(c)-1,l=0;l<c;l++)u[l]=this.revBin(l,y,c);return u},I.prototype.revBin=function(c,u,y){if(c===0||c===y-1)return c;for(var l=0,h=0;h<u;h++)l|=(c&1)<<u-h-1,c>>=1;return l},I.prototype.permute=function(c,u,y,l,h,b){for(var _=0;_<b;_++)l[_]=u[c[_]],h[_]=y[c[_]]},I.prototype.transform=function(c,u,y,l,h,b){this.permute(b,c,u,y,l,h);for(var _=1;_<h;_<<=1)for(var g=_<<1,f=Math.cos(2*Math.PI/g),v=Math.sin(2*Math.PI/g),O=0;O<h;O+=g)for(var T=f,R=v,z=0;z<_;z++){var V=y[O+z],W=l[O+z],Z=y[O+z+_],J=l[O+z+_],X=T*Z-R*J;J=T*J+R*Z,Z=X,y[O+z]=V+Z,l[O+z]=W+J,y[O+z+_]=V-Z,l[O+z+_]=W-J,z!==g&&(X=f*T-v*R,R=f*R+v*T,T=X)}},I.prototype.guessLen13b=function(c,u){var y=Math.max(u,c)|1,l=y&1,h=0;for(y=y/2|0;y;y=y>>>1)h++;return 1<<h+1+l},I.prototype.conjugate=function(c,u,y){if(!(y<=1))for(var l=0;l<y/2;l++){var h=c[l];c[l]=c[y-l-1],c[y-l-1]=h,h=u[l],u[l]=-u[y-l-1],u[y-l-1]=-h}},I.prototype.normalize13b=function(c,u){for(var y=0,l=0;l<u/2;l++){var h=Math.round(c[2*l+1]/u)*8192+Math.round(c[2*l]/u)+y;c[l]=h&67108863,h<67108864?y=0:y=h/67108864|0}return c},I.prototype.convert13b=function(c,u,y,l){for(var h=0,b=0;b<u;b++)h=h+(c[b]|0),y[2*b]=h&8191,h=h>>>13,y[2*b+1]=h&8191,h=h>>>13;for(b=2*u;b<l;++b)y[b]=0;r(h===0),r((h&-8192)===0)},I.prototype.stub=function(c){for(var u=new Array(c),y=0;y<c;y++)u[y]=0;return u},I.prototype.mulp=function(c,u,y){var l=2*this.guessLen13b(c.length,u.length),h=this.makeRBT(l),b=this.stub(l),_=new Array(l),g=new Array(l),f=new Array(l),v=new Array(l),O=new Array(l),T=new Array(l),R=y.words;R.length=l,this.convert13b(c.words,c.length,_,l),this.convert13b(u.words,u.length,v,l),this.transform(_,b,g,f,l,h),this.transform(v,b,O,T,l,h);for(var z=0;z<l;z++){var V=g[z]*O[z]-f[z]*T[z];f[z]=g[z]*T[z]+f[z]*O[z],g[z]=V}return this.conjugate(g,f,l),this.transform(g,f,R,b,l,h),this.conjugate(R,b,l),this.normalize13b(R,l),y.negative=c.negative^u.negative,y.length=c.length+u.length,y.strip()},i.prototype.mul=function(c){var u=new i(null);return u.words=new Array(this.length+c.length),this.mulTo(c,u)},i.prototype.mulf=function(c){var u=new i(null);return u.words=new Array(this.length+c.length),B(this,c,u)},i.prototype.imul=function(c){return this.clone().mulTo(c,this)},i.prototype.imuln=function(c){r(typeof c=="number"),r(c<67108864);for(var u=0,y=0;y<this.length;y++){var l=(this.words[y]|0)*c,h=(l&67108863)+(u&67108863);u>>=26,u+=l/67108864|0,u+=h>>>26,this.words[y]=h&67108863}return u!==0&&(this.words[y]=u,this.length++),this},i.prototype.muln=function(c){return this.clone().imuln(c)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(c){var u=P(c);if(u.length===0)return new i(1);for(var y=this,l=0;l<u.length&&u[l]===0;l++,y=y.sqr());if(++l<u.length)for(var h=y.sqr();l<u.length;l++,h=h.sqr())u[l]!==0&&(y=y.mul(h));return y},i.prototype.iushln=function(c){r(typeof c=="number"&&c>=0);var u=c%26,y=(c-u)/26,l=67108863>>>26-u<<26-u,h;if(u!==0){var b=0;for(h=0;h<this.length;h++){var _=this.words[h]&l,g=(this.words[h]|0)-_<<u;this.words[h]=g|b,b=_>>>26-u}b&&(this.words[h]=b,this.length++)}if(y!==0){for(h=this.length-1;h>=0;h--)this.words[h+y]=this.words[h];for(h=0;h<y;h++)this.words[h]=0;this.length+=y}return this.strip()},i.prototype.ishln=function(c){return r(this.negative===0),this.iushln(c)},i.prototype.iushrn=function(c,u,y){r(typeof c=="number"&&c>=0);var l;u?l=(u-u%26)/26:l=0;var h=c%26,b=Math.min((c-h)/26,this.length),_=67108863^67108863>>>h<<h,g=y;if(l-=b,l=Math.max(0,l),g){for(var f=0;f<b;f++)g.words[f]=this.words[f];g.length=b}if(b!==0)if(this.length>b)for(this.length-=b,f=0;f<this.length;f++)this.words[f]=this.words[f+b];else this.words[0]=0,this.length=1;var v=0;for(f=this.length-1;f>=0&&(v!==0||f>=l);f--){var O=this.words[f]|0;this.words[f]=v<<26-h|O>>>h,v=O&_}return g&&v!==0&&(g.words[g.length++]=v),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},i.prototype.ishrn=function(c,u,y){return r(this.negative===0),this.iushrn(c,u,y)},i.prototype.shln=function(c){return this.clone().ishln(c)},i.prototype.ushln=function(c){return this.clone().iushln(c)},i.prototype.shrn=function(c){return this.clone().ishrn(c)},i.prototype.ushrn=function(c){return this.clone().iushrn(c)},i.prototype.testn=function(c){r(typeof c=="number"&&c>=0);var u=c%26,y=(c-u)/26,l=1<<u;if(this.length<=y)return!1;var h=this.words[y];return!!(h&l)},i.prototype.imaskn=function(c){r(typeof c=="number"&&c>=0);var u=c%26,y=(c-u)/26;if(r(this.negative===0,"imaskn works only with positive numbers"),this.length<=y)return this;if(u!==0&&y++,this.length=Math.min(y,this.length),u!==0){var l=67108863^67108863>>>u<<u;this.words[this.length-1]&=l}return this.strip()},i.prototype.maskn=function(c){return this.clone().imaskn(c)},i.prototype.iaddn=function(c){return r(typeof c=="number"),r(c<67108864),c<0?this.isubn(-c):this.negative!==0?this.length===1&&(this.words[0]|0)<c?(this.words[0]=c-(this.words[0]|0),this.negative=0,this):(this.negative=0,this.isubn(c),this.negative=1,this):this._iaddn(c)},i.prototype._iaddn=function(c){this.words[0]+=c;for(var u=0;u<this.length&&this.words[u]>=67108864;u++)this.words[u]-=67108864,u===this.length-1?this.words[u+1]=1:this.words[u+1]++;return this.length=Math.max(this.length,u+1),this},i.prototype.isubn=function(c){if(r(typeof c=="number"),r(c<67108864),c<0)return this.iaddn(-c);if(this.negative!==0)return this.negative=0,this.iaddn(c),this.negative=1,this;if(this.words[0]-=c,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var u=0;u<this.length&&this.words[u]<0;u++)this.words[u]+=67108864,this.words[u+1]-=1;return this.strip()},i.prototype.addn=function(c){return this.clone().iaddn(c)},i.prototype.subn=function(c){return this.clone().isubn(c)},i.prototype.iabs=function(){return this.negative=0,this},i.prototype.abs=function(){return this.clone().iabs()},i.prototype._ishlnsubmul=function(c,u,y){var l=c.length+y,h;this._expand(l);var b,_=0;for(h=0;h<c.length;h++){b=(this.words[h+y]|0)+_;var g=(c.words[h]|0)*u;b-=g&67108863,_=(b>>26)-(g/67108864|0),this.words[h+y]=b&67108863}for(;h<this.length-y;h++)b=(this.words[h+y]|0)+_,_=b>>26,this.words[h+y]=b&67108863;if(_===0)return this.strip();for(r(_===-1),_=0,h=0;h<this.length;h++)b=-(this.words[h]|0)+_,_=b>>26,this.words[h]=b&67108863;return this.negative=1,this.strip()},i.prototype._wordDiv=function(c,u){var y=this.length-c.length,l=this.clone(),h=c,b=h.words[h.length-1]|0,_=this._countBits(b);y=26-_,y!==0&&(h=h.ushln(y),l.iushln(y),b=h.words[h.length-1]|0);var g=l.length-h.length,f;if(u!=="mod"){f=new i(null),f.length=g+1,f.words=new Array(f.length);for(var v=0;v<f.length;v++)f.words[v]=0}var O=l.clone()._ishlnsubmul(h,1,g);O.negative===0&&(l=O,f&&(f.words[g]=1));for(var T=g-1;T>=0;T--){var R=(l.words[h.length+T]|0)*67108864+(l.words[h.length+T-1]|0);for(R=Math.min(R/b|0,67108863),l._ishlnsubmul(h,R,T);l.negative!==0;)R--,l.negative=0,l._ishlnsubmul(h,1,T),l.isZero()||(l.negative^=1);f&&(f.words[T]=R)}return f&&f.strip(),l.strip(),u!=="div"&&y!==0&&l.iushrn(y),{div:f||null,mod:l}},i.prototype.divmod=function(c,u,y){if(r(!c.isZero()),this.isZero())return{div:new i(0),mod:new i(0)};var l,h,b;return this.negative!==0&&c.negative===0?(b=this.neg().divmod(c,u),u!=="mod"&&(l=b.div.neg()),u!=="div"&&(h=b.mod.neg(),y&&h.negative!==0&&h.iadd(c)),{div:l,mod:h}):this.negative===0&&c.negative!==0?(b=this.divmod(c.neg(),u),u!=="mod"&&(l=b.div.neg()),{div:l,mod:b.mod}):this.negative&c.negative?(b=this.neg().divmod(c.neg(),u),u!=="div"&&(h=b.mod.neg(),y&&h.negative!==0&&h.isub(c)),{div:b.div,mod:h}):c.length>this.length||this.cmp(c)<0?{div:new i(0),mod:this}:c.length===1?u==="div"?{div:this.divn(c.words[0]),mod:null}:u==="mod"?{div:null,mod:new i(this.modn(c.words[0]))}:{div:this.divn(c.words[0]),mod:new i(this.modn(c.words[0]))}:this._wordDiv(c,u)},i.prototype.div=function(c){return this.divmod(c,"div",!1).div},i.prototype.mod=function(c){return this.divmod(c,"mod",!1).mod},i.prototype.umod=function(c){return this.divmod(c,"mod",!0).mod},i.prototype.divRound=function(c){var u=this.divmod(c);if(u.mod.isZero())return u.div;var y=u.div.negative!==0?u.mod.isub(c):u.mod,l=c.ushrn(1),h=c.andln(1),b=y.cmp(l);return b<0||h===1&&b===0?u.div:u.div.negative!==0?u.div.isubn(1):u.div.iaddn(1)},i.prototype.modn=function(c){r(c<=67108863);for(var u=(1<<26)%c,y=0,l=this.length-1;l>=0;l--)y=(u*y+(this.words[l]|0))%c;return y},i.prototype.idivn=function(c){r(c<=67108863);for(var u=0,y=this.length-1;y>=0;y--){var l=(this.words[y]|0)+u*67108864;this.words[y]=l/c|0,u=l%c}return this.strip()},i.prototype.divn=function(c){return this.clone().idivn(c)},i.prototype.egcd=function(c){r(c.negative===0),r(!c.isZero());var u=this,y=c.clone();u.negative!==0?u=u.umod(c):u=u.clone();for(var l=new i(1),h=new i(0),b=new i(0),_=new i(1),g=0;u.isEven()&&y.isEven();)u.iushrn(1),y.iushrn(1),++g;for(var f=y.clone(),v=u.clone();!u.isZero();){for(var O=0,T=1;!(u.words[0]&T)&&O<26;++O,T<<=1);if(O>0)for(u.iushrn(O);O-- >0;)(l.isOdd()||h.isOdd())&&(l.iadd(f),h.isub(v)),l.iushrn(1),h.iushrn(1);for(var R=0,z=1;!(y.words[0]&z)&&R<26;++R,z<<=1);if(R>0)for(y.iushrn(R);R-- >0;)(b.isOdd()||_.isOdd())&&(b.iadd(f),_.isub(v)),b.iushrn(1),_.iushrn(1);u.cmp(y)>=0?(u.isub(y),l.isub(b),h.isub(_)):(y.isub(u),b.isub(l),_.isub(h))}return{a:b,b:_,gcd:y.iushln(g)}},i.prototype._invmp=function(c){r(c.negative===0),r(!c.isZero());var u=this,y=c.clone();u.negative!==0?u=u.umod(c):u=u.clone();for(var l=new i(1),h=new i(0),b=y.clone();u.cmpn(1)>0&&y.cmpn(1)>0;){for(var _=0,g=1;!(u.words[0]&g)&&_<26;++_,g<<=1);if(_>0)for(u.iushrn(_);_-- >0;)l.isOdd()&&l.iadd(b),l.iushrn(1);for(var f=0,v=1;!(y.words[0]&v)&&f<26;++f,v<<=1);if(f>0)for(y.iushrn(f);f-- >0;)h.isOdd()&&h.iadd(b),h.iushrn(1);u.cmp(y)>=0?(u.isub(y),l.isub(h)):(y.isub(u),h.isub(l))}var O;return u.cmpn(1)===0?O=l:O=h,O.cmpn(0)<0&&O.iadd(c),O},i.prototype.gcd=function(c){if(this.isZero())return c.abs();if(c.isZero())return this.abs();var u=this.clone(),y=c.clone();u.negative=0,y.negative=0;for(var l=0;u.isEven()&&y.isEven();l++)u.iushrn(1),y.iushrn(1);do{for(;u.isEven();)u.iushrn(1);for(;y.isEven();)y.iushrn(1);var h=u.cmp(y);if(h<0){var b=u;u=y,y=b}else if(h===0||y.cmpn(1)===0)break;u.isub(y)}while(!0);return y.iushln(l)},i.prototype.invm=function(c){return this.egcd(c).a.umod(c)},i.prototype.isEven=function(){return(this.words[0]&1)===0},i.prototype.isOdd=function(){return(this.words[0]&1)===1},i.prototype.andln=function(c){return this.words[0]&c},i.prototype.bincn=function(c){r(typeof c=="number");var u=c%26,y=(c-u)/26,l=1<<u;if(this.length<=y)return this._expand(y+1),this.words[y]|=l,this;for(var h=l,b=y;h!==0&&b<this.length;b++){var _=this.words[b]|0;_+=h,h=_>>>26,_&=67108863,this.words[b]=_}return h!==0&&(this.words[b]=h,this.length++),this},i.prototype.isZero=function(){return this.length===1&&this.words[0]===0},i.prototype.cmpn=function(c){var u=c<0;if(this.negative!==0&&!u)return-1;if(this.negative===0&&u)return 1;this.strip();var y;if(this.length>1)y=1;else{u&&(c=-c),r(c<=67108863,"Number is too big");var l=this.words[0]|0;y=l===c?0:l<c?-1:1}return this.negative!==0?-y|0:y},i.prototype.cmp=function(c){if(this.negative!==0&&c.negative===0)return-1;if(this.negative===0&&c.negative!==0)return 1;var u=this.ucmp(c);return this.negative!==0?-u|0:u},i.prototype.ucmp=function(c){if(this.length>c.length)return 1;if(this.length<c.length)return-1;for(var u=0,y=this.length-1;y>=0;y--){var l=this.words[y]|0,h=c.words[y]|0;if(l!==h){l<h?u=-1:l>h&&(u=1);break}}return u},i.prototype.gtn=function(c){return this.cmpn(c)===1},i.prototype.gt=function(c){return this.cmp(c)===1},i.prototype.gten=function(c){return this.cmpn(c)>=0},i.prototype.gte=function(c){return this.cmp(c)>=0},i.prototype.ltn=function(c){return this.cmpn(c)===-1},i.prototype.lt=function(c){return this.cmp(c)===-1},i.prototype.lten=function(c){return this.cmpn(c)<=0},i.prototype.lte=function(c){return this.cmp(c)<=0},i.prototype.eqn=function(c){return this.cmpn(c)===0},i.prototype.eq=function(c){return this.cmp(c)===0},i.red=function(c){return new N(c)},i.prototype.toRed=function(c){return r(!this.red,"Already a number in reduction context"),r(this.negative===0,"red works only with positives"),c.convertTo(this)._forceRed(c)},i.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(c){return this.red=c,this},i.prototype.forceRed=function(c){return r(!this.red,"Already a number in reduction context"),this._forceRed(c)},i.prototype.redAdd=function(c){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,c)},i.prototype.redIAdd=function(c){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,c)},i.prototype.redSub=function(c){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,c)},i.prototype.redISub=function(c){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,c)},i.prototype.redShl=function(c){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,c)},i.prototype.redMul=function(c){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,c),this.red.mul(this,c)},i.prototype.redIMul=function(c){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,c),this.red.imul(this,c)},i.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(c){return r(this.red&&!c.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,c)};var C={k256:null,p224:null,p192:null,p25519:null};function k(x,c){this.name=x,this.p=new i(c,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}k.prototype._tmp=function(){var c=new i(null);return c.words=new Array(Math.ceil(this.n/13)),c},k.prototype.ireduce=function(c){var u=c,y;do this.split(u,this.tmp),u=this.imulK(u),u=u.iadd(this.tmp),y=u.bitLength();while(y>this.n);var l=y<this.n?-1:u.ucmp(this.p);return l===0?(u.words[0]=0,u.length=1):l>0?u.isub(this.p):u.strip!==void 0?u.strip():u._strip(),u},k.prototype.split=function(c,u){c.iushrn(this.n,0,u)},k.prototype.imulK=function(c){return c.imul(this.k)};function q(){k.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}n(q,k),q.prototype.split=function(c,u){for(var y=4194303,l=Math.min(c.length,9),h=0;h<l;h++)u.words[h]=c.words[h];if(u.length=l,c.length<=9){c.words[0]=0,c.length=1;return}var b=c.words[9];for(u.words[u.length++]=b&y,h=10;h<c.length;h++){var _=c.words[h]|0;c.words[h-10]=(_&y)<<4|b>>>22,b=_}b>>>=22,c.words[h-10]=b,b===0&&c.length>10?c.length-=10:c.length-=9},q.prototype.imulK=function(c){c.words[c.length]=0,c.words[c.length+1]=0,c.length+=2;for(var u=0,y=0;y<c.length;y++){var l=c.words[y]|0;u+=l*977,c.words[y]=u&67108863,u=l*64+(u/67108864|0)}return c.words[c.length-1]===0&&(c.length--,c.words[c.length-1]===0&&c.length--),c};function L(){k.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}n(L,k);function U(){k.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}n(U,k);function F(){k.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}n(F,k),F.prototype.imulK=function(c){for(var u=0,y=0;y<c.length;y++){var l=(c.words[y]|0)*19+u,h=l&67108863;l>>>=26,c.words[y]=h,u=l}return u!==0&&(c.words[c.length++]=u),c},i._prime=function(c){if(C[c])return C[c];var u;if(c==="k256")u=new q;else if(c==="p224")u=new L;else if(c==="p192")u=new U;else if(c==="p25519")u=new F;else throw new Error("Unknown prime "+c);return C[c]=u,u};function N(x){if(typeof x=="string"){var c=i._prime(x);this.m=c.p,this.prime=c}else r(x.gtn(1),"modulus must be greater than 1"),this.m=x,this.prime=null}N.prototype._verify1=function(c){r(c.negative===0,"red works only with positives"),r(c.red,"red works only with red numbers")},N.prototype._verify2=function(c,u){r((c.negative|u.negative)===0,"red works only with positives"),r(c.red&&c.red===u.red,"red works only with red numbers")},N.prototype.imod=function(c){return this.prime?this.prime.ireduce(c)._forceRed(this):c.umod(this.m)._forceRed(this)},N.prototype.neg=function(c){return c.isZero()?c.clone():this.m.sub(c)._forceRed(this)},N.prototype.add=function(c,u){this._verify2(c,u);var y=c.add(u);return y.cmp(this.m)>=0&&y.isub(this.m),y._forceRed(this)},N.prototype.iadd=function(c,u){this._verify2(c,u);var y=c.iadd(u);return y.cmp(this.m)>=0&&y.isub(this.m),y},N.prototype.sub=function(c,u){this._verify2(c,u);var y=c.sub(u);return y.cmpn(0)<0&&y.iadd(this.m),y._forceRed(this)},N.prototype.isub=function(c,u){this._verify2(c,u);var y=c.isub(u);return y.cmpn(0)<0&&y.iadd(this.m),y},N.prototype.shl=function(c,u){return this._verify1(c),this.imod(c.ushln(u))},N.prototype.imul=function(c,u){return this._verify2(c,u),this.imod(c.imul(u))},N.prototype.mul=function(c,u){return this._verify2(c,u),this.imod(c.mul(u))},N.prototype.isqr=function(c){return this.imul(c,c.clone())},N.prototype.sqr=function(c){return this.mul(c,c)},N.prototype.sqrt=function(c){if(c.isZero())return c.clone();var u=this.m.andln(3);if(r(u%2===1),u===3){var y=this.m.add(new i(1)).iushrn(2);return this.pow(c,y)}for(var l=this.m.subn(1),h=0;!l.isZero()&&l.andln(1)===0;)h++,l.iushrn(1);r(!l.isZero());var b=new i(1).toRed(this),_=b.redNeg(),g=this.m.subn(1).iushrn(1),f=this.m.bitLength();for(f=new i(2*f*f).toRed(this);this.pow(f,g).cmp(_)!==0;)f.redIAdd(_);for(var v=this.pow(f,l),O=this.pow(c,l.addn(1).iushrn(1)),T=this.pow(c,l),R=h;T.cmp(b)!==0;){for(var z=T,V=0;z.cmp(b)!==0;V++)z=z.redSqr();r(V<R);var W=this.pow(v,new i(1).iushln(R-V-1));O=O.redMul(W),v=W.redSqr(),T=T.redMul(v),R=V}return O},N.prototype.invm=function(c){var u=c._invmp(this.m);return u.negative!==0?(u.negative=0,this.imod(u).redNeg()):this.imod(u)},N.prototype.pow=function(c,u){if(u.isZero())return new i(1).toRed(this);if(u.cmpn(1)===0)return c.clone();var y=4,l=new Array(1<<y);l[0]=new i(1).toRed(this),l[1]=c;for(var h=2;h<l.length;h++)l[h]=this.mul(l[h-1],c);var b=l[0],_=0,g=0,f=u.bitLength()%26;for(f===0&&(f=26),h=u.length-1;h>=0;h--){for(var v=u.words[h],O=f-1;O>=0;O--){var T=v>>O&1;if(b!==l[0]&&(b=this.sqr(b)),T===0&&_===0){g=0;continue}_<<=1,_|=T,g++,!(g!==y&&(h!==0||O!==0))&&(b=this.mul(b,l[_]),g=0,_=0)}f=26}return b},N.prototype.convertTo=function(c){var u=c.umod(this.m);return u===c?u.clone():u},N.prototype.convertFrom=function(c){var u=c.clone();return u.red=null,u},i.mont=function(c){return new G(c)};function G(x){N.call(this,x),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new i(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}n(G,N),G.prototype.convertTo=function(c){return this.imod(c.ushln(this.shift))},G.prototype.convertFrom=function(c){var u=this.imod(c.mul(this.rinv));return u.red=null,u},G.prototype.imul=function(c,u){if(c.isZero()||u.isZero())return c.words[0]=0,c.length=1,c;var y=c.imul(u),l=y.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),h=y.isub(l).iushrn(this.shift),b=h;return h.cmp(this.m)>=0?b=h.isub(this.m):h.cmpn(0)<0&&(b=h.iadd(this.m)),b._forceRed(this)},G.prototype.mul=function(c,u){if(c.isZero()||u.isZero())return new i(0)._forceRed(this);var y=c.mul(u),l=y.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),h=y.isub(l).iushrn(this.shift),b=h;return h.cmp(this.m)>=0?b=h.isub(this.m):h.cmpn(0)<0&&(b=h.iadd(this.m)),b._forceRed(this)},G.prototype.invm=function(c){var u=this.imod(c._invmp(this.m).mul(this.r2));return u._forceRed(this)}})(typeof eO>"u"||eO,Ere)});var tO=H((mvt,Mre)=>{E();var Sre=WM(),kke=Fr().Buffer;function Oke(t,e){return kke.from(t.toRed(Sre.mont(e.modulus)).redPow(new Sre(e.publicExponent)).fromRed().toArray())}Mre.exports=Oke});var Rre=H((gvt,Tre)=>{E();var Bke=c_(),rO=em(),Dke=Ov(),Pre=Q7(),Are=X7(),nO=WM(),Cke=tO(),jke=yM(),Ff=Fr().Buffer;Tre.exports=function(e,r,n){var i;e.padding?i=e.padding:n?i=1:i=4;var o=Bke(e),s;if(i===4)s=Nke(o,r);else if(i===1)s=qke(o,r,n);else if(i===3){if(s=new nO(r),s.cmp(o.modulus)>=0)throw new Error("data too long for modulus")}else throw new Error("unknown padding");return n?jke(s,o):Cke(s,o)};function Nke(t,e){var r=t.modulus.byteLength(),n=e.length,i=Dke("sha1").update(Ff.alloc(0)).digest(),o=i.length,s=2*o;if(n>r-s-2)throw new Error("message too long");var a=Ff.alloc(r-n-s-2),d=r-o-1,m=rO(o),p=Are(Ff.concat([i,a,Ff.alloc(1,1),e],d),Pre(m,d)),w=Are(m,Pre(p,o));return new nO(Ff.concat([Ff.alloc(1),w,p],r))}function qke(t,e,r){var n=e.length,i=t.modulus.byteLength();if(n>i-11)throw new Error("message too long");var o;return r?o=Ff.alloc(i-n-3,255):o=$ke(i-n-3),new nO(Ff.concat([Ff.from([0,r?1:2]),o,Ff.alloc(1),e],i))}function $ke(t){for(var e=Ff.allocUnsafe(t),r=0,n=rO(t*2),i=0,o;r<t;)i===n.length&&(n=rO(t*2),i=0),o=n[i++],o&&(e[r++]=o);return e}});var Dre=H((bvt,Bre)=>{E();var Lke=c_(),Ire=Q7(),kre=X7(),Ore=WM(),Uke=yM(),Fke=Ov(),zke=tO(),d_=Fr().Buffer;Bre.exports=function(e,r,n){var i;e.padding?i=e.padding:n?i=1:i=4;var o=Lke(e),s=o.modulus.byteLength();if(r.length>s||new Ore(r).cmp(o.modulus)>=0)throw new Error("decryption error");var a;n?a=zke(new Ore(r),o):a=Uke(r,o);var d=d_.alloc(s-a.length);if(a=d_.concat([d,a],s),i===4)return Kke(o,a);if(i===1)return Gke(o,a,n);if(i===3)return a;throw new Error("unknown padding")};function Kke(t,e){var r=t.modulus.byteLength(),n=Fke("sha1").update(d_.alloc(0)).digest(),i=n.length;if(e[0]!==0)throw new Error("decryption error");var o=e.slice(1,i+1),s=e.slice(i+1),a=kre(o,Ire(s,i)),d=kre(s,Ire(a,r-i-1));if(Wke(n,d.slice(0,i)))throw new Error("decryption error");for(var m=i;d[m]===0;)m++;if(d[m++]!==1)throw new Error("decryption error");return d.slice(m)}function Gke(t,e,r){for(var n=e.slice(0,2),i=2,o=0;e[i++]!==0;)if(i>=e.length){o++;break}var s=e.slice(2,i-1);if((n.toString("hex")!=="0002"&&!r||n.toString("hex")!=="0001"&&r)&&o++,s.length<8&&o++,o)throw new Error("decryption error");return e.slice(i)}function Wke(t,e){t=d_.from(t),e=d_.from(e);var r=0,n=t.length;t.length!==e.length&&(r++,n=Math.min(t.length,e.length));for(var i=-1;++i<n;)r+=t[i]^e[i];return r}});var Cre=H(Wm=>{E();Wm.publicEncrypt=Rre();Wm.privateDecrypt=Dre();Wm.privateEncrypt=function(e,r){return Wm.publicEncrypt(e,r,!0)};Wm.publicDecrypt=function(e,r){return Wm.privateDecrypt(e,r,!0)}});var Gre=H(h_=>{"use strict";E();function jre(){throw new Error(`secure random number generation not supported by this browser
use chrome, FireFox or Internet Explorer 11`)}var qre=Fr(),Nre=em(),$re=qre.Buffer,Lre=qre.kMaxLength,iO=globalThis.crypto||globalThis.msCrypto,Ure=Math.pow(2,32)-1;function Fre(t,e){if(typeof t!="number"||t!==t)throw new TypeError("offset must be a number");if(t>Ure||t<0)throw new TypeError("offset must be a uint32");if(t>Lre||t>e)throw new RangeError("offset out of range")}function zre(t,e,r){if(typeof t!="number"||t!==t)throw new TypeError("size must be a number");if(t>Ure||t<0)throw new TypeError("size must be a uint32");if(t+e>r||t>Lre)throw new RangeError("buffer too small")}iO&&iO.getRandomValues||!j.default.browser?(h_.randomFill=Vke,h_.randomFillSync=Hke):(h_.randomFill=jre,h_.randomFillSync=jre);function Vke(t,e,r,n){if(!$re.isBuffer(t)&&!(t instanceof globalThis.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');if(typeof e=="function")n=e,e=0,r=t.length;else if(typeof r=="function")n=r,r=t.length-e;else if(typeof n!="function")throw new TypeError('"cb" argument must be a function');return Fre(e,t.length),zre(r,e,t.length),Kre(t,e,r,n)}function Kre(t,e,r,n){if(j.default.browser){var i=t.buffer,o=new Uint8Array(i,e,r);if(iO.getRandomValues(o),n){j.default.nextTick(function(){n(null,t)});return}return t}if(n){Nre(r,function(a,d){if(a)return n(a);d.copy(t,e),n(null,t)});return}var s=Nre(r);return s.copy(t,e),t}function Hke(t,e,r){if(typeof e>"u"&&(e=0),!$re.isBuffer(t)&&!(t instanceof globalThis.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');return Fre(e,t.length),r===void 0&&(r=t.length-e),zre(r,e,t.length),Kre(t,e,r)}});var JS=H(hr=>{"use strict";E();hr.randomBytes=hr.rng=hr.pseudoRandomBytes=hr.prng=em();hr.createHash=hr.Hash=Ov();hr.createHmac=hr.Hmac=Zk();var Zke=sY(),Jke=Object.keys(Zke),Yke=["sha1","sha224","sha256","sha384","sha512","md5","rmd160"].concat(Jke);hr.getHashes=function(){return Yke};var Wre=o9();hr.pbkdf2=Wre.pbkdf2;hr.pbkdf2Sync=Wre.pbkdf2Sync;var el=TQ();hr.Cipher=el.Cipher;hr.createCipher=el.createCipher;hr.Cipheriv=el.Cipheriv;hr.createCipheriv=el.createCipheriv;hr.Decipher=el.Decipher;hr.createDecipher=el.createDecipher;hr.Decipheriv=el.Decipheriv;hr.createDecipheriv=el.createDecipheriv;hr.getCiphers=el.getCiphers;hr.listCiphers=el.listCiphers;var p_=zQ();hr.DiffieHellmanGroup=p_.DiffieHellmanGroup;hr.createDiffieHellmanGroup=p_.createDiffieHellmanGroup;hr.getDiffieHellman=p_.getDiffieHellman;hr.createDiffieHellman=p_.createDiffieHellman;hr.DiffieHellman=p_.DiffieHellman;var VM=yre();hr.createSign=VM.createSign;hr.Sign=VM.Sign;hr.createVerify=VM.createVerify;hr.Verify=VM.Verify;hr.createECDH=wre();var HM=Cre();hr.publicEncrypt=HM.publicEncrypt;hr.privateEncrypt=HM.privateEncrypt;hr.publicDecrypt=HM.publicDecrypt;hr.privateDecrypt=HM.privateDecrypt;var Vre=Gre();hr.randomFill=Vre.randomFill;hr.randomFillSync=Vre.randomFillSync;hr.createCredentials=function(){throw new Error(["sorry, createCredentials is not implemented yet","we accept pull requests","https://github.com/crypto-browserify/crypto-browserify"].join(`
`))};hr.constants={DH_CHECK_P_NOT_SAFE_PRIME:2,DH_CHECK_P_NOT_PRIME:1,DH_UNABLE_TO_CHECK_GENERATOR:4,DH_NOT_SUITABLE_GENERATOR:8,NPN_ENABLED:1,ALPN_ENABLED:1,RSA_PKCS1_PADDING:1,RSA_SSLV23_PADDING:2,RSA_NO_PADDING:3,RSA_PKCS1_OAEP_PADDING:4,RSA_X931_PADDING:5,RSA_PKCS1_PSS_PADDING:6,POINT_CONVERSION_COMPRESSED:2,POINT_CONVERSION_UNCOMPRESSED:4,POINT_CONVERSION_HYBRID:6}});var zf=H(pr=>{"use strict";E();Object.defineProperty(pr,"__esModule",{value:!0});pr.setBigUint64=pr.Hash=pr.equalBytes=pr.ensureBytes=pr.checkOpts=pr.concatBytes=pr.toBytes=pr.bytesToUtf8=pr.utf8ToBytes=pr.asyncLoop=pr.nextTick=pr.hexToBytes=pr.bytesToHex=pr.isLE=pr.createView=pr.u32=pr.u16=pr.u8=void 0;var sO=t=>t instanceof Uint8Array,Qke=t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength);pr.u8=Qke;var Xke=t=>new Uint16Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/2));pr.u16=Xke;var e9e=t=>new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4));pr.u32=e9e;var t9e=t=>new DataView(t.buffer,t.byteOffset,t.byteLength);pr.createView=t9e;pr.isLE=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!pr.isLE)throw new Error("Non little-endian hardware is not supported");var r9e=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function n9e(t){if(!sO(t))throw new Error("Uint8Array expected");let e="";for(let r=0;r<t.length;r++)e+=r9e[t[r]];return e}pr.bytesToHex=n9e;function i9e(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);let e=t.length;if(e%2)throw new Error("padded hex string expected, got unpadded hex of length "+e);let r=new Uint8Array(e/2);for(let n=0;n<r.length;n++){let i=n*2,o=t.slice(i,i+2),s=Number.parseInt(o,16);if(Number.isNaN(s)||s<0)throw new Error("Invalid byte sequence");r[n]=s}return r}pr.hexToBytes=i9e;var o9e=async()=>{};pr.nextTick=o9e;async function s9e(t,e,r){let n=Date.now();for(let i=0;i<t;i++){r(i);let o=Date.now()-n;o>=0&&o<e||(await(0,pr.nextTick)(),n+=o)}}pr.asyncLoop=s9e;function Hre(t){if(typeof t!="string")throw new Error(`utf8ToBytes expected string, got ${typeof t}`);return new Uint8Array(new TextEncoder().encode(t))}pr.utf8ToBytes=Hre;function a9e(t){return new TextDecoder().decode(t)}pr.bytesToUtf8=a9e;function c9e(t){if(typeof t=="string"&&(t=Hre(t)),!sO(t))throw new Error(`expected Uint8Array, got ${typeof t}`);return t}pr.toBytes=c9e;function f9e(...t){let e=new Uint8Array(t.reduce((n,i)=>n+i.length,0)),r=0;return t.forEach(n=>{if(!sO(n))throw new Error("Uint8Array expected");e.set(n,r),r+=n.length}),e}pr.concatBytes=f9e;var u9e=t=>Object.prototype.toString.call(t)==="[object Object]"&&t.constructor===Object;function l9e(t,e){if(e!==void 0&&(typeof e!="object"||!u9e(e)))throw new Error("options must be object or undefined");return Object.assign(t,e)}pr.checkOpts=l9e;function d9e(t,e){if(!(t instanceof Uint8Array))throw new Error("Uint8Array expected");if(typeof e=="number"&&t.length!==e)throw new Error(`Uint8Array length ${e} expected`)}pr.ensureBytes=d9e;function h9e(t,e){if(t.length!==e.length)throw new Error("equalBytes: Different size of Uint8Arrays");let r=!0;for(let n=0;n<t.length;n++)r&&(r=t[n]===e[n]);return r}pr.equalBytes=h9e;var oO=class{};pr.Hash=oO;function p9e(t,e,r,n){if(typeof t.setBigUint64=="function")return t.setBigUint64(e,r,n);let i=BigInt(32),o=BigInt(4294967295),s=Number(r>>i&o),a=Number(r&o),d=n?4:0,m=n?0:4;t.setUint32(e+d,s,n),t.setUint32(e+m,a,n)}pr.setBigUint64=p9e});var m_=H(Cs=>{"use strict";E();Object.defineProperty(Cs,"__esModule",{value:!0});Cs.AEAD_TAG_LENGTH=Cs.XCHACHA20_NONCE_LENGTH=Cs.CURVE25519_PUBLIC_KEY_SIZE=Cs.ETH_PUBLIC_KEY_SIZE=Cs.UNCOMPRESSED_PUBLIC_KEY_SIZE=Cs.COMPRESSED_PUBLIC_KEY_SIZE=Cs.SECRET_KEY_LENGTH=void 0;Cs.SECRET_KEY_LENGTH=32;Cs.COMPRESSED_PUBLIC_KEY_SIZE=33;Cs.UNCOMPRESSED_PUBLIC_KEY_SIZE=65;Cs.ETH_PUBLIC_KEY_SIZE=64;Cs.CURVE25519_PUBLIC_KEY_SIZE=32;Cs.XCHACHA20_NONCE_LENGTH=24;Cs.AEAD_TAG_LENGTH=16});var Vm=H(Xn=>{"use strict";E();Object.defineProperty(Xn,"__esModule",{value:!0});Xn.ephemeralKeySize=Xn.symmetricNonceLength=Xn.symmetricAlgorithm=Xn.isHkdfKeyCompressed=Xn.isEphemeralKeyCompressed=Xn.ellipticCurve=Xn.ECIES_CONFIG=void 0;var ZM=m_(),m9e=function(){function t(){this.ellipticCurve="secp256k1",this.isEphemeralKeyCompressed=!1,this.isHkdfKeyCompressed=!1,this.symmetricAlgorithm="aes-256-gcm",this.symmetricNonceLength=16}return t}();Xn.ECIES_CONFIG=new m9e;var y9e=function(){return Xn.ECIES_CONFIG.ellipticCurve};Xn.ellipticCurve=y9e;var g9e=function(){return Xn.ECIES_CONFIG.isEphemeralKeyCompressed};Xn.isEphemeralKeyCompressed=g9e;var v9e=function(){return Xn.ECIES_CONFIG.isHkdfKeyCompressed};Xn.isHkdfKeyCompressed=v9e;var b9e=function(){return Xn.ECIES_CONFIG.symmetricAlgorithm};Xn.symmetricAlgorithm=b9e;var w9e=function(){return Xn.ECIES_CONFIG.symmetricNonceLength};Xn.symmetricNonceLength=w9e;var _9e=function(){var t={secp256k1:Xn.ECIES_CONFIG.isEphemeralKeyCompressed?ZM.COMPRESSED_PUBLIC_KEY_SIZE:ZM.UNCOMPRESSED_PUBLIC_KEY_SIZE,x25519:ZM.CURVE25519_PUBLIC_KEY_SIZE,ed25519:ZM.CURVE25519_PUBLIC_KEY_SIZE};if(Xn.ECIES_CONFIG.ellipticCurve in t)return t[Xn.ECIES_CONFIG.ellipticCurve];throw new Error("Not implemented")};Xn.ephemeralKeySize=_9e});var Zre=H(JM=>{"use strict";E();Object.defineProperty(JM,"__esModule",{value:!0});JM.crypto=void 0;JM.crypto=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0});var aO=H(fb=>{"use strict";E();Object.defineProperty(fb,"__esModule",{value:!0});fb.getWebcryptoSubtle=fb.randomBytes=void 0;var Hm=Zre();function x9e(t=32){if(Hm.crypto&&typeof Hm.crypto.getRandomValues=="function")return Hm.crypto.getRandomValues(new Uint8Array(t));throw new Error("crypto.getRandomValues must be defined")}fb.randomBytes=x9e;function E9e(){if(Hm.crypto&&typeof Hm.crypto.subtle=="object"&&Hm.crypto.subtle!=null)return Hm.crypto.subtle;throw new Error("crypto.subtle must be defined")}fb.getWebcryptoSubtle=E9e});var QM=H(ta=>{"use strict";E();Object.defineProperty(ta,"__esModule",{value:!0});ta.output=ta.exists=ta.hash=ta.bytes=ta.bool=ta.number=void 0;function YM(t){if(!Number.isSafeInteger(t)||t<0)throw new Error(`Wrong positive integer: ${t}`)}ta.number=YM;function Jre(t){if(typeof t!="boolean")throw new Error(`Expected boolean, not ${t}`)}ta.bool=Jre;function S9e(t){return t instanceof Uint8Array||t!=null&&typeof t=="object"&&t.constructor.name==="Uint8Array"}function cO(t,...e){if(!S9e(t))throw new Error("Expected Uint8Array");if(e.length>0&&!e.includes(t.length))throw new Error(`Expected Uint8Array of length ${e}, not of length=${t.length}`)}ta.bytes=cO;function Yre(t){if(typeof t!="function"||typeof t.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");YM(t.outputLen),YM(t.blockLen)}ta.hash=Yre;function Qre(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}ta.exists=Qre;function Xre(t,e){cO(t);let r=e.outputLen;if(t.length<r)throw new Error(`digestInto() expects output buffer of length at least ${r}`)}ta.output=Xre;var M9e={number:YM,bool:Jre,bytes:cO,hash:Yre,exists:Qre,output:Xre};ta.default=M9e});var ene=H(XM=>{"use strict";E();Object.defineProperty(XM,"__esModule",{value:!0});XM.crypto=void 0;XM.crypto=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0});var Nd=H(mr=>{"use strict";E();Object.defineProperty(mr,"__esModule",{value:!0});mr.randomBytes=mr.wrapXOFConstructorWithOpts=mr.wrapConstructorWithOpts=mr.wrapConstructor=mr.checkOpts=mr.Hash=mr.concatBytes=mr.toBytes=mr.utf8ToBytes=mr.asyncLoop=mr.nextTick=mr.hexToBytes=mr.bytesToHex=mr.isLE=mr.rotr=mr.createView=mr.u32=mr.u8=void 0;var fO=ene(),P9e=t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength);mr.u8=P9e;var A9e=t=>new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4));mr.u32=A9e;function lO(t){return t instanceof Uint8Array||t!=null&&typeof t=="object"&&t.constructor.name==="Uint8Array"}var T9e=t=>new DataView(t.buffer,t.byteOffset,t.byteLength);mr.createView=T9e;var R9e=(t,e)=>t<<32-e|t>>>e;mr.rotr=R9e;mr.isLE=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!mr.isLE)throw new Error("Non little-endian hardware is not supported");var I9e=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function k9e(t){if(!lO(t))throw new Error("Uint8Array expected");let e="";for(let r=0;r<t.length;r++)e+=I9e[t[r]];return e}mr.bytesToHex=k9e;var jd={_0:48,_9:57,_A:65,_F:70,_a:97,_f:102};function tne(t){if(t>=jd._0&&t<=jd._9)return t-jd._0;if(t>=jd._A&&t<=jd._F)return t-(jd._A-10);if(t>=jd._a&&t<=jd._f)return t-(jd._a-10)}function O9e(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);let e=t.length,r=e/2;if(e%2)throw new Error("padded hex string expected, got unpadded hex of length "+e);let n=new Uint8Array(r);for(let i=0,o=0;i<r;i++,o+=2){let s=tne(t.charCodeAt(o)),a=tne(t.charCodeAt(o+1));if(s===void 0||a===void 0){let d=t[o]+t[o+1];throw new Error('hex string expected, got non-hex character "'+d+'" at index '+o)}n[i]=s*16+a}return n}mr.hexToBytes=O9e;var B9e=async()=>{};mr.nextTick=B9e;async function D9e(t,e,r){let n=Date.now();for(let i=0;i<t;i++){r(i);let o=Date.now()-n;o>=0&&o<e||(await(0,mr.nextTick)(),n+=o)}}mr.asyncLoop=D9e;function rne(t){if(typeof t!="string")throw new Error(`utf8ToBytes expected string, got ${typeof t}`);return new Uint8Array(new TextEncoder().encode(t))}mr.utf8ToBytes=rne;function e5(t){if(typeof t=="string"&&(t=rne(t)),!lO(t))throw new Error(`expected Uint8Array, got ${typeof t}`);return t}mr.toBytes=e5;function C9e(...t){let e=0;for(let n=0;n<t.length;n++){let i=t[n];if(!lO(i))throw new Error("Uint8Array expected");e+=i.length}let r=new Uint8Array(e);for(let n=0,i=0;n<t.length;n++){let o=t[n];r.set(o,i),i+=o.length}return r}mr.concatBytes=C9e;var uO=class{clone(){return this._cloneInto()}};mr.Hash=uO;var j9e={}.toString;function N9e(t,e){if(e!==void 0&&j9e.call(e)!=="[object Object]")throw new Error("Options should be object or undefined");return Object.assign(t,e)}mr.checkOpts=N9e;function q9e(t){let e=n=>t().update(e5(n)).digest(),r=t();return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=()=>t(),e}mr.wrapConstructor=q9e;function $9e(t){let e=(n,i)=>t(i).update(e5(n)).digest(),r=t({});return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=n=>t(n),e}mr.wrapConstructorWithOpts=$9e;function L9e(t){let e=(n,i)=>t(i).update(e5(n)).digest(),r=t({});return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=n=>t(n),e}mr.wrapXOFConstructorWithOpts=L9e;function U9e(t=32){if(fO.crypto&&typeof fO.crypto.getRandomValues=="function")return fO.crypto.getRandomValues(new Uint8Array(t));throw new Error("crypto.getRandomValues must be defined")}mr.randomBytes=U9e});var pO=H(t5=>{"use strict";E();Object.defineProperty(t5,"__esModule",{value:!0});t5.SHA2=void 0;var dO=QM(),y_=Nd();function F9e(t,e,r,n){if(typeof t.setBigUint64=="function")return t.setBigUint64(e,r,n);let i=BigInt(32),o=BigInt(4294967295),s=Number(r>>i&o),a=Number(r&o),d=n?4:0,m=n?0:4;t.setUint32(e+d,s,n),t.setUint32(e+m,a,n)}var hO=class extends y_.Hash{constructor(e,r,n,i){super(),this.blockLen=e,this.outputLen=r,this.padOffset=n,this.isLE=i,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=(0,y_.createView)(this.buffer)}update(e){(0,dO.exists)(this);let{view:r,buffer:n,blockLen:i}=this;e=(0,y_.toBytes)(e);let o=e.length;for(let s=0;s<o;){let a=Math.min(i-this.pos,o-s);if(a===i){let d=(0,y_.createView)(e);for(;i<=o-s;s+=i)this.process(d,s);continue}n.set(e.subarray(s,s+a),this.pos),this.pos+=a,s+=a,this.pos===i&&(this.process(r,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){(0,dO.exists)(this),(0,dO.output)(e,this),this.finished=!0;let{buffer:r,view:n,blockLen:i,isLE:o}=this,{pos:s}=this;r[s++]=128,this.buffer.subarray(s).fill(0),this.padOffset>i-s&&(this.process(n,0),s=0);for(let w=s;w<i;w++)r[w]=0;F9e(n,i-8,BigInt(this.length*8),o),this.process(n,0);let a=(0,y_.createView)(e),d=this.outputLen;if(d%4)throw new Error("_sha2: outputLen should be aligned to 32bit");let m=d/4,p=this.get();if(m>p.length)throw new Error("_sha2: outputLen bigger than state");for(let w=0;w<m;w++)a.setUint32(4*w,p[w],o)}digest(){let{buffer:e,outputLen:r}=this;this.digestInto(e);let n=e.slice(0,r);return this.destroy(),n}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());let{blockLen:r,buffer:n,length:i,finished:o,destroyed:s,pos:a}=this;return e.length=i,e.pos=a,e.finished=o,e.destroyed=s,i%r&&e.buffer.set(n),e}};t5.SHA2=hO});var Sne=H(Kt=>{"use strict";E();Object.defineProperty(Kt,"__esModule",{value:!0});Kt.add5L=Kt.add5H=Kt.add4H=Kt.add4L=Kt.add3H=Kt.add3L=Kt.add=Kt.rotlBL=Kt.rotlBH=Kt.rotlSL=Kt.rotlSH=Kt.rotr32L=Kt.rotr32H=Kt.rotrBL=Kt.rotrBH=Kt.rotrSL=Kt.rotrSH=Kt.shrSL=Kt.shrSH=Kt.toBig=Kt.split=Kt.fromBig=void 0;var r5=BigInt(2**32-1),mO=BigInt(32);function yO(t,e=!1){return e?{h:Number(t&r5),l:Number(t>>mO&r5)}:{h:Number(t>>mO&r5)|0,l:Number(t&r5)|0}}Kt.fromBig=yO;function nne(t,e=!1){let r=new Uint32Array(t.length),n=new Uint32Array(t.length);for(let i=0;i<t.length;i++){let{h:o,l:s}=yO(t[i],e);[r[i],n[i]]=[o,s]}return[r,n]}Kt.split=nne;var ine=(t,e)=>BigInt(t>>>0)<<mO|BigInt(e>>>0);Kt.toBig=ine;var one=(t,e,r)=>t>>>r;Kt.shrSH=one;var sne=(t,e,r)=>t<<32-r|e>>>r;Kt.shrSL=sne;var ane=(t,e,r)=>t>>>r|e<<32-r;Kt.rotrSH=ane;var cne=(t,e,r)=>t<<32-r|e>>>r;Kt.rotrSL=cne;var fne=(t,e,r)=>t<<64-r|e>>>r-32;Kt.rotrBH=fne;var une=(t,e,r)=>t>>>r-32|e<<64-r;Kt.rotrBL=une;var lne=(t,e)=>e;Kt.rotr32H=lne;var dne=(t,e)=>t;Kt.rotr32L=dne;var hne=(t,e,r)=>t<<r|e>>>32-r;Kt.rotlSH=hne;var pne=(t,e,r)=>e<<r|t>>>32-r;Kt.rotlSL=pne;var mne=(t,e,r)=>e<<r-32|t>>>64-r;Kt.rotlBH=mne;var yne=(t,e,r)=>t<<r-32|e>>>64-r;Kt.rotlBL=yne;function gne(t,e,r,n){let i=(e>>>0)+(n>>>0);return{h:t+r+(i/2**32|0)|0,l:i|0}}Kt.add=gne;var vne=(t,e,r)=>(t>>>0)+(e>>>0)+(r>>>0);Kt.add3L=vne;var bne=(t,e,r,n)=>e+r+n+(t/2**32|0)|0;Kt.add3H=bne;var wne=(t,e,r,n)=>(t>>>0)+(e>>>0)+(r>>>0)+(n>>>0);Kt.add4L=wne;var _ne=(t,e,r,n,i)=>e+r+n+i+(t/2**32|0)|0;Kt.add4H=_ne;var xne=(t,e,r,n,i)=>(t>>>0)+(e>>>0)+(r>>>0)+(n>>>0)+(i>>>0);Kt.add5L=xne;var Ene=(t,e,r,n,i,o)=>e+r+n+i+o+(t/2**32|0)|0;Kt.add5H=Ene;var z9e={fromBig:yO,split:nne,toBig:ine,shrSH:one,shrSL:sne,rotrSH:ane,rotrSL:cne,rotrBH:fne,rotrBL:une,rotr32H:lne,rotr32L:dne,rotlSH:hne,rotlSL:pne,rotlBH:mne,rotlBL:yne,add:gne,add3L:vne,add3H:bne,add4L:wne,add4H:_ne,add5H:Ene,add5L:xne};Kt.default=z9e});var Mne=H(Vc=>{"use strict";E();Object.defineProperty(Vc,"__esModule",{value:!0});Vc.sha384=Vc.sha512_256=Vc.sha512_224=Vc.sha512=Vc.SHA512=void 0;var K9e=pO(),yr=Sne(),n5=Nd(),[G9e,W9e]=(()=>yr.default.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(t=>BigInt(t))))(),vp=new Uint32Array(80),bp=new Uint32Array(80),Zm=class extends K9e.SHA2{constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){let{Ah:e,Al:r,Bh:n,Bl:i,Ch:o,Cl:s,Dh:a,Dl:d,Eh:m,El:p,Fh:w,Fl:P,Gh:S,Gl:M,Hh:A,Hl:B}=this;return[e,r,n,i,o,s,a,d,m,p,w,P,S,M,A,B]}set(e,r,n,i,o,s,a,d,m,p,w,P,S,M,A,B){this.Ah=e|0,this.Al=r|0,this.Bh=n|0,this.Bl=i|0,this.Ch=o|0,this.Cl=s|0,this.Dh=a|0,this.Dl=d|0,this.Eh=m|0,this.El=p|0,this.Fh=w|0,this.Fl=P|0,this.Gh=S|0,this.Gl=M|0,this.Hh=A|0,this.Hl=B|0}process(e,r){for(let k=0;k<16;k++,r+=4)vp[k]=e.getUint32(r),bp[k]=e.getUint32(r+=4);for(let k=16;k<80;k++){let q=vp[k-15]|0,L=bp[k-15]|0,U=yr.default.rotrSH(q,L,1)^yr.default.rotrSH(q,L,8)^yr.default.shrSH(q,L,7),F=yr.default.rotrSL(q,L,1)^yr.default.rotrSL(q,L,8)^yr.default.shrSL(q,L,7),N=vp[k-2]|0,G=bp[k-2]|0,x=yr.default.rotrSH(N,G,19)^yr.default.rotrBH(N,G,61)^yr.default.shrSH(N,G,6),c=yr.default.rotrSL(N,G,19)^yr.default.rotrBL(N,G,61)^yr.default.shrSL(N,G,6),u=yr.default.add4L(F,c,bp[k-7],bp[k-16]),y=yr.default.add4H(u,U,x,vp[k-7],vp[k-16]);vp[k]=y|0,bp[k]=u|0}let{Ah:n,Al:i,Bh:o,Bl:s,Ch:a,Cl:d,Dh:m,Dl:p,Eh:w,El:P,Fh:S,Fl:M,Gh:A,Gl:B,Hh:I,Hl:C}=this;for(let k=0;k<80;k++){let q=yr.default.rotrSH(w,P,14)^yr.default.rotrSH(w,P,18)^yr.default.rotrBH(w,P,41),L=yr.default.rotrSL(w,P,14)^yr.default.rotrSL(w,P,18)^yr.default.rotrBL(w,P,41),U=w&S^~w&A,F=P&M^~P&B,N=yr.default.add5L(C,L,F,W9e[k],bp[k]),G=yr.default.add5H(N,I,q,U,G9e[k],vp[k]),x=N|0,c=yr.default.rotrSH(n,i,28)^yr.default.rotrBH(n,i,34)^yr.default.rotrBH(n,i,39),u=yr.default.rotrSL(n,i,28)^yr.default.rotrBL(n,i,34)^yr.default.rotrBL(n,i,39),y=n&o^n&a^o&a,l=i&s^i&d^s&d;I=A|0,C=B|0,A=S|0,B=M|0,S=w|0,M=P|0,{h:w,l:P}=yr.default.add(m|0,p|0,G|0,x|0),m=a|0,p=d|0,a=o|0,d=s|0,o=n|0,s=i|0;let h=yr.default.add3L(x,u,l);n=yr.default.add3H(h,G,c,y),i=h|0}({h:n,l:i}=yr.default.add(this.Ah|0,this.Al|0,n|0,i|0)),{h:o,l:s}=yr.default.add(this.Bh|0,this.Bl|0,o|0,s|0),{h:a,l:d}=yr.default.add(this.Ch|0,this.Cl|0,a|0,d|0),{h:m,l:p}=yr.default.add(this.Dh|0,this.Dl|0,m|0,p|0),{h:w,l:P}=yr.default.add(this.Eh|0,this.El|0,w|0,P|0),{h:S,l:M}=yr.default.add(this.Fh|0,this.Fl|0,S|0,M|0),{h:A,l:B}=yr.default.add(this.Gh|0,this.Gl|0,A|0,B|0),{h:I,l:C}=yr.default.add(this.Hh|0,this.Hl|0,I|0,C|0),this.set(n,i,o,s,a,d,m,p,w,P,S,M,A,B,I,C)}roundClean(){vp.fill(0),bp.fill(0)}destroy(){this.buffer.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}};Vc.SHA512=Zm;var gO=class extends Zm{constructor(){super(),this.Ah=-1942145080,this.Al=424955298,this.Bh=1944164710,this.Bl=-1982016298,this.Ch=502970286,this.Cl=855612546,this.Dh=1738396948,this.Dl=1479516111,this.Eh=258812777,this.El=2077511080,this.Fh=2011393907,this.Fl=79989058,this.Gh=1067287976,this.Gl=1780299464,this.Hh=286451373,this.Hl=-1848208735,this.outputLen=28}},vO=class extends Zm{constructor(){super(),this.Ah=573645204,this.Al=-64227540,this.Bh=-1621794909,this.Bl=-934517566,this.Ch=596883563,this.Cl=1867755857,this.Dh=-1774684391,this.Dl=1497426621,this.Eh=-1775747358,this.El=-1467023389,this.Fh=-1101128155,this.Fl=1401305490,this.Gh=721525244,this.Gl=746961066,this.Hh=246885852,this.Hl=-2117784414,this.outputLen=32}},bO=class extends Zm{constructor(){super(),this.Ah=-876896931,this.Al=-1056596264,this.Bh=1654270250,this.Bl=914150663,this.Ch=-1856437926,this.Cl=812702999,this.Dh=355462360,this.Dl=-150054599,this.Eh=1731405415,this.El=-4191439,this.Fh=-1900787065,this.Fl=1750603025,this.Gh=-619958771,this.Gl=1694076839,this.Hh=1203062813,this.Hl=-1090891868,this.outputLen=48}};Vc.sha512=(0,n5.wrapConstructor)(()=>new Zm);Vc.sha512_224=(0,n5.wrapConstructor)(()=>new gO);Vc.sha512_256=(0,n5.wrapConstructor)(()=>new vO);Vc.sha384=(0,n5.wrapConstructor)(()=>new bO)});var Kf=H(Yt=>{"use strict";E();Object.defineProperty(Yt,"__esModule",{value:!0});Yt.validateObject=Yt.createHmacDrbg=Yt.bitMask=Yt.bitSet=Yt.bitGet=Yt.bitLen=Yt.utf8ToBytes=Yt.equalBytes=Yt.concatBytes=Yt.ensureBytes=Yt.numberToVarBytesBE=Yt.numberToBytesLE=Yt.numberToBytesBE=Yt.bytesToNumberLE=Yt.bytesToNumberBE=Yt.hexToBytes=Yt.hexToNumber=Yt.numberToHexUnpadded=Yt.bytesToHex=Yt.isBytes=void 0;var Tne=BigInt(0),i5=BigInt(1),V9e=BigInt(2);function ub(t){return t instanceof Uint8Array||t!=null&&typeof t=="object"&&t.constructor.name==="Uint8Array"}Yt.isBytes=ub;var H9e=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function _O(t){if(!ub(t))throw new Error("Uint8Array expected");let e="";for(let r=0;r<t.length;r++)e+=H9e[t[r]];return e}Yt.bytesToHex=_O;function Rne(t){let e=t.toString(16);return e.length&1?`0${e}`:e}Yt.numberToHexUnpadded=Rne;function xO(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);return BigInt(t===""?"0":`0x${t}`)}Yt.hexToNumber=xO;var qd={_0:48,_9:57,_A:65,_F:70,_a:97,_f:102};function Pne(t){if(t>=qd._0&&t<=qd._9)return t-qd._0;if(t>=qd._A&&t<=qd._F)return t-(qd._A-10);if(t>=qd._a&&t<=qd._f)return t-(qd._a-10)}function o5(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);let e=t.length,r=e/2;if(e%2)throw new Error("padded hex string expected, got unpadded hex of length "+e);let n=new Uint8Array(r);for(let i=0,o=0;i<r;i++,o+=2){let s=Pne(t.charCodeAt(o)),a=Pne(t.charCodeAt(o+1));if(s===void 0||a===void 0){let d=t[o]+t[o+1];throw new Error('hex string expected, got non-hex character "'+d+'" at index '+o)}n[i]=s*16+a}return n}Yt.hexToBytes=o5;function Z9e(t){return xO(_O(t))}Yt.bytesToNumberBE=Z9e;function J9e(t){if(!ub(t))throw new Error("Uint8Array expected");return xO(_O(Uint8Array.from(t).reverse()))}Yt.bytesToNumberLE=J9e;function Ine(t,e){return o5(t.toString(16).padStart(e*2,"0"))}Yt.numberToBytesBE=Ine;function Y9e(t,e){return Ine(t,e).reverse()}Yt.numberToBytesLE=Y9e;function Q9e(t){return o5(Rne(t))}Yt.numberToVarBytesBE=Q9e;function X9e(t,e,r){let n;if(typeof e=="string")try{n=o5(e)}catch(o){throw new Error(`${t} must be valid hex string, got "${e}". Cause: ${o}`)}else if(ub(e))n=Uint8Array.from(e);else throw new Error(`${t} must be hex string or Uint8Array`);let i=n.length;if(typeof r=="number"&&i!==r)throw new Error(`${t} expected ${r} bytes, got ${i}`);return n}Yt.ensureBytes=X9e;function kne(...t){let e=0;for(let i=0;i<t.length;i++){let o=t[i];if(!ub(o))throw new Error("Uint8Array expected");e+=o.length}let r=new Uint8Array(e),n=0;for(let i=0;i<t.length;i++){let o=t[i];r.set(o,n),n+=o.length}return r}Yt.concatBytes=kne;function e7e(t,e){if(t.length!==e.length)return!1;let r=0;for(let n=0;n<t.length;n++)r|=t[n]^e[n];return r===0}Yt.equalBytes=e7e;function t7e(t){if(typeof t!="string")throw new Error(`utf8ToBytes expected string, got ${typeof t}`);return new Uint8Array(new TextEncoder().encode(t))}Yt.utf8ToBytes=t7e;function r7e(t){let e;for(e=0;t>Tne;t>>=i5,e+=1);return e}Yt.bitLen=r7e;function n7e(t,e){return t>>BigInt(e)&i5}Yt.bitGet=n7e;var i7e=(t,e,r)=>t|(r?i5:Tne)<<BigInt(e);Yt.bitSet=i7e;var o7e=t=>(V9e<<BigInt(t-1))-i5;Yt.bitMask=o7e;var wO=t=>new Uint8Array(t),Ane=t=>Uint8Array.from(t);function s7e(t,e,r){if(typeof t!="number"||t<2)throw new Error("hashLen must be a number");if(typeof e!="number"||e<2)throw new Error("qByteLen must be a number");if(typeof r!="function")throw new Error("hmacFn must be a function");let n=wO(t),i=wO(t),o=0,s=()=>{n.fill(1),i.fill(0),o=0},a=(...w)=>r(i,n,...w),d=(w=wO())=>{i=a(Ane([0]),w),n=a(),w.length!==0&&(i=a(Ane([1]),w),n=a())},m=()=>{if(o++>=1e3)throw new Error("drbg: tried 1000 values");let w=0,P=[];for(;w<e;){n=a();let S=n.slice();P.push(S),w+=n.length}return kne(...P)};return(w,P)=>{s(),d(w);let S;for(;!(S=P(m()));)d();return s(),S}}Yt.createHmacDrbg=s7e;var a7e={bigint:t=>typeof t=="bigint",function:t=>typeof t=="function",boolean:t=>typeof t=="boolean",string:t=>typeof t=="string",stringOrUint8Array:t=>typeof t=="string"||ub(t),isSafeInteger:t=>Number.isSafeInteger(t),array:t=>Array.isArray(t),field:(t,e)=>e.Fp.isValid(t),hash:t=>typeof t=="function"&&Number.isSafeInteger(t.outputLen)};function c7e(t,e,r={}){let n=(i,o,s)=>{let a=a7e[o];if(typeof a!="function")throw new Error(`Invalid validator "${o}", expected function`);let d=t[i];if(!(s&&d===void 0)&&!a(d,t))throw new Error(`Invalid param ${String(i)}=${d} (${typeof d}), expected ${o}`)};for(let[i,o]of Object.entries(e))n(i,o,!1);for(let[i,o]of Object.entries(r))n(i,o,!0);return t}Yt.validateObject=c7e});var _p=H(Qt=>{"use strict";E();Object.defineProperty(Qt,"__esModule",{value:!0});Qt.mapHashToField=Qt.getMinHashLength=Qt.getFieldBytesLength=Qt.hashToPrivateScalar=Qt.FpSqrtEven=Qt.FpSqrtOdd=Qt.Field=Qt.nLength=Qt.FpIsSquare=Qt.FpDiv=Qt.FpInvertBatch=Qt.FpPow=Qt.validateField=Qt.isNegativeLE=Qt.FpSqrt=Qt.tonelliShanks=Qt.invert=Qt.pow2=Qt.pow=Qt.mod=void 0;var tc=Kf(),fo=BigInt(0),Tn=BigInt(1),wp=BigInt(2),f7e=BigInt(3),EO=BigInt(4),One=BigInt(5),Bne=BigInt(8),u7e=BigInt(9),l7e=BigInt(16);function ec(t,e){let r=t%e;return r>=fo?r:e+r}Qt.mod=ec;function Dne(t,e,r){if(r<=fo||e<fo)throw new Error("Expected power/modulo > 0");if(r===Tn)return fo;let n=Tn;for(;e>fo;)e&Tn&&(n=n*t%r),t=t*t%r,e>>=Tn;return n}Qt.pow=Dne;function d7e(t,e,r){let n=t;for(;e-- >fo;)n*=n,n%=r;return n}Qt.pow2=d7e;function s5(t,e){if(t===fo||e<=fo)throw new Error(`invert: expected positive integers, got n=${t} mod=${e}`);let r=ec(t,e),n=e,i=fo,o=Tn,s=Tn,a=fo;for(;r!==fo;){let m=n/r,p=n%r,w=i-s*m,P=o-a*m;n=r,r=p,i=s,o=a,s=w,a=P}if(n!==Tn)throw new Error("invert: does not exist");return ec(i,e)}Qt.invert=s5;function Cne(t){let e=(t-Tn)/wp,r,n,i;for(r=t-Tn,n=0;r%wp===fo;r/=wp,n++);for(i=wp;i<t&&Dne(i,e,t)!==t-Tn;i++);if(n===1){let s=(t+Tn)/EO;return function(d,m){let p=d.pow(m,s);if(!d.eql(d.sqr(p),m))throw new Error("Cannot find square root");return p}}let o=(r+Tn)/wp;return function(a,d){if(a.pow(d,e)===a.neg(a.ONE))throw new Error("Cannot find square root");let m=n,p=a.pow(a.mul(a.ONE,i),r),w=a.pow(d,o),P=a.pow(d,r);for(;!a.eql(P,a.ONE);){if(a.eql(P,a.ZERO))return a.ZERO;let S=1;for(let A=a.sqr(P);S<m&&!a.eql(A,a.ONE);S++)A=a.sqr(A);let M=a.pow(p,Tn<<BigInt(m-S-1));p=a.sqr(M),w=a.mul(w,M),P=a.mul(P,p),m=S}return w}}Qt.tonelliShanks=Cne;function jne(t){if(t%EO===f7e){let e=(t+Tn)/EO;return function(n,i){let o=n.pow(i,e);if(!n.eql(n.sqr(o),i))throw new Error("Cannot find square root");return o}}if(t%Bne===One){let e=(t-One)/Bne;return function(n,i){let o=n.mul(i,wp),s=n.pow(o,e),a=n.mul(i,s),d=n.mul(n.mul(a,wp),s),m=n.mul(a,n.sub(d,n.ONE));if(!n.eql(n.sqr(m),i))throw new Error("Cannot find square root");return m}}return t%l7e,Cne(t)}Qt.FpSqrt=jne;var h7e=(t,e)=>(ec(t,e)&Tn)===Tn;Qt.isNegativeLE=h7e;var p7e=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function m7e(t){let e={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},r=p7e.reduce((n,i)=>(n[i]="function",n),e);return(0,tc.validateObject)(t,r)}Qt.validateField=m7e;function Nne(t,e,r){if(r<fo)throw new Error("Expected power > 0");if(r===fo)return t.ONE;if(r===Tn)return e;let n=t.ONE,i=e;for(;r>fo;)r&Tn&&(n=t.mul(n,i)),i=t.sqr(i),r>>=Tn;return n}Qt.FpPow=Nne;function qne(t,e){let r=new Array(e.length),n=e.reduce((o,s,a)=>t.is0(s)?o:(r[a]=o,t.mul(o,s)),t.ONE),i=t.inv(n);return e.reduceRight((o,s,a)=>t.is0(s)?o:(r[a]=t.mul(o,r[a]),t.mul(o,s)),i),r}Qt.FpInvertBatch=qne;function y7e(t,e,r){return t.mul(e,typeof r=="bigint"?s5(r,t.ORDER):t.inv(r))}Qt.FpDiv=y7e;function g7e(t){let e=(t.ORDER-Tn)/wp;return r=>{let n=t.pow(r,e);return t.eql(n,t.ZERO)||t.eql(n,t.ONE)}}Qt.FpIsSquare=g7e;function SO(t,e){let r=e!==void 0?e:t.toString(2).length,n=Math.ceil(r/8);return{nBitLength:r,nByteLength:n}}Qt.nLength=SO;function v7e(t,e,r=!1,n={}){if(t<=fo)throw new Error(`Expected Field ORDER > 0, got ${t}`);let{nBitLength:i,nByteLength:o}=SO(t,e);if(o>2048)throw new Error("Field lengths over 2048 bytes are not supported");let s=jne(t),a=Object.freeze({ORDER:t,BITS:i,BYTES:o,MASK:(0,tc.bitMask)(i),ZERO:fo,ONE:Tn,create:d=>ec(d,t),isValid:d=>{if(typeof d!="bigint")throw new Error(`Invalid field element: expected bigint, got ${typeof d}`);return fo<=d&&d<t},is0:d=>d===fo,isOdd:d=>(d&Tn)===Tn,neg:d=>ec(-d,t),eql:(d,m)=>d===m,sqr:d=>ec(d*d,t),add:(d,m)=>ec(d+m,t),sub:(d,m)=>ec(d-m,t),mul:(d,m)=>ec(d*m,t),pow:(d,m)=>Nne(a,d,m),div:(d,m)=>ec(d*s5(m,t),t),sqrN:d=>d*d,addN:(d,m)=>d+m,subN:(d,m)=>d-m,mulN:(d,m)=>d*m,inv:d=>s5(d,t),sqrt:n.sqrt||(d=>s(a,d)),invertBatch:d=>qne(a,d),cmov:(d,m,p)=>p?m:d,toBytes:d=>r?(0,tc.numberToBytesLE)(d,o):(0,tc.numberToBytesBE)(d,o),fromBytes:d=>{if(d.length!==o)throw new Error(`Fp.fromBytes: expected ${o}, got ${d.length}`);return r?(0,tc.bytesToNumberLE)(d):(0,tc.bytesToNumberBE)(d)}});return Object.freeze(a)}Qt.Field=v7e;function b7e(t,e){if(!t.isOdd)throw new Error("Field doesn't have isOdd");let r=t.sqrt(e);return t.isOdd(r)?r:t.neg(r)}Qt.FpSqrtOdd=b7e;function w7e(t,e){if(!t.isOdd)throw new Error("Field doesn't have isOdd");let r=t.sqrt(e);return t.isOdd(r)?t.neg(r):r}Qt.FpSqrtEven=w7e;function _7e(t,e,r=!1){t=(0,tc.ensureBytes)("privateHash",t);let n=t.length,i=SO(e).nByteLength+8;if(i<24||n<i||n>1024)throw new Error(`hashToPrivateScalar: expected ${i}-1024 bytes of input, got ${n}`);let o=r?(0,tc.bytesToNumberLE)(t):(0,tc.bytesToNumberBE)(t);return ec(o,e-Tn)+Tn}Qt.hashToPrivateScalar=_7e;function MO(t){if(typeof t!="bigint")throw new Error("field order must be bigint");let e=t.toString(2).length;return Math.ceil(e/8)}Qt.getFieldBytesLength=MO;function $ne(t){let e=MO(t);return e+Math.ceil(e/2)}Qt.getMinHashLength=$ne;function x7e(t,e,r=!1){let n=t.length,i=MO(e),o=$ne(e);if(n<16||n<o||n>1024)throw new Error(`expected ${o}-1024 bytes of input, got ${n}`);let s=r?(0,tc.bytesToNumberBE)(t):(0,tc.bytesToNumberLE)(t),a=ec(s,e-Tn)+Tn;return r?(0,tc.numberToBytesLE)(a,i):(0,tc.numberToBytesBE)(a,i)}Qt.mapHashToField=x7e});var AO=H(lb=>{"use strict";E();Object.defineProperty(lb,"__esModule",{value:!0});lb.validateBasic=lb.wNAF=void 0;var Lne=_p(),E7e=Kf(),S7e=BigInt(0),PO=BigInt(1);function M7e(t,e){let r=(i,o)=>{let s=o.negate();return i?s:o},n=i=>{let o=Math.ceil(e/i)+1,s=2**(i-1);return{windows:o,windowSize:s}};return{constTimeNegate:r,unsafeLadder(i,o){let s=t.ZERO,a=i;for(;o>S7e;)o&PO&&(s=s.add(a)),a=a.double(),o>>=PO;return s},precomputeWindow(i,o){let{windows:s,windowSize:a}=n(o),d=[],m=i,p=m;for(let w=0;w<s;w++){p=m,d.push(p);for(let P=1;P<a;P++)p=p.add(m),d.push(p);m=p.double()}return d},wNAF(i,o,s){let{windows:a,windowSize:d}=n(i),m=t.ZERO,p=t.BASE,w=BigInt(2**i-1),P=2**i,S=BigInt(i);for(let M=0;M<a;M++){let A=M*d,B=Number(s&w);s>>=S,B>d&&(B-=P,s+=PO);let I=A,C=A+Math.abs(B)-1,k=M%2!==0,q=B<0;B===0?p=p.add(r(k,o[I])):m=m.add(r(q,o[C]))}return{p:m,f:p}},wNAFCached(i,o,s,a){let d=i._WINDOW_SIZE||1,m=o.get(i);return m||(m=this.precomputeWindow(i,d),d!==1&&o.set(i,a(m))),this.wNAF(d,m,s)}}}lb.wNAF=M7e;function P7e(t){return(0,Lne.validateField)(t.Fp),(0,E7e.validateObject)(t,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...(0,Lne.nLength)(t.n,t.nBitLength),...t,p:t.Fp.ORDER})}lb.validateBasic=P7e});var Fne=H(c5=>{"use strict";E();Object.defineProperty(c5,"__esModule",{value:!0});c5.twistedEdwards=void 0;var A7e=_p(),$d=Kf(),xp=Kf(),Une=AO(),Gf=BigInt(0),rc=BigInt(1),a5=BigInt(2),T7e=BigInt(8),R7e={zip215:!0};function I7e(t){let e=(0,Une.validateBasic)(t);return $d.validateObject(t,{hash:"function",a:"bigint",d:"bigint",randomBytes:"function"},{adjustScalarBytes:"function",domain:"function",uvRatio:"function",mapToCurve:"function"}),Object.freeze({...e})}function k7e(t){let e=I7e(t),{Fp:r,n,prehash:i,hash:o,randomBytes:s,nByteLength:a,h:d}=e,m=a5<<BigInt(a*8)-rc,p=r.create,w=e.uvRatio||((g,f)=>{try{return{isValid:!0,value:r.sqrt(g*r.inv(f))}}catch{return{isValid:!1,value:Gf}}}),P=e.adjustScalarBytes||(g=>g),S=e.domain||((g,f,v)=>{if(f.length||v)throw new Error("Contexts/pre-hash are not supported");return g}),M=g=>typeof g=="bigint"&&Gf<g,A=(g,f)=>M(g)&&M(f)&&g<f,B=g=>g===Gf||A(g,m);function I(g,f){if(A(g,f))return g;throw new Error(`Expected valid scalar < ${f}, got ${typeof g} ${g}`)}function C(g){return g===Gf?g:I(g,n)}let k=new Map;function q(g){if(!(g instanceof L))throw new Error("ExtendedPoint expected")}class L{constructor(f,v,O,T){if(this.ex=f,this.ey=v,this.ez=O,this.et=T,!B(f))throw new Error("x required");if(!B(v))throw new Error("y required");if(!B(O))throw new Error("z required");if(!B(T))throw new Error("t required")}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static fromAffine(f){if(f instanceof L)throw new Error("extended point not allowed");let{x:v,y:O}=f||{};if(!B(v)||!B(O))throw new Error("invalid affine point");return new L(v,O,rc,p(v*O))}static normalizeZ(f){let v=r.invertBatch(f.map(O=>O.ez));return f.map((O,T)=>O.toAffine(v[T])).map(L.fromAffine)}_setWindowSize(f){this._WINDOW_SIZE=f,k.delete(this)}assertValidity(){let{a:f,d:v}=e;if(this.is0())throw new Error("bad point: ZERO");let{ex:O,ey:T,ez:R,et:z}=this,V=p(O*O),W=p(T*T),Z=p(R*R),J=p(Z*Z),X=p(V*f),Ee=p(Z*p(X+W)),re=p(J+p(v*p(V*W)));if(Ee!==re)throw new Error("bad point: equation left != right (1)");let ne=p(O*T),qe=p(R*z);if(ne!==qe)throw new Error("bad point: equation left != right (2)")}equals(f){q(f);let{ex:v,ey:O,ez:T}=this,{ex:R,ey:z,ez:V}=f,W=p(v*V),Z=p(R*T),J=p(O*V),X=p(z*T);return W===Z&&J===X}is0(){return this.equals(L.ZERO)}negate(){return new L(p(-this.ex),this.ey,this.ez,p(-this.et))}double(){let{a:f}=e,{ex:v,ey:O,ez:T}=this,R=p(v*v),z=p(O*O),V=p(a5*p(T*T)),W=p(f*R),Z=v+O,J=p(p(Z*Z)-R-z),X=W+z,Ee=X-V,re=W-z,ne=p(J*Ee),qe=p(X*re),ce=p(J*re),ye=p(Ee*X);return new L(ne,qe,ye,ce)}add(f){q(f);let{a:v,d:O}=e,{ex:T,ey:R,ez:z,et:V}=this,{ex:W,ey:Z,ez:J,et:X}=f;if(v===BigInt(-1)){let ot=p((R-T)*(Z+W)),ue=p((R+T)*(Z-W)),he=p(ue-ot);if(he===Gf)return this.double();let lt=p(z*a5*X),se=p(V*a5*J),fe=se+lt,Lt=ue+ot,ge=se-lt,ve=p(fe*he),on=p(Lt*ge),xe=p(fe*ge),Pe=p(he*Lt);return new L(ve,on,Pe,xe)}let Ee=p(T*W),re=p(R*Z),ne=p(V*O*X),qe=p(z*J),ce=p((T+R)*(W+Z)-Ee-re),ye=qe-ne,Ne=qe+ne,ie=p(re-v*Ee),oe=p(ce*ye),ze=p(Ne*ie),le=p(ce*ie),me=p(ye*Ne);return new L(oe,ze,me,le)}subtract(f){return this.add(f.negate())}wNAF(f){return N.wNAFCached(this,k,f,L.normalizeZ)}multiply(f){let{p:v,f:O}=this.wNAF(I(f,n));return L.normalizeZ([v,O])[0]}multiplyUnsafe(f){let v=C(f);return v===Gf?F:this.equals(F)||v===rc?this:this.equals(U)?this.wNAF(v).p:N.unsafeLadder(this,v)}isSmallOrder(){return this.multiplyUnsafe(d).is0()}isTorsionFree(){return N.unsafeLadder(this,n).is0()}toAffine(f){let{ex:v,ey:O,ez:T}=this,R=this.is0();f==null&&(f=R?T7e:r.inv(T));let z=p(v*f),V=p(O*f),W=p(T*f);if(R)return{x:Gf,y:rc};if(W!==rc)throw new Error("invZ was invalid");return{x:z,y:V}}clearCofactor(){let{h:f}=e;return f===rc?this:this.multiplyUnsafe(f)}static fromHex(f,v=!1){let{d:O,a:T}=e,R=r.BYTES;f=(0,xp.ensureBytes)("pointHex",f,R);let z=f.slice(),V=f[R-1];z[R-1]=V&-129;let W=$d.bytesToNumberLE(z);W===Gf||(v?I(W,m):I(W,r.ORDER));let Z=p(W*W),J=p(Z-rc),X=p(O*Z-T),{isValid:Ee,value:re}=w(J,X);if(!Ee)throw new Error("Point.fromHex: invalid y coordinate");let ne=(re&rc)===rc,qe=(V&128)!==0;if(!v&&re===Gf&&qe)throw new Error("Point.fromHex: x=0 and x_0=1");return qe!==ne&&(re=p(-re)),L.fromAffine({x:re,y:W})}static fromPrivateKey(f){return c(f).point}toRawBytes(){let{x:f,y:v}=this.toAffine(),O=$d.numberToBytesLE(v,r.BYTES);return O[O.length-1]|=f&rc?128:0,O}toHex(){return $d.bytesToHex(this.toRawBytes())}}L.BASE=new L(e.Gx,e.Gy,rc,p(e.Gx*e.Gy)),L.ZERO=new L(Gf,rc,rc,Gf);let{BASE:U,ZERO:F}=L,N=(0,Une.wNAF)(L,a*8);function G(g){return(0,A7e.mod)(g,n)}function x(g){return G($d.bytesToNumberLE(g))}function c(g){let f=a;g=(0,xp.ensureBytes)("private key",g,f);let v=(0,xp.ensureBytes)("hashed private key",o(g),2*f),O=P(v.slice(0,f)),T=v.slice(f,2*f),R=x(O),z=U.multiply(R),V=z.toRawBytes();return{head:O,prefix:T,scalar:R,point:z,pointBytes:V}}function u(g){return c(g).pointBytes}function y(g=new Uint8Array,...f){let v=$d.concatBytes(...f);return x(o(S(v,(0,xp.ensureBytes)("context",g),!!i)))}function l(g,f,v={}){g=(0,xp.ensureBytes)("message",g),i&&(g=i(g));let{prefix:O,scalar:T,pointBytes:R}=c(f),z=y(v.context,O,g),V=U.multiply(z).toRawBytes(),W=y(v.context,V,R,g),Z=G(z+W*T);C(Z);let J=$d.concatBytes(V,$d.numberToBytesLE(Z,r.BYTES));return(0,xp.ensureBytes)("result",J,a*2)}let h=R7e;function b(g,f,v,O=h){let{context:T,zip215:R}=O,z=r.BYTES;g=(0,xp.ensureBytes)("signature",g,2*z),f=(0,xp.ensureBytes)("message",f),i&&(f=i(f));let V=$d.bytesToNumberLE(g.slice(z,2*z)),W,Z,J;try{W=L.fromHex(v,R),Z=L.fromHex(g.slice(0,z),R),J=U.multiplyUnsafe(V)}catch{return!1}if(!R&&W.isSmallOrder())return!1;let X=y(T,Z.toRawBytes(),W.toRawBytes(),f);return Z.add(W.multiplyUnsafe(X)).subtract(J).clearCofactor().equals(L.ZERO)}return U._setWindowSize(8),{CURVE:e,getPublicKey:u,sign:l,verify:b,ExtendedPoint:L,utils:{getExtendedPublicKey:c,randomPrivateKey:()=>s(r.BYTES),precompute(g=8,f=L.BASE){return f._setWindowSize(g),f.multiply(BigInt(3)),f}}}}c5.twistedEdwards=k7e});var Kne=H(f5=>{"use strict";E();Object.defineProperty(f5,"__esModule",{value:!0});f5.montgomery=void 0;var zne=_p(),db=Kf(),g_=BigInt(0),TO=BigInt(1);function O7e(t){return(0,db.validateObject)(t,{a:"bigint"},{montgomeryBits:"isSafeInteger",nByteLength:"isSafeInteger",adjustScalarBytes:"function",domain:"function",powPminus2:"function",Gu:"bigint"}),Object.freeze({...t})}function B7e(t){let e=O7e(t),{P:r}=e,n=k=>(0,zne.mod)(k,r),i=e.montgomeryBits,o=Math.ceil(i/8),s=e.nByteLength,a=e.adjustScalarBytes||(k=>k),d=e.powPminus2||(k=>(0,zne.pow)(k,r-BigInt(2),r));function m(k,q,L){let U=n(k*(q-L));return q=n(q-U),L=n(L+U),[q,L]}function p(k){if(typeof k=="bigint"&&g_<=k&&k<r)return k;throw new Error("Expected valid scalar 0 < scalar < CURVE.P")}let w=(e.a-BigInt(2))/BigInt(4);function P(k,q){let L=p(k),U=p(q),F=L,N=TO,G=g_,x=L,c=TO,u=g_,y;for(let h=BigInt(i-1);h>=g_;h--){let b=U>>h&TO;u^=b,y=m(u,N,x),N=y[0],x=y[1],y=m(u,G,c),G=y[0],c=y[1],u=b;let _=N+G,g=n(_*_),f=N-G,v=n(f*f),O=g-v,T=x+c,R=x-c,z=n(R*_),V=n(T*f),W=z+V,Z=z-V;x=n(W*W),c=n(F*n(Z*Z)),N=n(g*v),G=n(O*(g+n(w*O)))}y=m(u,N,x),N=y[0],x=y[1],y=m(u,G,c),G=y[0],c=y[1];let l=d(G);return n(N*l)}function S(k){return(0,db.numberToBytesLE)(n(k),o)}function M(k){let q=(0,db.ensureBytes)("u coordinate",k,o);return s===32&&(q[31]&=127),(0,db.bytesToNumberLE)(q)}function A(k){let q=(0,db.ensureBytes)("scalar",k),L=q.length;if(L!==o&&L!==s)throw new Error(`Expected ${o} or ${s} bytes, got ${L}`);return(0,db.bytesToNumberLE)(a(q))}function B(k,q){let L=M(q),U=A(k),F=P(L,U);if(F===g_)throw new Error("Invalid private or public key received");return S(F)}let I=S(e.Gu);function C(k){return B(k,I)}return{scalarMult:B,scalarMultBase:C,getSharedSecret:(k,q)=>B(k,q),getPublicKey:k=>C(k),utils:{randomPrivateKey:()=>e.randomBytes(e.nByteLength)},GuBytes:I}}f5.montgomery=B7e});var kO=H(Hc=>{"use strict";E();Object.defineProperty(Hc,"__esModule",{value:!0});Hc.createHasher=Hc.isogenyMap=Hc.hash_to_field=Hc.expand_message_xof=Hc.expand_message_xmd=void 0;var D7e=_p(),nc=Kf();function C7e(t){if((0,nc.isBytes)(t))return t;if(typeof t=="string")return(0,nc.utf8ToBytes)(t);throw new Error("DST must be Uint8Array or string")}var j7e=nc.bytesToNumberBE;function Ep(t,e){if(t<0||t>=1<<8*e)throw new Error(`bad I2OSP call: value=${t} length=${e}`);let r=Array.from({length:e}).fill(0);for(let n=e-1;n>=0;n--)r[n]=t&255,t>>>=8;return new Uint8Array(r)}function N7e(t,e){let r=new Uint8Array(t.length);for(let n=0;n<t.length;n++)r[n]=t[n]^e[n];return r}function v_(t){if(!(0,nc.isBytes)(t))throw new Error("Uint8Array expected")}function IO(t){if(!Number.isSafeInteger(t))throw new Error("number expected")}function Gne(t,e,r,n){v_(t),v_(e),IO(r),e.length>255&&(e=n((0,nc.concatBytes)((0,nc.utf8ToBytes)("H2C-OVERSIZE-DST-"),e)));let{outputLen:i,blockLen:o}=n,s=Math.ceil(r/i);if(s>255)throw new Error("Invalid xmd length");let a=(0,nc.concatBytes)(e,Ep(e.length,1)),d=Ep(0,o),m=Ep(r,2),p=new Array(s),w=n((0,nc.concatBytes)(d,t,m,Ep(0,1),a));p[0]=n((0,nc.concatBytes)(w,Ep(1,1),a));for(let S=1;S<=s;S++){let M=[N7e(w,p[S-1]),Ep(S+1,1),a];p[S]=n((0,nc.concatBytes)(...M))}return(0,nc.concatBytes)(...p).slice(0,r)}Hc.expand_message_xmd=Gne;function Wne(t,e,r,n,i){if(v_(t),v_(e),IO(r),e.length>255){let o=Math.ceil(2*n/8);e=i.create({dkLen:o}).update((0,nc.utf8ToBytes)("H2C-OVERSIZE-DST-")).update(e).digest()}if(r>65535||e.length>255)throw new Error("expand_message_xof: invalid lenInBytes");return i.create({dkLen:r}).update(t).update(Ep(r,2)).update(e).update(Ep(e.length,1)).digest()}Hc.expand_message_xof=Wne;function RO(t,e,r){(0,nc.validateObject)(r,{DST:"stringOrUint8Array",p:"bigint",m:"isSafeInteger",k:"isSafeInteger",hash:"hash"});let{p:n,k:i,m:o,hash:s,expand:a,DST:d}=r;v_(t),IO(e);let m=C7e(d),p=n.toString(2).length,w=Math.ceil((p+i)/8),P=e*o*w,S;if(a==="xmd")S=Gne(t,m,P,s);else if(a==="xof")S=Wne(t,m,P,i,s);else if(a==="_internal_pass")S=t;else throw new Error('expand must be "xmd" or "xof"');let M=new Array(e);for(let A=0;A<e;A++){let B=new Array(o);for(let I=0;I<o;I++){let C=w*(I+A*o),k=S.subarray(C,C+w);B[I]=(0,D7e.mod)(j7e(k),n)}M[A]=B}return M}Hc.hash_to_field=RO;function q7e(t,e){let r=e.map(n=>Array.from(n).reverse());return(n,i)=>{let[o,s,a,d]=r.map(m=>m.reduce((p,w)=>t.add(t.mul(p,n),w)));return n=t.div(o,s),i=t.mul(i,t.div(a,d)),{x:n,y:i}}}Hc.isogenyMap=q7e;function $7e(t,e,r){if(typeof e!="function")throw new Error("mapToCurve() must be defined");return{hashToCurve(n,i){let o=RO(n,2,{...r,DST:r.DST,...i}),s=t.fromAffine(e(o[0])),a=t.fromAffine(e(o[1])),d=s.add(a).clearCofactor();return d.assertValidity(),d},encodeToCurve(n,i){let o=RO(n,1,{...r,DST:r.encodeDST,...i}),s=t.fromAffine(e(o[0])).clearCofactor();return s.assertValidity(),s}}}Hc.createHasher=$7e});var oie=H(Wt=>{"use strict";E();Object.defineProperty(Wt,"__esModule",{value:!0});Wt.hash_to_ristretto255=Wt.hashToRistretto255=Wt.RistrettoPoint=Wt.encodeToCurve=Wt.hashToCurve=Wt.edwardsToMontgomeryPriv=Wt.edwardsToMontgomery=Wt.edwardsToMontgomeryPub=Wt.x25519=Wt.ed25519ph=Wt.ed25519ctx=Wt.ed25519=Wt.ED25519_TORSION_SUBGROUP=void 0;var l5=Mne(),b_=Nd(),jO=Fne(),L7e=Kne(),fn=_p(),Jm=Kf(),Xne=kO(),w_=BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949"),DO=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752"),U7e=BigInt(0),tl=BigInt(1),u5=BigInt(2),F7e=BigInt(5),Vne=BigInt(10),z7e=BigInt(20),K7e=BigInt(40),Hne=BigInt(80);function eie(t){let e=w_,n=t*t%e*t%e,i=(0,fn.pow2)(n,u5,e)*n%e,o=(0,fn.pow2)(i,tl,e)*t%e,s=(0,fn.pow2)(o,F7e,e)*o%e,a=(0,fn.pow2)(s,Vne,e)*s%e,d=(0,fn.pow2)(a,z7e,e)*a%e,m=(0,fn.pow2)(d,K7e,e)*d%e,p=(0,fn.pow2)(m,Hne,e)*m%e,w=(0,fn.pow2)(p,Hne,e)*m%e,P=(0,fn.pow2)(w,Vne,e)*s%e;return{pow_p_5_8:(0,fn.pow2)(P,u5,e)*t%e,b2:n}}function tie(t){return t[0]&=248,t[31]&=127,t[31]|=64,t}function NO(t,e){let r=w_,n=(0,fn.mod)(e*e*e,r),i=(0,fn.mod)(n*n*e,r),o=eie(t*i).pow_p_5_8,s=(0,fn.mod)(t*n*o,r),a=(0,fn.mod)(e*s*s,r),d=s,m=(0,fn.mod)(s*DO,r),p=a===t,w=a===(0,fn.mod)(-t,r),P=a===(0,fn.mod)(-t*DO,r);return p&&(s=d),(w||P)&&(s=m),(0,fn.isNegativeLE)(s,r)&&(s=(0,fn.mod)(-s,r)),{isValid:p||w,value:s}}Wt.ED25519_TORSION_SUBGROUP=["0100000000000000000000000000000000000000000000000000000000000000","c7176a703d4dd84fba3c0b760d10670f2a2053fa2c39ccc64ec7fd7792ac037a","0000000000000000000000000000000000000000000000000000000000000080","26e8958fc2b227b045c3f489f2ef98f0d5dfac05d3c63339b13802886d53fc05","ecffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f","26e8958fc2b227b045c3f489f2ef98f0d5dfac05d3c63339b13802886d53fc85","0000000000000000000000000000000000000000000000000000000000000000","c7176a703d4dd84fba3c0b760d10670f2a2053fa2c39ccc64ec7fd7792ac03fa"];var Ye=(0,fn.Field)(w_,void 0,!0),__={a:BigInt(-1),d:BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),Fp:Ye,n:BigInt("7237005577332262213973186563042994240857116359379907606001950938285454250989"),h:BigInt(8),Gx:BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),Gy:BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960"),hash:l5.sha512,randomBytes:b_.randomBytes,adjustScalarBytes:tie,uvRatio:NO};Wt.ed25519=(0,jO.twistedEdwards)(__);function rie(t,e,r){if(e.length>255)throw new Error("Context is too big");return(0,b_.concatBytes)((0,b_.utf8ToBytes)("SigEd25519 no Ed25519 collisions"),new Uint8Array([r?1:0,e.length]),e,t)}Wt.ed25519ctx=(0,jO.twistedEdwards)({...__,domain:rie});Wt.ed25519ph=(0,jO.twistedEdwards)({...__,domain:rie,prehash:l5.sha512});Wt.x25519=(()=>(0,L7e.montgomery)({P:w_,a:BigInt(486662),montgomeryBits:255,nByteLength:32,Gu:BigInt(9),powPminus2:t=>{let e=w_,{pow_p_5_8:r,b2:n}=eie(t);return(0,fn.mod)((0,fn.pow2)(r,BigInt(3),e)*n,e)},adjustScalarBytes:tie,randomBytes:b_.randomBytes}))();function nie(t){let{y:e}=Wt.ed25519.ExtendedPoint.fromHex(t),r=BigInt(1);return Ye.toBytes(Ye.create((r+e)*Ye.inv(r-e)))}Wt.edwardsToMontgomeryPub=nie;Wt.edwardsToMontgomery=nie;function G7e(t){let e=__.hash(t.subarray(0,32));return __.adjustScalarBytes(e).subarray(0,32)}Wt.edwardsToMontgomeryPriv=G7e;var W7e=(Ye.ORDER+BigInt(3))/BigInt(8),V7e=Ye.pow(u5,W7e),Zne=Ye.sqrt(Ye.neg(Ye.ONE)),H7e=(Ye.ORDER-BigInt(5))/BigInt(8),Jne=BigInt(486662);function Z7e(t){let e=Ye.sqr(t);e=Ye.mul(e,u5);let r=Ye.add(e,Ye.ONE),n=Ye.neg(Jne),i=Ye.sqr(r),o=Ye.mul(i,r),s=Ye.mul(e,Jne);s=Ye.mul(s,n),s=Ye.add(s,i),s=Ye.mul(s,n);let a=Ye.sqr(o);i=Ye.sqr(a),a=Ye.mul(a,o),a=Ye.mul(a,s),i=Ye.mul(i,a);let d=Ye.pow(i,H7e);d=Ye.mul(d,a);let m=Ye.mul(d,Zne);i=Ye.sqr(d),i=Ye.mul(i,o);let p=Ye.eql(i,s),w=Ye.cmov(m,d,p),P=Ye.mul(n,e),S=Ye.mul(d,t);S=Ye.mul(S,V7e);let M=Ye.mul(S,Zne),A=Ye.mul(s,e);i=Ye.sqr(S),i=Ye.mul(i,o);let B=Ye.eql(i,A),I=Ye.cmov(M,S,B);i=Ye.sqr(w),i=Ye.mul(i,o);let C=Ye.eql(i,s),k=Ye.cmov(P,n,C),q=Ye.cmov(I,w,C),L=Ye.isOdd(q);return q=Ye.cmov(q,Ye.neg(q),C!==L),{xMn:k,xMd:r,yMn:q,yMd:tl}}var J7e=(0,fn.FpSqrtEven)(Ye,Ye.neg(BigInt(486664)));function Y7e(t){let{xMn:e,xMd:r,yMn:n,yMd:i}=Z7e(t),o=Ye.mul(e,i);o=Ye.mul(o,J7e);let s=Ye.mul(r,n),a=Ye.sub(e,r),d=Ye.add(e,r),m=Ye.mul(s,d),p=Ye.eql(m,Ye.ZERO);o=Ye.cmov(o,Ye.ZERO,p),s=Ye.cmov(s,Ye.ONE,p),a=Ye.cmov(a,Ye.ONE,p),d=Ye.cmov(d,Ye.ONE,p);let w=Ye.invertBatch([s,d]);return{x:Ye.mul(o,w[0]),y:Ye.mul(a,w[1])}}var iie=(()=>(0,Xne.createHasher)(Wt.ed25519.ExtendedPoint,t=>Y7e(t[0]),{DST:"edwards25519_XMD:SHA-512_ELL2_RO_",encodeDST:"edwards25519_XMD:SHA-512_ELL2_NU_",p:Ye.ORDER,m:1,k:128,expand:"xmd",hash:l5.sha512}))();Wt.hashToCurve=(()=>iie.hashToCurve)();Wt.encodeToCurve=(()=>iie.encodeToCurve)();function OO(t){if(!(t instanceof $i))throw new Error("RistrettoPoint expected")}var CO=DO,Q7e=BigInt("25063068953384623474111414158702152701244531502492656460079210482610430750235"),X7e=BigInt("54469307008909316920995813868745141605393597292927456921205312896311721017578"),eOe=BigInt("1159843021668779879193775521855586647937357759715417654439879720876111806838"),tOe=BigInt("40440834346308536858101042469323190826248399146238708352240133220865137265952"),Yne=t=>NO(tl,t),rOe=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),BO=t=>Wt.ed25519.CURVE.Fp.create((0,Jm.bytesToNumberLE)(t)&rOe);function Qne(t){let{d:e}=Wt.ed25519.CURVE,r=Wt.ed25519.CURVE.Fp.ORDER,n=Wt.ed25519.CURVE.Fp.create,i=n(CO*t*t),o=n((i+tl)*eOe),s=BigInt(-1),a=n((s-e*i)*n(i+e)),{isValid:d,value:m}=NO(o,a),p=n(m*t);(0,fn.isNegativeLE)(p,r)||(p=n(-p)),d||(m=p),d||(s=i);let w=n(s*(i-tl)*tOe-a),P=m*m,S=n((m+m)*a),M=n(w*Q7e),A=n(tl-P),B=n(tl+P);return new Wt.ed25519.ExtendedPoint(n(S*B),n(A*M),n(M*B),n(S*A))}var $i=class{constructor(e){this.ep=e}static fromAffine(e){return new $i(Wt.ed25519.ExtendedPoint.fromAffine(e))}static hashToCurve(e){e=(0,Jm.ensureBytes)("ristrettoHash",e,64);let r=BO(e.slice(0,32)),n=Qne(r),i=BO(e.slice(32,64)),o=Qne(i);return new $i(n.add(o))}static fromHex(e){e=(0,Jm.ensureBytes)("ristrettoHex",e,32);let{a:r,d:n}=Wt.ed25519.CURVE,i=Wt.ed25519.CURVE.Fp.ORDER,o=Wt.ed25519.CURVE.Fp.create,s="RistrettoPoint.fromHex: the hex is not valid encoding of RistrettoPoint",a=BO(e);if(!(0,Jm.equalBytes)((0,Jm.numberToBytesLE)(a,32),e)||(0,fn.isNegativeLE)(a,i))throw new Error(s);let d=o(a*a),m=o(tl+r*d),p=o(tl-r*d),w=o(m*m),P=o(p*p),S=o(r*n*w-P),{isValid:M,value:A}=Yne(o(S*P)),B=o(A*p),I=o(A*B*S),C=o((a+a)*B);(0,fn.isNegativeLE)(C,i)&&(C=o(-C));let k=o(m*I),q=o(C*k);if(!M||(0,fn.isNegativeLE)(q,i)||k===U7e)throw new Error(s);return new $i(new Wt.ed25519.ExtendedPoint(C,k,tl,q))}toRawBytes(){let{ex:e,ey:r,ez:n,et:i}=this.ep,o=Wt.ed25519.CURVE.Fp.ORDER,s=Wt.ed25519.CURVE.Fp.create,a=s(s(n+r)*s(n-r)),d=s(e*r),m=s(d*d),{value:p}=Yne(s(a*m)),w=s(p*a),P=s(p*d),S=s(w*P*i),M;if((0,fn.isNegativeLE)(i*S,o)){let B=s(r*CO),I=s(e*CO);e=B,r=I,M=s(w*X7e)}else M=P;(0,fn.isNegativeLE)(e*S,o)&&(r=s(-r));let A=s((n-r)*M);return(0,fn.isNegativeLE)(A,o)&&(A=s(-A)),(0,Jm.numberToBytesLE)(A,32)}toHex(){return(0,Jm.bytesToHex)(this.toRawBytes())}toString(){return this.toHex()}equals(e){OO(e);let{ex:r,ey:n}=this.ep,{ex:i,ey:o}=e.ep,s=Wt.ed25519.CURVE.Fp.create,a=s(r*o)===s(n*i),d=s(n*o)===s(r*i);return a||d}add(e){return OO(e),new $i(this.ep.add(e.ep))}subtract(e){return OO(e),new $i(this.ep.subtract(e.ep))}multiply(e){return new $i(this.ep.multiply(e))}multiplyUnsafe(e){return new $i(this.ep.multiplyUnsafe(e))}double(){return new $i(this.ep.double())}negate(){return new $i(this.ep.negate())}};Wt.RistrettoPoint=(()=>($i.BASE||($i.BASE=new $i(Wt.ed25519.ExtendedPoint.BASE)),$i.ZERO||($i.ZERO=new $i(Wt.ed25519.ExtendedPoint.ZERO)),$i))();var nOe=(t,e)=>{let r=e.DST,n=typeof r=="string"?(0,b_.utf8ToBytes)(r):r,i=(0,Xne.expand_message_xmd)(t,n,64,l5.sha512);return $i.hashToCurve(i)};Wt.hashToRistretto255=nOe;Wt.hash_to_ristretto255=Wt.hashToRistretto255});var $O=H(hb=>{"use strict";E();Object.defineProperty(hb,"__esModule",{value:!0});hb.sha224=hb.sha256=void 0;var iOe=pO(),Zc=Nd(),oOe=(t,e,r)=>t&e^~t&r,sOe=(t,e,r)=>t&e^t&r^e&r,aOe=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),Sp=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Mp=new Uint32Array(64),d5=class extends iOe.SHA2{constructor(){super(64,32,8,!1),this.A=Sp[0]|0,this.B=Sp[1]|0,this.C=Sp[2]|0,this.D=Sp[3]|0,this.E=Sp[4]|0,this.F=Sp[5]|0,this.G=Sp[6]|0,this.H=Sp[7]|0}get(){let{A:e,B:r,C:n,D:i,E:o,F:s,G:a,H:d}=this;return[e,r,n,i,o,s,a,d]}set(e,r,n,i,o,s,a,d){this.A=e|0,this.B=r|0,this.C=n|0,this.D=i|0,this.E=o|0,this.F=s|0,this.G=a|0,this.H=d|0}process(e,r){for(let w=0;w<16;w++,r+=4)Mp[w]=e.getUint32(r,!1);for(let w=16;w<64;w++){let P=Mp[w-15],S=Mp[w-2],M=(0,Zc.rotr)(P,7)^(0,Zc.rotr)(P,18)^P>>>3,A=(0,Zc.rotr)(S,17)^(0,Zc.rotr)(S,19)^S>>>10;Mp[w]=A+Mp[w-7]+M+Mp[w-16]|0}let{A:n,B:i,C:o,D:s,E:a,F:d,G:m,H:p}=this;for(let w=0;w<64;w++){let P=(0,Zc.rotr)(a,6)^(0,Zc.rotr)(a,11)^(0,Zc.rotr)(a,25),S=p+P+oOe(a,d,m)+aOe[w]+Mp[w]|0,A=((0,Zc.rotr)(n,2)^(0,Zc.rotr)(n,13)^(0,Zc.rotr)(n,22))+sOe(n,i,o)|0;p=m,m=d,d=a,a=s+S|0,s=o,o=i,i=n,n=S+A|0}n=n+this.A|0,i=i+this.B|0,o=o+this.C|0,s=s+this.D|0,a=a+this.E|0,d=d+this.F|0,m=m+this.G|0,p=p+this.H|0,this.set(n,i,o,s,a,d,m,p)}roundClean(){Mp.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}},qO=class extends d5{constructor(){super(),this.A=-1056596264,this.B=914150663,this.C=812702999,this.D=-150054599,this.E=-4191439,this.F=1750603025,this.G=1694076839,this.H=-1090891868,this.outputLen=28}};hb.sha256=(0,Zc.wrapConstructor)(()=>new d5);hb.sha224=(0,Zc.wrapConstructor)(()=>new qO)});var UO=H(uo=>{"use strict";E();Object.defineProperty(uo,"__esModule",{value:!0});uo.mapToCurveSimpleSWU=uo.SWUFpSqrtRatio=uo.weierstrass=uo.weierstrassPoints=uo.DER=void 0;var pb=_p(),si=Kf(),rl=Kf(),LO=AO();function cOe(t){let e=(0,LO.validateBasic)(t);si.validateObject(e,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});let{endo:r,Fp:n,a:i}=e;if(r){if(!n.eql(i,n.ZERO))throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0");if(typeof r!="object"||typeof r.beta!="bigint"||typeof r.splitScalar!="function")throw new Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze({...e})}var{bytesToNumberBE:fOe,hexToBytes:uOe}=si;uo.DER={Err:class extends Error{constructor(e=""){super(e)}},_parseInt(t){let{Err:e}=uo.DER;if(t.length<2||t[0]!==2)throw new e("Invalid signature integer tag");let r=t[1],n=t.subarray(2,r+2);if(!r||n.length!==r)throw new e("Invalid signature integer: wrong length");if(n[0]&128)throw new e("Invalid signature integer: negative");if(n[0]===0&&!(n[1]&128))throw new e("Invalid signature integer: unnecessary leading zero");return{d:fOe(n),l:t.subarray(r+2)}},toSig(t){let{Err:e}=uo.DER,r=typeof t=="string"?uOe(t):t;if(!si.isBytes(r))throw new Error("ui8a expected");let n=r.length;if(n<2||r[0]!=48)throw new e("Invalid signature tag");if(r[1]!==n-2)throw new e("Invalid signature: incorrect length");let{d:i,l:o}=uo.DER._parseInt(r.subarray(2)),{d:s,l:a}=uo.DER._parseInt(o);if(a.length)throw new e("Invalid signature: left bytes after parsing");return{r:i,s}},hexFromSig(t){let e=m=>Number.parseInt(m[0],16)&8?"00"+m:m,r=m=>{let p=m.toString(16);return p.length&1?`0${p}`:p},n=e(r(t.s)),i=e(r(t.r)),o=n.length/2,s=i.length/2,a=r(o),d=r(s);return`30${r(s+o+4)}02${d}${i}02${a}${n}`}};var Wf=BigInt(0),Ri=BigInt(1),Pp=BigInt(2),h5=BigInt(3),sie=BigInt(4);function aie(t){let e=cOe(t),{Fp:r}=e,n=e.toBytes||((M,A,B)=>{let I=A.toAffine();return si.concatBytes(Uint8Array.from([4]),r.toBytes(I.x),r.toBytes(I.y))}),i=e.fromBytes||(M=>{let A=M.subarray(1),B=r.fromBytes(A.subarray(0,r.BYTES)),I=r.fromBytes(A.subarray(r.BYTES,2*r.BYTES));return{x:B,y:I}});function o(M){let{a:A,b:B}=e,I=r.sqr(M),C=r.mul(I,M);return r.add(r.add(C,r.mul(M,A)),B)}if(!r.eql(r.sqr(e.Gy),o(e.Gx)))throw new Error("bad generator point: equation left != right");function s(M){return typeof M=="bigint"&&Wf<M&&M<e.n}function a(M){if(!s(M))throw new Error("Expected valid bigint: 0 < bigint < curve.n")}function d(M){let{allowedPrivateKeyLengths:A,nByteLength:B,wrapPrivateKey:I,n:C}=e;if(A&&typeof M!="bigint"){if(si.isBytes(M)&&(M=si.bytesToHex(M)),typeof M!="string"||!A.includes(M.length))throw new Error("Invalid key");M=M.padStart(B*2,"0")}let k;try{k=typeof M=="bigint"?M:si.bytesToNumberBE((0,rl.ensureBytes)("private key",M,B))}catch{throw new Error(`private key must be ${B} bytes, hex or bigint, not ${typeof M}`)}return I&&(k=pb.mod(k,C)),a(k),k}let m=new Map;function p(M){if(!(M instanceof w))throw new Error("ProjectivePoint expected")}class w{constructor(A,B,I){if(this.px=A,this.py=B,this.pz=I,A==null||!r.isValid(A))throw new Error("x required");if(B==null||!r.isValid(B))throw new Error("y required");if(I==null||!r.isValid(I))throw new Error("z required")}static fromAffine(A){let{x:B,y:I}=A||{};if(!A||!r.isValid(B)||!r.isValid(I))throw new Error("invalid affine point");if(A instanceof w)throw new Error("projective point not allowed");let C=k=>r.eql(k,r.ZERO);return C(B)&&C(I)?w.ZERO:new w(B,I,r.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(A){let B=r.invertBatch(A.map(I=>I.pz));return A.map((I,C)=>I.toAffine(B[C])).map(w.fromAffine)}static fromHex(A){let B=w.fromAffine(i((0,rl.ensureBytes)("pointHex",A)));return B.assertValidity(),B}static fromPrivateKey(A){return w.BASE.multiply(d(A))}_setWindowSize(A){this._WINDOW_SIZE=A,m.delete(this)}assertValidity(){if(this.is0()){if(e.allowInfinityPoint&&!r.is0(this.py))return;throw new Error("bad point: ZERO")}let{x:A,y:B}=this.toAffine();if(!r.isValid(A)||!r.isValid(B))throw new Error("bad point: x or y not FE");let I=r.sqr(B),C=o(A);if(!r.eql(I,C))throw new Error("bad point: equation left != right");if(!this.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){let{y:A}=this.toAffine();if(r.isOdd)return!r.isOdd(A);throw new Error("Field doesn't support isOdd")}equals(A){p(A);let{px:B,py:I,pz:C}=this,{px:k,py:q,pz:L}=A,U=r.eql(r.mul(B,L),r.mul(k,C)),F=r.eql(r.mul(I,L),r.mul(q,C));return U&&F}negate(){return new w(this.px,r.neg(this.py),this.pz)}double(){let{a:A,b:B}=e,I=r.mul(B,h5),{px:C,py:k,pz:q}=this,L=r.ZERO,U=r.ZERO,F=r.ZERO,N=r.mul(C,C),G=r.mul(k,k),x=r.mul(q,q),c=r.mul(C,k);return c=r.add(c,c),F=r.mul(C,q),F=r.add(F,F),L=r.mul(A,F),U=r.mul(I,x),U=r.add(L,U),L=r.sub(G,U),U=r.add(G,U),U=r.mul(L,U),L=r.mul(c,L),F=r.mul(I,F),x=r.mul(A,x),c=r.sub(N,x),c=r.mul(A,c),c=r.add(c,F),F=r.add(N,N),N=r.add(F,N),N=r.add(N,x),N=r.mul(N,c),U=r.add(U,N),x=r.mul(k,q),x=r.add(x,x),N=r.mul(x,c),L=r.sub(L,N),F=r.mul(x,G),F=r.add(F,F),F=r.add(F,F),new w(L,U,F)}add(A){p(A);let{px:B,py:I,pz:C}=this,{px:k,py:q,pz:L}=A,U=r.ZERO,F=r.ZERO,N=r.ZERO,G=e.a,x=r.mul(e.b,h5),c=r.mul(B,k),u=r.mul(I,q),y=r.mul(C,L),l=r.add(B,I),h=r.add(k,q);l=r.mul(l,h),h=r.add(c,u),l=r.sub(l,h),h=r.add(B,C);let b=r.add(k,L);return h=r.mul(h,b),b=r.add(c,y),h=r.sub(h,b),b=r.add(I,C),U=r.add(q,L),b=r.mul(b,U),U=r.add(u,y),b=r.sub(b,U),N=r.mul(G,h),U=r.mul(x,y),N=r.add(U,N),U=r.sub(u,N),N=r.add(u,N),F=r.mul(U,N),u=r.add(c,c),u=r.add(u,c),y=r.mul(G,y),h=r.mul(x,h),u=r.add(u,y),y=r.sub(c,y),y=r.mul(G,y),h=r.add(h,y),c=r.mul(u,h),F=r.add(F,c),c=r.mul(b,h),U=r.mul(l,U),U=r.sub(U,c),c=r.mul(l,u),N=r.mul(b,N),N=r.add(N,c),new w(U,F,N)}subtract(A){return this.add(A.negate())}is0(){return this.equals(w.ZERO)}wNAF(A){return S.wNAFCached(this,m,A,B=>{let I=r.invertBatch(B.map(C=>C.pz));return B.map((C,k)=>C.toAffine(I[k])).map(w.fromAffine)})}multiplyUnsafe(A){let B=w.ZERO;if(A===Wf)return B;if(a(A),A===Ri)return this;let{endo:I}=e;if(!I)return S.unsafeLadder(this,A);let{k1neg:C,k1:k,k2neg:q,k2:L}=I.splitScalar(A),U=B,F=B,N=this;for(;k>Wf||L>Wf;)k&Ri&&(U=U.add(N)),L&Ri&&(F=F.add(N)),N=N.double(),k>>=Ri,L>>=Ri;return C&&(U=U.negate()),q&&(F=F.negate()),F=new w(r.mul(F.px,I.beta),F.py,F.pz),U.add(F)}multiply(A){a(A);let B=A,I,C,{endo:k}=e;if(k){let{k1neg:q,k1:L,k2neg:U,k2:F}=k.splitScalar(B),{p:N,f:G}=this.wNAF(L),{p:x,f:c}=this.wNAF(F);N=S.constTimeNegate(q,N),x=S.constTimeNegate(U,x),x=new w(r.mul(x.px,k.beta),x.py,x.pz),I=N.add(x),C=G.add(c)}else{let{p:q,f:L}=this.wNAF(B);I=q,C=L}return w.normalizeZ([I,C])[0]}multiplyAndAddUnsafe(A,B,I){let C=w.BASE,k=(L,U)=>U===Wf||U===Ri||!L.equals(C)?L.multiplyUnsafe(U):L.multiply(U),q=k(this,B).add(k(A,I));return q.is0()?void 0:q}toAffine(A){let{px:B,py:I,pz:C}=this,k=this.is0();A==null&&(A=k?r.ONE:r.inv(C));let q=r.mul(B,A),L=r.mul(I,A),U=r.mul(C,A);if(k)return{x:r.ZERO,y:r.ZERO};if(!r.eql(U,r.ONE))throw new Error("invZ was invalid");return{x:q,y:L}}isTorsionFree(){let{h:A,isTorsionFree:B}=e;if(A===Ri)return!0;if(B)return B(w,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){let{h:A,clearCofactor:B}=e;return A===Ri?this:B?B(w,this):this.multiplyUnsafe(e.h)}toRawBytes(A=!0){return this.assertValidity(),n(w,this,A)}toHex(A=!0){return si.bytesToHex(this.toRawBytes(A))}}w.BASE=new w(e.Gx,e.Gy,r.ONE),w.ZERO=new w(r.ZERO,r.ONE,r.ZERO);let P=e.nBitLength,S=(0,LO.wNAF)(w,e.endo?Math.ceil(P/2):P);return{CURVE:e,ProjectivePoint:w,normPrivateKeyToScalar:d,weierstrassEquation:o,isWithinCurveOrder:s}}uo.weierstrassPoints=aie;function lOe(t){let e=(0,LO.validateBasic)(t);return si.validateObject(e,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...e})}function dOe(t){let e=lOe(t),{Fp:r,n}=e,i=r.BYTES+1,o=2*r.BYTES+1;function s(h){return Wf<h&&h<r.ORDER}function a(h){return pb.mod(h,n)}function d(h){return pb.invert(h,n)}let{ProjectivePoint:m,normPrivateKeyToScalar:p,weierstrassEquation:w,isWithinCurveOrder:P}=aie({...e,toBytes(h,b,_){let g=b.toAffine(),f=r.toBytes(g.x),v=si.concatBytes;return _?v(Uint8Array.from([b.hasEvenY()?2:3]),f):v(Uint8Array.from([4]),f,r.toBytes(g.y))},fromBytes(h){let b=h.length,_=h[0],g=h.subarray(1);if(b===i&&(_===2||_===3)){let f=si.bytesToNumberBE(g);if(!s(f))throw new Error("Point is not on curve");let v=w(f),O=r.sqrt(v),T=(O&Ri)===Ri;return(_&1)===1!==T&&(O=r.neg(O)),{x:f,y:O}}else if(b===o&&_===4){let f=r.fromBytes(g.subarray(0,r.BYTES)),v=r.fromBytes(g.subarray(r.BYTES,2*r.BYTES));return{x:f,y:v}}else throw new Error(`Point of length ${b} was invalid. Expected ${i} compressed bytes or ${o} uncompressed bytes`)}}),S=h=>si.bytesToHex(si.numberToBytesBE(h,e.nByteLength));function M(h){let b=n>>Ri;return h>b}function A(h){return M(h)?a(-h):h}let B=(h,b,_)=>si.bytesToNumberBE(h.slice(b,_));class I{constructor(b,_,g){this.r=b,this.s=_,this.recovery=g,this.assertValidity()}static fromCompact(b){let _=e.nByteLength;return b=(0,rl.ensureBytes)("compactSignature",b,_*2),new I(B(b,0,_),B(b,_,2*_))}static fromDER(b){let{r:_,s:g}=uo.DER.toSig((0,rl.ensureBytes)("DER",b));return new I(_,g)}assertValidity(){if(!P(this.r))throw new Error("r must be 0 < r < CURVE.n");if(!P(this.s))throw new Error("s must be 0 < s < CURVE.n")}addRecoveryBit(b){return new I(this.r,this.s,b)}recoverPublicKey(b){let{r:_,s:g,recovery:f}=this,v=F((0,rl.ensureBytes)("msgHash",b));if(f==null||![0,1,2,3].includes(f))throw new Error("recovery id invalid");let O=f===2||f===3?_+e.n:_;if(O>=r.ORDER)throw new Error("recovery id 2 or 3 invalid");let T=f&1?"03":"02",R=m.fromHex(T+S(O)),z=d(O),V=a(-v*z),W=a(g*z),Z=m.BASE.multiplyAndAddUnsafe(R,V,W);if(!Z)throw new Error("point at infinify");return Z.assertValidity(),Z}hasHighS(){return M(this.s)}normalizeS(){return this.hasHighS()?new I(this.r,a(-this.s),this.recovery):this}toDERRawBytes(){return si.hexToBytes(this.toDERHex())}toDERHex(){return uo.DER.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return si.hexToBytes(this.toCompactHex())}toCompactHex(){return S(this.r)+S(this.s)}}let C={isValidPrivateKey(h){try{return p(h),!0}catch{return!1}},normPrivateKeyToScalar:p,randomPrivateKey:()=>{let h=pb.getMinHashLength(e.n);return pb.mapHashToField(e.randomBytes(h),e.n)},precompute(h=8,b=m.BASE){return b._setWindowSize(h),b.multiply(BigInt(3)),b}};function k(h,b=!0){return m.fromPrivateKey(h).toRawBytes(b)}function q(h){let b=si.isBytes(h),_=typeof h=="string",g=(b||_)&&h.length;return b?g===i||g===o:_?g===2*i||g===2*o:h instanceof m}function L(h,b,_=!0){if(q(h))throw new Error("first arg must be private key");if(!q(b))throw new Error("second arg must be public key");return m.fromHex(b).multiply(p(h)).toRawBytes(_)}let U=e.bits2int||function(h){let b=si.bytesToNumberBE(h),_=h.length*8-e.nBitLength;return _>0?b>>BigInt(_):b},F=e.bits2int_modN||function(h){return a(U(h))},N=si.bitMask(e.nBitLength);function G(h){if(typeof h!="bigint")throw new Error("bigint expected");if(!(Wf<=h&&h<N))throw new Error(`bigint expected < 2^${e.nBitLength}`);return si.numberToBytesBE(h,e.nByteLength)}function x(h,b,_=c){if(["recovered","canonical"].some(X=>X in _))throw new Error("sign() legacy options not supported");let{hash:g,randomBytes:f}=e,{lowS:v,prehash:O,extraEntropy:T}=_;v==null&&(v=!0),h=(0,rl.ensureBytes)("msgHash",h),O&&(h=(0,rl.ensureBytes)("prehashed msgHash",g(h)));let R=F(h),z=p(b),V=[G(z),G(R)];if(T!=null){let X=T===!0?f(r.BYTES):T;V.push((0,rl.ensureBytes)("extraEntropy",X))}let W=si.concatBytes(...V),Z=R;function J(X){let Ee=U(X);if(!P(Ee))return;let re=d(Ee),ne=m.BASE.multiply(Ee).toAffine(),qe=a(ne.x);if(qe===Wf)return;let ce=a(re*a(Z+qe*z));if(ce===Wf)return;let ye=(ne.x===qe?0:2)|Number(ne.y&Ri),Ne=ce;return v&&M(ce)&&(Ne=A(ce),ye^=1),new I(qe,Ne,ye)}return{seed:W,k2sig:J}}let c={lowS:e.lowS,prehash:!1},u={lowS:e.lowS,prehash:!1};function y(h,b,_=c){let{seed:g,k2sig:f}=x(h,b,_),v=e;return si.createHmacDrbg(v.hash.outputLen,v.nByteLength,v.hmac)(g,f)}m.BASE._setWindowSize(8);function l(h,b,_,g=u){let f=h;if(b=(0,rl.ensureBytes)("msgHash",b),_=(0,rl.ensureBytes)("publicKey",_),"strict"in g)throw new Error("options.strict was renamed to lowS");let{lowS:v,prehash:O}=g,T,R;try{if(typeof f=="string"||si.isBytes(f))try{T=I.fromDER(f)}catch(ne){if(!(ne instanceof uo.DER.Err))throw ne;T=I.fromCompact(f)}else if(typeof f=="object"&&typeof f.r=="bigint"&&typeof f.s=="bigint"){let{r:ne,s:qe}=f;T=new I(ne,qe)}else throw new Error("PARSE");R=m.fromHex(_)}catch(ne){if(ne.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(v&&T.hasHighS())return!1;O&&(b=e.hash(b));let{r:z,s:V}=T,W=F(b),Z=d(V),J=a(W*Z),X=a(z*Z),Ee=m.BASE.multiplyAndAddUnsafe(R,J,X)?.toAffine();return Ee?a(Ee.x)===z:!1}return{CURVE:e,getPublicKey:k,getSharedSecret:L,sign:y,verify:l,ProjectivePoint:m,Signature:I,utils:C}}uo.weierstrass=dOe;function cie(t,e){let r=t.ORDER,n=Wf;for(let M=r-Ri;M%Pp===Wf;M/=Pp)n+=Ri;let i=n,o=Pp<<i-Ri-Ri,s=o*Pp,a=(r-Ri)/s,d=(a-Ri)/Pp,m=s-Ri,p=o,w=t.pow(e,a),P=t.pow(e,(a+Ri)/Pp),S=(M,A)=>{let B=w,I=t.pow(A,m),C=t.sqr(I);C=t.mul(C,A);let k=t.mul(M,C);k=t.pow(k,d),k=t.mul(k,I),I=t.mul(k,A),C=t.mul(k,M);let q=t.mul(C,I);k=t.pow(q,p);let L=t.eql(k,t.ONE);I=t.mul(C,P),k=t.mul(q,B),C=t.cmov(I,C,L),q=t.cmov(k,q,L);for(let U=i;U>Ri;U--){let F=U-Pp;F=Pp<<F-Ri;let N=t.pow(q,F),G=t.eql(N,t.ONE);I=t.mul(C,B),B=t.mul(B,B),N=t.mul(q,B),C=t.cmov(I,C,G),q=t.cmov(N,q,G)}return{isValid:L,value:C}};if(t.ORDER%sie===h5){let M=(t.ORDER-h5)/sie,A=t.sqrt(t.neg(e));S=(B,I)=>{let C=t.sqr(I),k=t.mul(B,I);C=t.mul(C,k);let q=t.pow(C,M);q=t.mul(q,k);let L=t.mul(q,A),U=t.mul(t.sqr(q),I),F=t.eql(U,B),N=t.cmov(L,q,F);return{isValid:F,value:N}}}return S}uo.SWUFpSqrtRatio=cie;function hOe(t,e){if(pb.validateField(t),!t.isValid(e.A)||!t.isValid(e.B)||!t.isValid(e.Z))throw new Error("mapToCurveSimpleSWU: invalid opts");let r=cie(t,e.Z);if(!t.isOdd)throw new Error("Fp.isOdd is not implemented!");return n=>{let i,o,s,a,d,m,p,w;i=t.sqr(n),i=t.mul(i,e.Z),o=t.sqr(i),o=t.add(o,i),s=t.add(o,t.ONE),s=t.mul(s,e.B),a=t.cmov(e.Z,t.neg(o),!t.eql(o,t.ZERO)),a=t.mul(a,e.A),o=t.sqr(s),m=t.sqr(a),d=t.mul(m,e.A),o=t.add(o,d),o=t.mul(o,s),m=t.mul(m,a),d=t.mul(m,e.B),o=t.add(o,d),p=t.mul(i,s);let{isValid:P,value:S}=r(o,m);w=t.mul(i,n),w=t.mul(w,S),p=t.cmov(p,s,P),w=t.cmov(w,S,P);let M=t.isOdd(n)===t.isOdd(w);return w=t.cmov(t.neg(w),w,M),p=t.div(p,a),{x:p,y:w}}}uo.mapToCurveSimpleSWU=hOe});var FO=H(Ym=>{"use strict";E();Object.defineProperty(Ym,"__esModule",{value:!0});Ym.hmac=Ym.HMAC=void 0;var p5=QM(),fie=Nd(),x_=class extends fie.Hash{constructor(e,r){super(),this.finished=!1,this.destroyed=!1,(0,p5.hash)(e);let n=(0,fie.toBytes)(r);if(this.iHash=e.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;let i=this.blockLen,o=new Uint8Array(i);o.set(n.length>i?e.create().update(n).digest():n);for(let s=0;s<o.length;s++)o[s]^=54;this.iHash.update(o),this.oHash=e.create();for(let s=0;s<o.length;s++)o[s]^=106;this.oHash.update(o),o.fill(0)}update(e){return(0,p5.exists)(this),this.iHash.update(e),this}digestInto(e){(0,p5.exists)(this),(0,p5.bytes)(e,this.outputLen),this.finished=!0,this.iHash.digestInto(e),this.oHash.update(e),this.oHash.digestInto(e),this.destroy()}digest(){let e=new Uint8Array(this.oHash.outputLen);return this.digestInto(e),e}_cloneInto(e){e||(e=Object.create(Object.getPrototypeOf(this),{}));let{oHash:r,iHash:n,finished:i,destroyed:o,blockLen:s,outputLen:a}=this;return e=e,e.finished=i,e.destroyed=o,e.blockLen=s,e.outputLen=a,e.oHash=r._cloneInto(e.oHash),e.iHash=n._cloneInto(e.iHash),e}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}};Ym.HMAC=x_;var pOe=(t,e,r)=>new x_(t,e).update(r).digest();Ym.hmac=pOe;Ym.hmac.create=(t,e)=>new x_(t,e)});var die=H(mb=>{"use strict";E();Object.defineProperty(mb,"__esModule",{value:!0});mb.createCurve=mb.getHash=void 0;var mOe=FO(),uie=Nd(),yOe=UO();function lie(t){return{hash:t,hmac:(e,...r)=>(0,mOe.hmac)(t,e,(0,uie.concatBytes)(...r)),randomBytes:uie.randomBytes}}mb.getHash=lie;function gOe(t,e){let r=n=>(0,yOe.weierstrass)({...t,...lie(n)});return Object.freeze({...r(e),create:r})}mb.createCurve=gOe});var Eie=H(Pa=>{"use strict";E();Object.defineProperty(Pa,"__esModule",{value:!0});Pa.encodeToCurve=Pa.hashToCurve=Pa.schnorr=Pa.secp256k1=void 0;var m5=$O(),vOe=Nd(),Bo=_p(),bOe=UO(),js=Kf(),mie=kO(),wOe=die(),b5=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),y5=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),yie=BigInt(1),g5=BigInt(2),hie=(t,e)=>(t+e/g5)/e;function gie(t){let e=b5,r=BigInt(3),n=BigInt(6),i=BigInt(11),o=BigInt(22),s=BigInt(23),a=BigInt(44),d=BigInt(88),m=t*t*t%e,p=m*m*t%e,w=(0,Bo.pow2)(p,r,e)*p%e,P=(0,Bo.pow2)(w,r,e)*p%e,S=(0,Bo.pow2)(P,g5,e)*m%e,M=(0,Bo.pow2)(S,i,e)*S%e,A=(0,Bo.pow2)(M,o,e)*M%e,B=(0,Bo.pow2)(A,a,e)*A%e,I=(0,Bo.pow2)(B,d,e)*B%e,C=(0,Bo.pow2)(I,a,e)*A%e,k=(0,Bo.pow2)(C,r,e)*p%e,q=(0,Bo.pow2)(k,s,e)*M%e,L=(0,Bo.pow2)(q,n,e)*m%e,U=(0,Bo.pow2)(L,g5,e);if(!Ap.eql(Ap.sqr(U),t))throw new Error("Cannot find square root");return U}var Ap=(0,Bo.Field)(b5,void 0,void 0,{sqrt:gie});Pa.secp256k1=(0,wOe.createCurve)({a:BigInt(0),b:BigInt(7),Fp:Ap,n:y5,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:t=>{let e=y5,r=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),n=-yie*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),i=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),o=r,s=BigInt("0x100000000000000000000000000000000"),a=hie(o*t,e),d=hie(-n*t,e),m=(0,Bo.mod)(t-a*r-d*i,e),p=(0,Bo.mod)(-a*n-d*o,e),w=m>s,P=p>s;if(w&&(m=e-m),P&&(p=e-p),m>s||p>s)throw new Error("splitScalar: Endomorphism failed, k="+t);return{k1neg:w,k1:m,k2neg:P,k2:p}}}},m5.sha256);var w5=BigInt(0),vie=t=>typeof t=="bigint"&&w5<t&&t<b5,_Oe=t=>typeof t=="bigint"&&w5<t&&t<y5,pie={};function v5(t,...e){let r=pie[t];if(r===void 0){let n=(0,m5.sha256)(Uint8Array.from(t,i=>i.charCodeAt(0)));r=(0,js.concatBytes)(n,n),pie[t]=r}return(0,m5.sha256)((0,js.concatBytes)(r,...e))}var WO=t=>t.toRawBytes(!0).slice(1),KO=t=>(0,js.numberToBytesBE)(t,32),zO=t=>(0,Bo.mod)(t,b5),E_=t=>(0,Bo.mod)(t,y5),VO=Pa.secp256k1.ProjectivePoint,xOe=(t,e,r)=>VO.BASE.multiplyAndAddUnsafe(t,e,r);function GO(t){let e=Pa.secp256k1.utils.normPrivateKeyToScalar(t),r=VO.fromPrivateKey(e);return{scalar:r.hasEvenY()?e:E_(-e),bytes:WO(r)}}function bie(t){if(!vie(t))throw new Error("bad x: need 0 < x < p");let e=zO(t*t),r=zO(e*t+BigInt(7)),n=gie(r);n%g5!==w5&&(n=zO(-n));let i=new VO(t,n,yie);return i.assertValidity(),i}function wie(...t){return E_((0,js.bytesToNumberBE)(v5("BIP0340/challenge",...t)))}function EOe(t){return GO(t).bytes}function SOe(t,e,r=(0,vOe.randomBytes)(32)){let n=(0,js.ensureBytes)("message",t),{bytes:i,scalar:o}=GO(e),s=(0,js.ensureBytes)("auxRand",r,32),a=KO(o^(0,js.bytesToNumberBE)(v5("BIP0340/aux",s))),d=v5("BIP0340/nonce",a,i,n),m=E_((0,js.bytesToNumberBE)(d));if(m===w5)throw new Error("sign failed: k is zero");let{bytes:p,scalar:w}=GO(m),P=wie(p,i,n),S=new Uint8Array(64);if(S.set(p,0),S.set(KO(E_(w+P*o)),32),!_ie(S,n,i))throw new Error("sign: Invalid signature produced");return S}function _ie(t,e,r){let n=(0,js.ensureBytes)("signature",t,64),i=(0,js.ensureBytes)("message",e),o=(0,js.ensureBytes)("publicKey",r,32);try{let s=bie((0,js.bytesToNumberBE)(o)),a=(0,js.bytesToNumberBE)(n.subarray(0,32));if(!vie(a))return!1;let d=(0,js.bytesToNumberBE)(n.subarray(32,64));if(!_Oe(d))return!1;let m=wie(KO(a),WO(s),i),p=xOe(s,d,E_(-m));return!(!p||!p.hasEvenY()||p.toAffine().x!==a)}catch{return!1}}Pa.schnorr=(()=>({getPublicKey:EOe,sign:SOe,verify:_ie,utils:{randomPrivateKey:Pa.secp256k1.utils.randomPrivateKey,lift_x:bie,pointToBytes:WO,numberToBytesBE:js.numberToBytesBE,bytesToNumberBE:js.bytesToNumberBE,taggedHash:v5,mod:Bo.mod}}))();var MOe=(()=>(0,mie.isogenyMap)(Ap,[["0x8e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38daaaaa8c7","0x7d3d4c80bc321d5b9f315cea7fd44c5d595d2fc0bf63b92dfff1044f17c6581","0x534c328d23f234e6e2a413deca25caece4506144037c40314ecbd0b53d9dd262","0x8e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38daaaaa88c"],["0xd35771193d94918a9ca34ccbb7b640dd86cd409542f8487d9fe6b745781eb49b","0xedadc6f64383dc1df7c4b2d51b54225406d36b641f5e41bbc52a56612a8c6d14","0x0000000000000000000000000000000000000000000000000000000000000001"],["0x4bda12f684bda12f684bda12f684bda12f684bda12f684bda12f684b8e38e23c","0xc75e0c32d5cb7c0fa9d0a54b12a0a6d5647ab046d686da6fdffc90fc201d71a3","0x29a6194691f91a73715209ef6512e576722830a201be2018a765e85a9ecee931","0x2f684bda12f684bda12f684bda12f684bda12f684bda12f684bda12f38e38d84"],["0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffff93b","0x7a06534bb8bdb49fd5e9e6632722c2989467c1bfc8e8d978dfb425d2685c2573","0x6484aa716545ca2cf3a70c3fa8fe337e0a3d21162f0d6299a7bf8192bfd2a76f","0x0000000000000000000000000000000000000000000000000000000000000001"]].map(t=>t.map(e=>BigInt(e)))))(),POe=(()=>(0,bOe.mapToCurveSimpleSWU)(Ap,{A:BigInt("0x3f8731abdd661adca08a5558f0f5d272e953d363cb6f0e5d405447c01a444533"),B:BigInt("1771"),Z:Ap.create(BigInt("-11"))}))(),xie=(()=>(0,mie.createHasher)(Pa.secp256k1.ProjectivePoint,t=>{let{x:e,y:r}=POe(Ap.create(t[0]));return MOe(e,r)},{DST:"secp256k1_XMD:SHA-256_SSWU_RO_",encodeDST:"secp256k1_XMD:SHA-256_SSWU_NU_",p:Ap.ORDER,m:1,k:128,expand:"xmd",hash:m5.sha256}))();Pa.hashToCurve=(()=>xie.hashToCurve)();Pa.encodeToCurve=(()=>xie.encodeToCurve)()});var HO=H(yb=>{"use strict";E();Object.defineProperty(yb,"__esModule",{value:!0});yb.decodeHex=yb.remove0x=void 0;var AOe=zf();function Sie(t){return t.startsWith("0x")||t.startsWith("0X")?t.slice(2):t}yb.remove0x=Sie;function TOe(t){return(0,AOe.hexToBytes)(Sie(t))}yb.decodeHex=TOe});var JO=H(ra=>{"use strict";E();Object.defineProperty(ra,"__esModule",{value:!0});ra.output=ra.exists=ra.hash=ra.bytes=ra.bool=ra.number=void 0;function _5(t){if(!Number.isSafeInteger(t)||t<0)throw new Error(`Wrong positive integer: ${t}`)}ra.number=_5;function Mie(t){if(typeof t!="boolean")throw new Error(`Expected boolean, not ${t}`)}ra.bool=Mie;function ZO(t,...e){if(!(t instanceof Uint8Array))throw new Error("Expected Uint8Array");if(e.length>0&&!e.includes(t.length))throw new Error(`Expected Uint8Array of length ${e}, not of length=${t.length}`)}ra.bytes=ZO;function Pie(t){if(typeof t!="function"||typeof t.create!="function")throw new Error("hash must be wrapped by utils.wrapConstructor");_5(t.outputLen),_5(t.blockLen)}ra.hash=Pie;function Aie(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}ra.exists=Aie;function Tie(t,e){ZO(t);let r=e.outputLen;if(t.length<r)throw new Error(`digestInto() expects output buffer of length at least ${r}`)}ra.output=Tie;var ROe={number:_5,bool:Mie,bytes:ZO,hash:Pie,exists:Aie,output:Tie};ra.default=ROe});var Iie=H(gb=>{"use strict";E();Object.defineProperty(gb,"__esModule",{value:!0});gb.poly1305=gb.wrapConstructorWithKey=void 0;var x5=zf(),YO=JO(),Zo=(t,e)=>t[e++]&255|(t[e++]&255)<<8,QO=class{constructor(e){this.blockLen=16,this.outputLen=16,this.buffer=new Uint8Array(16),this.r=new Uint16Array(10),this.h=new Uint16Array(10),this.pad=new Uint16Array(8),this.pos=0,this.finished=!1,e=(0,x5.toBytes)(e),(0,x5.ensureBytes)(e,32);let r=Zo(e,0),n=Zo(e,2),i=Zo(e,4),o=Zo(e,6),s=Zo(e,8),a=Zo(e,10),d=Zo(e,12),m=Zo(e,14);this.r[0]=r&8191,this.r[1]=(r>>>13|n<<3)&8191,this.r[2]=(n>>>10|i<<6)&7939,this.r[3]=(i>>>7|o<<9)&8191,this.r[4]=(o>>>4|s<<12)&255,this.r[5]=s>>>1&8190,this.r[6]=(s>>>14|a<<2)&8191,this.r[7]=(a>>>11|d<<5)&8065,this.r[8]=(d>>>8|m<<8)&8191,this.r[9]=m>>>5&127;for(let p=0;p<8;p++)this.pad[p]=Zo(e,16+2*p)}process(e,r,n=!1){let i=n?0:2048,{h:o,r:s}=this,a=s[0],d=s[1],m=s[2],p=s[3],w=s[4],P=s[5],S=s[6],M=s[7],A=s[8],B=s[9],I=Zo(e,r+0),C=Zo(e,r+2),k=Zo(e,r+4),q=Zo(e,r+6),L=Zo(e,r+8),U=Zo(e,r+10),F=Zo(e,r+12),N=Zo(e,r+14),G=o[0]+(I&8191),x=o[1]+((I>>>13|C<<3)&8191),c=o[2]+((C>>>10|k<<6)&8191),u=o[3]+((k>>>7|q<<9)&8191),y=o[4]+((q>>>4|L<<12)&8191),l=o[5]+(L>>>1&8191),h=o[6]+((L>>>14|U<<2)&8191),b=o[7]+((U>>>11|F<<5)&8191),_=o[8]+((F>>>8|N<<8)&8191),g=o[9]+(N>>>5|i),f=0,v=f+G*a+x*(5*B)+c*(5*A)+u*(5*M)+y*(5*S);f=v>>>13,v&=8191,v+=l*(5*P)+h*(5*w)+b*(5*p)+_*(5*m)+g*(5*d),f+=v>>>13,v&=8191;let O=f+G*d+x*a+c*(5*B)+u*(5*A)+y*(5*M);f=O>>>13,O&=8191,O+=l*(5*S)+h*(5*P)+b*(5*w)+_*(5*p)+g*(5*m),f+=O>>>13,O&=8191;let T=f+G*m+x*d+c*a+u*(5*B)+y*(5*A);f=T>>>13,T&=8191,T+=l*(5*M)+h*(5*S)+b*(5*P)+_*(5*w)+g*(5*p),f+=T>>>13,T&=8191;let R=f+G*p+x*m+c*d+u*a+y*(5*B);f=R>>>13,R&=8191,R+=l*(5*A)+h*(5*M)+b*(5*S)+_*(5*P)+g*(5*w),f+=R>>>13,R&=8191;let z=f+G*w+x*p+c*m+u*d+y*a;f=z>>>13,z&=8191,z+=l*(5*B)+h*(5*A)+b*(5*M)+_*(5*S)+g*(5*P),f+=z>>>13,z&=8191;let V=f+G*P+x*w+c*p+u*m+y*d;f=V>>>13,V&=8191,V+=l*a+h*(5*B)+b*(5*A)+_*(5*M)+g*(5*S),f+=V>>>13,V&=8191;let W=f+G*S+x*P+c*w+u*p+y*m;f=W>>>13,W&=8191,W+=l*d+h*a+b*(5*B)+_*(5*A)+g*(5*M),f+=W>>>13,W&=8191;let Z=f+G*M+x*S+c*P+u*w+y*p;f=Z>>>13,Z&=8191,Z+=l*m+h*d+b*a+_*(5*B)+g*(5*A),f+=Z>>>13,Z&=8191;let J=f+G*A+x*M+c*S+u*P+y*w;f=J>>>13,J&=8191,J+=l*p+h*m+b*d+_*a+g*(5*B),f+=J>>>13,J&=8191;let X=f+G*B+x*A+c*M+u*S+y*P;f=X>>>13,X&=8191,X+=l*w+h*p+b*m+_*d+g*a,f+=X>>>13,X&=8191,f=(f<<2)+f|0,f=f+v|0,v=f&8191,f=f>>>13,O+=f,o[0]=v,o[1]=O,o[2]=T,o[3]=R,o[4]=z,o[5]=V,o[6]=W,o[7]=Z,o[8]=J,o[9]=X}finalize(){let{h:e,pad:r}=this,n=new Uint16Array(10),i=e[1]>>>13;e[1]&=8191;for(let a=2;a<10;a++)e[a]+=i,i=e[a]>>>13,e[a]&=8191;e[0]+=i*5,i=e[0]>>>13,e[0]&=8191,e[1]+=i,i=e[1]>>>13,e[1]&=8191,e[2]+=i,n[0]=e[0]+5,i=n[0]>>>13,n[0]&=8191;for(let a=1;a<10;a++)n[a]=e[a]+i,i=n[a]>>>13,n[a]&=8191;n[9]-=1<<13;let o=(i^1)-1;for(let a=0;a<10;a++)n[a]&=o;o=~o;for(let a=0;a<10;a++)e[a]=e[a]&o|n[a];e[0]=(e[0]|e[1]<<13)&65535,e[1]=(e[1]>>>3|e[2]<<10)&65535,e[2]=(e[2]>>>6|e[3]<<7)&65535,e[3]=(e[3]>>>9|e[4]<<4)&65535,e[4]=(e[4]>>>12|e[5]<<1|e[6]<<14)&65535,e[5]=(e[6]>>>2|e[7]<<11)&65535,e[6]=(e[7]>>>5|e[8]<<8)&65535,e[7]=(e[8]>>>8|e[9]<<5)&65535;let s=e[0]+r[0];e[0]=s&65535;for(let a=1;a<8;a++)s=(e[a]+r[a]|0)+(s>>>16)|0,e[a]=s&65535}update(e){YO.default.exists(this);let{buffer:r,blockLen:n}=this;e=(0,x5.toBytes)(e);let i=e.length;for(let o=0;o<i;){let s=Math.min(n-this.pos,i-o);if(s===n){for(;n<=i-o;o+=n)this.process(e,o);continue}r.set(e.subarray(o,o+s),this.pos),this.pos+=s,o+=s,this.pos===n&&(this.process(r,0,!1),this.pos=0)}return this}destroy(){this.h.fill(0),this.r.fill(0),this.buffer.fill(0),this.pad.fill(0)}digestInto(e){YO.default.exists(this),YO.default.output(e,this),this.finished=!0;let{buffer:r,h:n}=this,{pos:i}=this;if(i){for(r[i++]=1;i<16;i++)r[i]=0;this.process(r,0,!0)}this.finalize();let o=0;for(let s=0;s<8;s++)e[o++]=n[s]>>>0,e[o++]=n[s]>>>8;return e}digest(){let{buffer:e,outputLen:r}=this;this.digestInto(e);let n=e.slice(0,r);return this.destroy(),n}};function Rie(t){let e=(n,i)=>t(i).update((0,x5.toBytes)(n)).digest(),r=t(new Uint8Array(32));return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=n=>t(n),e}gb.wrapConstructorWithKey=Rie;gb.poly1305=Rie(t=>new QO(t))});var kie=H(S5=>{"use strict";E();Object.defineProperty(S5,"__esModule",{value:!0});S5.salsaBasic=void 0;var nl=JO(),il=zf(),IOe=(0,il.utf8ToBytes)("expand 16-byte k"),kOe=(0,il.utf8ToBytes)("expand 32-byte k"),OOe=(0,il.u32)(IOe),BOe=(0,il.u32)(kOe),E5=t=>!(t.byteOffset%4),DOe=t=>{let{core:e,rounds:r,counterRight:n,counterLen:i,allow128bitKeys:o,extendNonceFn:s,blockLen:a}=(0,il.checkOpts)({rounds:20,counterRight:!1,counterLen:8,allow128bitKeys:!0,blockLen:64},t);nl.default.number(i),nl.default.number(r),nl.default.number(a),nl.default.bool(n),nl.default.bool(o);let d=a/4;if(a%4!==0)throw new Error("Salsa/ChaCha: blockLen must be aligned to 4 bytes");return(m,p,w,P,S=0)=>{if(nl.default.bytes(m),nl.default.bytes(p),nl.default.bytes(w),P||(P=new Uint8Array(w.length)),nl.default.bytes(P),nl.default.number(S),S<0||S>=2**32-1)throw new Error("Salsa/ChaCha: counter overflow");if(P.length<w.length)throw new Error(`Salsa/ChaCha: output (${P.length}) is shorter than data (${w.length})`);let M=[],A,B;if(m.length===32)E5(m)?A=m:(A=m.slice(),M.push(A)),B=BOe;else if(m.length===16&&o)A=new Uint8Array(32),A.set(m),A.set(m,16),B=OOe,M.push(A);else throw new Error(`Salsa/ChaCha: invalid 32-byte key, got length=${m.length}`);if(E5(p)||(p=p.slice(),M.push(p)),s){if(p.length<=16)throw new Error("Salsa/ChaCha: extended nonce must be bigger than 16 bytes");A=s(B,A,p.subarray(0,16),new Uint8Array(32)),M.push(A),p=p.subarray(16)}let I=16-i;if(p.length!==I)throw new Error(`Salsa/ChaCha: nonce must be ${I} or 16 bytes`);if(I!==12){let G=new Uint8Array(12);G.set(p,n?0:12-p.length),M.push(p=G)}let C=new Uint8Array(a),k=(0,il.u32)(C),q=(0,il.u32)(A),L=(0,il.u32)(p),U=E5(w)&&(0,il.u32)(w),F=E5(P)&&(0,il.u32)(P);M.push(k);let N=w.length;for(let G=0,x=S;G<N;x++){if(e(B,q,L,k,x,r),x>=2**32-1)throw new Error("Salsa/ChaCha: counter overflow");let c=Math.min(a,N-G);if(c===a&&F&&U){let u=G/4;if(G%4!==0)throw new Error("Salsa/ChaCha: invalid block position");for(let y=0;y<d;y++)F[u+y]=U[u+y]^k[y];G+=a;continue}for(let u=0;u<c;u++)P[G+u]=w[G+u]^C[u];G+=c}for(let G=0;G<M.length;G++)M[G].fill(0);return P}};S5.salsaBasic=DOe});var Cie=H(ei=>{"use strict";E();Object.defineProperty(ei,"__esModule",{value:!0});ei.xchacha20poly1305=ei.chacha20poly1305=ei._poly1305_aead=ei.chacha12=ei.chacha8=ei.xchacha20=ei.chacha20=ei.chacha20orig=ei.hchacha=void 0;var Vf=zf(),COe=Iie(),S_=kie(),ct=(t,e)=>t<<e|t>>>32-e;function M_(t,e,r,n,i,o=20){let s=t[0],a=t[1],d=t[2],m=t[3],p=e[0],w=e[1],P=e[2],S=e[3],M=e[4],A=e[5],B=e[6],I=e[7],C=i,k=r[0],q=r[1],L=r[2],U=s,F=a,N=d,G=m,x=p,c=w,u=P,y=S,l=M,h=A,b=B,_=I,g=C,f=k,v=q,O=L;for(let R=0;R<o;R+=2)U=U+x|0,g=ct(g^U,16),l=l+g|0,x=ct(x^l,12),U=U+x|0,g=ct(g^U,8),l=l+g|0,x=ct(x^l,7),F=F+c|0,f=ct(f^F,16),h=h+f|0,c=ct(c^h,12),F=F+c|0,f=ct(f^F,8),h=h+f|0,c=ct(c^h,7),N=N+u|0,v=ct(v^N,16),b=b+v|0,u=ct(u^b,12),N=N+u|0,v=ct(v^N,8),b=b+v|0,u=ct(u^b,7),G=G+y|0,O=ct(O^G,16),_=_+O|0,y=ct(y^_,12),G=G+y|0,O=ct(O^G,8),_=_+O|0,y=ct(y^_,7),U=U+c|0,O=ct(O^U,16),b=b+O|0,c=ct(c^b,12),U=U+c|0,O=ct(O^U,8),b=b+O|0,c=ct(c^b,7),F=F+u|0,g=ct(g^F,16),_=_+g|0,u=ct(u^_,12),F=F+u|0,g=ct(g^F,8),_=_+g|0,u=ct(u^_,7),N=N+y|0,f=ct(f^N,16),l=l+f|0,y=ct(y^l,12),N=N+y|0,f=ct(f^N,8),l=l+f|0,y=ct(y^l,7),G=G+x|0,v=ct(v^G,16),h=h+v|0,x=ct(x^h,12),G=G+x|0,v=ct(v^G,8),h=h+v|0,x=ct(x^h,7);let T=0;n[T++]=s+U|0,n[T++]=a+F|0,n[T++]=d+N|0,n[T++]=m+G|0,n[T++]=p+x|0,n[T++]=w+c|0,n[T++]=P+u|0,n[T++]=S+y|0,n[T++]=M+l|0,n[T++]=A+h|0,n[T++]=B+b|0,n[T++]=I+_|0,n[T++]=C+g|0,n[T++]=k+f|0,n[T++]=q+v|0,n[T++]=L+O|0}function Die(t,e,r,n){let i=(0,Vf.u32)(e),o=(0,Vf.u32)(r),s=(0,Vf.u32)(n),a=t[0],d=t[1],m=t[2],p=t[3],w=i[0],P=i[1],S=i[2],M=i[3],A=i[4],B=i[5],I=i[6],C=i[7],k=o[0],q=o[1],L=o[2],U=o[3];for(let F=0;F<20;F+=2)a=a+w|0,k=ct(k^a,16),A=A+k|0,w=ct(w^A,12),a=a+w|0,k=ct(k^a,8),A=A+k|0,w=ct(w^A,7),d=d+P|0,q=ct(q^d,16),B=B+q|0,P=ct(P^B,12),d=d+P|0,q=ct(q^d,8),B=B+q|0,P=ct(P^B,7),m=m+S|0,L=ct(L^m,16),I=I+L|0,S=ct(S^I,12),m=m+S|0,L=ct(L^m,8),I=I+L|0,S=ct(S^I,7),p=p+M|0,U=ct(U^p,16),C=C+U|0,M=ct(M^C,12),p=p+M|0,U=ct(U^p,8),C=C+U|0,M=ct(M^C,7),a=a+P|0,U=ct(U^a,16),I=I+U|0,P=ct(P^I,12),a=a+P|0,U=ct(U^a,8),I=I+U|0,P=ct(P^I,7),d=d+S|0,k=ct(k^d,16),C=C+k|0,S=ct(S^C,12),d=d+S|0,k=ct(k^d,8),C=C+k|0,S=ct(S^C,7),m=m+M|0,q=ct(q^m,16),A=A+q|0,M=ct(M^A,12),m=m+M|0,q=ct(q^m,8),A=A+q|0,M=ct(M^A,7),p=p+w|0,L=ct(L^p,16),B=B+L|0,w=ct(w^B,12),p=p+w|0,L=ct(L^p,8),B=B+L|0,w=ct(w^B,7);return s[0]=a,s[1]=d,s[2]=m,s[3]=p,s[4]=k,s[5]=q,s[6]=L,s[7]=U,n}ei.hchacha=Die;ei.chacha20orig=(0,S_.salsaBasic)({core:M_,counterRight:!1,counterLen:8});ei.chacha20=(0,S_.salsaBasic)({core:M_,counterRight:!1,counterLen:4,allow128bitKeys:!1});ei.xchacha20=(0,S_.salsaBasic)({core:M_,counterRight:!1,counterLen:8,extendNonceFn:Die,allow128bitKeys:!1});ei.chacha8=(0,S_.salsaBasic)({core:M_,counterRight:!1,counterLen:4,rounds:8});ei.chacha12=(0,S_.salsaBasic)({core:M_,counterRight:!1,counterLen:4,rounds:12});var jOe=new Uint8Array(16),Oie=(t,e)=>{t.update(e);let r=e.length%16;r&&t.update(jOe.subarray(r))},Bie=(t,e,r,n,i)=>{let o=t(e,r,new Uint8Array(32)),s=COe.poly1305.create(o);i&&Oie(s,i),Oie(s,n);let a=new Uint8Array(16),d=(0,Vf.createView)(a);(0,Vf.setBigUint64)(d,0,BigInt(i?i.length:0),!0),(0,Vf.setBigUint64)(d,8,BigInt(n.length),!0),s.update(a);let m=s.digest();return o.fill(0),m},NOe=t=>(e,r,n)=>((0,Vf.ensureBytes)(e,32),(0,Vf.ensureBytes)(r),{tagLength:16,encrypt:(o,s)=>{let a=o.length,d=a+16;s?(0,Vf.ensureBytes)(s,d):s=new Uint8Array(d),t(e,r,o,s,1);let m=Bie(t,e,r,s.subarray(0,-16),n);return s.set(m,a),s},decrypt:(o,s)=>{let a=o.length,d=a-16;if(a<16)throw new Error(`encrypted data must be at least ${16} bytes`);s?(0,Vf.ensureBytes)(s,d):s=new Uint8Array(d);let m=o.subarray(0,-16),p=o.subarray(-16),w=Bie(t,e,r,m,n);if(!(0,Vf.equalBytes)(p,w))throw new Error("invalid tag");return t(e,r,m,s,1),s}});ei._poly1305_aead=NOe;ei.chacha20poly1305=(0,ei._poly1305_aead)(ei.chacha20);ei.xchacha20poly1305=(0,ei._poly1305_aead)(ei.xchacha20)});var Uie=H(Tp=>{"use strict";E();Object.defineProperty(Tp,"__esModule",{value:!0});Tp.hkdf=Tp.expand=Tp.extract=void 0;var eB=QM(),jie=Nd(),qie=FO();function $ie(t,e,r){return(0,eB.hash)(t),r===void 0&&(r=new Uint8Array(t.outputLen)),(0,qie.hmac)(t,(0,jie.toBytes)(r),(0,jie.toBytes)(e))}Tp.extract=$ie;var XO=new Uint8Array([0]),Nie=new Uint8Array;function Lie(t,e,r,n=32){if((0,eB.hash)(t),(0,eB.number)(n),n>255*t.outputLen)throw new Error("Length should be <= 255*HashLen");let i=Math.ceil(n/t.outputLen);r===void 0&&(r=Nie);let o=new Uint8Array(i*t.outputLen),s=qie.hmac.create(t,e),a=s._cloneInto(),d=new Uint8Array(s.outputLen);for(let m=0;m<i;m++)XO[0]=m+1,a.update(m===0?Nie:d).update(r).update(XO).digestInto(d),o.set(d,t.outputLen*m),s._cloneInto(a);return s.destroy(),a.destroy(),d.fill(0),XO.fill(0),o.slice(0,n)}Tp.expand=Lie;var qOe=(t,e,r,n,i)=>Lie(t,$ie(t,e,r),n,i);Tp.hkdf=qOe});var Kie=H(M5=>{"use strict";E();Object.defineProperty(M5,"__esModule",{value:!0});M5.aes256gcm=void 0;var Fie=zf(),zie=JS(),tB=m_();function $Oe(t,e,r){var n=function(o){var s=(0,zie.createCipheriv)("aes-256-gcm",t,e);r&&s.setAAD(r);var a=s.update(o),d=s.final();return(0,Fie.concatBytes)(a,d,s.getAuthTag())},i=function(o){var s=o.subarray(0,o.length-tB.AEAD_TAG_LENGTH),a=o.subarray(-tB.AEAD_TAG_LENGTH),d=(0,zie.createDecipheriv)("aes-256-gcm",t,e);r&&d.setAAD(r),d.setAuthTag(a);var m=d.update(s),p=d.final();return(0,Fie.concatBytes)(m,p)};return{tagLength:tB.AEAD_TAG_LENGTH,encrypt:n,decrypt:i}}M5.aes256gcm=$Oe});var rB=H(Rp=>{"use strict";E();Object.defineProperty(Rp,"__esModule",{value:!0});Rp.deriveKey=Rp.aesDecrypt=Rp.aesEncrypt=void 0;var LOe=Cie(),Wie=zf(),UOe=aO(),FOe=Uie(),zOe=$O(),Gie=Vm(),P5=m_(),KOe=Kie();function GOe(t,e){return Vie(!0,t,e)}Rp.aesEncrypt=GOe;function WOe(t,e){return Vie(!1,t,e)}Rp.aesDecrypt=WOe;function VOe(t){return(0,FOe.hkdf)(zOe.sha256,t,void 0,void 0,32)}Rp.deriveKey=VOe;function Vie(t,e,r){var n=(0,Gie.symmetricAlgorithm)(),i=t?HOe:ZOe;if(n==="aes-256-gcm")return i(KOe.aes256gcm,e,r,(0,Gie.symmetricNonceLength)());if(n==="xchacha20")return i(LOe.xchacha20poly1305,e,r,P5.XCHACHA20_NONCE_LENGTH);throw new Error("Not implemented")}function HOe(t,e,r,n){var i=(0,UOe.randomBytes)(n),o=t(e,i),s=o.encrypt(r),a=s.subarray(0,s.length-P5.AEAD_TAG_LENGTH),d=s.subarray(-P5.AEAD_TAG_LENGTH);return(0,Wie.concatBytes)(i,d,a)}function ZOe(t,e,r,n){var i=n+P5.AEAD_TAG_LENGTH,o=r.subarray(0,n),s=r.subarray(n,i),a=r.subarray(i),d=t(e,Uint8Array.from(o)),m=(0,Wie.concatBytes)(a,s);return d.decrypt(m)}});var Yie=H(Ns=>{"use strict";E();Object.defineProperty(Ns,"__esModule",{value:!0});Ns.hexToPublicKey=Ns.convertPublicKeyFormat=Ns.getSharedPoint=Ns.getSharedKey=Ns.getPublicKey=Ns.isValidPrivateKey=Ns.getValidSecret=void 0;var JOe=zf(),YOe=aO(),Hie=oie(),QOe=Eie(),nB=Vm(),Zie=m_(),XOe=HO(),eBe=rB();function tBe(){var t;do t=(0,YOe.randomBytes)(Zie.SECRET_KEY_LENGTH);while(!Jie(t));return t}Ns.getValidSecret=tBe;function Jie(t){return P_(function(e){return e.utils.isValidPrivateKey(t)},function(){return!0},function(){return!0})}Ns.isValidPrivateKey=Jie;function rBe(t){return P_(function(e){return e.getPublicKey(t)},function(e){return e.getPublicKey(t)},function(e){return e.getPublicKey(t)})}Ns.getPublicKey=rBe;function nBe(t,e){return(0,eBe.deriveKey)((0,JOe.concatBytes)(t,e))}Ns.getSharedKey=nBe;function iBe(t,e,r){return P_(function(n){return n.getSharedSecret(t,e,r)},function(n){return n.getSharedSecret(t,e)},function(n){var i=n.utils.getExtendedPublicKey(t).scalar,o=n.ExtendedPoint.fromHex(e).multiply(i);return o.toRawBytes()})}Ns.getSharedPoint=iBe;function oBe(t,e){return P_(function(r){return r.getSharedSecret(BigInt(1),t,e)},function(){return t},function(){return t})}Ns.convertPublicKeyFormat=oBe;function sBe(t){var e=(0,XOe.decodeHex)(t);return P_(function(){if(e.length===Zie.ETH_PUBLIC_KEY_SIZE){var r=new Uint8Array(1+e.length);return r.set([4]),r.set(e,1),r}return e},function(){return e},function(){return e})}Ns.hexToPublicKey=sBe;function P_(t,e,r){if((0,nB.ellipticCurve)()==="secp256k1")return t(QOe.secp256k1);if((0,nB.ellipticCurve)()==="x25519")return e(Hie.x25519);if((0,nB.ellipticCurve)()==="ed25519")return r(Hie.ed25519);throw new Error("Not implemented")}});var A5=H(Ld=>{"use strict";E();var aBe=Ld&&Ld.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),iB=Ld&&Ld.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&aBe(e,t,r)};Object.defineProperty(Ld,"__esModule",{value:!0});iB(Yie(),Ld);iB(HO(),Ld);iB(rB(),Ld)});var sB=H(R5=>{"use strict";E();Object.defineProperty(R5,"__esModule",{value:!0});R5.PublicKey=void 0;var oB=zf(),cBe=Vm(),T5=A5(),fBe=function(){function t(e){this.data=(0,T5.convertPublicKeyFormat)(e,!0)}return t.fromHex=function(e){return new t((0,T5.hexToPublicKey)(e))},Object.defineProperty(t.prototype,"uncompressed",{get:function(){return $.Buffer.from((0,T5.convertPublicKeyFormat)(this.data,!1))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"compressed",{get:function(){return $.Buffer.from(this.data)},enumerable:!1,configurable:!0}),t.prototype.toHex=function(e){return e===void 0&&(e=!0),e?(0,oB.bytesToHex)(this.data):(0,oB.bytesToHex)(this.uncompressed)},t.prototype.decapsulate=function(e){var r,n;return(0,cBe.isHkdfKeyCompressed)()?(r=this.data,n=e.multiply(this,!0)):(r=this.uncompressed,n=e.multiply(this,!1)),(0,T5.getSharedKey)(r,n)},t.prototype.equals=function(e){return(0,oB.equalBytes)(this.data,e.data)},t}();R5.PublicKey=fBe});var Xie=H(I5=>{"use strict";E();Object.defineProperty(I5,"__esModule",{value:!0});I5.PrivateKey=void 0;var Qie=zf(),uBe=Vm(),vb=A5(),lBe=sB(),dBe=function(){function t(e){var r=e===void 0?(0,vb.getValidSecret)():e;if(!(0,vb.isValidPrivateKey)(r))throw new Error("Invalid private key");this.data=r,this.publicKey=new lBe.PublicKey((0,vb.getPublicKey)(r))}return t.fromHex=function(e){return new t((0,vb.decodeHex)(e))},Object.defineProperty(t.prototype,"secret",{get:function(){return $.Buffer.from(this.data)},enumerable:!1,configurable:!0}),t.prototype.toHex=function(){return(0,Qie.bytesToHex)(this.data)},t.prototype.encapsulate=function(e){var r,n;return(0,uBe.isHkdfKeyCompressed)()?(r=this.publicKey.compressed,n=this.multiply(e,!0)):(r=this.publicKey.uncompressed,n=this.multiply(e,!1)),(0,vb.getSharedKey)(r,n)},t.prototype.multiply=function(e,r){return r===void 0&&(r=!1),(0,vb.getSharedPoint)(this.data,e.compressed,r)},t.prototype.equals=function(e){return(0,Qie.equalBytes)(this.data,e.data)},t}();I5.PrivateKey=dBe});var aB=H(bb=>{"use strict";E();Object.defineProperty(bb,"__esModule",{value:!0});bb.PublicKey=bb.PrivateKey=void 0;var hBe=Xie();Object.defineProperty(bb,"PrivateKey",{enumerable:!0,get:function(){return hBe.PrivateKey}});var pBe=sB();Object.defineProperty(bb,"PublicKey",{enumerable:!0,get:function(){return pBe.PublicKey}})});var roe=H(Aa=>{"use strict";E();Object.defineProperty(Aa,"__esModule",{value:!0});Aa.utils=Aa.PublicKey=Aa.PrivateKey=Aa.ECIES_CONFIG=Aa.decrypt=Aa.encrypt=void 0;var mBe=zf(),eoe=Vm(),wb=aB(),Qm=A5();function yBe(t,e){var r=new wb.PrivateKey,n=t instanceof Uint8Array?new wb.PublicKey(t):wb.PublicKey.fromHex(t),i=r.encapsulate(n),o=(0,Qm.aesEncrypt)(i,e),s;return(0,eoe.isEphemeralKeyCompressed)()?s=r.publicKey.compressed:s=r.publicKey.uncompressed,$.Buffer.from((0,mBe.concatBytes)(s,o))}Aa.encrypt=yBe;function gBe(t,e){var r=t instanceof Uint8Array?new wb.PrivateKey(t):wb.PrivateKey.fromHex(t),n=(0,eoe.ephemeralKeySize)(),i=new wb.PublicKey(e.subarray(0,n)),o=e.subarray(n),s=i.decapsulate(r);return $.Buffer.from((0,Qm.aesDecrypt)(s,o))}Aa.decrypt=gBe;var vBe=Vm();Object.defineProperty(Aa,"ECIES_CONFIG",{enumerable:!0,get:function(){return vBe.ECIES_CONFIG}});var toe=aB();Object.defineProperty(Aa,"PrivateKey",{enumerable:!0,get:function(){return toe.PrivateKey}});Object.defineProperty(Aa,"PublicKey",{enumerable:!0,get:function(){return toe.PublicKey}});Aa.utils={aesDecrypt:Qm.aesDecrypt,aesEncrypt:Qm.aesEncrypt,decodeHex:Qm.decodeHex,getValidSecret:Qm.getValidSecret,remove0x:Qm.remove0x}});var ai=H((Hbt,noe)=>{"use strict";E();noe.exports={ArrayIsArray(t){return Array.isArray(t)},ArrayPrototypeIncludes(t,e){return t.includes(e)},ArrayPrototypeIndexOf(t,e){return t.indexOf(e)},ArrayPrototypeJoin(t,e){return t.join(e)},ArrayPrototypeMap(t,e){return t.map(e)},ArrayPrototypePop(t,e){return t.pop(e)},ArrayPrototypePush(t,e){return t.push(e)},ArrayPrototypeSlice(t,e,r){return t.slice(e,r)},Error,FunctionPrototypeCall(t,e,...r){return t.call(e,...r)},FunctionPrototypeSymbolHasInstance(t,e){return Function.prototype[Symbol.hasInstance].call(t,e)},MathFloor:Math.floor,Number,NumberIsInteger:Number.isInteger,NumberIsNaN:Number.isNaN,NumberMAX_SAFE_INTEGER:Number.MAX_SAFE_INTEGER,NumberMIN_SAFE_INTEGER:Number.MIN_SAFE_INTEGER,NumberParseInt:Number.parseInt,ObjectDefineProperties(t,e){return Object.defineProperties(t,e)},ObjectDefineProperty(t,e,r){return Object.defineProperty(t,e,r)},ObjectGetOwnPropertyDescriptor(t,e){return Object.getOwnPropertyDescriptor(t,e)},ObjectKeys(t){return Object.keys(t)},ObjectSetPrototypeOf(t,e){return Object.setPrototypeOf(t,e)},Promise,PromisePrototypeCatch(t,e){return t.catch(e)},PromisePrototypeThen(t,e,r){return t.then(e,r)},PromiseReject(t){return Promise.reject(t)},PromiseResolve(t){return Promise.resolve(t)},ReflectApply:Reflect.apply,RegExpPrototypeTest(t,e){return t.test(e)},SafeSet:Set,String,StringPrototypeSlice(t,e,r){return t.slice(e,r)},StringPrototypeToLowerCase(t){return t.toLowerCase()},StringPrototypeToUpperCase(t){return t.toUpperCase()},StringPrototypeTrim(t){return t.trim()},Symbol,SymbolFor:Symbol.for,SymbolAsyncIterator:Symbol.asyncIterator,SymbolHasInstance:Symbol.hasInstance,SymbolIterator:Symbol.iterator,SymbolDispose:Symbol.dispose||Symbol("Symbol.dispose"),SymbolAsyncDispose:Symbol.asyncDispose||Symbol("Symbol.asyncDispose"),TypedArrayPrototypeSet(t,e,r){return t.set(e,r)},Boolean,Uint8Array}});var Ud=H((Jbt,k5)=>{"use strict";E();var{AbortController:ioe,AbortSignal:bBe}=typeof self<"u"?self:typeof window<"u"?window:void 0;k5.exports=ioe;k5.exports.AbortSignal=bBe;k5.exports.default=ioe});var qs=H((Qbt,fB)=>{"use strict";E();var wBe=sr(),{kResistStopPropagation:_Be,SymbolDispose:xBe}=ai(),EBe=globalThis.AbortSignal||Ud().AbortSignal,SBe=globalThis.AbortController||Ud().AbortController,MBe=Object.getPrototypeOf(async function(){}).constructor,ooe=globalThis.Blob||wBe.Blob,PBe=typeof ooe<"u"?function(e){return e instanceof ooe}:function(e){return!1},soe=(t,e)=>{if(t!==void 0&&(t===null||typeof t!="object"||!("aborted"in t)))throw new ERR_INVALID_ARG_TYPE(e,"AbortSignal",t)},ABe=(t,e)=>{if(typeof t!="function")throw new ERR_INVALID_ARG_TYPE(e,"Function",t)},cB=class extends Error{constructor(e){if(!Array.isArray(e))throw new TypeError(`Expected input to be an Array, got ${typeof e}`);let r="";for(let n=0;n<e.length;n++)r+=` ${e[n].stack}
`;super(r),this.name="AggregateError",this.errors=e}};fB.exports={AggregateError:cB,kEmptyObject:Object.freeze({}),once(t){let e=!1;return function(...r){e||(e=!0,t.apply(this,r))}},createDeferredPromise:function(){let t,e;return{promise:new Promise((n,i)=>{t=n,e=i}),resolve:t,reject:e}},promisify(t){return new Promise((e,r)=>{t((n,...i)=>n?r(n):e(...i))})},debuglog(){return function(){}},format(t,...e){return t.replace(/%([sdifj])/g,function(...[r,n]){let i=e.shift();return n==="f"?i.toFixed(6):n==="j"?JSON.stringify(i):n==="s"&&typeof i=="object"?`${i.constructor!==Object?i.constructor.name:""} {}`.trim():i.toString()})},inspect(t){switch(typeof t){case"string":if(t.includes("'"))if(t.includes('"')){if(!t.includes("`")&&!t.includes("${"))return`\`${t}\``}else return`"${t}"`;return`'${t}'`;case"number":return isNaN(t)?"NaN":Object.is(t,-0)?String(t):t;case"bigint":return`${String(t)}n`;case"boolean":case"undefined":return String(t);case"object":return"{}"}},types:{isAsyncFunction(t){return t instanceof MBe},isArrayBufferView(t){return ArrayBuffer.isView(t)}},isBlob:PBe,deprecate(t,e){return t},addAbortListener:Go().addAbortListener||function(e,r){if(e===void 0)throw new ERR_INVALID_ARG_TYPE("signal","AbortSignal",e);soe(e,"signal"),ABe(r,"listener");let n;return e.aborted?queueMicrotask(()=>r()):(e.addEventListener("abort",r,{__proto__:null,once:!0,[_Be]:!0}),n=()=>{e.removeEventListener("abort",r)}),{__proto__:null,[xBe](){var i;(i=n)===null||i===void 0||i()}}},AbortSignalAny:EBe.any||function(e){if(e.length===1)return e[0];let r=new SBe,n=()=>r.abort();return e.forEach(i=>{soe(i,"signals"),i.addEventListener("abort",n,{once:!0})}),r.signal.addEventListener("abort",()=>{e.forEach(i=>i.removeEventListener("abort",n))},{once:!0}),r.signal}};fB.exports.promisify.custom=Symbol.for("nodejs.util.promisify.custom")});var na=H((ewt,foe)=>{"use strict";E();var{format:TBe,inspect:O5,AggregateError:RBe}=qs(),IBe=globalThis.AggregateError||RBe,kBe=Symbol("kIsNodeError"),OBe=["string","function","number","object","Function","Object","boolean","bigint","symbol"],BBe=/^([A-Z][a-z0-9]*)+$/,DBe="__node_internal_",B5={};function Xm(t,e){if(!t)throw new B5.ERR_INTERNAL_ASSERTION(e)}function aoe(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 CBe(t,e,r){if(typeof e=="function")return Xm(e.length<=r.length,`Code: ${t}; The provided arguments length (${r.length}) does not match the required ones (${e.length}).`),e(...r);let n=(e.match(/%[dfijoOs]/g)||[]).length;return Xm(n===r.length,`Code: ${t}; The provided arguments length (${r.length}) does not match the required ones (${n}).`),r.length===0?e:TBe(e,...r)}function Jo(t,e,r){r||(r=Error);class n extends r{constructor(...o){super(CBe(t,e,o))}toString(){return`${this.name} [${t}]: ${this.message}`}}Object.defineProperties(n.prototype,{name:{value:r.name,writable:!0,enumerable:!1,configurable:!0},toString:{value(){return`${this.name} [${t}]: ${this.message}`},writable:!0,enumerable:!1,configurable:!0}}),n.prototype.code=t,n.prototype[kBe]=!0,B5[t]=n}function coe(t){let e=DBe+t.name;return Object.defineProperty(t,"name",{value:e}),t}function jBe(t,e){if(t&&e&&t!==e){if(Array.isArray(e.errors))return e.errors.push(t),e;let r=new IBe([e,t],e.message);return r.code=e.code,r}return t||e}var uB=class extends Error{constructor(e="The operation was aborted",r=void 0){if(r!==void 0&&typeof r!="object")throw new B5.ERR_INVALID_ARG_TYPE("options","Object",r);super(e,r),this.code="ABORT_ERR",this.name="AbortError"}};Jo("ERR_ASSERTION","%s",Error);Jo("ERR_INVALID_ARG_TYPE",(t,e,r)=>{Xm(typeof t=="string","'name' must be a string"),Array.isArray(e)||(e=[e]);let n="The ";t.endsWith(" argument")?n+=`${t} `:n+=`"${t}" ${t.includes(".")?"property":"argument"} `,n+="must be ";let i=[],o=[],s=[];for(let d of e)Xm(typeof d=="string","All expected entries have to be of type string"),OBe.includes(d)?i.push(d.toLowerCase()):BBe.test(d)?o.push(d):(Xm(d!=="object",'The value "object" should be written as "Object"'),s.push(d));if(o.length>0){let d=i.indexOf("object");d!==-1&&(i.splice(i,d,1),o.push("Object"))}if(i.length>0){switch(i.length){case 1:n+=`of type ${i[0]}`;break;case 2:n+=`one of type ${i[0]} or ${i[1]}`;break;default:{let d=i.pop();n+=`one of type ${i.join(", ")}, or ${d}`}}(o.length>0||s.length>0)&&(n+=" or ")}if(o.length>0){switch(o.length){case 1:n+=`an instance of ${o[0]}`;break;case 2:n+=`an instance of ${o[0]} or ${o[1]}`;break;default:{let d=o.pop();n+=`an instance of ${o.join(", ")}, or ${d}`}}s.length>0&&(n+=" or ")}switch(s.length){case 0:break;case 1:s[0].toLowerCase()!==s[0]&&(n+="an "),n+=`${s[0]}`;break;case 2:n+=`one of ${s[0]} or ${s[1]}`;break;default:{let d=s.pop();n+=`one of ${s.join(", ")}, or ${d}`}}if(r==null)n+=`. Received ${r}`;else if(typeof r=="function"&&r.name)n+=`. Received function ${r.name}`;else if(typeof r=="object"){var a;if((a=r.constructor)!==null&&a!==void 0&&a.name)n+=`. Received an instance of ${r.constructor.name}`;else{let d=O5(r,{depth:-1});n+=`. Received ${d}`}}else{let d=O5(r,{colors:!1});d.length>25&&(d=`${d.slice(0,25)}...`),n+=`. Received type ${typeof r} (${d})`}return n},TypeError);Jo("ERR_INVALID_ARG_VALUE",(t,e,r="is invalid")=>{let n=O5(e);return n.length>128&&(n=n.slice(0,128)+"..."),`The ${t.includes(".")?"property":"argument"} '${t}' ${r}. Received ${n}`},TypeError);Jo("ERR_INVALID_RETURN_VALUE",(t,e,r)=>{var n;let i=r!=null&&(n=r.constructor)!==null&&n!==void 0&&n.name?`instance of ${r.constructor.name}`:`type ${typeof r}`;return`Expected ${t} to be returned from the "${e}" function but got ${i}.`},TypeError);Jo("ERR_MISSING_ARGS",(...t)=>{Xm(t.length>0,"At least one arg needs to be specified");let e,r=t.length;switch(t=(Array.isArray(t)?t:[t]).map(n=>`"${n}"`).join(" or "),r){case 1:e+=`The ${t[0]} argument`;break;case 2:e+=`The ${t[0]} and ${t[1]} arguments`;break;default:{let n=t.pop();e+=`The ${t.join(", ")}, and ${n} arguments`}break}return`${e} must be specified`},TypeError);Jo("ERR_OUT_OF_RANGE",(t,e,r)=>{Xm(e,'Missing "range" argument');let n;return Number.isInteger(r)&&Math.abs(r)>2**32?n=aoe(String(r)):typeof r=="bigint"?(n=String(r),(r>2n**32n||r<-(2n**32n))&&(n=aoe(n)),n+="n"):n=O5(r),`The value of "${t}" is out of range. It must be ${e}. Received ${n}`},RangeError);Jo("ERR_MULTIPLE_CALLBACK","Callback called multiple times",Error);Jo("ERR_METHOD_NOT_IMPLEMENTED","The %s method is not implemented",Error);Jo("ERR_STREAM_ALREADY_FINISHED","Cannot call %s after a stream was finished",Error);Jo("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable",Error);Jo("ERR_STREAM_DESTROYED","Cannot call %s after a stream was destroyed",Error);Jo("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError);Jo("ERR_STREAM_PREMATURE_CLOSE","Premature close",Error);Jo("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF",Error);Jo("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event",Error);Jo("ERR_STREAM_WRITE_AFTER_END","write after end",Error);Jo("ERR_UNKNOWN_ENCODING","Unknown encoding: %s",TypeError);foe.exports={AbortError:uB,aggregateTwoErrors:coe(jBe),hideStackFrames:coe,codes:B5}});var xb=H((rwt,boe)=>{"use strict";E();var{ArrayIsArray:dB,ArrayPrototypeIncludes:hoe,ArrayPrototypeJoin:poe,ArrayPrototypeMap:NBe,NumberIsInteger:hB,NumberIsNaN:qBe,NumberMAX_SAFE_INTEGER:$Be,NumberMIN_SAFE_INTEGER:LBe,NumberParseInt:UBe,ObjectPrototypeHasOwnProperty:FBe,RegExpPrototypeExec:moe,String:zBe,StringPrototypeToUpperCase:KBe,StringPrototypeTrim:GBe}=ai(),{hideStackFrames:Jc,codes:{ERR_SOCKET_BAD_PORT:WBe,ERR_INVALID_ARG_TYPE:$s,ERR_INVALID_ARG_VALUE:_b,ERR_OUT_OF_RANGE:ey,ERR_UNKNOWN_SIGNAL:uoe}}=na(),{normalizeEncoding:VBe}=qs(),{isAsyncFunction:HBe,isArrayBufferView:ZBe}=qs().types,loe={};function JBe(t){return t===(t|0)}function YBe(t){return t===t>>>0}var QBe=/^[0-7]+$/,XBe="must be a 32-bit unsigned integer or an octal string";function eDe(t,e,r){if(typeof t>"u"&&(t=r),typeof t=="string"){if(moe(QBe,t)===null)throw new _b(e,t,XBe);t=UBe(t,8)}return yoe(t,e),t}var tDe=Jc((t,e,r=LBe,n=$Be)=>{if(typeof t!="number")throw new $s(e,"number",t);if(!hB(t))throw new ey(e,"an integer",t);if(t<r||t>n)throw new ey(e,`>= ${r} && <= ${n}`,t)}),rDe=Jc((t,e,r=-2147483648,n=2147483647)=>{if(typeof t!="number")throw new $s(e,"number",t);if(!hB(t))throw new ey(e,"an integer",t);if(t<r||t>n)throw new ey(e,`>= ${r} && <= ${n}`,t)}),yoe=Jc((t,e,r=!1)=>{if(typeof t!="number")throw new $s(e,"number",t);if(!hB(t))throw new ey(e,"an integer",t);let n=r?1:0,i=4294967295;if(t<n||t>i)throw new ey(e,`>= ${n} && <= ${i}`,t)});function pB(t,e){if(typeof t!="string")throw new $s(e,"string",t)}function nDe(t,e,r=void 0,n){if(typeof t!="number")throw new $s(e,"number",t);if(r!=null&&t<r||n!=null&&t>n||(r!=null||n!=null)&&qBe(t))throw new ey(e,`${r!=null?`>= ${r}`:""}${r!=null&&n!=null?" && ":""}${n!=null?`<= ${n}`:""}`,t)}var iDe=Jc((t,e,r)=>{if(!hoe(r,t)){let i="must be one of: "+poe(NBe(r,o=>typeof o=="string"?`'${o}'`:zBe(o)),", ");throw new _b(e,t,i)}});function goe(t,e){if(typeof t!="boolean")throw new $s(e,"boolean",t)}function lB(t,e,r){return t==null||!FBe(t,e)?r:t[e]}var oDe=Jc((t,e,r=null)=>{let n=lB(r,"allowArray",!1),i=lB(r,"allowFunction",!1);if(!lB(r,"nullable",!1)&&t===null||!n&&dB(t)||typeof t!="object"&&(!i||typeof t!="function"))throw new $s(e,"Object",t)}),sDe=Jc((t,e)=>{if(t!=null&&typeof t!="object"&&typeof t!="function")throw new $s(e,"a dictionary",t)}),D5=Jc((t,e,r=0)=>{if(!dB(t))throw new $s(e,"Array",t);if(t.length<r){let n=`must be longer than ${r}`;throw new _b(e,t,n)}});function aDe(t,e){D5(t,e);for(let r=0;r<t.length;r++)pB(t[r],`${e}[${r}]`)}function cDe(t,e){D5(t,e);for(let r=0;r<t.length;r++)goe(t[r],`${e}[${r}]`)}function fDe(t,e){D5(t,e);for(let r=0;r<t.length;r++){let n=t[r],i=`${e}[${r}]`;if(n==null)throw new $s(i,"AbortSignal",n);voe(n,i)}}function uDe(t,e="signal"){if(pB(t,e),loe[t]===void 0)throw loe[KBe(t)]!==void 0?new uoe(t+" (signals must use all capital letters)"):new uoe(t)}var lDe=Jc((t,e="buffer")=>{if(!ZBe(t))throw new $s(e,["Buffer","TypedArray","DataView"],t)});function dDe(t,e){let r=VBe(e),n=t.length;if(r==="hex"&&n%2!==0)throw new _b("encoding",e,`is invalid for data of length ${n}`)}function hDe(t,e="Port",r=!0){if(typeof t!="number"&&typeof t!="string"||typeof t=="string"&&GBe(t).length===0||+t!==+t>>>0||t>65535||t===0&&!r)throw new WBe(e,t,r);return t|0}var voe=Jc((t,e)=>{if(t!==void 0&&(t===null||typeof t!="object"||!("aborted"in t)))throw new $s(e,"AbortSignal",t)}),pDe=Jc((t,e)=>{if(typeof t!="function")throw new $s(e,"Function",t)}),mDe=Jc((t,e)=>{if(typeof t!="function"||HBe(t))throw new $s(e,"Function",t)}),yDe=Jc((t,e)=>{if(t!==void 0)throw new $s(e,"undefined",t)});function gDe(t,e,r){if(!hoe(r,t))throw new $s(e,`('${poe(r,"|")}')`,t)}var vDe=/^(?:<[^>]*>)(?:\s*;\s*[^;"\s]+(?:=(")?[^;"\s]*\1)?)*$/;function doe(t,e){if(typeof t>"u"||!moe(vDe,t))throw new _b(e,t,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}function bDe(t){if(typeof t=="string")return doe(t,"hints"),t;if(dB(t)){let e=t.length,r="";if(e===0)return r;for(let n=0;n<e;n++){let i=t[n];doe(i,"hints"),r+=i,n!==e-1&&(r+=", ")}return r}throw new _b("hints",t,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}boe.exports={isInt32:JBe,isUint32:YBe,parseFileMode:eDe,validateArray:D5,validateStringArray:aDe,validateBooleanArray:cDe,validateAbortSignalArray:fDe,validateBoolean:goe,validateBuffer:lDe,validateDictionary:sDe,validateEncoding:dDe,validateFunction:pDe,validateInt32:rDe,validateInteger:tDe,validateNumber:nDe,validateObject:oDe,validateOneOf:iDe,validatePlainFunction:mDe,validatePort:hDe,validateSignalName:uDe,validateString:pB,validateUint32:yoe,validateUndefined:yDe,validateUnion:gDe,validateAbortSignal:voe,validateLinkHeaderValue:bDe}});var sl=H((iwt,Doe)=>{"use strict";E();var{SymbolAsyncIterator:woe,SymbolIterator:_oe,SymbolFor:ty}=ai(),xoe=ty("nodejs.stream.destroyed"),Eoe=ty("nodejs.stream.errored"),mB=ty("nodejs.stream.readable"),yB=ty("nodejs.stream.writable"),Soe=ty("nodejs.stream.disturbed"),wDe=ty("nodejs.webstream.isClosedPromise"),_De=ty("nodejs.webstream.controllerErrorFunction");function C5(t,e=!1){var r;return!!(t&&typeof t.pipe=="function"&&typeof t.on=="function"&&(!e||typeof t.pause=="function"&&typeof t.resume=="function")&&(!t._writableState||((r=t._readableState)===null||r===void 0?void 0:r.readable)!==!1)&&(!t._writableState||t._readableState))}function j5(t){var e;return!!(t&&typeof t.write=="function"&&typeof t.on=="function"&&(!t._readableState||((e=t._writableState)===null||e===void 0?void 0:e.writable)!==!1))}function xDe(t){return!!(t&&typeof t.pipe=="function"&&t._readableState&&typeof t.on=="function"&&typeof t.write=="function")}function ol(t){return t&&(t._readableState||t._writableState||typeof t.write=="function"&&typeof t.on=="function"||typeof t.pipe=="function"&&typeof t.on=="function")}function Moe(t){return!!(t&&!ol(t)&&typeof t.pipeThrough=="function"&&typeof t.getReader=="function"&&typeof t.cancel=="function")}function Poe(t){return!!(t&&!ol(t)&&typeof t.getWriter=="function"&&typeof t.abort=="function")}function Aoe(t){return!!(t&&!ol(t)&&typeof t.readable=="object"&&typeof t.writable=="object")}function EDe(t){return Moe(t)||Poe(t)||Aoe(t)}function SDe(t,e){return t==null?!1:e===!0?typeof t[woe]=="function":e===!1?typeof t[_oe]=="function":typeof t[woe]=="function"||typeof t[_oe]=="function"}function N5(t){if(!ol(t))return null;let e=t._writableState,r=t._readableState,n=e||r;return!!(t.destroyed||t[xoe]||n!=null&&n.destroyed)}function Toe(t){if(!j5(t))return null;if(t.writableEnded===!0)return!0;let e=t._writableState;return e!=null&&e.errored?!1:typeof e?.ended!="boolean"?null:e.ended}function MDe(t,e){if(!j5(t))return null;if(t.writableFinished===!0)return!0;let r=t._writableState;return r!=null&&r.errored?!1:typeof r?.finished!="boolean"?null:!!(r.finished||e===!1&&r.ended===!0&&r.length===0)}function PDe(t){if(!C5(t))return null;if(t.readableEnded===!0)return!0;let e=t._readableState;return!e||e.errored?!1:typeof e?.ended!="boolean"?null:e.ended}function Roe(t,e){if(!C5(t))return null;let r=t._readableState;return r!=null&&r.errored?!1:typeof r?.endEmitted!="boolean"?null:!!(r.endEmitted||e===!1&&r.ended===!0&&r.length===0)}function Ioe(t){return t&&t[mB]!=null?t[mB]:typeof t?.readable!="boolean"?null:N5(t)?!1:C5(t)&&t.readable&&!Roe(t)}function koe(t){return t&&t[yB]!=null?t[yB]:typeof t?.writable!="boolean"?null:N5(t)?!1:j5(t)&&t.writable&&!Toe(t)}function ADe(t,e){return ol(t)?N5(t)?!0:!(e?.readable!==!1&&Ioe(t)||e?.writable!==!1&&koe(t)):null}function TDe(t){var e,r;return ol(t)?t.writableErrored?t.writableErrored:(e=(r=t._writableState)===null||r===void 0?void 0:r.errored)!==null&&e!==void 0?e:null:null}function RDe(t){var e,r;return ol(t)?t.readableErrored?t.readableErrored:(e=(r=t._readableState)===null||r===void 0?void 0:r.errored)!==null&&e!==void 0?e:null:null}function IDe(t){if(!ol(t))return null;if(typeof t.closed=="boolean")return t.closed;let e=t._writableState,r=t._readableState;return typeof e?.closed=="boolean"||typeof r?.closed=="boolean"?e?.closed||r?.closed:typeof t._closed=="boolean"&&Ooe(t)?t._closed:null}function Ooe(t){return typeof t._closed=="boolean"&&typeof t._defaultKeepAlive=="boolean"&&typeof t._removedConnection=="boolean"&&typeof t._removedContLen=="boolean"}function Boe(t){return typeof t._sent100=="boolean"&&Ooe(t)}function kDe(t){var e;return typeof t._consuming=="boolean"&&typeof t._dumped=="boolean"&&((e=t.req)===null||e===void 0?void 0:e.upgradeOrConnect)===void 0}function ODe(t){if(!ol(t))return null;let e=t._writableState,r=t._readableState,n=e||r;return!n&&Boe(t)||!!(n&&n.autoDestroy&&n.emitClose&&n.closed===!1)}function BDe(t){var e;return!!(t&&((e=t[Soe])!==null&&e!==void 0?e:t.readableDidRead||t.readableAborted))}function DDe(t){var e,r,n,i,o,s,a,d,m,p;return!!(t&&((e=(r=(n=(i=(o=(s=t[Eoe])!==null&&s!==void 0?s:t.readableErrored)!==null&&o!==void 0?o:t.writableErrored)!==null&&i!==void 0?i:(a=t._readableState)===null||a===void 0?void 0:a.errorEmitted)!==null&&n!==void 0?n:(d=t._writableState)===null||d===void 0?void 0:d.errorEmitted)!==null&&r!==void 0?r:(m=t._readableState)===null||m===void 0?void 0:m.errored)!==null&&e!==void 0?e:!((p=t._writableState)===null||p===void 0)&&p.errored))}Doe.exports={isDestroyed:N5,kIsDestroyed:xoe,isDisturbed:BDe,kIsDisturbed:Soe,isErrored:DDe,kIsErrored:Eoe,isReadable:Ioe,kIsReadable:mB,kIsClosedPromise:wDe,kControllerErrorFunction:_De,kIsWritable:yB,isClosed:IDe,isDuplexNodeStream:xDe,isFinished:ADe,isIterable:SDe,isReadableNodeStream:C5,isReadableStream:Moe,isReadableEnded:PDe,isReadableFinished:Roe,isReadableErrored:RDe,isNodeStream:ol,isWebStream:EDe,isWritable:koe,isWritableNodeStream:j5,isWritableStream:Poe,isWritableEnded:Toe,isWritableFinished:MDe,isWritableErrored:TDe,isServerRequest:kDe,isServerResponse:Boe,willEmitClose:ODe,isTransformStream:Aoe}});var Fd=H((swt,_B)=>{E();var Ip=ws(),{AbortError:zoe,codes:CDe}=na(),{ERR_INVALID_ARG_TYPE:jDe,ERR_STREAM_PREMATURE_CLOSE:Coe}=CDe,{kEmptyObject:vB,once:bB}=qs(),{validateAbortSignal:NDe,validateFunction:qDe,validateObject:$De,validateBoolean:LDe}=xb(),{Promise:UDe,PromisePrototypeThen:FDe,SymbolDispose:Koe}=ai(),{isClosed:zDe,isReadable:joe,isReadableNodeStream:gB,isReadableStream:KDe,isReadableFinished:Noe,isReadableErrored:qoe,isWritable:$oe,isWritableNodeStream:Loe,isWritableStream:GDe,isWritableFinished:Uoe,isWritableErrored:Foe,isNodeStream:WDe,willEmitClose:VDe,kIsClosedPromise:HDe}=sl(),Eb;function ZDe(t){return t.setHeader&&typeof t.abort=="function"}var wB=()=>{};function Goe(t,e,r){var n,i;if(arguments.length===2?(r=e,e=vB):e==null?e=vB:$De(e,"options"),qDe(r,"callback"),NDe(e.signal,"options.signal"),r=bB(r),KDe(t)||GDe(t))return JDe(t,e,r);if(!WDe(t))throw new jDe("stream",["ReadableStream","WritableStream","Stream"],t);let o=(n=e.readable)!==null&&n!==void 0?n:gB(t),s=(i=e.writable)!==null&&i!==void 0?i:Loe(t),a=t._writableState,d=t._readableState,m=()=>{t.writable||P()},p=VDe(t)&&gB(t)===o&&Loe(t)===s,w=Uoe(t,!1),P=()=>{w=!0,t.destroyed&&(p=!1),!(p&&(!t.readable||o))&&(!o||S)&&r.call(t)},S=Noe(t,!1),M=()=>{S=!0,t.destroyed&&(p=!1),!(p&&(!t.writable||s))&&(!s||w)&&r.call(t)},A=L=>{r.call(t,L)},B=zDe(t),I=()=>{B=!0;let L=Foe(t)||qoe(t);if(L&&typeof L!="boolean")return r.call(t,L);if(o&&!S&&gB(t,!0)&&!Noe(t,!1))return r.call(t,new Coe);if(s&&!w&&!Uoe(t,!1))return r.call(t,new Coe);r.call(t)},C=()=>{B=!0;let L=Foe(t)||qoe(t);if(L&&typeof L!="boolean")return r.call(t,L);r.call(t)},k=()=>{t.req.on("finish",P)};ZDe(t)?(t.on("complete",P),p||t.on("abort",I),t.req?k():t.on("request",k)):s&&!a&&(t.on("end",m),t.on("close",m)),!p&&typeof t.aborted=="boolean"&&t.on("aborted",I),t.on("end",M),t.on("finish",P),e.error!==!1&&t.on("error",A),t.on("close",I),B?Ip.nextTick(I):a!=null&&a.errorEmitted||d!=null&&d.errorEmitted?p||Ip.nextTick(C):(!o&&(!p||joe(t))&&(w||$oe(t)===!1)||!s&&(!p||$oe(t))&&(S||joe(t)===!1)||d&&t.req&&t.aborted)&&Ip.nextTick(C);let q=()=>{r=wB,t.removeListener("aborted",I),t.removeListener("complete",P),t.removeListener("abort",I),t.removeListener("request",k),t.req&&t.req.removeListener("finish",P),t.removeListener("end",m),t.removeListener("close",m),t.removeListener("finish",P),t.removeListener("end",M),t.removeListener("error",A),t.removeListener("close",I)};if(e.signal&&!B){let L=()=>{let U=r;q(),U.call(t,new zoe(void 0,{cause:e.signal.reason}))};if(e.signal.aborted)Ip.nextTick(L);else{Eb=Eb||qs().addAbortListener;let U=Eb(e.signal,L),F=r;r=bB((...N)=>{U[Koe](),F.apply(t,N)})}}return q}function JDe(t,e,r){let n=!1,i=wB;if(e.signal)if(i=()=>{n=!0,r.call(t,new zoe(void 0,{cause:e.signal.reason}))},e.signal.aborted)Ip.nextTick(i);else{Eb=Eb||qs().addAbortListener;let s=Eb(e.signal,i),a=r;r=bB((...d)=>{s[Koe](),a.apply(t,d)})}let o=(...s)=>{n||Ip.nextTick(()=>r.apply(t,s))};return FDe(t[HDe].promise,o,o),wB}function YDe(t,e){var r;let n=!1;return e===null&&(e=vB),(r=e)!==null&&r!==void 0&&r.cleanup&&(LDe(e.cleanup,"cleanup"),n=e.cleanup),new UDe((i,o)=>{let s=Goe(t,e,a=>{n&&s(),a?o(a):i()})})}_B.exports=Goe;_B.exports.finished=YDe});var ry=H((cwt,Xoe)=>{"use strict";E();var al=ws(),{aggregateTwoErrors:QDe,codes:{ERR_MULTIPLE_CALLBACK:XDe},AbortError:eCe}=na(),{Symbol:Hoe}=ai(),{kIsDestroyed:tCe,isDestroyed:rCe,isFinished:nCe,isServerRequest:iCe}=sl(),Zoe=Hoe("kDestroy"),xB=Hoe("kConstruct");function Joe(t,e,r){t&&(t.stack,e&&!e.errored&&(e.errored=t),r&&!r.errored&&(r.errored=t))}function oCe(t,e){let r=this._readableState,n=this._writableState,i=n||r;return n!=null&&n.destroyed||r!=null&&r.destroyed?(typeof e=="function"&&e(),this):(Joe(t,n,r),n&&(n.destroyed=!0),r&&(r.destroyed=!0),i.constructed?Woe(this,t,e):this.once(Zoe,function(o){Woe(this,QDe(o,t),e)}),this)}function Woe(t,e,r){let n=!1;function i(o){if(n)return;n=!0;let s=t._readableState,a=t._writableState;Joe(o,a,s),a&&(a.closed=!0),s&&(s.closed=!0),typeof r=="function"&&r(o),o?al.nextTick(sCe,t,o):al.nextTick(Yoe,t)}try{t._destroy(e||null,i)}catch(o){i(o)}}function sCe(t,e){EB(t,e),Yoe(t)}function Yoe(t){let e=t._readableState,r=t._writableState;r&&(r.closeEmitted=!0),e&&(e.closeEmitted=!0),(r!=null&&r.emitClose||e!=null&&e.emitClose)&&t.emit("close")}function EB(t,e){let r=t._readableState,n=t._writableState;n!=null&&n.errorEmitted||r!=null&&r.errorEmitted||(n&&(n.errorEmitted=!0),r&&(r.errorEmitted=!0),t.emit("error",e))}function aCe(){let t=this._readableState,e=this._writableState;t&&(t.constructed=!0,t.closed=!1,t.closeEmitted=!1,t.destroyed=!1,t.errored=null,t.errorEmitted=!1,t.reading=!1,t.ended=t.readable===!1,t.endEmitted=t.readable===!1),e&&(e.constructed=!0,e.destroyed=!1,e.closed=!1,e.closeEmitted=!1,e.errored=null,e.errorEmitted=!1,e.finalCalled=!1,e.prefinished=!1,e.ended=e.writable===!1,e.ending=e.writable===!1,e.finished=e.writable===!1)}function SB(t,e,r){let n=t._readableState,i=t._writableState;if(i!=null&&i.destroyed||n!=null&&n.destroyed)return this;n!=null&&n.autoDestroy||i!=null&&i.autoDestroy?t.destroy(e):e&&(e.stack,i&&!i.errored&&(i.errored=e),n&&!n.errored&&(n.errored=e),r?al.nextTick(EB,t,e):EB(t,e))}function cCe(t,e){if(typeof t._construct!="function")return;let r=t._readableState,n=t._writableState;r&&(r.constructed=!1),n&&(n.constructed=!1),t.once(xB,e),!(t.listenerCount(xB)>1)&&al.nextTick(fCe,t)}function fCe(t){let e=!1;function r(n){if(e){SB(t,n??new XDe);return}e=!0;let i=t._readableState,o=t._writableState,s=o||i;i&&(i.constructed=!0),o&&(o.constructed=!0),s.destroyed?t.emit(Zoe,n):n?SB(t,n,!0):al.nextTick(uCe,t)}try{t._construct(n=>{al.nextTick(r,n)})}catch(n){al.nextTick(r,n)}}function uCe(t){t.emit(xB)}function Voe(t){return t?.setHeader&&typeof t.abort=="function"}function Qoe(t){t.emit("close")}function lCe(t,e){t.emit("error",e),al.nextTick(Qoe,t)}function dCe(t,e){!t||rCe(t)||(!e&&!nCe(t)&&(e=new eCe),iCe(t)?(t.socket=null,t.destroy(e)):Voe(t)?t.abort():Voe(t.req)?t.req.abort():typeof t.destroy=="function"?t.destroy(e):typeof t.close=="function"?t.close():e?al.nextTick(lCe,t,e):al.nextTick(Qoe,t),t.destroyed||(t[tCe]=!0))}Xoe.exports={construct:cCe,destroyer:dCe,destroy:oCe,undestroy:aCe,errorOrDestroy:SB}});var L5=H((uwt,tse)=>{"use strict";E();var{ArrayIsArray:hCe,ObjectSetPrototypeOf:ese}=ai(),{EventEmitter:q5}=Go();function $5(t){q5.call(this,t)}ese($5.prototype,q5.prototype);ese($5,q5);$5.prototype.pipe=function(t,e){let r=this;function n(p){t.writable&&t.write(p)===!1&&r.pause&&r.pause()}r.on("data",n);function i(){r.readable&&r.resume&&r.resume()}t.on("drain",i),!t._isStdio&&(!e||e.end!==!1)&&(r.on("end",s),r.on("close",a));let o=!1;function s(){o||(o=!0,t.end())}function a(){o||(o=!0,typeof t.destroy=="function"&&t.destroy())}function d(p){m(),q5.listenerCount(this,"error")===0&&this.emit("error",p)}MB(r,"error",d),MB(t,"error",d);function m(){r.removeListener("data",n),t.removeListener("drain",i),r.removeListener("end",s),r.removeListener("close",a),r.removeListener("error",d),t.removeListener("error",d),r.removeListener("end",m),r.removeListener("close",m),t.removeListener("close",m)}return r.on("end",m),r.on("close",m),t.on("close",m),t.emit("pipe",r),t};function MB(t,e,r){if(typeof t.prependListener=="function")return t.prependListener(e,r);!t._events||!t._events[e]?t.on(e,r):hCe(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]}tse.exports={Stream:$5,prependListener:MB}});var A_=H((dwt,U5)=>{"use strict";E();var{SymbolDispose:pCe}=ai(),{AbortError:rse,codes:mCe}=na(),{isNodeStream:nse,isWebStream:yCe,kControllerErrorFunction:gCe}=sl(),vCe=Fd(),{ERR_INVALID_ARG_TYPE:ise}=mCe,PB,bCe=(t,e)=>{if(typeof t!="object"||!("aborted"in t))throw new ise(e,"AbortSignal",t)};U5.exports.addAbortSignal=function(e,r){if(bCe(e,"signal"),!nse(r)&&!yCe(r))throw new ise("stream",["ReadableStream","WritableStream","Stream"],r);return U5.exports.addAbortSignalNoValidate(e,r)};U5.exports.addAbortSignalNoValidate=function(t,e){if(typeof t!="object"||!("aborted"in t))return e;let r=nse(e)?()=>{e.destroy(new rse(void 0,{cause:t.reason}))}:()=>{e[gCe](new rse(void 0,{cause:t.reason}))};if(t.aborted)r();else{PB=PB||qs().addAbortListener;let n=PB(t,r);vCe(e,n[pCe])}return e}});var ase=H((mwt,sse)=>{"use strict";E();var{StringPrototypeSlice:ose,SymbolIterator:wCe,TypedArrayPrototypeSet:F5,Uint8Array:_Ce}=ai(),{Buffer:AB}=sr(),{inspect:xCe}=qs();sse.exports=class{constructor(){this.head=null,this.tail=null,this.length=0}push(e){let r={data:e,next:null};this.length>0?this.tail.next=r:this.head=r,this.tail=r,++this.length}unshift(e){let r={data:e,next:this.head};this.length===0&&(this.tail=r),this.head=r,++this.length}shift(){if(this.length===0)return;let e=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,e}clear(){this.head=this.tail=null,this.length=0}join(e){if(this.length===0)return"";let r=this.head,n=""+r.data;for(;(r=r.next)!==null;)n+=e+r.data;return n}concat(e){if(this.length===0)return AB.alloc(0);let r=AB.allocUnsafe(e>>>0),n=this.head,i=0;for(;n;)F5(r,n.data,i),i+=n.data.length,n=n.next;return r}consume(e,r){let n=this.head.data;if(e<n.length){let i=n.slice(0,e);return this.head.data=n.slice(e),i}return e===n.length?this.shift():r?this._getString(e):this._getBuffer(e)}first(){return this.head.data}*[wCe](){for(let e=this.head;e;e=e.next)yield e.data}_getString(e){let r="",n=this.head,i=0;do{let o=n.data;if(e>o.length)r+=o,e-=o.length;else{e===o.length?(r+=o,++i,n.next?this.head=n.next:this.head=this.tail=null):(r+=ose(o,0,e),this.head=n,n.data=ose(o,e));break}++i}while((n=n.next)!==null);return this.length-=i,r}_getBuffer(e){let r=AB.allocUnsafe(e),n=e,i=this.head,o=0;do{let s=i.data;if(e>s.length)F5(r,s,n-e),e-=s.length;else{e===s.length?(F5(r,s,n-e),++o,i.next?this.head=i.next:this.head=this.tail=null):(F5(r,new _Ce(s.buffer,s.byteOffset,e),n-e),this.head=i,i.data=s.slice(e));break}++o}while((i=i.next)!==null);return this.length-=o,r}[Symbol.for("nodejs.util.inspect.custom")](e,r){return xCe(this,{...r,depth:0,customInspect:!1})}}});var T_=H((gwt,lse)=>{"use strict";E();var{MathFloor:ECe,NumberIsInteger:SCe}=ai(),{validateInteger:MCe}=xb(),{ERR_INVALID_ARG_VALUE:PCe}=na().codes,cse=16*1024,fse=16;function ACe(t,e,r){return t.highWaterMark!=null?t.highWaterMark:e?t[r]:null}function use(t){return t?fse:cse}function TCe(t,e){MCe(e,"value",0),t?fse=e:cse=e}function RCe(t,e,r,n){let i=ACe(e,n,r);if(i!=null){if(!SCe(i)||i<0){let o=n?`options.${r}`:"options.highWaterMark";throw new PCe(o,i)}return ECe(i)}return use(t.objectMode)}lse.exports={getHighWaterMark:RCe,getDefaultHighWaterMark:use,setDefaultHighWaterMark:TCe}});var TB=H((bwt,mse)=>{"use strict";E();var dse=ws(),{PromisePrototypeThen:ICe,SymbolAsyncIterator:hse,SymbolIterator:pse}=ai(),{Buffer:kCe}=sr(),{ERR_INVALID_ARG_TYPE:OCe,ERR_STREAM_NULL_VALUES:BCe}=na().codes;function DCe(t,e,r){let n;if(typeof e=="string"||e instanceof kCe)return new t({objectMode:!0,...r,read(){this.push(e),this.push(null)}});let i;if(e&&e[hse])i=!0,n=e[hse]();else if(e&&e[pse])i=!1,n=e[pse]();else throw new OCe("iterable",["Iterable"],e);let o=new t({objectMode:!0,highWaterMark:1,...r}),s=!1;o._read=function(){s||(s=!0,d())},o._destroy=function(m,p){ICe(a(m),()=>dse.nextTick(p,m),w=>dse.nextTick(p,w||m))};async function a(m){let p=m!=null,w=typeof n.throw=="function";if(p&&w){let{value:P,done:S}=await n.throw(m);if(await P,S)return}if(typeof n.return=="function"){let{value:P}=await n.return();await P}}async function d(){for(;;){try{let{value:m,done:p}=i?await n.next():n.next();if(p)o.push(null);else{let w=m&&typeof m.then=="function"?await m:m;if(w===null)throw s=!1,new BCe;if(o.push(w))continue;s=!1}}catch(m){o.destroy(m)}break}}return o}mse.exports=DCe});var I_=H((_wt,Bse)=>{E();var Hf=ws(),{ArrayPrototypeIndexOf:CCe,NumberIsInteger:jCe,NumberIsNaN:NCe,NumberParseInt:qCe,ObjectDefineProperties:jB,ObjectKeys:$Ce,ObjectSetPrototypeOf:vse,Promise:bse,SafeSet:LCe,SymbolAsyncDispose:UCe,SymbolAsyncIterator:FCe,Symbol:zCe}=ai();Bse.exports=gr;gr.ReadableState=W5;var{EventEmitter:KCe}=Go(),{Stream:kp,prependListener:GCe}=L5(),{Buffer:RB}=sr(),{addAbortSignal:WCe}=A_(),wse=Fd(),qr=qs().debuglog("stream",t=>{qr=t}),VCe=ase(),Pb=ry(),{getHighWaterMark:HCe,getDefaultHighWaterMark:ZCe}=T_(),{aggregateTwoErrors:yse,codes:{ERR_INVALID_ARG_TYPE:JCe,ERR_METHOD_NOT_IMPLEMENTED:YCe,ERR_OUT_OF_RANGE:QCe,ERR_STREAM_PUSH_AFTER_EOF:XCe,ERR_STREAM_UNSHIFT_AFTER_END_EVENT:eje},AbortError:tje}=na(),{validateObject:rje}=xb(),ny=zCe("kPaused"),{StringDecoder:_se}=Uu(),nje=TB();vse(gr.prototype,kp.prototype);vse(gr,kp);var IB=()=>{},{errorOrDestroy:Sb}=Pb,Mb=1<<0,ije=1<<1,xse=1<<2,R_=1<<3,Ese=1<<4,z5=1<<5,K5=1<<6,Sse=1<<7,oje=1<<8,sje=1<<9,aje=1<<10,DB=1<<11,CB=1<<12,cje=1<<13,fje=1<<14,uje=1<<15,Mse=1<<16,lje=1<<17,dje=1<<18;function lo(t){return{enumerable:!1,get(){return(this.state&t)!==0},set(e){e?this.state|=t:this.state&=~t}}}jB(W5.prototype,{objectMode:lo(Mb),ended:lo(ije),endEmitted:lo(xse),reading:lo(R_),constructed:lo(Ese),sync:lo(z5),needReadable:lo(K5),emittedReadable:lo(Sse),readableListening:lo(oje),resumeScheduled:lo(sje),errorEmitted:lo(aje),emitClose:lo(DB),autoDestroy:lo(CB),destroyed:lo(cje),closed:lo(fje),closeEmitted:lo(uje),multiAwaitDrain:lo(Mse),readingMore:lo(lje),dataEmitted:lo(dje)});function W5(t,e,r){typeof r!="boolean"&&(r=e instanceof cl()),this.state=DB|CB|Ese|z5,t&&t.objectMode&&(this.state|=Mb),r&&t&&t.readableObjectMode&&(this.state|=Mb),this.highWaterMark=t?HCe(this,t,"readableHighWaterMark",r):ZCe(!1),this.buffer=new VCe,this.length=0,this.pipes=[],this.flowing=null,this[ny]=null,t&&t.emitClose===!1&&(this.state&=~DB),t&&t.autoDestroy===!1&&(this.state&=~CB),this.errored=null,this.defaultEncoding=t&&t.defaultEncoding||"utf8",this.awaitDrainWriters=null,this.decoder=null,this.encoding=null,t&&t.encoding&&(this.decoder=new _se(t.encoding),this.encoding=t.encoding)}function gr(t){if(!(this instanceof gr))return new gr(t);let e=this instanceof cl();this._readableState=new W5(t,this,e),t&&(typeof t.read=="function"&&(this._read=t.read),typeof t.destroy=="function"&&(this._destroy=t.destroy),typeof t.construct=="function"&&(this._construct=t.construct),t.signal&&!e&&WCe(t.signal,this)),kp.call(this,t),Pb.construct(this,()=>{this._readableState.needReadable&&G5(this,this._readableState)})}gr.prototype.destroy=Pb.destroy;gr.prototype._undestroy=Pb.undestroy;gr.prototype._destroy=function(t,e){e(t)};gr.prototype[KCe.captureRejectionSymbol]=function(t){this.destroy(t)};gr.prototype[UCe]=function(){let t;return this.destroyed||(t=this.readableEnded?null:new tje,this.destroy(t)),new bse((e,r)=>wse(this,n=>n&&n!==t?r(n):e(null)))};gr.prototype.push=function(t,e){return Pse(this,t,e,!1)};gr.prototype.unshift=function(t,e){return Pse(this,t,e,!0)};function Pse(t,e,r,n){qr("readableAddChunk",e);let i=t._readableState,o;if(i.state&Mb||(typeof e=="string"?(r=r||i.defaultEncoding,i.encoding!==r&&(n&&i.encoding?e=RB.from(e,r).toString(i.encoding):(e=RB.from(e,r),r=""))):e instanceof RB?r="":kp._isUint8Array(e)?(e=kp._uint8ArrayToBuffer(e),r=""):e!=null&&(o=new JCe("chunk",["string","Buffer","Uint8Array"],e))),o)Sb(t,o);else if(e===null)i.state&=~R_,mje(t,i);else if(i.state&Mb||e&&e.length>0)if(n)if(i.state&xse)Sb(t,new eje);else{if(i.destroyed||i.errored)return!1;kB(t,i,e,!0)}else if(i.ended)Sb(t,new XCe);else{if(i.destroyed||i.errored)return!1;i.state&=~R_,i.decoder&&!r?(e=i.decoder.write(e),i.objectMode||e.length!==0?kB(t,i,e,!1):G5(t,i)):kB(t,i,e,!1)}else n||(i.state&=~R_,G5(t,i));return!i.ended&&(i.length<i.highWaterMark||i.length===0)}function kB(t,e,r,n){e.flowing&&e.length===0&&!e.sync&&t.listenerCount("data")>0?(e.state&Mse?e.awaitDrainWriters.clear():e.awaitDrainWriters=null,e.dataEmitted=!0,t.emit("data",r)):(e.length+=e.objectMode?1:r.length,n?e.buffer.unshift(r):e.buffer.push(r),e.state&K5&&V5(t)),G5(t,e)}gr.prototype.isPaused=function(){let t=this._readableState;return t[ny]===!0||t.flowing===!1};gr.prototype.setEncoding=function(t){let e=new _se(t);this._readableState.decoder=e,this._readableState.encoding=this._readableState.decoder.encoding;let r=this._readableState.buffer,n="";for(let i of r)n+=e.write(i);return r.clear(),n!==""&&r.push(n),this._readableState.length=n.length,this};var hje=1073741824;function pje(t){if(t>hje)throw new QCe("size","<= 1GiB",t);return t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++,t}function gse(t,e){return t<=0||e.length===0&&e.ended?0:e.state&Mb?1:NCe(t)?e.flowing&&e.length?e.buffer.first().length:e.length:t<=e.length?t:e.ended?e.length:0}gr.prototype.read=function(t){qr("read",t),t===void 0?t=NaN:jCe(t)||(t=qCe(t,10));let e=this._readableState,r=t;if(t>e.highWaterMark&&(e.highWaterMark=pje(t)),t!==0&&(e.state&=~Sse),t===0&&e.needReadable&&((e.highWaterMark!==0?e.length>=e.highWaterMark:e.length>0)||e.ended))return qr("read: emitReadable",e.length,e.ended),e.length===0&&e.ended?OB(this):V5(this),null;if(t=gse(t,e),t===0&&e.ended)return e.length===0&&OB(this),null;let n=(e.state&K5)!==0;if(qr("need readable",n),(e.length===0||e.length-t<e.highWaterMark)&&(n=!0,qr("length less than watermark",n)),e.ended||e.reading||e.destroyed||e.errored||!e.constructed)n=!1,qr("reading, ended or constructing",n);else if(n){qr("do read"),e.state|=R_|z5,e.length===0&&(e.state|=K5);try{this._read(e.highWaterMark)}catch(o){Sb(this,o)}e.state&=~z5,e.reading||(t=gse(r,e))}let i;return t>0?i=kse(t,e):i=null,i===null?(e.needReadable=e.length<=e.highWaterMark,t=0):(e.length-=t,e.multiAwaitDrain?e.awaitDrainWriters.clear():e.awaitDrainWriters=null),e.length===0&&(e.ended||(e.needReadable=!0),r!==t&&e.ended&&OB(this)),i!==null&&!e.errorEmitted&&!e.closeEmitted&&(e.dataEmitted=!0,this.emit("data",i)),i};function mje(t,e){if(qr("onEofChunk"),!e.ended){if(e.decoder){let r=e.decoder.end();r&&r.length&&(e.buffer.push(r),e.length+=e.objectMode?1:r.length)}e.ended=!0,e.sync?V5(t):(e.needReadable=!1,e.emittedReadable=!0,Ase(t))}}function V5(t){let e=t._readableState;qr("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||(qr("emitReadable",e.flowing),e.emittedReadable=!0,Hf.nextTick(Ase,t))}function Ase(t){let e=t._readableState;qr("emitReadable_",e.destroyed,e.length,e.ended),!e.destroyed&&!e.errored&&(e.length||e.ended)&&(t.emit("readable"),e.emittedReadable=!1),e.needReadable=!e.flowing&&!e.ended&&e.length<=e.highWaterMark,Rse(t)}function G5(t,e){!e.readingMore&&e.constructed&&(e.readingMore=!0,Hf.nextTick(yje,t,e))}function yje(t,e){for(;!e.reading&&!e.ended&&(e.length<e.highWaterMark||e.flowing&&e.length===0);){let r=e.length;if(qr("maybeReadMore read 0"),t.read(0),r===e.length)break}e.readingMore=!1}gr.prototype._read=function(t){throw new YCe("_read()")};gr.prototype.pipe=function(t,e){let r=this,n=this._readableState;n.pipes.length===1&&(n.multiAwaitDrain||(n.multiAwaitDrain=!0,n.awaitDrainWriters=new LCe(n.awaitDrainWriters?[n.awaitDrainWriters]:[]))),n.pipes.push(t),qr("pipe count=%d opts=%j",n.pipes.length,e);let o=(!e||e.end!==!1)&&t!==Hf.stdout&&t!==Hf.stderr?a:B;n.endEmitted?Hf.nextTick(o):r.once("end",o),t.on("unpipe",s);function s(I,C){qr("onunpipe"),I===r&&C&&C.hasUnpiped===!1&&(C.hasUnpiped=!0,p())}function a(){qr("onend"),t.end()}let d,m=!1;function p(){qr("cleanup"),t.removeListener("close",M),t.removeListener("finish",A),d&&t.removeListener("drain",d),t.removeListener("error",S),t.removeListener("unpipe",s),r.removeListener("end",a),r.removeListener("end",B),r.removeListener("data",P),m=!0,d&&n.awaitDrainWriters&&(!t._writableState||t._writableState.needDrain)&&d()}function w(){m||(n.pipes.length===1&&n.pipes[0]===t?(qr("false write response, pause",0),n.awaitDrainWriters=t,n.multiAwaitDrain=!1):n.pipes.length>1&&n.pipes.includes(t)&&(qr("false write response, pause",n.awaitDrainWriters.size),n.awaitDrainWriters.add(t)),r.pause()),d||(d=gje(r,t),t.on("drain",d))}r.on("data",P);function P(I){qr("ondata");let C=t.write(I);qr("dest.write",C),C===!1&&w()}function S(I){if(qr("onerror",I),B(),t.removeListener("error",S),t.listenerCount("error")===0){let C=t._writableState||t._readableState;C&&!C.errorEmitted?Sb(t,I):t.emit("error",I)}}GCe(t,"error",S);function M(){t.removeListener("finish",A),B()}t.once("close",M);function A(){qr("onfinish"),t.removeListener("close",M),B()}t.once("finish",A);function B(){qr("unpipe"),r.unpipe(t)}return t.emit("pipe",r),t.writableNeedDrain===!0?w():n.flowing||(qr("pipe resume"),r.resume()),t};function gje(t,e){return function(){let n=t._readableState;n.awaitDrainWriters===e?(qr("pipeOnDrain",1),n.awaitDrainWriters=null):n.multiAwaitDrain&&(qr("pipeOnDrain",n.awaitDrainWriters.size),n.awaitDrainWriters.delete(e)),(!n.awaitDrainWriters||n.awaitDrainWriters.size===0)&&t.listenerCount("data")&&t.resume()}}gr.prototype.unpipe=function(t){let e=this._readableState,r={hasUnpiped:!1};if(e.pipes.length===0)return this;if(!t){let i=e.pipes;e.pipes=[],this.pause();for(let o=0;o<i.length;o++)i[o].emit("unpipe",this,{hasUnpiped:!1});return this}let n=CCe(e.pipes,t);return n===-1?this:(e.pipes.splice(n,1),e.pipes.length===0&&this.pause(),t.emit("unpipe",this,r),this)};gr.prototype.on=function(t,e){let r=kp.prototype.on.call(this,t,e),n=this._readableState;return t==="data"?(n.readableListening=this.listenerCount("readable")>0,n.flowing!==!1&&this.resume()):t==="readable"&&!n.endEmitted&&!n.readableListening&&(n.readableListening=n.needReadable=!0,n.flowing=!1,n.emittedReadable=!1,qr("on readable",n.length,n.reading),n.length?V5(this):n.reading||Hf.nextTick(vje,this)),r};gr.prototype.addListener=gr.prototype.on;gr.prototype.removeListener=function(t,e){let r=kp.prototype.removeListener.call(this,t,e);return t==="readable"&&Hf.nextTick(Tse,this),r};gr.prototype.off=gr.prototype.removeListener;gr.prototype.removeAllListeners=function(t){let e=kp.prototype.removeAllListeners.apply(this,arguments);return(t==="readable"||t===void 0)&&Hf.nextTick(Tse,this),e};function Tse(t){let e=t._readableState;e.readableListening=t.listenerCount("readable")>0,e.resumeScheduled&&e[ny]===!1?e.flowing=!0:t.listenerCount("data")>0?t.resume():e.readableListening||(e.flowing=null)}function vje(t){qr("readable nexttick read 0"),t.read(0)}gr.prototype.resume=function(){let t=this._readableState;return t.flowing||(qr("resume"),t.flowing=!t.readableListening,bje(this,t)),t[ny]=!1,this};function bje(t,e){e.resumeScheduled||(e.resumeScheduled=!0,Hf.nextTick(wje,t,e))}function wje(t,e){qr("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),Rse(t),e.flowing&&!e.reading&&t.read(0)}gr.prototype.pause=function(){return qr("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(qr("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState[ny]=!0,this};function Rse(t){let e=t._readableState;for(qr("flow",e.flowing);e.flowing&&t.read()!==null;);}gr.prototype.wrap=function(t){let e=!1;t.on("data",n=>{!this.push(n)&&t.pause&&(e=!0,t.pause())}),t.on("end",()=>{this.push(null)}),t.on("error",n=>{Sb(this,n)}),t.on("close",()=>{this.destroy()}),t.on("destroy",()=>{this.destroy()}),this._read=()=>{e&&t.resume&&(e=!1,t.resume())};let r=$Ce(t);for(let n=1;n<r.length;n++){let i=r[n];this[i]===void 0&&typeof t[i]=="function"&&(this[i]=t[i].bind(t))}return this};gr.prototype[FCe]=function(){return Ise(this)};gr.prototype.iterator=function(t){return t!==void 0&&rje(t,"options"),Ise(this,t)};function Ise(t,e){typeof t.read!="function"&&(t=gr.wrap(t,{objectMode:!0}));let r=_je(t,e);return r.stream=t,r}async function*_je(t,e){let r=IB;function n(s){this===t?(r(),r=IB):r=s}t.on("readable",n);let i,o=wse(t,{writable:!1},s=>{i=s?yse(i,s):null,r(),r=IB});try{for(;;){let s=t.destroyed?null:t.read();if(s!==null)yield s;else{if(i)throw i;if(i===null)return;await new bse(n)}}}catch(s){throw i=yse(i,s),i}finally{(i||e?.destroyOnReturn!==!1)&&(i===void 0||t._readableState.autoDestroy)?Pb.destroyer(t,null):(t.off("readable",n),o())}}jB(gr.prototype,{readable:{__proto__:null,get(){let t=this._readableState;return!!t&&t.readable!==!1&&!t.destroyed&&!t.errorEmitted&&!t.endEmitted},set(t){this._readableState&&(this._readableState.readable=!!t)}},readableDidRead:{__proto__:null,enumerable:!1,get:function(){return this._readableState.dataEmitted}},readableAborted:{__proto__:null,enumerable:!1,get:function(){return!!(this._readableState.readable!==!1&&(this._readableState.destroyed||this._readableState.errored)&&!this._readableState.endEmitted)}},readableHighWaterMark:{__proto__:null,enumerable:!1,get:function(){return this._readableState.highWaterMark}},readableBuffer:{__proto__:null,enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}},readableFlowing:{__proto__:null,enumerable:!1,get:function(){return this._readableState.flowing},set:function(t){this._readableState&&(this._readableState.flowing=t)}},readableLength:{__proto__:null,enumerable:!1,get(){return this._readableState.length}},readableObjectMode:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.objectMode:!1}},readableEncoding:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.encoding:null}},errored:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.errored:null}},closed:{__proto__:null,get(){return this._readableState?this._readableState.closed:!1}},destroyed:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.destroyed:!1},set(t){this._readableState&&(this._readableState.destroyed=t)}},readableEnded:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.endEmitted:!1}}});jB(W5.prototype,{pipesCount:{__proto__:null,get(){return this.pipes.length}},paused:{__proto__:null,get(){return this[ny]!==!1},set(t){this[ny]=!!t}}});gr._fromList=kse;function kse(t,e){if(e.length===0)return null;let r;return e.objectMode?r=e.buffer.shift():!t||t>=e.length?(e.decoder?r=e.buffer.join(""):e.buffer.length===1?r=e.buffer.first():r=e.buffer.concat(e.length),e.buffer.clear()):r=e.buffer.consume(t,e.decoder),r}function OB(t){let e=t._readableState;qr("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,Hf.nextTick(xje,e,t))}function xje(t,e){if(qr("endReadableNT",t.endEmitted,t.length),!t.errored&&!t.closeEmitted&&!t.endEmitted&&t.length===0){if(t.endEmitted=!0,e.emit("end"),e.writable&&e.allowHalfOpen===!1)Hf.nextTick(Eje,e);else if(t.autoDestroy){let r=e._writableState;(!r||r.autoDestroy&&(r.finished||r.writable===!1))&&e.destroy()}}}function Eje(t){t.writable&&!t.writableEnded&&!t.destroyed&&t.end()}gr.from=function(t,e){return nje(gr,t,e)};var BB;function Ose(){return BB===void 0&&(BB={}),BB}gr.fromWeb=function(t,e){return Ose().newStreamReadableFromReadableStream(t,e)};gr.toWeb=function(t,e){return Ose().newReadableStreamFromStreamReadable(t,e)};gr.wrap=function(t,e){var r,n;return new gr({objectMode:(r=(n=t.readableObjectMode)!==null&&n!==void 0?n:t.objectMode)!==null&&r!==void 0?r:!0,...e,destroy(i,o){Pb.destroyer(t,i),o(i)}}).wrap(t)}});var Q5=H((Ewt,Gse)=>{E();var iy=ws(),{ArrayPrototypeSlice:jse,Error:Sje,FunctionPrototypeSymbolHasInstance:Nse,ObjectDefineProperty:qse,ObjectDefineProperties:Mje,ObjectSetPrototypeOf:$se,StringPrototypeToLowerCase:Pje,Symbol:Aje,SymbolHasInstance:Tje}=ai();Gse.exports=ci;ci.WritableState=B_;var{EventEmitter:Rje}=Go(),k_=L5().Stream,{Buffer:H5}=sr(),Y5=ry(),{addAbortSignal:Ije}=A_(),{getHighWaterMark:kje,getDefaultHighWaterMark:Oje}=T_(),{ERR_INVALID_ARG_TYPE:Bje,ERR_METHOD_NOT_IMPLEMENTED:Dje,ERR_MULTIPLE_CALLBACK:Lse,ERR_STREAM_CANNOT_PIPE:Cje,ERR_STREAM_DESTROYED:O_,ERR_STREAM_ALREADY_FINISHED:jje,ERR_STREAM_NULL_VALUES:Nje,ERR_STREAM_WRITE_AFTER_END:qje,ERR_UNKNOWN_ENCODING:Use}=na().codes,{errorOrDestroy:Ab}=Y5;$se(ci.prototype,k_.prototype);$se(ci,k_);function $B(){}var Tb=Aje("kOnFinished");function B_(t,e,r){typeof r!="boolean"&&(r=e instanceof cl()),this.objectMode=!!(t&&t.objectMode),r&&(this.objectMode=this.objectMode||!!(t&&t.writableObjectMode)),this.highWaterMark=t?kje(this,t,"writableHighWaterMark",r):Oje(!1),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;let n=!!(t&&t.decodeStrings===!1);this.decodeStrings=!n,this.defaultEncoding=t&&t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=Lje.bind(void 0,e),this.writecb=null,this.writelen=0,this.afterWriteTickInfo=null,J5(this),this.pendingcb=0,this.constructed=!0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!t||t.emitClose!==!1,this.autoDestroy=!t||t.autoDestroy!==!1,this.errored=null,this.closed=!1,this.closeEmitted=!1,this[Tb]=[]}function J5(t){t.buffered=[],t.bufferedIndex=0,t.allBuffers=!0,t.allNoop=!0}B_.prototype.getBuffer=function(){return jse(this.buffered,this.bufferedIndex)};qse(B_.prototype,"bufferedRequestCount",{__proto__:null,get(){return this.buffered.length-this.bufferedIndex}});function ci(t){let e=this instanceof cl();if(!e&&!Nse(ci,this))return new ci(t);this._writableState=new B_(t,this,e),t&&(typeof t.write=="function"&&(this._write=t.write),typeof t.writev=="function"&&(this._writev=t.writev),typeof t.destroy=="function"&&(this._destroy=t.destroy),typeof t.final=="function"&&(this._final=t.final),typeof t.construct=="function"&&(this._construct=t.construct),t.signal&&Ije(t.signal,this)),k_.call(this,t),Y5.construct(this,()=>{let r=this._writableState;r.writing||UB(this,r),FB(this,r)})}qse(ci,Tje,{__proto__:null,value:function(t){return Nse(this,t)?!0:this!==ci?!1:t&&t._writableState instanceof B_}});ci.prototype.pipe=function(){Ab(this,new Cje)};function Fse(t,e,r,n){let i=t._writableState;if(typeof r=="function")n=r,r=i.defaultEncoding;else{if(!r)r=i.defaultEncoding;else if(r!=="buffer"&&!H5.isEncoding(r))throw new Use(r);typeof n!="function"&&(n=$B)}if(e===null)throw new Nje;if(!i.objectMode)if(typeof e=="string")i.decodeStrings!==!1&&(e=H5.from(e,r),r="buffer");else if(e instanceof H5)r="buffer";else if(k_._isUint8Array(e))e=k_._uint8ArrayToBuffer(e),r="buffer";else throw new Bje("chunk",["string","Buffer","Uint8Array"],e);let o;return i.ending?o=new qje:i.destroyed&&(o=new O_("write")),o?(iy.nextTick(n,o),Ab(t,o,!0),o):(i.pendingcb++,$je(t,i,e,r,n))}ci.prototype.write=function(t,e,r){return Fse(this,t,e,r)===!0};ci.prototype.cork=function(){this._writableState.corked++};ci.prototype.uncork=function(){let t=this._writableState;t.corked&&(t.corked--,t.writing||UB(this,t))};ci.prototype.setDefaultEncoding=function(e){if(typeof e=="string"&&(e=Pje(e)),!H5.isEncoding(e))throw new Use(e);return this._writableState.defaultEncoding=e,this};function $je(t,e,r,n,i){let o=e.objectMode?1:r.length;e.length+=o;let s=e.length<e.highWaterMark;return s||(e.needDrain=!0),e.writing||e.corked||e.errored||!e.constructed?(e.buffered.push({chunk:r,encoding:n,callback:i}),e.allBuffers&&n!=="buffer"&&(e.allBuffers=!1),e.allNoop&&i!==$B&&(e.allNoop=!1)):(e.writelen=o,e.writecb=i,e.writing=!0,e.sync=!0,t._write(r,n,e.onwrite),e.sync=!1),s&&!e.errored&&!e.destroyed}function Dse(t,e,r,n,i,o,s){e.writelen=n,e.writecb=s,e.writing=!0,e.sync=!0,e.destroyed?e.onwrite(new O_("write")):r?t._writev(i,e.onwrite):t._write(i,o,e.onwrite),e.sync=!1}function Cse(t,e,r,n){--e.pendingcb,n(r),LB(e),Ab(t,r)}function Lje(t,e){let r=t._writableState,n=r.sync,i=r.writecb;if(typeof i!="function"){Ab(t,new Lse);return}r.writing=!1,r.writecb=null,r.length-=r.writelen,r.writelen=0,e?(e.stack,r.errored||(r.errored=e),t._readableState&&!t._readableState.errored&&(t._readableState.errored=e),n?iy.nextTick(Cse,t,r,e,i):Cse(t,r,e,i)):(r.buffered.length>r.bufferedIndex&&UB(t,r),n?r.afterWriteTickInfo!==null&&r.afterWriteTickInfo.cb===i?r.afterWriteTickInfo.count++:(r.afterWriteTickInfo={count:1,cb:i,stream:t,state:r},iy.nextTick(Uje,r.afterWriteTickInfo)):zse(t,r,1,i))}function Uje({stream:t,state:e,count:r,cb:n}){return e.afterWriteTickInfo=null,zse(t,e,r,n)}function zse(t,e,r,n){for(!e.ending&&!t.destroyed&&e.length===0&&e.needDrain&&(e.needDrain=!1,t.emit("drain"));r-- >0;)e.pendingcb--,n();e.destroyed&&LB(e),FB(t,e)}function LB(t){if(t.writing)return;for(let i=t.bufferedIndex;i<t.buffered.length;++i){var e;let{chunk:o,callback:s}=t.buffered[i],a=t.objectMode?1:o.length;t.length-=a,s((e=t.errored)!==null&&e!==void 0?e:new O_("write"))}let r=t[Tb].splice(0);for(let i=0;i<r.length;i++){var n;r[i]((n=t.errored)!==null&&n!==void 0?n:new O_("end"))}J5(t)}function UB(t,e){if(e.corked||e.bufferProcessing||e.destroyed||!e.constructed)return;let{buffered:r,bufferedIndex:n,objectMode:i}=e,o=r.length-n;if(!o)return;let s=n;if(e.bufferProcessing=!0,o>1&&t._writev){e.pendingcb-=o-1;let a=e.allNoop?$B:m=>{for(let p=s;p<r.length;++p)r[p].callback(m)},d=e.allNoop&&s===0?r:jse(r,s);d.allBuffers=e.allBuffers,Dse(t,e,!0,e.length,d,"",a),J5(e)}else{do{let{chunk:a,encoding:d,callback:m}=r[s];r[s++]=null;let p=i?1:a.length;Dse(t,e,!1,p,a,d,m)}while(s<r.length&&!e.writing);s===r.length?J5(e):s>256?(r.splice(0,s),e.bufferedIndex=0):e.bufferedIndex=s}e.bufferProcessing=!1}ci.prototype._write=function(t,e,r){if(this._writev)this._writev([{chunk:t,encoding:e}],r);else throw new Dje("_write()")};ci.prototype._writev=null;ci.prototype.end=function(t,e,r){let n=this._writableState;typeof t=="function"?(r=t,t=null,e=null):typeof e=="function"&&(r=e,e=null);let i;if(t!=null){let o=Fse(this,t,e);o instanceof Sje&&(i=o)}return n.corked&&(n.corked=1,this.uncork()),i||(!n.errored&&!n.ending?(n.ending=!0,FB(this,n,!0),n.ended=!0):n.finished?i=new jje("end"):n.destroyed&&(i=new O_("end"))),typeof r=="function"&&(i||n.finished?iy.nextTick(r,i):n[Tb].push(r)),this};function Z5(t){return t.ending&&!t.destroyed&&t.constructed&&t.length===0&&!t.errored&&t.buffered.length===0&&!t.finished&&!t.writing&&!t.errorEmitted&&!t.closeEmitted}function Fje(t,e){let r=!1;function n(i){if(r){Ab(t,i??Lse());return}if(r=!0,e.pendingcb--,i){let o=e[Tb].splice(0);for(let s=0;s<o.length;s++)o[s](i);Ab(t,i,e.sync)}else Z5(e)&&(e.prefinished=!0,t.emit("prefinish"),e.pendingcb++,iy.nextTick(qB,t,e))}e.sync=!0,e.pendingcb++;try{t._final(n)}catch(i){n(i)}e.sync=!1}function zje(t,e){!e.prefinished&&!e.finalCalled&&(typeof t._final=="function"&&!e.destroyed?(e.finalCalled=!0,Fje(t,e)):(e.prefinished=!0,t.emit("prefinish")))}function FB(t,e,r){Z5(e)&&(zje(t,e),e.pendingcb===0&&(r?(e.pendingcb++,iy.nextTick((n,i)=>{Z5(i)?qB(n,i):i.pendingcb--},t,e)):Z5(e)&&(e.pendingcb++,qB(t,e))))}function qB(t,e){e.pendingcb--,e.finished=!0;let r=e[Tb].splice(0);for(let n=0;n<r.length;n++)r[n]();if(t.emit("finish"),e.autoDestroy){let n=t._readableState;(!n||n.autoDestroy&&(n.endEmitted||n.readable===!1))&&t.destroy()}}Mje(ci.prototype,{closed:{__proto__:null,get(){return this._writableState?this._writableState.closed:!1}},destroyed:{__proto__:null,get(){return this._writableState?this._writableState.destroyed:!1},set(t){this._writableState&&(this._writableState.destroyed=t)}},writable:{__proto__:null,get(){let t=this._writableState;return!!t&&t.writable!==!1&&!t.destroyed&&!t.errored&&!t.ending&&!t.ended},set(t){this._writableState&&(this._writableState.writable=!!t)}},writableFinished:{__proto__:null,get(){return this._writableState?this._writableState.finished:!1}},writableObjectMode:{__proto__:null,get(){return this._writableState?this._writableState.objectMode:!1}},writableBuffer:{__proto__:null,get(){return this._writableState&&this._writableState.getBuffer()}},writableEnded:{__proto__:null,get(){return this._writableState?this._writableState.ending:!1}},writableNeedDrain:{__proto__:null,get(){let t=this._writableState;return t?!t.destroyed&&!t.ending&&t.needDrain:!1}},writableHighWaterMark:{__proto__:null,get(){return this._writableState&&this._writableState.highWaterMark}},writableCorked:{__proto__:null,get(){return this._writableState?this._writableState.corked:0}},writableLength:{__proto__:null,get(){return this._writableState&&this._writableState.length}},errored:{__proto__:null,enumerable:!1,get(){return this._writableState?this._writableState.errored:null}},writableAborted:{__proto__:null,enumerable:!1,get:function(){return!!(this._writableState.writable!==!1&&(this._writableState.destroyed||this._writableState.errored)&&!this._writableState.finished)}}});var Kje=Y5.destroy;ci.prototype.destroy=function(t,e){let r=this._writableState;return!r.destroyed&&(r.bufferedIndex<r.buffered.length||r[Tb].length)&&iy.nextTick(LB,r),Kje.call(this,t,e),this};ci.prototype._undestroy=Y5.undestroy;ci.prototype._destroy=function(t,e){e(t)};ci.prototype[Rje.captureRejectionSymbol]=function(t){this.destroy(t)};var NB;function Kse(){return NB===void 0&&(NB={}),NB}ci.fromWeb=function(t,e){return Kse().newStreamWritableFromWritableStream(t,e)};ci.toWeb=function(t){return Kse().newWritableStreamFromStreamWritable(t)}});var sae=H((Mwt,oae)=>{E();var zB=ws(),Gje=sr(),{isReadable:Wje,isWritable:Vje,isIterable:Wse,isNodeStream:Hje,isReadableNodeStream:Vse,isWritableNodeStream:Hse,isDuplexNodeStream:Zje,isReadableStream:Zse,isWritableStream:Jse}=sl(),Yse=Fd(),{AbortError:nae,codes:{ERR_INVALID_ARG_TYPE:Jje,ERR_INVALID_RETURN_VALUE:Qse}}=na(),{destroyer:Ib}=ry(),Yje=cl(),iae=I_(),Qje=Q5(),{createDeferredPromise:Xse}=qs(),eae=TB(),tae=globalThis.Blob||Gje.Blob,Xje=typeof tae<"u"?function(e){return e instanceof tae}:function(e){return!1},eNe=globalThis.AbortController||Ud().AbortController,{FunctionPrototypeCall:rae}=ai(),Op=class extends Yje{constructor(e){super(e),e?.readable===!1&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),e?.writable===!1&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)}};oae.exports=function t(e,r){if(Zje(e))return e;if(Vse(e))return Rb({readable:e});if(Hse(e))return Rb({writable:e});if(Hje(e))return Rb({writable:!1,readable:!1});if(Zse(e))return Rb({readable:iae.fromWeb(e)});if(Jse(e))return Rb({writable:Qje.fromWeb(e)});if(typeof e=="function"){let{value:i,write:o,final:s,destroy:a}=tNe(e);if(Wse(i))return eae(Op,i,{objectMode:!0,write:o,final:s,destroy:a});let d=i?.then;if(typeof d=="function"){let m,p=rae(d,i,w=>{if(w!=null)throw new Qse("nully","body",w)},w=>{Ib(m,w)});return m=new Op({objectMode:!0,readable:!1,write:o,final(w){s(async()=>{try{await p,zB.nextTick(w,null)}catch(P){zB.nextTick(w,P)}})},destroy:a})}throw new Qse("Iterable, AsyncIterable or AsyncFunction",r,i)}if(Xje(e))return t(e.arrayBuffer());if(Wse(e))return eae(Op,e,{objectMode:!0,writable:!1});if(Zse(e?.readable)&&Jse(e?.writable))return Op.fromWeb(e);if(typeof e?.writable=="object"||typeof e?.readable=="object"){let i=e!=null&&e.readable?Vse(e?.readable)?e?.readable:t(e.readable):void 0,o=e!=null&&e.writable?Hse(e?.writable)?e?.writable:t(e.writable):void 0;return Rb({readable:i,writable:o})}let n=e?.then;if(typeof n=="function"){let i;return rae(n,e,o=>{o!=null&&i.push(o),i.push(null)},o=>{Ib(i,o)}),i=new Op({objectMode:!0,writable:!1,read(){}})}throw new Jje(r,["Blob","ReadableStream","WritableStream","Stream","Iterable","AsyncIterable","Function","{ readable, writable } pair","Promise"],e)};function tNe(t){let{promise:e,resolve:r}=Xse(),n=new eNe,i=n.signal;return{value:t(async function*(){for(;;){let s=e;e=null;let{chunk:a,done:d,cb:m}=await s;if(zB.nextTick(m),d)return;if(i.aborted)throw new nae(void 0,{cause:i.reason});({promise:e,resolve:r}=Xse()),yield a}}(),{signal:i}),write(s,a,d){let m=r;r=null,m({chunk:s,done:!1,cb:d})},final(s){let a=r;r=null,a({done:!0,cb:s})},destroy(s,a){n.abort(),a(s)}}}function Rb(t){let e=t.readable&&typeof t.readable.read!="function"?iae.wrap(t.readable):t.readable,r=t.writable,n=!!Wje(e),i=!!Vje(r),o,s,a,d,m;function p(w){let P=d;d=null,P?P(w):w&&m.destroy(w)}return m=new Op({readableObjectMode:!!(e!=null&&e.readableObjectMode),writableObjectMode:!!(r!=null&&r.writableObjectMode),readable:n,writable:i}),i&&(Yse(r,w=>{i=!1,w&&Ib(e,w),p(w)}),m._write=function(w,P,S){r.write(w,P)?S():o=S},m._final=function(w){r.end(),s=w},r.on("drain",function(){if(o){let w=o;o=null,w()}}),r.on("finish",function(){if(s){let w=s;s=null,w()}})),n&&(Yse(e,w=>{n=!1,w&&Ib(e,w),p(w)}),e.on("readable",function(){if(a){let w=a;a=null,w()}}),e.on("end",function(){m.push(null)}),m._read=function(){for(;;){let w=e.read();if(w===null){a=m._read;return}if(!m.push(w))return}}),m._destroy=function(w,P){!w&&d!==null&&(w=new nae),a=null,o=null,s=null,d===null?P(w):(d=P,Ib(r,w),Ib(e,w))},m}});var cl=H((Awt,fae)=>{"use strict";E();var{ObjectDefineProperties:rNe,ObjectGetOwnPropertyDescriptor:zd,ObjectKeys:nNe,ObjectSetPrototypeOf:aae}=ai();fae.exports=Zf;var WB=I_(),Yc=Q5();aae(Zf.prototype,WB.prototype);aae(Zf,WB);{let t=nNe(Yc.prototype);for(let e=0;e<t.length;e++){let r=t[e];Zf.prototype[r]||(Zf.prototype[r]=Yc.prototype[r])}}function Zf(t){if(!(this instanceof Zf))return new Zf(t);WB.call(this,t),Yc.call(this,t),t?(this.allowHalfOpen=t.allowHalfOpen!==!1,t.readable===!1&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),t.writable===!1&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)):this.allowHalfOpen=!0}rNe(Zf.prototype,{writable:{__proto__:null,...zd(Yc.prototype,"writable")},writableHighWaterMark:{__proto__:null,...zd(Yc.prototype,"writableHighWaterMark")},writableObjectMode:{__proto__:null,...zd(Yc.prototype,"writableObjectMode")},writableBuffer:{__proto__:null,...zd(Yc.prototype,"writableBuffer")},writableLength:{__proto__:null,...zd(Yc.prototype,"writableLength")},writableFinished:{__proto__:null,...zd(Yc.prototype,"writableFinished")},writableCorked:{__proto__:null,...zd(Yc.prototype,"writableCorked")},writableEnded:{__proto__:null,...zd(Yc.prototype,"writableEnded")},writableNeedDrain:{__proto__:null,...zd(Yc.prototype,"writableNeedDrain")},destroyed:{__proto__:null,get(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set(t){this._readableState&&this._writableState&&(this._readableState.destroyed=t,this._writableState.destroyed=t)}}});var KB;function cae(){return KB===void 0&&(KB={}),KB}Zf.fromWeb=function(t,e){return cae().newStreamDuplexFromReadableWritablePair(t,e)};Zf.toWeb=function(t){return cae().newReadableWritablePairFromDuplex(t)};var GB;Zf.from=function(t){return GB||(GB=sae()),GB(t,"body")}});var ZB=H((Rwt,lae)=>{"use strict";E();var{ObjectSetPrototypeOf:uae,Symbol:iNe}=ai();lae.exports=Kd;var{ERR_METHOD_NOT_IMPLEMENTED:oNe}=na().codes,HB=cl(),{getHighWaterMark:sNe}=T_();uae(Kd.prototype,HB.prototype);uae(Kd,HB);var D_=iNe("kCallback");function Kd(t){if(!(this instanceof Kd))return new Kd(t);let e=t?sNe(this,t,"readableHighWaterMark",!0):null;e===0&&(t={...t,highWaterMark:null,readableHighWaterMark:e,writableHighWaterMark:t.writableHighWaterMark||0}),HB.call(this,t),this._readableState.sync=!1,this[D_]=null,t&&(typeof t.transform=="function"&&(this._transform=t.transform),typeof t.flush=="function"&&(this._flush=t.flush)),this.on("prefinish",aNe)}function VB(t){typeof this._flush=="function"&&!this.destroyed?this._flush((e,r)=>{if(e){t?t(e):this.destroy(e);return}r!=null&&this.push(r),this.push(null),t&&t()}):(this.push(null),t&&t())}function aNe(){this._final!==VB&&VB.call(this)}Kd.prototype._final=VB;Kd.prototype._transform=function(t,e,r){throw new oNe("_transform()")};Kd.prototype._write=function(t,e,r){let n=this._readableState,i=this._writableState,o=n.length;this._transform(t,e,(s,a)=>{if(s){r(s);return}a!=null&&this.push(a),i.ended||o===n.length||n.length<n.highWaterMark?r():this[D_]=r})};Kd.prototype._read=function(){if(this[D_]){let t=this[D_];this[D_]=null,t()}}});var YB=H((kwt,hae)=>{"use strict";E();var{ObjectSetPrototypeOf:dae}=ai();hae.exports=kb;var JB=ZB();dae(kb.prototype,JB.prototype);dae(kb,JB);function kb(t){if(!(this instanceof kb))return new kb(t);JB.call(this,t)}kb.prototype._transform=function(t,e,r){r(null,t)}});var r8=H((Bwt,vae)=>{E();var C_=ws(),{ArrayIsArray:cNe,Promise:fNe,SymbolAsyncIterator:uNe,SymbolDispose:lNe}=ai(),t8=Fd(),{once:dNe}=qs(),hNe=ry(),pae=cl(),{aggregateTwoErrors:pNe,codes:{ERR_INVALID_ARG_TYPE:sD,ERR_INVALID_RETURN_VALUE:QB,ERR_MISSING_ARGS:mNe,ERR_STREAM_DESTROYED:yNe,ERR_STREAM_PREMATURE_CLOSE:gNe},AbortError:vNe}=na(),{validateFunction:bNe,validateAbortSignal:wNe}=xb(),{isIterable:oy,isReadable:XB,isReadableNodeStream:e8,isNodeStream:mae,isTransformStream:Ob,isWebStream:_Ne,isReadableStream:eD,isReadableFinished:xNe}=sl(),ENe=globalThis.AbortController||Ud().AbortController,tD,rD,nD;function yae(t,e,r){let n=!1;t.on("close",()=>{n=!0});let i=t8(t,{readable:e,writable:r},o=>{n=!o});return{destroy:o=>{n||(n=!0,hNe.destroyer(t,o||new yNe("pipe")))},cleanup:i}}function SNe(t){return bNe(t[t.length-1],"streams[stream.length - 1]"),t.pop()}function iD(t){if(oy(t))return t;if(e8(t))return MNe(t);throw new sD("val",["Readable","Iterable","AsyncIterable"],t)}async function*MNe(t){rD||(rD=I_()),yield*rD.prototype[uNe].call(t)}async function X5(t,e,r,{end:n}){let i,o=null,s=m=>{if(m&&(i=m),o){let p=o;o=null,p()}},a=()=>new fNe((m,p)=>{i?p(i):o=()=>{i?p(i):m()}});e.on("drain",s);let d=t8(e,{readable:!1},s);try{e.writableNeedDrain&&await a();for await(let m of t)e.write(m)||await a();n&&(e.end(),await a()),r()}catch(m){r(i!==m?pNe(i,m):m)}finally{d(),e.off("drain",s)}}async function oD(t,e,r,{end:n}){Ob(e)&&(e=e.writable);let i=e.getWriter();try{for await(let o of t)await i.ready,i.write(o).catch(()=>{});await i.ready,n&&await i.close(),r()}catch(o){try{await i.abort(o),r(o)}catch(s){r(s)}}}function PNe(...t){return gae(t,dNe(SNe(t)))}function gae(t,e,r){if(t.length===1&&cNe(t[0])&&(t=t[0]),t.length<2)throw new mNe("streams");let n=new ENe,i=n.signal,o=r?.signal,s=[];wNe(o,"options.signal");function a(){M(new vNe)}nD=nD||qs().addAbortListener;let d;o&&(d=nD(o,a));let m,p,w=[],P=0;function S(k){M(k,--P===0)}function M(k,q){var L;if(k&&(!m||m.code==="ERR_STREAM_PREMATURE_CLOSE")&&(m=k),!(!m&&!q)){for(;w.length;)w.shift()(m);(L=d)===null||L===void 0||L[lNe](),n.abort(),q&&(m||s.forEach(U=>U()),C_.nextTick(e,m,p))}}let A;for(let k=0;k<t.length;k++){let q=t[k],L=k<t.length-1,U=k>0,F=L||r?.end!==!1,N=k===t.length-1;if(mae(q)){let G=function(x){x&&x.name!=="AbortError"&&x.code!=="ERR_STREAM_PREMATURE_CLOSE"&&S(x)};var C=G;if(F){let{destroy:x,cleanup:c}=yae(q,L,U);w.push(x),XB(q)&&N&&s.push(c)}q.on("error",G),XB(q)&&N&&s.push(()=>{q.removeListener("error",G)})}if(k===0)if(typeof q=="function"){if(A=q({signal:i}),!oy(A))throw new QB("Iterable, AsyncIterable or Stream","source",A)}else oy(q)||e8(q)||Ob(q)?A=q:A=pae.from(q);else if(typeof q=="function"){if(Ob(A)){var B;A=iD((B=A)===null||B===void 0?void 0:B.readable)}else A=iD(A);if(A=q(A,{signal:i}),L){if(!oy(A,!0))throw new QB("AsyncIterable",`transform[${k-1}]`,A)}else{var I;tD||(tD=YB());let G=new tD({objectMode:!0}),x=(I=A)===null||I===void 0?void 0:I.then;if(typeof x=="function")P++,x.call(A,y=>{p=y,y!=null&&G.write(y),F&&G.end(),C_.nextTick(S)},y=>{G.destroy(y),C_.nextTick(S,y)});else if(oy(A,!0))P++,X5(A,G,S,{end:F});else if(eD(A)||Ob(A)){let y=A.readable||A;P++,X5(y,G,S,{end:F})}else throw new QB("AsyncIterable or Promise","destination",A);A=G;let{destroy:c,cleanup:u}=yae(A,!1,!0);w.push(c),N&&s.push(u)}}else if(mae(q)){if(e8(A)){P+=2;let G=ANe(A,q,S,{end:F});XB(q)&&N&&s.push(G)}else if(Ob(A)||eD(A)){let G=A.readable||A;P++,X5(G,q,S,{end:F})}else if(oy(A))P++,X5(A,q,S,{end:F});else throw new sD("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],A);A=q}else if(_Ne(q)){if(e8(A))P++,oD(iD(A),q,S,{end:F});else if(eD(A)||oy(A))P++,oD(A,q,S,{end:F});else if(Ob(A))P++,oD(A.readable,q,S,{end:F});else throw new sD("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],A);A=q}else A=pae.from(q)}return(i!=null&&i.aborted||o!=null&&o.aborted)&&C_.nextTick(a),A}function ANe(t,e,r,{end:n}){let i=!1;if(e.on("close",()=>{i||r(new gNe)}),t.pipe(e,{end:!1}),n){let s=function(){i=!0,e.end()};var o=s;xNe(t)?C_.nextTick(s):t.once("end",s)}else r();return t8(t,{readable:!0,writable:!1},s=>{let a=t._readableState;s&&s.code==="ERR_STREAM_PREMATURE_CLOSE"&&a&&a.ended&&!a.errored&&!a.errorEmitted?t.once("end",r).once("error",r):r(s)}),t8(e,{readable:!1,writable:!0},r)}vae.exports={pipelineImpl:gae,pipeline:PNe}});var cD=H((Cwt,Sae)=>{"use strict";E();var{pipeline:TNe}=r8(),n8=cl(),{destroyer:RNe}=ry(),{isNodeStream:i8,isReadable:bae,isWritable:wae,isWebStream:aD,isTransformStream:sy,isWritableStream:_ae,isReadableStream:xae}=sl(),{AbortError:INe,codes:{ERR_INVALID_ARG_VALUE:Eae,ERR_MISSING_ARGS:kNe}}=na(),ONe=Fd();Sae.exports=function(...e){if(e.length===0)throw new kNe("streams");if(e.length===1)return n8.from(e[0]);let r=[...e];if(typeof e[0]=="function"&&(e[0]=n8.from(e[0])),typeof e[e.length-1]=="function"){let S=e.length-1;e[S]=n8.from(e[S])}for(let S=0;S<e.length;++S)if(!(!i8(e[S])&&!aD(e[S]))){if(S<e.length-1&&!(bae(e[S])||xae(e[S])||sy(e[S])))throw new Eae(`streams[${S}]`,r[S],"must be readable");if(S>0&&!(wae(e[S])||_ae(e[S])||sy(e[S])))throw new Eae(`streams[${S}]`,r[S],"must be writable")}let n,i,o,s,a;function d(S){let M=s;s=null,M?M(S):S?a.destroy(S):!P&&!w&&a.destroy()}let m=e[0],p=TNe(e,d),w=!!(wae(m)||_ae(m)||sy(m)),P=!!(bae(p)||xae(p)||sy(p));if(a=new n8({writableObjectMode:!!(m!=null&&m.writableObjectMode),readableObjectMode:!!(p!=null&&p.readableObjectMode),writable:w,readable:P}),w){if(i8(m))a._write=function(M,A,B){m.write(M,A)?B():n=B},a._final=function(M){m.end(),i=M},m.on("drain",function(){if(n){let M=n;n=null,M()}});else if(aD(m)){let A=(sy(m)?m.writable:m).getWriter();a._write=async function(B,I,C){try{await A.ready,A.write(B).catch(()=>{}),C()}catch(k){C(k)}},a._final=async function(B){try{await A.ready,A.close().catch(()=>{}),i=B}catch(I){B(I)}}}let S=sy(p)?p.readable:p;ONe(S,()=>{if(i){let M=i;i=null,M()}})}if(P){if(i8(p))p.on("readable",function(){if(o){let S=o;o=null,S()}}),p.on("end",function(){a.push(null)}),a._read=function(){for(;;){let S=p.read();if(S===null){o=a._read;return}if(!a.push(S))return}};else if(aD(p)){let M=(sy(p)?p.readable:p).getReader();a._read=async function(){for(;;)try{let{value:A,done:B}=await M.read();if(!a.push(A))return;if(B){a.push(null);return}}catch{return}}}}return a._destroy=function(S,M){!S&&s!==null&&(S=new INe),o=null,n=null,i=null,s===null?M(S):(s=M,i8(p)&&RNe(p,S))},a}});var Dae=H((Nwt,lD)=>{"use strict";E();var BNe=globalThis.AbortController||Ud().AbortController,{codes:{ERR_INVALID_ARG_VALUE:DNe,ERR_INVALID_ARG_TYPE:j_,ERR_MISSING_ARGS:CNe,ERR_OUT_OF_RANGE:jNe},AbortError:fl}=na(),{validateAbortSignal:ay,validateInteger:Mae,validateObject:cy}=xb(),NNe=ai().Symbol("kWeak"),qNe=ai().Symbol("kResistStopPropagation"),{finished:$Ne}=Fd(),LNe=cD(),{addAbortSignalNoValidate:UNe}=A_(),{isWritable:FNe,isNodeStream:zNe}=sl(),{deprecate:KNe}=qs(),{ArrayPrototypePush:GNe,Boolean:WNe,MathFloor:Pae,Number:VNe,NumberIsNaN:HNe,Promise:Aae,PromiseReject:Tae,PromiseResolve:ZNe,PromisePrototypeThen:Rae,Symbol:kae}=ai(),o8=kae("kEmpty"),Iae=kae("kEof");function JNe(t,e){if(e!=null&&cy(e,"options"),e?.signal!=null&&ay(e.signal,"options.signal"),zNe(t)&&!FNe(t))throw new DNe("stream",t,"must be writable");let r=LNe(this,t);return e!=null&&e.signal&&UNe(e.signal,r),r}function s8(t,e){if(typeof t!="function")throw new j_("fn",["Function","AsyncFunction"],t);e!=null&&cy(e,"options"),e?.signal!=null&&ay(e.signal,"options.signal");let r=1;e?.concurrency!=null&&(r=Pae(e.concurrency));let n=r-1;return e?.highWaterMark!=null&&(n=Pae(e.highWaterMark)),Mae(r,"options.concurrency",1),Mae(n,"options.highWaterMark",0),n+=r,async function*(){let o=qs().AbortSignalAny([e?.signal].filter(WNe)),s=this,a=[],d={signal:o},m,p,w=!1,P=0;function S(){w=!0,M()}function M(){P-=1,A()}function A(){p&&!w&&P<r&&a.length<n&&(p(),p=null)}async function B(){try{for await(let I of s){if(w)return;if(o.aborted)throw new fl;try{if(I=t(I,d),I===o8)continue;I=ZNe(I)}catch(C){I=Tae(C)}P+=1,Rae(I,M,S),a.push(I),m&&(m(),m=null),!w&&(a.length>=n||P>=r)&&await new Aae(C=>{p=C})}a.push(Iae)}catch(I){let C=Tae(I);Rae(C,M,S),a.push(C)}finally{w=!0,m&&(m(),m=null)}}B();try{for(;;){for(;a.length>0;){let I=await a[0];if(I===Iae)return;if(o.aborted)throw new fl;I!==o8&&(yield I),a.shift(),A()}await new Aae(I=>{m=I})}}finally{w=!0,p&&(p(),p=null)}}.call(this)}function YNe(t=void 0){return t!=null&&cy(t,"options"),t?.signal!=null&&ay(t.signal,"options.signal"),async function*(){let r=0;for await(let i of this){var n;if(t!=null&&(n=t.signal)!==null&&n!==void 0&&n.aborted)throw new fl({cause:t.signal.reason});yield[r++,i]}}.call(this)}async function Oae(t,e=void 0){for await(let r of uD.call(this,t,e))return!0;return!1}async function QNe(t,e=void 0){if(typeof t!="function")throw new j_("fn",["Function","AsyncFunction"],t);return!await Oae.call(this,async(...r)=>!await t(...r),e)}async function XNe(t,e){for await(let r of uD.call(this,t,e))return r}async function eqe(t,e){if(typeof t!="function")throw new j_("fn",["Function","AsyncFunction"],t);async function r(n,i){return await t(n,i),o8}for await(let n of s8.call(this,r,e));}function uD(t,e){if(typeof t!="function")throw new j_("fn",["Function","AsyncFunction"],t);async function r(n,i){return await t(n,i)?n:o8}return s8.call(this,r,e)}var fD=class extends CNe{constructor(){super("reduce"),this.message="Reduce of an empty stream requires an initial value"}};async function tqe(t,e,r){var n;if(typeof t!="function")throw new j_("reducer",["Function","AsyncFunction"],t);r!=null&&cy(r,"options"),r?.signal!=null&&ay(r.signal,"options.signal");let i=arguments.length>1;if(r!=null&&(n=r.signal)!==null&&n!==void 0&&n.aborted){let m=new fl(void 0,{cause:r.signal.reason});throw this.once("error",()=>{}),await $Ne(this.destroy(m)),m}let o=new BNe,s=o.signal;if(r!=null&&r.signal){let m={once:!0,[NNe]:this,[qNe]:!0};r.signal.addEventListener("abort",()=>o.abort(),m)}let a=!1;try{for await(let m of this){var d;if(a=!0,r!=null&&(d=r.signal)!==null&&d!==void 0&&d.aborted)throw new fl;i?e=await t(e,m,{signal:s}):(e=m,i=!0)}if(!a&&!i)throw new fD}finally{o.abort()}return e}async function rqe(t){t!=null&&cy(t,"options"),t?.signal!=null&&ay(t.signal,"options.signal");let e=[];for await(let n of this){var r;if(t!=null&&(r=t.signal)!==null&&r!==void 0&&r.aborted)throw new fl(void 0,{cause:t.signal.reason});GNe(e,n)}return e}function nqe(t,e){let r=s8.call(this,t,e);return async function*(){for await(let i of r)yield*i}.call(this)}function Bae(t){if(t=VNe(t),HNe(t))return 0;if(t<0)throw new jNe("number",">= 0",t);return t}function iqe(t,e=void 0){return e!=null&&cy(e,"options"),e?.signal!=null&&ay(e.signal,"options.signal"),t=Bae(t),async function*(){var n;if(e!=null&&(n=e.signal)!==null&&n!==void 0&&n.aborted)throw new fl;for await(let o of this){var i;if(e!=null&&(i=e.signal)!==null&&i!==void 0&&i.aborted)throw new fl;t--<=0&&(yield o)}}.call(this)}function oqe(t,e=void 0){return e!=null&&cy(e,"options"),e?.signal!=null&&ay(e.signal,"options.signal"),t=Bae(t),async function*(){var n;if(e!=null&&(n=e.signal)!==null&&n!==void 0&&n.aborted)throw new fl;for await(let o of this){var i;if(e!=null&&(i=e.signal)!==null&&i!==void 0&&i.aborted)throw new fl;if(t-- >0&&(yield o),t<=0)return}}.call(this)}lD.exports.streamReturningOperators={asIndexedPairs:KNe(YNe,"readable.asIndexedPairs will be removed in a future version."),drop:iqe,filter:uD,flatMap:nqe,map:s8,take:oqe,compose:JNe};lD.exports.promiseReturningOperators={every:QNe,forEach:eqe,reduce:tqe,toArray:rqe,some:Oae,find:XNe}});var dD=H(($wt,Cae)=>{"use strict";E();var{ArrayPrototypePop:sqe,Promise:aqe}=ai(),{isIterable:cqe,isNodeStream:fqe,isWebStream:uqe}=sl(),{pipelineImpl:lqe}=r8(),{finished:dqe}=Fd();hD();function hqe(...t){return new aqe((e,r)=>{let n,i,o=t[t.length-1];if(o&&typeof o=="object"&&!fqe(o)&&!cqe(o)&&!uqe(o)){let s=sqe(t);n=s.signal,i=s.end}lqe(t,(s,a)=>{s?r(s):e(a)},{signal:n,end:i})})}Cae.exports={finished:dqe,pipeline:hqe}});var hD=H((Uwt,Kae)=>{E();var{Buffer:pqe}=sr(),{ObjectDefineProperty:Gd,ObjectKeys:qae,ReflectApply:$ae}=ai(),{promisify:{custom:Lae}}=qs(),{streamReturningOperators:jae,promiseReturningOperators:Nae}=Dae(),{codes:{ERR_ILLEGAL_CONSTRUCTOR:Uae}}=na(),mqe=cD(),{setDefaultHighWaterMark:yqe,getDefaultHighWaterMark:gqe}=T_(),{pipeline:Fae}=r8(),{destroyer:vqe}=ry(),zae=Fd(),pD=dD(),N_=sl(),Gn=Kae.exports=L5().Stream;Gn.isDestroyed=N_.isDestroyed;Gn.isDisturbed=N_.isDisturbed;Gn.isErrored=N_.isErrored;Gn.isReadable=N_.isReadable;Gn.isWritable=N_.isWritable;Gn.Readable=I_();for(let t of qae(jae)){let r=function(...n){if(new.target)throw Uae();return Gn.Readable.from($ae(e,this,n))};wqe=r;let e=jae[t];Gd(r,"name",{__proto__:null,value:e.name}),Gd(r,"length",{__proto__:null,value:e.length}),Gd(Gn.Readable.prototype,t,{__proto__:null,value:r,enumerable:!1,configurable:!0,writable:!0})}var wqe;for(let t of qae(Nae)){let r=function(...i){if(new.target)throw Uae();return $ae(e,this,i)};wqe=r;let e=Nae[t];Gd(r,"name",{__proto__:null,value:e.name}),Gd(r,"length",{__proto__:null,value:e.length}),Gd(Gn.Readable.prototype,t,{__proto__:null,value:r,enumerable:!1,configurable:!0,writable:!0})}var wqe;Gn.Writable=Q5();Gn.Duplex=cl();Gn.Transform=ZB();Gn.PassThrough=YB();Gn.pipeline=Fae;var{addAbortSignal:bqe}=A_();Gn.addAbortSignal=bqe;Gn.finished=zae;Gn.destroy=vqe;Gn.compose=mqe;Gn.setDefaultHighWaterMark=yqe;Gn.getDefaultHighWaterMark=gqe;Gd(Gn,"promises",{__proto__:null,configurable:!0,enumerable:!0,get(){return pD}});Gd(Fae,Lae,{__proto__:null,enumerable:!0,get(){return pD.pipeline}});Gd(zae,Lae,{__proto__:null,enumerable:!0,get(){return pD.finished}});Gn.Stream=Gn;Gn._isUint8Array=function(e){return e instanceof Uint8Array};Gn._uint8ArrayToBuffer=function(e){return pqe.from(e.buffer,e.byteOffset,e.byteLength)}});var a8=H((zwt,Li)=>{"use strict";E();var ho=hD(),_qe=dD(),xqe=ho.Readable.destroy;Li.exports=ho.Readable;Li.exports._uint8ArrayToBuffer=ho._uint8ArrayToBuffer;Li.exports._isUint8Array=ho._isUint8Array;Li.exports.isDisturbed=ho.isDisturbed;Li.exports.isErrored=ho.isErrored;Li.exports.isReadable=ho.isReadable;Li.exports.Readable=ho.Readable;Li.exports.Writable=ho.Writable;Li.exports.Duplex=ho.Duplex;Li.exports.Transform=ho.Transform;Li.exports.PassThrough=ho.PassThrough;Li.exports.addAbortSignal=ho.addAbortSignal;Li.exports.finished=ho.finished;Li.exports.destroy=ho.destroy;Li.exports.destroy=xqe;Li.exports.pipeline=ho.pipeline;Li.exports.compose=ho.compose;Object.defineProperty(ho,"promises",{configurable:!0,enumerable:!0,get(){return _qe}});Li.exports.Stream=ho.Stream;Li.exports.default=Li.exports});var Vae=H((vD,bD)=>{E();(function(t,e){typeof vD=="object"&&typeof bD<"u"?bD.exports=e():typeof define=="function"&&define.amd?define(e):(t=t||self,t.JSBI=e())})(vD,function(){"use strict";var t=Math.imul,e=Math.clz32;function r(N){return r=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(G){return typeof G}:function(G){return G&&typeof Symbol=="function"&&G.constructor===Symbol&&G!==Symbol.prototype?"symbol":typeof G},r(N)}function n(N,G){if(!(N instanceof G))throw new TypeError("Cannot call a class as a function")}function i(N,G){for(var x,c=0;c<G.length;c++)x=G[c],x.enumerable=x.enumerable||!1,x.configurable=!0,"value"in x&&(x.writable=!0),Object.defineProperty(N,x.key,x)}function o(N,G,x){return G&&i(N.prototype,G),x&&i(N,x),Object.defineProperty(N,"prototype",{writable:!1}),N}function s(N,G){if(typeof G!="function"&&G!==null)throw new TypeError("Super expression must either be null or a function");N.prototype=Object.create(G&&G.prototype,{constructor:{value:N,writable:!0,configurable:!0}}),Object.defineProperty(N,"prototype",{writable:!1}),G&&d(N,G)}function a(N){return a=Object.setPrototypeOf?Object.getPrototypeOf:function(G){return G.__proto__||Object.getPrototypeOf(G)},a(N)}function d(N,G){return d=Object.setPrototypeOf||function(x,c){return x.__proto__=c,x},d(N,G)}function m(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function p(){return p=m()?Reflect.construct:function(N,G,x){var c=[null];c.push.apply(c,G);var u=Function.bind.apply(N,c),y=new u;return x&&d(y,x.prototype),y},p.apply(null,arguments)}function w(N){return Function.toString.call(N).indexOf("[native code]")!==-1}function P(N){var G=typeof Map=="function"?new Map:void 0;return P=function(x){function c(){return p(x,arguments,a(this).constructor)}if(x===null||!w(x))return x;if(typeof x!="function")throw new TypeError("Super expression must either be null or a function");if(typeof G<"u"){if(G.has(x))return G.get(x);G.set(x,c)}return c.prototype=Object.create(x.prototype,{constructor:{value:c,enumerable:!1,writable:!0,configurable:!0}}),d(c,x)},P(N)}function S(N){if(N===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return N}function M(N,G){if(G&&(typeof G=="object"||typeof G=="function"))return G;if(G!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return S(N)}function A(N){var G=m();return function(){var x,c=a(N);if(G){var u=a(this).constructor;x=Reflect.construct(c,arguments,u)}else x=c.apply(this,arguments);return M(this,x)}}function B(N,G){return I(N)||C(N,G)||k(N,G)||L()}function I(N){if(Array.isArray(N))return N}function C(N,G){var x=N==null?null:typeof Symbol<"u"&&N[Symbol.iterator]||N["@@iterator"];if(x!=null){var c,u,y=[],l=!0,h=!1;try{for(x=x.call(N);!(l=(c=x.next()).done)&&(y.push(c.value),!(G&&y.length===G));l=!0);}catch(b){h=!0,u=b}finally{try{l||x.return==null||x.return()}finally{if(h)throw u}}return y}}function k(N,G){if(N){if(typeof N=="string")return q(N,G);var x=Object.prototype.toString.call(N).slice(8,-1);return x==="Object"&&N.constructor&&(x=N.constructor.name),x==="Map"||x==="Set"?Array.from(N):x==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(x)?q(N,G):void 0}}function q(N,G){(G==null||G>N.length)&&(G=N.length);for(var x=0,c=Array(G);x<G;x++)c[x]=N[x];return c}function L(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function U(N,G){var x=typeof Symbol<"u"&&N[Symbol.iterator]||N["@@iterator"];if(!x){if(Array.isArray(N)||(x=k(N))||G&&N&&typeof N.length=="number"){x&&(N=x);var c=0,u=function(){};return{s:u,n:function(){return c>=N.length?{done:!0}:{done:!1,value:N[c++]}},e:function(b){throw b},f:u}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var y,l=!0,h=!1;return{s:function(){x=x.call(N)},n:function(){var b=x.next();return l=b.done,b},e:function(b){h=!0,y=b},f:function(){try{l||x.return==null||x.return()}finally{if(h)throw y}}}}var F=function(N){var G=Math.abs,x=Math.max,c=Math.floor;function u(l,h){var b;if(n(this,u),b=y.call(this,l),b.sign=h,Object.setPrototypeOf(S(b),u.prototype),l>u.__kMaxLength)throw new RangeError("Maximum BigInt size exceeded");return b}s(u,N);var y=A(u);return o(u,[{key:"toDebugString",value:function(){var l,h=["BigInt["],b=U(this);try{for(b.s();!(l=b.n()).done;){var _=l.value;h.push((_&&(_>>>0).toString(16))+", ")}}catch(g){b.e(g)}finally{b.f()}return h.push("]"),h.join("")}},{key:"toString",value:function(){var l=0<arguments.length&&arguments[0]!==void 0?arguments[0]:10;if(2>l||36<l)throw new RangeError("toString() radix argument must be between 2 and 36");return this.length===0?"0":l&l-1?u.__toStringGeneric(this,l,!1):u.__toStringBasePowerOfTwo(this,l)}},{key:"valueOf",value:function(){throw new Error("Convert JSBI instances to native numbers using `toNumber`.")}},{key:"__copy",value:function(){for(var l=new u(this.length,this.sign),h=0;h<this.length;h++)l[h]=this[h];return l}},{key:"__trim",value:function(){for(var l=this.length,h=this[l-1];h===0;)l--,h=this[l-1],this.pop();return l===0&&(this.sign=!1),this}},{key:"__initializeDigits",value:function(){for(var l=0;l<this.length;l++)this[l]=0}},{key:"__clzmsd",value:function(){return u.__clz30(this.__digit(this.length-1))}},{key:"__inplaceMultiplyAdd",value:function(l,h,b){b>this.length&&(b=this.length);for(var _=32767&l,g=l>>>15,f=0,v=h,O=0;O<b;O++){var T=this.__digit(O),R=32767&T,z=T>>>15,V=u.__imul(R,_),W=u.__imul(R,g),Z=u.__imul(z,_),J=u.__imul(z,g),X=v+V+f;f=X>>>30,X&=1073741823,X+=((32767&W)<<15)+((32767&Z)<<15),f+=X>>>30,v=J+(W>>>15)+(Z>>>15),this.__setDigit(O,1073741823&X)}if(f!==0||v!==0)throw new Error("implementation bug")}},{key:"__inplaceAdd",value:function(l,h,b){for(var _,g=0,f=0;f<b;f++)_=this.__halfDigit(h+f)+l.__halfDigit(f)+g,g=_>>>15,this.__setHalfDigit(h+f,32767&_);return g}},{key:"__inplaceSub",value:function(l,h,b){var _=0;if(1&h){h>>=1;for(var g=this.__digit(h),f=32767&g,v=0;v<b-1>>>1;v++){var O=l.__digit(v),T=(g>>>15)-(32767&O)-_;_=1&T>>>15,this.__setDigit(h+v,(32767&T)<<15|32767&f),g=this.__digit(h+v+1),f=(32767&g)-(O>>>15)-_,_=1&f>>>15}var R=l.__digit(v),z=(g>>>15)-(32767&R)-_;if(_=1&z>>>15,this.__setDigit(h+v,(32767&z)<<15|32767&f),h+v+1>=this.length)throw new RangeError("out of bounds");!(1&b)&&(g=this.__digit(h+v+1),f=(32767&g)-(R>>>15)-_,_=1&f>>>15,this.__setDigit(h+l.length,1073709056&g|32767&f))}else{h>>=1;for(var V=0;V<l.length-1;V++){var W=this.__digit(h+V),Z=l.__digit(V),J=(32767&W)-(32767&Z)-_;_=1&J>>>15;var X=(W>>>15)-(Z>>>15)-_;_=1&X>>>15,this.__setDigit(h+V,(32767&X)<<15|32767&J)}var Ee=this.__digit(h+V),re=l.__digit(V),ne=(32767&Ee)-(32767&re)-_;_=1&ne>>>15;var qe=0;!(1&b)&&(qe=(Ee>>>15)-(re>>>15)-_,_=1&qe>>>15),this.__setDigit(h+V,(32767&qe)<<15|32767&ne)}return _}},{key:"__inplaceRightShift",value:function(l){if(l!==0){for(var h,b=this.__digit(0)>>>l,_=this.length-1,g=0;g<_;g++)h=this.__digit(g+1),this.__setDigit(g,1073741823&h<<30-l|b),b=h>>>l;this.__setDigit(_,b)}}},{key:"__digit",value:function(l){return this[l]}},{key:"__unsignedDigit",value:function(l){return this[l]>>>0}},{key:"__setDigit",value:function(l,h){this[l]=0|h}},{key:"__setDigitGrow",value:function(l,h){this[l]=0|h}},{key:"__halfDigitLength",value:function(){var l=this.length;return 32767>=this.__unsignedDigit(l-1)?2*l-1:2*l}},{key:"__halfDigit",value:function(l){return 32767&this[l>>>1]>>>15*(1&l)}},{key:"__setHalfDigit",value:function(l,h){var b=l>>>1,_=this.__digit(b),g=1&l?32767&_|h<<15:1073709056&_|32767&h;this.__setDigit(b,g)}}],[{key:"BigInt",value:function(l){var h=Number.isFinite;if(typeof l=="number"){if(l===0)return u.__zero();if(u.__isOneDigitInt(l))return 0>l?u.__oneDigit(-l,!0):u.__oneDigit(l,!1);if(!h(l)||c(l)!==l)throw new RangeError("The number "+l+" cannot be converted to BigInt because it is not an integer");return u.__fromDouble(l)}if(typeof l=="string"){var b=u.__fromString(l);if(b===null)throw new SyntaxError("Cannot convert "+l+" to a BigInt");return b}if(typeof l=="boolean")return l===!0?u.__oneDigit(1,!1):u.__zero();if(r(l)==="object"){if(l.constructor===u)return l;var _=u.__toPrimitive(l);return u.BigInt(_)}throw new TypeError("Cannot convert "+l+" to a BigInt")}},{key:"toNumber",value:function(l){var h=l.length;if(h===0)return 0;if(h===1){var b=l.__unsignedDigit(0);return l.sign?-b:b}var _=l.__digit(h-1),g=u.__clz30(_),f=30*h-g;if(1024<f)return l.sign?-1/0:1/0;var v=f-1,O=_,T=h-1,R=g+3,z=R===32?0:O<<R;z>>>=12;var V=R-12,W=12<=R?0:O<<20+R,Z=20+R;for(0<V&&0<T&&(T--,O=l.__digit(T),z|=O>>>30-V,W=O<<V+2,Z=V+2);0<Z&&0<T;)T--,O=l.__digit(T),W|=30<=Z?O<<Z-30:O>>>30-Z,Z-=30;var J=u.__decideRounding(l,Z,T,O);if((J===1||J===0&&(1&W)==1)&&(W=W+1>>>0,W===0&&(z++,z>>>20!=0&&(z=0,v++,1023<v))))return l.sign?-1/0:1/0;var X=l.sign?-2147483648:0;return v=v+1023<<20,u.__kBitConversionInts[1]=X|v|z,u.__kBitConversionInts[0]=W,u.__kBitConversionDouble[0]}},{key:"unaryMinus",value:function(l){if(l.length===0)return l;var h=l.__copy();return h.sign=!l.sign,h}},{key:"bitwiseNot",value:function(l){return l.sign?u.__absoluteSubOne(l).__trim():u.__absoluteAddOne(l,!0)}},{key:"exponentiate",value:function(l,h){if(h.sign)throw new RangeError("Exponent must be positive");if(h.length===0)return u.__oneDigit(1,!1);if(l.length===0)return l;if(l.length===1&&l.__digit(0)===1)return l.sign&&!(1&h.__digit(0))?u.unaryMinus(l):l;if(1<h.length)throw new RangeError("BigInt too big");var b=h.__unsignedDigit(0);if(b===1)return l;if(b>=u.__kMaxLengthBits)throw new RangeError("BigInt too big");if(l.length===1&&l.__digit(0)===2){var _=1+(0|b/30),g=l.sign&&(1&b)!=0,f=new u(_,g);f.__initializeDigits();var v=1<<b%30;return f.__setDigit(_-1,v),f}var O=null,T=l;for(1&b&&(O=l),b>>=1;b!==0;b>>=1)T=u.multiply(T,T),1&b&&(O===null?O=T:O=u.multiply(O,T));return O}},{key:"multiply",value:function(l,h){if(l.length===0)return l;if(h.length===0)return h;var b=l.length+h.length;30<=l.__clzmsd()+h.__clzmsd()&&b--;var _=new u(b,l.sign!==h.sign);_.__initializeDigits();for(var g=0;g<l.length;g++)u.__multiplyAccumulate(h,l.__digit(g),_,g);return _.__trim()}},{key:"divide",value:function(l,h){if(h.length===0)throw new RangeError("Division by zero");if(0>u.__absoluteCompare(l,h))return u.__zero();var b,_=l.sign!==h.sign,g=h.__unsignedDigit(0);if(h.length===1&&32767>=g){if(g===1)return _===l.sign?l:u.unaryMinus(l);b=u.__absoluteDivSmall(l,g,null)}else b=u.__absoluteDivLarge(l,h,!0,!1);return b.sign=_,b.__trim()}},{key:"remainder",value:function(h,b){if(b.length===0)throw new RangeError("Division by zero");if(0>u.__absoluteCompare(h,b))return h;var _=b.__unsignedDigit(0);if(b.length===1&&32767>=_){if(_===1)return u.__zero();var g=u.__absoluteModSmall(h,_);return g===0?u.__zero():u.__oneDigit(g,h.sign)}var f=u.__absoluteDivLarge(h,b,!1,!0);return f.sign=h.sign,f.__trim()}},{key:"add",value:function(l,h){var b=l.sign;return b===h.sign?u.__absoluteAdd(l,h,b):0<=u.__absoluteCompare(l,h)?u.__absoluteSub(l,h,b):u.__absoluteSub(h,l,!b)}},{key:"subtract",value:function(l,h){var b=l.sign;return b===h.sign?0<=u.__absoluteCompare(l,h)?u.__absoluteSub(l,h,b):u.__absoluteSub(h,l,!b):u.__absoluteAdd(l,h,b)}},{key:"leftShift",value:function(l,h){return h.length===0||l.length===0?l:h.sign?u.__rightShiftByAbsolute(l,h):u.__leftShiftByAbsolute(l,h)}},{key:"signedRightShift",value:function(l,h){return h.length===0||l.length===0?l:h.sign?u.__leftShiftByAbsolute(l,h):u.__rightShiftByAbsolute(l,h)}},{key:"unsignedRightShift",value:function(){throw new TypeError("BigInts have no unsigned right shift; use >> instead")}},{key:"lessThan",value:function(l,h){return 0>u.__compareToBigInt(l,h)}},{key:"lessThanOrEqual",value:function(l,h){return 0>=u.__compareToBigInt(l,h)}},{key:"greaterThan",value:function(l,h){return 0<u.__compareToBigInt(l,h)}},{key:"greaterThanOrEqual",value:function(l,h){return 0<=u.__compareToBigInt(l,h)}},{key:"equal",value:function(l,h){if(l.sign!==h.sign||l.length!==h.length)return!1;for(var b=0;b<l.length;b++)if(l.__digit(b)!==h.__digit(b))return!1;return!0}},{key:"notEqual",value:function(l,h){return!u.equal(l,h)}},{key:"bitwiseAnd",value:function(l,h){if(!l.sign&&!h.sign)return u.__absoluteAnd(l,h).__trim();if(l.sign&&h.sign){var b=x(l.length,h.length)+1,_=u.__absoluteSubOne(l,b),g=u.__absoluteSubOne(h);return _=u.__absoluteOr(_,g,_),u.__absoluteAddOne(_,!0,_).__trim()}if(l.sign){var f=[h,l];l=f[0],h=f[1]}return u.__absoluteAndNot(l,u.__absoluteSubOne(h)).__trim()}},{key:"bitwiseXor",value:function(l,h){if(!l.sign&&!h.sign)return u.__absoluteXor(l,h).__trim();if(l.sign&&h.sign){var b=x(l.length,h.length),_=u.__absoluteSubOne(l,b),g=u.__absoluteSubOne(h);return u.__absoluteXor(_,g,_).__trim()}var f=x(l.length,h.length)+1;if(l.sign){var v=[h,l];l=v[0],h=v[1]}var O=u.__absoluteSubOne(h,f);return O=u.__absoluteXor(O,l,O),u.__absoluteAddOne(O,!0,O).__trim()}},{key:"bitwiseOr",value:function(l,h){var b=x(l.length,h.length);if(!l.sign&&!h.sign)return u.__absoluteOr(l,h).__trim();if(l.sign&&h.sign){var _=u.__absoluteSubOne(l,b),g=u.__absoluteSubOne(h);return _=u.__absoluteAnd(_,g,_),u.__absoluteAddOne(_,!0,_).__trim()}if(l.sign){var f=[h,l];l=f[0],h=f[1]}var v=u.__absoluteSubOne(h,b);return v=u.__absoluteAndNot(v,l,v),u.__absoluteAddOne(v,!0,v).__trim()}},{key:"asIntN",value:function(l,h){if(h.length===0)return h;if(l=c(l),0>l)throw new RangeError("Invalid value: not (convertible to) a safe integer");if(l===0)return u.__zero();if(l>=u.__kMaxLengthBits)return h;var b=0|(l+29)/30;if(h.length<b)return h;var _=h.__unsignedDigit(b-1),g=1<<(l-1)%30;if(h.length===b&&_<g)return h;if((_&g)!==g)return u.__truncateToNBits(l,h);if(!h.sign)return u.__truncateAndSubFromPowerOfTwo(l,h,!0);if(!(_&g-1)){for(var f=b-2;0<=f;f--)if(h.__digit(f)!==0)return u.__truncateAndSubFromPowerOfTwo(l,h,!1);return h.length===b&&_===g?h:u.__truncateToNBits(l,h)}return u.__truncateAndSubFromPowerOfTwo(l,h,!1)}},{key:"asUintN",value:function(l,h){if(h.length===0)return h;if(l=c(l),0>l)throw new RangeError("Invalid value: not (convertible to) a safe integer");if(l===0)return u.__zero();if(h.sign){if(l>u.__kMaxLengthBits)throw new RangeError("BigInt too big");return u.__truncateAndSubFromPowerOfTwo(l,h,!1)}if(l>=u.__kMaxLengthBits)return h;var b=0|(l+29)/30;if(h.length<b)return h;var _=l%30;if(h.length==b){if(_===0)return h;var g=h.__digit(b-1);if(!(g>>>_))return h}return u.__truncateToNBits(l,h)}},{key:"ADD",value:function(l,h){if(l=u.__toPrimitive(l),h=u.__toPrimitive(h),typeof l=="string")return typeof h!="string"&&(h=h.toString()),l+h;if(typeof h=="string")return l.toString()+h;if(l=u.__toNumeric(l),h=u.__toNumeric(h),u.__isBigInt(l)&&u.__isBigInt(h))return u.add(l,h);if(typeof l=="number"&&typeof h=="number")return l+h;throw new TypeError("Cannot mix BigInt and other types, use explicit conversions")}},{key:"LT",value:function(l,h){return u.__compare(l,h,0)}},{key:"LE",value:function(l,h){return u.__compare(l,h,1)}},{key:"GT",value:function(l,h){return u.__compare(l,h,2)}},{key:"GE",value:function(l,h){return u.__compare(l,h,3)}},{key:"EQ",value:function(l,h){for(;;){if(u.__isBigInt(l))return u.__isBigInt(h)?u.equal(l,h):u.EQ(h,l);if(typeof l=="number"){if(u.__isBigInt(h))return u.__equalToNumber(h,l);if(r(h)!=="object")return l==h;h=u.__toPrimitive(h)}else if(typeof l=="string"){if(u.__isBigInt(h))return l=u.__fromString(l),l!==null&&u.equal(l,h);if(r(h)!=="object")return l==h;h=u.__toPrimitive(h)}else if(typeof l=="boolean"){if(u.__isBigInt(h))return u.__equalToNumber(h,+l);if(r(h)!=="object")return l==h;h=u.__toPrimitive(h)}else if(r(l)==="symbol"){if(u.__isBigInt(h))return!1;if(r(h)!=="object")return l==h;h=u.__toPrimitive(h)}else if(r(l)==="object"){if(r(h)==="object"&&h.constructor!==u)return l==h;l=u.__toPrimitive(l)}else return l==h}}},{key:"NE",value:function(l,h){return!u.EQ(l,h)}},{key:"DataViewGetBigInt64",value:function(l,h){var b=2<arguments.length&&arguments[2]!==void 0&&arguments[2];return u.asIntN(64,u.DataViewGetBigUint64(l,h,b))}},{key:"DataViewGetBigUint64",value:function(l,h){var b=2<arguments.length&&arguments[2]!==void 0&&arguments[2],_=b?[4,0]:[0,4],g=B(_,2),f=g[0],v=g[1],O=l.getUint32(h+f,b),T=l.getUint32(h+v,b),R=new u(3,!1);return R.__setDigit(0,1073741823&T),R.__setDigit(1,(268435455&O)<<2|T>>>30),R.__setDigit(2,O>>>28),R.__trim()}},{key:"DataViewSetBigInt64",value:function(l,h,b){var _=3<arguments.length&&arguments[3]!==void 0&&arguments[3];u.DataViewSetBigUint64(l,h,b,_)}},{key:"DataViewSetBigUint64",value:function(l,h,b){var _=3<arguments.length&&arguments[3]!==void 0&&arguments[3];b=u.asUintN(64,b);var g=0,f=0;if(0<b.length&&(f=b.__digit(0),1<b.length)){var v=b.__digit(1);f|=v<<30,g=v>>>2,2<b.length&&(g|=b.__digit(2)<<28)}var O=_?[4,0]:[0,4],T=B(O,2),R=T[0],z=T[1];l.setUint32(h+R,g,_),l.setUint32(h+z,f,_)}},{key:"__zero",value:function(){return new u(0,!1)}},{key:"__oneDigit",value:function(l,h){var b=new u(1,h);return b.__setDigit(0,l),b}},{key:"__decideRounding",value:function(l,h,b,_){if(0<h)return-1;var g;if(0>h)g=-h-1;else{if(b===0)return-1;b--,_=l.__digit(b),g=29}var f=1<<g;if(!(_&f))return-1;if(f-=1,(_&f)!=0)return 1;for(;0<b;)if(b--,l.__digit(b)!==0)return 1;return 0}},{key:"__fromDouble",value:function(l){u.__kBitConversionDouble[0]=l;var h,b=2047&u.__kBitConversionInts[1]>>>20,_=b-1023,g=(0|_/30)+1,f=new u(g,0>l),v=1048575&u.__kBitConversionInts[1]|1048576,O=u.__kBitConversionInts[0],T=20,R=_%30,z=0;if(R<T){var V=T-R;z=V+32,h=v>>>V,v=v<<32-V|O>>>V,O<<=32-V}else if(R===T)z=32,h=v,v=O,O=0;else{var W=R-T;z=32-W,h=v<<W|O>>>32-W,v=O<<W,O=0}f.__setDigit(g-1,h);for(var Z=g-2;0<=Z;Z--)0<z?(z-=30,h=v>>>2,v=v<<30|O>>>2,O<<=30):h=0,f.__setDigit(Z,h);return f.__trim()}},{key:"__isWhitespace",value:function(l){return 13>=l&&9<=l||(159>=l?l==32:131071>=l?l==160||l==5760:196607>=l?(l&=131071,10>=l||l==40||l==41||l==47||l==95||l==4096):l==65279)}},{key:"__fromString",value:function(l){var h=1<arguments.length&&arguments[1]!==void 0?arguments[1]:0,b=0,_=l.length,g=0;if(g===_)return u.__zero();for(var f=l.charCodeAt(g);u.__isWhitespace(f);){if(++g===_)return u.__zero();f=l.charCodeAt(g)}if(f===43){if(++g===_)return null;f=l.charCodeAt(g),b=1}else if(f===45){if(++g===_)return null;f=l.charCodeAt(g),b=-1}if(h===0){if(h=10,f===48){if(++g===_)return u.__zero();if(f=l.charCodeAt(g),f===88||f===120){if(h=16,++g===_)return null;f=l.charCodeAt(g)}else if(f===79||f===111){if(h=8,++g===_)return null;f=l.charCodeAt(g)}else if(f===66||f===98){if(h=2,++g===_)return null;f=l.charCodeAt(g)}}}else if(h===16&&f===48){if(++g===_)return u.__zero();if(f=l.charCodeAt(g),f===88||f===120){if(++g===_)return null;f=l.charCodeAt(g)}}if(b!==0&&h!==10)return null;for(;f===48;){if(++g===_)return u.__zero();f=l.charCodeAt(g)}var v=_-g,O=u.__kMaxBitsPerChar[h],T=u.__kBitsPerCharTableMultiplier-1;if(v>1073741824/O)return null;var R=O*v+T>>>u.__kBitsPerCharTableShift,z=new u(0|(R+29)/30,!1),V=10>h?h:10,W=10<h?h-10:0;if(h&h-1){z.__initializeDigits();var qe=!1,ce=0;do{for(var ye,Ne=0,ie=1;;){if(ye=void 0,f-48>>>0<V)ye=f-48;else if((32|f)-97>>>0<W)ye=(32|f)-87;else{qe=!0;break}var oe=ie*h;if(1073741823<oe)break;if(ie=oe,Ne=Ne*h+ye,ce++,++g===_){qe=!0;break}f=l.charCodeAt(g)}T=30*u.__kBitsPerCharTableMultiplier-1;var ze=0|(O*ce+T>>>u.__kBitsPerCharTableShift)/30;z.__inplaceMultiplyAdd(ie,Ne,ze)}while(!qe)}else{O>>=u.__kBitsPerCharTableShift;var Z=[],J=[],X=!1;do{for(var Ee,re=0,ne=0;;){if(Ee=void 0,f-48>>>0<V)Ee=f-48;else if((32|f)-97>>>0<W)Ee=(32|f)-87;else{X=!0;break}if(ne+=O,re=re<<O|Ee,++g===_){X=!0;break}if(f=l.charCodeAt(g),30<ne+O)break}Z.push(re),J.push(ne)}while(!X);u.__fillFromParts(z,Z,J)}if(g!==_){if(!u.__isWhitespace(f))return null;for(g++;g<_;g++)if(f=l.charCodeAt(g),!u.__isWhitespace(f))return null}return z.sign=b===-1,z.__trim()}},{key:"__fillFromParts",value:function(l,h,b){for(var _=0,g=0,f=0,v=h.length-1;0<=v;v--){var O=h[v],T=b[v];g|=O<<f,f+=T,f===30?(l.__setDigit(_++,g),f=0,g=0):30<f&&(l.__setDigit(_++,1073741823&g),f-=30,g=O>>>T-f)}if(g!==0){if(_>=l.length)throw new Error("implementation bug");l.__setDigit(_++,g)}for(;_<l.length;_++)l.__setDigit(_,0)}},{key:"__toStringBasePowerOfTwo",value:function(l,h){var b=l.length,_=h-1;_=(85&_>>>1)+(85&_),_=(51&_>>>2)+(51&_),_=(15&_>>>4)+(15&_);var g=_,f=h-1,v=l.__digit(b-1),O=u.__clz30(v),T=0|(30*b-O+g-1)/g;if(l.sign&&T++,268435456<T)throw new Error("string too long");for(var R=Array(T),z=T-1,V=0,W=0,Z=0;Z<b-1;Z++){var J=l.__digit(Z),X=(V|J<<W)&f;R[z--]=u.__kConversionChars[X];var Ee=g-W;for(V=J>>>Ee,W=30-Ee;W>=g;)R[z--]=u.__kConversionChars[V&f],V>>>=g,W-=g}var re=(V|v<<W)&f;for(R[z--]=u.__kConversionChars[re],V=v>>>g-W;V!==0;)R[z--]=u.__kConversionChars[V&f],V>>>=g;if(l.sign&&(R[z--]="-"),z!==-1)throw new Error("implementation bug");return R.join("")}},{key:"__toStringGeneric",value:function(l,h,b){var _=l.length;if(_===0)return"";if(_===1){var g=l.__unsignedDigit(0).toString(h);return b===!1&&l.sign&&(g="-"+g),g}var f=30*_-u.__clz30(l.__digit(_-1)),v=u.__kMaxBitsPerChar[h],O=v-1,T=f*u.__kBitsPerCharTableMultiplier;T+=O-1,T=0|T/O;var R,z,V=T+1>>1,W=u.exponentiate(u.__oneDigit(h,!1),u.__oneDigit(V,!1)),Z=W.__unsignedDigit(0);if(W.length===1&&32767>=Z){R=new u(l.length,!1),R.__initializeDigits();for(var J,X=0,Ee=2*l.length-1;0<=Ee;Ee--)J=X<<15|l.__halfDigit(Ee),R.__setHalfDigit(Ee,0|J/Z),X=0|J%Z;z=X.toString(h)}else{var re=u.__absoluteDivLarge(l,W,!0,!0);R=re.quotient;var ne=re.remainder.__trim();z=u.__toStringGeneric(ne,h,!0)}R.__trim();for(var qe=u.__toStringGeneric(R,h,!0);z.length<V;)z="0"+z;return b===!1&&l.sign&&(qe="-"+qe),qe+z}},{key:"__unequalSign",value:function(l){return l?-1:1}},{key:"__absoluteGreater",value:function(l){return l?-1:1}},{key:"__absoluteLess",value:function(l){return l?1:-1}},{key:"__compareToBigInt",value:function(l,h){var b=l.sign;if(b!==h.sign)return u.__unequalSign(b);var _=u.__absoluteCompare(l,h);return 0<_?u.__absoluteGreater(b):0>_?u.__absoluteLess(b):0}},{key:"__compareToNumber",value:function(l,h){if(u.__isOneDigitInt(h)){var b=l.sign,_=0>h;if(b!==_)return u.__unequalSign(b);if(l.length===0){if(_)throw new Error("implementation bug");return h===0?0:-1}if(1<l.length)return u.__absoluteGreater(b);var g=G(h),f=l.__unsignedDigit(0);return f>g?u.__absoluteGreater(b):f<g?u.__absoluteLess(b):0}return u.__compareToDouble(l,h)}},{key:"__compareToDouble",value:function(l,h){if(h!==h)return h;if(h===1/0)return-1;if(h===-1/0)return 1;var b=l.sign;if(b!==0>h)return u.__unequalSign(b);if(h===0)throw new Error("implementation bug: should be handled elsewhere");if(l.length===0)return-1;u.__kBitConversionDouble[0]=h;var _=2047&u.__kBitConversionInts[1]>>>20;if(_==2047)throw new Error("implementation bug: handled elsewhere");var g=_-1023;if(0>g)return u.__absoluteGreater(b);var f=l.length,v=l.__digit(f-1),O=u.__clz30(v),T=30*f-O,R=g+1;if(T<R)return u.__absoluteLess(b);if(T>R)return u.__absoluteGreater(b);var z=1048576|1048575&u.__kBitConversionInts[1],V=u.__kBitConversionInts[0],W=20,Z=29-O;if(Z!==(0|(T-1)%30))throw new Error("implementation bug");var J,X=0;if(Z<W){var Ee=W-Z;X=Ee+32,J=z>>>Ee,z=z<<32-Ee|V>>>Ee,V<<=32-Ee}else if(Z===W)X=32,J=z,z=V,V=0;else{var re=Z-W;X=32-re,J=z<<re|V>>>32-re,z=V<<re,V=0}if(v>>>=0,J>>>=0,v>J)return u.__absoluteGreater(b);if(v<J)return u.__absoluteLess(b);for(var ne=f-2;0<=ne;ne--){0<X?(X-=30,J=z>>>2,z=z<<30|V>>>2,V<<=30):J=0;var qe=l.__unsignedDigit(ne);if(qe>J)return u.__absoluteGreater(b);if(qe<J)return u.__absoluteLess(b)}if(z!==0||V!==0){if(X===0)throw new Error("implementation bug");return u.__absoluteLess(b)}return 0}},{key:"__equalToNumber",value:function(l,h){return u.__isOneDigitInt(h)?h===0?l.length===0:l.length===1&&l.sign===0>h&&l.__unsignedDigit(0)===G(h):u.__compareToDouble(l,h)===0}},{key:"__comparisonResultToBool",value:function(l,h){return h===0?0>l:h===1?0>=l:h===2?0<l:h===3?0<=l:void 0}},{key:"__compare",value:function(l,h,b){if(l=u.__toPrimitive(l),h=u.__toPrimitive(h),typeof l=="string"&&typeof h=="string")switch(b){case 0:return l<h;case 1:return l<=h;case 2:return l>h;case 3:return l>=h}if(u.__isBigInt(l)&&typeof h=="string")return h=u.__fromString(h),h!==null&&u.__comparisonResultToBool(u.__compareToBigInt(l,h),b);if(typeof l=="string"&&u.__isBigInt(h))return l=u.__fromString(l),l!==null&&u.__comparisonResultToBool(u.__compareToBigInt(l,h),b);if(l=u.__toNumeric(l),h=u.__toNumeric(h),u.__isBigInt(l)){if(u.__isBigInt(h))return u.__comparisonResultToBool(u.__compareToBigInt(l,h),b);if(typeof h!="number")throw new Error("implementation bug");return u.__comparisonResultToBool(u.__compareToNumber(l,h),b)}if(typeof l!="number")throw new Error("implementation bug");if(u.__isBigInt(h))return u.__comparisonResultToBool(u.__compareToNumber(h,l),2^b);if(typeof h!="number")throw new Error("implementation bug");return b===0?l<h:b===1?l<=h:b===2?l>h:b===3?l>=h:void 0}},{key:"__absoluteAdd",value:function(l,h,b){if(l.length<h.length)return u.__absoluteAdd(h,l,b);if(l.length===0)return l;if(h.length===0)return l.sign===b?l:u.unaryMinus(l);var _=l.length;(l.__clzmsd()===0||h.length===l.length&&h.__clzmsd()===0)&&_++;for(var g,f=new u(_,b),v=0,O=0;O<h.length;O++)g=l.__digit(O)+h.__digit(O)+v,v=g>>>30,f.__setDigit(O,1073741823&g);for(;O<l.length;O++){var T=l.__digit(O)+v;v=T>>>30,f.__setDigit(O,1073741823&T)}return O<f.length&&f.__setDigit(O,v),f.__trim()}},{key:"__absoluteSub",value:function(l,h,b){if(l.length===0)return l;if(h.length===0)return l.sign===b?l:u.unaryMinus(l);for(var _,g=new u(l.length,b),f=0,v=0;v<h.length;v++)_=l.__digit(v)-h.__digit(v)-f,f=1&_>>>30,g.__setDigit(v,1073741823&_);for(;v<l.length;v++){var O=l.__digit(v)-f;f=1&O>>>30,g.__setDigit(v,1073741823&O)}return g.__trim()}},{key:"__absoluteAddOne",value:function(l,h){var b=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null,_=l.length;b===null?b=new u(_,h):b.sign=h;for(var g,f=1,v=0;v<_;v++)g=l.__digit(v)+f,f=g>>>30,b.__setDigit(v,1073741823&g);return f!==0&&b.__setDigitGrow(_,1),b}},{key:"__absoluteSubOne",value:function(l,h){var b=l.length;h=h||b;for(var _,g=new u(h,!1),f=1,v=0;v<b;v++)_=l.__digit(v)-f,f=1&_>>>30,g.__setDigit(v,1073741823&_);if(f!==0)throw new Error("implementation bug");for(var O=b;O<h;O++)g.__setDigit(O,0);return g}},{key:"__absoluteAnd",value:function(l,h){var b=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null,_=l.length,g=h.length,f=g;if(_<g){f=_;var v=l,O=_;l=h,_=g,h=v,g=O}var T=f;b===null?b=new u(T,!1):T=b.length;for(var R=0;R<f;R++)b.__setDigit(R,l.__digit(R)&h.__digit(R));for(;R<T;R++)b.__setDigit(R,0);return b}},{key:"__absoluteAndNot",value:function(l,h){var b=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null,_=l.length,g=h.length,f=g;_<g&&(f=_);var v=_;b===null?b=new u(v,!1):v=b.length;for(var O=0;O<f;O++)b.__setDigit(O,l.__digit(O)&~h.__digit(O));for(;O<_;O++)b.__setDigit(O,l.__digit(O));for(;O<v;O++)b.__setDigit(O,0);return b}},{key:"__absoluteOr",value:function(l,h){var b=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null,_=l.length,g=h.length,f=g;if(_<g){f=_;var v=l,O=_;l=h,_=g,h=v,g=O}var T=_;b===null?b=new u(T,!1):T=b.length;for(var R=0;R<f;R++)b.__setDigit(R,l.__digit(R)|h.__digit(R));for(;R<_;R++)b.__setDigit(R,l.__digit(R));for(;R<T;R++)b.__setDigit(R,0);return b}},{key:"__absoluteXor",value:function(l,h){var b=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null,_=l.length,g=h.length,f=g;if(_<g){f=_;var v=l,O=_;l=h,_=g,h=v,g=O}var T=_;b===null?b=new u(T,!1):T=b.length;for(var R=0;R<f;R++)b.__setDigit(R,l.__digit(R)^h.__digit(R));for(;R<_;R++)b.__setDigit(R,l.__digit(R));for(;R<T;R++)b.__setDigit(R,0);return b}},{key:"__absoluteCompare",value:function(l,h){var b=l.length-h.length;if(b!=0)return b;for(var _=l.length-1;0<=_&&l.__digit(_)===h.__digit(_);)_--;return 0>_?0:l.__unsignedDigit(_)>h.__unsignedDigit(_)?1:-1}},{key:"__multiplyAccumulate",value:function(l,h,b,_){if(h!==0){for(var g=32767&h,f=h>>>15,v=0,O=0,T=0;T<l.length;T++,_++){var R=b.__digit(_),z=l.__digit(T),V=32767&z,W=z>>>15,Z=u.__imul(V,g),J=u.__imul(V,f),X=u.__imul(W,g),Ee=u.__imul(W,f);R+=O+Z+v,v=R>>>30,R&=1073741823,R+=((32767&J)<<15)+((32767&X)<<15),v+=R>>>30,O=Ee+(J>>>15)+(X>>>15),b.__setDigit(_,1073741823&R)}for(;v!==0||O!==0;_++){var re=b.__digit(_);re+=v+O,O=0,v=re>>>30,b.__setDigit(_,1073741823&re)}}}},{key:"__internalMultiplyAdd",value:function(l,h,b,_,g){for(var f=b,v=0,O=0;O<_;O++){var T=l.__digit(O),R=u.__imul(32767&T,h),z=u.__imul(T>>>15,h),V=R+((32767&z)<<15)+v+f;f=V>>>30,v=z>>>15,g.__setDigit(O,1073741823&V)}if(g.length>_)for(g.__setDigit(_++,f+v);_<g.length;)g.__setDigit(_++,0);else if(f+v!==0)throw new Error("implementation bug")}},{key:"__absoluteDivSmall",value:function(l,h){var b=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;b===null&&(b=new u(l.length,!1));for(var _=0,g=2*l.length-1;0<=g;g-=2){var f=(_<<15|l.__halfDigit(g))>>>0,v=0|f/h;_=0|f%h,f=(_<<15|l.__halfDigit(g-1))>>>0;var O=0|f/h;_=0|f%h,b.__setDigit(g>>>1,v<<15|O)}return b}},{key:"__absoluteModSmall",value:function(l,h){for(var b,_=0,g=2*l.length-1;0<=g;g--)b=(_<<15|l.__halfDigit(g))>>>0,_=0|b%h;return _}},{key:"__absoluteDivLarge",value:function(l,h,b,_){var g=h.__halfDigitLength(),f=h.length,v=l.__halfDigitLength()-g,O=null;b&&(O=new u(v+2>>>1,!1),O.__initializeDigits());var T=new u(g+2>>>1,!1);T.__initializeDigits();var R=u.__clz15(h.__halfDigit(g-1));0<R&&(h=u.__specialLeftShift(h,R,0));for(var z=u.__specialLeftShift(l,R,1),V=h.__halfDigit(g-1),W=0,Z=v;0<=Z;Z--){var J=32767,X=z.__halfDigit(Z+g);if(X!==V){var Ee=(X<<15|z.__halfDigit(Z+g-1))>>>0;J=0|Ee/V;for(var re=0|Ee%V,ne=h.__halfDigit(g-2),qe=z.__halfDigit(Z+g-2);u.__imul(J,ne)>>>0>(re<<16|qe)>>>0&&(J--,re+=V,!(32767<re)););}u.__internalMultiplyAdd(h,J,0,f,T);var ce=z.__inplaceSub(T,Z,g+1);ce!==0&&(ce=z.__inplaceAdd(h,Z,g),z.__setHalfDigit(Z+g,32767&z.__halfDigit(Z+g)+ce),J--),b&&(1&Z?W=J<<15:O.__setDigit(Z>>>1,W|J))}if(_)return z.__inplaceRightShift(R),b?{quotient:O,remainder:z}:z;if(b)return O;throw new Error("unreachable")}},{key:"__clz15",value:function(l){return u.__clz30(l)-15}},{key:"__specialLeftShift",value:function(l,h,b){var _=l.length,g=new u(_+b,!1);if(h===0){for(var f=0;f<_;f++)g.__setDigit(f,l.__digit(f));return 0<b&&g.__setDigit(_,0),g}for(var v,O=0,T=0;T<_;T++)v=l.__digit(T),g.__setDigit(T,1073741823&v<<h|O),O=v>>>30-h;return 0<b&&g.__setDigit(_,O),g}},{key:"__leftShiftByAbsolute",value:function(l,h){var b=u.__toShiftAmount(h);if(0>b)throw new RangeError("BigInt too big");var _=0|b/30,g=b%30,f=l.length,v=g!==0&&l.__digit(f-1)>>>30-g!=0,O=f+_+(v?1:0),T=new u(O,l.sign);if(g===0){for(var R=0;R<_;R++)T.__setDigit(R,0);for(;R<O;R++)T.__setDigit(R,l.__digit(R-_))}else{for(var z=0,V=0;V<_;V++)T.__setDigit(V,0);for(var W,Z=0;Z<f;Z++)W=l.__digit(Z),T.__setDigit(Z+_,1073741823&W<<g|z),z=W>>>30-g;if(v)T.__setDigit(f+_,z);else if(z!==0)throw new Error("implementation bug")}return T.__trim()}},{key:"__rightShiftByAbsolute",value:function(l,h){var b=l.length,_=l.sign,g=u.__toShiftAmount(h);if(0>g)return u.__rightShiftByMaximum(_);var f=0|g/30,v=g%30,O=b-f;if(0>=O)return u.__rightShiftByMaximum(_);var T=!1;if(_){if(l.__digit(f)&(1<<v)-1)T=!0;else for(var R=0;R<f;R++)if(l.__digit(R)!==0){T=!0;break}}if(T&&v===0){var z=l.__digit(b-1);!~z&&O++}var V=new u(O,_);if(v===0){V.__setDigit(O-1,0);for(var W=f;W<b;W++)V.__setDigit(W-f,l.__digit(W))}else{for(var Z,J=l.__digit(f)>>>v,X=b-f-1,Ee=0;Ee<X;Ee++)Z=l.__digit(Ee+f+1),V.__setDigit(Ee,1073741823&Z<<30-v|J),J=Z>>>v;V.__setDigit(X,J)}return T&&(V=u.__absoluteAddOne(V,!0,V)),V.__trim()}},{key:"__rightShiftByMaximum",value:function(l){return l?u.__oneDigit(1,!0):u.__zero()}},{key:"__toShiftAmount",value:function(l){if(1<l.length)return-1;var h=l.__unsignedDigit(0);return h>u.__kMaxLengthBits?-1:h}},{key:"__toPrimitive",value:function(l){var h=1<arguments.length&&arguments[1]!==void 0?arguments[1]:"default";if(r(l)!=="object"||l.constructor===u)return l;if(typeof Symbol<"u"&&r(Symbol.toPrimitive)==="symbol"){var b=l[Symbol.toPrimitive];if(b){var _=b(h);if(r(_)!=="object")return _;throw new TypeError("Cannot convert object to primitive value")}}var g=l.valueOf;if(g){var f=g.call(l);if(r(f)!=="object")return f}var v=l.toString;if(v){var O=v.call(l);if(r(O)!=="object")return O}throw new TypeError("Cannot convert object to primitive value")}},{key:"__toNumeric",value:function(l){return u.__isBigInt(l)?l:+l}},{key:"__isBigInt",value:function(l){return r(l)==="object"&&l!==null&&l.constructor===u}},{key:"__truncateToNBits",value:function(l,h){for(var b=0|(l+29)/30,_=new u(b,h.sign),g=b-1,f=0;f<g;f++)_.__setDigit(f,h.__digit(f));var v=h.__digit(g);if(l%30!=0){var O=32-l%30;v=v<<O>>>O}return _.__setDigit(g,v),_.__trim()}},{key:"__truncateAndSubFromPowerOfTwo",value:function(l,h,b){for(var _=Math.min,g,f=0|(l+29)/30,v=new u(f,b),O=0,T=f-1,R=0,z=_(T,h.length);O<z;O++)g=0-h.__digit(O)-R,R=1&g>>>30,v.__setDigit(O,1073741823&g);for(;O<T;O++)v.__setDigit(O,0|1073741823&-R);var V,W=T<h.length?h.__digit(T):0,Z=l%30;if(Z===0)V=0-W-R,V&=1073741823;else{var J=32-Z;W=W<<J>>>J;var X=1<<32-J;V=X-W-R,V&=X-1}return v.__setDigit(T,V),v.__trim()}},{key:"__digitPow",value:function(l,h){for(var b=1;0<h;)1&h&&(b*=l),h>>>=1,l*=l;return b}},{key:"__isOneDigitInt",value:function(l){return(1073741823&l)===l}}]),u}(P(Array));return F.__kMaxLength=33554432,F.__kMaxLengthBits=F.__kMaxLength<<5,F.__kMaxBitsPerChar=[0,0,32,51,64,75,83,90,96,102,107,111,115,119,122,126,128,131,134,136,139,141,143,145,147,149,151,153,154,156,158,159,160,162,163,165,166],F.__kBitsPerCharTableShift=5,F.__kBitsPerCharTableMultiplier=1<<F.__kBitsPerCharTableShift,F.__kConversionChars=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"],F.__kBitConversionBuffer=new ArrayBuffer(8),F.__kBitConversionDouble=new Float64Array(F.__kBitConversionBuffer),F.__kBitConversionInts=new Int32Array(F.__kBitConversionBuffer),F.__clz30=e?function(N){return e(N)-2}:function(N){var G=Math.LN2,x=Math.log;return N===0?30:0|29-(0|x(N>>>0)/G)},F.__imul=t||function(N,G){return 0|N*G},F})});var yx=H(Xr=>{"use strict";E();Object.defineProperty(Xr,"__esModule",{value:!0});Xr.regexpCode=Xr.getEsmExportName=Xr.getProperty=Xr.safeStringify=Xr.stringify=Xr.strConcat=Xr.addCodeArg=Xr.str=Xr._=Xr.nil=Xr._Code=Xr.Name=Xr.IDENTIFIER=Xr._CodeOrName=void 0;var px=class{};Xr._CodeOrName=px;Xr.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var Ay=class extends px{constructor(e){if(super(),!Xr.IDENTIFIER.test(e))throw new Error("CodeGen: name must be a valid identifier");this.str=e}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};Xr.Name=Ay;var rf=class extends px{constructor(e){super(),this._items=typeof e=="string"?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let e=this._items[0];return e===""||e==='""'}get str(){var e;return(e=this._str)!==null&&e!==void 0?e:this._str=this._items.reduce((r,n)=>`${r}${n}`,"")}get names(){var e;return(e=this._names)!==null&&e!==void 0?e:this._names=this._items.reduce((r,n)=>(n instanceof Ay&&(r[n.str]=(r[n.str]||0)+1),r),{})}};Xr._Code=rf;Xr.nil=new rf("");function Dfe(t,...e){let r=[t[0]],n=0;for(;n<e.length;)TC(r,e[n]),r.push(t[++n]);return new rf(r)}Xr._=Dfe;var AC=new rf("+");function Cfe(t,...e){let r=[mx(t[0])],n=0;for(;n<e.length;)r.push(AC),TC(r,e[n]),r.push(AC,mx(t[++n]));return d$e(r),new rf(r)}Xr.str=Cfe;function TC(t,e){e instanceof rf?t.push(...e._items):e instanceof Ay?t.push(e):t.push(m$e(e))}Xr.addCodeArg=TC;function d$e(t){let e=1;for(;e<t.length-1;){if(t[e]===AC){let r=h$e(t[e-1],t[e+1]);if(r!==void 0){t.splice(e-1,3,r);continue}t[e++]="+"}e++}}function h$e(t,e){if(e==='""')return t;if(t==='""')return e;if(typeof t=="string")return e instanceof Ay||t[t.length-1]!=='"'?void 0:typeof e!="string"?`${t.slice(0,-1)}${e}"`:e[0]==='"'?t.slice(0,-1)+e.slice(1):void 0;if(typeof e=="string"&&e[0]==='"'&&!(t instanceof Ay))return`"${t}${e.slice(1)}`}function p$e(t,e){return e.emptyStr()?t:t.emptyStr()?e:Cfe`${t}${e}`}Xr.strConcat=p$e;function m$e(t){return typeof t=="number"||typeof t=="boolean"||t===null?t:mx(Array.isArray(t)?t.join(","):t)}function y$e(t){return new rf(mx(t))}Xr.stringify=y$e;function mx(t){return JSON.stringify(t).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}Xr.safeStringify=mx;function g$e(t){return typeof t=="string"&&Xr.IDENTIFIER.test(t)?new rf(`.${t}`):Dfe`[${t}]`}Xr.getProperty=g$e;function v$e(t){if(typeof t=="string"&&Xr.IDENTIFIER.test(t))return new rf(`${t}`);throw new Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)}Xr.getEsmExportName=v$e;function b$e(t){return new rf(t.toString())}Xr.regexpCode=b$e});var OC=H(ua=>{"use strict";E();Object.defineProperty(ua,"__esModule",{value:!0});ua.ValueScope=ua.ValueScopeName=ua.Scope=ua.varKinds=ua.UsedValueState=void 0;var Oa=yx(),RC=class extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}},IC;(function(t){t[t.Started=0]="Started",t[t.Completed=1]="Completed"})(IC=ua.UsedValueState||(ua.UsedValueState={}));ua.varKinds={const:new Oa.Name("const"),let:new Oa.Name("let"),var:new Oa.Name("var")};var X8=class{constructor({prefixes:e,parent:r}={}){this._names={},this._prefixes=e,this._parent=r}toName(e){return e instanceof Oa.Name?e:this.name(e)}name(e){return new Oa.Name(this._newName(e))}_newName(e){let r=this._names[e]||this._nameGroup(e);return`${e}${r.index++}`}_nameGroup(e){var r,n;if(!((n=(r=this._parent)===null||r===void 0?void 0:r._prefixes)===null||n===void 0)&&n.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}}};ua.Scope=X8;var e4=class extends Oa.Name{constructor(e,r){super(r),this.prefix=e}setValue(e,{property:r,itemIndex:n}){this.value=e,this.scopePath=(0,Oa._)`.${new Oa.Name(r)}[${n}]`}};ua.ValueScopeName=e4;var w$e=(0,Oa._)`\n`,kC=class extends X8{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?w$e:Oa.nil}}get(){return this._scope}name(e){return new e4(e,this._newName(e))}value(e,r){var n;if(r.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let i=this.toName(e),{prefix:o}=i,s=(n=r.key)!==null&&n!==void 0?n:r.ref,a=this._values[o];if(a){let p=a.get(s);if(p)return p}else a=this._values[o]=new Map;a.set(s,i);let d=this._scope[o]||(this._scope[o]=[]),m=d.length;return d[m]=r.ref,i.setValue(r,{property:o,itemIndex:m}),i}getValue(e,r){let n=this._values[e];if(n)return n.get(r)}scopeRefs(e,r=this._values){return this._reduceValues(r,n=>{if(n.scopePath===void 0)throw new Error(`CodeGen: name "${n}" has no value`);return(0,Oa._)`${e}${n.scopePath}`})}scopeCode(e=this._values,r,n){return this._reduceValues(e,i=>{if(i.value===void 0)throw new Error(`CodeGen: name "${i}" has no value`);return i.value.code},r,n)}_reduceValues(e,r,n={},i){let o=Oa.nil;for(let s in e){let a=e[s];if(!a)continue;let d=n[s]=n[s]||new Map;a.forEach(m=>{if(d.has(m))return;d.set(m,IC.Started);let p=r(m);if(p){let w=this.opts.es5?ua.varKinds.var:ua.varKinds.const;o=(0,Oa._)`${o}${w} ${m} = ${p};${this.opts._n}`}else if(p=i?.(m))o=(0,Oa._)`${o}${p}${this.opts._n}`;else throw new RC(m);d.set(m,IC.Completed)})}return o}};ua.ValueScope=kC});var tr=H(wr=>{"use strict";E();Object.defineProperty(wr,"__esModule",{value:!0});wr.or=wr.and=wr.not=wr.CodeGen=wr.operators=wr.varKinds=wr.ValueScopeName=wr.ValueScope=wr.Scope=wr.Name=wr.regexpCode=wr.stringify=wr.getProperty=wr.nil=wr.strConcat=wr.str=wr._=void 0;var Kr=yx(),ru=OC(),Wp=yx();Object.defineProperty(wr,"_",{enumerable:!0,get:function(){return Wp._}});Object.defineProperty(wr,"str",{enumerable:!0,get:function(){return Wp.str}});Object.defineProperty(wr,"strConcat",{enumerable:!0,get:function(){return Wp.strConcat}});Object.defineProperty(wr,"nil",{enumerable:!0,get:function(){return Wp.nil}});Object.defineProperty(wr,"getProperty",{enumerable:!0,get:function(){return Wp.getProperty}});Object.defineProperty(wr,"stringify",{enumerable:!0,get:function(){return Wp.stringify}});Object.defineProperty(wr,"regexpCode",{enumerable:!0,get:function(){return Wp.regexpCode}});Object.defineProperty(wr,"Name",{enumerable:!0,get:function(){return Wp.Name}});var i4=OC();Object.defineProperty(wr,"Scope",{enumerable:!0,get:function(){return i4.Scope}});Object.defineProperty(wr,"ValueScope",{enumerable:!0,get:function(){return i4.ValueScope}});Object.defineProperty(wr,"ValueScopeName",{enumerable:!0,get:function(){return i4.ValueScopeName}});Object.defineProperty(wr,"varKinds",{enumerable:!0,get:function(){return i4.varKinds}});wr.operators={GT:new Kr._Code(">"),GTE:new Kr._Code(">="),LT:new Kr._Code("<"),LTE:new Kr._Code("<="),EQ:new Kr._Code("==="),NEQ:new Kr._Code("!=="),NOT:new Kr._Code("!"),OR:new Kr._Code("||"),AND:new Kr._Code("&&"),ADD:new Kr._Code("+")};var oh=class{optimizeNodes(){return this}optimizeNames(e,r){return this}},BC=class extends oh{constructor(e,r,n){super(),this.varKind=e,this.name=r,this.rhs=n}render({es5:e,_n:r}){let n=e?ru.varKinds.var:this.varKind,i=this.rhs===void 0?"":` = ${this.rhs}`;return`${n} ${this.name}${i};`+r}optimizeNames(e,r){if(e[this.name.str])return this.rhs&&(this.rhs=sw(this.rhs,e,r)),this}get names(){return this.rhs instanceof Kr._CodeOrName?this.rhs.names:{}}},t4=class extends oh{constructor(e,r,n){super(),this.lhs=e,this.rhs=r,this.sideEffects=n}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,r){if(!(this.lhs instanceof Kr.Name&&!e[this.lhs.str]&&!this.sideEffects))return this.rhs=sw(this.rhs,e,r),this}get names(){let e=this.lhs instanceof Kr.Name?{}:{...this.lhs.names};return n4(e,this.rhs)}},DC=class extends t4{constructor(e,r,n,i){super(e,n,i),this.op=r}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}},CC=class extends oh{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}},jC=class extends oh{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}},NC=class extends oh{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}},qC=class extends oh{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,r){return this.code=sw(this.code,e,r),this}get names(){return this.code instanceof Kr._CodeOrName?this.code.names:{}}},gx=class extends oh{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce((r,n)=>r+n.render(e),"")}optimizeNodes(){let{nodes:e}=this,r=e.length;for(;r--;){let n=e[r].optimizeNodes();Array.isArray(n)?e.splice(r,1,...n):n?e[r]=n:e.splice(r,1)}return e.length>0?this:void 0}optimizeNames(e,r){let{nodes:n}=this,i=n.length;for(;i--;){let o=n[i];o.optimizeNames(e,r)||(_$e(e,o.names),n.splice(i,1))}return n.length>0?this:void 0}get names(){return this.nodes.reduce((e,r)=>Ry(e,r.names),{})}},sh=class extends gx{render(e){return"{"+e._n+super.render(e)+"}"+e._n}},$C=class extends gx{},ow=class extends sh{};ow.kind="else";var nu=class extends sh{constructor(e,r){super(r),this.condition=e}render(e){let r=`if(${this.condition})`+super.render(e);return this.else&&(r+="else "+this.else.render(e)),r}optimizeNodes(){super.optimizeNodes();let e=this.condition;if(e===!0)return this.nodes;let r=this.else;if(r){let n=r.optimizeNodes();r=this.else=Array.isArray(n)?new ow(n):n}if(r)return e===!1?r instanceof nu?r:r.nodes:this.nodes.length?this:new nu(jfe(e),r instanceof nu?[r]:r.nodes);if(!(e===!1||!this.nodes.length))return this}optimizeNames(e,r){var n;if(this.else=(n=this.else)===null||n===void 0?void 0:n.optimizeNames(e,r),!!(super.optimizeNames(e,r)||this.else))return this.condition=sw(this.condition,e,r),this}get names(){let e=super.names;return n4(e,this.condition),this.else&&Ry(e,this.else.names),e}};nu.kind="if";var Ty=class extends sh{};Ty.kind="for";var LC=class extends Ty{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iteration=sw(this.iteration,e,r),this}get names(){return Ry(super.names,this.iteration.names)}},UC=class extends Ty{constructor(e,r,n,i){super(),this.varKind=e,this.name=r,this.from=n,this.to=i}render(e){let r=e.es5?ru.varKinds.var:this.varKind,{name:n,from:i,to:o}=this;return`for(${r} ${n}=${i}; ${n}<${o}; ${n}++)`+super.render(e)}get names(){let e=n4(super.names,this.from);return n4(e,this.to)}},r4=class extends Ty{constructor(e,r,n,i){super(),this.loop=e,this.varKind=r,this.name=n,this.iterable=i}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iterable=sw(this.iterable,e,r),this}get names(){return Ry(super.names,this.iterable.names)}},vx=class extends sh{constructor(e,r,n){super(),this.name=e,this.args=r,this.async=n}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}};vx.kind="func";var bx=class extends gx{render(e){return"return "+super.render(e)}};bx.kind="return";var FC=class extends sh{render(e){let r="try"+super.render(e);return this.catch&&(r+=this.catch.render(e)),this.finally&&(r+=this.finally.render(e)),r}optimizeNodes(){var e,r;return super.optimizeNodes(),(e=this.catch)===null||e===void 0||e.optimizeNodes(),(r=this.finally)===null||r===void 0||r.optimizeNodes(),this}optimizeNames(e,r){var n,i;return super.optimizeNames(e,r),(n=this.catch)===null||n===void 0||n.optimizeNames(e,r),(i=this.finally)===null||i===void 0||i.optimizeNames(e,r),this}get names(){let e=super.names;return this.catch&&Ry(e,this.catch.names),this.finally&&Ry(e,this.finally.names),e}},wx=class extends sh{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}};wx.kind="catch";var _x=class extends sh{render(e){return"finally"+super.render(e)}};_x.kind="finally";var zC=class{constructor(e,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?`
`:""},this._extScope=e,this._scope=new ru.Scope({parent:e}),this._nodes=[new $C]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,r){let n=this._extScope.value(e,r);return(this._values[n.prefix]||(this._values[n.prefix]=new Set)).add(n),n}getScopeValue(e,r){return this._extScope.getValue(e,r)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,r,n,i){let o=this._scope.toName(r);return n!==void 0&&i&&(this._constants[o.str]=n),this._leafNode(new BC(e,o,n)),o}const(e,r,n){return this._def(ru.varKinds.const,e,r,n)}let(e,r,n){return this._def(ru.varKinds.let,e,r,n)}var(e,r,n){return this._def(ru.varKinds.var,e,r,n)}assign(e,r,n){return this._leafNode(new t4(e,r,n))}add(e,r){return this._leafNode(new DC(e,wr.operators.ADD,r))}code(e){return typeof e=="function"?e():e!==Kr.nil&&this._leafNode(new qC(e)),this}object(...e){let r=["{"];for(let[n,i]of e)r.length>1&&r.push(","),r.push(n),(n!==i||this.opts.es5)&&(r.push(":"),(0,Kr.addCodeArg)(r,i));return r.push("}"),new Kr._Code(r)}if(e,r,n){if(this._blockNode(new nu(e)),r&&n)this.code(r).else().code(n).endIf();else if(r)this.code(r).endIf();else if(n)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(e){return this._elseNode(new nu(e))}else(){return this._elseNode(new ow)}endIf(){return this._endBlockNode(nu,ow)}_for(e,r){return this._blockNode(e),r&&this.code(r).endFor(),this}for(e,r){return this._for(new LC(e),r)}forRange(e,r,n,i,o=this.opts.es5?ru.varKinds.var:ru.varKinds.let){let s=this._scope.toName(e);return this._for(new UC(o,s,r,n),()=>i(s))}forOf(e,r,n,i=ru.varKinds.const){let o=this._scope.toName(e);if(this.opts.es5){let s=r instanceof Kr.Name?r:this.var("_arr",r);return this.forRange("_i",0,(0,Kr._)`${s}.length`,a=>{this.var(o,(0,Kr._)`${s}[${a}]`),n(o)})}return this._for(new r4("of",i,o,r),()=>n(o))}forIn(e,r,n,i=this.opts.es5?ru.varKinds.var:ru.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,(0,Kr._)`Object.keys(${r})`,n);let o=this._scope.toName(e);return this._for(new r4("in",i,o,r),()=>n(o))}endFor(){return this._endBlockNode(Ty)}label(e){return this._leafNode(new CC(e))}break(e){return this._leafNode(new jC(e))}return(e){let r=new bx;if(this._blockNode(r),this.code(e),r.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(bx)}try(e,r,n){if(!r&&!n)throw new Error('CodeGen: "try" without "catch" and "finally"');let i=new FC;if(this._blockNode(i),this.code(e),r){let o=this.name("e");this._currNode=i.catch=new wx(o),r(o)}return n&&(this._currNode=i.finally=new _x,this.code(n)),this._endBlockNode(wx,_x)}throw(e){return this._leafNode(new NC(e))}block(e,r){return this._blockStarts.push(this._nodes.length),e&&this.code(e).endBlock(r),this}endBlock(e){let r=this._blockStarts.pop();if(r===void 0)throw new Error("CodeGen: not in self-balancing block");let n=this._nodes.length-r;if(n<0||e!==void 0&&n!==e)throw new Error(`CodeGen: wrong number of nodes: ${n} vs ${e} expected`);return this._nodes.length=r,this}func(e,r=Kr.nil,n,i){return this._blockNode(new vx(e,r,n)),i&&this.code(i).endFunc(),this}endFunc(){return this._endBlockNode(vx)}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,r){let n=this._currNode;if(n instanceof e||r&&n instanceof r)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${r?`${e.kind}/${r.kind}`:e.kind}"`)}_elseNode(e){let r=this._currNode;if(!(r instanceof nu))throw new Error('CodeGen: "else" without "if"');return this._currNode=r.else=e,this}get _root(){return this._nodes[0]}get _currNode(){let e=this._nodes;return e[e.length-1]}set _currNode(e){let r=this._nodes;r[r.length-1]=e}};wr.CodeGen=zC;function Ry(t,e){for(let r in e)t[r]=(t[r]||0)+(e[r]||0);return t}function n4(t,e){return e instanceof Kr._CodeOrName?Ry(t,e.names):t}function sw(t,e,r){if(t instanceof Kr.Name)return n(t);if(!i(t))return t;return new Kr._Code(t._items.reduce((o,s)=>(s instanceof Kr.Name&&(s=n(s)),s instanceof Kr._Code?o.push(...s._items):o.push(s),o),[]));function n(o){let s=r[o.str];return s===void 0||e[o.str]!==1?o:(delete e[o.str],s)}function i(o){return o instanceof Kr._Code&&o._items.some(s=>s instanceof Kr.Name&&e[s.str]===1&&r[s.str]!==void 0)}}function _$e(t,e){for(let r in e)t[r]=(t[r]||0)-(e[r]||0)}function jfe(t){return typeof t=="boolean"||typeof t=="number"||t===null?!t:(0,Kr._)`!${KC(t)}`}wr.not=jfe;var x$e=Nfe(wr.operators.AND);function E$e(...t){return t.reduce(x$e)}wr.and=E$e;var S$e=Nfe(wr.operators.OR);function M$e(...t){return t.reduce(S$e)}wr.or=M$e;function Nfe(t){return(e,r)=>e===Kr.nil?r:r===Kr.nil?e:(0,Kr._)`${KC(e)} ${t} ${KC(r)}`}function KC(t){return t instanceof Kr.Name?t:(0,Kr._)`(${t})`}});var Dr=H(_r=>{"use strict";E();Object.defineProperty(_r,"__esModule",{value:!0});_r.checkStrictMode=_r.getErrorPath=_r.Type=_r.useFunc=_r.setEvaluated=_r.evaluatedPropsToName=_r.mergeEvaluated=_r.eachItem=_r.unescapeJsonPointer=_r.escapeJsonPointer=_r.escapeFragment=_r.unescapeFragment=_r.schemaRefOrVal=_r.schemaHasRulesButRef=_r.schemaHasRules=_r.checkUnknownRules=_r.alwaysValidSchema=_r.toHash=void 0;var kn=tr(),P$e=yx();function A$e(t){let e={};for(let r of t)e[r]=!0;return e}_r.toHash=A$e;function T$e(t,e){return typeof e=="boolean"?e:Object.keys(e).length===0?!0:(Lfe(t,e),!Ufe(e,t.self.RULES.all))}_r.alwaysValidSchema=T$e;function Lfe(t,e=t.schema){let{opts:r,self:n}=t;if(!r.strictSchema||typeof e=="boolean")return;let i=n.RULES.keywords;for(let o in e)i[o]||Gfe(t,`unknown keyword: "${o}"`)}_r.checkUnknownRules=Lfe;function Ufe(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(e[r])return!0;return!1}_r.schemaHasRules=Ufe;function R$e(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(r!=="$ref"&&e.all[r])return!0;return!1}_r.schemaHasRulesButRef=R$e;function I$e({topSchemaRef:t,schemaPath:e},r,n,i){if(!i){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return(0,kn._)`${r}`}return(0,kn._)`${t}${e}${(0,kn.getProperty)(n)}`}_r.schemaRefOrVal=I$e;function k$e(t){return Ffe(decodeURIComponent(t))}_r.unescapeFragment=k$e;function O$e(t){return encodeURIComponent(GC(t))}_r.escapeFragment=O$e;function GC(t){return typeof t=="number"?`${t}`:t.replace(/~/g,"~0").replace(/\//g,"~1")}_r.escapeJsonPointer=GC;function Ffe(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}_r.unescapeJsonPointer=Ffe;function B$e(t,e){if(Array.isArray(t))for(let r of t)e(r);else e(t)}_r.eachItem=B$e;function qfe({mergeNames:t,mergeToName:e,mergeValues:r,resultToName:n}){return(i,o,s,a)=>{let d=s===void 0?o:s instanceof kn.Name?(o instanceof kn.Name?t(i,o,s):e(i,o,s),s):o instanceof kn.Name?(e(i,s,o),o):r(o,s);return a===kn.Name&&!(d instanceof kn.Name)?n(i,d):d}}_r.mergeEvaluated={props:qfe({mergeNames:(t,e,r)=>t.if((0,kn._)`${r} !== true && ${e} !== undefined`,()=>{t.if((0,kn._)`${e} === true`,()=>t.assign(r,!0),()=>t.assign(r,(0,kn._)`${r} || {}`).code((0,kn._)`Object.assign(${r}, ${e})`))}),mergeToName:(t,e,r)=>t.if((0,kn._)`${r} !== true`,()=>{e===!0?t.assign(r,!0):(t.assign(r,(0,kn._)`${r} || {}`),WC(t,r,e))}),mergeValues:(t,e)=>t===!0?!0:{...t,...e},resultToName:zfe}),items:qfe({mergeNames:(t,e,r)=>t.if((0,kn._)`${r} !== true && ${e} !== undefined`,()=>t.assign(r,(0,kn._)`${e} === true ? true : ${r} > ${e} ? ${r} : ${e}`)),mergeToName:(t,e,r)=>t.if((0,kn._)`${r} !== true`,()=>t.assign(r,e===!0?!0:(0,kn._)`${r} > ${e} ? ${r} : ${e}`)),mergeValues:(t,e)=>t===!0?!0:Math.max(t,e),resultToName:(t,e)=>t.var("items",e)})};function zfe(t,e){if(e===!0)return t.var("props",!0);let r=t.var("props",(0,kn._)`{}`);return e!==void 0&&WC(t,r,e),r}_r.evaluatedPropsToName=zfe;function WC(t,e,r){Object.keys(r).forEach(n=>t.assign((0,kn._)`${e}${(0,kn.getProperty)(n)}`,!0))}_r.setEvaluated=WC;var $fe={};function D$e(t,e){return t.scopeValue("func",{ref:e,code:$fe[e.code]||($fe[e.code]=new P$e._Code(e.code))})}_r.useFunc=D$e;var Kfe;(function(t){t[t.Num=0]="Num",t[t.Str=1]="Str"})(Kfe=_r.Type||(_r.Type={}));function C$e(t,e,r){if(t instanceof kn.Name){let n=e===Kfe.Num;return r?n?(0,kn._)`"[" + ${t} + "]"`:(0,kn._)`"['" + ${t} + "']"`:n?(0,kn._)`"/" + ${t}`:(0,kn._)`"/" + ${t}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,kn.getProperty)(t).toString():"/"+GC(t)}_r.getErrorPath=C$e;function Gfe(t,e,r=t.opts.strictSchema){if(r){if(e=`strict mode: ${e}`,r===!0)throw new Error(e);t.self.logger.warn(e)}}_r.checkStrictMode=Gfe});var nf=H(VC=>{"use strict";E();Object.defineProperty(VC,"__esModule",{value:!0});var Us=tr(),j$e={data:new Us.Name("data"),valCxt:new Us.Name("valCxt"),instancePath:new Us.Name("instancePath"),parentData:new Us.Name("parentData"),parentDataProperty:new Us.Name("parentDataProperty"),rootData:new Us.Name("rootData"),dynamicAnchors:new Us.Name("dynamicAnchors"),vErrors:new Us.Name("vErrors"),errors:new Us.Name("errors"),this:new Us.Name("this"),self:new Us.Name("self"),scope:new Us.Name("scope"),json:new Us.Name("json"),jsonPos:new Us.Name("jsonPos"),jsonLen:new Us.Name("jsonLen"),jsonPart:new Us.Name("jsonPart")};VC.default=j$e});var xx=H(Fs=>{"use strict";E();Object.defineProperty(Fs,"__esModule",{value:!0});Fs.extendErrors=Fs.resetErrorsCount=Fs.reportExtraError=Fs.reportError=Fs.keyword$DataError=Fs.keywordError=void 0;var Vr=tr(),o4=Dr(),la=nf();Fs.keywordError={message:({keyword:t})=>(0,Vr.str)`must pass "${t}" keyword validation`};Fs.keyword$DataError={message:({keyword:t,schemaType:e})=>e?(0,Vr.str)`"${t}" keyword must be ${e} ($data)`:(0,Vr.str)`"${t}" keyword is invalid ($data)`};function N$e(t,e=Fs.keywordError,r,n){let{it:i}=t,{gen:o,compositeRule:s,allErrors:a}=i,d=Hfe(t,e,r);n??(s||a)?Wfe(o,d):Vfe(i,(0,Vr._)`[${d}]`)}Fs.reportError=N$e;function q$e(t,e=Fs.keywordError,r){let{it:n}=t,{gen:i,compositeRule:o,allErrors:s}=n,a=Hfe(t,e,r);Wfe(i,a),o||s||Vfe(n,la.default.vErrors)}Fs.reportExtraError=q$e;function $$e(t,e){t.assign(la.default.errors,e),t.if((0,Vr._)`${la.default.vErrors} !== null`,()=>t.if(e,()=>t.assign((0,Vr._)`${la.default.vErrors}.length`,e),()=>t.assign(la.default.vErrors,null)))}Fs.resetErrorsCount=$$e;function L$e({gen:t,keyword:e,schemaValue:r,data:n,errsCount:i,it:o}){if(i===void 0)throw new Error("ajv implementation error");let s=t.name("err");t.forRange("i",i,la.default.errors,a=>{t.const(s,(0,Vr._)`${la.default.vErrors}[${a}]`),t.if((0,Vr._)`${s}.instancePath === undefined`,()=>t.assign((0,Vr._)`${s}.instancePath`,(0,Vr.strConcat)(la.default.instancePath,o.errorPath))),t.assign((0,Vr._)`${s}.schemaPath`,(0,Vr.str)`${o.errSchemaPath}/${e}`),o.opts.verbose&&(t.assign((0,Vr._)`${s}.schema`,r),t.assign((0,Vr._)`${s}.data`,n))})}Fs.extendErrors=L$e;function Wfe(t,e){let r=t.const("err",e);t.if((0,Vr._)`${la.default.vErrors} === null`,()=>t.assign(la.default.vErrors,(0,Vr._)`[${r}]`),(0,Vr._)`${la.default.vErrors}.push(${r})`),t.code((0,Vr._)`${la.default.errors}++`)}function Vfe(t,e){let{gen:r,validateName:n,schemaEnv:i}=t;i.$async?r.throw((0,Vr._)`new ${t.ValidationError}(${e})`):(r.assign((0,Vr._)`${n}.errors`,e),r.return(!1))}var Iy={keyword:new Vr.Name("keyword"),schemaPath:new Vr.Name("schemaPath"),params:new Vr.Name("params"),propertyName:new Vr.Name("propertyName"),message:new Vr.Name("message"),schema:new Vr.Name("schema"),parentSchema:new Vr.Name("parentSchema")};function Hfe(t,e,r){let{createErrors:n}=t.it;return n===!1?(0,Vr._)`{}`:U$e(t,e,r)}function U$e(t,e,r={}){let{gen:n,it:i}=t,o=[F$e(i,r),z$e(t,r)];return K$e(t,e,o),n.object(...o)}function F$e({errorPath:t},{instancePath:e}){let r=e?(0,Vr.str)`${t}${(0,o4.getErrorPath)(e,o4.Type.Str)}`:t;return[la.default.instancePath,(0,Vr.strConcat)(la.default.instancePath,r)]}function z$e({keyword:t,it:{errSchemaPath:e}},{schemaPath:r,parentSchema:n}){let i=n?e:(0,Vr.str)`${e}/${t}`;return r&&(i=(0,Vr.str)`${i}${(0,o4.getErrorPath)(r,o4.Type.Str)}`),[Iy.schemaPath,i]}function K$e(t,{params:e,message:r},n){let{keyword:i,data:o,schemaValue:s,it:a}=t,{opts:d,propertyName:m,topSchemaRef:p,schemaPath:w}=a;n.push([Iy.keyword,i],[Iy.params,typeof e=="function"?e(t):e||(0,Vr._)`{}`]),d.messages&&n.push([Iy.message,typeof r=="function"?r(t):r]),d.verbose&&n.push([Iy.schema,s],[Iy.parentSchema,(0,Vr._)`${p}${w}`],[la.default.data,o]),m&&n.push([Iy.propertyName,m])}});var Jfe=H(aw=>{"use strict";E();Object.defineProperty(aw,"__esModule",{value:!0});aw.boolOrEmptySchema=aw.topBoolOrEmptySchema=void 0;var G$e=xx(),W$e=tr(),V$e=nf(),H$e={message:"boolean schema is false"};function Z$e(t){let{gen:e,schema:r,validateName:n}=t;r===!1?Zfe(t,!1):typeof r=="object"&&r.$async===!0?e.return(V$e.default.data):(e.assign((0,W$e._)`${n}.errors`,null),e.return(!0))}aw.topBoolOrEmptySchema=Z$e;function J$e(t,e){let{gen:r,schema:n}=t;n===!1?(r.var(e,!1),Zfe(t)):r.var(e,!0)}aw.boolOrEmptySchema=J$e;function Zfe(t,e){let{gen:r,data:n}=t,i={gen:r,keyword:"false schema",data:n,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:t};(0,G$e.reportError)(i,H$e,void 0,e)}});var HC=H(cw=>{"use strict";E();Object.defineProperty(cw,"__esModule",{value:!0});cw.getRules=cw.isJSONType=void 0;var Y$e=["string","number","integer","boolean","null","object","array"],Q$e=new Set(Y$e);function X$e(t){return typeof t=="string"&&Q$e.has(t)}cw.isJSONType=X$e;function eLe(){let t={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...t,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},t.number,t.string,t.array,t.object],post:{rules:[]},all:{},keywords:{}}}cw.getRules=eLe});var ZC=H(Vp=>{"use strict";E();Object.defineProperty(Vp,"__esModule",{value:!0});Vp.shouldUseRule=Vp.shouldUseGroup=Vp.schemaHasRulesForType=void 0;function tLe({schema:t,self:e},r){let n=e.RULES.types[r];return n&&n!==!0&&Yfe(t,n)}Vp.schemaHasRulesForType=tLe;function Yfe(t,e){return e.rules.some(r=>Qfe(t,r))}Vp.shouldUseGroup=Yfe;function Qfe(t,e){var r;return t[e.keyword]!==void 0||((r=e.definition.implements)===null||r===void 0?void 0:r.some(n=>t[n]!==void 0))}Vp.shouldUseRule=Qfe});var Sx=H(fs=>{"use strict";E();Object.defineProperty(fs,"__esModule",{value:!0});fs.reportTypeError=fs.checkDataTypes=fs.checkDataType=fs.coerceAndCheckDataType=fs.getJSONTypes=fs.getSchemaTypes=fs.DataType=void 0;var rLe=HC(),nLe=ZC(),iLe=xx(),ar=tr(),Xfe=Dr(),Ex;(function(t){t[t.Correct=0]="Correct",t[t.Wrong=1]="Wrong"})(Ex=fs.DataType||(fs.DataType={}));function oLe(t){let e=eue(t.type);if(e.includes("null")){if(t.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!e.length&&t.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');t.nullable===!0&&e.push("null")}return e}fs.getSchemaTypes=oLe;function eue(t){let e=Array.isArray(t)?t:t?[t]:[];if(e.every(rLe.isJSONType))return e;throw new Error("type must be JSONType or JSONType[]: "+e.join(","))}fs.getJSONTypes=eue;function sLe(t,e){let{gen:r,data:n,opts:i}=t,o=aLe(e,i.coerceTypes),s=e.length>0&&!(o.length===0&&e.length===1&&(0,nLe.schemaHasRulesForType)(t,e[0]));if(s){let a=YC(e,n,i.strictNumbers,Ex.Wrong);r.if(a,()=>{o.length?cLe(t,e,o):QC(t)})}return s}fs.coerceAndCheckDataType=sLe;var tue=new Set(["string","number","integer","boolean","null"]);function aLe(t,e){return e?t.filter(r=>tue.has(r)||e==="array"&&r==="array"):[]}function cLe(t,e,r){let{gen:n,data:i,opts:o}=t,s=n.let("dataType",(0,ar._)`typeof ${i}`),a=n.let("coerced",(0,ar._)`undefined`);o.coerceTypes==="array"&&n.if((0,ar._)`${s} == 'object' && Array.isArray(${i}) && ${i}.length == 1`,()=>n.assign(i,(0,ar._)`${i}[0]`).assign(s,(0,ar._)`typeof ${i}`).if(YC(e,i,o.strictNumbers),()=>n.assign(a,i))),n.if((0,ar._)`${a} !== undefined`);for(let m of r)(tue.has(m)||m==="array"&&o.coerceTypes==="array")&&d(m);n.else(),QC(t),n.endIf(),n.if((0,ar._)`${a} !== undefined`,()=>{n.assign(i,a),fLe(t,a)});function d(m){switch(m){case"string":n.elseIf((0,ar._)`${s} == "number" || ${s} == "boolean"`).assign(a,(0,ar._)`"" + ${i}`).elseIf((0,ar._)`${i} === null`).assign(a,(0,ar._)`""`);return;case"number":n.elseIf((0,ar._)`${s} == "boolean" || ${i} === null
|| (${s} == "string" && ${i} && ${i} == +${i})`).assign(a,(0,ar._)`+${i}`);return;case"integer":n.elseIf((0,ar._)`${s} === "boolean" || ${i} === null
|| (${s} === "string" && ${i} && ${i} == +${i} && !(${i} % 1))`).assign(a,(0,ar._)`+${i}`);return;case"boolean":n.elseIf((0,ar._)`${i} === "false" || ${i} === 0 || ${i} === null`).assign(a,!1).elseIf((0,ar._)`${i} === "true" || ${i} === 1`).assign(a,!0);return;case"null":n.elseIf((0,ar._)`${i} === "" || ${i} === 0 || ${i} === false`),n.assign(a,null);return;case"array":n.elseIf((0,ar._)`${s} === "string" || ${s} === "number"
|| ${s} === "boolean" || ${i} === null`).assign(a,(0,ar._)`[${i}]`)}}}function fLe({gen:t,parentData:e,parentDataProperty:r},n){t.if((0,ar._)`${e} !== undefined`,()=>t.assign((0,ar._)`${e}[${r}]`,n))}function JC(t,e,r,n=Ex.Correct){let i=n===Ex.Correct?ar.operators.EQ:ar.operators.NEQ,o;switch(t){case"null":return(0,ar._)`${e} ${i} null`;case"array":o=(0,ar._)`Array.isArray(${e})`;break;case"object":o=(0,ar._)`${e} && typeof ${e} == "object" && !Array.isArray(${e})`;break;case"integer":o=s((0,ar._)`!(${e} % 1) && !isNaN(${e})`);break;case"number":o=s();break;default:return(0,ar._)`typeof ${e} ${i} ${t}`}return n===Ex.Correct?o:(0,ar.not)(o);function s(a=ar.nil){return(0,ar.and)((0,ar._)`typeof ${e} == "number"`,a,r?(0,ar._)`isFinite(${e})`:ar.nil)}}fs.checkDataType=JC;function YC(t,e,r,n){if(t.length===1)return JC(t[0],e,r,n);let i,o=(0,Xfe.toHash)(t);if(o.array&&o.object){let s=(0,ar._)`typeof ${e} != "object"`;i=o.null?s:(0,ar._)`!${e} || ${s}`,delete o.null,delete o.array,delete o.object}else i=ar.nil;o.number&&delete o.integer;for(let s in o)i=(0,ar.and)(i,JC(s,e,r,n));return i}fs.checkDataTypes=YC;var uLe={message:({schema:t})=>`must be ${t}`,params:({schema:t,schemaValue:e})=>typeof t=="string"?(0,ar._)`{type: ${t}}`:(0,ar._)`{type: ${e}}`};function QC(t){let e=lLe(t);(0,iLe.reportError)(e,uLe)}fs.reportTypeError=QC;function lLe(t){let{gen:e,data:r,schema:n}=t,i=(0,Xfe.schemaRefOrVal)(t,n,"type");return{gen:e,keyword:"type",data:r,schema:n.type,schemaCode:i,schemaValue:i,parentSchema:n,params:{},it:t}}});var nue=H(s4=>{"use strict";E();Object.defineProperty(s4,"__esModule",{value:!0});s4.assignDefaults=void 0;var fw=tr(),dLe=Dr();function hLe(t,e){let{properties:r,items:n}=t.schema;if(e==="object"&&r)for(let i in r)rue(t,i,r[i].default);else e==="array"&&Array.isArray(n)&&n.forEach((i,o)=>rue(t,o,i.default))}s4.assignDefaults=hLe;function rue(t,e,r){let{gen:n,compositeRule:i,data:o,opts:s}=t;if(r===void 0)return;let a=(0,fw._)`${o}${(0,fw.getProperty)(e)}`;if(i){(0,dLe.checkStrictMode)(t,`default is ignored for: ${a}`);return}let d=(0,fw._)`${a} === undefined`;s.useDefaults==="empty"&&(d=(0,fw._)`${d} || ${a} === null || ${a} === ""`),n.if(d,(0,fw._)`${a} = ${(0,fw.stringify)(r)}`)}});var of=H(xn=>{"use strict";E();Object.defineProperty(xn,"__esModule",{value:!0});xn.validateUnion=xn.validateArray=xn.usePattern=xn.callValidateCode=xn.schemaProperties=xn.allSchemaProperties=xn.noPropertyInData=xn.propertyInData=xn.isOwnProperty=xn.hasPropFunc=xn.reportMissingProp=xn.checkMissingProp=xn.checkReportMissingProp=void 0;var Wn=tr(),XC=Dr(),Hp=nf(),pLe=Dr();function mLe(t,e){let{gen:r,data:n,it:i}=t;r.if(tj(r,n,e,i.opts.ownProperties),()=>{t.setParams({missingProperty:(0,Wn._)`${e}`},!0),t.error()})}xn.checkReportMissingProp=mLe;function yLe({gen:t,data:e,it:{opts:r}},n,i){return(0,Wn.or)(...n.map(o=>(0,Wn.and)(tj(t,e,o,r.ownProperties),(0,Wn._)`${i} = ${o}`)))}xn.checkMissingProp=yLe;function gLe(t,e){t.setParams({missingProperty:e},!0),t.error()}xn.reportMissingProp=gLe;function iue(t){return t.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,Wn._)`Object.prototype.hasOwnProperty`})}xn.hasPropFunc=iue;function ej(t,e,r){return(0,Wn._)`${iue(t)}.call(${e}, ${r})`}xn.isOwnProperty=ej;function vLe(t,e,r,n){let i=(0,Wn._)`${e}${(0,Wn.getProperty)(r)} !== undefined`;return n?(0,Wn._)`${i} && ${ej(t,e,r)}`:i}xn.propertyInData=vLe;function tj(t,e,r,n){let i=(0,Wn._)`${e}${(0,Wn.getProperty)(r)} === undefined`;return n?(0,Wn.or)(i,(0,Wn.not)(ej(t,e,r))):i}xn.noPropertyInData=tj;function oue(t){return t?Object.keys(t).filter(e=>e!=="__proto__"):[]}xn.allSchemaProperties=oue;function bLe(t,e){return oue(e).filter(r=>!(0,XC.alwaysValidSchema)(t,e[r]))}xn.schemaProperties=bLe;function wLe({schemaCode:t,data:e,it:{gen:r,topSchemaRef:n,schemaPath:i,errorPath:o},it:s},a,d,m){let p=m?(0,Wn._)`${t}, ${e}, ${n}${i}`:e,w=[[Hp.default.instancePath,(0,Wn.strConcat)(Hp.default.instancePath,o)],[Hp.default.parentData,s.parentData],[Hp.default.parentDataProperty,s.parentDataProperty],[Hp.default.rootData,Hp.default.rootData]];s.opts.dynamicRef&&w.push([Hp.default.dynamicAnchors,Hp.default.dynamicAnchors]);let P=(0,Wn._)`${p}, ${r.object(...w)}`;return d!==Wn.nil?(0,Wn._)`${a}.call(${d}, ${P})`:(0,Wn._)`${a}(${P})`}xn.callValidateCode=wLe;var _Le=(0,Wn._)`new RegExp`;function xLe({gen:t,it:{opts:e}},r){let n=e.unicodeRegExp?"u":"",{regExp:i}=e.code,o=i(r,n);return t.scopeValue("pattern",{key:o.toString(),ref:o,code:(0,Wn._)`${i.code==="new RegExp"?_Le:(0,pLe.useFunc)(t,i)}(${r}, ${n})`})}xn.usePattern=xLe;function ELe(t){let{gen:e,data:r,keyword:n,it:i}=t,o=e.name("valid");if(i.allErrors){let a=e.let("valid",!0);return s(()=>e.assign(a,!1)),a}return e.var(o,!0),s(()=>e.break()),o;function s(a){let d=e.const("len",(0,Wn._)`${r}.length`);e.forRange("i",0,d,m=>{t.subschema({keyword:n,dataProp:m,dataPropType:XC.Type.Num},o),e.if((0,Wn.not)(o),a)})}}xn.validateArray=ELe;function SLe(t){let{gen:e,schema:r,keyword:n,it:i}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");if(r.some(d=>(0,XC.alwaysValidSchema)(i,d))&&!i.opts.unevaluated)return;let s=e.let("valid",!1),a=e.name("_valid");e.block(()=>r.forEach((d,m)=>{let p=t.subschema({keyword:n,schemaProp:m,compositeRule:!0},a);e.assign(s,(0,Wn._)`${s} || ${a}`),t.mergeValidEvaluated(p,a)||e.if((0,Wn.not)(s))})),t.result(s,()=>t.reset(),()=>t.error(!0))}xn.validateUnion=SLe});var cue=H(Tl=>{"use strict";E();Object.defineProperty(Tl,"__esModule",{value:!0});Tl.validateKeywordUsage=Tl.validSchemaType=Tl.funcKeywordCode=Tl.macroKeywordCode=void 0;var da=tr(),ky=nf(),MLe=of(),PLe=xx();function ALe(t,e){let{gen:r,keyword:n,schema:i,parentSchema:o,it:s}=t,a=e.macro.call(s.self,i,o,s),d=aue(r,n,a);s.opts.validateSchema!==!1&&s.self.validateSchema(a,!0);let m=r.name("valid");t.subschema({schema:a,schemaPath:da.nil,errSchemaPath:`${s.errSchemaPath}/${n}`,topSchemaRef:d,compositeRule:!0},m),t.pass(m,()=>t.error(!0))}Tl.macroKeywordCode=ALe;function TLe(t,e){var r;let{gen:n,keyword:i,schema:o,parentSchema:s,$data:a,it:d}=t;ILe(d,e);let m=!a&&e.compile?e.compile.call(d.self,o,s,d):e.validate,p=aue(n,i,m),w=n.let("valid");t.block$data(w,P),t.ok((r=e.valid)!==null&&r!==void 0?r:w);function P(){if(e.errors===!1)A(),e.modifying&&sue(t),B(()=>t.error());else{let I=e.async?S():M();e.modifying&&sue(t),B(()=>RLe(t,I))}}function S(){let I=n.let("ruleErrs",null);return n.try(()=>A((0,da._)`await `),C=>n.assign(w,!1).if((0,da._)`${C} instanceof ${d.ValidationError}`,()=>n.assign(I,(0,da._)`${C}.errors`),()=>n.throw(C))),I}function M(){let I=(0,da._)`${p}.errors`;return n.assign(I,null),A(da.nil),I}function A(I=e.async?(0,da._)`await `:da.nil){let C=d.opts.passContext?ky.default.this:ky.default.self,k=!("compile"in e&&!a||e.schema===!1);n.assign(w,(0,da._)`${I}${(0,MLe.callValidateCode)(t,p,C,k)}`,e.modifying)}function B(I){var C;n.if((0,da.not)((C=e.valid)!==null&&C!==void 0?C:w),I)}}Tl.funcKeywordCode=TLe;function sue(t){let{gen:e,data:r,it:n}=t;e.if(n.parentData,()=>e.assign(r,(0,da._)`${n.parentData}[${n.parentDataProperty}]`))}function RLe(t,e){let{gen:r}=t;r.if((0,da._)`Array.isArray(${e})`,()=>{r.assign(ky.default.vErrors,(0,da._)`${ky.default.vErrors} === null ? ${e} : ${ky.default.vErrors}.concat(${e})`).assign(ky.default.errors,(0,da._)`${ky.default.vErrors}.length`),(0,PLe.extendErrors)(t)},()=>t.error())}function ILe({schemaEnv:t},e){if(e.async&&!t.$async)throw new Error("async keyword in sync schema")}function aue(t,e,r){if(r===void 0)throw new Error(`keyword "${e}" failed to compile`);return t.scopeValue("keyword",typeof r=="function"?{ref:r}:{ref:r,code:(0,da.stringify)(r)})}function kLe(t,e,r=!1){return!e.length||e.some(n=>n==="array"?Array.isArray(t):n==="object"?t&&typeof t=="object"&&!Array.isArray(t):typeof t==n||r&&typeof t>"u")}Tl.validSchemaType=kLe;function OLe({schema:t,opts:e,self:r,errSchemaPath:n},i,o){if(Array.isArray(i.keyword)?!i.keyword.includes(o):i.keyword!==o)throw new Error("ajv implementation error");let s=i.dependencies;if(s?.some(a=>!Object.prototype.hasOwnProperty.call(t,a)))throw new Error(`parent schema must have dependencies of ${o}: ${s.join(",")}`);if(i.validateSchema&&!i.validateSchema(t[o])){let d=`keyword "${o}" value is invalid at path "${n}": `+r.errorsText(i.validateSchema.errors);if(e.validateSchema==="log")r.logger.error(d);else throw new Error(d)}}Tl.validateKeywordUsage=OLe});var uue=H(Zp=>{"use strict";E();Object.defineProperty(Zp,"__esModule",{value:!0});Zp.extendSubschemaMode=Zp.extendSubschemaData=Zp.getSubschema=void 0;var Rl=tr(),fue=Dr();function BLe(t,{keyword:e,schemaProp:r,schema:n,schemaPath:i,errSchemaPath:o,topSchemaRef:s}){if(e!==void 0&&n!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(e!==void 0){let a=t.schema[e];return r===void 0?{schema:a,schemaPath:(0,Rl._)`${t.schemaPath}${(0,Rl.getProperty)(e)}`,errSchemaPath:`${t.errSchemaPath}/${e}`}:{schema:a[r],schemaPath:(0,Rl._)`${t.schemaPath}${(0,Rl.getProperty)(e)}${(0,Rl.getProperty)(r)}`,errSchemaPath:`${t.errSchemaPath}/${e}/${(0,fue.escapeFragment)(r)}`}}if(n!==void 0){if(i===void 0||o===void 0||s===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:n,schemaPath:i,topSchemaRef:s,errSchemaPath:o}}throw new Error('either "keyword" or "schema" must be passed')}Zp.getSubschema=BLe;function DLe(t,e,{dataProp:r,dataPropType:n,data:i,dataTypes:o,propertyName:s}){if(i!==void 0&&r!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');let{gen:a}=e;if(r!==void 0){let{errorPath:m,dataPathArr:p,opts:w}=e,P=a.let("data",(0,Rl._)`${e.data}${(0,Rl.getProperty)(r)}`,!0);d(P),t.errorPath=(0,Rl.str)`${m}${(0,fue.getErrorPath)(r,n,w.jsPropertySyntax)}`,t.parentDataProperty=(0,Rl._)`${r}`,t.dataPathArr=[...p,t.parentDataProperty]}if(i!==void 0){let m=i instanceof Rl.Name?i:a.let("data",i,!0);d(m),s!==void 0&&(t.propertyName=s)}o&&(t.dataTypes=o);function d(m){t.data=m,t.dataLevel=e.dataLevel+1,t.dataTypes=[],e.definedProperties=new Set,t.parentData=e.data,t.dataNames=[...e.dataNames,m]}}Zp.extendSubschemaData=DLe;function CLe(t,{jtdDiscriminator:e,jtdMetadata:r,compositeRule:n,createErrors:i,allErrors:o}){n!==void 0&&(t.compositeRule=n),i!==void 0&&(t.createErrors=i),o!==void 0&&(t.allErrors=o),t.jtdDiscriminator=e,t.jtdMetadata=r}Zp.extendSubschemaMode=CLe});var rj=H((e3t,lue)=>{"use strict";E();lue.exports=function t(e,r){if(e===r)return!0;if(e&&r&&typeof e=="object"&&typeof r=="object"){if(e.constructor!==r.constructor)return!1;var n,i,o;if(Array.isArray(e)){if(n=e.length,n!=r.length)return!1;for(i=n;i--!==0;)if(!t(e[i],r[i]))return!1;return!0}if(e.constructor===RegExp)return e.source===r.source&&e.flags===r.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===r.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===r.toString();if(o=Object.keys(e),n=o.length,n!==Object.keys(r).length)return!1;for(i=n;i--!==0;)if(!Object.prototype.hasOwnProperty.call(r,o[i]))return!1;for(i=n;i--!==0;){var s=o[i];if(!t(e[s],r[s]))return!1}return!0}return e!==e&&r!==r}});var hue=H((r3t,due)=>{"use strict";E();var Jp=due.exports=function(t,e,r){typeof e=="function"&&(r=e,e={}),r=e.cb||r;var n=typeof r=="function"?r:r.pre||function(){},i=r.post||function(){};a4(e,n,i,t,"",t)};Jp.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};Jp.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};Jp.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};Jp.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};function a4(t,e,r,n,i,o,s,a,d,m){if(n&&typeof n=="object"&&!Array.isArray(n)){e(n,i,o,s,a,d,m);for(var p in n){var w=n[p];if(Array.isArray(w)){if(p in Jp.arrayKeywords)for(var P=0;P<w.length;P++)a4(t,e,r,w[P],i+"/"+p+"/"+P,o,i,p,n,P)}else if(p in Jp.propsKeywords){if(w&&typeof w=="object")for(var S in w)a4(t,e,r,w[S],i+"/"+p+"/"+jLe(S),o,i,p,n,S)}else(p in Jp.keywords||t.allKeys&&!(p in Jp.skipKeywords))&&a4(t,e,r,w,i+"/"+p,o,i,p,n)}r(n,i,o,s,a,d,m)}}function jLe(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}});var Mx=H(Ba=>{"use strict";E();Object.defineProperty(Ba,"__esModule",{value:!0});Ba.getSchemaRefs=Ba.resolveUrl=Ba.normalizeId=Ba._getFullPath=Ba.getFullPath=Ba.inlineRef=void 0;var NLe=Dr(),qLe=rj(),$Le=hue(),LLe=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function ULe(t,e=!0){return typeof t=="boolean"?!0:e===!0?!nj(t):e?pue(t)<=e:!1}Ba.inlineRef=ULe;var FLe=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function nj(t){for(let e in t){if(FLe.has(e))return!0;let r=t[e];if(Array.isArray(r)&&r.some(nj)||typeof r=="object"&&nj(r))return!0}return!1}function pue(t){let e=0;for(let r in t){if(r==="$ref")return 1/0;if(e++,!LLe.has(r)&&(typeof t[r]=="object"&&(0,NLe.eachItem)(t[r],n=>e+=pue(n)),e===1/0))return 1/0}return e}function mue(t,e="",r){r!==!1&&(e=uw(e));let n=t.parse(e);return yue(t,n)}Ba.getFullPath=mue;function yue(t,e){return t.serialize(e).split("#")[0]+"#"}Ba._getFullPath=yue;var zLe=/#\/?$/;function uw(t){return t?t.replace(zLe,""):""}Ba.normalizeId=uw;function KLe(t,e,r){return r=uw(r),t.resolve(e,r)}Ba.resolveUrl=KLe;var GLe=/^[a-z_][-a-z0-9._]*$/i;function WLe(t,e){if(typeof t=="boolean")return{};let{schemaId:r,uriResolver:n}=this.opts,i=uw(t[r]||e),o={"":i},s=mue(n,i,!1),a={},d=new Set;return $Le(t,{allKeys:!0},(w,P,S,M)=>{if(M===void 0)return;let A=s+P,B=o[M];typeof w[r]=="string"&&(B=I.call(this,w[r])),C.call(this,w.$anchor),C.call(this,w.$dynamicAnchor),o[P]=B;function I(k){let q=this.opts.uriResolver.resolve;if(k=uw(B?q(B,k):k),d.has(k))throw p(k);d.add(k);let L=this.refs[k];return typeof L=="string"&&(L=this.refs[L]),typeof L=="object"?m(w,L.schema,k):k!==uw(A)&&(k[0]==="#"?(m(w,a[k],k),a[k]=w):this.refs[k]=A),k}function C(k){if(typeof k=="string"){if(!GLe.test(k))throw new Error(`invalid anchor "${k}"`);I.call(this,`#${k}`)}}}),a;function m(w,P,S){if(P!==void 0&&!qLe(w,P))throw p(S)}function p(w){return new Error(`reference "${w}" resolves to more than one schema`)}}Ba.getSchemaRefs=WLe});var Tx=H(Yp=>{"use strict";E();Object.defineProperty(Yp,"__esModule",{value:!0});Yp.getData=Yp.KeywordCxt=Yp.validateFunctionCode=void 0;var _ue=Jfe(),gue=Sx(),oj=ZC(),c4=Sx(),VLe=nue(),Ax=cue(),ij=uue(),vt=tr(),Vt=nf(),HLe=Mx(),ah=Dr(),Px=xx();function ZLe(t){if(Sue(t)&&(Mue(t),Eue(t))){QLe(t);return}xue(t,()=>(0,_ue.topBoolOrEmptySchema)(t))}Yp.validateFunctionCode=ZLe;function xue({gen:t,validateName:e,schema:r,schemaEnv:n,opts:i},o){i.code.es5?t.func(e,(0,vt._)`${Vt.default.data}, ${Vt.default.valCxt}`,n.$async,()=>{t.code((0,vt._)`"use strict"; ${vue(r,i)}`),YLe(t,i),t.code(o)}):t.func(e,(0,vt._)`${Vt.default.data}, ${JLe(i)}`,n.$async,()=>t.code(vue(r,i)).code(o))}function JLe(t){return(0,vt._)`{${Vt.default.instancePath}="", ${Vt.default.parentData}, ${Vt.default.parentDataProperty}, ${Vt.default.rootData}=${Vt.default.data}${t.dynamicRef?(0,vt._)`, ${Vt.default.dynamicAnchors}={}`:vt.nil}}={}`}function YLe(t,e){t.if(Vt.default.valCxt,()=>{t.var(Vt.default.instancePath,(0,vt._)`${Vt.default.valCxt}.${Vt.default.instancePath}`),t.var(Vt.default.parentData,(0,vt._)`${Vt.default.valCxt}.${Vt.default.parentData}`),t.var(Vt.default.parentDataProperty,(0,vt._)`${Vt.default.valCxt}.${Vt.default.parentDataProperty}`),t.var(Vt.default.rootData,(0,vt._)`${Vt.default.valCxt}.${Vt.default.rootData}`),e.dynamicRef&&t.var(Vt.default.dynamicAnchors,(0,vt._)`${Vt.default.valCxt}.${Vt.default.dynamicAnchors}`)},()=>{t.var(Vt.default.instancePath,(0,vt._)`""`),t.var(Vt.default.parentData,(0,vt._)`undefined`),t.var(Vt.default.parentDataProperty,(0,vt._)`undefined`),t.var(Vt.default.rootData,Vt.default.data),e.dynamicRef&&t.var(Vt.default.dynamicAnchors,(0,vt._)`{}`)})}function QLe(t){let{schema:e,opts:r,gen:n}=t;xue(t,()=>{r.$comment&&e.$comment&&Aue(t),nUe(t),n.let(Vt.default.vErrors,null),n.let(Vt.default.errors,0),r.unevaluated&&XLe(t),Pue(t),sUe(t)})}function XLe(t){let{gen:e,validateName:r}=t;t.evaluated=e.const("evaluated",(0,vt._)`${r}.evaluated`),e.if((0,vt._)`${t.evaluated}.dynamicProps`,()=>e.assign((0,vt._)`${t.evaluated}.props`,(0,vt._)`undefined`)),e.if((0,vt._)`${t.evaluated}.dynamicItems`,()=>e.assign((0,vt._)`${t.evaluated}.items`,(0,vt._)`undefined`))}function vue(t,e){let r=typeof t=="object"&&t[e.schemaId];return r&&(e.code.source||e.code.process)?(0,vt._)`/*# sourceURL=${r} */`:vt.nil}function eUe(t,e){if(Sue(t)&&(Mue(t),Eue(t))){tUe(t,e);return}(0,_ue.boolOrEmptySchema)(t,e)}function Eue({schema:t,self:e}){if(typeof t=="boolean")return!t;for(let r in t)if(e.RULES.all[r])return!0;return!1}function Sue(t){return typeof t.schema!="boolean"}function tUe(t,e){let{schema:r,gen:n,opts:i}=t;i.$comment&&r.$comment&&Aue(t),iUe(t),oUe(t);let o=n.const("_errs",Vt.default.errors);Pue(t,o),n.var(e,(0,vt._)`${o} === ${Vt.default.errors}`)}function Mue(t){(0,ah.checkUnknownRules)(t),rUe(t)}function Pue(t,e){if(t.opts.jtd)return bue(t,[],!1,e);let r=(0,gue.getSchemaTypes)(t.schema),n=(0,gue.coerceAndCheckDataType)(t,r);bue(t,r,!n,e)}function rUe(t){let{schema:e,errSchemaPath:r,opts:n,self:i}=t;e.$ref&&n.ignoreKeywordsWithRef&&(0,ah.schemaHasRulesButRef)(e,i.RULES)&&i.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function nUe(t){let{schema:e,opts:r}=t;e.default!==void 0&&r.useDefaults&&r.strictSchema&&(0,ah.checkStrictMode)(t,"default is ignored in the schema root")}function iUe(t){let e=t.schema[t.opts.schemaId];e&&(t.baseId=(0,HLe.resolveUrl)(t.opts.uriResolver,t.baseId,e))}function oUe(t){if(t.schema.$async&&!t.schemaEnv.$async)throw new Error("async schema in sync schema")}function Aue({gen:t,schemaEnv:e,schema:r,errSchemaPath:n,opts:i}){let o=r.$comment;if(i.$comment===!0)t.code((0,vt._)`${Vt.default.self}.logger.log(${o})`);else if(typeof i.$comment=="function"){let s=(0,vt.str)`${n}/$comment`,a=t.scopeValue("root",{ref:e.root});t.code((0,vt._)`${Vt.default.self}.opts.$comment(${o}, ${s}, ${a}.schema)`)}}function sUe(t){let{gen:e,schemaEnv:r,validateName:n,ValidationError:i,opts:o}=t;r.$async?e.if((0,vt._)`${Vt.default.errors} === 0`,()=>e.return(Vt.default.data),()=>e.throw((0,vt._)`new ${i}(${Vt.default.vErrors})`)):(e.assign((0,vt._)`${n}.errors`,Vt.default.vErrors),o.unevaluated&&aUe(t),e.return((0,vt._)`${Vt.default.errors} === 0`))}function aUe({gen:t,evaluated:e,props:r,items:n}){r instanceof vt.Name&&t.assign((0,vt._)`${e}.props`,r),n instanceof vt.Name&&t.assign((0,vt._)`${e}.items`,n)}function bue(t,e,r,n){let{gen:i,schema:o,data:s,allErrors:a,opts:d,self:m}=t,{RULES:p}=m;if(o.$ref&&(d.ignoreKeywordsWithRef||!(0,ah.schemaHasRulesButRef)(o,p))){i.block(()=>Rue(t,"$ref",p.all.$ref.definition));return}d.jtd||cUe(t,e),i.block(()=>{for(let P of p.rules)w(P);w(p.post)});function w(P){(0,oj.shouldUseGroup)(o,P)&&(P.type?(i.if((0,c4.checkDataType)(P.type,s,d.strictNumbers)),wue(t,P),e.length===1&&e[0]===P.type&&r&&(i.else(),(0,c4.reportTypeError)(t)),i.endIf()):wue(t,P),a||i.if((0,vt._)`${Vt.default.errors} === ${n||0}`))}}function wue(t,e){let{gen:r,schema:n,opts:{useDefaults:i}}=t;i&&(0,VLe.assignDefaults)(t,e.type),r.block(()=>{for(let o of e.rules)(0,oj.shouldUseRule)(n,o)&&Rue(t,o.keyword,o.definition,e.type)})}function cUe(t,e){t.schemaEnv.meta||!t.opts.strictTypes||(fUe(t,e),t.opts.allowUnionTypes||uUe(t,e),lUe(t,t.dataTypes))}function fUe(t,e){if(e.length){if(!t.dataTypes.length){t.dataTypes=e;return}e.forEach(r=>{Tue(t.dataTypes,r)||sj(t,`type "${r}" not allowed by context "${t.dataTypes.join(",")}"`)}),hUe(t,e)}}function uUe(t,e){e.length>1&&!(e.length===2&&e.includes("null"))&&sj(t,"use allowUnionTypes to allow union type keyword")}function lUe(t,e){let r=t.self.RULES.all;for(let n in r){let i=r[n];if(typeof i=="object"&&(0,oj.shouldUseRule)(t.schema,i)){let{type:o}=i.definition;o.length&&!o.some(s=>dUe(e,s))&&sj(t,`missing type "${o.join(",")}" for keyword "${n}"`)}}}function dUe(t,e){return t.includes(e)||e==="number"&&t.includes("integer")}function Tue(t,e){return t.includes(e)||e==="integer"&&t.includes("number")}function hUe(t,e){let r=[];for(let n of t.dataTypes)Tue(e,n)?r.push(n):e.includes("integer")&&n==="number"&&r.push("integer");t.dataTypes=r}function sj(t,e){let r=t.schemaEnv.baseId+t.errSchemaPath;e+=` at "${r}" (strictTypes)`,(0,ah.checkStrictMode)(t,e,t.opts.strictTypes)}var f4=class{constructor(e,r,n){if((0,Ax.validateKeywordUsage)(e,r,n),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=n,this.data=e.data,this.schema=e.schema[n],this.$data=r.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,ah.schemaRefOrVal)(e,this.schema,n,this.$data),this.schemaType=r.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=r,this.$data)this.schemaCode=e.gen.const("vSchema",Iue(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,Ax.validSchemaType)(this.schema,r.schemaType,r.allowUndefined))throw new Error(`${n} value must be ${JSON.stringify(r.schemaType)}`);("code"in r?r.trackErrors:r.errors!==!1)&&(this.errsCount=e.gen.const("_errs",Vt.default.errors))}result(e,r,n){this.failResult((0,vt.not)(e),r,n)}failResult(e,r,n){this.gen.if(e),n?n():this.error(),r?(this.gen.else(),r(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(e,r){this.failResult((0,vt.not)(e),void 0,r)}fail(e){if(e===void 0){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(e),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(e){if(!this.$data)return this.fail(e);let{schemaCode:r}=this;this.fail((0,vt._)`${r} !== undefined && (${(0,vt.or)(this.invalid$data(),e)})`)}error(e,r,n){if(r){this.setParams(r),this._error(e,n),this.setParams({});return}this._error(e,n)}_error(e,r){(e?Px.reportExtraError:Px.reportError)(this,this.def.error,r)}$dataError(){(0,Px.reportError)(this,this.def.$dataError||Px.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,Px.resetErrorsCount)(this.gen,this.errsCount)}ok(e){this.allErrors||this.gen.if(e)}setParams(e,r){r?Object.assign(this.params,e):this.params=e}block$data(e,r,n=vt.nil){this.gen.block(()=>{this.check$data(e,n),r()})}check$data(e=vt.nil,r=vt.nil){if(!this.$data)return;let{gen:n,schemaCode:i,schemaType:o,def:s}=this;n.if((0,vt.or)((0,vt._)`${i} === undefined`,r)),e!==vt.nil&&n.assign(e,!0),(o.length||s.validateSchema)&&(n.elseIf(this.invalid$data()),this.$dataError(),e!==vt.nil&&n.assign(e,!1)),n.else()}invalid$data(){let{gen:e,schemaCode:r,schemaType:n,def:i,it:o}=this;return(0,vt.or)(s(),a());function s(){if(n.length){if(!(r instanceof vt.Name))throw new Error("ajv implementation error");let d=Array.isArray(n)?n:[n];return(0,vt._)`${(0,c4.checkDataTypes)(d,r,o.opts.strictNumbers,c4.DataType.Wrong)}`}return vt.nil}function a(){if(i.validateSchema){let d=e.scopeValue("validate$data",{ref:i.validateSchema});return(0,vt._)`!${d}(${r})`}return vt.nil}}subschema(e,r){let n=(0,ij.getSubschema)(this.it,e);(0,ij.extendSubschemaData)(n,this.it,e),(0,ij.extendSubschemaMode)(n,e);let i={...this.it,...n,items:void 0,props:void 0};return eUe(i,r),i}mergeEvaluated(e,r){let{it:n,gen:i}=this;n.opts.unevaluated&&(n.props!==!0&&e.props!==void 0&&(n.props=ah.mergeEvaluated.props(i,e.props,n.props,r)),n.items!==!0&&e.items!==void 0&&(n.items=ah.mergeEvaluated.items(i,e.items,n.items,r)))}mergeValidEvaluated(e,r){let{it:n,gen:i}=this;if(n.opts.unevaluated&&(n.props!==!0||n.items!==!0))return i.if(r,()=>this.mergeEvaluated(e,vt.Name)),!0}};Yp.KeywordCxt=f4;function Rue(t,e,r,n){let i=new f4(t,r,e);"code"in r?r.code(i,n):i.$data&&r.validate?(0,Ax.funcKeywordCode)(i,r):"macro"in r?(0,Ax.macroKeywordCode)(i,r):(r.compile||r.validate)&&(0,Ax.funcKeywordCode)(i,r)}var pUe=/^\/(?:[^~]|~0|~1)*$/,mUe=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function Iue(t,{dataLevel:e,dataNames:r,dataPathArr:n}){let i,o;if(t==="")return Vt.default.rootData;if(t[0]==="/"){if(!pUe.test(t))throw new Error(`Invalid JSON-pointer: ${t}`);i=t,o=Vt.default.rootData}else{let m=mUe.exec(t);if(!m)throw new Error(`Invalid JSON-pointer: ${t}`);let p=+m[1];if(i=m[2],i==="#"){if(p>=e)throw new Error(d("property/index",p));return n[e-p]}if(p>e)throw new Error(d("data",p));if(o=r[e-p],!i)return o}let s=o,a=i.split("/");for(let m of a)m&&(o=(0,vt._)`${o}${(0,vt.getProperty)((0,ah.unescapeJsonPointer)(m))}`,s=(0,vt._)`${s} && ${o}`);return s;function d(m,p){return`Cannot access ${m} ${p} levels up, current level is ${e}`}}Yp.getData=Iue});var u4=H(cj=>{"use strict";E();Object.defineProperty(cj,"__esModule",{value:!0});var aj=class extends Error{constructor(e){super("validation failed"),this.errors=e,this.ajv=this.validation=!0}};cj.default=aj});var l4=H(lj=>{"use strict";E();Object.defineProperty(lj,"__esModule",{value:!0});var fj=Mx(),uj=class extends Error{constructor(e,r,n,i){super(i||`can't resolve reference ${n} from id ${r}`),this.missingRef=(0,fj.resolveUrl)(e,r,n),this.missingSchema=(0,fj.normalizeId)((0,fj.getFullPath)(e,this.missingRef))}};lj.default=uj});var Rx=H(sf=>{"use strict";E();Object.defineProperty(sf,"__esModule",{value:!0});sf.resolveSchema=sf.getCompilingSchema=sf.resolveRef=sf.compileSchema=sf.SchemaEnv=void 0;var iu=tr(),yUe=u4(),Oy=nf(),ou=Mx(),kue=Dr(),gUe=Tx(),lw=class{constructor(e){var r;this.refs={},this.dynamicAnchors={};let n;typeof e.schema=="object"&&(n=e.schema),this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=(r=e.baseId)!==null&&r!==void 0?r:(0,ou.normalizeId)(n?.[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=n?.$async,this.refs={}}};sf.SchemaEnv=lw;function hj(t){let e=Oue.call(this,t);if(e)return e;let r=(0,ou.getFullPath)(this.opts.uriResolver,t.root.baseId),{es5:n,lines:i}=this.opts.code,{ownProperties:o}=this.opts,s=new iu.CodeGen(this.scope,{es5:n,lines:i,ownProperties:o}),a;t.$async&&(a=s.scopeValue("Error",{ref:yUe.default,code:(0,iu._)`require("ajv/dist/runtime/validation_error").default`}));let d=s.scopeName("validate");t.validateName=d;let m={gen:s,allErrors:this.opts.allErrors,data:Oy.default.data,parentData:Oy.default.parentData,parentDataProperty:Oy.default.parentDataProperty,dataNames:[Oy.default.data],dataPathArr:[iu.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:s.scopeValue("schema",this.opts.code.source===!0?{ref:t.schema,code:(0,iu.stringify)(t.schema)}:{ref:t.schema}),validateName:d,ValidationError:a,schema:t.schema,schemaEnv:t,rootId:r,baseId:t.baseId||r,schemaPath:iu.nil,errSchemaPath:t.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,iu._)`""`,opts:this.opts,self:this},p;try{this._compilations.add(t),(0,gUe.validateFunctionCode)(m),s.optimize(this.opts.code.optimize);let w=s.toString();p=`${s.scopeRefs(Oy.default.scope)}return ${w}`,this.opts.code.process&&(p=this.opts.code.process(p,t));let S=new Function(`${Oy.default.self}`,`${Oy.default.scope}`,p)(this,this.scope.get());if(this.scope.value(d,{ref:S}),S.errors=null,S.schema=t.schema,S.schemaEnv=t,t.$async&&(S.$async=!0),this.opts.code.source===!0&&(S.source={validateName:d,validateCode:w,scopeValues:s._values}),this.opts.unevaluated){let{props:M,items:A}=m;S.evaluated={props:M instanceof iu.Name?void 0:M,items:A instanceof iu.Name?void 0:A,dynamicProps:M instanceof iu.Name,dynamicItems:A instanceof iu.Name},S.source&&(S.source.evaluated=(0,iu.stringify)(S.evaluated))}return t.validate=S,t}catch(w){throw delete t.validate,delete t.validateName,p&&this.logger.error("Error compiling schema, function code:",p),w}finally{this._compilations.delete(t)}}sf.compileSchema=hj;function vUe(t,e,r){var n;r=(0,ou.resolveUrl)(this.opts.uriResolver,e,r);let i=t.refs[r];if(i)return i;let o=_Ue.call(this,t,r);if(o===void 0){let s=(n=t.localRefs)===null||n===void 0?void 0:n[r],{schemaId:a}=this.opts;s&&(o=new lw({schema:s,schemaId:a,root:t,baseId:e}))}if(o!==void 0)return t.refs[r]=bUe.call(this,o)}sf.resolveRef=vUe;function bUe(t){return(0,ou.inlineRef)(t.schema,this.opts.inlineRefs)?t.schema:t.validate?t:hj.call(this,t)}function Oue(t){for(let e of this._compilations)if(wUe(e,t))return e}sf.getCompilingSchema=Oue;function wUe(t,e){return t.schema===e.schema&&t.root===e.root&&t.baseId===e.baseId}function _Ue(t,e){let r;for(;typeof(r=this.refs[e])=="string";)e=r;return r||this.schemas[e]||d4.call(this,t,e)}function d4(t,e){let r=this.opts.uriResolver.parse(e),n=(0,ou._getFullPath)(this.opts.uriResolver,r),i=(0,ou.getFullPath)(this.opts.uriResolver,t.baseId,void 0);if(Object.keys(t.schema).length>0&&n===i)return dj.call(this,r,t);let o=(0,ou.normalizeId)(n),s=this.refs[o]||this.schemas[o];if(typeof s=="string"){let a=d4.call(this,t,s);return typeof a?.schema!="object"?void 0:dj.call(this,r,a)}if(typeof s?.schema=="object"){if(s.validate||hj.call(this,s),o===(0,ou.normalizeId)(e)){let{schema:a}=s,{schemaId:d}=this.opts,m=a[d];return m&&(i=(0,ou.resolveUrl)(this.opts.uriResolver,i,m)),new lw({schema:a,schemaId:d,root:t,baseId:i})}return dj.call(this,r,s)}}sf.resolveSchema=d4;var xUe=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function dj(t,{baseId:e,schema:r,root:n}){var i;if(((i=t.fragment)===null||i===void 0?void 0:i[0])!=="/")return;for(let a of t.fragment.slice(1).split("/")){if(typeof r=="boolean")return;let d=r[(0,kue.unescapeFragment)(a)];if(d===void 0)return;r=d;let m=typeof r=="object"&&r[this.opts.schemaId];!xUe.has(a)&&m&&(e=(0,ou.resolveUrl)(this.opts.uriResolver,e,m))}let o;if(typeof r!="boolean"&&r.$ref&&!(0,kue.schemaHasRulesButRef)(r,this.RULES)){let a=(0,ou.resolveUrl)(this.opts.uriResolver,e,r.$ref);o=d4.call(this,n,a)}let{schemaId:s}=this.opts;if(o=o||new lw({schema:r,schemaId:s,root:n,baseId:e}),o.schema!==o.root.schema)return o}});var Bue=H((p3t,EUe)=>{EUe.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}});var pj=H((h4,Due)=>{E();(function(t,e){typeof h4=="object"&&typeof Due<"u"?e(h4):typeof define=="function"&&define.amd?define(["exports"],e):e(t.URI=t.URI||{})})(h4,function(t){"use strict";function e(){for(var Q=arguments.length,Y=Array(Q),ae=0;ae<Q;ae++)Y[ae]=arguments[ae];if(Y.length>1){Y[0]=Y[0].slice(0,-1);for(var ee=Y.length-1,te=1;te<ee;++te)Y[te]=Y[te].slice(1,-1);return Y[ee]=Y[ee].slice(1),Y.join("")}else return Y[0]}function r(Q){return"(?:"+Q+")"}function n(Q){return Q===void 0?"undefined":Q===null?"null":Object.prototype.toString.call(Q).split(" ").pop().split("]").shift().toLowerCase()}function i(Q){return Q.toUpperCase()}function o(Q){return Q!=null?Q instanceof Array?Q:typeof Q.length!="number"||Q.split||Q.setInterval||Q.call?[Q]:Array.prototype.slice.call(Q):[]}function s(Q,Y){var ae=Q;if(Y)for(var ee in Y)ae[ee]=Y[ee];return ae}function a(Q){var Y="[A-Za-z]",ae="[\\x0D]",ee="[0-9]",te="[\\x22]",Ke=e(ee,"[A-Fa-f]"),de="[\\x0A]",pe="[\\x20]",bt=r(r("%[EFef]"+Ke+"%"+Ke+Ke+"%"+Ke+Ke)+"|"+r("%[89A-Fa-f]"+Ke+"%"+Ke+Ke)+"|"+r("%"+Ke+Ke)),st="[\\:\\/\\?\\#\\[\\]\\@]",Ve="[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]",Tt=e(st,Ve),Ut=Q?"[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]":"[]",Pt=Q?"[\\uE000-\\uF8FF]":"[]",yt=e(Y,ee,"[\\-\\.\\_\\~]",Ut),Rt=r(Y+e(Y,ee,"[\\+\\-\\.]")+"*"),_t=r(r(bt+"|"+e(yt,Ve,"[\\:]"))+"*"),Lr=r(r("25[0-5]")+"|"+r("2[0-4]"+ee)+"|"+r("1"+ee+ee)+"|"+r("[1-9]"+ee)+"|"+ee),nr=r(r("25[0-5]")+"|"+r("2[0-4]"+ee)+"|"+r("1"+ee+ee)+"|"+r("0?[1-9]"+ee)+"|0?0?"+ee),lr=r(nr+"\\."+nr+"\\."+nr+"\\."+nr),xt=r(Ke+"{1,4}"),ir=r(r(xt+"\\:"+xt)+"|"+lr),dr=r(r(xt+"\\:")+"{6}"+ir),Er=r("\\:\\:"+r(xt+"\\:")+"{5}"+ir),Ur=r(r(xt)+"?\\:\\:"+r(xt+"\\:")+"{4}"+ir),Rr=r(r(r(xt+"\\:")+"{0,1}"+xt)+"?\\:\\:"+r(xt+"\\:")+"{3}"+ir),Hr=r(r(r(xt+"\\:")+"{0,2}"+xt)+"?\\:\\:"+r(xt+"\\:")+"{2}"+ir),Ih=r(r(r(xt+"\\:")+"{0,3}"+xt)+"?\\:\\:"+xt+"\\:"+ir),kh=r(r(r(xt+"\\:")+"{0,4}"+xt)+"?\\:\\:"+ir),xu=r(r(r(xt+"\\:")+"{0,5}"+xt)+"?\\:\\:"+xt),bg=r(r(r(xt+"\\:")+"{0,6}"+xt)+"?\\:\\:"),Ql=r([dr,Er,Ur,Rr,Hr,Ih,kh,xu,bg].join("|")),wg=r(r(yt+"|"+bt)+"+"),OA=r(Ql+"\\%25"+wg),P0=r(Ql+r("\\%25|\\%(?!"+Ke+"{2})")+wg),xge=r("[vV]"+Ke+"+\\."+e(yt,Ve,"[\\:]")+"+"),Ege=r("\\["+r(P0+"|"+Ql+"|"+xge)+"\\]"),NL=r(r(bt+"|"+e(yt,Ve))+"*"),c1=r(Ege+"|"+lr+"(?!"+NL+")|"+NL),f1=r(ee+"*"),qL=r(r(_t+"@")+"?"+c1+r("\\:"+f1)+"?"),u1=r(bt+"|"+e(yt,Ve,"[\\:\\@]")),Sge=r(u1+"*"),$L=r(u1+"+"),Mge=r(r(bt+"|"+e(yt,Ve,"[\\@]"))+"+"),Xl=r(r("\\/"+Sge)+"*"),_g=r("\\/"+r($L+Xl)+"?"),BA=r(Mge+Xl),lE=r($L+Xl),xg="(?!"+u1+")",det=r(Xl+"|"+_g+"|"+BA+"|"+lE+"|"+xg),Eg=r(r(u1+"|"+e("[\\/\\?]",Pt))+"*"),l1=r(r(u1+"|[\\/\\?]")+"*"),LL=r(r("\\/\\/"+qL+Xl)+"|"+_g+"|"+lE+"|"+xg),Pge=r(Rt+"\\:"+LL+r("\\?"+Eg)+"?"+r("\\#"+l1)+"?"),Age=r(r("\\/\\/"+qL+Xl)+"|"+_g+"|"+BA+"|"+xg),Tge=r(Age+r("\\?"+Eg)+"?"+r("\\#"+l1)+"?"),je=r(Pge+"|"+Tge),het=r(Rt+"\\:"+LL+r("\\?"+Eg)+"?"),pet="^("+Rt+")\\:"+r(r("\\/\\/("+r("("+_t+")@")+"?("+c1+")"+r("\\:("+f1+")")+"?)")+"?("+Xl+"|"+_g+"|"+lE+"|"+xg+")")+r("\\?("+Eg+")")+"?"+r("\\#("+l1+")")+"?$",met="^(){0}"+r(r("\\/\\/("+r("("+_t+")@")+"?("+c1+")"+r("\\:("+f1+")")+"?)")+"?("+Xl+"|"+_g+"|"+BA+"|"+xg+")")+r("\\?("+Eg+")")+"?"+r("\\#("+l1+")")+"?$",yet="^("+Rt+")\\:"+r(r("\\/\\/("+r("("+_t+")@")+"?("+c1+")"+r("\\:("+f1+")")+"?)")+"?("+Xl+"|"+_g+"|"+lE+"|"+xg+")")+r("\\?("+Eg+")")+"?$",get="^"+r("\\#("+l1+")")+"?$",vet="^"+r("("+_t+")@")+"?("+c1+")"+r("\\:("+f1+")")+"?$";return{NOT_SCHEME:new RegExp(e("[^]",Y,ee,"[\\+\\-\\.]"),"g"),NOT_USERINFO:new RegExp(e("[^\\%\\:]",yt,Ve),"g"),NOT_HOST:new RegExp(e("[^\\%\\[\\]\\:]",yt,Ve),"g"),NOT_PATH:new RegExp(e("[^\\%\\/\\:\\@]",yt,Ve),"g"),NOT_PATH_NOSCHEME:new RegExp(e("[^\\%\\/\\@]",yt,Ve),"g"),NOT_QUERY:new RegExp(e("[^\\%]",yt,Ve,"[\\:\\@\\/\\?]",Pt),"g"),NOT_FRAGMENT:new RegExp(e("[^\\%]",yt,Ve,"[\\:\\@\\/\\?]"),"g"),ESCAPE:new RegExp(e("[^]",yt,Ve),"g"),UNRESERVED:new RegExp(yt,"g"),OTHER_CHARS:new RegExp(e("[^\\%]",yt,Tt),"g"),PCT_ENCODED:new RegExp(bt,"g"),IPV4ADDRESS:new RegExp("^("+lr+")$"),IPV6ADDRESS:new RegExp("^\\[?("+Ql+")"+r(r("\\%25|\\%(?!"+Ke+"{2})")+"("+wg+")")+"?\\]?$")}}var d=a(!1),m=a(!0),p=function(){function Q(Y,ae){var ee=[],te=!0,Ke=!1,de=void 0;try{for(var pe=Y[Symbol.iterator](),bt;!(te=(bt=pe.next()).done)&&(ee.push(bt.value),!(ae&&ee.length===ae));te=!0);}catch(st){Ke=!0,de=st}finally{try{!te&&pe.return&&pe.return()}finally{if(Ke)throw de}}return ee}return function(Y,ae){if(Array.isArray(Y))return Y;if(Symbol.iterator in Object(Y))return Q(Y,ae);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),w=function(Q){if(Array.isArray(Q)){for(var Y=0,ae=Array(Q.length);Y<Q.length;Y++)ae[Y]=Q[Y];return ae}else return Array.from(Q)},P=2147483647,S=36,M=1,A=26,B=38,I=700,C=72,k=128,q="-",L=/^xn--/,U=/[^\0-\x7E]/,F=/[\x2E\u3002\uFF0E\uFF61]/g,N={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},G=S-M,x=Math.floor,c=String.fromCharCode;function u(Q){throw new RangeError(N[Q])}function y(Q,Y){for(var ae=[],ee=Q.length;ee--;)ae[ee]=Y(Q[ee]);return ae}function l(Q,Y){var ae=Q.split("@"),ee="";ae.length>1&&(ee=ae[0]+"@",Q=ae[1]),Q=Q.replace(F,".");var te=Q.split("."),Ke=y(te,Y).join(".");return ee+Ke}function h(Q){for(var Y=[],ae=0,ee=Q.length;ae<ee;){var te=Q.charCodeAt(ae++);if(te>=55296&&te<=56319&&ae<ee){var Ke=Q.charCodeAt(ae++);(Ke&64512)==56320?Y.push(((te&1023)<<10)+(Ke&1023)+65536):(Y.push(te),ae--)}else Y.push(te)}return Y}var b=function(Y){return String.fromCodePoint.apply(String,w(Y))},_=function(Y){return Y-48<10?Y-22:Y-65<26?Y-65:Y-97<26?Y-97:S},g=function(Y,ae){return Y+22+75*(Y<26)-((ae!=0)<<5)},f=function(Y,ae,ee){var te=0;for(Y=ee?x(Y/I):Y>>1,Y+=x(Y/ae);Y>G*A>>1;te+=S)Y=x(Y/G);return x(te+(G+1)*Y/(Y+B))},v=function(Y){var ae=[],ee=Y.length,te=0,Ke=k,de=C,pe=Y.lastIndexOf(q);pe<0&&(pe=0);for(var bt=0;bt<pe;++bt)Y.charCodeAt(bt)>=128&&u("not-basic"),ae.push(Y.charCodeAt(bt));for(var st=pe>0?pe+1:0;st<ee;){for(var Ve=te,Tt=1,Ut=S;;Ut+=S){st>=ee&&u("invalid-input");var Pt=_(Y.charCodeAt(st++));(Pt>=S||Pt>x((P-te)/Tt))&&u("overflow"),te+=Pt*Tt;var yt=Ut<=de?M:Ut>=de+A?A:Ut-de;if(Pt<yt)break;var Rt=S-yt;Tt>x(P/Rt)&&u("overflow"),Tt*=Rt}var _t=ae.length+1;de=f(te-Ve,_t,Ve==0),x(te/_t)>P-Ke&&u("overflow"),Ke+=x(te/_t),te%=_t,ae.splice(te++,0,Ke)}return String.fromCodePoint.apply(String,ae)},O=function(Y){var ae=[];Y=h(Y);var ee=Y.length,te=k,Ke=0,de=C,pe=!0,bt=!1,st=void 0;try{for(var Ve=Y[Symbol.iterator](),Tt;!(pe=(Tt=Ve.next()).done);pe=!0){var Ut=Tt.value;Ut<128&&ae.push(c(Ut))}}catch(P0){bt=!0,st=P0}finally{try{!pe&&Ve.return&&Ve.return()}finally{if(bt)throw st}}var Pt=ae.length,yt=Pt;for(Pt&&ae.push(q);yt<ee;){var Rt=P,_t=!0,Lr=!1,nr=void 0;try{for(var lr=Y[Symbol.iterator](),xt;!(_t=(xt=lr.next()).done);_t=!0){var ir=xt.value;ir>=te&&ir<Rt&&(Rt=ir)}}catch(P0){Lr=!0,nr=P0}finally{try{!_t&&lr.return&&lr.return()}finally{if(Lr)throw nr}}var dr=yt+1;Rt-te>x((P-Ke)/dr)&&u("overflow"),Ke+=(Rt-te)*dr,te=Rt;var Er=!0,Ur=!1,Rr=void 0;try{for(var Hr=Y[Symbol.iterator](),Ih;!(Er=(Ih=Hr.next()).done);Er=!0){var kh=Ih.value;if(kh<te&&++Ke>P&&u("overflow"),kh==te){for(var xu=Ke,bg=S;;bg+=S){var Ql=bg<=de?M:bg>=de+A?A:bg-de;if(xu<Ql)break;var wg=xu-Ql,OA=S-Ql;ae.push(c(g(Ql+wg%OA,0))),xu=x(wg/OA)}ae.push(c(g(xu,0))),de=f(Ke,dr,yt==Pt),Ke=0,++yt}}}catch(P0){Ur=!0,Rr=P0}finally{try{!Er&&Hr.return&&Hr.return()}finally{if(Ur)throw Rr}}++Ke,++te}return ae.join("")},T=function(Y){return l(Y,function(ae){return L.test(ae)?v(ae.slice(4).toLowerCase()):ae})},R=function(Y){return l(Y,function(ae){return U.test(ae)?"xn--"+O(ae):ae})},z={version:"2.1.0",ucs2:{decode:h,encode:b},decode:v,encode:O,toASCII:R,toUnicode:T},V={};function W(Q){var Y=Q.charCodeAt(0),ae=void 0;return Y<16?ae="%0"+Y.toString(16).toUpperCase():Y<128?ae="%"+Y.toString(16).toUpperCase():Y<2048?ae="%"+(Y>>6|192).toString(16).toUpperCase()+"%"+(Y&63|128).toString(16).toUpperCase():ae="%"+(Y>>12|224).toString(16).toUpperCase()+"%"+(Y>>6&63|128).toString(16).toUpperCase()+"%"+(Y&63|128).toString(16).toUpperCase(),ae}function Z(Q){for(var Y="",ae=0,ee=Q.length;ae<ee;){var te=parseInt(Q.substr(ae+1,2),16);if(te<128)Y+=String.fromCharCode(te),ae+=3;else if(te>=194&&te<224){if(ee-ae>=6){var Ke=parseInt(Q.substr(ae+4,2),16);Y+=String.fromCharCode((te&31)<<6|Ke&63)}else Y+=Q.substr(ae,6);ae+=6}else if(te>=224){if(ee-ae>=9){var de=parseInt(Q.substr(ae+4,2),16),pe=parseInt(Q.substr(ae+7,2),16);Y+=String.fromCharCode((te&15)<<12|(de&63)<<6|pe&63)}else Y+=Q.substr(ae,9);ae+=9}else Y+=Q.substr(ae,3),ae+=3}return Y}function J(Q,Y){function ae(ee){var te=Z(ee);return te.match(Y.UNRESERVED)?te:ee}return Q.scheme&&(Q.scheme=String(Q.scheme).replace(Y.PCT_ENCODED,ae).toLowerCase().replace(Y.NOT_SCHEME,"")),Q.userinfo!==void 0&&(Q.userinfo=String(Q.userinfo).replace(Y.PCT_ENCODED,ae).replace(Y.NOT_USERINFO,W).replace(Y.PCT_ENCODED,i)),Q.host!==void 0&&(Q.host=String(Q.host).replace(Y.PCT_ENCODED,ae).toLowerCase().replace(Y.NOT_HOST,W).replace(Y.PCT_ENCODED,i)),Q.path!==void 0&&(Q.path=String(Q.path).replace(Y.PCT_ENCODED,ae).replace(Q.scheme?Y.NOT_PATH:Y.NOT_PATH_NOSCHEME,W).replace(Y.PCT_ENCODED,i)),Q.query!==void 0&&(Q.query=String(Q.query).replace(Y.PCT_ENCODED,ae).replace(Y.NOT_QUERY,W).replace(Y.PCT_ENCODED,i)),Q.fragment!==void 0&&(Q.fragment=String(Q.fragment).replace(Y.PCT_ENCODED,ae).replace(Y.NOT_FRAGMENT,W).replace(Y.PCT_ENCODED,i)),Q}function X(Q){return Q.replace(/^0*(.*)/,"$1")||"0"}function Ee(Q,Y){var ae=Q.match(Y.IPV4ADDRESS)||[],ee=p(ae,2),te=ee[1];return te?te.split(".").map(X).join("."):Q}function re(Q,Y){var ae=Q.match(Y.IPV6ADDRESS)||[],ee=p(ae,3),te=ee[1],Ke=ee[2];if(te){for(var de=te.toLowerCase().split("::").reverse(),pe=p(de,2),bt=pe[0],st=pe[1],Ve=st?st.split(":").map(X):[],Tt=bt.split(":").map(X),Ut=Y.IPV4ADDRESS.test(Tt[Tt.length-1]),Pt=Ut?7:8,yt=Tt.length-Pt,Rt=Array(Pt),_t=0;_t<Pt;++_t)Rt[_t]=Ve[_t]||Tt[yt+_t]||"";Ut&&(Rt[Pt-1]=Ee(Rt[Pt-1],Y));var Lr=Rt.reduce(function(dr,Er,Ur){if(!Er||Er==="0"){var Rr=dr[dr.length-1];Rr&&Rr.index+Rr.length===Ur?Rr.length++:dr.push({index:Ur,length:1})}return dr},[]),nr=Lr.sort(function(dr,Er){return Er.length-dr.length})[0],lr=void 0;if(nr&&nr.length>1){var xt=Rt.slice(0,nr.index),ir=Rt.slice(nr.index+nr.length);lr=xt.join(":")+"::"+ir.join(":")}else lr=Rt.join(":");return Ke&&(lr+="%"+Ke),lr}else return Q}var ne=/^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i,qe="".match(/(){0}/)[1]===void 0;function ce(Q){var Y=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},ae={},ee=Y.iri!==!1?m:d;Y.reference==="suffix"&&(Q=(Y.scheme?Y.scheme+":":"")+"//"+Q);var te=Q.match(ne);if(te){qe?(ae.scheme=te[1],ae.userinfo=te[3],ae.host=te[4],ae.port=parseInt(te[5],10),ae.path=te[6]||"",ae.query=te[7],ae.fragment=te[8],isNaN(ae.port)&&(ae.port=te[5])):(ae.scheme=te[1]||void 0,ae.userinfo=Q.indexOf("@")!==-1?te[3]:void 0,ae.host=Q.indexOf("//")!==-1?te[4]:void 0,ae.port=parseInt(te[5],10),ae.path=te[6]||"",ae.query=Q.indexOf("?")!==-1?te[7]:void 0,ae.fragment=Q.indexOf("#")!==-1?te[8]:void 0,isNaN(ae.port)&&(ae.port=Q.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/)?te[4]:void 0)),ae.host&&(ae.host=re(Ee(ae.host,ee),ee)),ae.scheme===void 0&&ae.userinfo===void 0&&ae.host===void 0&&ae.port===void 0&&!ae.path&&ae.query===void 0?ae.reference="same-document":ae.scheme===void 0?ae.reference="relative":ae.fragment===void 0?ae.reference="absolute":ae.reference="uri",Y.reference&&Y.reference!=="suffix"&&Y.reference!==ae.reference&&(ae.error=ae.error||"URI is not a "+Y.reference+" reference.");var Ke=V[(Y.scheme||ae.scheme||"").toLowerCase()];if(!Y.unicodeSupport&&(!Ke||!Ke.unicodeSupport)){if(ae.host&&(Y.domainHost||Ke&&Ke.domainHost))try{ae.host=z.toASCII(ae.host.replace(ee.PCT_ENCODED,Z).toLowerCase())}catch(de){ae.error=ae.error||"Host's domain name can not be converted to ASCII via punycode: "+de}J(ae,d)}else J(ae,ee);Ke&&Ke.parse&&Ke.parse(ae,Y)}else ae.error=ae.error||"URI can not be parsed.";return ae}function ye(Q,Y){var ae=Y.iri!==!1?m:d,ee=[];return Q.userinfo!==void 0&&(ee.push(Q.userinfo),ee.push("@")),Q.host!==void 0&&ee.push(re(Ee(String(Q.host),ae),ae).replace(ae.IPV6ADDRESS,function(te,Ke,de){return"["+Ke+(de?"%25"+de:"")+"]"})),(typeof Q.port=="number"||typeof Q.port=="string")&&(ee.push(":"),ee.push(String(Q.port))),ee.length?ee.join(""):void 0}var Ne=/^\.\.?\//,ie=/^\/\.(\/|$)/,oe=/^\/\.\.(\/|$)/,ze=/^\/?(?:.|\n)*?(?=\/|$)/;function le(Q){for(var Y=[];Q.length;)if(Q.match(Ne))Q=Q.replace(Ne,"");else if(Q.match(ie))Q=Q.replace(ie,"/");else if(Q.match(oe))Q=Q.replace(oe,"/"),Y.pop();else if(Q==="."||Q==="..")Q="";else{var ae=Q.match(ze);if(ae){var ee=ae[0];Q=Q.slice(ee.length),Y.push(ee)}else throw new Error("Unexpected dot segment condition")}return Y.join("")}function me(Q){var Y=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},ae=Y.iri?m:d,ee=[],te=V[(Y.scheme||Q.scheme||"").toLowerCase()];if(te&&te.serialize&&te.serialize(Q,Y),Q.host&&!ae.IPV6ADDRESS.test(Q.host)){if(Y.domainHost||te&&te.domainHost)try{Q.host=Y.iri?z.toUnicode(Q.host):z.toASCII(Q.host.replace(ae.PCT_ENCODED,Z).toLowerCase())}catch(pe){Q.error=Q.error||"Host's domain name can not be converted to "+(Y.iri?"Unicode":"ASCII")+" via punycode: "+pe}}J(Q,ae),Y.reference!=="suffix"&&Q.scheme&&(ee.push(Q.scheme),ee.push(":"));var Ke=ye(Q,Y);if(Ke!==void 0&&(Y.reference!=="suffix"&&ee.push("//"),ee.push(Ke),Q.path&&Q.path.charAt(0)!=="/"&&ee.push("/")),Q.path!==void 0){var de=Q.path;!Y.absolutePath&&(!te||!te.absolutePath)&&(de=le(de)),Ke===void 0&&(de=de.replace(/^\/\//,"/%2F")),ee.push(de)}return Q.query!==void 0&&(ee.push("?"),ee.push(Q.query)),Q.fragment!==void 0&&(ee.push("#"),ee.push(Q.fragment)),ee.join("")}function ot(Q,Y){var ae=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},ee=arguments[3],te={};return ee||(Q=ce(me(Q,ae),ae),Y=ce(me(Y,ae),ae)),ae=ae||{},!ae.tolerant&&Y.scheme?(te.scheme=Y.scheme,te.userinfo=Y.userinfo,te.host=Y.host,te.port=Y.port,te.path=le(Y.path||""),te.query=Y.query):(Y.userinfo!==void 0||Y.host!==void 0||Y.port!==void 0?(te.userinfo=Y.userinfo,te.host=Y.host,te.port=Y.port,te.path=le(Y.path||""),te.query=Y.query):(Y.path?(Y.path.charAt(0)==="/"?te.path=le(Y.path):((Q.userinfo!==void 0||Q.host!==void 0||Q.port!==void 0)&&!Q.path?te.path="/"+Y.path:Q.path?te.path=Q.path.slice(0,Q.path.lastIndexOf("/")+1)+Y.path:te.path=Y.path,te.path=le(te.path)),te.query=Y.query):(te.path=Q.path,Y.query!==void 0?te.query=Y.query:te.query=Q.query),te.userinfo=Q.userinfo,te.host=Q.host,te.port=Q.port),te.scheme=Q.scheme),te.fragment=Y.fragment,te}function ue(Q,Y,ae){var ee=s({scheme:"null"},ae);return me(ot(ce(Q,ee),ce(Y,ee),ee,!0),ee)}function he(Q,Y){return typeof Q=="string"?Q=me(ce(Q,Y),Y):n(Q)==="object"&&(Q=ce(me(Q,Y),Y)),Q}function lt(Q,Y,ae){return typeof Q=="string"?Q=me(ce(Q,ae),ae):n(Q)==="object"&&(Q=me(Q,ae)),typeof Y=="string"?Y=me(ce(Y,ae),ae):n(Y)==="object"&&(Y=me(Y,ae)),Q===Y}function se(Q,Y){return Q&&Q.toString().replace(!Y||!Y.iri?d.ESCAPE:m.ESCAPE,W)}function fe(Q,Y){return Q&&Q.toString().replace(!Y||!Y.iri?d.PCT_ENCODED:m.PCT_ENCODED,Z)}var Lt={scheme:"http",domainHost:!0,parse:function(Y,ae){return Y.host||(Y.error=Y.error||"HTTP URIs must have a host."),Y},serialize:function(Y,ae){var ee=String(Y.scheme).toLowerCase()==="https";return(Y.port===(ee?443:80)||Y.port==="")&&(Y.port=void 0),Y.path||(Y.path="/"),Y}},ge={scheme:"https",domainHost:Lt.domainHost,parse:Lt.parse,serialize:Lt.serialize};function ve(Q){return typeof Q.secure=="boolean"?Q.secure:String(Q.scheme).toLowerCase()==="wss"}var on={scheme:"ws",domainHost:!0,parse:function(Y,ae){var ee=Y;return ee.secure=ve(ee),ee.resourceName=(ee.path||"/")+(ee.query?"?"+ee.query:""),ee.path=void 0,ee.query=void 0,ee},serialize:function(Y,ae){if((Y.port===(ve(Y)?443:80)||Y.port==="")&&(Y.port=void 0),typeof Y.secure=="boolean"&&(Y.scheme=Y.secure?"wss":"ws",Y.secure=void 0),Y.resourceName){var ee=Y.resourceName.split("?"),te=p(ee,2),Ke=te[0],de=te[1];Y.path=Ke&&Ke!=="/"?Ke:void 0,Y.query=de,Y.resourceName=void 0}return Y.fragment=void 0,Y}},xe={scheme:"wss",domainHost:on.domainHost,parse:on.parse,serialize:on.serialize},Pe={},jr=!0,Se="[A-Za-z0-9\\-\\.\\_\\~"+(jr?"\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF":"")+"]",_e="[0-9A-Fa-f]",Mn=r(r("%[EFef]"+_e+"%"+_e+_e+"%"+_e+_e)+"|"+r("%[89A-Fa-f]"+_e+"%"+_e+_e)+"|"+r("%"+_e+_e)),Me="[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]",Te="[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]",vi=e(Te,'[\\"\\\\]'),Ae="[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]",Be=new RegExp(Se,"g"),Pn=new RegExp(Mn,"g"),De=new RegExp(e("[^]",Me,"[\\.]",'[\\"]',vi),"g"),Ie=new RegExp(e("[^]",Se,Ae),"g"),bi=Ie;function Re(Q){var Y=Z(Q);return Y.match(Be)?Y:Q}var ke={scheme:"mailto",parse:function(Y,ae){var ee=Y,te=ee.to=ee.path?ee.path.split(","):[];if(ee.path=void 0,ee.query){for(var Ke=!1,de={},pe=ee.query.split("&"),bt=0,st=pe.length;bt<st;++bt){var Ve=pe[bt].split("=");switch(Ve[0]){case"to":for(var Tt=Ve[1].split(","),Ut=0,Pt=Tt.length;Ut<Pt;++Ut)te.push(Tt[Ut]);break;case"subject":ee.subject=fe(Ve[1],ae);break;case"body":ee.body=fe(Ve[1],ae);break;default:Ke=!0,de[fe(Ve[0],ae)]=fe(Ve[1],ae);break}}Ke&&(ee.headers=de)}ee.query=void 0;for(var yt=0,Rt=te.length;yt<Rt;++yt){var _t=te[yt].split("@");if(_t[0]=fe(_t[0]),ae.unicodeSupport)_t[1]=fe(_t[1],ae).toLowerCase();else try{_t[1]=z.toASCII(fe(_t[1],ae).toLowerCase())}catch(Lr){ee.error=ee.error||"Email address's domain name can not be converted to ASCII via punycode: "+Lr}te[yt]=_t.join("@")}return ee},serialize:function(Y,ae){var ee=Y,te=o(Y.to);if(te){for(var Ke=0,de=te.length;Ke<de;++Ke){var pe=String(te[Ke]),bt=pe.lastIndexOf("@"),st=pe.slice(0,bt).replace(Pn,Re).replace(Pn,i).replace(De,W),Ve=pe.slice(bt+1);try{Ve=ae.iri?z.toUnicode(Ve):z.toASCII(fe(Ve,ae).toLowerCase())}catch(yt){ee.error=ee.error||"Email address's domain name can not be converted to "+(ae.iri?"Unicode":"ASCII")+" via punycode: "+yt}te[Ke]=st+"@"+Ve}ee.path=te.join(",")}var Tt=Y.headers=Y.headers||{};Y.subject&&(Tt.subject=Y.subject),Y.body&&(Tt.body=Y.body);var Ut=[];for(var Pt in Tt)Tt[Pt]!==Pe[Pt]&&Ut.push(Pt.replace(Pn,Re).replace(Pn,i).replace(Ie,W)+"="+Tt[Pt].replace(Pn,Re).replace(Pn,i).replace(bi,W));return Ut.length&&(ee.query=Ut.join("&")),ee}},wi=/^([^\:]+)\:(.*)/,Oe={scheme:"urn",parse:function(Y,ae){var ee=Y.path&&Y.path.match(wi),te=Y;if(ee){var Ke=ae.scheme||te.scheme||"urn",de=ee[1].toLowerCase(),pe=ee[2],bt=Ke+":"+(ae.nid||de),st=V[bt];te.nid=de,te.nss=pe,te.path=void 0,st&&(te=st.parse(te,ae))}else te.error=te.error||"URN can not be parsed.";return te},serialize:function(Y,ae){var ee=ae.scheme||Y.scheme||"urn",te=Y.nid,Ke=ee+":"+(ae.nid||te),de=V[Ke];de&&(Y=de.serialize(Y,ae));var pe=Y,bt=Y.nss;return pe.path=(te||ae.nid)+":"+bt,pe}},Ce=/^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/,oi={scheme:"urn:uuid",parse:function(Y,ae){var ee=Y;return ee.uuid=ee.nss,ee.nss=void 0,!ae.tolerant&&(!ee.uuid||!ee.uuid.match(Ce))&&(ee.error=ee.error||"UUID is not valid."),ee},serialize:function(Y,ae){var ee=Y;return ee.nss=(Y.uuid||"").toLowerCase(),ee}};V[Lt.scheme]=Lt,V[ge.scheme]=ge,V[on.scheme]=on,V[xe.scheme]=xe,V[ke.scheme]=ke,V[Oe.scheme]=Oe,V[oi.scheme]=oi,t.SCHEMES=V,t.pctEncChar=W,t.pctDecChars=Z,t.parse=ce,t.removeDotSegments=le,t.serialize=me,t.resolveComponents=ot,t.resolve=ue,t.normalize=he,t.equal=lt,t.escapeComponent=se,t.unescapeComponent=fe,Object.defineProperty(t,"__esModule",{value:!0})})});var jue=H(mj=>{"use strict";E();Object.defineProperty(mj,"__esModule",{value:!0});var Cue=pj();Cue.code='require("ajv/dist/runtime/uri").default';mj.default=Cue});var Kue=H(us=>{"use strict";E();Object.defineProperty(us,"__esModule",{value:!0});us.CodeGen=us.Name=us.nil=us.stringify=us.str=us._=us.KeywordCxt=void 0;var SUe=Tx();Object.defineProperty(us,"KeywordCxt",{enumerable:!0,get:function(){return SUe.KeywordCxt}});var dw=tr();Object.defineProperty(us,"_",{enumerable:!0,get:function(){return dw._}});Object.defineProperty(us,"str",{enumerable:!0,get:function(){return dw.str}});Object.defineProperty(us,"stringify",{enumerable:!0,get:function(){return dw.stringify}});Object.defineProperty(us,"nil",{enumerable:!0,get:function(){return dw.nil}});Object.defineProperty(us,"Name",{enumerable:!0,get:function(){return dw.Name}});Object.defineProperty(us,"CodeGen",{enumerable:!0,get:function(){return dw.CodeGen}});var MUe=u4(),Uue=l4(),PUe=HC(),Ix=Rx(),AUe=tr(),kx=Mx(),p4=Sx(),gj=Dr(),Nue=Bue(),TUe=jue(),Fue=(t,e)=>new RegExp(t,e);Fue.code="new RegExp";var RUe=["removeAdditional","useDefaults","coerceTypes"],IUe=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),kUe={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."},OUe={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},que=200;function BUe(t){var e,r,n,i,o,s,a,d,m,p,w,P,S,M,A,B,I,C,k,q,L,U,F,N,G;let x=t.strict,c=(e=t.code)===null||e===void 0?void 0:e.optimize,u=c===!0||c===void 0?1:c||0,y=(n=(r=t.code)===null||r===void 0?void 0:r.regExp)!==null&&n!==void 0?n:Fue,l=(i=t.uriResolver)!==null&&i!==void 0?i:TUe.default;return{strictSchema:(s=(o=t.strictSchema)!==null&&o!==void 0?o:x)!==null&&s!==void 0?s:!0,strictNumbers:(d=(a=t.strictNumbers)!==null&&a!==void 0?a:x)!==null&&d!==void 0?d:!0,strictTypes:(p=(m=t.strictTypes)!==null&&m!==void 0?m:x)!==null&&p!==void 0?p:"log",strictTuples:(P=(w=t.strictTuples)!==null&&w!==void 0?w:x)!==null&&P!==void 0?P:"log",strictRequired:(M=(S=t.strictRequired)!==null&&S!==void 0?S:x)!==null&&M!==void 0?M:!1,code:t.code?{...t.code,optimize:u,regExp:y}:{optimize:u,regExp:y},loopRequired:(A=t.loopRequired)!==null&&A!==void 0?A:que,loopEnum:(B=t.loopEnum)!==null&&B!==void 0?B:que,meta:(I=t.meta)!==null&&I!==void 0?I:!0,messages:(C=t.messages)!==null&&C!==void 0?C:!0,inlineRefs:(k=t.inlineRefs)!==null&&k!==void 0?k:!0,schemaId:(q=t.schemaId)!==null&&q!==void 0?q:"$id",addUsedSchema:(L=t.addUsedSchema)!==null&&L!==void 0?L:!0,validateSchema:(U=t.validateSchema)!==null&&U!==void 0?U:!0,validateFormats:(F=t.validateFormats)!==null&&F!==void 0?F:!0,unicodeRegExp:(N=t.unicodeRegExp)!==null&&N!==void 0?N:!0,int32range:(G=t.int32range)!==null&&G!==void 0?G:!0,uriResolver:l}}var Ox=class{constructor(e={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...BUe(e)};let{es5:r,lines:n}=this.opts.code;this.scope=new AUe.ValueScope({scope:{},prefixes:IUe,es5:r,lines:n}),this.logger=$Ue(e.logger);let i=e.validateFormats;e.validateFormats=!1,this.RULES=(0,PUe.getRules)(),$ue.call(this,kUe,e,"NOT SUPPORTED"),$ue.call(this,OUe,e,"DEPRECATED","warn"),this._metaOpts=NUe.call(this),e.formats&&CUe.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords&&jUe.call(this,e.keywords),typeof e.meta=="object"&&this.addMetaSchema(e.meta),DUe.call(this),e.validateFormats=i}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:e,meta:r,schemaId:n}=this.opts,i=Nue;n==="id"&&(i={...Nue},i.id=i.$id,delete i.$id),r&&e&&this.addMetaSchema(i,i[n],!1)}defaultMeta(){let{meta:e,schemaId:r}=this.opts;return this.opts.defaultMeta=typeof e=="object"?e[r]||e:void 0}validate(e,r){let n;if(typeof e=="string"){if(n=this.getSchema(e),!n)throw new Error(`no schema with key or ref "${e}"`)}else n=this.compile(e);let i=n(r);return"$async"in n||(this.errors=n.errors),i}compile(e,r){let n=this._addSchema(e,r);return n.validate||this._compileSchemaEnv(n)}compileAsync(e,r){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");let{loadSchema:n}=this.opts;return i.call(this,e,r);async function i(p,w){await o.call(this,p.$schema);let P=this._addSchema(p,w);return P.validate||s.call(this,P)}async function o(p){p&&!this.getSchema(p)&&await i.call(this,{$ref:p},!0)}async function s(p){try{return this._compileSchemaEnv(p)}catch(w){if(!(w instanceof Uue.default))throw w;return a.call(this,w),await d.call(this,w.missingSchema),s.call(this,p)}}function a({missingSchema:p,missingRef:w}){if(this.refs[p])throw new Error(`AnySchema ${p} is loaded but ${w} cannot be resolved`)}async function d(p){let w=await m.call(this,p);this.refs[p]||await o.call(this,w.$schema),this.refs[p]||this.addSchema(w,p,r)}async function m(p){let w=this._loading[p];if(w)return w;try{return await(this._loading[p]=n(p))}finally{delete this._loading[p]}}}addSchema(e,r,n,i=this.opts.validateSchema){if(Array.isArray(e)){for(let s of e)this.addSchema(s,void 0,n,i);return this}let o;if(typeof e=="object"){let{schemaId:s}=this.opts;if(o=e[s],o!==void 0&&typeof o!="string")throw new Error(`schema ${s} must be string`)}return r=(0,kx.normalizeId)(r||o),this._checkUnique(r),this.schemas[r]=this._addSchema(e,n,r,i,!0),this}addMetaSchema(e,r,n=this.opts.validateSchema){return this.addSchema(e,r,!0,n),this}validateSchema(e,r){if(typeof e=="boolean")return!0;let n;if(n=e.$schema,n!==void 0&&typeof n!="string")throw new Error("$schema must be a string");if(n=n||this.opts.defaultMeta||this.defaultMeta(),!n)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let i=this.validate(n,e);if(!i&&r){let o="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(o);else throw new Error(o)}return i}getSchema(e){let r;for(;typeof(r=Lue.call(this,e))=="string";)e=r;if(r===void 0){let{schemaId:n}=this.opts,i=new Ix.SchemaEnv({schema:{},schemaId:n});if(r=Ix.resolveSchema.call(this,i,e),!r)return;this.refs[e]=r}return r.validate||this._compileSchemaEnv(r)}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":{let r=Lue.call(this,e);return typeof r=="object"&&this._cache.delete(r.schema),delete this.schemas[e],delete this.refs[e],this}case"object":{let r=e;this._cache.delete(r);let n=e[this.opts.schemaId];return n&&(n=(0,kx.normalizeId)(n),delete this.schemas[n],delete this.refs[n]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(e){for(let r of e)this.addKeyword(r);return this}addKeyword(e,r){let n;if(typeof e=="string")n=e,typeof r=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),r.keyword=n);else if(typeof e=="object"&&r===void 0){if(r=e,n=r.keyword,Array.isArray(n)&&!n.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(UUe.call(this,n,r),!r)return(0,gj.eachItem)(n,o=>yj.call(this,o)),this;zUe.call(this,r);let i={...r,type:(0,p4.getJSONTypes)(r.type),schemaType:(0,p4.getJSONTypes)(r.schemaType)};return(0,gj.eachItem)(n,i.type.length===0?o=>yj.call(this,o,i):o=>i.type.forEach(s=>yj.call(this,o,i,s))),this}getKeyword(e){let r=this.RULES.all[e];return typeof r=="object"?r.definition:!!r}removeKeyword(e){let{RULES:r}=this;delete r.keywords[e],delete r.all[e];for(let n of r.rules){let i=n.rules.findIndex(o=>o.keyword===e);i>=0&&n.rules.splice(i,1)}return this}addFormat(e,r){return typeof r=="string"&&(r=new RegExp(r)),this.formats[e]=r,this}errorsText(e=this.errors,{separator:r=", ",dataVar:n="data"}={}){return!e||e.length===0?"No errors":e.map(i=>`${n}${i.instancePath} ${i.message}`).reduce((i,o)=>i+r+o)}$dataMetaSchema(e,r){let n=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(let i of r){let o=i.split("/").slice(1),s=e;for(let a of o)s=s[a];for(let a in n){let d=n[a];if(typeof d!="object")continue;let{$data:m}=d.definition,p=s[a];m&&p&&(s[a]=zue(p))}}return e}_removeAllSchemas(e,r){for(let n in e){let i=e[n];(!r||r.test(n))&&(typeof i=="string"?delete e[n]:i&&!i.meta&&(this._cache.delete(i.schema),delete e[n]))}}_addSchema(e,r,n,i=this.opts.validateSchema,o=this.opts.addUsedSchema){let s,{schemaId:a}=this.opts;if(typeof e=="object")s=e[a];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof e!="boolean")throw new Error("schema must be object or boolean")}let d=this._cache.get(e);if(d!==void 0)return d;n=(0,kx.normalizeId)(s||n);let m=kx.getSchemaRefs.call(this,e,n);return d=new Ix.SchemaEnv({schema:e,schemaId:a,meta:r,baseId:n,localRefs:m}),this._cache.set(d.schema,d),o&&!n.startsWith("#")&&(n&&this._checkUnique(n),this.refs[n]=d),i&&this.validateSchema(e,!0),d}_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):Ix.compileSchema.call(this,e),!e.validate)throw new Error("ajv implementation error");return e.validate}_compileMetaSchema(e){let r=this.opts;this.opts=this._metaOpts;try{Ix.compileSchema.call(this,e)}finally{this.opts=r}}};us.default=Ox;Ox.ValidationError=MUe.default;Ox.MissingRefError=Uue.default;function $ue(t,e,r,n="error"){for(let i in t){let o=i;o in e&&this.logger[n](`${r}: option ${i}. ${t[o]}`)}}function Lue(t){return t=(0,kx.normalizeId)(t),this.schemas[t]||this.refs[t]}function DUe(){let t=this.opts.schemas;if(t)if(Array.isArray(t))this.addSchema(t);else for(let e in t)this.addSchema(t[e],e)}function CUe(){for(let t in this.opts.formats){let e=this.opts.formats[t];e&&this.addFormat(t,e)}}function jUe(t){if(Array.isArray(t)){this.addVocabulary(t);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let e in t){let r=t[e];r.keyword||(r.keyword=e),this.addKeyword(r)}}function NUe(){let t={...this.opts};for(let e of RUe)delete t[e];return t}var qUe={log(){},warn(){},error(){}};function $Ue(t){if(t===!1)return qUe;if(t===void 0)return console;if(t.log&&t.warn&&t.error)return t;throw new Error("logger must implement log, warn and error methods")}var LUe=/^[a-z_$][a-z0-9_$:-]*$/i;function UUe(t,e){let{RULES:r}=this;if((0,gj.eachItem)(t,n=>{if(r.keywords[n])throw new Error(`Keyword ${n} is already defined`);if(!LUe.test(n))throw new Error(`Keyword ${n} has invalid name`)}),!!e&&e.$data&&!("code"in e||"validate"in e))throw new Error('$data keyword must have "code" or "validate" function')}function yj(t,e,r){var n;let i=e?.post;if(r&&i)throw new Error('keyword with "post" flag cannot have "type"');let{RULES:o}=this,s=i?o.post:o.rules.find(({type:d})=>d===r);if(s||(s={type:r,rules:[]},o.rules.push(s)),o.keywords[t]=!0,!e)return;let a={keyword:t,definition:{...e,type:(0,p4.getJSONTypes)(e.type),schemaType:(0,p4.getJSONTypes)(e.schemaType)}};e.before?FUe.call(this,s,a,e.before):s.rules.push(a),o.all[t]=a,(n=e.implements)===null||n===void 0||n.forEach(d=>this.addKeyword(d))}function FUe(t,e,r){let n=t.rules.findIndex(i=>i.keyword===r);n>=0?t.rules.splice(n,0,e):(t.rules.push(e),this.logger.warn(`rule ${r} is not defined`))}function zUe(t){let{metaSchema:e}=t;e!==void 0&&(t.$data&&this.opts.$data&&(e=zue(e)),t.validateSchema=this.compile(e,!0))}var KUe={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function zue(t){return{anyOf:[t,KUe]}}});var Gue=H(vj=>{"use strict";E();Object.defineProperty(vj,"__esModule",{value:!0});var GUe={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};vj.default=GUe});var g4=H(By=>{"use strict";E();Object.defineProperty(By,"__esModule",{value:!0});By.callRef=By.getValidate=void 0;var WUe=l4(),Wue=of(),Da=tr(),hw=nf(),Vue=Rx(),m4=Dr(),VUe={keyword:"$ref",schemaType:"string",code(t){let{gen:e,schema:r,it:n}=t,{baseId:i,schemaEnv:o,validateName:s,opts:a,self:d}=n,{root:m}=o;if((r==="#"||r==="#/")&&i===m.baseId)return w();let p=Vue.resolveRef.call(d,m,i,r);if(p===void 0)throw new WUe.default(n.opts.uriResolver,i,r);if(p instanceof Vue.SchemaEnv)return P(p);return S(p);function w(){if(o===m)return y4(t,s,o,o.$async);let M=e.scopeValue("root",{ref:m});return y4(t,(0,Da._)`${M}.validate`,m,m.$async)}function P(M){let A=Hue(t,M);y4(t,A,M,M.$async)}function S(M){let A=e.scopeValue("schema",a.code.source===!0?{ref:M,code:(0,Da.stringify)(M)}:{ref:M}),B=e.name("valid"),I=t.subschema({schema:M,dataTypes:[],schemaPath:Da.nil,topSchemaRef:A,errSchemaPath:r},B);t.mergeEvaluated(I),t.ok(B)}}};function Hue(t,e){let{gen:r}=t;return e.validate?r.scopeValue("validate",{ref:e.validate}):(0,Da._)`${r.scopeValue("wrapper",{ref:e})}.validate`}By.getValidate=Hue;function y4(t,e,r,n){let{gen:i,it:o}=t,{allErrors:s,schemaEnv:a,opts:d}=o,m=d.passContext?hw.default.this:Da.nil;n?p():w();function p(){if(!a.$async)throw new Error("async schema referenced by sync schema");let M=i.let("valid");i.try(()=>{i.code((0,Da._)`await ${(0,Wue.callValidateCode)(t,e,m)}`),S(e),s||i.assign(M,!0)},A=>{i.if((0,Da._)`!(${A} instanceof ${o.ValidationError})`,()=>i.throw(A)),P(A),s||i.assign(M,!1)}),t.ok(M)}function w(){t.result((0,Wue.callValidateCode)(t,e,m),()=>S(e),()=>P(e))}function P(M){let A=(0,Da._)`${M}.errors`;i.assign(hw.default.vErrors,(0,Da._)`${hw.default.vErrors} === null ? ${A} : ${hw.default.vErrors}.concat(${A})`),i.assign(hw.default.errors,(0,Da._)`${hw.default.vErrors}.length`)}function S(M){var A;if(!o.opts.unevaluated)return;let B=(A=r?.validate)===null||A===void 0?void 0:A.evaluated;if(o.props!==!0)if(B&&!B.dynamicProps)B.props!==void 0&&(o.props=m4.mergeEvaluated.props(i,B.props,o.props));else{let I=i.var("props",(0,Da._)`${M}.evaluated.props`);o.props=m4.mergeEvaluated.props(i,I,o.props,Da.Name)}if(o.items!==!0)if(B&&!B.dynamicItems)B.items!==void 0&&(o.items=m4.mergeEvaluated.items(i,B.items,o.items));else{let I=i.var("items",(0,Da._)`${M}.evaluated.items`);o.items=m4.mergeEvaluated.items(i,I,o.items,Da.Name)}}}By.callRef=y4;By.default=VUe});var Zue=H(bj=>{"use strict";E();Object.defineProperty(bj,"__esModule",{value:!0});var HUe=Gue(),ZUe=g4(),JUe=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",HUe.default,ZUe.default];bj.default=JUe});var Jue=H(wj=>{"use strict";E();Object.defineProperty(wj,"__esModule",{value:!0});var v4=tr(),Qp=v4.operators,b4={maximum:{okStr:"<=",ok:Qp.LTE,fail:Qp.GT},minimum:{okStr:">=",ok:Qp.GTE,fail:Qp.LT},exclusiveMaximum:{okStr:"<",ok:Qp.LT,fail:Qp.GTE},exclusiveMinimum:{okStr:">",ok:Qp.GT,fail:Qp.LTE}},YUe={message:({keyword:t,schemaCode:e})=>(0,v4.str)`must be ${b4[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>(0,v4._)`{comparison: ${b4[t].okStr}, limit: ${e}}`},QUe={keyword:Object.keys(b4),type:"number",schemaType:"number",$data:!0,error:YUe,code(t){let{keyword:e,data:r,schemaCode:n}=t;t.fail$data((0,v4._)`${r} ${b4[e].fail} ${n} || isNaN(${r})`)}};wj.default=QUe});var Yue=H(_j=>{"use strict";E();Object.defineProperty(_j,"__esModule",{value:!0});var Bx=tr(),XUe={message:({schemaCode:t})=>(0,Bx.str)`must be multiple of ${t}`,params:({schemaCode:t})=>(0,Bx._)`{multipleOf: ${t}}`},eFe={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:XUe,code(t){let{gen:e,data:r,schemaCode:n,it:i}=t,o=i.opts.multipleOfPrecision,s=e.let("res"),a=o?(0,Bx._)`Math.abs(Math.round(${s}) - ${s}) > 1e-${o}`:(0,Bx._)`${s} !== parseInt(${s})`;t.fail$data((0,Bx._)`(${n} === 0 || (${s} = ${r}/${n}, ${a}))`)}};_j.default=eFe});var Xue=H(xj=>{"use strict";E();Object.defineProperty(xj,"__esModule",{value:!0});function Que(t){let e=t.length,r=0,n=0,i;for(;n<e;)r++,i=t.charCodeAt(n++),i>=55296&&i<=56319&&n<e&&(i=t.charCodeAt(n),(i&64512)===56320&&n++);return r}xj.default=Que;Que.code='require("ajv/dist/runtime/ucs2length").default'});var ele=H(Ej=>{"use strict";E();Object.defineProperty(Ej,"__esModule",{value:!0});var Dy=tr(),tFe=Dr(),rFe=Xue(),nFe={message({keyword:t,schemaCode:e}){let r=t==="maxLength"?"more":"fewer";return(0,Dy.str)`must NOT have ${r} than ${e} characters`},params:({schemaCode:t})=>(0,Dy._)`{limit: ${t}}`},iFe={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:nFe,code(t){let{keyword:e,data:r,schemaCode:n,it:i}=t,o=e==="maxLength"?Dy.operators.GT:Dy.operators.LT,s=i.opts.unicode===!1?(0,Dy._)`${r}.length`:(0,Dy._)`${(0,tFe.useFunc)(t.gen,rFe.default)}(${r})`;t.fail$data((0,Dy._)`${s} ${o} ${n}`)}};Ej.default=iFe});var tle=H(Sj=>{"use strict";E();Object.defineProperty(Sj,"__esModule",{value:!0});var oFe=of(),w4=tr(),sFe={message:({schemaCode:t})=>(0,w4.str)`must match pattern "${t}"`,params:({schemaCode:t})=>(0,w4._)`{pattern: ${t}}`},aFe={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:sFe,code(t){let{data:e,$data:r,schema:n,schemaCode:i,it:o}=t,s=o.opts.unicodeRegExp?"u":"",a=r?(0,w4._)`(new RegExp(${i}, ${s}))`:(0,oFe.usePattern)(t,n);t.fail$data((0,w4._)`!${a}.test(${e})`)}};Sj.default=aFe});var rle=H(Mj=>{"use strict";E();Object.defineProperty(Mj,"__esModule",{value:!0});var Dx=tr(),cFe={message({keyword:t,schemaCode:e}){let r=t==="maxProperties"?"more":"fewer";return(0,Dx.str)`must NOT have ${r} than ${e} properties`},params:({schemaCode:t})=>(0,Dx._)`{limit: ${t}}`},fFe={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:cFe,code(t){let{keyword:e,data:r,schemaCode:n}=t,i=e==="maxProperties"?Dx.operators.GT:Dx.operators.LT;t.fail$data((0,Dx._)`Object.keys(${r}).length ${i} ${n}`)}};Mj.default=fFe});var nle=H(Pj=>{"use strict";E();Object.defineProperty(Pj,"__esModule",{value:!0});var Cx=of(),jx=tr(),uFe=Dr(),lFe={message:({params:{missingProperty:t}})=>(0,jx.str)`must have required property '${t}'`,params:({params:{missingProperty:t}})=>(0,jx._)`{missingProperty: ${t}}`},dFe={keyword:"required",type:"object",schemaType:"array",$data:!0,error:lFe,code(t){let{gen:e,schema:r,schemaCode:n,data:i,$data:o,it:s}=t,{opts:a}=s;if(!o&&r.length===0)return;let d=r.length>=a.loopRequired;if(s.allErrors?m():p(),a.strictRequired){let S=t.parentSchema.properties,{definedProperties:M}=t.it;for(let A of r)if(S?.[A]===void 0&&!M.has(A)){let B=s.schemaEnv.baseId+s.errSchemaPath,I=`required property "${A}" is not defined at "${B}" (strictRequired)`;(0,uFe.checkStrictMode)(s,I,s.opts.strictRequired)}}function m(){if(d||o)t.block$data(jx.nil,w);else for(let S of r)(0,Cx.checkReportMissingProp)(t,S)}function p(){let S=e.let("missing");if(d||o){let M=e.let("valid",!0);t.block$data(M,()=>P(S,M)),t.ok(M)}else e.if((0,Cx.checkMissingProp)(t,r,S)),(0,Cx.reportMissingProp)(t,S),e.else()}function w(){e.forOf("prop",n,S=>{t.setParams({missingProperty:S}),e.if((0,Cx.noPropertyInData)(e,i,S,a.ownProperties),()=>t.error())})}function P(S,M){t.setParams({missingProperty:S}),e.forOf(S,n,()=>{e.assign(M,(0,Cx.propertyInData)(e,i,S,a.ownProperties)),e.if((0,jx.not)(M),()=>{t.error(),e.break()})},jx.nil)}}};Pj.default=dFe});var ile=H(Aj=>{"use strict";E();Object.defineProperty(Aj,"__esModule",{value:!0});var Nx=tr(),hFe={message({keyword:t,schemaCode:e}){let r=t==="maxItems"?"more":"fewer";return(0,Nx.str)`must NOT have ${r} than ${e} items`},params:({schemaCode:t})=>(0,Nx._)`{limit: ${t}}`},pFe={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:hFe,code(t){let{keyword:e,data:r,schemaCode:n}=t,i=e==="maxItems"?Nx.operators.GT:Nx.operators.LT;t.fail$data((0,Nx._)`${r}.length ${i} ${n}`)}};Aj.default=pFe});var _4=H(Tj=>{"use strict";E();Object.defineProperty(Tj,"__esModule",{value:!0});var ole=rj();ole.code='require("ajv/dist/runtime/equal").default';Tj.default=ole});var sle=H(Ij=>{"use strict";E();Object.defineProperty(Ij,"__esModule",{value:!0});var Rj=Sx(),ls=tr(),mFe=Dr(),yFe=_4(),gFe={message:({params:{i:t,j:e}})=>(0,ls.str)`must NOT have duplicate items (items ## ${e} and ${t} are identical)`,params:({params:{i:t,j:e}})=>(0,ls._)`{i: ${t}, j: ${e}}`},vFe={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:gFe,code(t){let{gen:e,data:r,$data:n,schema:i,parentSchema:o,schemaCode:s,it:a}=t;if(!n&&!i)return;let d=e.let("valid"),m=o.items?(0,Rj.getSchemaTypes)(o.items):[];t.block$data(d,p,(0,ls._)`${s} === false`),t.ok(d);function p(){let M=e.let("i",(0,ls._)`${r}.length`),A=e.let("j");t.setParams({i:M,j:A}),e.assign(d,!0),e.if((0,ls._)`${M} > 1`,()=>(w()?P:S)(M,A))}function w(){return m.length>0&&!m.some(M=>M==="object"||M==="array")}function P(M,A){let B=e.name("item"),I=(0,Rj.checkDataTypes)(m,B,a.opts.strictNumbers,Rj.DataType.Wrong),C=e.const("indices",(0,ls._)`{}`);e.for((0,ls._)`;${M}--;`,()=>{e.let(B,(0,ls._)`${r}[${M}]`),e.if(I,(0,ls._)`continue`),m.length>1&&e.if((0,ls._)`typeof ${B} == "string"`,(0,ls._)`${B} += "_"`),e.if((0,ls._)`typeof ${C}[${B}] == "number"`,()=>{e.assign(A,(0,ls._)`${C}[${B}]`),t.error(),e.assign(d,!1).break()}).code((0,ls._)`${C}[${B}] = ${M}`)})}function S(M,A){let B=(0,mFe.useFunc)(e,yFe.default),I=e.name("outer");e.label(I).for((0,ls._)`;${M}--;`,()=>e.for((0,ls._)`${A} = ${M}; ${A}--;`,()=>e.if((0,ls._)`${B}(${r}[${M}], ${r}[${A}])`,()=>{t.error(),e.assign(d,!1).break(I)})))}}};Ij.default=vFe});var ale=H(Oj=>{"use strict";E();Object.defineProperty(Oj,"__esModule",{value:!0});var kj=tr(),bFe=Dr(),wFe=_4(),_Fe={message:"must be equal to constant",params:({schemaCode:t})=>(0,kj._)`{allowedValue: ${t}}`},xFe={keyword:"const",$data:!0,error:_Fe,code(t){let{gen:e,data:r,$data:n,schemaCode:i,schema:o}=t;n||o&&typeof o=="object"?t.fail$data((0,kj._)`!${(0,bFe.useFunc)(e,wFe.default)}(${r}, ${i})`):t.fail((0,kj._)`${o} !== ${r}`)}};Oj.default=xFe});var cle=H(Bj=>{"use strict";E();Object.defineProperty(Bj,"__esModule",{value:!0});var qx=tr(),EFe=Dr(),SFe=_4(),MFe={message:"must be equal to one of the allowed values",params:({schemaCode:t})=>(0,qx._)`{allowedValues: ${t}}`},PFe={keyword:"enum",schemaType:"array",$data:!0,error:MFe,code(t){let{gen:e,data:r,$data:n,schema:i,schemaCode:o,it:s}=t;if(!n&&i.length===0)throw new Error("enum must have non-empty array");let a=i.length>=s.opts.loopEnum,d,m=()=>d??(d=(0,EFe.useFunc)(e,SFe.default)),p;if(a||n)p=e.let("valid"),t.block$data(p,w);else{if(!Array.isArray(i))throw new Error("ajv implementation error");let S=e.const("vSchema",o);p=(0,qx.or)(...i.map((M,A)=>P(S,A)))}t.pass(p);function w(){e.assign(p,!1),e.forOf("v",o,S=>e.if((0,qx._)`${m()}(${r}, ${S})`,()=>e.assign(p,!0).break()))}function P(S,M){let A=i[M];return typeof A=="object"&&A!==null?(0,qx._)`${m()}(${r}, ${S}[${M}])`:(0,qx._)`${r} === ${A}`}}};Bj.default=PFe});var fle=H(Dj=>{"use strict";E();Object.defineProperty(Dj,"__esModule",{value:!0});var AFe=Jue(),TFe=Yue(),RFe=ele(),IFe=tle(),kFe=rle(),OFe=nle(),BFe=ile(),DFe=sle(),CFe=ale(),jFe=cle(),NFe=[AFe.default,TFe.default,RFe.default,IFe.default,kFe.default,OFe.default,BFe.default,DFe.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},CFe.default,jFe.default];Dj.default=NFe});var jj=H($x=>{"use strict";E();Object.defineProperty($x,"__esModule",{value:!0});$x.validateAdditionalItems=void 0;var Cy=tr(),Cj=Dr(),qFe={message:({params:{len:t}})=>(0,Cy.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,Cy._)`{limit: ${t}}`},$Fe={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:qFe,code(t){let{parentSchema:e,it:r}=t,{items:n}=e;if(!Array.isArray(n)){(0,Cj.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}ule(t,n)}};function ule(t,e){let{gen:r,schema:n,data:i,keyword:o,it:s}=t;s.items=!0;let a=r.const("len",(0,Cy._)`${i}.length`);if(n===!1)t.setParams({len:e.length}),t.pass((0,Cy._)`${a} <= ${e.length}`);else if(typeof n=="object"&&!(0,Cj.alwaysValidSchema)(s,n)){let m=r.var("valid",(0,Cy._)`${a} <= ${e.length}`);r.if((0,Cy.not)(m),()=>d(m)),t.ok(m)}function d(m){r.forRange("i",e.length,a,p=>{t.subschema({keyword:o,dataProp:p,dataPropType:Cj.Type.Num},m),s.allErrors||r.if((0,Cy.not)(m),()=>r.break())})}}$x.validateAdditionalItems=ule;$x.default=$Fe});var Nj=H(Lx=>{"use strict";E();Object.defineProperty(Lx,"__esModule",{value:!0});Lx.validateTuple=void 0;var lle=tr(),x4=Dr(),LFe=of(),UFe={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(t){let{schema:e,it:r}=t;if(Array.isArray(e))return dle(t,"additionalItems",e);r.items=!0,!(0,x4.alwaysValidSchema)(r,e)&&t.ok((0,LFe.validateArray)(t))}};function dle(t,e,r=t.schema){let{gen:n,parentSchema:i,data:o,keyword:s,it:a}=t;p(i),a.opts.unevaluated&&r.length&&a.items!==!0&&(a.items=x4.mergeEvaluated.items(n,r.length,a.items));let d=n.name("valid"),m=n.const("len",(0,lle._)`${o}.length`);r.forEach((w,P)=>{(0,x4.alwaysValidSchema)(a,w)||(n.if((0,lle._)`${m} > ${P}`,()=>t.subschema({keyword:s,schemaProp:P,dataProp:P},d)),t.ok(d))});function p(w){let{opts:P,errSchemaPath:S}=a,M=r.length,A=M===w.minItems&&(M===w.maxItems||w[e]===!1);if(P.strictTuples&&!A){let B=`"${s}" is ${M}-tuple, but minItems or maxItems/${e} are not specified or different at path "${S}"`;(0,x4.checkStrictMode)(a,B,P.strictTuples)}}}Lx.validateTuple=dle;Lx.default=UFe});var hle=H(qj=>{"use strict";E();Object.defineProperty(qj,"__esModule",{value:!0});var FFe=Nj(),zFe={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:t=>(0,FFe.validateTuple)(t,"items")};qj.default=zFe});var mle=H($j=>{"use strict";E();Object.defineProperty($j,"__esModule",{value:!0});var ple=tr(),KFe=Dr(),GFe=of(),WFe=jj(),VFe={message:({params:{len:t}})=>(0,ple.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,ple._)`{limit: ${t}}`},HFe={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:VFe,code(t){let{schema:e,parentSchema:r,it:n}=t,{prefixItems:i}=r;n.items=!0,!(0,KFe.alwaysValidSchema)(n,e)&&(i?(0,WFe.validateAdditionalItems)(t,i):t.ok((0,GFe.validateArray)(t)))}};$j.default=HFe});var yle=H(Lj=>{"use strict";E();Object.defineProperty(Lj,"__esModule",{value:!0});var af=tr(),E4=Dr(),ZFe={message:({params:{min:t,max:e}})=>e===void 0?(0,af.str)`must contain at least ${t} valid item(s)`:(0,af.str)`must contain at least ${t} and no more than ${e} valid item(s)`,params:({params:{min:t,max:e}})=>e===void 0?(0,af._)`{minContains: ${t}}`:(0,af._)`{minContains: ${t}, maxContains: ${e}}`},JFe={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:ZFe,code(t){let{gen:e,schema:r,parentSchema:n,data:i,it:o}=t,s,a,{minContains:d,maxContains:m}=n;o.opts.next?(s=d===void 0?1:d,a=m):s=1;let p=e.const("len",(0,af._)`${i}.length`);if(t.setParams({min:s,max:a}),a===void 0&&s===0){(0,E4.checkStrictMode)(o,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(a!==void 0&&s>a){(0,E4.checkStrictMode)(o,'"minContains" > "maxContains" is always invalid'),t.fail();return}if((0,E4.alwaysValidSchema)(o,r)){let A=(0,af._)`${p} >= ${s}`;a!==void 0&&(A=(0,af._)`${A} && ${p} <= ${a}`),t.pass(A);return}o.items=!0;let w=e.name("valid");a===void 0&&s===1?S(w,()=>e.if(w,()=>e.break())):s===0?(e.let(w,!0),a!==void 0&&e.if((0,af._)`${i}.length > 0`,P)):(e.let(w,!1),P()),t.result(w,()=>t.reset());function P(){let A=e.name("_valid"),B=e.let("count",0);S(A,()=>e.if(A,()=>M(B)))}function S(A,B){e.forRange("i",0,p,I=>{t.subschema({keyword:"contains",dataProp:I,dataPropType:E4.Type.Num,compositeRule:!0},A),B()})}function M(A){e.code((0,af._)`${A}++`),a===void 0?e.if((0,af._)`${A} >= ${s}`,()=>e.assign(w,!0).break()):(e.if((0,af._)`${A} > ${a}`,()=>e.assign(w,!1).break()),s===1?e.assign(w,!0):e.if((0,af._)`${A} >= ${s}`,()=>e.assign(w,!0)))}}};Lj.default=JFe});var S4=H(Il=>{"use strict";E();Object.defineProperty(Il,"__esModule",{value:!0});Il.validateSchemaDeps=Il.validatePropertyDeps=Il.error=void 0;var Uj=tr(),YFe=Dr(),Ux=of();Il.error={message:({params:{property:t,depsCount:e,deps:r}})=>{let n=e===1?"property":"properties";return(0,Uj.str)`must have ${n} ${r} when property ${t} is present`},params:({params:{property:t,depsCount:e,deps:r,missingProperty:n}})=>(0,Uj._)`{property: ${t},
missingProperty: ${n},
depsCount: ${e},
deps: ${r}}`};var QFe={keyword:"dependencies",type:"object",schemaType:"object",error:Il.error,code(t){let[e,r]=XFe(t);gle(t,e),vle(t,r)}};function XFe({schema:t}){let e={},r={};for(let n in t){if(n==="__proto__")continue;let i=Array.isArray(t[n])?e:r;i[n]=t[n]}return[e,r]}function gle(t,e=t.schema){let{gen:r,data:n,it:i}=t;if(Object.keys(e).length===0)return;let o=r.let("missing");for(let s in e){let a=e[s];if(a.length===0)continue;let d=(0,Ux.propertyInData)(r,n,s,i.opts.ownProperties);t.setParams({property:s,depsCount:a.length,deps:a.join(", ")}),i.allErrors?r.if(d,()=>{for(let m of a)(0,Ux.checkReportMissingProp)(t,m)}):(r.if((0,Uj._)`${d} && (${(0,Ux.checkMissingProp)(t,a,o)})`),(0,Ux.reportMissingProp)(t,o),r.else())}}Il.validatePropertyDeps=gle;function vle(t,e=t.schema){let{gen:r,data:n,keyword:i,it:o}=t,s=r.name("valid");for(let a in e)(0,YFe.alwaysValidSchema)(o,e[a])||(r.if((0,Ux.propertyInData)(r,n,a,o.opts.ownProperties),()=>{let d=t.subschema({keyword:i,schemaProp:a},s);t.mergeValidEvaluated(d,s)},()=>r.var(s,!0)),t.ok(s))}Il.validateSchemaDeps=vle;Il.default=QFe});var wle=H(Fj=>{"use strict";E();Object.defineProperty(Fj,"__esModule",{value:!0});var ble=tr(),eze=Dr(),tze={message:"property name must be valid",params:({params:t})=>(0,ble._)`{propertyName: ${t.propertyName}}`},rze={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:tze,code(t){let{gen:e,schema:r,data:n,it:i}=t;if((0,eze.alwaysValidSchema)(i,r))return;let o=e.name("valid");e.forIn("key",n,s=>{t.setParams({propertyName:s}),t.subschema({keyword:"propertyNames",data:s,dataTypes:["string"],propertyName:s,compositeRule:!0},o),e.if((0,ble.not)(o),()=>{t.error(!0),i.allErrors||e.break()})}),t.ok(o)}};Fj.default=rze});var Kj=H(zj=>{"use strict";E();Object.defineProperty(zj,"__esModule",{value:!0});var M4=of(),su=tr(),nze=nf(),P4=Dr(),ize={message:"must NOT have additional properties",params:({params:t})=>(0,su._)`{additionalProperty: ${t.additionalProperty}}`},oze={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:ize,code(t){let{gen:e,schema:r,parentSchema:n,data:i,errsCount:o,it:s}=t;if(!o)throw new Error("ajv implementation error");let{allErrors:a,opts:d}=s;if(s.props=!0,d.removeAdditional!=="all"&&(0,P4.alwaysValidSchema)(s,r))return;let m=(0,M4.allSchemaProperties)(n.properties),p=(0,M4.allSchemaProperties)(n.patternProperties);w(),t.ok((0,su._)`${o} === ${nze.default.errors}`);function w(){e.forIn("key",i,B=>{!m.length&&!p.length?M(B):e.if(P(B),()=>M(B))})}function P(B){let I;if(m.length>8){let C=(0,P4.schemaRefOrVal)(s,n.properties,"properties");I=(0,M4.isOwnProperty)(e,C,B)}else m.length?I=(0,su.or)(...m.map(C=>(0,su._)`${B} === ${C}`)):I=su.nil;return p.length&&(I=(0,su.or)(I,...p.map(C=>(0,su._)`${(0,M4.usePattern)(t,C)}.test(${B})`))),(0,su.not)(I)}function S(B){e.code((0,su._)`delete ${i}[${B}]`)}function M(B){if(d.removeAdditional==="all"||d.removeAdditional&&r===!1){S(B);return}if(r===!1){t.setParams({additionalProperty:B}),t.error(),a||e.break();return}if(typeof r=="object"&&!(0,P4.alwaysValidSchema)(s,r)){let I=e.name("valid");d.removeAdditional==="failing"?(A(B,I,!1),e.if((0,su.not)(I),()=>{t.reset(),S(B)})):(A(B,I),a||e.if((0,su.not)(I),()=>e.break()))}}function A(B,I,C){let k={keyword:"additionalProperties",dataProp:B,dataPropType:P4.Type.Str};C===!1&&Object.assign(k,{compositeRule:!0,createErrors:!1,allErrors:!1}),t.subschema(k,I)}}};zj.default=oze});var Ele=H(Wj=>{"use strict";E();Object.defineProperty(Wj,"__esModule",{value:!0});var sze=Tx(),_le=of(),Gj=Dr(),xle=Kj(),aze={keyword:"properties",type:"object",schemaType:"object",code(t){let{gen:e,schema:r,parentSchema:n,data:i,it:o}=t;o.opts.removeAdditional==="all"&&n.additionalProperties===void 0&&xle.default.code(new sze.KeywordCxt(o,xle.default,"additionalProperties"));let s=(0,_le.allSchemaProperties)(r);for(let w of s)o.definedProperties.add(w);o.opts.unevaluated&&s.length&&o.props!==!0&&(o.props=Gj.mergeEvaluated.props(e,(0,Gj.toHash)(s),o.props));let a=s.filter(w=>!(0,Gj.alwaysValidSchema)(o,r[w]));if(a.length===0)return;let d=e.name("valid");for(let w of a)m(w)?p(w):(e.if((0,_le.propertyInData)(e,i,w,o.opts.ownProperties)),p(w),o.allErrors||e.else().var(d,!0),e.endIf()),t.it.definedProperties.add(w),t.ok(d);function m(w){return o.opts.useDefaults&&!o.compositeRule&&r[w].default!==void 0}function p(w){t.subschema({keyword:"properties",schemaProp:w,dataProp:w},d)}}};Wj.default=aze});var Ale=H(Vj=>{"use strict";E();Object.defineProperty(Vj,"__esModule",{value:!0});var Sle=of(),A4=tr(),Mle=Dr(),Ple=Dr(),cze={keyword:"patternProperties",type:"object",schemaType:"object",code(t){let{gen:e,schema:r,data:n,parentSchema:i,it:o}=t,{opts:s}=o,a=(0,Sle.allSchemaProperties)(r),d=a.filter(A=>(0,Mle.alwaysValidSchema)(o,r[A]));if(a.length===0||d.length===a.length&&(!o.opts.unevaluated||o.props===!0))return;let m=s.strictSchema&&!s.allowMatchingProperties&&i.properties,p=e.name("valid");o.props!==!0&&!(o.props instanceof A4.Name)&&(o.props=(0,Ple.evaluatedPropsToName)(e,o.props));let{props:w}=o;P();function P(){for(let A of a)m&&S(A),o.allErrors?M(A):(e.var(p,!0),M(A),e.if(p))}function S(A){for(let B in m)new RegExp(A).test(B)&&(0,Mle.checkStrictMode)(o,`property ${B} matches pattern ${A} (use allowMatchingProperties)`)}function M(A){e.forIn("key",n,B=>{e.if((0,A4._)`${(0,Sle.usePattern)(t,A)}.test(${B})`,()=>{let I=d.includes(A);I||t.subschema({keyword:"patternProperties",schemaProp:A,dataProp:B,dataPropType:Ple.Type.Str},p),o.opts.unevaluated&&w!==!0?e.assign((0,A4._)`${w}[${B}]`,!0):!I&&!o.allErrors&&e.if((0,A4.not)(p),()=>e.break())})})}}};Vj.default=cze});var Tle=H(Hj=>{"use strict";E();Object.defineProperty(Hj,"__esModule",{value:!0});var fze=Dr(),uze={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(t){let{gen:e,schema:r,it:n}=t;if((0,fze.alwaysValidSchema)(n,r)){t.fail();return}let i=e.name("valid");t.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},i),t.failResult(i,()=>t.reset(),()=>t.error())},error:{message:"must NOT be valid"}};Hj.default=uze});var Rle=H(Zj=>{"use strict";E();Object.defineProperty(Zj,"__esModule",{value:!0});var lze=of(),dze={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:lze.validateUnion,error:{message:"must match a schema in anyOf"}};Zj.default=dze});var Ile=H(Jj=>{"use strict";E();Object.defineProperty(Jj,"__esModule",{value:!0});var T4=tr(),hze=Dr(),pze={message:"must match exactly one schema in oneOf",params:({params:t})=>(0,T4._)`{passingSchemas: ${t.passing}}`},mze={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:pze,code(t){let{gen:e,schema:r,parentSchema:n,it:i}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");if(i.opts.discriminator&&n.discriminator)return;let o=r,s=e.let("valid",!1),a=e.let("passing",null),d=e.name("_valid");t.setParams({passing:a}),e.block(m),t.result(s,()=>t.reset(),()=>t.error(!0));function m(){o.forEach((p,w)=>{let P;(0,hze.alwaysValidSchema)(i,p)?e.var(d,!0):P=t.subschema({keyword:"oneOf",schemaProp:w,compositeRule:!0},d),w>0&&e.if((0,T4._)`${d} && ${s}`).assign(s,!1).assign(a,(0,T4._)`[${a}, ${w}]`).else(),e.if(d,()=>{e.assign(s,!0),e.assign(a,w),P&&t.mergeEvaluated(P,T4.Name)})})}}};Jj.default=mze});var kle=H(Yj=>{"use strict";E();Object.defineProperty(Yj,"__esModule",{value:!0});var yze=Dr(),gze={keyword:"allOf",schemaType:"array",code(t){let{gen:e,schema:r,it:n}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");let i=e.name("valid");r.forEach((o,s)=>{if((0,yze.alwaysValidSchema)(n,o))return;let a=t.subschema({keyword:"allOf",schemaProp:s},i);t.ok(i),t.mergeEvaluated(a)})}};Yj.default=gze});var Dle=H(Qj=>{"use strict";E();Object.defineProperty(Qj,"__esModule",{value:!0});var R4=tr(),Ble=Dr(),vze={message:({params:t})=>(0,R4.str)`must match "${t.ifClause}" schema`,params:({params:t})=>(0,R4._)`{failingKeyword: ${t.ifClause}}`},bze={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:vze,code(t){let{gen:e,parentSchema:r,it:n}=t;r.then===void 0&&r.else===void 0&&(0,Ble.checkStrictMode)(n,'"if" without "then" and "else" is ignored');let i=Ole(n,"then"),o=Ole(n,"else");if(!i&&!o)return;let s=e.let("valid",!0),a=e.name("_valid");if(d(),t.reset(),i&&o){let p=e.let("ifClause");t.setParams({ifClause:p}),e.if(a,m("then",p),m("else",p))}else i?e.if(a,m("then")):e.if((0,R4.not)(a),m("else"));t.pass(s,()=>t.error(!0));function d(){let p=t.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},a);t.mergeEvaluated(p)}function m(p,w){return()=>{let P=t.subschema({keyword:p},a);e.assign(s,a),t.mergeValidEvaluated(P,s),w?e.assign(w,(0,R4._)`${p}`):t.setParams({ifClause:p})}}}};function Ole(t,e){let r=t.schema[e];return r!==void 0&&!(0,Ble.alwaysValidSchema)(t,r)}Qj.default=bze});var Cle=H(Xj=>{"use strict";E();Object.defineProperty(Xj,"__esModule",{value:!0});var wze=Dr(),_ze={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:t,parentSchema:e,it:r}){e.if===void 0&&(0,wze.checkStrictMode)(r,`"${t}" without "if" is ignored`)}};Xj.default=_ze});var jle=H(eN=>{"use strict";E();Object.defineProperty(eN,"__esModule",{value:!0});var xze=jj(),Eze=hle(),Sze=Nj(),Mze=mle(),Pze=yle(),Aze=S4(),Tze=wle(),Rze=Kj(),Ize=Ele(),kze=Ale(),Oze=Tle(),Bze=Rle(),Dze=Ile(),Cze=kle(),jze=Dle(),Nze=Cle();function qze(t=!1){let e=[Oze.default,Bze.default,Dze.default,Cze.default,jze.default,Nze.default,Tze.default,Rze.default,Aze.default,Ize.default,kze.default];return t?e.push(Eze.default,Mze.default):e.push(xze.default,Sze.default),e.push(Pze.default),e}eN.default=qze});var rN=H(Fx=>{"use strict";E();Object.defineProperty(Fx,"__esModule",{value:!0});Fx.dynamicAnchor=void 0;var tN=tr(),$ze=nf(),Nle=Rx(),Lze=g4(),Uze={keyword:"$dynamicAnchor",schemaType:"string",code:t=>qle(t,t.schema)};function qle(t,e){let{gen:r,it:n}=t;n.schemaEnv.root.dynamicAnchors[e]=!0;let i=(0,tN._)`${$ze.default.dynamicAnchors}${(0,tN.getProperty)(e)}`,o=n.errSchemaPath==="#"?n.validateName:Fze(t);r.if((0,tN._)`!${i}`,()=>r.assign(i,o))}Fx.dynamicAnchor=qle;function Fze(t){let{schemaEnv:e,schema:r,self:n}=t.it,{root:i,baseId:o,localRefs:s,meta:a}=e.root,{schemaId:d}=n.opts,m=new Nle.SchemaEnv({schema:r,schemaId:d,root:i,baseId:o,localRefs:s,meta:a});return Nle.compileSchema.call(n,m),(0,Lze.getValidate)(t,m)}Fx.default=Uze});var nN=H(zx=>{"use strict";E();Object.defineProperty(zx,"__esModule",{value:!0});zx.dynamicRef=void 0;var $le=tr(),zze=nf(),Lle=g4(),Kze={keyword:"$dynamicRef",schemaType:"string",code:t=>Ule(t,t.schema)};function Ule(t,e){let{gen:r,keyword:n,it:i}=t;if(e[0]!=="#")throw new Error(`"${n}" only supports hash fragment reference`);let o=e.slice(1);if(i.allErrors)s();else{let d=r.let("valid",!1);s(d),t.ok(d)}function s(d){if(i.schemaEnv.root.dynamicAnchors[o]){let m=r.let("_v",(0,$le._)`${zze.default.dynamicAnchors}${(0,$le.getProperty)(o)}`);r.if(m,a(m,d),a(i.validateName,d))}else a(i.validateName,d)()}function a(d,m){return m?()=>r.block(()=>{(0,Lle.callRef)(t,d),r.let(m,!0)}):()=>(0,Lle.callRef)(t,d)}}zx.dynamicRef=Ule;zx.default=Kze});var Fle=H(iN=>{"use strict";E();Object.defineProperty(iN,"__esModule",{value:!0});var Gze=rN(),Wze=Dr(),Vze={keyword:"$recursiveAnchor",schemaType:"boolean",code(t){t.schema?(0,Gze.dynamicAnchor)(t,""):(0,Wze.checkStrictMode)(t.it,"$recursiveAnchor: false is ignored")}};iN.default=Vze});var zle=H(oN=>{"use strict";E();Object.defineProperty(oN,"__esModule",{value:!0});var Hze=nN(),Zze={keyword:"$recursiveRef",schemaType:"string",code:t=>(0,Hze.dynamicRef)(t,t.schema)};oN.default=Zze});var Kle=H(sN=>{"use strict";E();Object.defineProperty(sN,"__esModule",{value:!0});var Jze=rN(),Yze=nN(),Qze=Fle(),Xze=zle(),eKe=[Jze.default,Yze.default,Qze.default,Xze.default];sN.default=eKe});var Wle=H(aN=>{"use strict";E();Object.defineProperty(aN,"__esModule",{value:!0});var Gle=S4(),tKe={keyword:"dependentRequired",type:"object",schemaType:"object",error:Gle.error,code:t=>(0,Gle.validatePropertyDeps)(t)};aN.default=tKe});var Vle=H(cN=>{"use strict";E();Object.defineProperty(cN,"__esModule",{value:!0});var rKe=S4(),nKe={keyword:"dependentSchemas",type:"object",schemaType:"object",code:t=>(0,rKe.validateSchemaDeps)(t)};cN.default=nKe});var Hle=H(fN=>{"use strict";E();Object.defineProperty(fN,"__esModule",{value:!0});var iKe=Dr(),oKe={keyword:["maxContains","minContains"],type:"array",schemaType:"number",code({keyword:t,parentSchema:e,it:r}){e.contains===void 0&&(0,iKe.checkStrictMode)(r,`"${t}" without "contains" is ignored`)}};fN.default=oKe});var Zle=H(uN=>{"use strict";E();Object.defineProperty(uN,"__esModule",{value:!0});var sKe=Wle(),aKe=Vle(),cKe=Hle(),fKe=[sKe.default,aKe.default,cKe.default];uN.default=fKe});var Yle=H(lN=>{"use strict";E();Object.defineProperty(lN,"__esModule",{value:!0});var Xp=tr(),Jle=Dr(),uKe=nf(),lKe={message:"must NOT have unevaluated properties",params:({params:t})=>(0,Xp._)`{unevaluatedProperty: ${t.unevaluatedProperty}}`},dKe={keyword:"unevaluatedProperties",type:"object",schemaType:["boolean","object"],trackErrors:!0,error:lKe,code(t){let{gen:e,schema:r,data:n,errsCount:i,it:o}=t;if(!i)throw new Error("ajv implementation error");let{allErrors:s,props:a}=o;a instanceof Xp.Name?e.if((0,Xp._)`${a} !== true`,()=>e.forIn("key",n,w=>e.if(m(a,w),()=>d(w)))):a!==!0&&e.forIn("key",n,w=>a===void 0?d(w):e.if(p(a,w),()=>d(w))),o.props=!0,t.ok((0,Xp._)`${i} === ${uKe.default.errors}`);function d(w){if(r===!1){t.setParams({unevaluatedProperty:w}),t.error(),s||e.break();return}if(!(0,Jle.alwaysValidSchema)(o,r)){let P=e.name("valid");t.subschema({keyword:"unevaluatedProperties",dataProp:w,dataPropType:Jle.Type.Str},P),s||e.if((0,Xp.not)(P),()=>e.break())}}function m(w,P){return(0,Xp._)`!${w} || !${w}[${P}]`}function p(w,P){let S=[];for(let M in w)w[M]===!0&&S.push((0,Xp._)`${P} !== ${M}`);return(0,Xp.and)(...S)}}};lN.default=dKe});var Xle=H(dN=>{"use strict";E();Object.defineProperty(dN,"__esModule",{value:!0});var jy=tr(),Qle=Dr(),hKe={message:({params:{len:t}})=>(0,jy.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,jy._)`{limit: ${t}}`},pKe={keyword:"unevaluatedItems",type:"array",schemaType:["boolean","object"],error:hKe,code(t){let{gen:e,schema:r,data:n,it:i}=t,o=i.items||0;if(o===!0)return;let s=e.const("len",(0,jy._)`${n}.length`);if(r===!1)t.setParams({len:o}),t.fail((0,jy._)`${s} > ${o}`);else if(typeof r=="object"&&!(0,Qle.alwaysValidSchema)(i,r)){let d=e.var("valid",(0,jy._)`${s} <= ${o}`);e.if((0,jy.not)(d),()=>a(d,o)),t.ok(d)}i.items=!0;function a(d,m){e.forRange("i",m,s,p=>{t.subschema({keyword:"unevaluatedItems",dataProp:p,dataPropType:Qle.Type.Num},d),i.allErrors||e.if((0,jy.not)(d),()=>e.break())})}}};dN.default=pKe});var ede=H(hN=>{"use strict";E();Object.defineProperty(hN,"__esModule",{value:!0});var mKe=Yle(),yKe=Xle(),gKe=[mKe.default,yKe.default];hN.default=gKe});var tde=H(pN=>{"use strict";E();Object.defineProperty(pN,"__esModule",{value:!0});var Ki=tr(),vKe={message:({schemaCode:t})=>(0,Ki.str)`must match format "${t}"`,params:({schemaCode:t})=>(0,Ki._)`{format: ${t}}`},bKe={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:vKe,code(t,e){let{gen:r,data:n,$data:i,schema:o,schemaCode:s,it:a}=t,{opts:d,errSchemaPath:m,schemaEnv:p,self:w}=a;if(!d.validateFormats)return;i?P():S();function P(){let M=r.scopeValue("formats",{ref:w.formats,code:d.code.formats}),A=r.const("fDef",(0,Ki._)`${M}[${s}]`),B=r.let("fType"),I=r.let("format");r.if((0,Ki._)`typeof ${A} == "object" && !(${A} instanceof RegExp)`,()=>r.assign(B,(0,Ki._)`${A}.type || "string"`).assign(I,(0,Ki._)`${A}.validate`),()=>r.assign(B,(0,Ki._)`"string"`).assign(I,A)),t.fail$data((0,Ki.or)(C(),k()));function C(){return d.strictSchema===!1?Ki.nil:(0,Ki._)`${s} && !${I}`}function k(){let q=p.$async?(0,Ki._)`(${A}.async ? await ${I}(${n}) : ${I}(${n}))`:(0,Ki._)`${I}(${n})`,L=(0,Ki._)`(typeof ${I} == "function" ? ${q} : ${I}.test(${n}))`;return(0,Ki._)`${I} && ${I} !== true && ${B} === ${e} && !${L}`}}function S(){let M=w.formats[o];if(!M){C();return}if(M===!0)return;let[A,B,I]=k(M);A===e&&t.pass(q());function C(){if(d.strictSchema===!1){w.logger.warn(L());return}throw new Error(L());function L(){return`unknown format "${o}" ignored in schema at path "${m}"`}}function k(L){let U=L instanceof RegExp?(0,Ki.regexpCode)(L):d.code.formats?(0,Ki._)`${d.code.formats}${(0,Ki.getProperty)(o)}`:void 0,F=r.scopeValue("formats",{key:o,ref:L,code:U});return typeof L=="object"&&!(L instanceof RegExp)?[L.type||"string",L.validate,(0,Ki._)`${F}.validate`]:["string",L,F]}function q(){if(typeof M=="object"&&!(M instanceof RegExp)&&M.async){if(!p.$async)throw new Error("async format in sync schema");return(0,Ki._)`await ${I}(${n})`}return typeof B=="function"?(0,Ki._)`${I}(${n})`:(0,Ki._)`${I}.test(${n})`}}}};pN.default=bKe});var rde=H(mN=>{"use strict";E();Object.defineProperty(mN,"__esModule",{value:!0});var wKe=tde(),_Ke=[wKe.default];mN.default=_Ke});var nde=H(pw=>{"use strict";E();Object.defineProperty(pw,"__esModule",{value:!0});pw.contentVocabulary=pw.metadataVocabulary=void 0;pw.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];pw.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var ode=H(yN=>{"use strict";E();Object.defineProperty(yN,"__esModule",{value:!0});var xKe=Zue(),EKe=fle(),SKe=jle(),MKe=Kle(),PKe=Zle(),AKe=ede(),TKe=rde(),ide=nde(),RKe=[MKe.default,xKe.default,EKe.default,(0,SKe.default)(!0),TKe.default,ide.metadataVocabulary,ide.contentVocabulary,PKe.default,AKe.default];yN.default=RKe});var sde=H(Kx=>{"use strict";E();Object.defineProperty(Kx,"__esModule",{value:!0});Kx.DiscrError=void 0;var IKe;(function(t){t.Tag="tag",t.Mapping="mapping"})(IKe=Kx.DiscrError||(Kx.DiscrError={}))});var cde=H(vN=>{"use strict";E();Object.defineProperty(vN,"__esModule",{value:!0});var mw=tr(),gN=sde(),ade=Rx(),kKe=Dr(),OKe={message:({params:{discrError:t,tagName:e}})=>t===gN.DiscrError.Tag?`tag "${e}" must be string`:`value of tag "${e}" must be in oneOf`,params:({params:{discrError:t,tag:e,tagName:r}})=>(0,mw._)`{error: ${t}, tag: ${r}, tagValue: ${e}}`},BKe={keyword:"discriminator",type:"object",schemaType:"object",error:OKe,code(t){let{gen:e,data:r,schema:n,parentSchema:i,it:o}=t,{oneOf:s}=i;if(!o.opts.discriminator)throw new Error("discriminator: requires discriminator option");let a=n.propertyName;if(typeof a!="string")throw new Error("discriminator: requires propertyName");if(n.mapping)throw new Error("discriminator: mapping is not supported");if(!s)throw new Error("discriminator: requires oneOf keyword");let d=e.let("valid",!1),m=e.const("tag",(0,mw._)`${r}${(0,mw.getProperty)(a)}`);e.if((0,mw._)`typeof ${m} == "string"`,()=>p(),()=>t.error(!1,{discrError:gN.DiscrError.Tag,tag:m,tagName:a})),t.ok(d);function p(){let S=P();e.if(!1);for(let M in S)e.elseIf((0,mw._)`${m} === ${M}`),e.assign(d,w(S[M]));e.else(),t.error(!1,{discrError:gN.DiscrError.Mapping,tag:m,tagName:a}),e.endIf()}function w(S){let M=e.name("valid"),A=t.subschema({keyword:"oneOf",schemaProp:S},M);return t.mergeEvaluated(A,mw.Name),M}function P(){var S;let M={},A=I(i),B=!0;for(let q=0;q<s.length;q++){let L=s[q];L?.$ref&&!(0,kKe.schemaHasRulesButRef)(L,o.self.RULES)&&(L=ade.resolveRef.call(o.self,o.schemaEnv.root,o.baseId,L?.$ref),L instanceof ade.SchemaEnv&&(L=L.schema));let U=(S=L?.properties)===null||S===void 0?void 0:S[a];if(typeof U!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${a}"`);B=B&&(A||I(L)),C(U,q)}if(!B)throw new Error(`discriminator: "${a}" must be required`);return M;function I({required:q}){return Array.isArray(q)&&q.includes(a)}function C(q,L){if(q.const)k(q.const,L);else if(q.enum)for(let U of q.enum)k(U,L);else throw new Error(`discriminator: "properties/${a}" must have "const" or "enum"`)}function k(q,L){if(typeof q!="string"||q in M)throw new Error(`discriminator: "${a}" values must be unique strings`);M[q]=L}}}};vN.default=BKe});var fde=H((p6t,DKe)=>{DKe.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/schema",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/core":!0,"https://json-schema.org/draft/2020-12/vocab/applicator":!0,"https://json-schema.org/draft/2020-12/vocab/unevaluated":!0,"https://json-schema.org/draft/2020-12/vocab/validation":!0,"https://json-schema.org/draft/2020-12/vocab/meta-data":!0,"https://json-schema.org/draft/2020-12/vocab/format-annotation":!0,"https://json-schema.org/draft/2020-12/vocab/content":!0},$dynamicAnchor:"meta",title:"Core and Validation specifications meta-schema",allOf:[{$ref:"meta/core"},{$ref:"meta/applicator"},{$ref:"meta/unevaluated"},{$ref:"meta/validation"},{$ref:"meta/meta-data"},{$ref:"meta/format-annotation"},{$ref:"meta/content"}],type:["object","boolean"],$comment:"This meta-schema also defines keywords that have appeared in previous drafts in order to prevent incompatible extensions as they remain in common use.",properties:{definitions:{$comment:'"definitions" has been replaced by "$defs".',type:"object",additionalProperties:{$dynamicRef:"#meta"},deprecated:!0,default:{}},dependencies:{$comment:'"dependencies" has been split and replaced by "dependentSchemas" and "dependentRequired" in order to serve their differing semantics.',type:"object",additionalProperties:{anyOf:[{$dynamicRef:"#meta"},{$ref:"meta/validation#/$defs/stringArray"}]},deprecated:!0,default:{}},$recursiveAnchor:{$comment:'"$recursiveAnchor" has been replaced by "$dynamicAnchor".',$ref:"meta/core#/$defs/anchorString",deprecated:!0},$recursiveRef:{$comment:'"$recursiveRef" has been replaced by "$dynamicRef".',$ref:"meta/core#/$defs/uriReferenceString",deprecated:!0}}}});var ude=H((m6t,CKe)=>{CKe.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/applicator",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/applicator":!0},$dynamicAnchor:"meta",title:"Applicator vocabulary meta-schema",type:["object","boolean"],properties:{prefixItems:{$ref:"#/$defs/schemaArray"},items:{$dynamicRef:"#meta"},contains:{$dynamicRef:"#meta"},additionalProperties:{$dynamicRef:"#meta"},properties:{type:"object",additionalProperties:{$dynamicRef:"#meta"},default:{}},patternProperties:{type:"object",additionalProperties:{$dynamicRef:"#meta"},propertyNames:{format:"regex"},default:{}},dependentSchemas:{type:"object",additionalProperties:{$dynamicRef:"#meta"},default:{}},propertyNames:{$dynamicRef:"#meta"},if:{$dynamicRef:"#meta"},then:{$dynamicRef:"#meta"},else:{$dynamicRef:"#meta"},allOf:{$ref:"#/$defs/schemaArray"},anyOf:{$ref:"#/$defs/schemaArray"},oneOf:{$ref:"#/$defs/schemaArray"},not:{$dynamicRef:"#meta"}},$defs:{schemaArray:{type:"array",minItems:1,items:{$dynamicRef:"#meta"}}}}});var lde=H((y6t,jKe)=>{jKe.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/unevaluated",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/unevaluated":!0},$dynamicAnchor:"meta",title:"Unevaluated applicator vocabulary meta-schema",type:["object","boolean"],properties:{unevaluatedItems:{$dynamicRef:"#meta"},unevaluatedProperties:{$dynamicRef:"#meta"}}}});var dde=H((g6t,NKe)=>{NKe.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/content",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/content":!0},$dynamicAnchor:"meta",title:"Content vocabulary meta-schema",type:["object","boolean"],properties:{contentEncoding:{type:"string"},contentMediaType:{type:"string"},contentSchema:{$dynamicRef:"#meta"}}}});var hde=H((v6t,qKe)=>{qKe.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/core",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/core":!0},$dynamicAnchor:"meta",title:"Core vocabulary meta-schema",type:["object","boolean"],properties:{$id:{$ref:"#/$defs/uriReferenceString",$comment:"Non-empty fragments not allowed.",pattern:"^[^#]*#?$"},$schema:{$ref:"#/$defs/uriString"},$ref:{$ref:"#/$defs/uriReferenceString"},$anchor:{$ref:"#/$defs/anchorString"},$dynamicRef:{$ref:"#/$defs/uriReferenceString"},$dynamicAnchor:{$ref:"#/$defs/anchorString"},$vocabulary:{type:"object",propertyNames:{$ref:"#/$defs/uriString"},additionalProperties:{type:"boolean"}},$comment:{type:"string"},$defs:{type:"object",additionalProperties:{$dynamicRef:"#meta"}}},$defs:{anchorString:{type:"string",pattern:"^[A-Za-z_][-A-Za-z0-9._]*$"},uriString:{type:"string",format:"uri"},uriReferenceString:{type:"string",format:"uri-reference"}}}});var pde=H((b6t,$Ke)=>{$Ke.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/format-annotation",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/format-annotation":!0},$dynamicAnchor:"meta",title:"Format vocabulary meta-schema for annotation results",type:["object","boolean"],properties:{format:{type:"string"}}}});var mde=H((w6t,LKe)=>{LKe.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/meta-data",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/meta-data":!0},$dynamicAnchor:"meta",title:"Meta-data vocabulary meta-schema",type:["object","boolean"],properties:{title:{type:"string"},description:{type:"string"},default:!0,deprecated:{type:"boolean",default:!1},readOnly:{type:"boolean",default:!1},writeOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0}}}});var yde=H((_6t,UKe)=>{UKe.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/validation",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/validation":!0},$dynamicAnchor:"meta",title:"Validation vocabulary meta-schema",type:["object","boolean"],properties:{type:{anyOf:[{$ref:"#/$defs/simpleTypes"},{type:"array",items:{$ref:"#/$defs/simpleTypes"},minItems:1,uniqueItems:!0}]},const:!0,enum:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/$defs/nonNegativeInteger"},minLength:{$ref:"#/$defs/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},maxItems:{$ref:"#/$defs/nonNegativeInteger"},minItems:{$ref:"#/$defs/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},maxContains:{$ref:"#/$defs/nonNegativeInteger"},minContains:{$ref:"#/$defs/nonNegativeInteger",default:1},maxProperties:{$ref:"#/$defs/nonNegativeInteger"},minProperties:{$ref:"#/$defs/nonNegativeIntegerDefault0"},required:{$ref:"#/$defs/stringArray"},dependentRequired:{type:"object",additionalProperties:{$ref:"#/$defs/stringArray"}}},$defs:{nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{$ref:"#/$defs/nonNegativeInteger",default:0},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}}}});var gde=H(bN=>{"use strict";E();Object.defineProperty(bN,"__esModule",{value:!0});var FKe=fde(),zKe=ude(),KKe=lde(),GKe=dde(),WKe=hde(),VKe=pde(),HKe=mde(),ZKe=yde(),JKe=["/properties"];function YKe(t){return[FKe,zKe,KKe,GKe,WKe,e(this,VKe),HKe,e(this,ZKe)].forEach(r=>this.addMetaSchema(r,void 0,!1)),this;function e(r,n){return t?r.$dataMetaSchema(n,JKe):n}}bN.default=YKe});var _N=H((hi,vde)=>{"use strict";E();Object.defineProperty(hi,"__esModule",{value:!0});hi.MissingRefError=hi.ValidationError=hi.CodeGen=hi.Name=hi.nil=hi.stringify=hi.str=hi._=hi.KeywordCxt=void 0;var QKe=Kue(),XKe=ode(),eGe=cde(),tGe=gde(),wN="https://json-schema.org/draft/2020-12/schema",I4=class extends QKe.default{constructor(e={}){super({...e,dynamicRef:!0,next:!0,unevaluated:!0})}_addVocabularies(){super._addVocabularies(),XKe.default.forEach(e=>this.addVocabulary(e)),this.opts.discriminator&&this.addKeyword(eGe.default)}_addDefaultMetaSchema(){super._addDefaultMetaSchema();let{$data:e,meta:r}=this.opts;r&&(tGe.default.call(this,e),this.refs["http://json-schema.org/schema"]=wN)}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(wN)?wN:void 0)}};vde.exports=hi=I4;Object.defineProperty(hi,"__esModule",{value:!0});hi.default=I4;var rGe=Tx();Object.defineProperty(hi,"KeywordCxt",{enumerable:!0,get:function(){return rGe.KeywordCxt}});var yw=tr();Object.defineProperty(hi,"_",{enumerable:!0,get:function(){return yw._}});Object.defineProperty(hi,"str",{enumerable:!0,get:function(){return yw.str}});Object.defineProperty(hi,"stringify",{enumerable:!0,get:function(){return yw.stringify}});Object.defineProperty(hi,"nil",{enumerable:!0,get:function(){return yw.nil}});Object.defineProperty(hi,"Name",{enumerable:!0,get:function(){return yw.Name}});Object.defineProperty(hi,"CodeGen",{enumerable:!0,get:function(){return yw.CodeGen}});var nGe=u4();Object.defineProperty(hi,"ValidationError",{enumerable:!0,get:function(){return nGe.default}});var iGe=l4();Object.defineProperty(hi,"MissingRefError",{enumerable:!0,get:function(){return iGe.default}})});var xde=H((C5t,_de)=>{E();var aGe=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,O4=()=>aGe.now(),cGe=t=>t&&t===Math.floor(t)&&t>0&&isFinite(t),xN=t=>t===1/0||cGe(t),Wx=class{constructor({max:e=1/0,ttl:r,updateAgeOnGet:n=!1,checkAgeOnGet:i=!1,noUpdateTTL:o=!1,dispose:s,noDisposeOnSet:a=!1}={}){if(this.expirations=Object.create(null),this.data=new Map,this.expirationMap=new Map,r!==void 0&&!xN(r))throw new TypeError("ttl must be positive integer or Infinity if set");if(!xN(e))throw new TypeError("max must be positive integer or Infinity");if(this.ttl=r,this.max=e,this.updateAgeOnGet=!!n,this.checkAgeOnGet=!!i,this.noUpdateTTL=!!o,this.noDisposeOnSet=!!a,s!==void 0){if(typeof s!="function")throw new TypeError("dispose must be function if set");this.dispose=s}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 i in this.expirations){this.setTimer(i,i-O4());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 j.default.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!==Wx.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 i=this.expirations[n];!i||i.length<=1?delete this.expirations[n]:this.expirations[n]=i.filter(o=>o!==e)}if(r!==1/0){let i=Math.floor(O4()+r);this.expirationMap.set(e,i),this.expirations[i]||(this.expirations[i]=[],this.setTimer(i,r)),this.expirations[i].push(e)}else this.expirationMap.set(e,1/0)}set(e,r,{ttl:n=this.ttl,noUpdateTTL:i=this.noUpdateTTL,noDisposeOnSet:o=this.noDisposeOnSet}={}){if(!xN(n))throw new TypeError("ttl must be positive integer or Infinity");if(this.expirationMap.has(e)){i||this.setTTL(e,n);let s=this.data.get(e);s!==r&&(this.data.set(e,r),o||this.dispose(s,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-O4())):0}get(e,{updateAgeOnGet:r=this.updateAgeOnGet,ttl:n=this.ttl,checkAgeOnGet:i=this.checkAgeOnGet}={}){let o=this.data.get(e);if(i&&this.getRemainingTTL(e)===0){this.delete(e);return}return r&&this.setTTL(e,n),o}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 i=this.expirations[r];return i&&(i.length<=1?delete this.expirations[r]:this.expirations[r]=i.filter(o=>o!==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 i of r)n.push([i,this.data.get(i)]),this.data.delete(i),this.expirationMap.delete(i);for(let[i,o]of n)this.dispose(o,i,"evict")}else{let n=this.size-this.max,i=[];for(let o of r.splice(0,n))i.push([o,this.data.get(o)]),this.data.delete(o),this.expirationMap.delete(o);for(let[o,s]of i)this.dispose(s,o,"evict");return}}}get size(){return this.data.size}purgeStale(){let e=Math.ceil(O4());for(let r in this.expirations){if(r==="Infinity"||r>e)return;let n=[...this.expirations[r]||[]],i=[];delete this.expirations[r];for(let o of n)i.push([o,this.data.get(o)]),this.data.delete(o),this.expirationMap.delete(o);for(let[o,s]of i)this.dispose(s,o,"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()}};_de.exports=Wx});var Ade=H(Pde=>{"use strict";E();Pde.supports=function(...e){let r=e.reduce((n,i)=>Object.assign(n,i),{});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 uu=H((t8t,Tde)=>{"use strict";E();Tde.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 MN=H((n8t,Rde)=>{"use strict";E();var SN=null;Rde.exports=function(){return SN===null&&(SN={textEncoder:new TextEncoder,textDecoder:new TextDecoder}),SN}});var TN=H(Ide=>{"use strict";E();var PN=uu(),uGe=new Set(["buffer","view","utf8"]),AN=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"||!uGe.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 PN(`Encoding '${this.name}' cannot be transcoded to 'buffer'`,{code:"LEVEL_ENCODING_NOT_SUPPORTED"})}createViewTranscoder(){throw new PN(`Encoding '${this.name}' cannot be transcoded to 'view'`,{code:"LEVEL_ENCODING_NOT_SUPPORTED"})}createUTF8Transcoder(){throw new PN(`Encoding '${this.name}' cannot be transcoded to 'utf8'`,{code:"LEVEL_ENCODING_NOT_SUPPORTED"})}};Ide.Encoding=AN});var ON=H(D4=>{"use strict";E();var{Buffer:IN}=sr()||{},{Encoding:kN}=TN(),lGe=MN(),Hx=class extends kN{constructor(e){super({...e,format:"buffer"})}createViewTranscoder(){return new Zx({encode:this.encode,decode:e=>this.decode(IN.from(e.buffer,e.byteOffset,e.byteLength)),name:`${this.name}+view`})}createBufferTranscoder(){return this}},Zx=class extends kN{constructor(e){super({...e,format:"view"})}createBufferTranscoder(){return new Hx({encode:e=>{let r=this.encode(e);return IN.from(r.buffer,r.byteOffset,r.byteLength)},decode:this.decode,name:`${this.name}+buffer`})}createViewTranscoder(){return this}},RN=class extends kN{constructor(e){super({...e,format:"utf8"})}createBufferTranscoder(){return new Hx({encode:e=>IN.from(this.encode(e),"utf8"),decode:e=>this.decode(e.toString("utf8")),name:`${this.name}+buffer`})}createViewTranscoder(){let{textEncoder:e,textDecoder:r}=lGe();return new Zx({encode:n=>e.encode(this.encode(n)),decode:n=>this.decode(r.decode(n)),name:`${this.name}+view`})}createUTF8Transcoder(){return this}};D4.BufferFormat=Hx;D4.ViewFormat=Zx;D4.UTF8Format=RN});var Dde=H($y=>{"use strict";E();var{Buffer:zs}=sr()||{Buffer:{isBuffer:()=>!1}},{textEncoder:Ode,textDecoder:kde}=MN()(),{BufferFormat:Jx,ViewFormat:BN,UTF8Format:Bde}=ON(),C4=t=>t;$y.utf8=new Bde({encode:function(t){return zs.isBuffer(t)?t.toString("utf8"):ArrayBuffer.isView(t)?kde.decode(t):String(t)},decode:C4,name:"utf8",createViewTranscoder(){return new BN({encode:function(t){return ArrayBuffer.isView(t)?t:Ode.encode(t)},decode:function(t){return kde.decode(t)},name:`${this.name}+view`})},createBufferTranscoder(){return new Jx({encode:function(t){return zs.isBuffer(t)?t:ArrayBuffer.isView(t)?zs.from(t.buffer,t.byteOffset,t.byteLength):zs.from(String(t),"utf8")},decode:function(t){return t.toString("utf8")},name:`${this.name}+buffer`})}});$y.json=new Bde({encode:JSON.stringify,decode:JSON.parse,name:"json"});$y.buffer=new Jx({encode:function(t){return zs.isBuffer(t)?t:ArrayBuffer.isView(t)?zs.from(t.buffer,t.byteOffset,t.byteLength):zs.from(String(t),"utf8")},decode:C4,name:"buffer",createViewTranscoder(){return new BN({encode:function(t){return ArrayBuffer.isView(t)?t:zs.from(String(t),"utf8")},decode:function(t){return zs.from(t.buffer,t.byteOffset,t.byteLength)},name:`${this.name}+view`})}});$y.view=new BN({encode:function(t){return ArrayBuffer.isView(t)?t:Ode.encode(t)},decode:C4,name:"view",createBufferTranscoder(){return new Jx({encode:function(t){return zs.isBuffer(t)?t:ArrayBuffer.isView(t)?zs.from(t.buffer,t.byteOffset,t.byteLength):zs.from(String(t),"utf8")},decode:C4,name:`${this.name}+buffer`})}});$y.hex=new Jx({encode:function(t){return zs.isBuffer(t)?t:zs.from(String(t),"hex")},decode:function(t){return t.toString("hex")},name:"hex"});$y.base64=new Jx({encode:function(t){return zs.isBuffer(t)?t:zs.from(String(t),"base64")},decode:function(t){return t.toString("base64")},name:"base64"})});var Nde=H(jde=>{"use strict";E();var Cde=uu(),N4=Dde(),{Encoding:dGe}=TN(),{BufferFormat:hGe,ViewFormat:pGe,UTF8Format:mGe}=ON(),Yx=Symbol("formats"),j4=Symbol("encodings"),yGe=new Set(["buffer","view","utf8"]),DN=class{constructor(e){if(Array.isArray(e)){if(!e.every(r=>yGe.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[j4]=new Map,this[Yx]=new Set(e);for(let r in N4)try{this.encoding(r)}catch(n){if(n.code!=="LEVEL_ENCODING_NOT_SUPPORTED")throw n}}encodings(){return Array.from(new Set(this[j4].values()))}encoding(e){let r=this[j4].get(e);if(r===void 0){if(typeof e=="string"&&e!==""){if(r=wGe[e],!r)throw new Cde(`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=gGe(e)}let{name:n,format:i}=r;if(!this[Yx].has(i))if(this[Yx].has("view"))r=r.createViewTranscoder();else if(this[Yx].has("buffer"))r=r.createBufferTranscoder();else if(this[Yx].has("utf8"))r=r.createUTF8Transcoder();else throw new Cde(`Encoding '${n}' cannot be transcoded`,{code:"LEVEL_ENCODING_NOT_SUPPORTED"});for(let o of[e,n,r.name,r.commonName])this[j4].set(o,r)}return r}};jde.Transcoder=DN;function gGe(t){if(t instanceof dGe)return t;let e="type"in t&&typeof t.type=="string"?t.type:void 0,r=t.name||e||`anonymous-${_Ge++}`;switch(vGe(t)){case"view":return new pGe({...t,name:r});case"utf8":return new mGe({...t,name:r});case"buffer":return new hGe({...t,name:r});default:throw new TypeError("Format must be one of 'buffer', 'view', 'utf8'")}}function vGe(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 bGe={binary:N4.buffer,"utf-8":N4.utf8},wGe={...N4,...bGe},_Ge=0});var $de=H((h8t,qde)=>{E();qde.exports=typeof queueMicrotask=="function"?queueMicrotask:t=>Promise.resolve().then(t)});var Qx=H(CN=>{"use strict";E();var Lde=$de();CN.fromCallback=function(t,e){if(t===void 0){var r=new Promise(function(n,i){t=function(o,s){o?i(o):n(s)}});t[e!==void 0?e:"promise"]=r}else if(typeof t!="function")throw new TypeError("Callback must be a function");return t};CN.fromPromise=function(t,e){if(e===void 0)return t;t.then(function(r){Lde(()=>e(null,r))}).catch(function(r){Lde(()=>e(r))})}});var q4=H(jN=>{"use strict";E();jN.getCallback=function(t,e){return typeof t=="function"?t:e};jN.getOptions=function(t,e){return typeof t=="object"&&t!==null?t:e!==void 0?e:{}}});var s0=H(F4=>{"use strict";E();var{fromCallback:NN}=Qx(),dc=uu(),{getOptions:qN,getCallback:Ude}=q4(),Ly=Symbol("promise"),_w=Symbol("callback"),Dl=Symbol("working"),Uy=Symbol("handleOne"),fh=Symbol("handleMany"),$N=Symbol("autoClose"),i0=Symbol("finishWork"),Cl=Symbol("returnMany"),t0=Symbol("closing"),Xx=Symbol("handleClose"),$4=Symbol("closed"),e3=Symbol("closeCallbacks"),n0=Symbol("keyEncoding"),Fy=Symbol("valueEncoding"),LN=Symbol("abortOnClose"),L4=Symbol("legacy"),UN=Symbol("keys"),FN=Symbol("values"),r0=Symbol("limit"),cf=Symbol("count"),U4=Object.freeze({}),xGe=()=>{},Fde=!1,t3=class{constructor(e,r,n){if(typeof e!="object"||e===null){let i=e===null?"null":typeof e;throw new TypeError(`The first argument must be an abstract-level database, received ${i}`)}if(typeof r!="object"||r===null)throw new TypeError("The second argument must be an options object");this[$4]=!1,this[e3]=[],this[Dl]=!1,this[t0]=!1,this[$N]=!1,this[_w]=null,this[Uy]=this[Uy].bind(this),this[fh]=this[fh].bind(this),this[Xx]=this[Xx].bind(this),this[n0]=r[n0],this[Fy]=r[Fy],this[L4]=n,this[r0]=Number.isInteger(r.limit)&&r.limit>=0?r.limit:1/0,this[cf]=0,this[LN]=!!r.abortOnClose,this.db=e,this.db.attachResource(this),this.nextTick=e.nextTick}get count(){return this[cf]}get limit(){return this[r0]}next(e){let r;if(e===void 0)r=new Promise((n,i)=>{e=(o,s,a)=>{o?i(o):this[L4]?s===void 0&&a===void 0?n():n([s,a]):n(s)}});else if(typeof e!="function")throw new TypeError("Callback must be a function");return this[t0]?this.nextTick(e,new dc("Iterator is not open: cannot call next() after close()",{code:"LEVEL_ITERATOR_NOT_OPEN"})):this[Dl]?this.nextTick(e,new dc("Iterator is busy: cannot call next() until previous call has completed",{code:"LEVEL_ITERATOR_BUSY"})):(this[Dl]=!0,this[_w]=e,this[cf]>=this[r0]?this.nextTick(this[Uy],null):this._next(this[Uy])),r}_next(e){this.nextTick(e)}nextv(e,r,n){return n=Ude(r,n),n=NN(n,Ly),r=qN(r,U4),Number.isInteger(e)?(this[t0]?this.nextTick(n,new dc("Iterator is not open: cannot call nextv() after close()",{code:"LEVEL_ITERATOR_NOT_OPEN"})):this[Dl]?this.nextTick(n,new dc("Iterator is busy: cannot call nextv() until previous call has completed",{code:"LEVEL_ITERATOR_BUSY"})):(e<1&&(e=1),this[r0]<1/0&&(e=Math.min(e,this[r0]-this[cf])),this[Dl]=!0,this[_w]=n,e<=0?this.nextTick(this[fh],null,[]):this._nextv(e,r,this[fh])),n[Ly]):(this.nextTick(n,new TypeError("The first argument 'size' must be an integer")),n[Ly])}_nextv(e,r,n){let i=[],o=(s,a,d)=>{if(s)return n(s);if(this[L4]?a===void 0&&d===void 0:a===void 0)return n(null,i);i.push(this[L4]?[a,d]:a),i.length===e?n(null,i):this._next(o)};this._next(o)}all(e,r){return r=Ude(e,r),r=NN(r,Ly),e=qN(e,U4),this[t0]?this.nextTick(r,new dc("Iterator is not open: cannot call all() after close()",{code:"LEVEL_ITERATOR_NOT_OPEN"})):this[Dl]?this.nextTick(r,new dc("Iterator is busy: cannot call all() until previous call has completed",{code:"LEVEL_ITERATOR_BUSY"})):(this[Dl]=!0,this[_w]=r,this[$N]=!0,this[cf]>=this[r0]?this.nextTick(this[fh],null,[]):this._all(e,this[fh])),r[Ly]}_all(e,r){let n=this[cf],i=[],o=()=>{let a=this[r0]<1/0?Math.min(1e3,this[r0]-n):1e3;a<=0?this.nextTick(r,null,i):this._nextv(a,U4,s)},s=(a,d)=>{a?r(a):d.length===0?r(null,i):(i.push.apply(i,d),n+=d.length,o())};o()}[i0](){let e=this[_w];return this[LN]&&e===null?xGe:(this[Dl]=!1,this[_w]=null,this[t0]&&this._close(this[Xx]),e)}[Cl](e,r,n){this[$N]?this.close(e.bind(null,r,n)):e(r,n)}seek(e,r){if(r=qN(r,U4),!this[t0]){if(this[Dl])throw new dc("Iterator is busy: cannot call seek() until next() has completed",{code:"LEVEL_ITERATOR_BUSY"});{let n=this.db.keyEncoding(r.keyEncoding||this[n0]),i=n.format;r.keyEncoding!==i&&(r={...r,keyEncoding:i});let o=this.db.prefixKey(n.encode(e),i);this._seek(o,r)}}}_seek(e,r){throw new dc("Iterator does not support seek()",{code:"LEVEL_NOT_SUPPORTED"})}close(e){return e=NN(e,Ly),this[$4]?this.nextTick(e):this[t0]?this[e3].push(e):(this[t0]=!0,this[e3].push(e),this[Dl]?this[LN]&&this[i0]()(new dc("Aborted on iterator close()",{code:"LEVEL_ITERATOR_NOT_OPEN"})):this._close(this[Xx])),e[Ly]}_close(e){this.nextTick(e)}[Xx](){this[$4]=!0,this.db.detachResource(this);let e=this[e3];this[e3]=[];for(let r of e)r()}async*[Symbol.asyncIterator](){try{let e;for(;(e=await this.next())!==void 0;)yield e}finally{this[$4]||await this.close()}}},xw=class extends t3{constructor(e,r){super(e,r,!0),this[UN]=r.keys!==!1,this[FN]=r.values!==!1}[Uy](e,r,n){let i=this[i0]();if(e)return i(e);try{r=this[UN]&&r!==void 0?this[n0].decode(r):void 0,n=this[FN]&&n!==void 0?this[Fy].decode(n):void 0}catch(o){return i(new o0("entry",o))}r===void 0&&n===void 0||this[cf]++,i(null,r,n)}[fh](e,r){let n=this[i0]();if(e)return this[Cl](n,e);try{for(let i of r){let o=i[0],s=i[1];i[0]=this[UN]&&o!==void 0?this[n0].decode(o):void 0,i[1]=this[FN]&&s!==void 0?this[Fy].decode(s):void 0}}catch(i){return this[Cl](n,new o0("entries",i))}this[cf]+=r.length,this[Cl](n,null,r)}end(e){return!Fde&&typeof console<"u"&&(Fde=!0,console.warn(new dc("The iterator.end() method was renamed to close() and end() is an alias that will be removed in a future version",{code:"LEVEL_LEGACY"}))),this.close(e)}},zN=class extends t3{constructor(e,r){super(e,r,!1)}[Uy](e,r){let n=this[i0]();if(e)return n(e);try{r=r!==void 0?this[n0].decode(r):void 0}catch(i){return n(new o0("key",i))}r!==void 0&&this[cf]++,n(null,r)}[fh](e,r){let n=this[i0]();if(e)return this[Cl](n,e);try{for(let i=0;i<r.length;i++){let o=r[i];r[i]=o!==void 0?this[n0].decode(o):void 0}}catch(i){return this[Cl](n,new o0("keys",i))}this[cf]+=r.length,this[Cl](n,null,r)}},KN=class extends t3{constructor(e,r){super(e,r,!1)}[Uy](e,r){let n=this[i0]();if(e)return n(e);try{r=r!==void 0?this[Fy].decode(r):void 0}catch(i){return n(new o0("value",i))}r!==void 0&&this[cf]++,n(null,r)}[fh](e,r){let n=this[i0]();if(e)return this[Cl](n,e);try{for(let i=0;i<r.length;i++){let o=r[i];r[i]=o!==void 0?this[Fy].decode(o):void 0}}catch(i){return this[Cl](n,new o0("values",i))}this[cf]+=r.length,this[Cl](n,null,r)}},o0=class extends dc{constructor(e,r){super(`Iterator could not decode ${e}`,{code:"LEVEL_DECODE_ERROR",cause:r})}};for(let t of["_ended property","_nexting property","_end method"])Object.defineProperty(xw.prototype,t.split(" ")[0],{get(){throw new dc(`The ${t} has been removed`,{code:"LEVEL_LEGACY"})},set(){throw new dc(`The ${t} has been removed`,{code:"LEVEL_LEGACY"})}});xw.keyEncoding=n0;xw.valueEncoding=Fy;F4.AbstractIterator=xw;F4.AbstractKeyIterator=zN;F4.AbstractValueIterator=KN});var zde=H(GN=>{"use strict";E();var{AbstractKeyIterator:EGe,AbstractValueIterator:SGe}=s0(),zy=Symbol("iterator"),r3=Symbol("callback"),Ew=Symbol("handleOne"),Ky=Symbol("handleMany"),n3=class extends EGe{constructor(e,r){super(e,r),this[zy]=e.iterator({...r,keys:!0,values:!1}),this[Ew]=this[Ew].bind(this),this[Ky]=this[Ky].bind(this)}},z4=class extends SGe{constructor(e,r){super(e,r),this[zy]=e.iterator({...r,keys:!1,values:!0}),this[Ew]=this[Ew].bind(this),this[Ky]=this[Ky].bind(this)}};for(let t of[n3,z4]){let e=t===n3,r=e?n=>n[0]:n=>n[1];t.prototype._next=function(n){this[r3]=n,this[zy].next(this[Ew])},t.prototype[Ew]=function(n,i,o){let s=this[r3];n?s(n):s(null,e?i:o)},t.prototype._nextv=function(n,i,o){this[r3]=o,this[zy].nextv(n,i,this[Ky])},t.prototype._all=function(n,i){this[r3]=i,this[zy].all(n,this[Ky])},t.prototype[Ky]=function(n,i){let o=this[r3];n?o(n):o(null,i.map(r))},t.prototype._seek=function(n,i){this[zy].seek(n,i)},t.prototype._close=function(n){this[zy].close(n)}}GN.DefaultKeyIterator=n3;GN.DefaultValueIterator=z4});var Kde=H(Z4=>{"use strict";E();var{AbstractIterator:MGe,AbstractKeyIterator:PGe,AbstractValueIterator:AGe}=s0(),WN=uu(),Ca=Symbol("nut"),V4=Symbol("undefer"),H4=Symbol("factory"),K4=class extends MGe{constructor(e,r){super(e,r),this[Ca]=null,this[H4]=()=>e.iterator(r),this.db.defer(()=>this[V4]())}},G4=class extends PGe{constructor(e,r){super(e,r),this[Ca]=null,this[H4]=()=>e.keys(r),this.db.defer(()=>this[V4]())}},W4=class extends AGe{constructor(e,r){super(e,r),this[Ca]=null,this[H4]=()=>e.values(r),this.db.defer(()=>this[V4]())}};for(let t of[K4,G4,W4])t.prototype[V4]=function(){this.db.status==="open"&&(this[Ca]=this[H4]())},t.prototype._next=function(e){this[Ca]!==null?this[Ca].next(e):this.db.status==="opening"?this.db.defer(()=>this._next(e)):this.nextTick(e,new WN("Iterator is not open: cannot call next() after close()",{code:"LEVEL_ITERATOR_NOT_OPEN"}))},t.prototype._nextv=function(e,r,n){this[Ca]!==null?this[Ca].nextv(e,r,n):this.db.status==="opening"?this.db.defer(()=>this._nextv(e,r,n)):this.nextTick(n,new WN("Iterator is not open: cannot call nextv() after close()",{code:"LEVEL_ITERATOR_NOT_OPEN"}))},t.prototype._all=function(e,r){this[Ca]!==null?this[Ca].all(r):this.db.status==="opening"?this.db.defer(()=>this._all(e,r)):this.nextTick(r,new WN("Iterator is not open: cannot call all() after close()",{code:"LEVEL_ITERATOR_NOT_OPEN"}))},t.prototype._seek=function(e,r){this[Ca]!==null?this[Ca]._seek(e,r):this.db.status==="opening"&&this.db.defer(()=>this._seek(e,r))},t.prototype._close=function(e){this[Ca]!==null?this[Ca].close(e):this.db.status==="opening"?this.db.defer(()=>this._close(e)):this.nextTick(e)};Z4.DeferredIterator=K4;Z4.DeferredKeyIterator=G4;Z4.DeferredValueIterator=W4});var HN=H(Wde=>{"use strict";E();var{fromCallback:Gde}=Qx(),J4=uu(),{getCallback:TGe,getOptions:RGe}=q4(),Y4=Symbol("promise"),ff=Symbol("status"),Sw=Symbol("operations"),i3=Symbol("finishClose"),Mw=Symbol("closeCallbacks"),VN=class{constructor(e){if(typeof e!="object"||e===null){let r=e===null?"null":typeof e;throw new TypeError(`The first argument must be an abstract-level database, received ${r}`)}this[Sw]=[],this[Mw]=[],this[ff]="open",this[i3]=this[i3].bind(this),this.db=e,this.db.attachResource(this),this.nextTick=e.nextTick}get length(){return this[Sw].length}put(e,r,n){if(this[ff]!=="open")throw new J4("Batch is not open: cannot call put() after write() or close()",{code:"LEVEL_BATCH_NOT_OPEN"});let i=this.db._checkKey(e)||this.db._checkValue(r);if(i)throw i;let o=n&&n.sublevel!=null?n.sublevel:this.db,s=n,a=o.keyEncoding(n&&n.keyEncoding),d=o.valueEncoding(n&&n.valueEncoding),m=a.format;n={...n,keyEncoding:m,valueEncoding:d.format},o!==this.db&&(n.sublevel=null);let p=o.prefixKey(a.encode(e),m),w=d.encode(r);return this._put(p,w,n),this[Sw].push({...s,type:"put",key:e,value:r}),this}_put(e,r,n){}del(e,r){if(this[ff]!=="open")throw new J4("Batch is not open: cannot call del() after write() or close()",{code:"LEVEL_BATCH_NOT_OPEN"});let n=this.db._checkKey(e);if(n)throw n;let i=r&&r.sublevel!=null?r.sublevel:this.db,o=r,s=i.keyEncoding(r&&r.keyEncoding),a=s.format;return r={...r,keyEncoding:a},i!==this.db&&(r.sublevel=null),this._del(i.prefixKey(s.encode(e),a),r),this[Sw].push({...o,type:"del",key:e}),this}_del(e,r){}clear(){if(this[ff]!=="open")throw new J4("Batch is not open: cannot call clear() after write() or close()",{code:"LEVEL_BATCH_NOT_OPEN"});return this._clear(),this[Sw]=[],this}_clear(){}write(e,r){return r=TGe(e,r),r=Gde(r,Y4),e=RGe(e),this[ff]!=="open"?this.nextTick(r,new J4("Batch is not open: cannot call write() after write() or close()",{code:"LEVEL_BATCH_NOT_OPEN"})):this.length===0?this.close(r):(this[ff]="writing",this._write(e,n=>{this[ff]="closing",this[Mw].push(()=>r(n)),n||this.db.emit("batch",this[Sw]),this._close(this[i3])})),r[Y4]}_write(e,r){}close(e){return e=Gde(e,Y4),this[ff]==="closing"?this[Mw].push(e):this[ff]==="closed"?this.nextTick(e):(this[Mw].push(e),this[ff]!=="writing"&&(this[ff]="closing",this._close(this[i3]))),e[Y4]}_close(e){this.nextTick(e)}[i3](){this[ff]="closed",this.db.detachResource(this);let e=this[Mw];this[Mw]=[];for(let r of e)r()}};Wde.AbstractChainedBatch=VN});var Hde=H(Vde=>{"use strict";E();var{AbstractChainedBatch:IGe}=HN(),kGe=uu(),Pw=Symbol("encoded"),ZN=class extends IGe{constructor(e){super(e),this[Pw]=[]}_put(e,r,n){this[Pw].push({...n,type:"put",key:e,value:r})}_del(e,r){this[Pw].push({...r,type:"del",key:e})}_clear(){this[Pw]=[]}_write(e,r){this.db.status==="opening"?this.db.defer(()=>this._write(e,r)):this.db.status==="open"?this[Pw].length===0?this.nextTick(r):this.db._batch(this[Pw],e,r):this.nextTick(r,new kGe("Batch is not open: cannot call write() after write() or close()",{code:"LEVEL_BATCH_NOT_OPEN"}))}};Vde.DefaultChainedBatch=ZN});var Yde=H((R8t,Jde)=>{"use strict";E();var Zde=uu(),OGe=Object.prototype.hasOwnProperty,BGe=new Set(["lt","lte","gt","gte"]);Jde.exports=function(t,e){let r={};for(let n in t)if(OGe.call(t,n)&&!(n==="keyEncoding"||n==="valueEncoding")){if(n==="start"||n==="end")throw new Zde(`The legacy range option '${n}' has been removed`,{code:"LEVEL_LEGACY"});if(n==="encoding")throw new Zde("The levelup-style 'encoding' alias has been removed, use 'valueEncoding' instead",{code:"LEVEL_LEGACY"});BGe.has(n)?r[n]=e.encode(t[n]):r[n]=t[n]}return r.reverse=!!r.reverse,r.limit=Number.isInteger(r.limit)&&r.limit>=0?r.limit:-1,r}});var JN=H((k8t,Xde)=>{E();var Qde;Xde.exports=typeof queueMicrotask=="function"?queueMicrotask.bind(typeof window<"u"?window:globalThis):t=>(Qde||(Qde=Promise.resolve())).then(t).catch(e=>setTimeout(()=>{throw e},0))});var rhe=H((B8t,the)=>{"use strict";E();var ehe=JN();the.exports=function(t,...e){e.length===0?ehe(t):ehe(()=>t(...e))}});var nhe=H(Q4=>{"use strict";E();var{AbstractIterator:DGe,AbstractKeyIterator:CGe,AbstractValueIterator:jGe}=s0(),Aw=Symbol("unfix"),lu=Symbol("iterator"),Gy=Symbol("handleOne"),a0=Symbol("handleMany"),uh=Symbol("callback"),o3=class extends DGe{constructor(e,r,n,i){super(e,r),this[lu]=n,this[Aw]=i,this[Gy]=this[Gy].bind(this),this[a0]=this[a0].bind(this),this[uh]=null}[Gy](e,r,n){let i=this[uh];if(e)return i(e);r!==void 0&&(r=this[Aw](r)),i(e,r,n)}[a0](e,r){let n=this[uh];if(e)return n(e);for(let i of r){let o=i[0];o!==void 0&&(i[0]=this[Aw](o))}n(e,r)}},s3=class extends CGe{constructor(e,r,n,i){super(e,r),this[lu]=n,this[Aw]=i,this[Gy]=this[Gy].bind(this),this[a0]=this[a0].bind(this),this[uh]=null}[Gy](e,r){let n=this[uh];if(e)return n(e);r!==void 0&&(r=this[Aw](r)),n(e,r)}[a0](e,r){let n=this[uh];if(e)return n(e);for(let i=0;i<r.length;i++){let o=r[i];o!==void 0&&(r[i]=this[Aw](o))}n(e,r)}},a3=class extends jGe{constructor(e,r,n){super(e,r),this[lu]=n}};for(let t of[o3,s3])t.prototype._next=function(e){this[uh]=e,this[lu].next(this[Gy])},t.prototype._nextv=function(e,r,n){this[uh]=n,this[lu].nextv(e,r,this[a0])},t.prototype._all=function(e,r){this[uh]=r,this[lu].all(e,this[a0])};for(let t of[a3])t.prototype._next=function(e){this[lu].next(e)},t.prototype._nextv=function(e,r,n){this[lu].nextv(e,r,n)},t.prototype._all=function(e,r){this[lu].all(e,r)};for(let t of[o3,s3,a3])t.prototype._seek=function(e,r){this[lu].seek(e,r)},t.prototype._close=function(e){this[lu].close(e)};Q4.AbstractSublevelIterator=o3;Q4.AbstractSublevelKeyIterator=s3;Q4.AbstractSublevelValueIterator=a3});var ahe=H((N8t,she)=>{"use strict";E();var YN=uu(),{Buffer:eq}=sr()||{},{AbstractSublevelIterator:NGe,AbstractSublevelKeyIterator:qGe,AbstractSublevelValueIterator:$Ge}=nhe(),lh=Symbol("prefix"),ihe=Symbol("upperBound"),c3=Symbol("prefixRange"),hc=Symbol("parent"),QN=Symbol("unfix"),ohe=new TextEncoder,LGe={separator:"!"};she.exports=function({AbstractLevel:t}){class e extends t{static defaults(n){if(typeof n=="string")throw new YN("The subleveldown string shorthand for { separator } has been removed",{code:"LEVEL_LEGACY"});if(n&&n.open)throw new YN("The subleveldown open option has been removed",{code:"LEVEL_LEGACY"});return n==null?LGe:n.separator?n:{...n,separator:"!"}}constructor(n,i,o){let{separator:s,manifest:a,...d}=e.defaults(o);i=FGe(i,s);let m=s.charCodeAt(0)+1,p=n[hc]||n;if(!ohe.encode(i).every(S=>S>m&&S<127))throw new YN(`Prefix must use bytes > ${m} < ${127}`,{code:"LEVEL_INVALID_PREFIX"});super(UGe(p,a),d);let w=(n.prefix||"")+s+i+s,P=w.slice(0,-1)+String.fromCharCode(m);this[hc]=p,this[lh]=new X4(w),this[ihe]=new X4(P),this[QN]=new tq,this.nextTick=p.nextTick}prefixKey(n,i){if(i==="utf8")return this[lh].utf8+n;if(n.byteLength===0)return this[lh][i];if(i==="view"){let o=this[lh].view,s=new Uint8Array(o.byteLength+n.byteLength);return s.set(o,0),s.set(n,o.byteLength),s}else{let o=this[lh].buffer;return eq.concat([o,n],o.byteLength+n.byteLength)}}[c3](n,i){n.gte!==void 0?n.gte=this.prefixKey(n.gte,i):n.gt!==void 0?n.gt=this.prefixKey(n.gt,i):n.gte=this[lh][i],n.lte!==void 0?n.lte=this.prefixKey(n.lte,i):n.lt!==void 0?n.lt=this.prefixKey(n.lt,i):n.lte=this[ihe][i]}get prefix(){return this[lh].utf8}get db(){return this[hc]}_open(n,i){this[hc].open({passive:!0},i)}_put(n,i,o,s){this[hc].put(n,i,o,s)}_get(n,i,o){this[hc].get(n,i,o)}_getMany(n,i,o){this[hc].getMany(n,i,o)}_del(n,i,o){this[hc].del(n,i,o)}_batch(n,i,o){this[hc].batch(n,i,o)}_clear(n,i){this[c3](n,n.keyEncoding),this[hc].clear(n,i)}_iterator(n){this[c3](n,n.keyEncoding);let i=this[hc].iterator(n),o=this[QN].get(this[lh].utf8.length,n.keyEncoding);return new NGe(this,n,i,o)}_keys(n){this[c3](n,n.keyEncoding);let i=this[hc].keys(n),o=this[QN].get(this[lh].utf8.length,n.keyEncoding);return new qGe(this,n,i,o)}_values(n){this[c3](n,n.keyEncoding);let i=this[hc].values(n);return new $Ge(this,n,i)}}return{AbstractSublevel:e}};var UGe=function(t,e){return{...t.supports,createIfMissing:!1,errorIfExists:!1,events:{},additionalMethods:{},...e,encodings:{utf8:XN(t,"utf8"),buffer:XN(t,"buffer"),view:XN(t,"view")}}},XN=function(t,e){return t.supports.encodings[e]?t.keyEncoding(e).name===e:!1},X4=class{constructor(e){this.utf8=e,this.view=ohe.encode(e),this.buffer=eq?eq.from(this.view.buffer,0,this.view.byteLength):{}}},tq=class{constructor(){this.cache=new Map}get(e,r){let n=this.cache.get(r);return n===void 0&&(r==="view"?n=function(i,o){return o.subarray(i)}.bind(null,e):n=function(i,o){return o.slice(i)}.bind(null,e),this.cache.set(r,n)),n}},FGe=function(t,e){let r=0,n=t.length;for(;r<n&&t[r]===e;)r++;for(;n>r&&t[n-1]===e;)n--;return t.slice(r,n)}});var sq=H(oq=>{"use strict";E();var{supports:zGe}=Ade(),{Transcoder:KGe}=Nde(),{EventEmitter:GGe}=Go(),{fromCallback:c0}=Qx(),du=uu(),{AbstractIterator:Wy}=s0(),{DefaultKeyIterator:WGe,DefaultValueIterator:VGe}=zde(),{DeferredIterator:HGe,DeferredKeyIterator:ZGe,DeferredValueIterator:JGe}=Kde(),{DefaultChainedBatch:che}=Hde(),{getCallback:Vy,getOptions:f0}=q4(),eP=Yde(),vr=Symbol("promise"),dh=Symbol("landed"),Hy=Symbol("resources"),rq=Symbol("closeResources"),f3=Symbol("operations"),u3=Symbol("undefer"),tP=Symbol("deferOpen"),fhe=Symbol("options"),Cr=Symbol("status"),Zy=Symbol("defaultOptions"),Tw=Symbol("transcoder"),rP=Symbol("keyEncoding"),nq=Symbol("valueEncoding"),YGe=()=>{},l3=class extends GGe{constructor(e,r){if(super(),typeof e!="object"||e===null)throw new TypeError("The first argument 'manifest' must be an object");r=f0(r);let{keyEncoding:n,valueEncoding:i,passive:o,...s}=r;this[Hy]=new Set,this[f3]=[],this[tP]=!0,this[fhe]=s,this[Cr]="opening",this.supports=zGe(e,{status:!0,promises:!0,clear:!0,getMany:!0,deferredOpen:!0,snapshots:e.snapshots!==!1,permanence:e.permanence!==!1,keyIterator:!0,valueIterator:!0,iteratorNextv:!0,iteratorAll:!0,encodings:e.encodings||{},events:Object.assign({},e.events,{opening:!0,open:!0,closing:!0,closed:!0,put:!0,del:!0,batch:!0,clear:!0})}),this[Tw]=new KGe(QGe(this)),this[rP]=this[Tw].encoding(n||"utf8"),this[nq]=this[Tw].encoding(i||"utf8");for(let a of this[Tw].encodings())this.supports.encodings[a.commonName]||(this.supports.encodings[a.commonName]=!0);this[Zy]={empty:Object.freeze({}),entry:Object.freeze({keyEncoding:this[rP].commonName,valueEncoding:this[nq].commonName}),key:Object.freeze({keyEncoding:this[rP].commonName})},this.nextTick(()=>{this[tP]&&this.open({passive:!1},YGe)})}get status(){return this[Cr]}keyEncoding(e){return this[Tw].encoding(e??this[rP])}valueEncoding(e){return this[Tw].encoding(e??this[nq])}open(e,r){r=Vy(e,r),r=c0(r,vr),e={...this[fhe],...f0(e)},e.createIfMissing=e.createIfMissing!==!1,e.errorIfExists=!!e.errorIfExists;let n=i=>{this[Cr]==="closing"||this[Cr]==="opening"?this.once(dh,i?()=>n(i):n):this[Cr]!=="open"?r(new du("Database is not open",{code:"LEVEL_DATABASE_NOT_OPEN",cause:i})):r()};return e.passive?this[Cr]==="opening"?this.once(dh,n):this.nextTick(n):this[Cr]==="closed"||this[tP]?(this[tP]=!1,this[Cr]="opening",this.emit("opening"),this._open(e,i=>{if(i){this[Cr]="closed",this[rq](()=>{this.emit(dh),n(i)}),this[u3]();return}this[Cr]="open",this[u3](),this.emit(dh),this[Cr]==="open"&&this.emit("open"),this[Cr]==="open"&&this.emit("ready"),n()})):this[Cr]==="open"?this.nextTick(n):this.once(dh,()=>this.open(e,r)),r[vr]}_open(e,r){this.nextTick(r)}close(e){e=c0(e,vr);let r=n=>{this[Cr]==="opening"||this[Cr]==="closing"?this.once(dh,n?r(n):r):this[Cr]!=="closed"?e(new du("Database is not closed",{code:"LEVEL_DATABASE_NOT_CLOSED",cause:n})):e()};if(this[Cr]==="open"){this[Cr]="closing",this.emit("closing");let n=i=>{this[Cr]="open",this[u3](),this.emit(dh),r(i)};this[rq](()=>{this._close(i=>{if(i)return n(i);this[Cr]="closed",this[u3](),this.emit(dh),this[Cr]==="closed"&&this.emit("closed"),r()})})}else this[Cr]==="closed"?this.nextTick(r):this.once(dh,()=>this.close(e));return e[vr]}[rq](e){if(this[Hy].size===0)return this.nextTick(e);let r=this[Hy].size,n=!0,i=()=>{--r===0&&(n?this.nextTick(e):e())};for(let o of this[Hy])o.close(i);n=!1,this[Hy].clear()}_close(e){this.nextTick(e)}get(e,r,n){if(n=Vy(r,n),n=c0(n,vr),r=f0(r,this[Zy].entry),this[Cr]==="opening")return this.defer(()=>this.get(e,r,n)),n[vr];if(Rw(this,n))return n[vr];let i=this._checkKey(e);if(i)return this.nextTick(n,i),n[vr];let o=this.keyEncoding(r.keyEncoding),s=this.valueEncoding(r.valueEncoding),a=o.format,d=s.format;return(r.keyEncoding!==a||r.valueEncoding!==d)&&(r=Object.assign({},r,{keyEncoding:a,valueEncoding:d})),this._get(this.prefixKey(o.encode(e),a),r,(m,p)=>{if(m)return(m.code==="LEVEL_NOT_FOUND"||m.notFound||/NotFound/i.test(m))&&(m.code||(m.code="LEVEL_NOT_FOUND"),m.notFound||(m.notFound=!0),m.status||(m.status=404)),n(m);try{p=s.decode(p)}catch(w){return n(new du("Could not decode value",{code:"LEVEL_DECODE_ERROR",cause:w}))}n(null,p)}),n[vr]}_get(e,r,n){this.nextTick(n,new Error("NotFound"))}getMany(e,r,n){if(n=Vy(r,n),n=c0(n,vr),r=f0(r,this[Zy].entry),this[Cr]==="opening")return this.defer(()=>this.getMany(e,r,n)),n[vr];if(Rw(this,n))return n[vr];if(!Array.isArray(e))return this.nextTick(n,new TypeError("The first argument 'keys' must be an array")),n[vr];if(e.length===0)return this.nextTick(n,null,[]),n[vr];let i=this.keyEncoding(r.keyEncoding),o=this.valueEncoding(r.valueEncoding),s=i.format,a=o.format;(r.keyEncoding!==s||r.valueEncoding!==a)&&(r=Object.assign({},r,{keyEncoding:s,valueEncoding:a}));let d=new Array(e.length);for(let m=0;m<e.length;m++){let p=e[m],w=this._checkKey(p);if(w)return this.nextTick(n,w),n[vr];d[m]=this.prefixKey(i.encode(p),s)}return this._getMany(d,r,(m,p)=>{if(m)return n(m);try{for(let w=0;w<p.length;w++)p[w]!==void 0&&(p[w]=o.decode(p[w]))}catch(w){return n(new du(`Could not decode one or more of ${p.length} value(s)`,{code:"LEVEL_DECODE_ERROR",cause:w}))}n(null,p)}),n[vr]}_getMany(e,r,n){this.nextTick(n,null,new Array(e.length).fill(void 0))}put(e,r,n,i){if(i=Vy(n,i),i=c0(i,vr),n=f0(n,this[Zy].entry),this[Cr]==="opening")return this.defer(()=>this.put(e,r,n,i)),i[vr];if(Rw(this,i))return i[vr];let o=this._checkKey(e)||this._checkValue(r);if(o)return this.nextTick(i,o),i[vr];let s=this.keyEncoding(n.keyEncoding),a=this.valueEncoding(n.valueEncoding),d=s.format,m=a.format;(n.keyEncoding!==d||n.valueEncoding!==m)&&(n=Object.assign({},n,{keyEncoding:d,valueEncoding:m}));let p=this.prefixKey(s.encode(e),d),w=a.encode(r);return this._put(p,w,n,P=>{if(P)return i(P);this.emit("put",e,r),i()}),i[vr]}_put(e,r,n,i){this.nextTick(i)}del(e,r,n){if(n=Vy(r,n),n=c0(n,vr),r=f0(r,this[Zy].key),this[Cr]==="opening")return this.defer(()=>this.del(e,r,n)),n[vr];if(Rw(this,n))return n[vr];let i=this._checkKey(e);if(i)return this.nextTick(n,i),n[vr];let o=this.keyEncoding(r.keyEncoding),s=o.format;return r.keyEncoding!==s&&(r=Object.assign({},r,{keyEncoding:s})),this._del(this.prefixKey(o.encode(e),s),r,a=>{if(a)return n(a);this.emit("del",e),n()}),n[vr]}_del(e,r,n){this.nextTick(n)}batch(e,r,n){if(!arguments.length){if(this[Cr]==="opening")return new che(this);if(this[Cr]!=="open")throw new du("Database is not open",{code:"LEVEL_DATABASE_NOT_OPEN"});return this._chainedBatch()}if(typeof e=="function"?n=e:n=Vy(r,n),n=c0(n,vr),r=f0(r,this[Zy].empty),this[Cr]==="opening")return this.defer(()=>this.batch(e,r,n)),n[vr];if(Rw(this,n))return n[vr];if(!Array.isArray(e))return this.nextTick(n,new TypeError("The first argument 'operations' must be an array")),n[vr];if(e.length===0)return this.nextTick(n),n[vr];let i=new Array(e.length),{keyEncoding:o,valueEncoding:s,...a}=r;for(let d=0;d<e.length;d++){if(typeof e[d]!="object"||e[d]===null)return this.nextTick(n,new TypeError("A batch operation must be an object")),n[vr];let m=Object.assign({},e[d]);if(m.type!=="put"&&m.type!=="del")return this.nextTick(n,new TypeError("A batch operation must have a type property that is 'put' or 'del'")),n[vr];let p=this._checkKey(m.key);if(p)return this.nextTick(n,p),n[vr];let w=m.sublevel!=null?m.sublevel:this,P=w.keyEncoding(m.keyEncoding||o),S=P.format;if(m.key=w.prefixKey(P.encode(m.key),S),m.keyEncoding=S,m.type==="put"){let M=this._checkValue(m.value);if(M)return this.nextTick(n,M),n[vr];let A=w.valueEncoding(m.valueEncoding||s);m.value=A.encode(m.value),m.valueEncoding=A.format}w!==this&&(m.sublevel=null),i[d]=m}return this._batch(i,a,d=>{if(d)return n(d);this.emit("batch",e),n()}),n[vr]}_batch(e,r,n){this.nextTick(n)}sublevel(e,r){return this._sublevel(e,iq.defaults(r))}_sublevel(e,r){return new iq(this,e,r)}prefixKey(e,r){return e}clear(e,r){if(r=Vy(e,r),r=c0(r,vr),e=f0(e,this[Zy].empty),this[Cr]==="opening")return this.defer(()=>this.clear(e,r)),r[vr];if(Rw(this,r))return r[vr];let n=e,i=this.keyEncoding(e.keyEncoding);return e=eP(e,i),e.keyEncoding=i.format,e.limit===0?this.nextTick(r):this._clear(e,o=>{if(o)return r(o);this.emit("clear",n),r()}),r[vr]}_clear(e,r){this.nextTick(r)}iterator(e){let r=this.keyEncoding(e&&e.keyEncoding),n=this.valueEncoding(e&&e.valueEncoding);if(e=eP(e,r),e.keys=e.keys!==!1,e.values=e.values!==!1,e[Wy.keyEncoding]=r,e[Wy.valueEncoding]=n,e.keyEncoding=r.format,e.valueEncoding=n.format,this[Cr]==="opening")return new HGe(this,e);if(this[Cr]!=="open")throw new du("Database is not open",{code:"LEVEL_DATABASE_NOT_OPEN"});return this._iterator(e)}_iterator(e){return new Wy(this,e)}keys(e){let r=this.keyEncoding(e&&e.keyEncoding),n=this.valueEncoding(e&&e.valueEncoding);if(e=eP(e,r),e[Wy.keyEncoding]=r,e[Wy.valueEncoding]=n,e.keyEncoding=r.format,e.valueEncoding=n.format,this[Cr]==="opening")return new ZGe(this,e);if(this[Cr]!=="open")throw new du("Database is not open",{code:"LEVEL_DATABASE_NOT_OPEN"});return this._keys(e)}_keys(e){return new WGe(this,e)}values(e){let r=this.keyEncoding(e&&e.keyEncoding),n=this.valueEncoding(e&&e.valueEncoding);if(e=eP(e,r),e[Wy.keyEncoding]=r,e[Wy.valueEncoding]=n,e.keyEncoding=r.format,e.valueEncoding=n.format,this[Cr]==="opening")return new JGe(this,e);if(this[Cr]!=="open")throw new du("Database is not open",{code:"LEVEL_DATABASE_NOT_OPEN"});return this._values(e)}_values(e){return new VGe(this,e)}defer(e){if(typeof e!="function")throw new TypeError("The first argument must be a function");this[f3].push(e)}[u3](){if(this[f3].length===0)return;let e=this[f3];this[f3]=[];for(let r of e)r()}attachResource(e){if(typeof e!="object"||e===null||typeof e.close!="function")throw new TypeError("The first argument must be a resource object");this[Hy].add(e)}detachResource(e){this[Hy].delete(e)}_chainedBatch(){return new che(this)}_checkKey(e){if(e==null)return new du("Key cannot be null or undefined",{code:"LEVEL_INVALID_KEY"})}_checkValue(e){if(e==null)return new du("Value cannot be null or undefined",{code:"LEVEL_INVALID_VALUE"})}};l3.prototype.nextTick=rhe();var{AbstractSublevel:iq}=ahe()({AbstractLevel:l3});oq.AbstractLevel=l3;oq.AbstractSublevel=iq;var Rw=function(t,e){return t[Cr]!=="open"?(t.nextTick(e,new du("Database is not open",{code:"LEVEL_DATABASE_NOT_OPEN"})),!0):!1},QGe=function(t){return Object.keys(t.supports.encodings).filter(e=>!!t.supports.encodings[e])}});var aq=H(Jy=>{"use strict";E();Jy.AbstractLevel=sq().AbstractLevel;Jy.AbstractSublevel=sq().AbstractSublevel;Jy.AbstractIterator=s0().AbstractIterator;Jy.AbstractKeyIterator=s0().AbstractKeyIterator;Jy.AbstractValueIterator=s0().AbstractValueIterator;Jy.AbstractChainedBatch=HN().AbstractChainedBatch});var lhe=H((z8t,uhe)=>{E();uhe.exports=eWe;var XGe=JN();function eWe(t,e,r){if(typeof e!="number")throw new Error("second argument must be a Number");let n,i,o,s,a,d=!0,m;Array.isArray(t)?(n=[],o=i=t.length):(s=Object.keys(t),n={},o=i=s.length);function p(P){function S(){r&&r(P,n),r=null}d?XGe(S):S()}function w(P,S,M){if(n[P]=M,S&&(a=!0),--o===0||S)p(S);else if(!a&&m<i){let A;s?(A=s[m],m+=1,t[A](function(B,I){w(A,B,I)})):(A=m,m+=1,t[A](function(B,I){w(A,B,I)}))}}m=e,o?s?s.some(function(P,S){return t[P](function(M,A){w(P,M,A)}),S===e-1}):t.some(function(P,S){return P(function(M,A){w(S,M,A)}),S===e-1}):p(null),d=!1}});var cq=H((G8t,dhe)=>{"use strict";E();dhe.exports=function(e){let r=e.gte!==void 0?e.gte:e.gt!==void 0?e.gt:void 0,n=e.lte!==void 0?e.lte:e.lt!==void 0?e.lt:void 0,i=e.gte===void 0,o=e.lte===void 0;return r!==void 0&&n!==void 0?IDBKeyRange.bound(r,n,i,o):r!==void 0?IDBKeyRange.lowerBound(r,i):n!==void 0?IDBKeyRange.upperBound(n,o):null}});var fq=H((V8t,hhe)=>{"use strict";E();var tWe=new TextEncoder;hhe.exports=function(t){return t instanceof Uint8Array?t:t instanceof ArrayBuffer?new Uint8Array(t):tWe.encode(t)}});var vhe=H(ghe=>{"use strict";E();var{AbstractIterator:rWe}=aq(),phe=cq(),nP=fq(),jl=Symbol("cache"),hh=Symbol("finished"),pc=Symbol("options"),ph=Symbol("currentOptions"),Yy=Symbol("position"),uq=Symbol("location"),Iw=Symbol("first"),mhe={},lq=class extends rWe{constructor(e,r,n){super(e,n),this[jl]=[],this[hh]=this.limit===0,this[pc]=n,this[ph]={...n},this[Yy]=void 0,this[uq]=r,this[Iw]=!0}_nextv(e,r,n){if(this[Iw]=!1,this[hh])return this.nextTick(n,null,[]);if(this[jl].length>0)return e=Math.min(e,this[jl].length),this.nextTick(n,null,this[jl].splice(0,e));this[Yy]!==void 0&&(this[pc].reverse?(this[ph].lt=this[Yy],this[ph].lte=void 0):(this[ph].gt=this[Yy],this[ph].gte=void 0));let i;try{i=phe(this[ph])}catch{return this[hh]=!0,this.nextTick(n,null,[])}let o=this.db.db.transaction([this[uq]],"readonly"),s=o.objectStore(this[uq]),a=[];if(this[pc].reverse){let d=!this[pc].values&&s.openKeyCursor?"openKeyCursor":"openCursor";s[d](i,"prev").onsuccess=m=>{let p=m.target.result;if(p){let{key:w,value:P}=p;this[Yy]=w,a.push([this[pc].keys&&w!==void 0?nP(w):void 0,this[pc].values&&P!==void 0?nP(P):void 0]),a.length<e?p.continue():yhe(o)}else this[hh]=!0}}else{let d,m,p=()=>{if(d===void 0||m===void 0)return;let w=Math.max(d.length,m.length);w===0||e===1/0?this[hh]=!0:this[Yy]=d[w-1],a.length=w;for(let P=0;P<w;P++){let S=d[P],M=m[P];a[P]=[this[pc].keys&&S!==void 0?nP(S):void 0,this[pc].values&&M!==void 0?nP(M):void 0]}yhe(o)};this[pc].keys||e<1/0?s.getAllKeys(i,e<1/0?e:void 0).onsuccess=w=>{d=w.target.result,p()}:(d=[],this.nextTick(p)),this[pc].values?s.getAll(i,e<1/0?e:void 0).onsuccess=w=>{m=w.target.result,p()}:(m=[],this.nextTick(p))}o.onabort=()=>{n(o.error||new Error("aborted by user")),n=null},o.oncomplete=()=>{n(null,a),n=null}}_next(e){if(this[jl].length>0){let[r,n]=this[jl].shift();this.nextTick(e,null,r,n)}else if(this[hh])this.nextTick(e);else{let r=Math.min(100,this.limit-this.count);this[Iw]&&(this[Iw]=!1,r=1),this._nextv(r,mhe,(n,i)=>{if(n)return e(n);this[jl]=i,this._next(e)})}}_all(e,r){this[Iw]=!1;let n=this[jl].splice(0,this[jl].length),i=this.limit-this.count-n.length;if(i<=0)return this.nextTick(r,null,n);this._nextv(i,mhe,(o,s)=>{if(o)return r(o);n.length>0&&(s=n.concat(s)),r(null,s)})}_seek(e,r){this[Iw]=!0,this[jl]=[],this[hh]=!1,this[Yy]=void 0,this[ph]={...this[pc]};let n;try{n=phe(this[pc])}catch{this[hh]=!0;return}n!==null&&!n.includes(e)?this[hh]=!0:this[pc].reverse?this[ph].lte=e:this[ph].gte=e}};ghe.Iterator=lq;function yhe(t){typeof t.commit=="function"&&t.commit()}});var whe=H((Y8t,bhe)=>{"use strict";E();bhe.exports=function(e,r,n,i,o){if(i.limit===0)return e.nextTick(o);let s=e.db.transaction([r],"readwrite"),a=s.objectStore(r),d=0;s.oncomplete=function(){o()},s.onabort=function(){o(s.error||new Error("aborted by user"))};let m=a.openKeyCursor?"openKeyCursor":"openCursor",p=i.reverse?"prev":"next";a[m](n,p).onsuccess=function(w){let P=w.target.result;P&&(a.delete(P.key).onsuccess=function(){(i.limit<=0||++d<i.limit)&&P.continue()})}}});var pq=H(Mhe=>{"use strict";E();var{AbstractLevel:nWe}=aq(),_he=uu(),iWe=lhe(),{fromCallback:oWe}=Qx(),{Iterator:sWe}=vhe(),xhe=fq(),aWe=whe(),cWe=cq(),She="level-js-",d3=Symbol("idb"),dq=Symbol("namePrefix"),mh=Symbol("location"),hq=Symbol("version"),Qy=Symbol("store"),h3=Symbol("onComplete"),Ehe=Symbol("promise"),iP=class extends nWe{constructor(e,r,n){if(typeof r=="function"||typeof n=="function")throw new _he("The levelup-style callback argument has been removed",{code:"LEVEL_LEGACY"});let{prefix:i,version:o,...s}=r||{};if(super({encodings:{view:!0},snapshots:!1,createIfMissing:!1,errorIfExists:!1,seek:!0},s),typeof e!="string")throw new Error("constructor requires a location string argument");this[mh]=e,this[dq]=i??She,this[hq]=parseInt(o||1,10),this[d3]=null}get location(){return this[mh]}get namePrefix(){return this[dq]}get version(){return this[hq]}get db(){return this[d3]}get type(){return"browser-level"}_open(e,r){let n=indexedDB.open(this[dq]+this[mh],this[hq]);n.onerror=function(){r(n.error||new Error("unknown error"))},n.onsuccess=()=>{this[d3]=n.result,r()},n.onupgradeneeded=i=>{let o=i.target.result;o.objectStoreNames.contains(this[mh])||o.createObjectStore(this[mh])}}[Qy](e){return this[d3].transaction([this[mh]],e).objectStore(this[mh])}[h3](e,r){let n=e.transaction;n.onabort=function(){r(n.error||new Error("aborted by user"))},n.oncomplete=function(){r(null,e.result)}}_get(e,r,n){let i=this[Qy]("readonly"),o;try{o=i.get(e)}catch(s){return this.nextTick(n,s)}this[h3](o,function(s,a){if(s)return n(s);if(a===void 0)return n(new _he("Entry not found",{code:"LEVEL_NOT_FOUND"}));n(null,xhe(a))})}_getMany(e,r,n){let i=this[Qy]("readonly"),o=e.map(s=>a=>{let d;try{d=i.get(s)}catch(m){return a(m)}d.onsuccess=()=>{let m=d.result;a(null,m===void 0?m:xhe(m))},d.onerror=m=>{m.stopPropagation(),a(d.error)}});iWe(o,16,n)}_del(e,r,n){let i=this[Qy]("readwrite"),o;try{o=i.delete(e)}catch(s){return this.nextTick(n,s)}this[h3](o,n)}_put(e,r,n,i){let o=this[Qy]("readwrite"),s;try{s=o.put(r,e)}catch(a){return this.nextTick(i,a)}this[h3](s,i)}_iterator(e){return new sWe(this,this[mh],e)}_batch(e,r,n){let i=this[Qy]("readwrite"),o=i.transaction,s=0,a;o.onabort=function(){n(a||o.error||new Error("aborted by user"))},o.oncomplete=function(){n()};function d(){let m=e[s++],p=m.key,w;try{w=m.type==="del"?i.delete(p):i.put(m.value,p)}catch(P){a=P,o.abort();return}s<e.length?w.onsuccess=d:typeof o.commit=="function"&&o.commit()}d()}_clear(e,r){let n,i;try{n=cWe(e)}catch{return this.nextTick(r)}if(e.limit>=0)return aWe(this,this[mh],n,e,r);try{let o=this[Qy]("readwrite");i=n?o.delete(n):o.clear()}catch(o){return this.nextTick(r,o)}this[h3](i,r)}_close(e){this[d3].close(),this.nextTick(e)}};iP.destroy=function(t,e,r){typeof e=="function"&&(r=e,e=She),r=oWe(r,Ehe);let n=indexedDB.deleteDatabase(e+t);return n.onsuccess=function(){r()},n.onerror=function(i){r(i)},r[Ehe]};Mhe.BrowserLevel=iP});var mq=H(Phe=>{E();Phe.Level=pq().BrowserLevel});var eo=H((c4t,Ahe)=>{"use strict";E();Ahe.exports={ArrayIsArray(t){return Array.isArray(t)},ArrayPrototypeIncludes(t,e){return t.includes(e)},ArrayPrototypeIndexOf(t,e){return t.indexOf(e)},ArrayPrototypeJoin(t,e){return t.join(e)},ArrayPrototypeMap(t,e){return t.map(e)},ArrayPrototypePop(t,e){return t.pop(e)},ArrayPrototypePush(t,e){return t.push(e)},ArrayPrototypeSlice(t,e,r){return t.slice(e,r)},Error,FunctionPrototypeCall(t,e,...r){return t.call(e,...r)},FunctionPrototypeSymbolHasInstance(t,e){return Function.prototype[Symbol.hasInstance].call(t,e)},MathFloor:Math.floor,Number,NumberIsInteger:Number.isInteger,NumberIsNaN:Number.isNaN,NumberMAX_SAFE_INTEGER:Number.MAX_SAFE_INTEGER,NumberMIN_SAFE_INTEGER:Number.MIN_SAFE_INTEGER,NumberParseInt:Number.parseInt,ObjectDefineProperties(t,e){return Object.defineProperties(t,e)},ObjectDefineProperty(t,e,r){return Object.defineProperty(t,e,r)},ObjectGetOwnPropertyDescriptor(t,e){return Object.getOwnPropertyDescriptor(t,e)},ObjectKeys(t){return Object.keys(t)},ObjectSetPrototypeOf(t,e){return Object.setPrototypeOf(t,e)},Promise,PromisePrototypeCatch(t,e){return t.catch(e)},PromisePrototypeThen(t,e,r){return t.then(e,r)},PromiseReject(t){return Promise.reject(t)},ReflectApply:Reflect.apply,RegExpPrototypeTest(t,e){return t.test(e)},SafeSet:Set,String,StringPrototypeSlice(t,e,r){return t.slice(e,r)},StringPrototypeToLowerCase(t){return t.toLowerCase()},StringPrototypeToUpperCase(t){return t.toUpperCase()},StringPrototypeTrim(t){return t.trim()},Symbol,SymbolFor:Symbol.for,SymbolAsyncIterator:Symbol.asyncIterator,SymbolHasInstance:Symbol.hasInstance,SymbolIterator:Symbol.iterator,TypedArrayPrototypeSet(t,e,r){return t.set(e,r)},Uint8Array}});var Nl=H((u4t,gq)=>{"use strict";E();var uWe=sr(),lWe=Object.getPrototypeOf(async function(){}).constructor,The=globalThis.Blob||uWe.Blob,dWe=typeof The<"u"?function(e){return e instanceof The}:function(e){return!1},yq=class extends Error{constructor(e){if(!Array.isArray(e))throw new TypeError(`Expected input to be an Array, got ${typeof e}`);let r="";for(let n=0;n<e.length;n++)r+=` ${e[n].stack}
`;super(r),this.name="AggregateError",this.errors=e}};gq.exports={AggregateError:yq,kEmptyObject:Object.freeze({}),once(t){let e=!1;return function(...r){e||(e=!0,t.apply(this,r))}},createDeferredPromise:function(){let t,e;return{promise:new Promise((n,i)=>{t=n,e=i}),resolve:t,reject:e}},promisify(t){return new Promise((e,r)=>{t((n,...i)=>n?r(n):e(...i))})},debuglog(){return function(){}},format(t,...e){return t.replace(/%([sdifj])/g,function(...[r,n]){let i=e.shift();return n==="f"?i.toFixed(6):n==="j"?JSON.stringify(i):n==="s"&&typeof i=="object"?`${i.constructor!==Object?i.constructor.name:""} {}`.trim():i.toString()})},inspect(t){switch(typeof t){case"string":if(t.includes("'"))if(t.includes('"')){if(!t.includes("`")&&!t.includes("${"))return`\`${t}\``}else return`"${t}"`;return`'${t}'`;case"number":return isNaN(t)?"NaN":Object.is(t,-0)?String(t):t;case"bigint":return`${String(t)}n`;case"boolean":case"undefined":return String(t);case"object":return"{}"}},types:{isAsyncFunction(t){return t instanceof lWe},isArrayBufferView(t){return ArrayBuffer.isView(t)}},isBlob:dWe};gq.exports.promisify.custom=Symbol.for("nodejs.util.promisify.custom")});var ha=H((d4t,khe)=>{"use strict";E();var{format:hWe,inspect:sP,AggregateError:pWe}=Nl(),mWe=globalThis.AggregateError||pWe,yWe=Symbol("kIsNodeError"),gWe=["string","function","number","object","Function","Object","boolean","bigint","symbol"],vWe=/^([A-Z][a-z0-9]*)+$/,bWe="__node_internal_",aP={};function eg(t,e){if(!t)throw new aP.ERR_INTERNAL_ASSERTION(e)}function Rhe(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 wWe(t,e,r){if(typeof e=="function")return eg(e.length<=r.length,`Code: ${t}; The provided arguments length (${r.length}) does not match the required ones (${e.length}).`),e(...r);let n=(e.match(/%[dfijoOs]/g)||[]).length;return eg(n===r.length,`Code: ${t}; The provided arguments length (${r.length}) does not match the required ones (${n}).`),r.length===0?e:hWe(e,...r)}function hs(t,e,r){r||(r=Error);class n extends r{constructor(...o){super(wWe(t,e,o))}toString(){return`${this.name} [${t}]: ${this.message}`}}Object.defineProperties(n.prototype,{name:{value:r.name,writable:!0,enumerable:!1,configurable:!0},toString:{value(){return`${this.name} [${t}]: ${this.message}`},writable:!0,enumerable:!1,configurable:!0}}),n.prototype.code=t,n.prototype[yWe]=!0,aP[t]=n}function Ihe(t){let e=bWe+t.name;return Object.defineProperty(t,"name",{value:e}),t}function _We(t,e){if(t&&e&&t!==e){if(Array.isArray(e.errors))return e.errors.push(t),e;let r=new mWe([e,t],e.message);return r.code=e.code,r}return t||e}var vq=class extends Error{constructor(e="The operation was aborted",r=void 0){if(r!==void 0&&typeof r!="object")throw new aP.ERR_INVALID_ARG_TYPE("options","Object",r);super(e,r),this.code="ABORT_ERR",this.name="AbortError"}};hs("ERR_ASSERTION","%s",Error);hs("ERR_INVALID_ARG_TYPE",(t,e,r)=>{eg(typeof t=="string","'name' must be a string"),Array.isArray(e)||(e=[e]);let n="The ";t.endsWith(" argument")?n+=`${t} `:n+=`"${t}" ${t.includes(".")?"property":"argument"} `,n+="must be ";let i=[],o=[],s=[];for(let d of e)eg(typeof d=="string","All expected entries have to be of type string"),gWe.includes(d)?i.push(d.toLowerCase()):vWe.test(d)?o.push(d):(eg(d!=="object",'The value "object" should be written as "Object"'),s.push(d));if(o.length>0){let d=i.indexOf("object");d!==-1&&(i.splice(i,d,1),o.push("Object"))}if(i.length>0){switch(i.length){case 1:n+=`of type ${i[0]}`;break;case 2:n+=`one of type ${i[0]} or ${i[1]}`;break;default:{let d=i.pop();n+=`one of type ${i.join(", ")}, or ${d}`}}(o.length>0||s.length>0)&&(n+=" or ")}if(o.length>0){switch(o.length){case 1:n+=`an instance of ${o[0]}`;break;case 2:n+=`an instance of ${o[0]} or ${o[1]}`;break;default:{let d=o.pop();n+=`an instance of ${o.join(", ")}, or ${d}`}}s.length>0&&(n+=" or ")}switch(s.length){case 0:break;case 1:s[0].toLowerCase()!==s[0]&&(n+="an "),n+=`${s[0]}`;break;case 2:n+=`one of ${s[0]} or ${s[1]}`;break;default:{let d=s.pop();n+=`one of ${s.join(", ")}, or ${d}`}}if(r==null)n+=`. Received ${r}`;else if(typeof r=="function"&&r.name)n+=`. Received function ${r.name}`;else if(typeof r=="object"){var a;if((a=r.constructor)!==null&&a!==void 0&&a.name)n+=`. Received an instance of ${r.constructor.name}`;else{let d=sP(r,{depth:-1});n+=`. Received ${d}`}}else{let d=sP(r,{colors:!1});d.length>25&&(d=`${d.slice(0,25)}...`),n+=`. Received type ${typeof r} (${d})`}return n},TypeError);hs("ERR_INVALID_ARG_VALUE",(t,e,r="is invalid")=>{let n=sP(e);return n.length>128&&(n=n.slice(0,128)+"..."),`The ${t.includes(".")?"property":"argument"} '${t}' ${r}. Received ${n}`},TypeError);hs("ERR_INVALID_RETURN_VALUE",(t,e,r)=>{var n;let i=r!=null&&(n=r.constructor)!==null&&n!==void 0&&n.name?`instance of ${r.constructor.name}`:`type ${typeof r}`;return`Expected ${t} to be returned from the "${e}" function but got ${i}.`},TypeError);hs("ERR_MISSING_ARGS",(...t)=>{eg(t.length>0,"At least one arg needs to be specified");let e,r=t.length;switch(t=(Array.isArray(t)?t:[t]).map(n=>`"${n}"`).join(" or "),r){case 1:e+=`The ${t[0]} argument`;break;case 2:e+=`The ${t[0]} and ${t[1]} arguments`;break;default:{let n=t.pop();e+=`The ${t.join(", ")}, and ${n} arguments`}break}return`${e} must be specified`},TypeError);hs("ERR_OUT_OF_RANGE",(t,e,r)=>{eg(e,'Missing "range" argument');let n;return Number.isInteger(r)&&Math.abs(r)>2**32?n=Rhe(String(r)):typeof r=="bigint"?(n=String(r),(r>2n**32n||r<-(2n**32n))&&(n=Rhe(n)),n+="n"):n=sP(r),`The value of "${t}" is out of range. It must be ${e}. Received ${n}`},RangeError);hs("ERR_MULTIPLE_CALLBACK","Callback called multiple times",Error);hs("ERR_METHOD_NOT_IMPLEMENTED","The %s method is not implemented",Error);hs("ERR_STREAM_ALREADY_FINISHED","Cannot call %s after a stream was finished",Error);hs("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable",Error);hs("ERR_STREAM_DESTROYED","Cannot call %s after a stream was destroyed",Error);hs("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError);hs("ERR_STREAM_PREMATURE_CLOSE","Premature close",Error);hs("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF",Error);hs("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event",Error);hs("ERR_STREAM_WRITE_AFTER_END","write after end",Error);hs("ERR_UNKNOWN_ENCODING","Unknown encoding: %s",TypeError);khe.exports={AbortError:vq,aggregateTwoErrors:Ihe(_We),hideStackFrames:Ihe,codes:aP}});var p3=H((p4t,Lhe)=>{"use strict";E();var{ArrayIsArray:wq,ArrayPrototypeIncludes:Che,ArrayPrototypeJoin:jhe,ArrayPrototypeMap:xWe,NumberIsInteger:_q,NumberIsNaN:EWe,NumberMAX_SAFE_INTEGER:SWe,NumberMIN_SAFE_INTEGER:MWe,NumberParseInt:PWe,ObjectPrototypeHasOwnProperty:AWe,RegExpPrototypeExec:Nhe,String:TWe,StringPrototypeToUpperCase:RWe,StringPrototypeTrim:IWe}=eo(),{hideStackFrames:uf,codes:{ERR_SOCKET_BAD_PORT:kWe,ERR_INVALID_ARG_TYPE:pa,ERR_INVALID_ARG_VALUE:kw,ERR_OUT_OF_RANGE:tg,ERR_UNKNOWN_SIGNAL:Ohe}}=ha(),{normalizeEncoding:OWe}=Nl(),{isAsyncFunction:BWe,isArrayBufferView:DWe}=Nl().types,Bhe={};function CWe(t){return t===(t|0)}function jWe(t){return t===t>>>0}var NWe=/^[0-7]+$/,qWe="must be a 32-bit unsigned integer or an octal string";function $We(t,e,r){if(typeof t>"u"&&(t=r),typeof t=="string"){if(Nhe(NWe,t)===null)throw new kw(e,t,qWe);t=PWe(t,8)}return qhe(t,e),t}var LWe=uf((t,e,r=MWe,n=SWe)=>{if(typeof t!="number")throw new pa(e,"number",t);if(!_q(t))throw new tg(e,"an integer",t);if(t<r||t>n)throw new tg(e,`>= ${r} && <= ${n}`,t)}),UWe=uf((t,e,r=-2147483648,n=2147483647)=>{if(typeof t!="number")throw new pa(e,"number",t);if(!_q(t))throw new tg(e,"an integer",t);if(t<r||t>n)throw new tg(e,`>= ${r} && <= ${n}`,t)}),qhe=uf((t,e,r=!1)=>{if(typeof t!="number")throw new pa(e,"number",t);if(!_q(t))throw new tg(e,"an integer",t);let n=r?1:0,i=4294967295;if(t<n||t>i)throw new tg(e,`>= ${n} && <= ${i}`,t)});function xq(t,e){if(typeof t!="string")throw new pa(e,"string",t)}function FWe(t,e,r=void 0,n){if(typeof t!="number")throw new pa(e,"number",t);if(r!=null&&t<r||n!=null&&t>n||(r!=null||n!=null)&&EWe(t))throw new tg(e,`${r!=null?`>= ${r}`:""}${r!=null&&n!=null?" && ":""}${n!=null?`<= ${n}`:""}`,t)}var zWe=uf((t,e,r)=>{if(!Che(r,t)){let i="must be one of: "+jhe(xWe(r,o=>typeof o=="string"?`'${o}'`:TWe(o)),", ");throw new kw(e,t,i)}});function $he(t,e){if(typeof t!="boolean")throw new pa(e,"boolean",t)}function bq(t,e,r){return t==null||!AWe(t,e)?r:t[e]}var KWe=uf((t,e,r=null)=>{let n=bq(r,"allowArray",!1),i=bq(r,"allowFunction",!1);if(!bq(r,"nullable",!1)&&t===null||!n&&wq(t)||typeof t!="object"&&(!i||typeof t!="function"))throw new pa(e,"Object",t)}),GWe=uf((t,e)=>{if(t!=null&&typeof t!="object"&&typeof t!="function")throw new pa(e,"a dictionary",t)}),Eq=uf((t,e,r=0)=>{if(!wq(t))throw new pa(e,"Array",t);if(t.length<r){let n=`must be longer than ${r}`;throw new kw(e,t,n)}});function WWe(t,e){Eq(t,e);for(let r=0;r<t.length;r++)xq(t[r],`${e}[${r}]`)}function VWe(t,e){Eq(t,e);for(let r=0;r<t.length;r++)$he(t[r],`${e}[${r}]`)}function HWe(t,e="signal"){if(xq(t,e),Bhe[t]===void 0)throw Bhe[RWe(t)]!==void 0?new Ohe(t+" (signals must use all capital letters)"):new Ohe(t)}var ZWe=uf((t,e="buffer")=>{if(!DWe(t))throw new pa(e,["Buffer","TypedArray","DataView"],t)});function JWe(t,e){let r=OWe(e),n=t.length;if(r==="hex"&&n%2!==0)throw new kw("encoding",e,`is invalid for data of length ${n}`)}function YWe(t,e="Port",r=!0){if(typeof t!="number"&&typeof t!="string"||typeof t=="string"&&IWe(t).length===0||+t!==+t>>>0||t>65535||t===0&&!r)throw new kWe(e,t,r);return t|0}var QWe=uf((t,e)=>{if(t!==void 0&&(t===null||typeof t!="object"||!("aborted"in t)))throw new pa(e,"AbortSignal",t)}),XWe=uf((t,e)=>{if(typeof t!="function")throw new pa(e,"Function",t)}),eVe=uf((t,e)=>{if(typeof t!="function"||BWe(t))throw new pa(e,"Function",t)}),tVe=uf((t,e)=>{if(t!==void 0)throw new pa(e,"undefined",t)});function rVe(t,e,r){if(!Che(r,t))throw new pa(e,`('${jhe(r,"|")}')`,t)}var nVe=/^(?:<[^>]*>)(?:\s*;\s*[^;"\s]+(?:=(")?[^;"\s]*\1)?)*$/;function Dhe(t,e){if(typeof t>"u"||!Nhe(nVe,t))throw new kw(e,t,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}function iVe(t){if(typeof t=="string")return Dhe(t,"hints"),t;if(wq(t)){let e=t.length,r="";if(e===0)return r;for(let n=0;n<e;n++){let i=t[n];Dhe(i,"hints"),r+=i,n!==e-1&&(r+=", ")}return r}throw new kw("hints",t,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}Lhe.exports={isInt32:CWe,isUint32:jWe,parseFileMode:$We,validateArray:Eq,validateStringArray:WWe,validateBooleanArray:VWe,validateBoolean:$he,validateBuffer:ZWe,validateDictionary:GWe,validateEncoding:JWe,validateFunction:XWe,validateInt32:UWe,validateInteger:LWe,validateNumber:FWe,validateObject:KWe,validateOneOf:zWe,validatePlainFunction:eVe,validatePort:YWe,validateSignalName:HWe,validateString:xq,validateUint32:qhe,validateUndefined:tVe,validateUnion:rVe,validateAbortSignal:QWe,validateLinkHeaderValue:iVe}});var $l=H((y4t,rpe)=>{"use strict";E();var{Symbol:cP,SymbolAsyncIterator:Uhe,SymbolIterator:Fhe,SymbolFor:zhe}=eo(),Khe=cP("kDestroyed"),Ghe=cP("kIsErrored"),Sq=cP("kIsReadable"),Whe=cP("kIsDisturbed"),oVe=zhe("nodejs.webstream.isClosedPromise"),sVe=zhe("nodejs.webstream.controllerErrorFunction");function fP(t,e=!1){var r;return!!(t&&typeof t.pipe=="function"&&typeof t.on=="function"&&(!e||typeof t.pause=="function"&&typeof t.resume=="function")&&(!t._writableState||((r=t._readableState)===null||r===void 0?void 0:r.readable)!==!1)&&(!t._writableState||t._readableState))}function uP(t){var e;return!!(t&&typeof t.write=="function"&&typeof t.on=="function"&&(!t._readableState||((e=t._writableState)===null||e===void 0?void 0:e.writable)!==!1))}function aVe(t){return!!(t&&typeof t.pipe=="function"&&t._readableState&&typeof t.on=="function"&&typeof t.write=="function")}function ql(t){return t&&(t._readableState||t._writableState||typeof t.write=="function"&&typeof t.on=="function"||typeof t.pipe=="function"&&typeof t.on=="function")}function Vhe(t){return!!(t&&!ql(t)&&typeof t.pipeThrough=="function"&&typeof t.getReader=="function"&&typeof t.cancel=="function")}function Hhe(t){return!!(t&&!ql(t)&&typeof t.getWriter=="function"&&typeof t.abort=="function")}function Zhe(t){return!!(t&&!ql(t)&&typeof t.readable=="object"&&typeof t.writable=="object")}function cVe(t){return Vhe(t)||Hhe(t)||Zhe(t)}function fVe(t,e){return t==null?!1:e===!0?typeof t[Uhe]=="function":e===!1?typeof t[Fhe]=="function":typeof t[Uhe]=="function"||typeof t[Fhe]=="function"}function lP(t){if(!ql(t))return null;let e=t._writableState,r=t._readableState,n=e||r;return!!(t.destroyed||t[Khe]||n!=null&&n.destroyed)}function Jhe(t){if(!uP(t))return null;if(t.writableEnded===!0)return!0;let e=t._writableState;return e!=null&&e.errored?!1:typeof e?.ended!="boolean"?null:e.ended}function uVe(t,e){if(!uP(t))return null;if(t.writableFinished===!0)return!0;let r=t._writableState;return r!=null&&r.errored?!1:typeof r?.finished!="boolean"?null:!!(r.finished||e===!1&&r.ended===!0&&r.length===0)}function lVe(t){if(!fP(t))return null;if(t.readableEnded===!0)return!0;let e=t._readableState;return!e||e.errored?!1:typeof e?.ended!="boolean"?null:e.ended}function Yhe(t,e){if(!fP(t))return null;let r=t._readableState;return r!=null&&r.errored?!1:typeof r?.endEmitted!="boolean"?null:!!(r.endEmitted||e===!1&&r.ended===!0&&r.length===0)}function Qhe(t){return t&&t[Sq]!=null?t[Sq]:typeof t?.readable!="boolean"?null:lP(t)?!1:fP(t)&&t.readable&&!Yhe(t)}function Xhe(t){return typeof t?.writable!="boolean"?null:lP(t)?!1:uP(t)&&t.writable&&!Jhe(t)}function dVe(t,e){return ql(t)?lP(t)?!0:!(e?.readable!==!1&&Qhe(t)||e?.writable!==!1&&Xhe(t)):null}function hVe(t){var e,r;return ql(t)?t.writableErrored?t.writableErrored:(e=(r=t._writableState)===null||r===void 0?void 0:r.errored)!==null&&e!==void 0?e:null:null}function pVe(t){var e,r;return ql(t)?t.readableErrored?t.readableErrored:(e=(r=t._readableState)===null||r===void 0?void 0:r.errored)!==null&&e!==void 0?e:null:null}function mVe(t){if(!ql(t))return null;if(typeof t.closed=="boolean")return t.closed;let e=t._writableState,r=t._readableState;return typeof e?.closed=="boolean"||typeof r?.closed=="boolean"?e?.closed||r?.closed:typeof t._closed=="boolean"&&epe(t)?t._closed:null}function epe(t){return typeof t._closed=="boolean"&&typeof t._defaultKeepAlive=="boolean"&&typeof t._removedConnection=="boolean"&&typeof t._removedContLen=="boolean"}function tpe(t){return typeof t._sent100=="boolean"&&epe(t)}function yVe(t){var e;return typeof t._consuming=="boolean"&&typeof t._dumped=="boolean"&&((e=t.req)===null||e===void 0?void 0:e.upgradeOrConnect)===void 0}function gVe(t){if(!ql(t))return null;let e=t._writableState,r=t._readableState,n=e||r;return!n&&tpe(t)||!!(n&&n.autoDestroy&&n.emitClose&&n.closed===!1)}function vVe(t){var e;return!!(t&&((e=t[Whe])!==null&&e!==void 0?e:t.readableDidRead||t.readableAborted))}function bVe(t){var e,r,n,i,o,s,a,d,m,p;return!!(t&&((e=(r=(n=(i=(o=(s=t[Ghe])!==null&&s!==void 0?s:t.readableErrored)!==null&&o!==void 0?o:t.writableErrored)!==null&&i!==void 0?i:(a=t._readableState)===null||a===void 0?void 0:a.errorEmitted)!==null&&n!==void 0?n:(d=t._writableState)===null||d===void 0?void 0:d.errorEmitted)!==null&&r!==void 0?r:(m=t._readableState)===null||m===void 0?void 0:m.errored)!==null&&e!==void 0?e:!((p=t._writableState)===null||p===void 0)&&p.errored))}rpe.exports={kDestroyed:Khe,isDisturbed:vVe,kIsDisturbed:Whe,isErrored:bVe,kIsErrored:Ghe,isReadable:Qhe,kIsReadable:Sq,kIsClosedPromise:oVe,kControllerErrorFunction:sVe,isClosed:mVe,isDestroyed:lP,isDuplexNodeStream:aVe,isFinished:dVe,isIterable:fVe,isReadableNodeStream:fP,isReadableStream:Vhe,isReadableEnded:lVe,isReadableFinished:Yhe,isReadableErrored:pVe,isNodeStream:ql,isWebStream:cVe,isWritable:Xhe,isWritableNodeStream:uP,isWritableStream:Hhe,isWritableEnded:Jhe,isWritableFinished:uVe,isWritableErrored:hVe,isServerRequest:yVe,isServerResponse:tpe,willEmitClose:gVe,isTransformStream:Zhe}});var yh=H((v4t,Rq)=>{E();var u0=ws(),{AbortError:lpe,codes:wVe}=ha(),{ERR_INVALID_ARG_TYPE:_Ve,ERR_STREAM_PREMATURE_CLOSE:npe}=wVe,{kEmptyObject:Pq,once:Aq}=Nl(),{validateAbortSignal:xVe,validateFunction:EVe,validateObject:SVe,validateBoolean:MVe}=p3(),{Promise:PVe,PromisePrototypeThen:AVe}=eo(),{isClosed:TVe,isReadable:ipe,isReadableNodeStream:Mq,isReadableStream:RVe,isReadableFinished:ope,isReadableErrored:spe,isWritable:ape,isWritableNodeStream:cpe,isWritableStream:IVe,isWritableFinished:fpe,isWritableErrored:upe,isNodeStream:kVe,willEmitClose:OVe,kIsClosedPromise:BVe}=$l();function DVe(t){return t.setHeader&&typeof t.abort=="function"}var Tq=()=>{};function dpe(t,e,r){var n,i;if(arguments.length===2?(r=e,e=Pq):e==null?e=Pq:SVe(e,"options"),EVe(r,"callback"),xVe(e.signal,"options.signal"),r=Aq(r),RVe(t)||IVe(t))return CVe(t,e,r);if(!kVe(t))throw new _Ve("stream",["ReadableStream","WritableStream","Stream"],t);let o=(n=e.readable)!==null&&n!==void 0?n:Mq(t),s=(i=e.writable)!==null&&i!==void 0?i:cpe(t),a=t._writableState,d=t._readableState,m=()=>{t.writable||P()},p=OVe(t)&&Mq(t)===o&&cpe(t)===s,w=fpe(t,!1),P=()=>{w=!0,t.destroyed&&(p=!1),!(p&&(!t.readable||o))&&(!o||S)&&r.call(t)},S=ope(t,!1),M=()=>{S=!0,t.destroyed&&(p=!1),!(p&&(!t.writable||s))&&(!s||w)&&r.call(t)},A=L=>{r.call(t,L)},B=TVe(t),I=()=>{B=!0;let L=upe(t)||spe(t);if(L&&typeof L!="boolean")return r.call(t,L);if(o&&!S&&Mq(t,!0)&&!ope(t,!1))return r.call(t,new npe);if(s&&!w&&!fpe(t,!1))return r.call(t,new npe);r.call(t)},C=()=>{B=!0;let L=upe(t)||spe(t);if(L&&typeof L!="boolean")return r.call(t,L);r.call(t)},k=()=>{t.req.on("finish",P)};DVe(t)?(t.on("complete",P),p||t.on("abort",I),t.req?k():t.on("request",k)):s&&!a&&(t.on("end",m),t.on("close",m)),!p&&typeof t.aborted=="boolean"&&t.on("aborted",I),t.on("end",M),t.on("finish",P),e.error!==!1&&t.on("error",A),t.on("close",I),B?u0.nextTick(I):a!=null&&a.errorEmitted||d!=null&&d.errorEmitted?p||u0.nextTick(C):(!o&&(!p||ipe(t))&&(w||ape(t)===!1)||!s&&(!p||ape(t))&&(S||ipe(t)===!1)||d&&t.req&&t.aborted)&&u0.nextTick(C);let q=()=>{r=Tq,t.removeListener("aborted",I),t.removeListener("complete",P),t.removeListener("abort",I),t.removeListener("request",k),t.req&&t.req.removeListener("finish",P),t.removeListener("end",m),t.removeListener("close",m),t.removeListener("finish",P),t.removeListener("end",M),t.removeListener("error",A),t.removeListener("close",I)};if(e.signal&&!B){let L=()=>{let U=r;q(),U.call(t,new lpe(void 0,{cause:e.signal.reason}))};if(e.signal.aborted)u0.nextTick(L);else{let U=r;r=Aq((...F)=>{e.signal.removeEventListener("abort",L),U.apply(t,F)}),e.signal.addEventListener("abort",L)}}return q}function CVe(t,e,r){let n=!1,i=Tq;if(e.signal)if(i=()=>{n=!0,r.call(t,new lpe(void 0,{cause:e.signal.reason}))},e.signal.aborted)u0.nextTick(i);else{let s=r;r=Aq((...a)=>{e.signal.removeEventListener("abort",i),s.apply(t,a)}),e.signal.addEventListener("abort",i)}let o=(...s)=>{n||u0.nextTick(()=>r.apply(t,s))};return AVe(t[BVe].promise,o,o),Tq}function jVe(t,e){var r;let n=!1;return e===null&&(e=Pq),(r=e)!==null&&r!==void 0&&r.cleanup&&(MVe(e.cleanup,"cleanup"),n=e.cleanup),new PVe((i,o)=>{let s=dpe(t,e,a=>{n&&s(),a?o(a):i()})})}Rq.exports=dpe;Rq.exports.finished=jVe});var rg=H((w4t,wpe)=>{"use strict";E();var Ll=ws(),{aggregateTwoErrors:NVe,codes:{ERR_MULTIPLE_CALLBACK:qVe},AbortError:$Ve}=ha(),{Symbol:mpe}=eo(),{kDestroyed:LVe,isDestroyed:UVe,isFinished:FVe,isServerRequest:zVe}=$l(),ype=mpe("kDestroy"),Iq=mpe("kConstruct");function gpe(t,e,r){t&&(t.stack,e&&!e.errored&&(e.errored=t),r&&!r.errored&&(r.errored=t))}function KVe(t,e){let r=this._readableState,n=this._writableState,i=n||r;return n!=null&&n.destroyed||r!=null&&r.destroyed?(typeof e=="function"&&e(),this):(gpe(t,n,r),n&&(n.destroyed=!0),r&&(r.destroyed=!0),i.constructed?hpe(this,t,e):this.once(ype,function(o){hpe(this,NVe(o,t),e)}),this)}function hpe(t,e,r){let n=!1;function i(o){if(n)return;n=!0;let s=t._readableState,a=t._writableState;gpe(o,a,s),a&&(a.closed=!0),s&&(s.closed=!0),typeof r=="function"&&r(o),o?Ll.nextTick(GVe,t,o):Ll.nextTick(vpe,t)}try{t._destroy(e||null,i)}catch(o){i(o)}}function GVe(t,e){kq(t,e),vpe(t)}function vpe(t){let e=t._readableState,r=t._writableState;r&&(r.closeEmitted=!0),e&&(e.closeEmitted=!0),(r!=null&&r.emitClose||e!=null&&e.emitClose)&&t.emit("close")}function kq(t,e){let r=t._readableState,n=t._writableState;n!=null&&n.errorEmitted||r!=null&&r.errorEmitted||(n&&(n.errorEmitted=!0),r&&(r.errorEmitted=!0),t.emit("error",e))}function WVe(){let t=this._readableState,e=this._writableState;t&&(t.constructed=!0,t.closed=!1,t.closeEmitted=!1,t.destroyed=!1,t.errored=null,t.errorEmitted=!1,t.reading=!1,t.ended=t.readable===!1,t.endEmitted=t.readable===!1),e&&(e.constructed=!0,e.destroyed=!1,e.closed=!1,e.closeEmitted=!1,e.errored=null,e.errorEmitted=!1,e.finalCalled=!1,e.prefinished=!1,e.ended=e.writable===!1,e.ending=e.writable===!1,e.finished=e.writable===!1)}function Oq(t,e,r){let n=t._readableState,i=t._writableState;if(i!=null&&i.destroyed||n!=null&&n.destroyed)return this;n!=null&&n.autoDestroy||i!=null&&i.autoDestroy?t.destroy(e):e&&(e.stack,i&&!i.errored&&(i.errored=e),n&&!n.errored&&(n.errored=e),r?Ll.nextTick(kq,t,e):kq(t,e))}function VVe(t,e){if(typeof t._construct!="function")return;let r=t._readableState,n=t._writableState;r&&(r.constructed=!1),n&&(n.constructed=!1),t.once(Iq,e),!(t.listenerCount(Iq)>1)&&Ll.nextTick(HVe,t)}function HVe(t){let e=!1;function r(n){if(e){Oq(t,n??new qVe);return}e=!0;let i=t._readableState,o=t._writableState,s=o||i;i&&(i.constructed=!0),o&&(o.constructed=!0),s.destroyed?t.emit(ype,n):n?Oq(t,n,!0):Ll.nextTick(ZVe,t)}try{t._construct(n=>{Ll.nextTick(r,n)})}catch(n){Ll.nextTick(r,n)}}function ZVe(t){t.emit(Iq)}function ppe(t){return t?.setHeader&&typeof t.abort=="function"}function bpe(t){t.emit("close")}function JVe(t,e){t.emit("error",e),Ll.nextTick(bpe,t)}function YVe(t,e){!t||UVe(t)||(!e&&!FVe(t)&&(e=new $Ve),zVe(t)?(t.socket=null,t.destroy(e)):ppe(t)?t.abort():ppe(t.req)?t.req.abort():typeof t.destroy=="function"?t.destroy(e):typeof t.close=="function"?t.close():e?Ll.nextTick(JVe,t,e):Ll.nextTick(bpe,t),t.destroyed||(t[LVe]=!0))}wpe.exports={construct:VVe,destroyer:YVe,destroy:KVe,undestroy:WVe,errorOrDestroy:Oq}});var pP=H((x4t,xpe)=>{"use strict";E();var{ArrayIsArray:QVe,ObjectSetPrototypeOf:_pe}=eo(),{EventEmitter:dP}=Go();function hP(t){dP.call(this,t)}_pe(hP.prototype,dP.prototype);_pe(hP,dP);hP.prototype.pipe=function(t,e){let r=this;function n(p){t.writable&&t.write(p)===!1&&r.pause&&r.pause()}r.on("data",n);function i(){r.readable&&r.resume&&r.resume()}t.on("drain",i),!t._isStdio&&(!e||e.end!==!1)&&(r.on("end",s),r.on("close",a));let o=!1;function s(){o||(o=!0,t.end())}function a(){o||(o=!0,typeof t.destroy=="function"&&t.destroy())}function d(p){m(),dP.listenerCount(this,"error")===0&&this.emit("error",p)}Bq(r,"error",d),Bq(t,"error",d);function m(){r.removeListener("data",n),t.removeListener("drain",i),r.removeListener("end",s),r.removeListener("close",a),r.removeListener("error",d),t.removeListener("error",d),r.removeListener("end",m),r.removeListener("close",m),t.removeListener("close",m)}return r.on("end",m),r.on("close",m),t.on("close",m),t.emit("pipe",r),t};function Bq(t,e,r){if(typeof t.prependListener=="function")return t.prependListener(e,r);!t._events||!t._events[e]?t.on(e,r):QVe(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]}xpe.exports={Stream:hP,prependListener:Bq}});var m3=H((S4t,mP)=>{"use strict";E();var{AbortError:Epe,codes:XVe}=ha(),{isNodeStream:Spe,isWebStream:eHe,kControllerErrorFunction:tHe}=$l(),rHe=yh(),{ERR_INVALID_ARG_TYPE:Mpe}=XVe,nHe=(t,e)=>{if(typeof t!="object"||!("aborted"in t))throw new Mpe(e,"AbortSignal",t)};mP.exports.addAbortSignal=function(e,r){if(nHe(e,"signal"),!Spe(r)&&!eHe(r))throw new Mpe("stream",["ReadableStream","WritableStream","Stream"],r);return mP.exports.addAbortSignalNoValidate(e,r)};mP.exports.addAbortSignalNoValidate=function(t,e){if(typeof t!="object"||!("aborted"in t))return e;let r=Spe(e)?()=>{e.destroy(new Epe(void 0,{cause:t.reason}))}:()=>{e[tHe](new Epe(void 0,{cause:t.reason}))};return t.aborted?r():(t.addEventListener("abort",r),rHe(e,()=>t.removeEventListener("abort",r))),e}});var Tpe=H((A4t,Ape)=>{"use strict";E();var{StringPrototypeSlice:Ppe,SymbolIterator:iHe,TypedArrayPrototypeSet:yP,Uint8Array:oHe}=eo(),{Buffer:Dq}=sr(),{inspect:sHe}=Nl();Ape.exports=class{constructor(){this.head=null,this.tail=null,this.length=0}push(e){let r={data:e,next:null};this.length>0?this.tail.next=r:this.head=r,this.tail=r,++this.length}unshift(e){let r={data:e,next:this.head};this.length===0&&(this.tail=r),this.head=r,++this.length}shift(){if(this.length===0)return;let e=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,e}clear(){this.head=this.tail=null,this.length=0}join(e){if(this.length===0)return"";let r=this.head,n=""+r.data;for(;(r=r.next)!==null;)n+=e+r.data;return n}concat(e){if(this.length===0)return Dq.alloc(0);let r=Dq.allocUnsafe(e>>>0),n=this.head,i=0;for(;n;)yP(r,n.data,i),i+=n.data.length,n=n.next;return r}consume(e,r){let n=this.head.data;if(e<n.length){let i=n.slice(0,e);return this.head.data=n.slice(e),i}return e===n.length?this.shift():r?this._getString(e):this._getBuffer(e)}first(){return this.head.data}*[iHe](){for(let e=this.head;e;e=e.next)yield e.data}_getString(e){let r="",n=this.head,i=0;do{let o=n.data;if(e>o.length)r+=o,e-=o.length;else{e===o.length?(r+=o,++i,n.next?this.head=n.next:this.head=this.tail=null):(r+=Ppe(o,0,e),this.head=n,n.data=Ppe(o,e));break}++i}while((n=n.next)!==null);return this.length-=i,r}_getBuffer(e){let r=Dq.allocUnsafe(e),n=e,i=this.head,o=0;do{let s=i.data;if(e>s.length)yP(r,s,n-e),e-=s.length;else{e===s.length?(yP(r,s,n-e),++o,i.next?this.head=i.next:this.head=this.tail=null):(yP(r,new oHe(s.buffer,s.byteOffset,e),n-e),this.head=i,i.data=s.slice(e));break}++o}while((i=i.next)!==null);return this.length-=o,r}[Symbol.for("nodejs.util.inspect.custom")](e,r){return sHe(this,{...r,depth:0,customInspect:!1})}}});var gP=H((R4t,Ipe)=>{"use strict";E();var{MathFloor:aHe,NumberIsInteger:cHe}=eo(),{ERR_INVALID_ARG_VALUE:fHe}=ha().codes;function uHe(t,e,r){return t.highWaterMark!=null?t.highWaterMark:e?t[r]:null}function Rpe(t){return t?16:16*1024}function lHe(t,e,r,n){let i=uHe(e,n,r);if(i!=null){if(!cHe(i)||i<0){let o=n?`options.${r}`:"options.highWaterMark";throw new fHe(o,i)}return aHe(i)}return Rpe(t.objectMode)}Ipe.exports={getHighWaterMark:lHe,getDefaultHighWaterMark:Rpe}});var Cq=H((k4t,Dpe)=>{"use strict";E();var kpe=ws(),{PromisePrototypeThen:dHe,SymbolAsyncIterator:Ope,SymbolIterator:Bpe}=eo(),{Buffer:hHe}=sr(),{ERR_INVALID_ARG_TYPE:pHe,ERR_STREAM_NULL_VALUES:mHe}=ha().codes;function yHe(t,e,r){let n;if(typeof e=="string"||e instanceof hHe)return new t({objectMode:!0,...r,read(){this.push(e),this.push(null)}});let i;if(e&&e[Ope])i=!0,n=e[Ope]();else if(e&&e[Bpe])i=!1,n=e[Bpe]();else throw new pHe("iterable",["Iterable"],e);let o=new t({objectMode:!0,highWaterMark:1,...r}),s=!1;o._read=function(){s||(s=!0,d())},o._destroy=function(m,p){dHe(a(m),()=>kpe.nextTick(p,m),w=>kpe.nextTick(p,w||m))};async function a(m){let p=m!=null,w=typeof n.throw=="function";if(p&&w){let{value:P,done:S}=await n.throw(m);if(await P,S)return}if(typeof n.return=="function"){let{value:P}=await n.return();await P}}async function d(){for(;;){try{let{value:m,done:p}=i?await n.next():n.next();if(p)o.push(null);else{let w=m&&typeof m.then=="function"?await m:m;if(w===null)throw s=!1,new mHe;if(o.push(w))continue;s=!1}}catch(m){o.destroy(m)}break}}return o}Dpe.exports=yHe});var y3=H((B4t,Vpe)=>{E();var hu=ws(),{ArrayPrototypeIndexOf:gHe,NumberIsInteger:vHe,NumberIsNaN:bHe,NumberParseInt:wHe,ObjectDefineProperties:Npe,ObjectKeys:_He,ObjectSetPrototypeOf:qpe,Promise:xHe,SafeSet:EHe,SymbolAsyncIterator:SHe,Symbol:MHe}=eo();Vpe.exports=xr;xr.ReadableState=Uq;var{EventEmitter:PHe}=Go(),{Stream:l0,prependListener:AHe}=pP(),{Buffer:jq}=sr(),{addAbortSignal:THe}=m3(),RHe=yh(),$r=Nl().debuglog("stream",t=>{$r=t}),IHe=Tpe(),Bw=rg(),{getHighWaterMark:kHe,getDefaultHighWaterMark:OHe}=gP(),{aggregateTwoErrors:Cpe,codes:{ERR_INVALID_ARG_TYPE:BHe,ERR_METHOD_NOT_IMPLEMENTED:DHe,ERR_OUT_OF_RANGE:CHe,ERR_STREAM_PUSH_AFTER_EOF:jHe,ERR_STREAM_UNSHIFT_AFTER_END_EVENT:NHe}}=ha(),{validateObject:qHe}=p3(),ng=MHe("kPaused"),{StringDecoder:$pe}=Uu(),$He=Cq();qpe(xr.prototype,l0.prototype);qpe(xr,l0);var Nq=()=>{},{errorOrDestroy:Ow}=Bw;function Uq(t,e,r){typeof r!="boolean"&&(r=e instanceof Ul()),this.objectMode=!!(t&&t.objectMode),r&&(this.objectMode=this.objectMode||!!(t&&t.readableObjectMode)),this.highWaterMark=t?kHe(this,t,"readableHighWaterMark",r):OHe(!1),this.buffer=new IHe,this.length=0,this.pipes=[],this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.constructed=!0,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this[ng]=null,this.errorEmitted=!1,this.emitClose=!t||t.emitClose!==!1,this.autoDestroy=!t||t.autoDestroy!==!1,this.destroyed=!1,this.errored=null,this.closed=!1,this.closeEmitted=!1,this.defaultEncoding=t&&t.defaultEncoding||"utf8",this.awaitDrainWriters=null,this.multiAwaitDrain=!1,this.readingMore=!1,this.dataEmitted=!1,this.decoder=null,this.encoding=null,t&&t.encoding&&(this.decoder=new $pe(t.encoding),this.encoding=t.encoding)}function xr(t){if(!(this instanceof xr))return new xr(t);let e=this instanceof Ul();this._readableState=new Uq(t,this,e),t&&(typeof t.read=="function"&&(this._read=t.read),typeof t.destroy=="function"&&(this._destroy=t.destroy),typeof t.construct=="function"&&(this._construct=t.construct),t.signal&&!e&&THe(t.signal,this)),l0.call(this,t),Bw.construct(this,()=>{this._readableState.needReadable&&vP(this,this._readableState)})}xr.prototype.destroy=Bw.destroy;xr.prototype._undestroy=Bw.undestroy;xr.prototype._destroy=function(t,e){e(t)};xr.prototype[PHe.captureRejectionSymbol]=function(t){this.destroy(t)};xr.prototype.push=function(t,e){return Lpe(this,t,e,!1)};xr.prototype.unshift=function(t,e){return Lpe(this,t,e,!0)};function Lpe(t,e,r,n){$r("readableAddChunk",e);let i=t._readableState,o;if(i.objectMode||(typeof e=="string"?(r=r||i.defaultEncoding,i.encoding!==r&&(n&&i.encoding?e=jq.from(e,r).toString(i.encoding):(e=jq.from(e,r),r=""))):e instanceof jq?r="":l0._isUint8Array(e)?(e=l0._uint8ArrayToBuffer(e),r=""):e!=null&&(o=new BHe("chunk",["string","Buffer","Uint8Array"],e))),o)Ow(t,o);else if(e===null)i.reading=!1,FHe(t,i);else if(i.objectMode||e&&e.length>0)if(n)if(i.endEmitted)Ow(t,new NHe);else{if(i.destroyed||i.errored)return!1;qq(t,i,e,!0)}else if(i.ended)Ow(t,new jHe);else{if(i.destroyed||i.errored)return!1;i.reading=!1,i.decoder&&!r?(e=i.decoder.write(e),i.objectMode||e.length!==0?qq(t,i,e,!1):vP(t,i)):qq(t,i,e,!1)}else n||(i.reading=!1,vP(t,i));return!i.ended&&(i.length<i.highWaterMark||i.length===0)}function qq(t,e,r,n){e.flowing&&e.length===0&&!e.sync&&t.listenerCount("data")>0?(e.multiAwaitDrain?e.awaitDrainWriters.clear():e.awaitDrainWriters=null,e.dataEmitted=!0,t.emit("data",r)):(e.length+=e.objectMode?1:r.length,n?e.buffer.unshift(r):e.buffer.push(r),e.needReadable&&bP(t)),vP(t,e)}xr.prototype.isPaused=function(){let t=this._readableState;return t[ng]===!0||t.flowing===!1};xr.prototype.setEncoding=function(t){let e=new $pe(t);this._readableState.decoder=e,this._readableState.encoding=this._readableState.decoder.encoding;let r=this._readableState.buffer,n="";for(let i of r)n+=e.write(i);return r.clear(),n!==""&&r.push(n),this._readableState.length=n.length,this};var LHe=1073741824;function UHe(t){if(t>LHe)throw new CHe("size","<= 1GiB",t);return t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++,t}function jpe(t,e){return t<=0||e.length===0&&e.ended?0:e.objectMode?1:bHe(t)?e.flowing&&e.length?e.buffer.first().length:e.length:t<=e.length?t:e.ended?e.length:0}xr.prototype.read=function(t){$r("read",t),t===void 0?t=NaN:vHe(t)||(t=wHe(t,10));let e=this._readableState,r=t;if(t>e.highWaterMark&&(e.highWaterMark=UHe(t)),t!==0&&(e.emittedReadable=!1),t===0&&e.needReadable&&((e.highWaterMark!==0?e.length>=e.highWaterMark:e.length>0)||e.ended))return $r("read: emitReadable",e.length,e.ended),e.length===0&&e.ended?$q(this):bP(this),null;if(t=jpe(t,e),t===0&&e.ended)return e.length===0&&$q(this),null;let n=e.needReadable;if($r("need readable",n),(e.length===0||e.length-t<e.highWaterMark)&&(n=!0,$r("length less than watermark",n)),e.ended||e.reading||e.destroyed||e.errored||!e.constructed)n=!1,$r("reading, ended or constructing",n);else if(n){$r("do read"),e.reading=!0,e.sync=!0,e.length===0&&(e.needReadable=!0);try{this._read(e.highWaterMark)}catch(o){Ow(this,o)}e.sync=!1,e.reading||(t=jpe(r,e))}let i;return t>0?i=Gpe(t,e):i=null,i===null?(e.needReadable=e.length<=e.highWaterMark,t=0):(e.length-=t,e.multiAwaitDrain?e.awaitDrainWriters.clear():e.awaitDrainWriters=null),e.length===0&&(e.ended||(e.needReadable=!0),r!==t&&e.ended&&$q(this)),i!==null&&!e.errorEmitted&&!e.closeEmitted&&(e.dataEmitted=!0,this.emit("data",i)),i};function FHe(t,e){if($r("onEofChunk"),!e.ended){if(e.decoder){let r=e.decoder.end();r&&r.length&&(e.buffer.push(r),e.length+=e.objectMode?1:r.length)}e.ended=!0,e.sync?bP(t):(e.needReadable=!1,e.emittedReadable=!0,Upe(t))}}function bP(t){let e=t._readableState;$r("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||($r("emitReadable",e.flowing),e.emittedReadable=!0,hu.nextTick(Upe,t))}function Upe(t){let e=t._readableState;$r("emitReadable_",e.destroyed,e.length,e.ended),!e.destroyed&&!e.errored&&(e.length||e.ended)&&(t.emit("readable"),e.emittedReadable=!1),e.needReadable=!e.flowing&&!e.ended&&e.length<=e.highWaterMark,zpe(t)}function vP(t,e){!e.readingMore&&e.constructed&&(e.readingMore=!0,hu.nextTick(zHe,t,e))}function zHe(t,e){for(;!e.reading&&!e.ended&&(e.length<e.highWaterMark||e.flowing&&e.length===0);){let r=e.length;if($r("maybeReadMore read 0"),t.read(0),r===e.length)break}e.readingMore=!1}xr.prototype._read=function(t){throw new DHe("_read()")};xr.prototype.pipe=function(t,e){let r=this,n=this._readableState;n.pipes.length===1&&(n.multiAwaitDrain||(n.multiAwaitDrain=!0,n.awaitDrainWriters=new EHe(n.awaitDrainWriters?[n.awaitDrainWriters]:[]))),n.pipes.push(t),$r("pipe count=%d opts=%j",n.pipes.length,e);let o=(!e||e.end!==!1)&&t!==hu.stdout&&t!==hu.stderr?a:B;n.endEmitted?hu.nextTick(o):r.once("end",o),t.on("unpipe",s);function s(I,C){$r("onunpipe"),I===r&&C&&C.hasUnpiped===!1&&(C.hasUnpiped=!0,p())}function a(){$r("onend"),t.end()}let d,m=!1;function p(){$r("cleanup"),t.removeListener("close",M),t.removeListener("finish",A),d&&t.removeListener("drain",d),t.removeListener("error",S),t.removeListener("unpipe",s),r.removeListener("end",a),r.removeListener("end",B),r.removeListener("data",P),m=!0,d&&n.awaitDrainWriters&&(!t._writableState||t._writableState.needDrain)&&d()}function w(){m||(n.pipes.length===1&&n.pipes[0]===t?($r("false write response, pause",0),n.awaitDrainWriters=t,n.multiAwaitDrain=!1):n.pipes.length>1&&n.pipes.includes(t)&&($r("false write response, pause",n.awaitDrainWriters.size),n.awaitDrainWriters.add(t)),r.pause()),d||(d=KHe(r,t),t.on("drain",d))}r.on("data",P);function P(I){$r("ondata");let C=t.write(I);$r("dest.write",C),C===!1&&w()}function S(I){if($r("onerror",I),B(),t.removeListener("error",S),t.listenerCount("error")===0){let C=t._writableState||t._readableState;C&&!C.errorEmitted?Ow(t,I):t.emit("error",I)}}AHe(t,"error",S);function M(){t.removeListener("finish",A),B()}t.once("close",M);function A(){$r("onfinish"),t.removeListener("close",M),B()}t.once("finish",A);function B(){$r("unpipe"),r.unpipe(t)}return t.emit("pipe",r),t.writableNeedDrain===!0?n.flowing&&w():n.flowing||($r("pipe resume"),r.resume()),t};function KHe(t,e){return function(){let n=t._readableState;n.awaitDrainWriters===e?($r("pipeOnDrain",1),n.awaitDrainWriters=null):n.multiAwaitDrain&&($r("pipeOnDrain",n.awaitDrainWriters.size),n.awaitDrainWriters.delete(e)),(!n.awaitDrainWriters||n.awaitDrainWriters.size===0)&&t.listenerCount("data")&&t.resume()}}xr.prototype.unpipe=function(t){let e=this._readableState,r={hasUnpiped:!1};if(e.pipes.length===0)return this;if(!t){let i=e.pipes;e.pipes=[],this.pause();for(let o=0;o<i.length;o++)i[o].emit("unpipe",this,{hasUnpiped:!1});return this}let n=gHe(e.pipes,t);return n===-1?this:(e.pipes.splice(n,1),e.pipes.length===0&&this.pause(),t.emit("unpipe",this,r),this)};xr.prototype.on=function(t,e){let r=l0.prototype.on.call(this,t,e),n=this._readableState;return t==="data"?(n.readableListening=this.listenerCount("readable")>0,n.flowing!==!1&&this.resume()):t==="readable"&&!n.endEmitted&&!n.readableListening&&(n.readableListening=n.needReadable=!0,n.flowing=!1,n.emittedReadable=!1,$r("on readable",n.length,n.reading),n.length?bP(this):n.reading||hu.nextTick(GHe,this)),r};xr.prototype.addListener=xr.prototype.on;xr.prototype.removeListener=function(t,e){let r=l0.prototype.removeListener.call(this,t,e);return t==="readable"&&hu.nextTick(Fpe,this),r};xr.prototype.off=xr.prototype.removeListener;xr.prototype.removeAllListeners=function(t){let e=l0.prototype.removeAllListeners.apply(this,arguments);return(t==="readable"||t===void 0)&&hu.nextTick(Fpe,this),e};function Fpe(t){let e=t._readableState;e.readableListening=t.listenerCount("readable")>0,e.resumeScheduled&&e[ng]===!1?e.flowing=!0:t.listenerCount("data")>0?t.resume():e.readableListening||(e.flowing=null)}function GHe(t){$r("readable nexttick read 0"),t.read(0)}xr.prototype.resume=function(){let t=this._readableState;return t.flowing||($r("resume"),t.flowing=!t.readableListening,WHe(this,t)),t[ng]=!1,this};function WHe(t,e){e.resumeScheduled||(e.resumeScheduled=!0,hu.nextTick(VHe,t,e))}function VHe(t,e){$r("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),zpe(t),e.flowing&&!e.reading&&t.read(0)}xr.prototype.pause=function(){return $r("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&($r("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState[ng]=!0,this};function zpe(t){let e=t._readableState;for($r("flow",e.flowing);e.flowing&&t.read()!==null;);}xr.prototype.wrap=function(t){let e=!1;t.on("data",n=>{!this.push(n)&&t.pause&&(e=!0,t.pause())}),t.on("end",()=>{this.push(null)}),t.on("error",n=>{Ow(this,n)}),t.on("close",()=>{this.destroy()}),t.on("destroy",()=>{this.destroy()}),this._read=()=>{e&&t.resume&&(e=!1,t.resume())};let r=_He(t);for(let n=1;n<r.length;n++){let i=r[n];this[i]===void 0&&typeof t[i]=="function"&&(this[i]=t[i].bind(t))}return this};xr.prototype[SHe]=function(){return Kpe(this)};xr.prototype.iterator=function(t){return t!==void 0&&qHe(t,"options"),Kpe(this,t)};function Kpe(t,e){typeof t.read!="function"&&(t=xr.wrap(t,{objectMode:!0}));let r=HHe(t,e);return r.stream=t,r}async function*HHe(t,e){let r=Nq;function n(s){this===t?(r(),r=Nq):r=s}t.on("readable",n);let i,o=RHe(t,{writable:!1},s=>{i=s?Cpe(i,s):null,r(),r=Nq});try{for(;;){let s=t.destroyed?null:t.read();if(s!==null)yield s;else{if(i)throw i;if(i===null)return;await new xHe(n)}}}catch(s){throw i=Cpe(i,s),i}finally{(i||e?.destroyOnReturn!==!1)&&(i===void 0||t._readableState.autoDestroy)?Bw.destroyer(t,null):(t.off("readable",n),o())}}Npe(xr.prototype,{readable:{__proto__:null,get(){let t=this._readableState;return!!t&&t.readable!==!1&&!t.destroyed&&!t.errorEmitted&&!t.endEmitted},set(t){this._readableState&&(this._readableState.readable=!!t)}},readableDidRead:{__proto__:null,enumerable:!1,get:function(){return this._readableState.dataEmitted}},readableAborted:{__proto__:null,enumerable:!1,get:function(){return!!(this._readableState.readable!==!1&&(this._readableState.destroyed||this._readableState.errored)&&!this._readableState.endEmitted)}},readableHighWaterMark:{__proto__:null,enumerable:!1,get:function(){return this._readableState.highWaterMark}},readableBuffer:{__proto__:null,enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}},readableFlowing:{__proto__:null,enumerable:!1,get:function(){return this._readableState.flowing},set:function(t){this._readableState&&(this._readableState.flowing=t)}},readableLength:{__proto__:null,enumerable:!1,get(){return this._readableState.length}},readableObjectMode:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.objectMode:!1}},readableEncoding:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.encoding:null}},errored:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.errored:null}},closed:{__proto__:null,get(){return this._readableState?this._readableState.closed:!1}},destroyed:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.destroyed:!1},set(t){this._readableState&&(this._readableState.destroyed=t)}},readableEnded:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.endEmitted:!1}}});Npe(Uq.prototype,{pipesCount:{__proto__:null,get(){return this.pipes.length}},paused:{__proto__:null,get(){return this[ng]!==!1},set(t){this[ng]=!!t}}});xr._fromList=Gpe;function Gpe(t,e){if(e.length===0)return null;let r;return e.objectMode?r=e.buffer.shift():!t||t>=e.length?(e.decoder?r=e.buffer.join(""):e.buffer.length===1?r=e.buffer.first():r=e.buffer.concat(e.length),e.buffer.clear()):r=e.buffer.consume(t,e.decoder),r}function $q(t){let e=t._readableState;$r("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,hu.nextTick(ZHe,e,t))}function ZHe(t,e){if($r("endReadableNT",t.endEmitted,t.length),!t.errored&&!t.closeEmitted&&!t.endEmitted&&t.length===0){if(t.endEmitted=!0,e.emit("end"),e.writable&&e.allowHalfOpen===!1)hu.nextTick(JHe,e);else if(t.autoDestroy){let r=e._writableState;(!r||r.autoDestroy&&(r.finished||r.writable===!1))&&e.destroy()}}}function JHe(t){t.writable&&!t.writableEnded&&!t.destroyed&&t.end()}xr.from=function(t,e){return $He(xr,t,e)};var Lq;function Wpe(){return Lq===void 0&&(Lq={}),Lq}xr.fromWeb=function(t,e){return Wpe().newStreamReadableFromReadableStream(t,e)};xr.toWeb=function(t,e){return Wpe().newReadableStreamFromStreamReadable(t,e)};xr.wrap=function(t,e){var r,n;return new xr({objectMode:(r=(n=t.readableObjectMode)!==null&&n!==void 0?n:t.objectMode)!==null&&r!==void 0?r:!0,...e,destroy(i,o){Bw.destroyer(t,i),o(i)}}).wrap(t)}});var Hq=H((C4t,o0e)=>{E();var ig=ws(),{ArrayPrototypeSlice:Jpe,Error:YHe,FunctionPrototypeSymbolHasInstance:Ype,ObjectDefineProperty:Qpe,ObjectDefineProperties:QHe,ObjectSetPrototypeOf:Xpe,StringPrototypeToLowerCase:XHe,Symbol:eZe,SymbolHasInstance:tZe}=eo();o0e.exports=mi;mi.WritableState=b3;var{EventEmitter:rZe}=Go(),g3=pP().Stream,{Buffer:wP}=sr(),EP=rg(),{addAbortSignal:nZe}=m3(),{getHighWaterMark:iZe,getDefaultHighWaterMark:oZe}=gP(),{ERR_INVALID_ARG_TYPE:sZe,ERR_METHOD_NOT_IMPLEMENTED:aZe,ERR_MULTIPLE_CALLBACK:e0e,ERR_STREAM_CANNOT_PIPE:cZe,ERR_STREAM_DESTROYED:v3,ERR_STREAM_ALREADY_FINISHED:fZe,ERR_STREAM_NULL_VALUES:uZe,ERR_STREAM_WRITE_AFTER_END:lZe,ERR_UNKNOWN_ENCODING:t0e}=ha().codes,{errorOrDestroy:Dw}=EP;Xpe(mi.prototype,g3.prototype);Xpe(mi,g3);function Kq(){}var Cw=eZe("kOnFinished");function b3(t,e,r){typeof r!="boolean"&&(r=e instanceof Ul()),this.objectMode=!!(t&&t.objectMode),r&&(this.objectMode=this.objectMode||!!(t&&t.writableObjectMode)),this.highWaterMark=t?iZe(this,t,"writableHighWaterMark",r):oZe(!1),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;let n=!!(t&&t.decodeStrings===!1);this.decodeStrings=!n,this.defaultEncoding=t&&t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=hZe.bind(void 0,e),this.writecb=null,this.writelen=0,this.afterWriteTickInfo=null,xP(this),this.pendingcb=0,this.constructed=!0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!t||t.emitClose!==!1,this.autoDestroy=!t||t.autoDestroy!==!1,this.errored=null,this.closed=!1,this.closeEmitted=!1,this[Cw]=[]}function xP(t){t.buffered=[],t.bufferedIndex=0,t.allBuffers=!0,t.allNoop=!0}b3.prototype.getBuffer=function(){return Jpe(this.buffered,this.bufferedIndex)};Qpe(b3.prototype,"bufferedRequestCount",{__proto__:null,get(){return this.buffered.length-this.bufferedIndex}});function mi(t){let e=this instanceof Ul();if(!e&&!Ype(mi,this))return new mi(t);this._writableState=new b3(t,this,e),t&&(typeof t.write=="function"&&(this._write=t.write),typeof t.writev=="function"&&(this._writev=t.writev),typeof t.destroy=="function"&&(this._destroy=t.destroy),typeof t.final=="function"&&(this._final=t.final),typeof t.construct=="function"&&(this._construct=t.construct),t.signal&&nZe(t.signal,this)),g3.call(this,t),EP.construct(this,()=>{let r=this._writableState;r.writing||Wq(this,r),Vq(this,r)})}Qpe(mi,tZe,{__proto__:null,value:function(t){return Ype(this,t)?!0:this!==mi?!1:t&&t._writableState instanceof b3}});mi.prototype.pipe=function(){Dw(this,new cZe)};function r0e(t,e,r,n){let i=t._writableState;if(typeof r=="function")n=r,r=i.defaultEncoding;else{if(!r)r=i.defaultEncoding;else if(r!=="buffer"&&!wP.isEncoding(r))throw new t0e(r);typeof n!="function"&&(n=Kq)}if(e===null)throw new uZe;if(!i.objectMode)if(typeof e=="string")i.decodeStrings!==!1&&(e=wP.from(e,r),r="buffer");else if(e instanceof wP)r="buffer";else if(g3._isUint8Array(e))e=g3._uint8ArrayToBuffer(e),r="buffer";else throw new sZe("chunk",["string","Buffer","Uint8Array"],e);let o;return i.ending?o=new lZe:i.destroyed&&(o=new v3("write")),o?(ig.nextTick(n,o),Dw(t,o,!0),o):(i.pendingcb++,dZe(t,i,e,r,n))}mi.prototype.write=function(t,e,r){return r0e(this,t,e,r)===!0};mi.prototype.cork=function(){this._writableState.corked++};mi.prototype.uncork=function(){let t=this._writableState;t.corked&&(t.corked--,t.writing||Wq(this,t))};mi.prototype.setDefaultEncoding=function(e){if(typeof e=="string"&&(e=XHe(e)),!wP.isEncoding(e))throw new t0e(e);return this._writableState.defaultEncoding=e,this};function dZe(t,e,r,n,i){let o=e.objectMode?1:r.length;e.length+=o;let s=e.length<e.highWaterMark;return s||(e.needDrain=!0),e.writing||e.corked||e.errored||!e.constructed?(e.buffered.push({chunk:r,encoding:n,callback:i}),e.allBuffers&&n!=="buffer"&&(e.allBuffers=!1),e.allNoop&&i!==Kq&&(e.allNoop=!1)):(e.writelen=o,e.writecb=i,e.writing=!0,e.sync=!0,t._write(r,n,e.onwrite),e.sync=!1),s&&!e.errored&&!e.destroyed}function Hpe(t,e,r,n,i,o,s){e.writelen=n,e.writecb=s,e.writing=!0,e.sync=!0,e.destroyed?e.onwrite(new v3("write")):r?t._writev(i,e.onwrite):t._write(i,o,e.onwrite),e.sync=!1}function Zpe(t,e,r,n){--e.pendingcb,n(r),Gq(e),Dw(t,r)}function hZe(t,e){let r=t._writableState,n=r.sync,i=r.writecb;if(typeof i!="function"){Dw(t,new e0e);return}r.writing=!1,r.writecb=null,r.length-=r.writelen,r.writelen=0,e?(e.stack,r.errored||(r.errored=e),t._readableState&&!t._readableState.errored&&(t._readableState.errored=e),n?ig.nextTick(Zpe,t,r,e,i):Zpe(t,r,e,i)):(r.buffered.length>r.bufferedIndex&&Wq(t,r),n?r.afterWriteTickInfo!==null&&r.afterWriteTickInfo.cb===i?r.afterWriteTickInfo.count++:(r.afterWriteTickInfo={count:1,cb:i,stream:t,state:r},ig.nextTick(pZe,r.afterWriteTickInfo)):n0e(t,r,1,i))}function pZe({stream:t,state:e,count:r,cb:n}){return e.afterWriteTickInfo=null,n0e(t,e,r,n)}function n0e(t,e,r,n){for(!e.ending&&!t.destroyed&&e.length===0&&e.needDrain&&(e.needDrain=!1,t.emit("drain"));r-- >0;)e.pendingcb--,n();e.destroyed&&Gq(e),Vq(t,e)}function Gq(t){if(t.writing)return;for(let i=t.bufferedIndex;i<t.buffered.length;++i){var e;let{chunk:o,callback:s}=t.buffered[i],a=t.objectMode?1:o.length;t.length-=a,s((e=t.errored)!==null&&e!==void 0?e:new v3("write"))}let r=t[Cw].splice(0);for(let i=0;i<r.length;i++){var n;r[i]((n=t.errored)!==null&&n!==void 0?n:new v3("end"))}xP(t)}function Wq(t,e){if(e.corked||e.bufferProcessing||e.destroyed||!e.constructed)return;let{buffered:r,bufferedIndex:n,objectMode:i}=e,o=r.length-n;if(!o)return;let s=n;if(e.bufferProcessing=!0,o>1&&t._writev){e.pendingcb-=o-1;let a=e.allNoop?Kq:m=>{for(let p=s;p<r.length;++p)r[p].callback(m)},d=e.allNoop&&s===0?r:Jpe(r,s);d.allBuffers=e.allBuffers,Hpe(t,e,!0,e.length,d,"",a),xP(e)}else{do{let{chunk:a,encoding:d,callback:m}=r[s];r[s++]=null;let p=i?1:a.length;Hpe(t,e,!1,p,a,d,m)}while(s<r.length&&!e.writing);s===r.length?xP(e):s>256?(r.splice(0,s),e.bufferedIndex=0):e.bufferedIndex=s}e.bufferProcessing=!1}mi.prototype._write=function(t,e,r){if(this._writev)this._writev([{chunk:t,encoding:e}],r);else throw new aZe("_write()")};mi.prototype._writev=null;mi.prototype.end=function(t,e,r){let n=this._writableState;typeof t=="function"?(r=t,t=null,e=null):typeof e=="function"&&(r=e,e=null);let i;if(t!=null){let o=r0e(this,t,e);o instanceof YHe&&(i=o)}return n.corked&&(n.corked=1,this.uncork()),i||(!n.errored&&!n.ending?(n.ending=!0,Vq(this,n,!0),n.ended=!0):n.finished?i=new fZe("end"):n.destroyed&&(i=new v3("end"))),typeof r=="function"&&(i||n.finished?ig.nextTick(r,i):n[Cw].push(r)),this};function _P(t){return t.ending&&!t.destroyed&&t.constructed&&t.length===0&&!t.errored&&t.buffered.length===0&&!t.finished&&!t.writing&&!t.errorEmitted&&!t.closeEmitted}function mZe(t,e){let r=!1;function n(i){if(r){Dw(t,i??e0e());return}if(r=!0,e.pendingcb--,i){let o=e[Cw].splice(0);for(let s=0;s<o.length;s++)o[s](i);Dw(t,i,e.sync)}else _P(e)&&(e.prefinished=!0,t.emit("prefinish"),e.pendingcb++,ig.nextTick(zq,t,e))}e.sync=!0,e.pendingcb++;try{t._final(n)}catch(i){n(i)}e.sync=!1}function yZe(t,e){!e.prefinished&&!e.finalCalled&&(typeof t._final=="function"&&!e.destroyed?(e.finalCalled=!0,mZe(t,e)):(e.prefinished=!0,t.emit("prefinish")))}function Vq(t,e,r){_P(e)&&(yZe(t,e),e.pendingcb===0&&(r?(e.pendingcb++,ig.nextTick((n,i)=>{_P(i)?zq(n,i):i.pendingcb--},t,e)):_P(e)&&(e.pendingcb++,zq(t,e))))}function zq(t,e){e.pendingcb--,e.finished=!0;let r=e[Cw].splice(0);for(let n=0;n<r.length;n++)r[n]();if(t.emit("finish"),e.autoDestroy){let n=t._readableState;(!n||n.autoDestroy&&(n.endEmitted||n.readable===!1))&&t.destroy()}}QHe(mi.prototype,{closed:{__proto__:null,get(){return this._writableState?this._writableState.closed:!1}},destroyed:{__proto__:null,get(){return this._writableState?this._writableState.destroyed:!1},set(t){this._writableState&&(this._writableState.destroyed=t)}},writable:{__proto__:null,get(){let t=this._writableState;return!!t&&t.writable!==!1&&!t.destroyed&&!t.errored&&!t.ending&&!t.ended},set(t){this._writableState&&(this._writableState.writable=!!t)}},writableFinished:{__proto__:null,get(){return this._writableState?this._writableState.finished:!1}},writableObjectMode:{__proto__:null,get(){return this._writableState?this._writableState.objectMode:!1}},writableBuffer:{__proto__:null,get(){return this._writableState&&this._writableState.getBuffer()}},writableEnded:{__proto__:null,get(){return this._writableState?this._writableState.ending:!1}},writableNeedDrain:{__proto__:null,get(){let t=this._writableState;return t?!t.destroyed&&!t.ending&&t.needDrain:!1}},writableHighWaterMark:{__proto__:null,get(){return this._writableState&&this._writableState.highWaterMark}},writableCorked:{__proto__:null,get(){return this._writableState?this._writableState.corked:0}},writableLength:{__proto__:null,get(){return this._writableState&&this._writableState.length}},errored:{__proto__:null,enumerable:!1,get(){return this._writableState?this._writableState.errored:null}},writableAborted:{__proto__:null,enumerable:!1,get:function(){return!!(this._writableState.writable!==!1&&(this._writableState.destroyed||this._writableState.errored)&&!this._writableState.finished)}}});var gZe=EP.destroy;mi.prototype.destroy=function(t,e){let r=this._writableState;return!r.destroyed&&(r.bufferedIndex<r.buffered.length||r[Cw].length)&&ig.nextTick(Gq,r),gZe.call(this,t,e),this};mi.prototype._undestroy=EP.undestroy;mi.prototype._destroy=function(t,e){e(t)};mi.prototype[rZe.captureRejectionSymbol]=function(t){this.destroy(t)};var Fq;function i0e(){return Fq===void 0&&(Fq={}),Fq}mi.fromWeb=function(t,e){return i0e().newStreamWritableFromWritableStream(t,e)};mi.toWeb=function(t){return i0e().newWritableStreamFromStreamWritable(t)}});var g0e=H((N4t,y0e)=>{E();var Zq=ws(),vZe=sr(),{isReadable:bZe,isWritable:wZe,isIterable:s0e,isNodeStream:_Ze,isReadableNodeStream:a0e,isWritableNodeStream:c0e,isDuplexNodeStream:xZe}=$l(),f0e=yh(),{AbortError:m0e,codes:{ERR_INVALID_ARG_TYPE:EZe,ERR_INVALID_RETURN_VALUE:u0e}}=ha(),{destroyer:jw}=rg(),SZe=Ul(),MZe=y3(),{createDeferredPromise:l0e}=Nl(),d0e=Cq(),h0e=globalThis.Blob||vZe.Blob,PZe=typeof h0e<"u"?function(e){return e instanceof h0e}:function(e){return!1},AZe=globalThis.AbortController||Ud().AbortController,{FunctionPrototypeCall:p0e}=eo(),og=class extends SZe{constructor(e){super(e),e?.readable===!1&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),e?.writable===!1&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)}};y0e.exports=function t(e,r){if(xZe(e))return e;if(a0e(e))return SP({readable:e});if(c0e(e))return SP({writable:e});if(_Ze(e))return SP({writable:!1,readable:!1});if(typeof e=="function"){let{value:i,write:o,final:s,destroy:a}=TZe(e);if(s0e(i))return d0e(og,i,{objectMode:!0,write:o,final:s,destroy:a});let d=i?.then;if(typeof d=="function"){let m,p=p0e(d,i,w=>{if(w!=null)throw new u0e("nully","body",w)},w=>{jw(m,w)});return m=new og({objectMode:!0,readable:!1,write:o,final(w){s(async()=>{try{await p,Zq.nextTick(w,null)}catch(P){Zq.nextTick(w,P)}})},destroy:a})}throw new u0e("Iterable, AsyncIterable or AsyncFunction",r,i)}if(PZe(e))return t(e.arrayBuffer());if(s0e(e))return d0e(og,e,{objectMode:!0,writable:!1});if(typeof e?.writable=="object"||typeof e?.readable=="object"){let i=e!=null&&e.readable?a0e(e?.readable)?e?.readable:t(e.readable):void 0,o=e!=null&&e.writable?c0e(e?.writable)?e?.writable:t(e.writable):void 0;return SP({readable:i,writable:o})}let n=e?.then;if(typeof n=="function"){let i;return p0e(n,e,o=>{o!=null&&i.push(o),i.push(null)},o=>{jw(i,o)}),i=new og({objectMode:!0,writable:!1,read(){}})}throw new EZe(r,["Blob","ReadableStream","WritableStream","Stream","Iterable","AsyncIterable","Function","{ readable, writable } pair","Promise"],e)};function TZe(t){let{promise:e,resolve:r}=l0e(),n=new AZe,i=n.signal;return{value:t(async function*(){for(;;){let s=e;e=null;let{chunk:a,done:d,cb:m}=await s;if(Zq.nextTick(m),d)return;if(i.aborted)throw new m0e(void 0,{cause:i.reason});({promise:e,resolve:r}=l0e()),yield a}}(),{signal:i}),write(s,a,d){let m=r;r=null,m({chunk:s,done:!1,cb:d})},final(s){let a=r;r=null,a({done:!0,cb:s})},destroy(s,a){n.abort(),a(s)}}}function SP(t){let e=t.readable&&typeof t.readable.read!="function"?MZe.wrap(t.readable):t.readable,r=t.writable,n=!!bZe(e),i=!!wZe(r),o,s,a,d,m;function p(w){let P=d;d=null,P?P(w):w&&m.destroy(w)}return m=new og({readableObjectMode:!!(e!=null&&e.readableObjectMode),writableObjectMode:!!(r!=null&&r.writableObjectMode),readable:n,writable:i}),i&&(f0e(r,w=>{i=!1,w&&jw(e,w),p(w)}),m._write=function(w,P,S){r.write(w,P)?S():o=S},m._final=function(w){r.end(),s=w},r.on("drain",function(){if(o){let w=o;o=null,w()}}),r.on("finish",function(){if(s){let w=s;s=null,w()}})),n&&(f0e(e,w=>{n=!1,w&&jw(e,w),p(w)}),e.on("readable",function(){if(a){let w=a;a=null,w()}}),e.on("end",function(){m.push(null)}),m._read=function(){for(;;){let w=e.read();if(w===null){a=m._read;return}if(!m.push(w))return}}),m._destroy=function(w,P){!w&&d!==null&&(w=new m0e),a=null,o=null,s=null,d===null?P(w):(d=P,jw(r,w),jw(e,w))},m}});var Ul=H(($4t,w0e)=>{"use strict";E();var{ObjectDefineProperties:RZe,ObjectGetOwnPropertyDescriptor:gh,ObjectKeys:IZe,ObjectSetPrototypeOf:v0e}=eo();w0e.exports=pu;var Qq=y3(),lf=Hq();v0e(pu.prototype,Qq.prototype);v0e(pu,Qq);{let t=IZe(lf.prototype);for(let e=0;e<t.length;e++){let r=t[e];pu.prototype[r]||(pu.prototype[r]=lf.prototype[r])}}function pu(t){if(!(this instanceof pu))return new pu(t);Qq.call(this,t),lf.call(this,t),t?(this.allowHalfOpen=t.allowHalfOpen!==!1,t.readable===!1&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),t.writable===!1&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)):this.allowHalfOpen=!0}RZe(pu.prototype,{writable:{__proto__:null,...gh(lf.prototype,"writable")},writableHighWaterMark:{__proto__:null,...gh(lf.prototype,"writableHighWaterMark")},writableObjectMode:{__proto__:null,...gh(lf.prototype,"writableObjectMode")},writableBuffer:{__proto__:null,...gh(lf.prototype,"writableBuffer")},writableLength:{__proto__:null,...gh(lf.prototype,"writableLength")},writableFinished:{__proto__:null,...gh(lf.prototype,"writableFinished")},writableCorked:{__proto__:null,...gh(lf.prototype,"writableCorked")},writableEnded:{__proto__:null,...gh(lf.prototype,"writableEnded")},writableNeedDrain:{__proto__:null,...gh(lf.prototype,"writableNeedDrain")},destroyed:{__proto__:null,get(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set(t){this._readableState&&this._writableState&&(this._readableState.destroyed=t,this._writableState.destroyed=t)}}});var Jq;function b0e(){return Jq===void 0&&(Jq={}),Jq}pu.fromWeb=function(t,e){return b0e().newStreamDuplexFromReadableWritablePair(t,e)};pu.toWeb=function(t){return b0e().newReadableWritablePairFromDuplex(t)};var Yq;pu.from=function(t){return Yq||(Yq=g0e()),Yq(t,"body")}});var t$=H((U4t,x0e)=>{"use strict";E();var{ObjectSetPrototypeOf:_0e,Symbol:kZe}=eo();x0e.exports=vh;var{ERR_METHOD_NOT_IMPLEMENTED:OZe}=ha().codes,e$=Ul(),{getHighWaterMark:BZe}=gP();_0e(vh.prototype,e$.prototype);_0e(vh,e$);var w3=kZe("kCallback");function vh(t){if(!(this instanceof vh))return new vh(t);let e=t?BZe(this,t,"readableHighWaterMark",!0):null;e===0&&(t={...t,highWaterMark:null,readableHighWaterMark:e,writableHighWaterMark:t.writableHighWaterMark||0}),e$.call(this,t),this._readableState.sync=!1,this[w3]=null,t&&(typeof t.transform=="function"&&(this._transform=t.transform),typeof t.flush=="function"&&(this._flush=t.flush)),this.on("prefinish",DZe)}function Xq(t){typeof this._flush=="function"&&!this.destroyed?this._flush((e,r)=>{if(e){t?t(e):this.destroy(e);return}r!=null&&this.push(r),this.push(null),t&&t()}):(this.push(null),t&&t())}function DZe(){this._final!==Xq&&Xq.call(this)}vh.prototype._final=Xq;vh.prototype._transform=function(t,e,r){throw new OZe("_transform()")};vh.prototype._write=function(t,e,r){let n=this._readableState,i=this._writableState,o=n.length;this._transform(t,e,(s,a)=>{if(s){r(s);return}a!=null&&this.push(a),i.ended||o===n.length||n.length<n.highWaterMark?r():this[w3]=r})};vh.prototype._read=function(){if(this[w3]){let t=this[w3];this[w3]=null,t()}}});var n$=H((z4t,S0e)=>{"use strict";E();var{ObjectSetPrototypeOf:E0e}=eo();S0e.exports=Nw;var r$=t$();E0e(Nw.prototype,r$.prototype);E0e(Nw,r$);function Nw(t){if(!(this instanceof Nw))return new Nw(t);r$.call(this,t)}Nw.prototype._transform=function(t,e,r){r(null,t)}});var TP=H((G4t,R0e)=>{E();var _3=ws(),{ArrayIsArray:CZe,Promise:jZe,SymbolAsyncIterator:NZe}=eo(),AP=yh(),{once:qZe}=Nl(),$Ze=rg(),M0e=Ul(),{aggregateTwoErrors:LZe,codes:{ERR_INVALID_ARG_TYPE:l$,ERR_INVALID_RETURN_VALUE:i$,ERR_MISSING_ARGS:UZe,ERR_STREAM_DESTROYED:FZe,ERR_STREAM_PREMATURE_CLOSE:zZe},AbortError:KZe}=ha(),{validateFunction:GZe,validateAbortSignal:WZe}=p3(),{isIterable:sg,isReadable:o$,isReadableNodeStream:PP,isNodeStream:P0e,isTransformStream:qw,isWebStream:VZe,isReadableStream:s$,isReadableEnded:HZe}=$l(),ZZe=globalThis.AbortController||Ud().AbortController,a$,c$;function A0e(t,e,r){let n=!1;t.on("close",()=>{n=!0});let i=AP(t,{readable:e,writable:r},o=>{n=!o});return{destroy:o=>{n||(n=!0,$Ze.destroyer(t,o||new FZe("pipe")))},cleanup:i}}function JZe(t){return GZe(t[t.length-1],"streams[stream.length - 1]"),t.pop()}function f$(t){if(sg(t))return t;if(PP(t))return YZe(t);throw new l$("val",["Readable","Iterable","AsyncIterable"],t)}async function*YZe(t){c$||(c$=y3()),yield*c$.prototype[NZe].call(t)}async function MP(t,e,r,{end:n}){let i,o=null,s=m=>{if(m&&(i=m),o){let p=o;o=null,p()}},a=()=>new jZe((m,p)=>{i?p(i):o=()=>{i?p(i):m()}});e.on("drain",s);let d=AP(e,{readable:!1},s);try{e.writableNeedDrain&&await a();for await(let m of t)e.write(m)||await a();n&&e.end(),await a(),r()}catch(m){r(i!==m?LZe(i,m):m)}finally{d(),e.off("drain",s)}}async function u$(t,e,r,{end:n}){qw(e)&&(e=e.writable);let i=e.getWriter();try{for await(let o of t)await i.ready,i.write(o).catch(()=>{});await i.ready,n&&await i.close(),r()}catch(o){try{await i.abort(o),r(o)}catch(s){r(s)}}}function QZe(...t){return T0e(t,qZe(JZe(t)))}function T0e(t,e,r){if(t.length===1&&CZe(t[0])&&(t=t[0]),t.length<2)throw new UZe("streams");let n=new ZZe,i=n.signal,o=r?.signal,s=[];WZe(o,"options.signal");function a(){S(new KZe)}o?.addEventListener("abort",a);let d,m,p=[],w=0;function P(C){S(C,--w===0)}function S(C,k){if(C&&(!d||d.code==="ERR_STREAM_PREMATURE_CLOSE")&&(d=C),!(!d&&!k)){for(;p.length;)p.shift()(d);o?.removeEventListener("abort",a),n.abort(),k&&(d||s.forEach(q=>q()),_3.nextTick(e,d,m))}}let M;for(let C=0;C<t.length;C++){let k=t[C],q=C<t.length-1,L=C>0,U=q||r?.end!==!1,F=C===t.length-1;if(P0e(k)){let N=function(G){G&&G.name!=="AbortError"&&G.code!=="ERR_STREAM_PREMATURE_CLOSE"&&P(G)};var I=N;if(U){let{destroy:G,cleanup:x}=A0e(k,q,L);p.push(G),o$(k)&&F&&s.push(x)}k.on("error",N),o$(k)&&F&&s.push(()=>{k.removeListener("error",N)})}if(C===0)if(typeof k=="function"){if(M=k({signal:i}),!sg(M))throw new i$("Iterable, AsyncIterable or Stream","source",M)}else sg(k)||PP(k)||qw(k)?M=k:M=M0e.from(k);else if(typeof k=="function"){if(qw(M)){var A;M=f$((A=M)===null||A===void 0?void 0:A.readable)}else M=f$(M);if(M=k(M,{signal:i}),q){if(!sg(M,!0))throw new i$("AsyncIterable",`transform[${C-1}]`,M)}else{var B;a$||(a$=n$());let N=new a$({objectMode:!0}),G=(B=M)===null||B===void 0?void 0:B.then;if(typeof G=="function")w++,G.call(M,u=>{m=u,u!=null&&N.write(u),U&&N.end(),_3.nextTick(P)},u=>{N.destroy(u),_3.nextTick(P,u)});else if(sg(M,!0))w++,MP(M,N,P,{end:U});else if(s$(M)||qw(M)){let u=M.readable||M;w++,MP(u,N,P,{end:U})}else throw new i$("AsyncIterable or Promise","destination",M);M=N;let{destroy:x,cleanup:c}=A0e(M,!1,!0);p.push(x),F&&s.push(c)}}else if(P0e(k)){if(PP(M)){w+=2;let N=XZe(M,k,P,{end:U});o$(k)&&F&&s.push(N)}else if(qw(M)||s$(M)){let N=M.readable||M;w++,MP(N,k,P,{end:U})}else if(sg(M))w++,MP(M,k,P,{end:U});else throw new l$("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],M);M=k}else if(VZe(k)){if(PP(M))w++,u$(f$(M),k,P,{end:U});else if(s$(M)||sg(M))w++,u$(M,k,P,{end:U});else if(qw(M))w++,u$(M.readable,k,P,{end:U});else throw new l$("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],M);M=k}else M=M0e.from(k)}return(i!=null&&i.aborted||o!=null&&o.aborted)&&_3.nextTick(a),M}function XZe(t,e,r,{end:n}){let i=!1;if(e.on("close",()=>{i||r(new zZe)}),t.pipe(e,{end:!1}),n){let s=function(){i=!0,e.end()};var o=s;HZe(t)?_3.nextTick(s):t.once("end",s)}else r();return AP(t,{readable:!0,writable:!1},s=>{let a=t._readableState;s&&s.code==="ERR_STREAM_PREMATURE_CLOSE"&&a&&a.ended&&!a.errored&&!a.errorEmitted?t.once("end",r).once("error",r):r(s)}),AP(e,{readable:!1,writable:!0},r)}R0e.exports={pipelineImpl:T0e,pipeline:QZe}});var h$=H((V4t,C0e)=>{"use strict";E();var{pipeline:eJe}=TP(),RP=Ul(),{destroyer:tJe}=rg(),{isNodeStream:IP,isReadable:I0e,isWritable:k0e,isWebStream:d$,isTransformStream:ag,isWritableStream:O0e,isReadableStream:B0e}=$l(),{AbortError:rJe,codes:{ERR_INVALID_ARG_VALUE:D0e,ERR_MISSING_ARGS:nJe}}=ha(),iJe=yh();C0e.exports=function(...e){if(e.length===0)throw new nJe("streams");if(e.length===1)return RP.from(e[0]);let r=[...e];if(typeof e[0]=="function"&&(e[0]=RP.from(e[0])),typeof e[e.length-1]=="function"){let S=e.length-1;e[S]=RP.from(e[S])}for(let S=0;S<e.length;++S)if(!(!IP(e[S])&&!d$(e[S]))){if(S<e.length-1&&!(I0e(e[S])||B0e(e[S])||ag(e[S])))throw new D0e(`streams[${S}]`,r[S],"must be readable");if(S>0&&!(k0e(e[S])||O0e(e[S])||ag(e[S])))throw new D0e(`streams[${S}]`,r[S],"must be writable")}let n,i,o,s,a;function d(S){let M=s;s=null,M?M(S):S?a.destroy(S):!P&&!w&&a.destroy()}let m=e[0],p=eJe(e,d),w=!!(k0e(m)||O0e(m)||ag(m)),P=!!(I0e(p)||B0e(p)||ag(p));if(a=new RP({writableObjectMode:!!(m!=null&&m.writableObjectMode),readableObjectMode:!!(p!=null&&p.writableObjectMode),writable:w,readable:P}),w){if(IP(m))a._write=function(M,A,B){m.write(M,A)?B():n=B},a._final=function(M){m.end(),i=M},m.on("drain",function(){if(n){let M=n;n=null,M()}});else if(d$(m)){let A=(ag(m)?m.writable:m).getWriter();a._write=async function(B,I,C){try{await A.ready,A.write(B).catch(()=>{}),C()}catch(k){C(k)}},a._final=async function(B){try{await A.ready,A.close().catch(()=>{}),i=B}catch(I){B(I)}}}let S=ag(p)?p.readable:p;iJe(S,()=>{if(i){let M=i;i=null,M()}})}if(P){if(IP(p))p.on("readable",function(){if(o){let S=o;o=null,S()}}),p.on("end",function(){a.push(null)}),a._read=function(){for(;;){let S=p.read();if(S===null){o=a._read;return}if(!a.push(S))return}};else if(d$(p)){let M=(ag(p)?p.readable:p).getReader();a._read=async function(){for(;;)try{let{value:A,done:B}=await M.read();if(!a.push(A))return;if(B){a.push(null);return}}catch{return}}}}return a._destroy=function(S,M){!S&&s!==null&&(S=new rJe),o=null,n=null,i=null,s===null?M(S):(s=M,IP(p)&&tJe(p,S))},a}});var z0e=H((Z4t,y$)=>{"use strict";E();var $0e=globalThis.AbortController||Ud().AbortController,{codes:{ERR_INVALID_ARG_VALUE:oJe,ERR_INVALID_ARG_TYPE:x3,ERR_MISSING_ARGS:sJe,ERR_OUT_OF_RANGE:aJe},AbortError:Fl}=ha(),{validateAbortSignal:cg,validateInteger:cJe,validateObject:fg}=p3(),fJe=eo().Symbol("kWeak"),{finished:uJe}=yh(),lJe=h$(),{addAbortSignalNoValidate:dJe}=m3(),{isWritable:hJe,isNodeStream:pJe}=$l(),{ArrayPrototypePush:mJe,MathFloor:yJe,Number:gJe,NumberIsNaN:vJe,Promise:j0e,PromiseReject:N0e,PromisePrototypeThen:bJe,Symbol:L0e}=eo(),kP=L0e("kEmpty"),q0e=L0e("kEof");function wJe(t,e){if(e!=null&&fg(e,"options"),e?.signal!=null&&cg(e.signal,"options.signal"),pJe(t)&&!hJe(t))throw new oJe("stream",t,"must be writable");let r=lJe(this,t);return e!=null&&e.signal&&dJe(e.signal,r),r}function OP(t,e){if(typeof t!="function")throw new x3("fn",["Function","AsyncFunction"],t);e!=null&&fg(e,"options"),e?.signal!=null&&cg(e.signal,"options.signal");let r=1;return e?.concurrency!=null&&(r=yJe(e.concurrency)),cJe(r,"concurrency",1),async function*(){var i,o;let s=new $0e,a=this,d=[],m=s.signal,p={signal:m},w=()=>s.abort();e!=null&&(i=e.signal)!==null&&i!==void 0&&i.aborted&&w(),e==null||(o=e.signal)===null||o===void 0||o.addEventListener("abort",w);let P,S,M=!1;function A(){M=!0}async function B(){try{for await(let k of a){var I;if(M)return;if(m.aborted)throw new Fl;try{k=t(k,p)}catch(q){k=N0e(q)}k!==kP&&(typeof((I=k)===null||I===void 0?void 0:I.catch)=="function"&&k.catch(A),d.push(k),P&&(P(),P=null),!M&&d.length&&d.length>=r&&await new j0e(q=>{S=q}))}d.push(q0e)}catch(k){let q=N0e(k);bJe(q,void 0,A),d.push(q)}finally{var C;M=!0,P&&(P(),P=null),e==null||(C=e.signal)===null||C===void 0||C.removeEventListener("abort",w)}}B();try{for(;;){for(;d.length>0;){let I=await d[0];if(I===q0e)return;if(m.aborted)throw new Fl;I!==kP&&(yield I),d.shift(),S&&(S(),S=null)}await new j0e(I=>{P=I})}}finally{s.abort(),M=!0,S&&(S(),S=null)}}.call(this)}function _Je(t=void 0){return t!=null&&fg(t,"options"),t?.signal!=null&&cg(t.signal,"options.signal"),async function*(){let r=0;for await(let i of this){var n;if(t!=null&&(n=t.signal)!==null&&n!==void 0&&n.aborted)throw new Fl({cause:t.signal.reason});yield[r++,i]}}.call(this)}async function U0e(t,e=void 0){for await(let r of m$.call(this,t,e))return!0;return!1}async function xJe(t,e=void 0){if(typeof t!="function")throw new x3("fn",["Function","AsyncFunction"],t);return!await U0e.call(this,async(...r)=>!await t(...r),e)}async function EJe(t,e){for await(let r of m$.call(this,t,e))return r}async function SJe(t,e){if(typeof t!="function")throw new x3("fn",["Function","AsyncFunction"],t);async function r(n,i){return await t(n,i),kP}for await(let n of OP.call(this,r,e));}function m$(t,e){if(typeof t!="function")throw new x3("fn",["Function","AsyncFunction"],t);async function r(n,i){return await t(n,i)?n:kP}return OP.call(this,r,e)}var p$=class extends sJe{constructor(){super("reduce"),this.message="Reduce of an empty stream requires an initial value"}};async function MJe(t,e,r){var n;if(typeof t!="function")throw new x3("reducer",["Function","AsyncFunction"],t);r!=null&&fg(r,"options"),r?.signal!=null&&cg(r.signal,"options.signal");let i=arguments.length>1;if(r!=null&&(n=r.signal)!==null&&n!==void 0&&n.aborted){let m=new Fl(void 0,{cause:r.signal.reason});throw this.once("error",()=>{}),await uJe(this.destroy(m)),m}let o=new $0e,s=o.signal;if(r!=null&&r.signal){let m={once:!0,[fJe]:this};r.signal.addEventListener("abort",()=>o.abort(),m)}let a=!1;try{for await(let m of this){var d;if(a=!0,r!=null&&(d=r.signal)!==null&&d!==void 0&&d.aborted)throw new Fl;i?e=await t(e,m,{signal:s}):(e=m,i=!0)}if(!a&&!i)throw new p$}finally{o.abort()}return e}async function PJe(t){t!=null&&fg(t,"options"),t?.signal!=null&&cg(t.signal,"options.signal");let e=[];for await(let n of this){var r;if(t!=null&&(r=t.signal)!==null&&r!==void 0&&r.aborted)throw new Fl(void 0,{cause:t.signal.reason});mJe(e,n)}return e}function AJe(t,e){let r=OP.call(this,t,e);return async function*(){for await(let i of r)yield*i}.call(this)}function F0e(t){if(t=gJe(t),vJe(t))return 0;if(t<0)throw new aJe("number",">= 0",t);return t}function TJe(t,e=void 0){return e!=null&&fg(e,"options"),e?.signal!=null&&cg(e.signal,"options.signal"),t=F0e(t),async function*(){var n;if(e!=null&&(n=e.signal)!==null&&n!==void 0&&n.aborted)throw new Fl;for await(let o of this){var i;if(e!=null&&(i=e.signal)!==null&&i!==void 0&&i.aborted)throw new Fl;t--<=0&&(yield o)}}.call(this)}function RJe(t,e=void 0){return e!=null&&fg(e,"options"),e?.signal!=null&&cg(e.signal,"options.signal"),t=F0e(t),async function*(){var n;if(e!=null&&(n=e.signal)!==null&&n!==void 0&&n.aborted)throw new Fl;for await(let o of this){var i;if(e!=null&&(i=e.signal)!==null&&i!==void 0&&i.aborted)throw new Fl;if(t-- >0)yield o;else return}}.call(this)}y$.exports.streamReturningOperators={asIndexedPairs:_Je,drop:TJe,filter:m$,flatMap:AJe,map:OP,take:RJe,compose:wJe};y$.exports.promiseReturningOperators={every:xJe,forEach:SJe,reduce:MJe,toArray:PJe,some:U0e,find:EJe}});var g$=H((Y4t,K0e)=>{"use strict";E();var{ArrayPrototypePop:IJe,Promise:kJe}=eo(),{isIterable:OJe,isNodeStream:BJe,isWebStream:DJe}=$l(),{pipelineImpl:CJe}=TP(),{finished:jJe}=yh();v$();function NJe(...t){return new kJe((e,r)=>{let n,i,o=t[t.length-1];if(o&&typeof o=="object"&&!BJe(o)&&!OJe(o)&&!DJe(o)){let s=IJe(t);n=s.signal,i=s.end}CJe(t,(s,a)=>{s?r(s):e(a)},{signal:n,end:i})})}K0e.exports={finished:jJe,pipeline:NJe}});var v$=H((X4t,X0e)=>{E();var{Buffer:qJe}=sr(),{ObjectDefineProperty:bh,ObjectKeys:V0e,ReflectApply:H0e}=eo(),{promisify:{custom:Z0e}}=Nl(),{streamReturningOperators:G0e,promiseReturningOperators:W0e}=z0e(),{codes:{ERR_ILLEGAL_CONSTRUCTOR:J0e}}=ha(),$Je=h$(),{pipeline:Y0e}=TP(),{destroyer:LJe}=rg(),Q0e=yh(),b$=g$(),w$=$l(),Wi=X0e.exports=pP().Stream;Wi.isDisturbed=w$.isDisturbed;Wi.isErrored=w$.isErrored;Wi.isReadable=w$.isReadable;Wi.Readable=y3();for(let t of V0e(G0e)){let r=function(...n){if(new.target)throw J0e();return Wi.Readable.from(H0e(e,this,n))};FJe=r;let e=G0e[t];bh(r,"name",{__proto__:null,value:e.name}),bh(r,"length",{__proto__:null,value:e.length}),bh(Wi.Readable.prototype,t,{__proto__:null,value:r,enumerable:!1,configurable:!0,writable:!0})}var FJe;for(let t of V0e(W0e)){let r=function(...i){if(new.target)throw J0e();return H0e(e,this,i)};FJe=r;let e=W0e[t];bh(r,"name",{__proto__:null,value:e.name}),bh(r,"length",{__proto__:null,value:e.length}),bh(Wi.Readable.prototype,t,{__proto__:null,value:r,enumerable:!1,configurable:!0,writable:!0})}var FJe;Wi.Writable=Hq();Wi.Duplex=Ul();Wi.Transform=t$();Wi.PassThrough=n$();Wi.pipeline=Y0e;var{addAbortSignal:UJe}=m3();Wi.addAbortSignal=UJe;Wi.finished=Q0e;Wi.destroy=LJe;Wi.compose=$Je;bh(Wi,"promises",{__proto__:null,configurable:!0,enumerable:!0,get(){return b$}});bh(Y0e,Z0e,{__proto__:null,enumerable:!0,get(){return b$.pipeline}});bh(Q0e,Z0e,{__proto__:null,enumerable:!0,get(){return b$.finished}});Wi.Stream=Wi;Wi._isUint8Array=function(e){return e instanceof Uint8Array};Wi._uint8ArrayToBuffer=function(e){return qJe.from(e.buffer,e.byteOffset,e.byteLength)}});var _$=H((tPt,Vi)=>{"use strict";E();var vo=v$(),zJe=g$(),KJe=vo.Readable.destroy;Vi.exports=vo.Readable;Vi.exports._uint8ArrayToBuffer=vo._uint8ArrayToBuffer;Vi.exports._isUint8Array=vo._isUint8Array;Vi.exports.isDisturbed=vo.isDisturbed;Vi.exports.isErrored=vo.isErrored;Vi.exports.isReadable=vo.isReadable;Vi.exports.Readable=vo.Readable;Vi.exports.Writable=vo.Writable;Vi.exports.Duplex=vo.Duplex;Vi.exports.Transform=vo.Transform;Vi.exports.PassThrough=vo.PassThrough;Vi.exports.addAbortSignal=vo.addAbortSignal;Vi.exports.finished=vo.finished;Vi.exports.destroy=vo.destroy;Vi.exports.destroy=KJe;Vi.exports.pipeline=vo.pipeline;Vi.exports.compose=vo.compose;Object.defineProperty(vo,"promises",{configurable:!0,enumerable:!0,get(){return zJe}});Vi.exports.Stream=vo.Stream;Vi.exports.default=Vi.exports});var uye=H((Xkt,fye)=>{"use strict";E();fye.exports=function t(e){if(typeof e=="number"&&isNaN(e))throw new Error("NaN is not allowed");if(typeof e=="number"&&!isFinite(e))throw new Error("Infinity is not allowed");return e===null||typeof e!="object"?JSON.stringify(e):e.toJSON instanceof Function?t(e.toJSON()):Array.isArray(e)?`[${e.reduce((i,o,s)=>`${i}${s===0?"":","}${t(o===void 0||typeof o=="symbol"?null:o)}`,"")}]`:`{${Object.keys(e).sort().reduce((n,i)=>{if(e[i]===void 0||typeof e[i]=="symbol")return n;let o=n.length===0?"":",";return`${n}${o}${t(i)}:${t(e[i])}`},"")}}`}});var Eye=H((rOt,xye)=>{E();var Qw=1e3,Xw=Qw*60,e1=Xw*60,hg=e1*24,dXe=hg*7,hXe=hg*365.25;xye.exports=function(t,e){e=e||{};var r=typeof t;if(r==="string"&&t.length>0)return pXe(t);if(r==="number"&&isFinite(t))return e.long?yXe(t):mXe(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))};function pXe(t){if(t=String(t),!(t.length>100)){var e=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(t);if(e){var r=parseFloat(e[1]),n=(e[2]||"ms").toLowerCase();switch(n){case"years":case"year":case"yrs":case"yr":case"y":return r*hXe;case"weeks":case"week":case"w":return r*dXe;case"days":case"day":case"d":return r*hg;case"hours":case"hour":case"hrs":case"hr":case"h":return r*e1;case"minutes":case"minute":case"mins":case"min":case"m":return r*Xw;case"seconds":case"second":case"secs":case"sec":case"s":return r*Qw;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}function mXe(t){var e=Math.abs(t);return e>=hg?Math.round(t/hg)+"d":e>=e1?Math.round(t/e1)+"h":e>=Xw?Math.round(t/Xw)+"m":e>=Qw?Math.round(t/Qw)+"s":t+"ms"}function yXe(t){var e=Math.abs(t);return e>=hg?pA(t,e,hg,"day"):e>=e1?pA(t,e,e1,"hour"):e>=Xw?pA(t,e,Xw,"minute"):e>=Qw?pA(t,e,Qw,"second"):t+" ms"}function pA(t,e,r,n){var i=e>=r*1.5;return Math.round(t/r)+" "+n+(i?"s":"")}});var Mye=H(Sye=>{E();Sye.Level=pq().BrowserLevel});var Vye=H((mDt,SL)=>{"use strict";E();var FXe=Object.prototype.hasOwnProperty,va="~";function Q3(){}Object.create&&(Q3.prototype=Object.create(null),new Q3().__proto__||(va=!1));function zXe(t,e,r){this.fn=t,this.context=e,this.once=r||!1}function Wye(t,e,r,n,i){if(typeof r!="function")throw new TypeError("The listener must be a function");var o=new zXe(r,n||t,i),s=va?va+e:e;return t._events[s]?t._events[s].fn?t._events[s]=[t._events[s],o]:t._events[s].push(o):(t._events[s]=o,t._eventsCount++),t}function wA(t,e){--t._eventsCount===0?t._events=new Q3:delete t._events[e]}function Ws(){this._events=new Q3,this._eventsCount=0}Ws.prototype.eventNames=function(){var e=[],r,n;if(this._eventsCount===0)return e;for(n in r=this._events)FXe.call(r,n)&&e.push(va?n.slice(1):n);return Object.getOwnPropertySymbols?e.concat(Object.getOwnPropertySymbols(r)):e};Ws.prototype.listeners=function(e){var r=va?va+e:e,n=this._events[r];if(!n)return[];if(n.fn)return[n.fn];for(var i=0,o=n.length,s=new Array(o);i<o;i++)s[i]=n[i].fn;return s};Ws.prototype.listenerCount=function(e){var r=va?va+e:e,n=this._events[r];return n?n.fn?1:n.length:0};Ws.prototype.emit=function(e,r,n,i,o,s){var a=va?va+e:e;if(!this._events[a])return!1;var d=this._events[a],m=arguments.length,p,w;if(d.fn){switch(d.once&&this.removeListener(e,d.fn,void 0,!0),m){case 1:return d.fn.call(d.context),!0;case 2:return d.fn.call(d.context,r),!0;case 3:return d.fn.call(d.context,r,n),!0;case 4:return d.fn.call(d.context,r,n,i),!0;case 5:return d.fn.call(d.context,r,n,i,o),!0;case 6:return d.fn.call(d.context,r,n,i,o,s),!0}for(w=1,p=new Array(m-1);w<m;w++)p[w-1]=arguments[w];d.fn.apply(d.context,p)}else{var P=d.length,S;for(w=0;w<P;w++)switch(d[w].once&&this.removeListener(e,d[w].fn,void 0,!0),m){case 1:d[w].fn.call(d[w].context);break;case 2:d[w].fn.call(d[w].context,r);break;case 3:d[w].fn.call(d[w].context,r,n);break;case 4:d[w].fn.call(d[w].context,r,n,i);break;default:if(!p)for(S=1,p=new Array(m-1);S<m;S++)p[S-1]=arguments[S];d[w].fn.apply(d[w].context,p)}}return!0};Ws.prototype.on=function(e,r,n){return Wye(this,e,r,n,!1)};Ws.prototype.once=function(e,r,n){return Wye(this,e,r,n,!0)};Ws.prototype.removeListener=function(e,r,n,i){var o=va?va+e:e;if(!this._events[o])return this;if(!r)return wA(this,o),this;var s=this._events[o];if(s.fn)s.fn===r&&(!i||s.once)&&(!n||s.context===n)&&wA(this,o);else{for(var a=0,d=[],m=s.length;a<m;a++)(s[a].fn!==r||i&&!s[a].once||n&&s[a].context!==n)&&d.push(s[a]);d.length?this._events[o]=d.length===1?d[0]:d:wA(this,o)}return this};Ws.prototype.removeAllListeners=function(e){var r;return e?(r=va?va+e:e,this._events[r]&&wA(this,r)):(this._events=new Q3,this._eventsCount=0),this};Ws.prototype.off=Ws.prototype.removeListener;Ws.prototype.addListener=Ws.prototype.on;Ws.prefixed=va;Ws.EventEmitter=Ws;typeof SL<"u"&&(SL.exports=Ws)});E();E();E();E();var VF=or(BU(),1);E();var XA={};Di(XA,{base64:()=>Zve,base64pad:()=>Jve,base64url:()=>_s,base64urlpad:()=>Yve});E();E();E();function Kve(t,e){if(t.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 i=0;i<t.length;i++){var o=t.charAt(i),s=o.charCodeAt(0);if(r[s]!==255)throw new TypeError(o+" is ambiguous");r[s]=i}var a=t.length,d=t.charAt(0),m=Math.log(a)/Math.log(256),p=Math.log(256)/Math.log(a);function w(M){if(M instanceof Uint8Array||(ArrayBuffer.isView(M)?M=new Uint8Array(M.buffer,M.byteOffset,M.byteLength):Array.isArray(M)&&(M=Uint8Array.from(M))),!(M instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(M.length===0)return"";for(var A=0,B=0,I=0,C=M.length;I!==C&&M[I]===0;)I++,A++;for(var k=(C-I)*p+1>>>0,q=new Uint8Array(k);I!==C;){for(var L=M[I],U=0,F=k-1;(L!==0||U<B)&&F!==-1;F--,U++)L+=256*q[F]>>>0,q[F]=L%a>>>0,L=L/a>>>0;if(L!==0)throw new Error("Non-zero carry");B=U,I++}for(var N=k-B;N!==k&&q[N]===0;)N++;for(var G=d.repeat(A);N<k;++N)G+=t.charAt(q[N]);return G}function P(M){if(typeof M!="string")throw new TypeError("Expected String");if(M.length===0)return new Uint8Array;var A=0;if(M[A]!==" "){for(var B=0,I=0;M[A]===d;)B++,A++;for(var C=(M.length-A)*m+1>>>0,k=new Uint8Array(C);M[A];){var q=r[M.charCodeAt(A)];if(q===255)return;for(var L=0,U=C-1;(q!==0||L<I)&&U!==-1;U--,L++)q+=a*k[U]>>>0,k[U]=q%256>>>0,q=q/256>>>0;if(q!==0)throw new Error("Non-zero carry");I=L,A++}if(M[A]!==" "){for(var F=C-I;F!==C&&k[F]===0;)F++;for(var N=new Uint8Array(B+(C-F)),G=B;F!==C;)N[G++]=k[F++];return N}}}function S(M){var A=P(M);if(A)return A;throw new Error(`Non-${e} character`)}return{encode:w,decodeUnsafe:P,decode:S}}var Gve=Kve,Wve=Gve,DU=Wve;E();var Xet=new Uint8Array(0);var CU=(t,e)=>{if(t===e)return!0;if(t.byteLength!==e.byteLength)return!1;for(let r=0;r<t.byteLength;r++)if(t[r]!==e[r])return!1;return!0},gf=t=>{if(t instanceof Uint8Array&&t.constructor.name==="Uint8Array")return t;if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);throw new Error("Unknown type, must be binary type")};var jU=t=>new TextEncoder().encode(t),NU=t=>new TextDecoder().decode(t);E();var ZA=class{constructor(e,r,n){this.name=e,this.prefix=r,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},JA=class{constructor(e,r,n){if(this.name=e,this.prefix=r,r.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return qU(this,e)}},YA=class{constructor(e){this.decoders=e}or(e){return qU(this,e)}decode(e){let r=e[0],n=this.decoders[r];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}},qU=(t,e)=>new YA({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}}),QA=class{constructor(e,r,n,i){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new ZA(e,r,n),this.decoder=new JA(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}},Ag=({name:t,prefix:e,encode:r,decode:n})=>new QA(t,e,r,n),Oh=({prefix:t,name:e,alphabet:r})=>{let{encode:n,decode:i}=DU(r,e);return Ag({prefix:t,name:e,encode:n,decode:o=>gf(i(o))})},Vve=(t,e,r,n)=>{let i={};for(let p=0;p<e.length;++p)i[e[p]]=p;let o=t.length;for(;t[o-1]==="=";)--o;let s=new Uint8Array(o*r/8|0),a=0,d=0,m=0;for(let p=0;p<o;++p){let w=i[t[p]];if(w===void 0)throw new SyntaxError(`Non-${n} character`);d=d<<r|w,a+=r,a>=8&&(a-=8,s[m++]=255&d>>a)}if(a>=r||255&d<<8-a)throw new SyntaxError("Unexpected end of data");return s},Hve=(t,e,r)=>{let n=e[e.length-1]==="=",i=(1<<r)-1,o="",s=0,a=0;for(let d=0;d<t.length;++d)for(a=a<<8|t[d],s+=8;s>r;)s-=r,o+=e[i&a>>s];if(s&&(o+=e[i&a<<r-s]),n)for(;o.length*r&7;)o+="=";return o},_i=({name:t,prefix:e,bitsPerChar:r,alphabet:n})=>Ag({prefix:e,name:t,encode(i){return Hve(i,n,r)},decode(i){return Vve(i,n,r,t)}});var Zve=_i({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),Jve=_i({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),_s=_i({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),Yve=_i({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var eT=new TextEncoder,Qve=new TextDecoder,et=class{static base64UrlToBytes(e){return _s.baseDecode(e)}static base64UrlToObject(e){let r=_s.baseDecode(e);return et.bytesToObject(r)}static bytesToBase64Url(e){return _s.baseEncode(e)}static bytesToString(e){return Qve.decode(e)}static bytesToObject(e){let r=et.bytesToString(e);return JSON.parse(r)}static objectToBytes(e){let r=JSON.stringify(e);return eT.encode(r)}static stringToBase64Url(e){let r=eT.encode(e);return _s.baseEncode(r)}static stringToBytes(e){return eT.encode(e)}};E();E();E();E();var Fo=2n**255n-19n,Tg=2n**252n+27742317777372353535851937790883648493n,tT=0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51an,rT=0x6666666666666666666666666666666666666666666666666666666666666658n,yE={a:-1n,d:37095705934669439343138083508754565189542113879843219016388785533085940283555n,p:Fo,n:Tg,h:8,Gx:tT,Gy:rT},Vs=(t="")=>{throw new Error(t)},zU=t=>typeof t=="string",bE=(t,e)=>!(t instanceof Uint8Array)||typeof e=="number"&&e>0&&t.length!==e?Vs("Uint8Array expected"):t,Rg=t=>new Uint8Array(t),Ig=(t,e)=>bE(zU(t)?iT(t):Rg(t),e),Et=(t,e=Fo)=>{let r=t%e;return r>=0n?r:e+r},$U=t=>t instanceof xs?t:Vs("Point expected"),LU,xs=class{constructor(e,r,n,i){this.ex=e,this.ey=r,this.ez=n,this.et=i}static fromAffine(e){return new xs(e.x,e.y,1n,Et(e.x*e.y))}static fromHex(e,r=!0){let{d:n}=yE;e=Ig(e,32);let i=e.slice();i[31]=e[31]&-129;let o=oT(i);o===0n||(r&&!(0n<o&&o<Fo)&&Vs("bad y coord 1"),!r&&!(0n<o&&o<2n**256n)&&Vs("bad y coord 2"));let s=Et(o*o),a=Et(s-1n),d=Et(n*s+1n),{isValid:m,value:p}=ebe(a,d);m||Vs("bad y coordinate 3");let w=(p&1n)===1n;return(e[31]&128)!==0!==w&&(p=Et(-p)),new xs(p,o,1n,Et(p*o))}get x(){return this.toAffine().x}get y(){return this.toAffine().y}equals(e){let{ex:r,ey:n,ez:i}=this,{ex:o,ey:s,ez:a}=$U(e),d=Et(r*a),m=Et(o*i),p=Et(n*a),w=Et(s*i);return d===m&&p===w}is0(){return this.equals(gE)}negate(){return new xs(Et(-this.ex),this.ey,this.ez,Et(-this.et))}double(){let{ex:e,ey:r,ez:n}=this,{a:i}=yE,o=Et(e*e),s=Et(r*r),a=Et(2n*Et(n*n)),d=Et(i*o),m=e+r,p=Et(Et(m*m)-o-s),w=d+s,P=w-a,S=d-s,M=Et(p*P),A=Et(w*S),B=Et(p*S),I=Et(P*w);return new xs(M,A,I,B)}add(e){let{ex:r,ey:n,ez:i,et:o}=this,{ex:s,ey:a,ez:d,et:m}=$U(e),{a:p,d:w}=yE,P=Et(r*s),S=Et(n*a),M=Et(o*w*m),A=Et(i*d),B=Et((r+n)*(s+a)-P-S),I=Et(A-M),C=Et(A+M),k=Et(S-p*P),q=Et(B*I),L=Et(C*k),U=Et(B*k),F=Et(I*C);return new xs(q,L,F,U)}mul(e,r=!0){if(e===0n)return r===!0?Vs("cannot multiply by 0"):gE;if(typeof e=="bigint"&&0n<e&&e<Tg||Vs("invalid scalar, must be < L"),!r&&this.is0()||e===1n)return this;if(this.equals(Bh))return obe(e).p;let n=gE,i=Bh;for(let o=this;e>0n;o=o.double(),e>>=1n)e&1n?n=n.add(o):r&&(i=i.add(o));return n}multiply(e){return this.mul(e)}clearCofactor(){return this.mul(BigInt(yE.h),!1)}isSmallOrder(){return this.clearCofactor().is0()}isTorsionFree(){let e=this.mul(Tg/2n,!1).double();return Tg%2n&&(e=e.add(this)),e.is0()}toAffine(){let{ex:e,ey:r,ez:n}=this;if(this.is0())return{x:0n,y:0n};let i=WU(n);return Et(n*i)!==1n&&Vs("invalid inverse"),{x:Et(e*i),y:Et(r*i)}}toRawBytes(){let{x:e,y:r}=this.toAffine(),n=GU(r);return n[31]|=e&1n?128:0,n}toHex(){return nT(this.toRawBytes())}};xs.BASE=new xs(tT,rT,1n,Et(tT*rT));xs.ZERO=new xs(0n,1n,1n,0n);var{BASE:Bh,ZERO:gE}=xs,KU=(t,e)=>t.toString(16).padStart(e,"0"),nT=t=>Array.from(t).map(e=>KU(e,2)).join(""),iT=t=>{let e=t.length;(!zU(t)||e%2)&&Vs("hex invalid 1");let r=Rg(e/2);for(let n=0;n<r.length;n++){let i=n*2,o=t.slice(i,i+2),s=Number.parseInt(o,16);(Number.isNaN(s)||s<0)&&Vs("hex invalid 2"),r[n]=s}return r},GU=t=>iT(KU(t,32*2)).reverse(),oT=t=>BigInt("0x"+nT(Rg(bE(t)).reverse())),p1=(...t)=>{let e=Rg(t.reduce((n,i)=>n+bE(i).length,0)),r=0;return t.forEach(n=>{e.set(n,r),r+=n.length}),e},WU=(t,e=Fo)=>{(t===0n||e<=0n)&&Vs("no inverse n="+t+" mod="+e);let r=Et(t,e),n=e,i=0n,o=1n,s=1n,a=0n;for(;r!==0n;){let d=n/r,m=n%r,p=i-s*d,w=o-a*d;n=r,r=m,i=s,o=a,s=p,a=w}return n===1n?Et(i,e):Vs("no inverse")},Au=(t,e)=>{let r=t;for(;e-- >0n;)r*=r,r%=Fo;return r},Xve=t=>{let r=t*t%Fo*t%Fo,n=Au(r,2n)*r%Fo,i=Au(n,1n)*t%Fo,o=Au(i,5n)*i%Fo,s=Au(o,10n)*o%Fo,a=Au(s,20n)*s%Fo,d=Au(a,40n)*a%Fo,m=Au(d,80n)*d%Fo,p=Au(m,80n)*d%Fo,w=Au(p,10n)*o%Fo;return{pow_p_5_8:Au(w,2n)*t%Fo,b2:r}},UU=19681161376707505956807079304988542015446066515923890162744021073123829784752n,ebe=(t,e)=>{let r=Et(e*e*e),n=Et(r*r*e),i=Xve(t*n).pow_p_5_8,o=Et(t*r*i),s=Et(e*o*o),a=o,d=Et(o*UU),m=s===t,p=s===Et(-t),w=s===Et(-t*UU);return m&&(o=a),(p||w)&&(o=d),(Et(o)&1n)===1n&&(o=Et(-o)),{isValid:m||p,value:o}},vE=t=>Et(oT(t),Tg),h1,sT=(...t)=>wE.sha512Async(...t),VU=(...t)=>typeof h1=="function"?h1(...t):Vs("etc.sha512Sync not set"),HU=t=>{let e=t.slice(0,32);e[0]&=248,e[31]&=127,e[31]|=64;let r=t.slice(32,64),n=vE(e),i=Bh.mul(n),o=i.toRawBytes();return{head:e,prefix:r,scalar:n,point:i,pointBytes:o}},aT=t=>sT(Ig(t,32)).then(HU),tbe=t=>HU(VU(Ig(t,32))),cT=t=>aT(t).then(e=>e.pointBytes);function ZU(t,e){return t?sT(e.hashable).then(e.finish):e.finish(VU(e.hashable))}var rbe=(t,e,r)=>{let{pointBytes:n,scalar:i}=t,o=vE(e),s=Bh.mul(o).toRawBytes();return{hashable:p1(s,n,r),finish:m=>{let p=Et(o+vE(m)*i,Tg);return bE(p1(s,GU(p)),64)}}},JU=async(t,e)=>{let r=Ig(t),n=await aT(e),i=await sT(n.prefix,r);return ZU(!0,rbe(n,i,r))};var nbe=(t,e,r)=>{e=Ig(e),t=Ig(t,64);let n=xs.fromHex(r,!1),i=xs.fromHex(t.slice(0,32),!1),o=oT(t.slice(32,64)),s=Bh.mul(o,!1);return{hashable:p1(i.toRawBytes(),n.toRawBytes(),e),finish:m=>{let p=vE(m);return i.add(n.mul(p,!1)).add(s.negate()).clearCofactor().is0()}}},YU=async(t,e,r)=>ZU(!0,nbe(t,e,r));var FU=()=>typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0,wE={bytesToHex:nT,hexToBytes:iT,concatBytes:p1,mod:Et,invert:WU,randomBytes:t=>{let e=FU();return e||Vs("crypto.getRandomValues must be defined"),e.getRandomValues(Rg(t))},sha512Async:async(...t)=>{let e=FU();e||Vs("crypto.subtle or etc.sha512Async must be defined");let r=p1(...t);return Rg(await e.subtle.digest("SHA-512",r.buffer))},sha512Sync:void 0};Object.defineProperties(wE,{sha512Sync:{configurable:!1,get(){return h1},set(t){h1||(h1=t)}}});var fT={getExtendedPublicKeyAsync:aT,getExtendedPublicKey:tbe,randomPrivateKey:()=>wE.randomBytes(32),precompute(t=8,e=Bh){return e.multiply(3n),e}},I0=8,ibe=()=>{let t=[],e=256/I0+1,r=Bh,n=r;for(let i=0;i<e;i++){n=r,t.push(n);for(let o=1;o<2**(I0-1);o++)n=n.add(r),t.push(n);r=n.double()}return t},obe=t=>{let e=LU||(LU=ibe()),r=(p,w)=>{let P=w.negate();return p?P:w},n=gE,i=Bh,o=1+256/I0,s=2**(I0-1),a=BigInt(2**I0-1),d=2**I0,m=BigInt(I0);for(let p=0;p<o;p++){let w=p*s,P=Number(t&a);t>>=m,P>s&&(P-=d,t+=1n);let S=w,M=w+Math.abs(P)-1,A=p%2!==0,B=P<0;P===0?i=i.add(r(A,e[S])):n=n.add(r(B,e[M]))}return{p:n,f:i}};E();var be=class extends Error{constructor(r,n){super(`${r}: ${n}`);this.code=r;this.name="DwnError"}},Gr=(je=>(je.AuthenticateJwsMissing="AuthenticateJwsMissing",je.AuthenticateDescriptorCidMismatch="AuthenticateDescriptorCidMismatch",je.AuthenticationMoreThanOneSignatureNotSupported="AuthenticationMoreThanOneSignatureNotSupported",je.AuthorizationAuthorNotOwner="AuthorizationAuthorNotOwner",je.AuthorizationNotGrantedToAuthor="AuthorizationNotGrantedToAuthor",je.ComputeCidCodecNotSupported="ComputeCidCodecNotSupported",je.ComputeCidMultihashNotSupported="ComputeCidMultihashNotSupported",je.DidMethodNotSupported="DidMethodNotSupported",je.DidNotString="DidNotString",je.DidNotValid="DidNotValid",je.DidResolutionFailed="DidResolutionFailed",je.Ed25519InvalidJwk="Ed25519InvalidJwk",je.EventEmitterStreamNotOpenError="EventEmitterStreamNotOpenError",je.EventsSubscribeEventStreamUnimplemented="EventsSubscribeEventStreamUnimplemented",je.GeneralJwsVerifierGetPublicKeyNotFound="GeneralJwsVerifierGetPublicKeyNotFound",je.GeneralJwsVerifierInvalidSignature="GeneralJwsVerifierInvalidSignature",je.GrantAuthorizationGrantExpired="GrantAuthorizationGrantExpired",je.GrantAuthorizationGrantMissing="GrantAuthorizationGrantMissing",je.GrantAuthorizationGrantRevoked="GrantAuthorizationGrantRevoked",je.GrantAuthorizationInterfaceMismatch="GrantAuthorizationInterfaceMismatch",je.GrantAuthorizationMethodMismatch="GrantAuthorizationMethodMismatch",je.GrantAuthorizationNotGrantedForTenant="GrantAuthorizationNotGrantedForTenant",je.GrantAuthorizationNotGrantedToAuthor="GrantAuthorizationNotGrantedToAuthor",je.GrantAuthorizationGrantNotYetActive="GrantAuthorizationGrantNotYetActive",je.HdKeyDerivationPathInvalid="HdKeyDerivationPathInvalid",je.JwsVerifySignatureUnsupportedCrv="JwsVerifySignatureUnsupportedCrv",je.IndexInvalidCursorValueType="IndexInvalidCursorValueType",je.IndexInvalidCursorSortProperty="IndexInvalidCursorSortProperty",je.IndexInvalidSortPropertyInMemory="IndexInvalidSortPropertyInMemory",je.IndexMissingIndexableProperty="IndexMissingIndexableProperty",je.JwsDecodePlainObjectPayloadInvalid="JwsDecodePlainObjectPayloadInvalid",je.MessageGetInvalidCid="MessageGetInvalidCid",je.ParseCidCodecNotSupported="ParseCidCodecNotSupported",je.ParseCidMultihashNotSupported="ParseCidMultihashNotSupported",je.PermissionsProtocolValidateSchemaUnexpectedRecord="PermissionsProtocolValidateSchemaUnexpectedRecord",je.PermissionsProtocolValidateScopeContextIdProhibitedProperties="PermissionsProtocolValidateScopeContextIdProhibitedProperties",je.PermissionsProtocolValidateScopeSchemaProhibitedProperties="PermissionsProtocolValidateScopeSchemaProhibitedProperties",je.PrivateKeySignerUnableToDeduceAlgorithm="PrivateKeySignerUnableToDeduceAlgorithm",je.PrivateKeySignerUnableToDeduceKeyId="PrivateKeySignerUnableToDeduceKeyId",je.PrivateKeySignerUnsupportedCurve="PrivateKeySignerUnsupportedCurve",je.ProtocolAuthorizationActionNotAllowed="ProtocolAuthorizationActionNotAllowed",je.ProtocolAuthorizationActionRulesNotFound="ProtocolAuthorizationActionRulesNotFound",je.ProtocolAuthorizationIncorrectDataFormat="ProtocolAuthorizationIncorrectDataFormat",je.ProtocolAuthorizationIncorrectContextId="ProtocolAuthorizationIncorrectContextId",je.ProtocolAuthorizationIncorrectProtocolPath="ProtocolAuthorizationIncorrectProtocolPath",je.ProtocolAuthorizationDuplicateRoleRecipient="ProtocolAuthorizationDuplicateRoleRecipient",je.ProtocolAuthorizationInvalidSchema="ProtocolAuthorizationInvalidSchema",je.ProtocolAuthorizationInvalidType="ProtocolAuthorizationInvalidType",je.ProtocolAuthorizationMatchingRoleRecordNotFound="ProtocolAuthorizationMatchingRoleRecordNotFound",je.ProtocolAuthorizationMaxSizeInvalid="ProtocolAuthorizationMaxSizeInvalid",je.ProtocolAuthorizationMinSizeInvalid="ProtocolAuthorizationMinSizeInvalid",je.ProtocolAuthorizationMissingContextId="ProtocolAuthorizationMissingContextId",je.ProtocolAuthorizationMissingRuleSet="ProtocolAuthorizationMissingRuleSet",je.ProtocolAuthorizationParentlessIncorrectProtocolPath="ProtocolAuthorizationParentlessIncorrectProtocolPath",je.ProtocolAuthorizationNotARole="ProtocolAuthorizationNotARole",je.ProtocolAuthorizationParentNotFoundConstructingRecordChain="ProtocolAuthorizationParentNotFoundConstructingRecordChain",je.ProtocolAuthorizationProtocolNotFound="ProtocolAuthorizationProtocolNotFound",je.ProtocolAuthorizationQueryWithoutRole="ProtocolAuthorizationQueryWithoutRole",je.ProtocolAuthorizationRoleMissingRecipient="ProtocolAuthorizationRoleMissingRecipient",je.ProtocolAuthorizationTagsInvalidSchema="ProtocolAuthorizationTagsInvalidSchema",je.ProtocolsConfigureDuplicateActorInRuleSet="ProtocolsConfigureDuplicateActorInRuleSet",je.ProtocolsConfigureDuplicateRoleInRuleSet="ProtocolsConfigureDuplicateRoleInRuleSet",je.ProtocolsConfigureInvalidSize="ProtocolsConfigureInvalidSize",je.ProtocolsConfigureInvalidActionMissingOf="ProtocolsConfigureInvalidActionMissingOf",je.ProtocolsConfigureInvalidActionOfNotAllowed="ProtocolsConfigureInvalidActionOfNotAllowed",je.ProtocolsConfigureInvalidActionDeleteWithoutCreate="ProtocolsConfigureInvalidActionDeleteWithoutCreate",je.ProtocolsConfigureInvalidActionUpdateWithoutCreate="ProtocolsConfigureInvalidActionUpdateWithoutCreate",je.ProtocolsConfigureInvalidRecipientOfAction="ProtocolsConfigureInvalidRecipientOfAction",je.ProtocolsConfigureInvalidRuleSetRecordType="ProtocolsConfigureInvalidRuleSetRecordType",je.ProtocolsConfigureInvalidTagSchema="ProtocolsConfigureInvalidTagSchema",je.ProtocolsConfigureQueryNotAllowed="ProtocolsConfigureQueryNotAllowed",je.ProtocolsConfigureRecordNestingDepthExceeded="ProtocolsConfigureRecordNestingDepthExceeded",je.ProtocolsConfigureRoleDoesNotExistAtGivenPath="ProtocolsConfigureRoleDoesNotExistAtGivenPath",je.ProtocolsConfigureUnauthorized="ProtocolsConfigureUnauthorized",je.ProtocolsQueryUnauthorized="ProtocolsQueryUnauthorized",je.RecordsAuthorDelegatedGrantAndIdExistenceMismatch="RecordsAuthorDelegatedGrantAndIdExistenceMismatch",je.RecordsAuthorDelegatedGrantCidMismatch="RecordsAuthorDelegatedGrantCidMismatch",je.RecordsAuthorDelegatedGrantGrantedToAndOwnerSignatureMismatch="RecordsAuthorDelegatedGrantGrantedToAndOwnerSignatureMismatch",je.RecordsAuthorDelegatedGrantNotADelegatedGrant="RecordsAuthorDelegatedGrantNotADelegatedGrant",je.RecordsDecryptNoMatchingKeyEncryptedFound="RecordsDecryptNoMatchingKeyEncryptedFound",je.RecordsDeleteAuthorizationFailed="RecordsDeleteAuthorizationFailed",je.RecordsQueryCreateFilterPublishedSortInvalid="RecordsQueryCreateFilterPublishedSortInvalid",je.RecordsQueryParseFilterPublishedSortInvalid="RecordsQueryParseFilterPublishedSortInvalid",je.RecordsGrantAuthorizationConditionPublicationProhibited="RecordsGrantAuthorizationConditionPublicationProhibited",je.RecordsGrantAuthorizationConditionPublicationRequired="RecordsGrantAuthorizationConditionPublicationRequired",je.RecordsGrantAuthorizationDeleteProtocolScopeMismatch="RecordsGrantAuthorizationDeleteProtocolScopeMismatch",je.RecordsGrantAuthorizationQueryOrSubscribeProtocolScopeMismatch="RecordsGrantAuthorizationQueryOrSubscribeProtocolScopeMismatch",je.RecordsGrantAuthorizationScopeContextIdMismatch="RecordsGrantAuthorizationScopeContextIdMismatch",je.RecordsGrantAuthorizationScopeMissingProtocol="RecordsGrantAuthorizationScopeMissingProtocol",je.RecordsGrantAuthorizationScopeNotRecords="RecordsGrantAuthorizationScopeNotRecords",je.RecordsGrantAuthorizationScopeProtocolMismatch="RecordsGrantAuthorizationScopeProtocolMismatch",je.RecordsGrantAuthorizationScopeProtocolPathMismatch="RecordsGrantAuthorizationScopeProtocolPathMismatch",je.RecordsGrantAuthorizationScopeSchema="RecordsGrantAuthorizationScopeSchema",je.RecordsDerivePrivateKeyUnSupportedCurve="RecordsDerivePrivateKeyUnSupportedCurve",je.RecordsInvalidAncestorKeyDerivationSegment="RecordsInvalidAncestorKeyDerivationSegment",je.RecordsOwnerDelegatedGrantAndIdExistenceMismatch="RecordsOwnerDelegatedGrantAndIdExistenceMismatch",je.RecordsOwnerDelegatedGrantCidMismatch="RecordsOwnerDelegatedGrantCidMismatch",je.RecordsOwnerDelegatedGrantGrantedToAndOwnerSignatureMismatch="RecordsOwnerDelegatedGrantGrantedToAndOwnerSignatureMismatch",je.RecordsOwnerDelegatedGrantNotADelegatedGrant="RecordsOwnerDelegatedGrantNotADelegatedGrant",je.RecordsProtocolContextDerivationSchemeMissingContextId="RecordsProtocolContextDerivationSchemeMissingContextId",je.RecordsProtocolPathDerivationSchemeMissingProtocol="RecordsProtocolPathDerivationSchemeMissingProtocol",je.RecordsQueryFilterMissingRequiredProperties="RecordsQueryFilterMissingRequiredProperties",je.RecordsReadReturnedMultiple="RecordsReadReturnedMultiple",je.RecordsReadAuthorizationFailed="RecordsReadAuthorizationFailed",je.RecordsSubscribeEventStreamUnimplemented="RecordsSubscribeEventStreamUnimplemented",je.RecordsSubscribeFilterMissingRequiredProperties="RecordsSubscribeFilterMissingRequiredProperties",je.RecordsSchemasDerivationSchemeMissingSchema="RecordsSchemasDerivationSchemeMissingSchema",je.RecordsWriteAttestationIntegrityMoreThanOneSignature="RecordsWriteAttestationIntegrityMoreThanOneSignature",je.RecordsWriteAttestationIntegrityDescriptorCidMismatch="RecordsWriteAttestationIntegrityDescriptorCidMismatch",je.RecordsWriteAttestationIntegrityInvalidPayloadProperty="RecordsWriteAttestationIntegrityInvalidPayloadProperty",je.RecordsWriteAuthorizationFailed="RecordsWriteAuthorizationFailed",je.RecordsWriteCreateMissingSigner="RecordsWriteCreateMissingSigner",je.RecordsWriteCreateDataAndDataCidMutuallyExclusive="RecordsWriteCreateDataAndDataCidMutuallyExclusive",je.RecordsWriteCreateDataCidAndDataSizeMutuallyInclusive="RecordsWriteCreateDataCidAndDataSizeMutuallyInclusive",je.RecordsWriteCreateProtocolAndProtocolPathMutuallyInclusive="RecordsWriteCreateProtocolAndProtocolPathMutuallyInclusive",je.RecordsWriteDataCidMismatch="RecordsWriteDataCidMismatch",je.RecordsWriteDataSizeMismatch="RecordsWriteDataSizeMismatch",je.RecordsWriteGetEntryIdUndefinedAuthor="RecordsWriteGetEntryIdUndefinedAuthor",je.RecordsWriteGetInitialWriteNotFound="RecordsWriteGetInitialWriteNotFound",je.RecordsWriteImmutablePropertyChanged="RecordsWriteImmutablePropertyChanged",je.RecordsWriteMissingSigner="RecordsWriteMissingSigner",je.RecordsWriteMissingDataInPrevious="RecordsWriteMissingDataInPrevious",je.RecordsWriteMissingEncodedDataInPrevious="RecordsWriteMissingEncodedDataInPrevious",je.RecordsWriteMissingDataStream="RecordsWriteMissingDataStream",je.RecordsWriteMissingProtocol="RecordsWriteMissingProtocol",je.RecordsWriteMissingSchema="RecordsWriteMissingSchema",je.RecordsWriteOwnerAndTenantMismatch="RecordsWriteOwnerAndTenantMismatch",je.RecordsWriteSignAsOwnerDelegateUnknownAuthor="RecordsWriteSignAsOwnerDelegateUnknownAuthor",je.RecordsWriteSignAsOwnerUnknownAuthor="RecordsWriteSignAsOwnerUnknownAuthor",je.RecordsWriteValidateIntegrityAttestationMismatch="RecordsWriteValidateIntegrityAttestationMismatch",je.RecordsWriteValidateIntegrityContextIdMismatch="RecordsWriteValidateIntegrityContextIdMismatch",je.RecordsWriteValidateIntegrityContextIdNotInSignerSignaturePayload="RecordsWriteValidateIntegrityContextIdNotInSignerSignaturePayload",je.RecordsWriteValidateIntegrityDateCreatedMismatch="RecordsWriteValidateIntegrityDateCreatedMismatch",je.RecordsWriteValidateIntegrityEncryptionCidMismatch="RecordsWriteValidateIntegrityEncryptionCidMismatch",je.RecordsWriteValidateIntegrityRecordIdUnauthorized="RecordsWriteValidateIntegrityRecordIdUnauthorized",je.SchemaValidatorAdditionalPropertyNotAllowed="SchemaValidatorAdditionalPropertyNotAllowed",je.SchemaValidatorFailure="SchemaValidatorFailure",je.SchemaValidatorSchemaNotFound="SchemaValidatorSchemaNotFound",je.SchemaValidatorUnevaluatedPropertyNotAllowed="SchemaValidatorUnevaluatedPropertyNotAllowed",je.Secp256k1KeyNotValid="Secp256k1KeyNotValid",je.Secp256r1KeyNotValid="Secp256r1KeyNotValid",je.TimestampInvalid="TimestampInvalid",je.UrlProtocolNotNormalized="UrlProtocolNotNormalized",je.UrlProtocolNotNormalizable="UrlProtocolNotNormalizable",je.UrlSchemaNotNormalized="UrlSchemaNotNormalized",je.UrlSchemaNotNormalizable="UrlSchemaNotNormalizable",je))(Gr||{});function XU(t){if(t.kty!=="OKP"||t.crv!=="Ed25519")throw new be("Ed25519InvalidJwk","invalid jwk. kty MUST be OKP. crv MUST be Ed25519")}function eF(t){return{alg:"EdDSA",kty:"OKP",crv:"Ed25519",x:et.bytesToBase64Url(t)}}var m1={sign:async(t,e)=>{XU(e);let r=et.base64UrlToBytes(e.d);return JU(t,r)},verify:async(t,e,r)=>{XU(r);let n=et.base64UrlToBytes(r.x);return YU(e,t,n)},generateKeyPair:async()=>{let t=fT.randomPrivateKey(),e=await cT(t),r=et.bytesToBase64Url(t),n=eF(e),i={...n,d:r};return{publicJwk:n,privateJwk:i}},publicKeyToJwk:async t=>eF(t)};E();E();var dT=2n**256n,Dh=dT-0x1000003d1n,io=dT-0x14551231950b75fc4402da1732fc9bebfn,sF=0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798n,aF=0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8n,cF={p:Dh,n:io,a:0n,b:7n,Gx:sF,Gy:aF},Es=32,tF=t=>rt(rt(t*t)*t+cF.b),mn=(t="")=>{throw new Error(t)},SE=t=>typeof t=="bigint",fF=t=>typeof t=="string",uT=t=>SE(t)&&0n<t&&t<Dh,v1=t=>SE(t)&&0n<t&&t<io,uF=(t,e)=>!(t instanceof Uint8Array)||typeof e=="number"&&e>0&&t.length!==e?mn("Uint8Array expected"):t,Ua=t=>new Uint8Array(t),id=(t,e)=>uF(fF(t)?b1(t):Ua(t),e),rt=(t,e=Dh)=>{let r=t%e;return r>=0n?r:e+r},rF=t=>t instanceof xi?t:mn("Point expected"),nF,xi=class{constructor(e,r,n){this.px=e,this.py=r,this.pz=n}static fromAffine(e){return new xi(e.x,e.y,1n)}static fromHex(e){e=id(e);let r,n=e[0],i=e.subarray(1),o=xE(i,0,Es),s=e.length;if(s===33&&[2,3].includes(n)){uT(o)||mn("Point hex invalid: x not FE");let a=sbe(tF(o)),d=(a&1n)===1n;(n&1)===1!==d&&(a=rt(-a)),r=new xi(o,a,1n)}return s===65&&n===4&&(r=new xi(o,xE(i,Es,2*Es),1n)),r?r.ok():mn("Point is not on curve")}static fromPrivateKey(e){return nd.mul(EE(e))}get x(){return this.aff().x}get y(){return this.aff().y}equals(e){let{px:r,py:n,pz:i}=this,{px:o,py:s,pz:a}=rF(e),d=rt(r*a),m=rt(o*i),p=rt(n*a),w=rt(s*i);return d===m&&p===w}negate(){return new xi(this.px,rt(-this.py),this.pz)}double(){return this.add(this)}add(e){let{px:r,py:n,pz:i}=this,{px:o,py:s,pz:a}=rF(e),{a:d,b:m}=cF,p=0n,w=0n,P=0n,S=rt(m*3n),M=rt(r*o),A=rt(n*s),B=rt(i*a),I=rt(r+n),C=rt(o+s);I=rt(I*C),C=rt(M+A),I=rt(I-C),C=rt(r+i);let k=rt(o+a);return C=rt(C*k),k=rt(M+B),C=rt(C-k),k=rt(n+i),p=rt(s+a),k=rt(k*p),p=rt(A+B),k=rt(k-p),P=rt(d*C),p=rt(S*B),P=rt(p+P),p=rt(A-P),P=rt(A+P),w=rt(p*P),A=rt(M+M),A=rt(A+M),B=rt(d*B),C=rt(S*C),A=rt(A+B),B=rt(M-B),B=rt(d*B),C=rt(C+B),M=rt(A*C),w=rt(w+M),M=rt(k*C),p=rt(I*p),p=rt(p-M),M=rt(I*A),P=rt(k*P),P=rt(P+M),new xi(p,w,P)}mul(e,r=!0){if(!r&&e===0n)return _E;if(v1(e)||mn("invalid scalar"),this.equals(nd))return lbe(e).p;let n=_E,i=nd;for(let o=this;e>0n;o=o.double(),e>>=1n)e&1n?n=n.add(o):r&&(i=i.add(o));return n}mulAddQUns(e,r,n){return this.mul(r,!1).add(e.mul(n,!1)).ok()}toAffine(){let{px:e,py:r,pz:n}=this;if(this.equals(_E))return{x:0n,y:0n};if(n===1n)return{x:e,y:r};let i=_1(n);return rt(n*i)!==1n&&mn("invalid inverse"),{x:rt(e*i),y:rt(r*i)}}assertValidity(){let{x:e,y:r}=this.aff();return(!uT(e)||!uT(r))&&mn("Point invalid: x or y"),rt(r*r)===tF(e)?this:mn("Point invalid: not on curve")}multiply(e){return this.mul(e)}aff(){return this.toAffine()}ok(){return this.assertValidity()}toHex(e=!0){let{x:r,y:n}=this.aff();return(e?(n&1n)===0n?"02":"03":"04")+y1(r)+(e?"":y1(n))}toRawBytes(e=!0){return b1(this.toHex(e))}};xi.BASE=new xi(sF,aF,1n);xi.ZERO=new xi(0n,1n,0n);var{BASE:nd,ZERO:_E}=xi,lF=(t,e)=>t.toString(16).padStart(e,"0"),hT=t=>Array.from(t).map(e=>lF(e,2)).join(""),b1=t=>{let e=t.length;(!fF(t)||e%2)&&mn("hex invalid 1");let r=Ua(e/2);for(let n=0;n<r.length;n++){let i=n*2,o=t.slice(i,i+2),s=Number.parseInt(o,16);(Number.isNaN(s)||s<0)&&mn("hex invalid 2"),r[n]=s}return r},w1=t=>BigInt("0x"+(hT(t)||"0")),xE=(t,e,r)=>w1(t.slice(e,r)),ME=t=>SE(t)&&t>=0n&&t<dT?b1(lF(t,2*Es)):mn("bigint expected"),y1=t=>hT(ME(t)),lT=(...t)=>{let e=Ua(t.reduce((n,i)=>n+uF(i).length,0)),r=0;return t.forEach(n=>{e.set(n,r),r+=n.length}),e},_1=(t,e=Dh)=>{(t===0n||e<=0n)&&mn("no inverse n="+t+" mod="+e);let r=rt(t,e),n=e,i=0n,o=1n,s=1n,a=0n;for(;r!==0n;){let d=n/r,m=n%r,p=i-s*d,w=o-a*d;n=r,r=m,i=s,o=a,s=p,a=w}return n===1n?rt(i,e):mn("no inverse")},sbe=t=>{let e=1n;for(let r=t,n=(Dh+1n)/4n;n>0n;n>>=1n)n&1n&&(e=e*r%Dh),r=r*r%Dh;return rt(e*e)===t?e:mn("sqrt invalid")},EE=t=>(SE(t)||(t=w1(id(t,Es))),v1(t)?t:mn("private key out of range")),pT=t=>t>io>>1n;function x1(t,e=!0){return xi.fromPrivateKey(t).toRawBytes(e)}var Ch=class{constructor(e,r,n){this.r=e,this.s=r,this.recovery=n,this.assertValidity()}static fromCompact(e){return e=id(e,64),new Ch(xE(e,0,Es),xE(e,Es,2*Es))}assertValidity(){return v1(this.r)&&v1(this.s)?this:mn()}addRecoveryBit(e){return new Ch(this.r,this.s,e)}hasHighS(){return pT(this.s)}recoverPublicKey(e){let{r,s:n,recovery:i}=this;[0,1,2,3].includes(i)||mn("recovery id invalid");let o=mT(id(e,32)),s=i===2||i===3?r+io:r;s>=Dh&&mn("q.x invalid");let a=i&1?"03":"02",d=xi.fromHex(a+y1(s)),m=_1(s,io),p=rt(-o*m,io),w=rt(n*m,io);return nd.mulAddQUns(d,p,w)}toCompactRawBytes(){return b1(this.toCompactHex())}toCompactHex(){return y1(this.r)+y1(this.s)}},dF=t=>{let e=t.length*8-256,r=w1(t);return e>0?r>>BigInt(e):r},mT=t=>rt(dF(t),io),iF=t=>ME(t),oF=()=>typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0,g1,hF={lowS:!0},abe={lowS:!0};function cbe(t,e,r=hF){["der","recovered","canonical"].some(w=>w in r)&&mn("sign() legacy options not supported");let{lowS:n}=r;n==null&&(n=!0);let i=mT(id(t)),o=iF(i),s=EE(e),a=[iF(s),o],d=r.extraEntropy;if(d){d===!0&&(d=jh.randomBytes(Es));let w=id(d);w.length!==Es&&mn(),a.push(w)}let m=i,p=w=>{let P=dF(w);if(!v1(P))return;let S=_1(P,io),M=nd.mul(P).aff(),A=rt(M.x,io);if(A===0n)return;let B=rt(S*rt(m+rt(s*A,io),io),io);if(B===0n)return;let I=B,C=(M.x===A?0:2)|Number(M.y&1n);return n&&pT(B)&&(I=rt(-B,io),C^=1),new Ch(A,I,C)};return{seed:lT(...a),k2sig:p}}function fbe(t){let e=Ua(Es),r=Ua(Es),n=0,i=()=>{e.fill(1),r.fill(0),n=0},o="drbg: tried 1000 values";if(t){let s=(...m)=>jh.hmacSha256Async(r,e,...m),a=async(m=Ua())=>{r=await s(Ua([0]),m),e=await s(),m.length!==0&&(r=await s(Ua([1]),m),e=await s())},d=async()=>(n++>=1e3&&mn(o),e=await s(),e);return async(m,p)=>{i(),await a(m);let w;for(;!(w=p(await d()));)await a();return i(),w}}else{let s=(...m)=>{let p=g1;return p||mn("etc.hmacSha256Sync not set"),p(r,e,...m)},a=(m=Ua())=>{r=s(Ua([0]),m),e=s(),m.length!==0&&(r=s(Ua([1]),m),e=s())},d=()=>(n++>=1e3&&mn(o),e=s(),e);return(m,p)=>{i(),a(m);let w;for(;!(w=p(d()));)a();return i(),w}}}async function yT(t,e,r=hF){let{seed:n,k2sig:i}=cbe(t,e,r);return fbe(!0)(n,i)}function pF(t,e,r,n=abe){let{lowS:i}=n;i==null&&(i=!0),"strict"in n&&mn("verify() legacy options not supported");let o,s,a,d=t&&typeof t=="object"&&"r"in t;!d&&id(t).length!==2*Es&&mn("signature must be 64 bytes");try{o=d?new Ch(t.r,t.s).assertValidity():Ch.fromCompact(t),s=mT(id(e,Es)),a=r instanceof xi?r.ok():xi.fromHex(r)}catch{return!1}if(!o)return!1;let{r:m,s:p}=o;if(i&&pT(p))return!1;let w;try{let S=_1(p,io),M=rt(s*S,io),A=rt(m*S,io);w=nd.mulAddQUns(a,M,A).aff()}catch{return!1}return w?rt(w.x,io)===m:!1}function mF(t){t=id(t);let e=Es+8;(t.length<e||t.length>1024)&&mn("expected proper params");let r=rt(w1(t),io-1n)+1n;return ME(r)}var jh={hexToBytes:b1,bytesToHex:hT,concatBytes:lT,bytesToNumberBE:w1,numberToBytesBE:ME,mod:rt,invert:_1,hmacSha256Async:async(t,...e)=>{let r=oF();if(!r)return mn("etc.hmacSha256Async not set");let n=r.subtle,i=await n.importKey("raw",t,{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign"]);return Ua(await n.sign("HMAC",i,lT(...e)))},hmacSha256Sync:g1,hashToPrivateKey:mF,randomBytes:t=>{let e=oF();return e||mn("crypto.getRandomValues must be defined"),e.getRandomValues(Ua(t))}},PE={normPrivateKeyToScalar:EE,isValidPrivateKey:t=>{try{return!!EE(t)}catch{return!1}},randomPrivateKey:()=>mF(jh.randomBytes(Es+8)),precompute(t=8,e=nd){return e.multiply(3n),e}};Object.defineProperties(jh,{hmacSha256Sync:{configurable:!1,get(){return g1},set(t){g1||(g1=t)}}});var k0=8,ube=()=>{let t=[],e=256/k0+1,r=nd,n=r;for(let i=0;i<e;i++){n=r,t.push(n);for(let o=1;o<2**(k0-1);o++)n=n.add(r),t.push(n);r=n.double()}return t},lbe=t=>{let e=nF||(nF=ube()),r=(p,w)=>{let P=w.negate();return p?P:w},n=_E,i=nd,o=1+256/k0,s=2**(k0-1),a=BigInt(2**k0-1),d=2**k0,m=BigInt(k0);for(let p=0;p<o;p++){let w=p*s,P=Number(t&a);t>>=m,P>s&&(P-=d,t+=1n);let S=w,M=w+Math.abs(P)-1,A=p%2!==0,B=P<0;P===0?i=i.add(r(A,e[S])):n=n.add(r(B,e[M]))}return{p:n,f:i}};var _T={};Di(_T,{sha256:()=>xo,sha512:()=>Ibe});E();E();E();var Tu={};Di(Tu,{decode:()=>kg,encodeTo:()=>O0,encodingLength:()=>B0});E();E();var dbe=vF,yF=128,hbe=127,pbe=~hbe,mbe=Math.pow(2,31);function vF(t,e,r){e=e||[],r=r||0;for(var n=r;t>=mbe;)e[r++]=t&255|yF,t/=128;for(;t&pbe;)e[r++]=t&255|yF,t>>>=7;return e[r]=t|0,vF.bytes=r-n+1,e}var ybe=vT,gbe=128,gF=127;function vT(t,n){var r=0,n=n||0,i=0,o=n,s,a=t.length;do{if(o>=a)throw vT.bytes=0,new RangeError("Could not decode varint");s=t[o++],r+=i<28?(s&gF)<<i:(s&gF)*Math.pow(2,i),i+=7}while(s>=gbe);return vT.bytes=o-n,r}var vbe=Math.pow(2,7),bbe=Math.pow(2,14),wbe=Math.pow(2,21),_be=Math.pow(2,28),xbe=Math.pow(2,35),Ebe=Math.pow(2,42),Sbe=Math.pow(2,49),Mbe=Math.pow(2,56),Pbe=Math.pow(2,63),Abe=function(t){return t<vbe?1:t<bbe?2:t<wbe?3:t<_be?4:t<xbe?5:t<Ebe?6:t<Sbe?7:t<Mbe?8:t<Pbe?9:10},Tbe={encode:dbe,decode:ybe,encodingLength:Abe},Rbe=Tbe,E1=Rbe;var kg=(t,e=0)=>[E1.decode(t,e),E1.decode.bytes],O0=(t,e,r=0)=>(E1.encode(t,e,r),e),B0=t=>E1.encodingLength(t);var D0=(t,e)=>{let r=e.byteLength,n=B0(t),i=n+B0(r),o=new Uint8Array(i+r);return O0(t,o,0),O0(r,o,n),o.set(e,i),new Og(t,r,e,o)},AE=t=>{let e=gf(t),[r,n]=kg(e),[i,o]=kg(e.subarray(n)),s=e.subarray(n+o);if(s.byteLength!==i)throw new Error("Incorrect length");return new Og(r,i,s,e)},bF=(t,e)=>{if(t===e)return!0;{let r=e;return t.code===r.code&&t.size===r.size&&r.bytes instanceof Uint8Array&&CU(t.bytes,r.bytes)}},Og=class{constructor(e,r,n,i){this.code=e,this.size=r,this.digest=n,this.bytes=i}};var wT=({name:t,code:e,encode:r})=>new bT(t,e,r),bT=class{constructor(e,r,n){this.name=e,this.code=r,this.encode=n}digest(e){if(e instanceof Uint8Array){let r=this.encode(e);return r instanceof Uint8Array?D0(this.code,r):r.then(n=>D0(this.code,n))}else throw Error("Unknown type, must be binary type")}};var _F=t=>async e=>new Uint8Array(await crypto.subtle.digest(t,e)),xo=wT({name:"sha2-256",code:18,encode:_F("SHA-256")}),Ibe=wT({name:"sha2-512",code:19,encode:_F("SHA-512")});var sn=class{static validateKey(e){if(e.kty!=="EC"||e.crv!=="secp256k1")throw new be("Secp256k1KeyNotValid","Invalid SECP256K1 JWK: `kty` MUST be `EC`. `crv` MUST be `secp256k1`")}static async publicKeyToJwk(e){let r;e.byteLength===33?r=xi.fromHex(e).toRawBytes(!1):r=e;let n=et.bytesToBase64Url(r.subarray(1,33)),i=et.bytesToBase64Url(r.subarray(33,65));return{alg:"ES256K",kty:"EC",crv:"secp256k1",x:n,y:i}}static async privateKeyToJwk(e){let r=await sn.getPublicKey(e),n=await sn.publicKeyToJwk(r);return n.d=et.bytesToBase64Url(e),n}static publicJwkToBytes(e){let r=et.base64UrlToBytes(e.x),n=et.base64UrlToBytes(e.y);return xi.fromAffine({x:jh.bytesToNumberBE(r),y:jh.bytesToNumberBE(n)}).toRawBytes(!0)}static privateJwkToBytes(e){return et.base64UrlToBytes(e.d)}static async sign(e,r){sn.validateKey(r);let n=await xo.encode(e),i=sn.privateJwkToBytes(r);return(await yT(n,i)).toCompactRawBytes()}static async verify(e,r,n){sn.validateKey(n);let i=sn.publicJwkToBytes(n),o=await xo.encode(e);return pF(r,o,i)}static async generateKeyPair(){let e=PE.randomPrivateKey(),r=x1(e,!1),n=et.bytesToBase64Url(e),i=await sn.publicKeyToJwk(r),o={...i,d:n};return{publicJwk:i,privateJwk:o}}static async generateKeyPairRaw(){let e=PE.randomPrivateKey();return{publicKey:x1(e,!0),privateKey:e}}static async getPublicKey(e){return x1(e,!0)}static async getPublicJwk(e){let{d:r,...n}=e;return n}};E();E();E();E();E();function xF(t){if(!Number.isSafeInteger(t)||t<0)throw new Error(`Wrong positive integer: ${t}`)}function kbe(t){return t instanceof Uint8Array||t!=null&&typeof t=="object"&&t.constructor.name==="Uint8Array"}function xT(t,...e){if(!kbe(t))throw new Error("Expected Uint8Array");if(e.length>0&&!e.includes(t.length))throw new Error(`Expected Uint8Array of length ${e}, not of length=${t.length}`)}function EF(t){if(typeof t!="function"||typeof t.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");xF(t.outputLen),xF(t.blockLen)}function Dg(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}function SF(t,e){xT(t);let r=e.outputLen;if(t.length<r)throw new Error(`digestInto() expects output buffer of length at least ${r}`)}E();E();var Cg=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;function MF(t){return t instanceof Uint8Array||t!=null&&typeof t=="object"&&t.constructor.name==="Uint8Array"}var TE=t=>new DataView(t.buffer,t.byteOffset,t.byteLength),vf=(t,e)=>t<<32-e|t>>>e,Obe=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!Obe)throw new Error("Non little-endian hardware is not supported");function ET(t){if(typeof t!="string")throw new Error(`utf8ToBytes expected string, got ${typeof t}`);return new Uint8Array(new TextEncoder().encode(t))}function S1(t){if(typeof t=="string"&&(t=ET(t)),!MF(t))throw new Error(`expected Uint8Array, got ${typeof t}`);return t}function RE(...t){let e=0;for(let n=0;n<t.length;n++){let i=t[n];if(!MF(i))throw new Error("Uint8Array expected");e+=i.length}let r=new Uint8Array(e);for(let n=0,i=0;n<t.length;n++){let o=t[n];r.set(o,i),i+=o.length}return r}var jg=class{clone(){return this._cloneInto()}},$tt={}.toString;function IE(t){let e=n=>t().update(S1(n)).digest(),r=t();return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=()=>t(),e}function C0(t=32){if(Cg&&typeof Cg.getRandomValues=="function")return Cg.getRandomValues(new Uint8Array(t));throw new Error("crypto.getRandomValues must be defined")}var kE=class extends jg{constructor(e,r){super(),this.finished=!1,this.destroyed=!1,EF(e);let n=S1(r);if(this.iHash=e.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;let i=this.blockLen,o=new Uint8Array(i);o.set(n.length>i?e.create().update(n).digest():n);for(let s=0;s<o.length;s++)o[s]^=54;this.iHash.update(o),this.oHash=e.create();for(let s=0;s<o.length;s++)o[s]^=106;this.oHash.update(o),o.fill(0)}update(e){return Dg(this),this.iHash.update(e),this}digestInto(e){Dg(this),xT(e,this.outputLen),this.finished=!0,this.iHash.digestInto(e),this.oHash.update(e),this.oHash.digestInto(e),this.destroy()}digest(){let e=new Uint8Array(this.oHash.outputLen);return this.digestInto(e),e}_cloneInto(e){e||(e=Object.create(Object.getPrototypeOf(this),{}));let{oHash:r,iHash:n,finished:i,destroyed:o,blockLen:s,outputLen:a}=this;return e=e,e.finished=i,e.destroyed=o,e.blockLen=s,e.outputLen=a,e.oHash=r._cloneInto(e.oHash),e.iHash=n._cloneInto(e.iHash),e}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}},ST=(t,e,r)=>new kE(t,e).update(r).digest();ST.create=(t,e)=>new kE(t,e);E();E();var BE={};Di(BE,{bitGet:()=>$be,bitLen:()=>qbe,bitMask:()=>M1,bitSet:()=>Lbe,bytesToHex:()=>sd,bytesToNumberBE:()=>ad,bytesToNumberLE:()=>wf,concatBytes:()=>fd,createHmacDrbg:()=>AT,ensureBytes:()=>Fn,equalBytes:()=>jbe,hexToBytes:()=>j0,hexToNumber:()=>PT,isBytes:()=>bf,numberToBytesBE:()=>wa,numberToBytesLE:()=>cd,numberToHexUnpadded:()=>RF,numberToVarBytesBE:()=>Cbe,utf8ToBytes:()=>Nbe,validateObject:()=>_c});E();var TF=BigInt(0),OE=BigInt(1),Bbe=BigInt(2);function bf(t){return t instanceof Uint8Array||t!=null&&typeof t=="object"&&t.constructor.name==="Uint8Array"}var Dbe=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function sd(t){if(!bf(t))throw new Error("Uint8Array expected");let e="";for(let r=0;r<t.length;r++)e+=Dbe[t[r]];return e}function RF(t){let e=t.toString(16);return e.length&1?`0${e}`:e}function PT(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);return BigInt(t===""?"0":`0x${t}`)}var od={_0:48,_9:57,_A:65,_F:70,_a:97,_f:102};function PF(t){if(t>=od._0&&t<=od._9)return t-od._0;if(t>=od._A&&t<=od._F)return t-(od._A-10);if(t>=od._a&&t<=od._f)return t-(od._a-10)}function j0(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);let e=t.length,r=e/2;if(e%2)throw new Error("padded hex string expected, got unpadded hex of length "+e);let n=new Uint8Array(r);for(let i=0,o=0;i<r;i++,o+=2){let s=PF(t.charCodeAt(o)),a=PF(t.charCodeAt(o+1));if(s===void 0||a===void 0){let d=t[o]+t[o+1];throw new Error('hex string expected, got non-hex character "'+d+'" at index '+o)}n[i]=s*16+a}return n}function ad(t){return PT(sd(t))}function wf(t){if(!bf(t))throw new Error("Uint8Array expected");return PT(sd(Uint8Array.from(t).reverse()))}function wa(t,e){return j0(t.toString(16).padStart(e*2,"0"))}function cd(t,e){return wa(t,e).reverse()}function Cbe(t){return j0(RF(t))}function Fn(t,e,r){let n;if(typeof e=="string")try{n=j0(e)}catch(o){throw new Error(`${t} must be valid hex string, got "${e}". Cause: ${o}`)}else if(bf(e))n=Uint8Array.from(e);else throw new Error(`${t} must be hex string or Uint8Array`);let i=n.length;if(typeof r=="number"&&i!==r)throw new Error(`${t} expected ${r} bytes, got ${i}`);return n}function fd(...t){let e=0;for(let i=0;i<t.length;i++){let o=t[i];if(!bf(o))throw new Error("Uint8Array expected");e+=o.length}let r=new Uint8Array(e),n=0;for(let i=0;i<t.length;i++){let o=t[i];r.set(o,n),n+=o.length}return r}function jbe(t,e){if(t.length!==e.length)return!1;let r=0;for(let n=0;n<t.length;n++)r|=t[n]^e[n];return r===0}function Nbe(t){if(typeof t!="string")throw new Error(`utf8ToBytes expected string, got ${typeof t}`);return new Uint8Array(new TextEncoder().encode(t))}function qbe(t){let e;for(e=0;t>TF;t>>=OE,e+=1);return e}function $be(t,e){return t>>BigInt(e)&OE}var Lbe=(t,e,r)=>t|(r?OE:TF)<<BigInt(e),M1=t=>(Bbe<<BigInt(t-1))-OE,MT=t=>new Uint8Array(t),AF=t=>Uint8Array.from(t);function AT(t,e,r){if(typeof t!="number"||t<2)throw new Error("hashLen must be a number");if(typeof e!="number"||e<2)throw new Error("qByteLen must be a number");if(typeof r!="function")throw new Error("hmacFn must be a function");let n=MT(t),i=MT(t),o=0,s=()=>{n.fill(1),i.fill(0),o=0},a=(...w)=>r(i,n,...w),d=(w=MT())=>{i=a(AF([0]),w),n=a(),w.length!==0&&(i=a(AF([1]),w),n=a())},m=()=>{if(o++>=1e3)throw new Error("drbg: tried 1000 values");let w=0,P=[];for(;w<e;){n=a();let S=n.slice();P.push(S),w+=n.length}return fd(...P)};return(w,P)=>{s(),d(w);let S;for(;!(S=P(m()));)d();return s(),S}}var Ube={bigint:t=>typeof t=="bigint",function:t=>typeof t=="function",boolean:t=>typeof t=="boolean",string:t=>typeof t=="string",stringOrUint8Array:t=>typeof t=="string"||bf(t),isSafeInteger:t=>Number.isSafeInteger(t),array:t=>Array.isArray(t),field:(t,e)=>e.Fp.isValid(t),hash:t=>typeof t=="function"&&Number.isSafeInteger(t.outputLen)};function _c(t,e,r={}){let n=(i,o,s)=>{let a=Ube[o];if(typeof a!="function")throw new Error(`Invalid validator "${o}", expected function`);let d=t[i];if(!(s&&d===void 0)&&!a(d,t))throw new Error(`Invalid param ${String(i)}=${d} (${typeof d}), expected ${o}`)};for(let[i,o]of Object.entries(e))n(i,o,!1);for(let[i,o]of Object.entries(r))n(i,o,!0);return t}var oo=BigInt(0),Hn=BigInt(1),N0=BigInt(2),Fbe=BigInt(3),TT=BigInt(4),IF=BigInt(5),kF=BigInt(8),zbe=BigInt(9),Kbe=BigInt(16);function tn(t,e){let r=t%e;return r>=oo?r:e+r}function RT(t,e,r){if(r<=oo||e<oo)throw new Error("Expected power/modulo > 0");if(r===Hn)return oo;let n=Hn;for(;e>oo;)e&Hn&&(n=n*t%r),t=t*t%r,e>>=Hn;return n}function zn(t,e,r){let n=t;for(;e-- >oo;)n*=n,n%=r;return n}function DE(t,e){if(t===oo||e<=oo)throw new Error(`invert: expected positive integers, got n=${t} mod=${e}`);let r=tn(t,e),n=e,i=oo,o=Hn,s=Hn,a=oo;for(;r!==oo;){let m=n/r,p=n%r,w=i-s*m,P=o-a*m;n=r,r=p,i=s,o=a,s=w,a=P}if(n!==Hn)throw new Error("invert: does not exist");return tn(i,e)}function Gbe(t){let e=(t-Hn)/N0,r,n,i;for(r=t-Hn,n=0;r%N0===oo;r/=N0,n++);for(i=N0;i<t&&RT(i,e,t)!==t-Hn;i++);if(n===1){let s=(t+Hn)/TT;return function(d,m){let p=d.pow(m,s);if(!d.eql(d.sqr(p),m))throw new Error("Cannot find square root");return p}}let o=(r+Hn)/N0;return function(a,d){if(a.pow(d,e)===a.neg(a.ONE))throw new Error("Cannot find square root");let m=n,p=a.pow(a.mul(a.ONE,i),r),w=a.pow(d,o),P=a.pow(d,r);for(;!a.eql(P,a.ONE);){if(a.eql(P,a.ZERO))return a.ZERO;let S=1;for(let A=a.sqr(P);S<m&&!a.eql(A,a.ONE);S++)A=a.sqr(A);let M=a.pow(p,Hn<<BigInt(m-S-1));p=a.sqr(M),w=a.mul(w,M),P=a.mul(P,p),m=S}return w}}function Wbe(t){if(t%TT===Fbe){let e=(t+Hn)/TT;return function(n,i){let o=n.pow(i,e);if(!n.eql(n.sqr(o),i))throw new Error("Cannot find square root");return o}}if(t%kF===IF){let e=(t-IF)/kF;return function(n,i){let o=n.mul(i,N0),s=n.pow(o,e),a=n.mul(i,s),d=n.mul(n.mul(a,N0),s),m=n.mul(a,n.sub(d,n.ONE));if(!n.eql(n.sqr(m),i))throw new Error("Cannot find square root");return m}}return t%Kbe,Gbe(t)}var OF=(t,e)=>(tn(t,e)&Hn)===Hn,Vbe=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function IT(t){let e={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},r=Vbe.reduce((n,i)=>(n[i]="function",n),e);return _c(t,r)}function Hbe(t,e,r){if(r<oo)throw new Error("Expected power > 0");if(r===oo)return t.ONE;if(r===Hn)return e;let n=t.ONE,i=e;for(;r>oo;)r&Hn&&(n=t.mul(n,i)),i=t.sqr(i),r>>=Hn;return n}function Zbe(t,e){let r=new Array(e.length),n=e.reduce((o,s,a)=>t.is0(s)?o:(r[a]=o,t.mul(o,s)),t.ONE),i=t.inv(n);return e.reduceRight((o,s,a)=>t.is0(s)?o:(r[a]=t.mul(o,r[a]),t.mul(o,s)),i),r}function kT(t,e){let r=e!==void 0?e:t.toString(2).length,n=Math.ceil(r/8);return{nBitLength:r,nByteLength:n}}function Ng(t,e,r=!1,n={}){if(t<=oo)throw new Error(`Expected Field ORDER > 0, got ${t}`);let{nBitLength:i,nByteLength:o}=kT(t,e);if(o>2048)throw new Error("Field lengths over 2048 bytes are not supported");let s=Wbe(t),a=Object.freeze({ORDER:t,BITS:i,BYTES:o,MASK:M1(i),ZERO:oo,ONE:Hn,create:d=>tn(d,t),isValid:d=>{if(typeof d!="bigint")throw new Error(`Invalid field element: expected bigint, got ${typeof d}`);return oo<=d&&d<t},is0:d=>d===oo,isOdd:d=>(d&Hn)===Hn,neg:d=>tn(-d,t),eql:(d,m)=>d===m,sqr:d=>tn(d*d,t),add:(d,m)=>tn(d+m,t),sub:(d,m)=>tn(d-m,t),mul:(d,m)=>tn(d*m,t),pow:(d,m)=>Hbe(a,d,m),div:(d,m)=>tn(d*DE(m,t),t),sqrN:d=>d*d,addN:(d,m)=>d+m,subN:(d,m)=>d-m,mulN:(d,m)=>d*m,inv:d=>DE(d,t),sqrt:n.sqrt||(d=>s(a,d)),invertBatch:d=>Zbe(a,d),cmov:(d,m,p)=>p?m:d,toBytes:d=>r?cd(d,o):wa(d,o),fromBytes:d=>{if(d.length!==o)throw new Error(`Fp.fromBytes: expected ${o}, got ${d.length}`);return r?wf(d):ad(d)}});return Object.freeze(a)}function BF(t,e){if(!t.isOdd)throw new Error("Field doesn't have isOdd");let r=t.sqrt(e);return t.isOdd(r)?t.neg(r):r}function DF(t){if(typeof t!="bigint")throw new Error("field order must be bigint");let e=t.toString(2).length;return Math.ceil(e/8)}function OT(t){let e=DF(t);return e+Math.ceil(e/2)}function CF(t,e,r=!1){let n=t.length,i=DF(e),o=OT(e);if(n<16||n<o||n>1024)throw new Error(`expected ${o}-1024 bytes of input, got ${n}`);let s=r?ad(t):wf(t),a=tn(s,e-Hn)+Hn;return r?cd(a,i):wa(a,i)}E();var Ybe=BigInt(0),BT=BigInt(1);function CE(t,e){let r=(i,o)=>{let s=o.negate();return i?s:o},n=i=>{let o=Math.ceil(e/i)+1,s=2**(i-1);return{windows:o,windowSize:s}};return{constTimeNegate:r,unsafeLadder(i,o){let s=t.ZERO,a=i;for(;o>Ybe;)o&BT&&(s=s.add(a)),a=a.double(),o>>=BT;return s},precomputeWindow(i,o){let{windows:s,windowSize:a}=n(o),d=[],m=i,p=m;for(let w=0;w<s;w++){p=m,d.push(p);for(let P=1;P<a;P++)p=p.add(m),d.push(p);m=p.double()}return d},wNAF(i,o,s){let{windows:a,windowSize:d}=n(i),m=t.ZERO,p=t.BASE,w=BigInt(2**i-1),P=2**i,S=BigInt(i);for(let M=0;M<a;M++){let A=M*d,B=Number(s&w);s>>=S,B>d&&(B-=P,s+=BT);let I=A,C=A+Math.abs(B)-1,k=M%2!==0,q=B<0;B===0?p=p.add(r(k,o[I])):m=m.add(r(q,o[C]))}return{p:m,f:p}},wNAFCached(i,o,s,a){let d=i._WINDOW_SIZE||1,m=o.get(i);return m||(m=this.precomputeWindow(i,d),d!==1&&o.set(i,a(m))),this.wNAF(d,m,s)}}}function P1(t){return IT(t.Fp),_c(t,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...kT(t.n,t.nBitLength),...t,p:t.Fp.ORDER})}function Qbe(t){let e=P1(t);_c(e,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});let{endo:r,Fp:n,a:i}=e;if(r){if(!n.eql(i,n.ZERO))throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0");if(typeof r!="object"||typeof r.beta!="bigint"||typeof r.splitScalar!="function")throw new Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze({...e})}var{bytesToNumberBE:Xbe,hexToBytes:ewe}=BE,q0={Err:class extends Error{constructor(e=""){super(e)}},_parseInt(t){let{Err:e}=q0;if(t.length<2||t[0]!==2)throw new e("Invalid signature integer tag");let r=t[1],n=t.subarray(2,r+2);if(!r||n.length!==r)throw new e("Invalid signature integer: wrong length");if(n[0]&128)throw new e("Invalid signature integer: negative");if(n[0]===0&&!(n[1]&128))throw new e("Invalid signature integer: unnecessary leading zero");return{d:Xbe(n),l:t.subarray(r+2)}},toSig(t){let{Err:e}=q0,r=typeof t=="string"?ewe(t):t;if(!bf(r))throw new Error("ui8a expected");let n=r.length;if(n<2||r[0]!=48)throw new e("Invalid signature tag");if(r[1]!==n-2)throw new e("Invalid signature: incorrect length");let{d:i,l:o}=q0._parseInt(r.subarray(2)),{d:s,l:a}=q0._parseInt(o);if(a.length)throw new e("Invalid signature: left bytes after parsing");return{r:i,s}},hexFromSig(t){let e=m=>Number.parseInt(m[0],16)&8?"00"+m:m,r=m=>{let p=m.toString(16);return p.length&1?`0${p}`:p},n=e(r(t.s)),i=e(r(t.r)),o=n.length/2,s=i.length/2,a=r(o),d=r(s);return`30${r(s+o+4)}02${d}${i}02${a}${n}`}},ud=BigInt(0),xc=BigInt(1),rrt=BigInt(2),jF=BigInt(3),nrt=BigInt(4);function twe(t){let e=Qbe(t),{Fp:r}=e,n=e.toBytes||((M,A,B)=>{let I=A.toAffine();return fd(Uint8Array.from([4]),r.toBytes(I.x),r.toBytes(I.y))}),i=e.fromBytes||(M=>{let A=M.subarray(1),B=r.fromBytes(A.subarray(0,r.BYTES)),I=r.fromBytes(A.subarray(r.BYTES,2*r.BYTES));return{x:B,y:I}});function o(M){let{a:A,b:B}=e,I=r.sqr(M),C=r.mul(I,M);return r.add(r.add(C,r.mul(M,A)),B)}if(!r.eql(r.sqr(e.Gy),o(e.Gx)))throw new Error("bad generator point: equation left != right");function s(M){return typeof M=="bigint"&&ud<M&&M<e.n}function a(M){if(!s(M))throw new Error("Expected valid bigint: 0 < bigint < curve.n")}function d(M){let{allowedPrivateKeyLengths:A,nByteLength:B,wrapPrivateKey:I,n:C}=e;if(A&&typeof M!="bigint"){if(bf(M)&&(M=sd(M)),typeof M!="string"||!A.includes(M.length))throw new Error("Invalid key");M=M.padStart(B*2,"0")}let k;try{k=typeof M=="bigint"?M:ad(Fn("private key",M,B))}catch{throw new Error(`private key must be ${B} bytes, hex or bigint, not ${typeof M}`)}return I&&(k=tn(k,C)),a(k),k}let m=new Map;function p(M){if(!(M instanceof w))throw new Error("ProjectivePoint expected")}class w{constructor(A,B,I){if(this.px=A,this.py=B,this.pz=I,A==null||!r.isValid(A))throw new Error("x required");if(B==null||!r.isValid(B))throw new Error("y required");if(I==null||!r.isValid(I))throw new Error("z required")}static fromAffine(A){let{x:B,y:I}=A||{};if(!A||!r.isValid(B)||!r.isValid(I))throw new Error("invalid affine point");if(A instanceof w)throw new Error("projective point not allowed");let C=k=>r.eql(k,r.ZERO);return C(B)&&C(I)?w.ZERO:new w(B,I,r.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(A){let B=r.invertBatch(A.map(I=>I.pz));return A.map((I,C)=>I.toAffine(B[C])).map(w.fromAffine)}static fromHex(A){let B=w.fromAffine(i(Fn("pointHex",A)));return B.assertValidity(),B}static fromPrivateKey(A){return w.BASE.multiply(d(A))}_setWindowSize(A){this._WINDOW_SIZE=A,m.delete(this)}assertValidity(){if(this.is0()){if(e.allowInfinityPoint&&!r.is0(this.py))return;throw new Error("bad point: ZERO")}let{x:A,y:B}=this.toAffine();if(!r.isValid(A)||!r.isValid(B))throw new Error("bad point: x or y not FE");let I=r.sqr(B),C=o(A);if(!r.eql(I,C))throw new Error("bad point: equation left != right");if(!this.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){let{y:A}=this.toAffine();if(r.isOdd)return!r.isOdd(A);throw new Error("Field doesn't support isOdd")}equals(A){p(A);let{px:B,py:I,pz:C}=this,{px:k,py:q,pz:L}=A,U=r.eql(r.mul(B,L),r.mul(k,C)),F=r.eql(r.mul(I,L),r.mul(q,C));return U&&F}negate(){return new w(this.px,r.neg(this.py),this.pz)}double(){let{a:A,b:B}=e,I=r.mul(B,jF),{px:C,py:k,pz:q}=this,L=r.ZERO,U=r.ZERO,F=r.ZERO,N=r.mul(C,C),G=r.mul(k,k),x=r.mul(q,q),c=r.mul(C,k);return c=r.add(c,c),F=r.mul(C,q),F=r.add(F,F),L=r.mul(A,F),U=r.mul(I,x),U=r.add(L,U),L=r.sub(G,U),U=r.add(G,U),U=r.mul(L,U),L=r.mul(c,L),F=r.mul(I,F),x=r.mul(A,x),c=r.sub(N,x),c=r.mul(A,c),c=r.add(c,F),F=r.add(N,N),N=r.add(F,N),N=r.add(N,x),N=r.mul(N,c),U=r.add(U,N),x=r.mul(k,q),x=r.add(x,x),N=r.mul(x,c),L=r.sub(L,N),F=r.mul(x,G),F=r.add(F,F),F=r.add(F,F),new w(L,U,F)}add(A){p(A);let{px:B,py:I,pz:C}=this,{px:k,py:q,pz:L}=A,U=r.ZERO,F=r.ZERO,N=r.ZERO,G=e.a,x=r.mul(e.b,jF),c=r.mul(B,k),u=r.mul(I,q),y=r.mul(C,L),l=r.add(B,I),h=r.add(k,q);l=r.mul(l,h),h=r.add(c,u),l=r.sub(l,h),h=r.add(B,C);let b=r.add(k,L);return h=r.mul(h,b),b=r.add(c,y),h=r.sub(h,b),b=r.add(I,C),U=r.add(q,L),b=r.mul(b,U),U=r.add(u,y),b=r.sub(b,U),N=r.mul(G,h),U=r.mul(x,y),N=r.add(U,N),U=r.sub(u,N),N=r.add(u,N),F=r.mul(U,N),u=r.add(c,c),u=r.add(u,c),y=r.mul(G,y),h=r.mul(x,h),u=r.add(u,y),y=r.sub(c,y),y=r.mul(G,y),h=r.add(h,y),c=r.mul(u,h),F=r.add(F,c),c=r.mul(b,h),U=r.mul(l,U),U=r.sub(U,c),c=r.mul(l,u),N=r.mul(b,N),N=r.add(N,c),new w(U,F,N)}subtract(A){return this.add(A.negate())}is0(){return this.equals(w.ZERO)}wNAF(A){return S.wNAFCached(this,m,A,B=>{let I=r.invertBatch(B.map(C=>C.pz));return B.map((C,k)=>C.toAffine(I[k])).map(w.fromAffine)})}multiplyUnsafe(A){let B=w.ZERO;if(A===ud)return B;if(a(A),A===xc)return this;let{endo:I}=e;if(!I)return S.unsafeLadder(this,A);let{k1neg:C,k1:k,k2neg:q,k2:L}=I.splitScalar(A),U=B,F=B,N=this;for(;k>ud||L>ud;)k&xc&&(U=U.add(N)),L&xc&&(F=F.add(N)),N=N.double(),k>>=xc,L>>=xc;return C&&(U=U.negate()),q&&(F=F.negate()),F=new w(r.mul(F.px,I.beta),F.py,F.pz),U.add(F)}multiply(A){a(A);let B=A,I,C,{endo:k}=e;if(k){let{k1neg:q,k1:L,k2neg:U,k2:F}=k.splitScalar(B),{p:N,f:G}=this.wNAF(L),{p:x,f:c}=this.wNAF(F);N=S.constTimeNegate(q,N),x=S.constTimeNegate(U,x),x=new w(r.mul(x.px,k.beta),x.py,x.pz),I=N.add(x),C=G.add(c)}else{let{p:q,f:L}=this.wNAF(B);I=q,C=L}return w.normalizeZ([I,C])[0]}multiplyAndAddUnsafe(A,B,I){let C=w.BASE,k=(L,U)=>U===ud||U===xc||!L.equals(C)?L.multiplyUnsafe(U):L.multiply(U),q=k(this,B).add(k(A,I));return q.is0()?void 0:q}toAffine(A){let{px:B,py:I,pz:C}=this,k=this.is0();A==null&&(A=k?r.ONE:r.inv(C));let q=r.mul(B,A),L=r.mul(I,A),U=r.mul(C,A);if(k)return{x:r.ZERO,y:r.ZERO};if(!r.eql(U,r.ONE))throw new Error("invZ was invalid");return{x:q,y:L}}isTorsionFree(){let{h:A,isTorsionFree:B}=e;if(A===xc)return!0;if(B)return B(w,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){let{h:A,clearCofactor:B}=e;return A===xc?this:B?B(w,this):this.multiplyUnsafe(e.h)}toRawBytes(A=!0){return this.assertValidity(),n(w,this,A)}toHex(A=!0){return sd(this.toRawBytes(A))}}w.BASE=new w(e.Gx,e.Gy,r.ONE),w.ZERO=new w(r.ZERO,r.ONE,r.ZERO);let P=e.nBitLength,S=CE(w,e.endo?Math.ceil(P/2):P);return{CURVE:e,ProjectivePoint:w,normPrivateKeyToScalar:d,weierstrassEquation:o,isWithinCurveOrder:s}}function rwe(t){let e=P1(t);return _c(e,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...e})}function NF(t){let e=rwe(t),{Fp:r,n}=e,i=r.BYTES+1,o=2*r.BYTES+1;function s(h){return ud<h&&h<r.ORDER}function a(h){return tn(h,n)}function d(h){return DE(h,n)}let{ProjectivePoint:m,normPrivateKeyToScalar:p,weierstrassEquation:w,isWithinCurveOrder:P}=twe({...e,toBytes(h,b,_){let g=b.toAffine(),f=r.toBytes(g.x),v=fd;return _?v(Uint8Array.from([b.hasEvenY()?2:3]),f):v(Uint8Array.from([4]),f,r.toBytes(g.y))},fromBytes(h){let b=h.length,_=h[0],g=h.subarray(1);if(b===i&&(_===2||_===3)){let f=ad(g);if(!s(f))throw new Error("Point is not on curve");let v=w(f),O=r.sqrt(v),T=(O&xc)===xc;return(_&1)===1!==T&&(O=r.neg(O)),{x:f,y:O}}else if(b===o&&_===4){let f=r.fromBytes(g.subarray(0,r.BYTES)),v=r.fromBytes(g.subarray(r.BYTES,2*r.BYTES));return{x:f,y:v}}else throw new Error(`Point of length ${b} was invalid. Expected ${i} compressed bytes or ${o} uncompressed bytes`)}}),S=h=>sd(wa(h,e.nByteLength));function M(h){let b=n>>xc;return h>b}function A(h){return M(h)?a(-h):h}let B=(h,b,_)=>ad(h.slice(b,_));class I{constructor(b,_,g){this.r=b,this.s=_,this.recovery=g,this.assertValidity()}static fromCompact(b){let _=e.nByteLength;return b=Fn("compactSignature",b,_*2),new I(B(b,0,_),B(b,_,2*_))}static fromDER(b){let{r:_,s:g}=q0.toSig(Fn("DER",b));return new I(_,g)}assertValidity(){if(!P(this.r))throw new Error("r must be 0 < r < CURVE.n");if(!P(this.s))throw new Error("s must be 0 < s < CURVE.n")}addRecoveryBit(b){return new I(this.r,this.s,b)}recoverPublicKey(b){let{r:_,s:g,recovery:f}=this,v=F(Fn("msgHash",b));if(f==null||![0,1,2,3].includes(f))throw new Error("recovery id invalid");let O=f===2||f===3?_+e.n:_;if(O>=r.ORDER)throw new Error("recovery id 2 or 3 invalid");let T=f&1?"03":"02",R=m.fromHex(T+S(O)),z=d(O),V=a(-v*z),W=a(g*z),Z=m.BASE.multiplyAndAddUnsafe(R,V,W);if(!Z)throw new Error("point at infinify");return Z.assertValidity(),Z}hasHighS(){return M(this.s)}normalizeS(){return this.hasHighS()?new I(this.r,a(-this.s),this.recovery):this}toDERRawBytes(){return j0(this.toDERHex())}toDERHex(){return q0.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return j0(this.toCompactHex())}toCompactHex(){return S(this.r)+S(this.s)}}let C={isValidPrivateKey(h){try{return p(h),!0}catch{return!1}},normPrivateKeyToScalar:p,randomPrivateKey:()=>{let h=OT(e.n);return CF(e.randomBytes(h),e.n)},precompute(h=8,b=m.BASE){return b._setWindowSize(h),b.multiply(BigInt(3)),b}};function k(h,b=!0){return m.fromPrivateKey(h).toRawBytes(b)}function q(h){let b=bf(h),_=typeof h=="string",g=(b||_)&&h.length;return b?g===i||g===o:_?g===2*i||g===2*o:h instanceof m}function L(h,b,_=!0){if(q(h))throw new Error("first arg must be private key");if(!q(b))throw new Error("second arg must be public key");return m.fromHex(b).multiply(p(h)).toRawBytes(_)}let U=e.bits2int||function(h){let b=ad(h),_=h.length*8-e.nBitLength;return _>0?b>>BigInt(_):b},F=e.bits2int_modN||function(h){return a(U(h))},N=M1(e.nBitLength);function G(h){if(typeof h!="bigint")throw new Error("bigint expected");if(!(ud<=h&&h<N))throw new Error(`bigint expected < 2^${e.nBitLength}`);return wa(h,e.nByteLength)}function x(h,b,_=c){if(["recovered","canonical"].some(X=>X in _))throw new Error("sign() legacy options not supported");let{hash:g,randomBytes:f}=e,{lowS:v,prehash:O,extraEntropy:T}=_;v==null&&(v=!0),h=Fn("msgHash",h),O&&(h=Fn("prehashed msgHash",g(h)));let R=F(h),z=p(b),V=[G(z),G(R)];if(T!=null){let X=T===!0?f(r.BYTES):T;V.push(Fn("extraEntropy",X))}let W=fd(...V),Z=R;function J(X){let Ee=U(X);if(!P(Ee))return;let re=d(Ee),ne=m.BASE.multiply(Ee).toAffine(),qe=a(ne.x);if(qe===ud)return;let ce=a(re*a(Z+qe*z));if(ce===ud)return;let ye=(ne.x===qe?0:2)|Number(ne.y&xc),Ne=ce;return v&&M(ce)&&(Ne=A(ce),ye^=1),new I(qe,Ne,ye)}return{seed:W,k2sig:J}}let c={lowS:e.lowS,prehash:!1},u={lowS:e.lowS,prehash:!1};function y(h,b,_=c){let{seed:g,k2sig:f}=x(h,b,_),v=e;return AT(v.hash.outputLen,v.nByteLength,v.hmac)(g,f)}m.BASE._setWindowSize(8);function l(h,b,_,g=u){let f=h;if(b=Fn("msgHash",b),_=Fn("publicKey",_),"strict"in g)throw new Error("options.strict was renamed to lowS");let{lowS:v,prehash:O}=g,T,R;try{if(typeof f=="string"||bf(f))try{T=I.fromDER(f)}catch(ne){if(!(ne instanceof q0.Err))throw ne;T=I.fromCompact(f)}else if(typeof f=="object"&&typeof f.r=="bigint"&&typeof f.s=="bigint"){let{r:ne,s:qe}=f;T=new I(ne,qe)}else throw new Error("PARSE");R=m.fromHex(_)}catch(ne){if(ne.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(v&&T.hasHighS())return!1;O&&(b=e.hash(b));let{r:z,s:V}=T,W=F(b),Z=d(V),J=a(W*Z),X=a(z*Z),Ee=m.BASE.multiplyAndAddUnsafe(R,J,X)?.toAffine();return Ee?a(Ee.x)===z:!1}return{CURVE:e,getPublicKey:k,getSharedSecret:L,sign:y,verify:l,ProjectivePoint:m,Signature:I,utils:C}}function nwe(t){return{hash:t,hmac:(e,...r)=>ST(t,e,RE(...r)),randomBytes:C0}}function jE(t,e){let r=n=>NF({...t,...nwe(n)});return Object.freeze({...r(e),create:r})}E();E();function iwe(t,e,r,n){if(typeof t.setBigUint64=="function")return t.setBigUint64(e,r,n);let i=BigInt(32),o=BigInt(4294967295),s=Number(r>>i&o),a=Number(r&o),d=n?4:0,m=n?0:4;t.setUint32(e+d,s,n),t.setUint32(e+m,a,n)}var qg=class extends jg{constructor(e,r,n,i){super(),this.blockLen=e,this.outputLen=r,this.padOffset=n,this.isLE=i,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=TE(this.buffer)}update(e){Dg(this);let{view:r,buffer:n,blockLen:i}=this;e=S1(e);let o=e.length;for(let s=0;s<o;){let a=Math.min(i-this.pos,o-s);if(a===i){let d=TE(e);for(;i<=o-s;s+=i)this.process(d,s);continue}n.set(e.subarray(s,s+a),this.pos),this.pos+=a,s+=a,this.pos===i&&(this.process(r,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){Dg(this),SF(e,this),this.finished=!0;let{buffer:r,view:n,blockLen:i,isLE:o}=this,{pos:s}=this;r[s++]=128,this.buffer.subarray(s).fill(0),this.padOffset>i-s&&(this.process(n,0),s=0);for(let w=s;w<i;w++)r[w]=0;iwe(n,i-8,BigInt(this.length*8),o),this.process(n,0);let a=TE(e),d=this.outputLen;if(d%4)throw new Error("_sha2: outputLen should be aligned to 32bit");let m=d/4,p=this.get();if(m>p.length)throw new Error("_sha2: outputLen bigger than state");for(let w=0;w<m;w++)a.setUint32(4*w,p[w],o)}digest(){let{buffer:e,outputLen:r}=this;this.digestInto(e);let n=e.slice(0,r);return this.destroy(),n}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());let{blockLen:r,buffer:n,length:i,finished:o,destroyed:s,pos:a}=this;return e.length=i,e.pos=a,e.finished=o,e.destroyed=s,i%r&&e.buffer.set(n),e}};var owe=(t,e,r)=>t&e^~t&r,swe=(t,e,r)=>t&e^t&r^e&r,awe=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),Nh=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),qh=new Uint32Array(64),DT=class extends qg{constructor(){super(64,32,8,!1),this.A=Nh[0]|0,this.B=Nh[1]|0,this.C=Nh[2]|0,this.D=Nh[3]|0,this.E=Nh[4]|0,this.F=Nh[5]|0,this.G=Nh[6]|0,this.H=Nh[7]|0}get(){let{A:e,B:r,C:n,D:i,E:o,F:s,G:a,H:d}=this;return[e,r,n,i,o,s,a,d]}set(e,r,n,i,o,s,a,d){this.A=e|0,this.B=r|0,this.C=n|0,this.D=i|0,this.E=o|0,this.F=s|0,this.G=a|0,this.H=d|0}process(e,r){for(let w=0;w<16;w++,r+=4)qh[w]=e.getUint32(r,!1);for(let w=16;w<64;w++){let P=qh[w-15],S=qh[w-2],M=vf(P,7)^vf(P,18)^P>>>3,A=vf(S,17)^vf(S,19)^S>>>10;qh[w]=A+qh[w-7]+M+qh[w-16]|0}let{A:n,B:i,C:o,D:s,E:a,F:d,G:m,H:p}=this;for(let w=0;w<64;w++){let P=vf(a,6)^vf(a,11)^vf(a,25),S=p+P+owe(a,d,m)+awe[w]+qh[w]|0,A=(vf(n,2)^vf(n,13)^vf(n,22))+swe(n,i,o)|0;p=m,m=d,d=a,a=s+S|0,s=o,o=i,i=n,n=S+A|0}n=n+this.A|0,i=i+this.B|0,o=o+this.C|0,s=s+this.D|0,a=a+this.E|0,d=d+this.F|0,m=m+this.G|0,p=p+this.H|0,this.set(n,i,o,s,a,d,m,p)}roundClean(){qh.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}};var Ec=IE(()=>new DT);var qF=Ng(BigInt("0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff")),cwe=qF.create(BigInt("-3")),fwe=BigInt("0x5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b"),ld=jE({a:cwe,b:fwe,Fp:qF,n:BigInt("0xffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551"),Gx:BigInt("0x6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c296"),Gy:BigInt("0x4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f5"),h:BigInt(1),lowS:!1},Ec),Hs=ld;E();E();E();E();E();function $h(t){return globalThis.Buffer!=null?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):t}function dd(t=0){return globalThis.Buffer?.alloc!=null?$h(globalThis.Buffer.alloc(t)):new Uint8Array(t)}function Lh(t=0){return globalThis.Buffer?.allocUnsafe!=null?$h(globalThis.Buffer.allocUnsafe(t)):new Uint8Array(t)}function $g(t,e){e==null&&(e=t.reduce((i,o)=>i+o.length,0));let r=Lh(e),n=0;for(let i of t)r.set(i,n),n+=i.length;return $h(r)}E();function CT(t,e){if(t===e)return!0;if(t.byteLength!==e.byteLength)return!1;for(let r=0;r<t.byteLength;r++)if(t[r]!==e[r])return!1;return!0}E();E();E();var jT={};Di(jT,{identity:()=>uwe});E();var uwe=Ag({prefix:"\0",name:"identity",encode:t=>NU(t),decode:t=>jU(t)});var NT={};Di(NT,{base2:()=>lwe});E();var lwe=_i({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var qT={};Di(qT,{base8:()=>dwe});E();var dwe=_i({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var $T={};Di($T,{base10:()=>hwe});E();var hwe=Oh({prefix:"9",name:"base10",alphabet:"0123456789"});var LT={};Di(LT,{base16:()=>pwe,base16upper:()=>mwe});E();var pwe=_i({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),mwe=_i({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var UT={};Di(UT,{base32:()=>Lg,base32hex:()=>bwe,base32hexpad:()=>_we,base32hexpadupper:()=>xwe,base32hexupper:()=>wwe,base32pad:()=>gwe,base32padupper:()=>vwe,base32upper:()=>ywe,base32z:()=>NE});E();var Lg=_i({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),ywe=_i({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),gwe=_i({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),vwe=_i({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),bwe=_i({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),wwe=_i({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),_we=_i({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),xwe=_i({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),NE=_i({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var FT={};Di(FT,{base36:()=>Ewe,base36upper:()=>Swe});E();var Ewe=Oh({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),Swe=Oh({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var zT={};Di(zT,{base58btc:()=>Zs,base58flickr:()=>Mwe});E();var Zs=Oh({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),Mwe=Oh({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var KT={};Di(KT,{base256emoji:()=>Iwe});E();var $F=Array.from("\u{1F680}\u{1FA90}\u2604\u{1F6F0}\u{1F30C}\u{1F311}\u{1F312}\u{1F313}\u{1F314}\u{1F315}\u{1F316}\u{1F317}\u{1F318}\u{1F30D}\u{1F30F}\u{1F30E}\u{1F409}\u2600\u{1F4BB}\u{1F5A5}\u{1F4BE}\u{1F4BF}\u{1F602}\u2764\u{1F60D}\u{1F923}\u{1F60A}\u{1F64F}\u{1F495}\u{1F62D}\u{1F618}\u{1F44D}\u{1F605}\u{1F44F}\u{1F601}\u{1F525}\u{1F970}\u{1F494}\u{1F496}\u{1F499}\u{1F622}\u{1F914}\u{1F606}\u{1F644}\u{1F4AA}\u{1F609}\u263A\u{1F44C}\u{1F917}\u{1F49C}\u{1F614}\u{1F60E}\u{1F607}\u{1F339}\u{1F926}\u{1F389}\u{1F49E}\u270C\u2728\u{1F937}\u{1F631}\u{1F60C}\u{1F338}\u{1F64C}\u{1F60B}\u{1F497}\u{1F49A}\u{1F60F}\u{1F49B}\u{1F642}\u{1F493}\u{1F929}\u{1F604}\u{1F600}\u{1F5A4}\u{1F603}\u{1F4AF}\u{1F648}\u{1F447}\u{1F3B6}\u{1F612}\u{1F92D}\u2763\u{1F61C}\u{1F48B}\u{1F440}\u{1F62A}\u{1F611}\u{1F4A5}\u{1F64B}\u{1F61E}\u{1F629}\u{1F621}\u{1F92A}\u{1F44A}\u{1F973}\u{1F625}\u{1F924}\u{1F449}\u{1F483}\u{1F633}\u270B\u{1F61A}\u{1F61D}\u{1F634}\u{1F31F}\u{1F62C}\u{1F643}\u{1F340}\u{1F337}\u{1F63B}\u{1F613}\u2B50\u2705\u{1F97A}\u{1F308}\u{1F608}\u{1F918}\u{1F4A6}\u2714\u{1F623}\u{1F3C3}\u{1F490}\u2639\u{1F38A}\u{1F498}\u{1F620}\u261D\u{1F615}\u{1F33A}\u{1F382}\u{1F33B}\u{1F610}\u{1F595}\u{1F49D}\u{1F64A}\u{1F639}\u{1F5E3}\u{1F4AB}\u{1F480}\u{1F451}\u{1F3B5}\u{1F91E}\u{1F61B}\u{1F534}\u{1F624}\u{1F33C}\u{1F62B}\u26BD\u{1F919}\u2615\u{1F3C6}\u{1F92B}\u{1F448}\u{1F62E}\u{1F646}\u{1F37B}\u{1F343}\u{1F436}\u{1F481}\u{1F632}\u{1F33F}\u{1F9E1}\u{1F381}\u26A1\u{1F31E}\u{1F388}\u274C\u270A\u{1F44B}\u{1F630}\u{1F928}\u{1F636}\u{1F91D}\u{1F6B6}\u{1F4B0}\u{1F353}\u{1F4A2}\u{1F91F}\u{1F641}\u{1F6A8}\u{1F4A8}\u{1F92C}\u2708\u{1F380}\u{1F37A}\u{1F913}\u{1F619}\u{1F49F}\u{1F331}\u{1F616}\u{1F476}\u{1F974}\u25B6\u27A1\u2753\u{1F48E}\u{1F4B8}\u2B07\u{1F628}\u{1F31A}\u{1F98B}\u{1F637}\u{1F57A}\u26A0\u{1F645}\u{1F61F}\u{1F635}\u{1F44E}\u{1F932}\u{1F920}\u{1F927}\u{1F4CC}\u{1F535}\u{1F485}\u{1F9D0}\u{1F43E}\u{1F352}\u{1F617}\u{1F911}\u{1F30A}\u{1F92F}\u{1F437}\u260E\u{1F4A7}\u{1F62F}\u{1F486}\u{1F446}\u{1F3A4}\u{1F647}\u{1F351}\u2744\u{1F334}\u{1F4A3}\u{1F438}\u{1F48C}\u{1F4CD}\u{1F940}\u{1F922}\u{1F445}\u{1F4A1}\u{1F4A9}\u{1F450}\u{1F4F8}\u{1F47B}\u{1F910}\u{1F92E}\u{1F3BC}\u{1F975}\u{1F6A9}\u{1F34E}\u{1F34A}\u{1F47C}\u{1F48D}\u{1F4E3}\u{1F942}"),Pwe=$F.reduce((t,e,r)=>(t[r]=e,t),[]),Awe=$F.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);function Twe(t){return t.reduce((e,r)=>(e+=Pwe[r],e),"")}function Rwe(t){let e=[];for(let r of t){let n=Awe[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}var Iwe=Ag({prefix:"\u{1F680}",name:"base256emoji",encode:Twe,decode:Rwe});var WT={};Di(WT,{identity:()=>GT});E();var LF=0,kwe="identity",UF=gf,Owe=t=>D0(LF,UF(t)),GT={code:LF,name:kwe,encode:UF,digest:Owe};var $0={};Di($0,{code:()=>Uh,decode:()=>Cwe,encode:()=>Dwe,name:()=>Bwe});E();var Bwe="raw",Uh=85,Dwe=t=>gf(t),Cwe=t=>gf(t);E();var snt=new TextEncoder,ant=new TextDecoder;E();E();E();var FF=(t,e)=>{let{bytes:r,version:n}=t;switch(n){case 0:return qwe(r,VT(t),e||Zs.encoder);default:return $we(r,VT(t),e||Lg.encoder)}};var zF=new WeakMap,VT=t=>{let e=zF.get(t);if(e==null){let r=new Map;return zF.set(t,r),r}return e},St=class{constructor(e,r,n,i){this.code=r,this.version=e,this.multihash=n,this.bytes=i,this["/"]=i}get asCID(){return this}get byteOffset(){return this.bytes.byteOffset}get byteLength(){return this.bytes.byteLength}toV0(){switch(this.version){case 0:return this;case 1:{let{code:e,multihash:r}=this;if(e!==A1)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(r.code!==Lwe)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return St.createV0(r)}default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}toV1(){switch(this.version){case 0:{let{code:e,digest:r}=this.multihash,n=D0(e,r);return St.createV1(this.code,n)}case 1:return this;default:throw Error(`Can not convert CID version ${this.version} to version 1. This is a bug please report`)}}equals(e){return St.equals(this,e)}static equals(e,r){let n=r;return n&&e.code===n.code&&e.version===n.version&&bF(e.multihash,n.multihash)}toString(e){return FF(this,e)}toJSON(){return{"/":FF(this)}}link(){return this}get[Symbol.toStringTag](){return"CID"}[Symbol.for("nodejs.util.inspect.custom")](){return`CID(${this.toString()})`}static asCID(e){if(e==null)return null;let r=e;if(r instanceof St)return r;if(r["/"]!=null&&r["/"]===r.bytes||r.asCID===r){let{version:n,code:i,multihash:o,bytes:s}=r;return new St(n,i,o,s||KF(n,i,o.bytes))}else if(r[Uwe]===!0){let{version:n,multihash:i,code:o}=r,s=AE(i);return St.create(n,o,s)}else return null}static create(e,r,n){if(typeof r!="number")throw new Error("String codecs are no longer supported");if(!(n.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(e){case 0:{if(r!==A1)throw new Error(`Version 0 CID must use dag-pb (code: ${A1}) block encoding`);return new St(e,r,n,n.bytes)}case 1:{let i=KF(e,r,n.bytes);return new St(e,r,n,i)}default:throw new Error("Invalid version")}}static createV0(e){return St.create(0,A1,e)}static createV1(e,r){return St.create(1,e,r)}static decode(e){let[r,n]=St.decodeFirst(e);if(n.length)throw new Error("Incorrect length");return r}static decodeFirst(e){let r=St.inspectBytes(e),n=r.size-r.multihashSize,i=gf(e.subarray(n,n+r.multihashSize));if(i.byteLength!==r.multihashSize)throw new Error("Incorrect length");let o=i.subarray(r.multihashSize-r.digestSize),s=new Og(r.multihashCode,r.digestSize,o,i);return[r.version===0?St.createV0(s):St.createV1(r.codec,s),e.subarray(r.size)]}static inspectBytes(e){let r=0,n=()=>{let[w,P]=kg(e.subarray(r));return r+=P,w},i=n(),o=A1;if(i===18?(i=0,r=0):o=n(),i!==0&&i!==1)throw new RangeError(`Invalid CID version ${i}`);let s=r,a=n(),d=n(),m=r+d,p=m-s;return{version:i,codec:o,multihashCode:a,digestSize:d,multihashSize:p,size:m}}static parse(e,r){let[n,i]=Nwe(e,r),o=St.decode(i);if(o.version===0&&e[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return VT(o).set(n,e),o}},Nwe=(t,e)=>{switch(t[0]){case"Q":{let r=e||Zs;return[Zs.prefix,r.decode(`${Zs.prefix}${t}`)]}case Zs.prefix:{let r=e||Zs;return[Zs.prefix,r.decode(t)]}case Lg.prefix:{let r=e||Lg;return[Lg.prefix,r.decode(t)]}default:{if(e==null)throw Error("To parse non base32 or base58btc encoded CID multibase decoder must be provided");return[t[0],e.decode(t)]}}},qwe=(t,e,r)=>{let{prefix:n}=r;if(n!==Zs.prefix)throw Error(`Cannot string encode V0 in ${r.name} encoding`);let i=e.get(n);if(i==null){let o=r.encode(t).slice(1);return e.set(n,o),o}else return i},$we=(t,e,r)=>{let{prefix:n}=r,i=e.get(n);if(i==null){let o=r.encode(t);return e.set(n,o),o}else return i},A1=112,Lwe=18,KF=(t,e,r)=>{let n=B0(t),i=n+B0(e),o=new Uint8Array(i+r.byteLength);return O0(t,o,0),O0(e,o,n),o.set(r,i),o},Uwe=Symbol.for("@ipld/js-cid/CID");E();var HT={...jT,...NT,...qT,...$T,...LT,...UT,...FT,...zT,...XA,...KT},Ent={..._T,...WT};function WF(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}var GF=WF("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),ZT=WF("ascii","a",t=>{let e="a";for(let r=0;r<t.length;r++)e+=String.fromCharCode(t[r]);return e},t=>{t=t.substring(1);let e=Lh(t.length);for(let r=0;r<t.length;r++)e[r]=t.charCodeAt(r);return e}),Fwe={utf8:GF,"utf-8":GF,hex:HT.base16,latin1:ZT,ascii:ZT,binary:ZT,...HT},qE=Fwe;function L0(t,e="utf8"){let r=qE[e];if(r==null)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?$h(globalThis.Buffer.from(t,"utf-8")):r.decoder.decode(`${r.prefix}${t}`)}E();function JT(t,e="utf8"){let r=qE[e];if(r==null)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(t.buffer,t.byteOffset,t.byteLength).toString("utf8"):r.encoder.encode(t).substring(1)}E();var zwe={toString:JT,fromString:L0},Js=class{static validateKey(e){if(e.kty!=="EC"||e.crv!=="P-256")throw new be("Secp256r1KeyNotValid","Invalid SECP256R1 JWK: `kty` MUST be `EC`. `crv` MUST be `P-256`")}static async publicKeyToJwk(e){let r;e.byteLength===33?r=ld.ProjectivePoint.fromHex(e).toRawBytes(!1):r=e;let n=et.bytesToBase64Url(r.subarray(1,33)),i=et.bytesToBase64Url(r.subarray(33,65));return{alg:"ES256",kty:"EC",crv:"P-256",x:n,y:i}}static privateJwkToBytes(e){return et.base64UrlToBytes(e.d)}static async sign(e,r){Js.validateKey(r);let n=await xo.encode(e),i=Js.privateJwkToBytes(r);return Promise.resolve(ld.sign(n,i).toCompactRawBytes())}static async verify(e,r,n){Js.validateKey(n);let i;r.length===64?i=ld.Signature.fromCompact(r):i=ld.Signature.fromDER(r);let o=await xo.encode(e),s=ld.ProjectivePoint.fromAffine({x:Js.bytesToBigInt(et.base64UrlToBytes(n.x)),y:Js.bytesToBigInt(et.base64UrlToBytes(n.y))}).toRawBytes(!1);return ld.verify(i,o,s)}static async generateKeyPair(){let e=ld.utils.randomPrivateKey(),r=Hs.getPublicKey(e,!1),n=et.bytesToBase64Url(e),i=await Js.publicKeyToJwk(r),o={...i,d:n};return{publicJwk:i,privateJwk:o}}static bytesToBigInt(e){return BigInt("0x"+zwe.toString(e,"base16"))}};var Ug={Ed25519:m1,secp256k1:{sign:sn.sign,verify:sn.verify,generateKeyPair:sn.generateKeyPair,publicKeyToJwk:sn.publicKeyToJwk},"P-256":{sign:Js.sign,verify:Js.verify,generateKeyPair:Js.generateKeyPair,publicKeyToJwk:Js.publicKeyToJwk}};var Fh=class{constructor(e){if(e.keyId===void 0&&e.privateJwk.kid===void 0)throw new be("PrivateKeySignerUnableToDeduceKeyId","Unable to deduce the key ID");if(e.algorithm===void 0&&e.privateJwk.alg===void 0)throw new be("PrivateKeySignerUnableToDeduceAlgorithm","Unable to deduce the signature algorithm");if(this.keyId=e.keyId??e.privateJwk.kid,this.algorithm=e.algorithm??e.privateJwk.alg,this.privateJwk=e.privateJwk,this.signatureAlgorithm=Ug[e.privateJwk.crv],!this.signatureAlgorithm)throw new be("PrivateKeySignerUnsupportedCurve",`Unsupported crv ${e.privateJwk.crv}, crv must be one of ${Object.keys(Ug)}`)}async sign(e){return await this.signatureAlgorithm.sign(e,this.privateJwk)}};var zt=class{static getKid(e){let{kid:r}=et.base64UrlToObject(e.protected);return r}static getSignerDid(e){let r=zt.getKid(e);return zt.extractDid(r)}static async verifySignature(e,r,n){let i=Ug[n.crv];if(!i)throw new be("JwsVerifySignatureUnsupportedCrv",`unsupported crv. crv must be one of ${Object.keys(Ug)}`);let o=et.stringToBytes(`${r.protected}.${e}`),s=et.base64UrlToBytes(r.signature);return await i.verify(o,s,n)}static decodePlainObjectPayload(e){let r;try{r=et.base64UrlToObject(e.payload)}catch{throw new be("JwsDecodePlainObjectPayloadInvalid","payload is not a JSON object")}if(!(0,VF.default)(r))throw new be("JwsDecodePlainObjectPayloadInvalid","signed payload must be a plain object");return r}static extractDid(e){let[r]=e.split("#");return r}static createSigners(e){return e.map(n=>zt.createSigner(n))}static createSigner(e){let r=e.keyPair.privateJwk,n=e.keyId;return new Fh({privateJwk:r,keyId:n})}};E();E();var T1=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,ZF=new Set,YT=typeof j.default=="object"&&j.default?j.default:{},JF=(t,e,r,n)=>{typeof YT.emitWarning=="function"?YT.emitWarning(t,e,r,n):console.error(`[${r}] ${e}: ${t}`)},LE=globalThis.AbortController,HF=globalThis.AbortSignal;if(typeof LE>"u"){HF=class{onabort;_onabort=[];reason;aborted=!1;addEventListener(n,i){this._onabort.push(i)}},LE=class{constructor(){e()}signal=new HF;abort(n){if(!this.signal.aborted){this.signal.reason=n,this.signal.aborted=!0;for(let i of this.signal._onabort)i(n);this.signal.onabort?.(n)}}};let t=YT.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",e=()=>{t&&(t=!1,JF("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",e))}}var Kwe=t=>!ZF.has(t),_it=Symbol("type"),zh=t=>t&&t===Math.floor(t)&&t>0&&isFinite(t),YF=t=>zh(t)?t<=Math.pow(2,8)?Uint8Array:t<=Math.pow(2,16)?Uint16Array:t<=Math.pow(2,32)?Uint32Array:t<=Number.MAX_SAFE_INTEGER?zg:null:null,zg=class extends Array{constructor(e){super(e),this.fill(0)}},Kg,Fg=class{heap;length;static create(e){let r=YF(e);if(!r)return[];CA(Fg,Kg,!0);let n=new Fg(e,r);return CA(Fg,Kg,!1),n}constructor(e,r){if(!FL(Fg,Kg))throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new r(e),this.length=0}push(e){this.heap[this.length++]=e}pop(){return this.heap[--this.length]}},$E=Fg;Kg=new WeakMap,zL($E,Kg,!1);var Gg=class{#h;#u;#v;#p;#R;ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#n;#m;#i;#r;#e;#c;#l;#a;#o;#y;#s;#x;#E;#g;#b;#M;#f;static unsafeExposeInternals(e){return{starts:e.#E,ttls:e.#g,sizes:e.#x,keyMap:e.#i,keyList:e.#r,valList:e.#e,next:e.#c,prev:e.#l,get head(){return e.#a},get tail(){return e.#o},free:e.#y,isBackgroundFetch:r=>e.#t(r),backgroundFetch:(r,n,i,o)=>e.#O(r,n,i,o),moveToTail:r=>e.#T(r),indexes:r=>e.#w(r),rindexes:r=>e.#_(r),isStale:r=>e.#d(r)}}get max(){return this.#h}get maxSize(){return this.#u}get calculatedSize(){return this.#m}get size(){return this.#n}get fetchMethod(){return this.#R}get dispose(){return this.#v}get disposeAfter(){return this.#p}constructor(e){let{max:r=0,ttl:n,ttlResolution:i=1,ttlAutopurge:o,updateAgeOnGet:s,updateAgeOnHas:a,allowStale:d,dispose:m,disposeAfter:p,noDisposeOnSet:w,noUpdateTTL:P,maxSize:S=0,maxEntrySize:M=0,sizeCalculation:A,fetchMethod:B,noDeleteOnFetchRejection:I,noDeleteOnStaleGet:C,allowStaleOnFetchRejection:k,allowStaleOnFetchAbort:q,ignoreFetchAbort:L}=e;if(r!==0&&!zh(r))throw new TypeError("max option must be a nonnegative integer");let U=r?YF(r):Array;if(!U)throw new Error("invalid max value: "+r);if(this.#h=r,this.#u=S,this.maxEntrySize=M||this.#u,this.sizeCalculation=A,this.sizeCalculation){if(!this.#u&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(B!==void 0&&typeof B!="function")throw new TypeError("fetchMethod must be a function if specified");if(this.#R=B,this.#M=!!B,this.#i=new Map,this.#r=new Array(r).fill(void 0),this.#e=new Array(r).fill(void 0),this.#c=new U(r),this.#l=new U(r),this.#a=0,this.#o=0,this.#y=$E.create(r),this.#n=0,this.#m=0,typeof m=="function"&&(this.#v=m),typeof p=="function"?(this.#p=p,this.#s=[]):(this.#p=void 0,this.#s=void 0),this.#b=!!this.#v,this.#f=!!this.#p,this.noDisposeOnSet=!!w,this.noUpdateTTL=!!P,this.noDeleteOnFetchRejection=!!I,this.allowStaleOnFetchRejection=!!k,this.allowStaleOnFetchAbort=!!q,this.ignoreFetchAbort=!!L,this.maxEntrySize!==0){if(this.#u!==0&&!zh(this.#u))throw new TypeError("maxSize must be a positive integer if specified");if(!zh(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#q()}if(this.allowStale=!!d,this.noDeleteOnStaleGet=!!C,this.updateAgeOnGet=!!s,this.updateAgeOnHas=!!a,this.ttlResolution=zh(i)||i===0?i:1,this.ttlAutopurge=!!o,this.ttl=n||0,this.ttl){if(!zh(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#B()}if(this.#h===0&&this.ttl===0&&this.#u===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#h&&!this.#u){let F="LRU_CACHE_UNBOUNDED";Kwe(F)&&(ZF.add(F),JF("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",F,Gg))}}getRemainingTTL(e){return this.#i.has(e)?1/0:0}#B(){let e=new zg(this.#h),r=new zg(this.#h);this.#g=e,this.#E=r,this.#D=(o,s,a=T1.now())=>{if(r[o]=s!==0?a:0,e[o]=s,s!==0&&this.ttlAutopurge){let d=setTimeout(()=>{this.#d(o)&&this.delete(this.#r[o])},s+1);d.unref&&d.unref()}},this.#P=o=>{r[o]=e[o]!==0?T1.now():0},this.#S=(o,s)=>{if(e[s]){let a=e[s],d=r[s];o.ttl=a,o.start=d,o.now=n||i();let m=o.now-d;o.remainingTTL=a-m}};let n=0,i=()=>{let o=T1.now();if(this.ttlResolution>0){n=o;let s=setTimeout(()=>n=0,this.ttlResolution);s.unref&&s.unref()}return o};this.getRemainingTTL=o=>{let s=this.#i.get(o);if(s===void 0)return 0;let a=e[s],d=r[s];if(a===0||d===0)return 1/0;let m=(n||i())-d;return a-m},this.#d=o=>e[o]!==0&&r[o]!==0&&(n||i())-r[o]>e[o]}#P=()=>{};#S=()=>{};#D=()=>{};#d=()=>!1;#q(){let e=new zg(this.#h);this.#m=0,this.#x=e,this.#A=r=>{this.#m-=e[r],e[r]=0},this.#C=(r,n,i,o)=>{if(this.#t(n))return 0;if(!zh(i))if(o){if(typeof o!="function")throw new TypeError("sizeCalculation must be a function");if(i=o(n,r),!zh(i))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return i},this.#I=(r,n,i)=>{if(e[r]=n,this.#u){let o=this.#u-e[r];for(;this.#m>o;)this.#k(!0)}this.#m+=e[r],i&&(i.entrySize=n,i.totalCalculatedSize=this.#m)}}#A=e=>{};#I=(e,r,n)=>{};#C=(e,r,n,i)=>{if(n||i)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#w({allowStale:e=this.allowStale}={}){if(this.#n)for(let r=this.#o;!(!this.#j(r)||((e||!this.#d(r))&&(yield r),r===this.#a));)r=this.#l[r]}*#_({allowStale:e=this.allowStale}={}){if(this.#n)for(let r=this.#a;!(!this.#j(r)||((e||!this.#d(r))&&(yield r),r===this.#o));)r=this.#c[r]}#j(e){return e!==void 0&&this.#i.get(this.#r[e])===e}*entries(){for(let e of this.#w())this.#e[e]!==void 0&&this.#r[e]!==void 0&&!this.#t(this.#e[e])&&(yield[this.#r[e],this.#e[e]])}*rentries(){for(let e of this.#_())this.#e[e]!==void 0&&this.#r[e]!==void 0&&!this.#t(this.#e[e])&&(yield[this.#r[e],this.#e[e]])}*keys(){for(let e of this.#w()){let r=this.#r[e];r!==void 0&&!this.#t(this.#e[e])&&(yield r)}}*rkeys(){for(let e of this.#_()){let r=this.#r[e];r!==void 0&&!this.#t(this.#e[e])&&(yield r)}}*values(){for(let e of this.#w())this.#e[e]!==void 0&&!this.#t(this.#e[e])&&(yield this.#e[e])}*rvalues(){for(let e of this.#_())this.#e[e]!==void 0&&!this.#t(this.#e[e])&&(yield this.#e[e])}[Symbol.iterator](){return this.entries()}find(e,r={}){for(let n of this.#w()){let i=this.#e[n],o=this.#t(i)?i.__staleWhileFetching:i;if(o!==void 0&&e(o,this.#r[n],this))return this.get(this.#r[n],r)}}forEach(e,r=this){for(let n of this.#w()){let i=this.#e[n],o=this.#t(i)?i.__staleWhileFetching:i;o!==void 0&&e.call(r,o,this.#r[n],this)}}rforEach(e,r=this){for(let n of this.#_()){let i=this.#e[n],o=this.#t(i)?i.__staleWhileFetching:i;o!==void 0&&e.call(r,o,this.#r[n],this)}}purgeStale(){let e=!1;for(let r of this.#_({allowStale:!0}))this.#d(r)&&(this.delete(this.#r[r]),e=!0);return e}dump(){let e=[];for(let r of this.#w({allowStale:!0})){let n=this.#r[r],i=this.#e[r],o=this.#t(i)?i.__staleWhileFetching:i;if(o===void 0||n===void 0)continue;let s={value:o};if(this.#g&&this.#E){s.ttl=this.#g[r];let a=T1.now()-this.#E[r];s.start=Math.floor(Date.now()-a)}this.#x&&(s.size=this.#x[r]),e.unshift([n,s])}return e}load(e){this.clear();for(let[r,n]of e){if(n.start){let i=Date.now()-n.start;n.start=T1.now()-i}this.set(r,n.value,n)}}set(e,r,n={}){if(r===void 0)return this.delete(e),this;let{ttl:i=this.ttl,start:o,noDisposeOnSet:s=this.noDisposeOnSet,sizeCalculation:a=this.sizeCalculation,status:d}=n,{noUpdateTTL:m=this.noUpdateTTL}=n,p=this.#C(e,r,n.size||0,a);if(this.maxEntrySize&&p>this.maxEntrySize)return d&&(d.set="miss",d.maxEntrySizeExceeded=!0),this.delete(e),this;let w=this.#n===0?void 0:this.#i.get(e);if(w===void 0)w=this.#n===0?this.#o:this.#y.length!==0?this.#y.pop():this.#n===this.#h?this.#k(!1):this.#n,this.#r[w]=e,this.#e[w]=r,this.#i.set(e,w),this.#c[this.#o]=w,this.#l[w]=this.#o,this.#o=w,this.#n++,this.#I(w,p,d),d&&(d.set="add"),m=!1;else{this.#T(w);let P=this.#e[w];if(r!==P){if(this.#M&&this.#t(P)?P.__abortController.abort(new Error("replaced")):s||(this.#b&&this.#v?.(P,e,"set"),this.#f&&this.#s?.push([P,e,"set"])),this.#A(w),this.#I(w,p,d),this.#e[w]=r,d){d.set="replace";let S=P&&this.#t(P)?P.__staleWhileFetching:P;S!==void 0&&(d.oldValue=S)}}else d&&(d.set="update")}if(i!==0&&!this.#g&&this.#B(),this.#g&&(m||this.#D(w,i,o),d&&this.#S(d,w)),!s&&this.#f&&this.#s){let P=this.#s,S;for(;S=P?.shift();)this.#p?.(...S)}return this}pop(){try{for(;this.#n;){let e=this.#e[this.#a];if(this.#k(!0),this.#t(e)){if(e.__staleWhileFetching)return e.__staleWhileFetching}else if(e!==void 0)return e}}finally{if(this.#f&&this.#s){let e=this.#s,r;for(;r=e?.shift();)this.#p?.(...r)}}}#k(e){let r=this.#a,n=this.#r[r],i=this.#e[r];return this.#M&&this.#t(i)?i.__abortController.abort(new Error("evicted")):(this.#b||this.#f)&&(this.#b&&this.#v?.(i,n,"evict"),this.#f&&this.#s?.push([i,n,"evict"])),this.#A(r),e&&(this.#r[r]=void 0,this.#e[r]=void 0,this.#y.push(r)),this.#n===1?(this.#a=this.#o=0,this.#y.length=0):this.#a=this.#c[r],this.#i.delete(n),this.#n--,r}has(e,r={}){let{updateAgeOnHas:n=this.updateAgeOnHas,status:i}=r,o=this.#i.get(e);if(o!==void 0){let s=this.#e[o];if(this.#t(s)&&s.__staleWhileFetching===void 0)return!1;if(this.#d(o))i&&(i.has="stale",this.#S(i,o));else return n&&this.#P(o),i&&(i.has="hit",this.#S(i,o)),!0}else i&&(i.has="miss");return!1}peek(e,r={}){let{allowStale:n=this.allowStale}=r,i=this.#i.get(e);if(i!==void 0&&(n||!this.#d(i))){let o=this.#e[i];return this.#t(o)?o.__staleWhileFetching:o}}#O(e,r,n,i){let o=r===void 0?void 0:this.#e[r];if(this.#t(o))return o;let s=new LE,{signal:a}=n;a?.addEventListener("abort",()=>s.abort(a.reason),{signal:s.signal});let d={signal:s.signal,options:n,context:i},m=(A,B=!1)=>{let{aborted:I}=s.signal,C=n.ignoreFetchAbort&&A!==void 0;if(n.status&&(I&&!B?(n.status.fetchAborted=!0,n.status.fetchError=s.signal.reason,C&&(n.status.fetchAbortIgnored=!0)):n.status.fetchResolved=!0),I&&!C&&!B)return w(s.signal.reason);let k=S;return this.#e[r]===S&&(A===void 0?k.__staleWhileFetching?this.#e[r]=k.__staleWhileFetching:this.delete(e):(n.status&&(n.status.fetchUpdated=!0),this.set(e,A,d.options))),A},p=A=>(n.status&&(n.status.fetchRejected=!0,n.status.fetchError=A),w(A)),w=A=>{let{aborted:B}=s.signal,I=B&&n.allowStaleOnFetchAbort,C=I||n.allowStaleOnFetchRejection,k=C||n.noDeleteOnFetchRejection,q=S;if(this.#e[r]===S&&(!k||q.__staleWhileFetching===void 0?this.delete(e):I||(this.#e[r]=q.__staleWhileFetching)),C)return n.status&&q.__staleWhileFetching!==void 0&&(n.status.returnedStale=!0),q.__staleWhileFetching;if(q.__returned===q)throw A},P=(A,B)=>{let I=this.#R?.(e,o,d);I&&I instanceof Promise&&I.then(C=>A(C),B),s.signal.addEventListener("abort",()=>{(!n.ignoreFetchAbort||n.allowStaleOnFetchAbort)&&(A(),n.allowStaleOnFetchAbort&&(A=C=>m(C,!0)))})};n.status&&(n.status.fetchDispatched=!0);let S=new Promise(P).then(m,p),M=Object.assign(S,{__abortController:s,__staleWhileFetching:o,__returned:void 0});return r===void 0?(this.set(e,M,{...d.options,status:void 0}),r=this.#i.get(e)):this.#e[r]=M,M}#t(e){if(!this.#M)return!1;let r=e;return!!r&&r instanceof Promise&&r.hasOwnProperty("__staleWhileFetching")&&r.__abortController instanceof LE}async fetch(e,r={}){let{allowStale:n=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,ttl:s=this.ttl,noDisposeOnSet:a=this.noDisposeOnSet,size:d=0,sizeCalculation:m=this.sizeCalculation,noUpdateTTL:p=this.noUpdateTTL,noDeleteOnFetchRejection:w=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:P=this.allowStaleOnFetchRejection,ignoreFetchAbort:S=this.ignoreFetchAbort,allowStaleOnFetchAbort:M=this.allowStaleOnFetchAbort,context:A,forceRefresh:B=!1,status:I,signal:C}=r;if(!this.#M)return I&&(I.fetch="get"),this.get(e,{allowStale:n,updateAgeOnGet:i,noDeleteOnStaleGet:o,status:I});let k={allowStale:n,updateAgeOnGet:i,noDeleteOnStaleGet:o,ttl:s,noDisposeOnSet:a,size:d,sizeCalculation:m,noUpdateTTL:p,noDeleteOnFetchRejection:w,allowStaleOnFetchRejection:P,allowStaleOnFetchAbort:M,ignoreFetchAbort:S,status:I,signal:C},q=this.#i.get(e);if(q===void 0){I&&(I.fetch="miss");let L=this.#O(e,q,k,A);return L.__returned=L}else{let L=this.#e[q];if(this.#t(L)){let x=n&&L.__staleWhileFetching!==void 0;return I&&(I.fetch="inflight",x&&(I.returnedStale=!0)),x?L.__staleWhileFetching:L.__returned=L}let U=this.#d(q);if(!B&&!U)return I&&(I.fetch="hit"),this.#T(q),i&&this.#P(q),I&&this.#S(I,q),L;let F=this.#O(e,q,k,A),G=F.__staleWhileFetching!==void 0&&n;return I&&(I.fetch=U?"stale":"refresh",G&&U&&(I.returnedStale=!0)),G?F.__staleWhileFetching:F.__returned=F}}get(e,r={}){let{allowStale:n=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,status:s}=r,a=this.#i.get(e);if(a!==void 0){let d=this.#e[a],m=this.#t(d);return s&&this.#S(s,a),this.#d(a)?(s&&(s.get="stale"),m?(s&&n&&d.__staleWhileFetching!==void 0&&(s.returnedStale=!0),n?d.__staleWhileFetching:void 0):(o||this.delete(e),s&&n&&(s.returnedStale=!0),n?d:void 0)):(s&&(s.get="hit"),m?d.__staleWhileFetching:(this.#T(a),i&&this.#P(a),d))}else s&&(s.get="miss")}#N(e,r){this.#l[r]=e,this.#c[e]=r}#T(e){e!==this.#o&&(e===this.#a?this.#a=this.#c[e]:this.#N(this.#l[e],this.#c[e]),this.#N(this.#o,e),this.#o=e)}delete(e){let r=!1;if(this.#n!==0){let n=this.#i.get(e);if(n!==void 0)if(r=!0,this.#n===1)this.clear();else{this.#A(n);let i=this.#e[n];this.#t(i)?i.__abortController.abort(new Error("deleted")):(this.#b||this.#f)&&(this.#b&&this.#v?.(i,e,"delete"),this.#f&&this.#s?.push([i,e,"delete"])),this.#i.delete(e),this.#r[n]=void 0,this.#e[n]=void 0,n===this.#o?this.#o=this.#l[n]:n===this.#a?this.#a=this.#c[n]:(this.#c[this.#l[n]]=this.#c[n],this.#l[this.#c[n]]=this.#l[n]),this.#n--,this.#y.push(n)}}if(this.#f&&this.#s?.length){let n=this.#s,i;for(;i=n?.shift();)this.#p?.(...i)}return r}clear(){for(let e of this.#_({allowStale:!0})){let r=this.#e[e];if(this.#t(r))r.__abortController.abort(new Error("deleted"));else{let n=this.#r[e];this.#b&&this.#v?.(r,n,"delete"),this.#f&&this.#s?.push([r,n,"delete"])}}if(this.#i.clear(),this.#e.fill(void 0),this.#r.fill(void 0),this.#g&&this.#E&&(this.#g.fill(0),this.#E.fill(0)),this.#x&&this.#x.fill(0),this.#a=0,this.#o=0,this.#y.length=0,this.#m=0,this.#n=0,this.#f&&this.#s){let e=this.#s,r;for(;r=e?.shift();)this.#p?.(...r)}}};var UE=class{constructor(e){this.timeToLiveInSeconds=e;this.cache=new Gg({max:1e5,ttl:e*1e3})}async set(e,r){try{this.cache.set(e,r)}catch{}}async get(e){return this.cache.get(e)}};E();var tR={};Di(tR,{Authorization:()=>Gwe,AuthorizationDelegatedGrant:()=>Wwe,AuthorizationOwner:()=>Zwe,Definitions:()=>s1e,EventsFilter:()=>r1e,EventsGet:()=>n1e,EventsQuery:()=>i1e,EventsSubscribe:()=>o1e,GeneralJwk:()=>a1e,GeneralJws:()=>c1e,GenericSignaturePayload:()=>T1e,JwkVerificationMethod:()=>f1e,MessagesGet:()=>l1e,NumberRangeFilter:()=>d1e,PaginationCursor:()=>h1e,PermissionGrantData:()=>p1e,PermissionRequestData:()=>m1e,PermissionRevocationData:()=>y1e,PermissionsDefinitions:()=>g1e,PermissionsScopes:()=>v1e,ProtocolDefinition:()=>b1e,ProtocolRuleSet:()=>x1e,ProtocolsConfigure:()=>E1e,ProtocolsQuery:()=>S1e,PublicJwk:()=>A1e,RecordsDelete:()=>Jwe,RecordsFilter:()=>P1e,RecordsQuery:()=>Ywe,RecordsRead:()=>M1e,RecordsSubscribe:()=>Qwe,RecordsWrite:()=>Xwe,RecordsWriteDataEncoded:()=>e1e,RecordsWriteSignaturePayload:()=>R1e,RecordsWriteUnidentified:()=>t1e,StringRangeFilter:()=>I1e});E();var Gwe=Yn;var z0=new RegExp("^[A-Za-z0-9_-]+$","u");function cn(t,{instancePath:e="",parentData:r,parentDataProperty:n,rootData:i=t,dynamicAnchors:o={}}={}){let s=null,a=0,d=cn.evaluated;if(d.dynamicProps&&(d.props=void 0),d.dynamicItems&&(d.items=void 0),a===0)if(t&&typeof t=="object"&&!Array.isArray(t)){let P=a;for(let S in t)if(!(S==="payload"||S==="signatures")){return cn.errors=[{instancePath:e,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:S},message:"must NOT have additional properties"}],!1;break}if(P===a){if(t.payload!==void 0){let S=t.payload,M=a;if(a===a)if(typeof S=="string"){if(!z0.test(S))return cn.errors=[{instancePath:e+"/payload",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/$defs/base64url/pattern",keyword:"pattern",params:{pattern:"^[A-Za-z0-9_-]+$"},message:'must match pattern "^[A-Za-z0-9_-]+$"'}],!1}else return cn.errors=[{instancePath:e+"/payload",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/$defs/base64url/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var m=M===a}else var m=!0;if(m)if(t.signatures!==void 0){let S=t.signatures,M=a;if(a===M)if(Array.isArray(S)){if(S.length<1)return cn.errors=[{instancePath:e+"/signatures",schemaPath:"#/properties/signatures/minItems",keyword:"minItems",params:{limit:1},message:"must NOT have fewer than 1 items"}],!1;{var p=!0;let B=S.length;for(let I=0;I<B;I++){let C=S[I],k=a;if(a===k)if(C&&typeof C=="object"&&!Array.isArray(C)){if(C.protected!==void 0){let L=C.protected,U=a;if(a===a)if(typeof L=="string"){if(!z0.test(L))return cn.errors=[{instancePath:e+"/signatures/"+I+"/protected",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/$defs/base64url/pattern",keyword:"pattern",params:{pattern:"^[A-Za-z0-9_-]+$"},message:'must match pattern "^[A-Za-z0-9_-]+$"'}],!1}else return cn.errors=[{instancePath:e+"/signatures/"+I+"/protected",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/$defs/base64url/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var w=U===a}else var w=!0;if(w)if(C.signature!==void 0){let L=C.signature,U=a;if(a===a)if(typeof L=="string"){if(!z0.test(L))return cn.errors=[{instancePath:e+"/signatures/"+I+"/signature",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/$defs/base64url/pattern",keyword:"pattern",params:{pattern:"^[A-Za-z0-9_-]+$"},message:'must match pattern "^[A-Za-z0-9_-]+$"'}],!1}else return cn.errors=[{instancePath:e+"/signatures/"+I+"/signature",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/$defs/base64url/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var w=U===a}else var w=!0}else return cn.errors=[{instancePath:e+"/signatures/"+I,schemaPath:"#/properties/signatures/items/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;var p=k===a;if(!p)break}}}else return cn.errors=[{instancePath:e+"/signatures",schemaPath:"#/properties/signatures/type",keyword:"type",params:{type:"array"},message:"must be array"}],!1;var m=M===a}else var m=!0}}else return cn.errors=[{instancePath:e,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;return cn.errors=s,a===0}cn.evaluated={props:!0,dynamicProps:!1,dynamicItems:!1};function Yn(t,{instancePath:e="",parentData:r,parentDataProperty:n,rootData:i=t,dynamicAnchors:o={}}={}){let s=null,a=0,d=Yn.evaluated;if(d.dynamicProps&&(d.props=void 0),d.dynamicItems&&(d.items=void 0),a===0)if(t&&typeof t=="object"&&!Array.isArray(t)){let m=a;for(let p in t)if(p!=="signature"){return Yn.errors=[{instancePath:e,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:p},message:"must NOT have additional properties"}],!1;break}m===a&&t.signature!==void 0&&(cn(t.signature,{instancePath:e+"/signature",parentData:t,parentDataProperty:"signature",rootData:i,dynamicAnchors:o})||(s=s===null?cn.errors:s.concat(cn.errors),a=s.length))}else return Yn.errors=[{instancePath:e,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;return Yn.errors=s,a===0}Yn.evaluated={props:!0,dynamicProps:!1,dynamicItems:!1};var Wwe=So;var Kh={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://identity.foundation/dwn/json-schemas/records-write-unidentified.json",type:"object",required:["descriptor"],properties:{recordId:{type:"string"},contextId:{type:"string",pattern:"^[a-zA-Z0-9]+(/[a-zA-Z0-9]+)*$"},attestation:{$ref:"https://identity.foundation/dwn/json-schemas/general-jws.json"},authorization:{$ref:"https://identity.foundation/dwn/json-schemas/authorization-owner.json"},encryption:{type:"object",properties:{algorithm:{type:"string",enum:["A256CTR"]},initializationVector:{$ref:"https://identity.foundation/dwn/json-schemas/defs.json#/$defs/base64url"},keyEncryption:{type:"array",minItems:1,items:{type:"object",properties:{rootKeyId:{type:"string"},derivationScheme:{type:"string",enum:["dataFormats","protocolContext","protocolPath","schemas"]},derivedPublicKey:{$ref:"https://identity.foundation/dwn/json-schemas/public-jwk.json"},algorithm:{type:"string",enum:["ECIES-ES256K"]},encryptedKey:{$ref:"https://identity.foundation/dwn/json-schemas/defs.json#/$defs/base64url"},initializationVector:{$ref:"https://identity.foundation/dwn/json-schemas/defs.json#/$defs/base64url"},ephemeralPublicKey:{$ref:"https://identity.foundation/dwn/json-schemas/public-jwk.json"},messageAuthenticationCode:{$ref:"https://identity.foundation/dwn/json-schemas/defs.json#/$defs/base64url"}},additionalProperties:!1,required:["rootKeyId","derivationScheme","algorithm","encryptedKey","initializationVector","ephemeralPublicKey","messageAuthenticationCode"]}}},additionalProperties:!1,required:["algorithm","initializationVector","keyEncryption"]},descriptor:{type:"object",properties:{interface:{enum:["Records"],type:"string"},method:{enum:["Write"],type:"string"},recipient:{$ref:"https://identity.foundation/dwn/json-schemas/defs.json#/$defs/did"},protocol:{type:"string"},protocolPath:{type:"string",pattern:"^[a-zA-Z]+(/[a-zA-Z]+)*$"},schema:{type:"string"},tags:{type:"object",minProperties:1,maxProperties:10,additionalProperties:{oneOf:[{type:"string"},{type:"number"},{type:"boolean"},{type:"array",minItems:1,maxItems:10,items:{type:"string"}},{type:"array",minItems:1,maxItems:10,items:{type:"number"}}]}},parentId:{type:"string"},dataCid:{type:"string"},dataSize:{type:"number"},dateCreated:{$ref:"https://identity.foundation/dwn/json-schemas/defs.json#/$defs/date-time"},messageTimestamp:{$ref:"https://identity.foundation/dwn/json-schemas/defs.json#/$defs/date-time"},published:{type:"boolean"},datePublished:{$ref:"https://identity.foundation/dwn/json-schemas/defs.json#/$defs/date-time"},dataFormat:{type:"string"}},additionalProperties:!1,required:["interface","method","dataCid","dataSize","dateCreated","messageTimestamp","dataFormat"],dependencies:{parentId:["protocol"]},allOf:[{$comment:"rule defining `published` and `datePublished` relationship",anyOf:[{properties:{published:{type:"boolean",enum:[!0]}},required:["published","datePublished"]},{properties:{published:{type:"boolean",enum:[!1]}},not:{required:["datePublished"]}},{allOf:[{not:{required:["published"]}},{not:{required:["datePublished"]}}]}]}]}},$comment:"rule defining `protocol` and `contextId` relationship",anyOf:[{properties:{descriptor:{type:"object",required:["protocol","protocolPath"]}},required:["contextId"]},{allOf:[{not:{required:["contextId"]}},{properties:{descriptor:{type:"object",not:{required:["protocol"]}}}},{properties:{descriptor:{type:"object",not:{required:["protocolPath"]}}}}]}]};var Vwe=new RegExp("^[a-zA-Z0-9]+(/[a-zA-Z0-9]+)*$","u"),K0=new RegExp("^did:([a-z0-9]+):((?:(?:[a-zA-Z0-9._-]|(?:%[0-9a-fA-F]{2}))*:)*((?:[a-zA-Z0-9._-]|(?:%[0-9a-fA-F]{2}))+))((;[a-zA-Z0-9_.:%-]+=[a-zA-Z0-9_.:%-]*)*)(/[^#?]*)?([?][^#]*)?(#.*)?$","u"),Hwe=new RegExp("^[a-zA-Z]+(/[a-zA-Z]+)*$","u"),Jn=new RegExp("^\\d{4}-[0-1]\\d-[0-3]\\dT(?:[0-2]\\d:[0-5]\\d:[0-5]\\d|23:59:60)\\.\\d{6}Z$","u");var Wg={validate:Sc};function Iu(t,{instancePath:e="",parentData:r,parentDataProperty:n,rootData:i=t,dynamicAnchors:o={}}={}){let s=null,a=0,d=Iu.evaluated;if(d.dynamicProps&&(d.props=void 0),d.dynamicItems&&(d.items=void 0),a===0)if(t&&typeof t=="object"&&!Array.isArray(t)){let p=a;for(let w in t)if(!(w==="signature"||w==="authorDelegatedGrant"||w==="ownerSignature"||w==="ownerDelegatedGrant")){return Iu.errors=[{instancePath:e,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:w},message:"must NOT have additional properties"}],!1;break}if(p===a){let w;if(t.ownerSignature!==void 0&&t.signature===void 0&&(w="signature"))return Iu.errors=[{instancePath:e,schemaPath:"#/dependencies",keyword:"dependencies",params:{property:"ownerSignature",missingProperty:w,depsCount:1,deps:"signature"},message:"must have property signature when property ownerSignature is present"}],!1;if(t.signature!==void 0){let P=a;cn(t.signature,{instancePath:e+"/signature",parentData:t,parentDataProperty:"signature",rootData:i,dynamicAnchors:o})||(s=s===null?cn.errors:s.concat(cn.errors),a=s.length);var m=P===a}else var m=!0;if(m){if(t.authorDelegatedGrant!==void 0){let P=a;Wg.validate(t.authorDelegatedGrant,{instancePath:e+"/authorDelegatedGrant",parentData:t,parentDataProperty:"authorDelegatedGrant",rootData:i,dynamicAnchors:o})||(s=s===null?Wg.validate.errors:s.concat(Wg.validate.errors),a=s.length);var m=P===a}else var m=!0;if(m){if(t.ownerSignature!==void 0){let P=a;cn(t.ownerSignature,{instancePath:e+"/ownerSignature",parentData:t,parentDataProperty:"ownerSignature",rootData:i,dynamicAnchors:o})||(s=s===null?cn.errors:s.concat(cn.errors),a=s.length);var m=P===a}else var m=!0;if(m)if(t.ownerDelegatedGrant!==void 0){let P=a;Wg.validate(t.ownerDelegatedGrant,{instancePath:e+"/ownerDelegatedGrant",parentData:t,parentDataProperty:"ownerDelegatedGrant",rootData:i,dynamicAnchors:o})||(s=s===null?Wg.validate.errors:s.concat(Wg.validate.errors),a=s.length);var m=P===a}else var m=!0}}}}else return Iu.errors=[{instancePath:e,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;return Iu.errors=s,a===0}Iu.evaluated={props:!0,dynamicProps:!1,dynamicItems:!1};var lz={$id:"https://identity.foundation/dwn/json-schemas/general-jwk.json",$schema:"https://json-schema.org/draft/2020-12/schema",type:"object",required:["kty"],properties:{alg:{type:"string"},kid:{type:"string"},kty:{enum:["EC","RSA","oct","OKP"]},crv:{type:"string"},use:{type:"string"},key_ops:{type:"string"},x5u:{type:"string"},x5c:{type:"string"},x5t:{type:"string"},"x5t#S256":{type:"string"}},oneOf:[{properties:{kty:{const:"EC"},crv:{type:"string"},x:{type:"string"},y:{type:"string"},d:{type:"string"}},required:["crv","x"]},{properties:{kty:{const:"OKP"},crv:{type:"string"},x:{type:"string"},d:{type:"string"}},required:["crv","x"]},{properties:{kty:{const:"RSA"},n:{type:"string"},e:{type:"string"},d:{type:"string"},p:{type:"string"},q:{type:"string"},dp:{type:"string"},dq:{type:"string"},qi:{type:"string"},oth:{type:"object"}},required:["n","e"]},{properties:{kty:{const:"oct"},k:{type:"string"}},required:["k"]}]};function an(t,{instancePath:e="",parentData:r,parentDataProperty:n,rootData:i=t,dynamicAnchors:o={}}={}){let s=null,a=0,d=an.evaluated;d.dynamicProps&&(d.props=void 0),d.dynamicItems&&(d.items=void 0);let m=a,p=a,w=!1,P=null,S=a;if(t&&typeof t=="object"&&!Array.isArray(t)){let l;if(t.crv===void 0&&(l="crv")||t.x===void 0&&(l="x")){let h={instancePath:e,schemaPath:"https://identity.foundation/dwn/json-schemas/general-jwk.json/oneOf/0/required",keyword:"required",params:{missingProperty:l},message:"must have required property '"+l+"'"};s===null?s=[h]:s.push(h),a++}else{if(t.kty!==void 0){let h=a;if(t.kty!=="EC"){let b={instancePath:e+"/kty",schemaPath:"https://identity.foundation/dwn/json-schemas/general-jwk.json/oneOf/0/properties/kty/const",keyword:"const",params:{allowedValue:"EC"},message:"must be equal to constant"};s===null?s=[b]:s.push(b),a++}var M=h===a}else var M=!0;if(M){if(t.crv!==void 0){let h=a;if(typeof t.crv!="string"){let _={instancePath:e+"/crv",schemaPath:"https://identity.foundation/dwn/json-schemas/general-jwk.json/oneOf/0/properties/crv/type",keyword:"type",params:{type:"string"},message:"must be string"};s===null?s=[_]:s.push(_),a++}var M=h===a}else var M=!0;if(M){if(t.x!==void 0){let h=a;if(typeof t.x!="string"){let _={instancePath:e+"/x",schemaPath:"https://identity.foundation/dwn/json-schemas/general-jwk.json/oneOf/0/properties/x/type",keyword:"type",params:{type:"string"},message:"must be string"};s===null?s=[_]:s.push(_),a++}var M=h===a}else var M=!0;if(M){if(t.y!==void 0){let h=a;if(typeof t.y!="string"){let _={instancePath:e+"/y",schemaPath:"https://identity.foundation/dwn/json-schemas/general-jwk.json/oneOf/0/properties/y/type",keyword:"type",params:{type:"string"},message:"must be string"};s===null?s=[_]:s.push(_),a++}var M=h===a}else var M=!0;if(M)if(t.d!==void 0){let h=a;if(typeof t.d!="string"){let _={instancePath:e+"/d",schemaPath:"https://identity.foundation/dwn/json-schemas/general-jwk.json/oneOf/0/properties/d/type",keyword:"type",params:{type:"string"},message:"must be string"};s===null?s=[_]:s.push(_),a++}var M=h===a}else var M=!0}}}}}var C=S===a;if(C){w=!0,P=0;var A={};A.kty=!0,A.crv=!0,A.x=!0,A.y=!0,A.d=!0}let B=a;if(t&&typeof t=="object"&&!Array.isArray(t)){let l;if(t.crv===void 0&&(l="crv")||t.x===void 0&&(l="x")){let h={instancePath:e,schemaPath:"https://identity.foundation/dwn/json-schemas/general-jwk.json/oneOf/1/required",keyword:"required",params:{missingProperty:l},message:"must have required property '"+l+"'"};s===null?s=[h]:s.push(h),a++}else{if(t.kty!==void 0){let h=a;if(t.kty!=="OKP"){let b={instancePath:e+"/kty",schemaPath:"https://identity.foundation/dwn/json-schemas/general-jwk.json/oneOf/1/properties/kty/const",keyword:"const",params:{allowedValue:"OKP"},message:"must be equal to constant"};s===null?s=[b]:s.push(b),a++}var I=h===a}else var I=!0;if(I){if(t.crv!==void 0){let h=a;if(typeof t.crv!="string"){let _={instancePath:e+"/crv",schemaPath:"https://identity.foundation/dwn/json-schemas/general-jwk.json/oneOf/1/properties/crv/type",keyword:"type",params:{type:"string"},message:"must be string"};s===null?s=[_]:s.push(_),a++}var I=h===a}else var I=!0;if(I){if(t.x!==void 0){let h=a;if(typeof t.x!="string"){let _={instancePath:e+"/x",schemaPath:"https://identity.foundation/dwn/json-schemas/general-jwk.json/oneOf/1/properties/x/type",keyword:"type",params:{type:"string"},message:"must be string"};s===null?s=[_]:s.push(_),a++}var I=h===a}else var I=!0;if(I)if(t.d!==void 0){let h=a;if(typeof t.d!="string"){let _={instancePath:e+"/d",schemaPath:"https://identity.foundation/dwn/json-schemas/general-jwk.json/oneOf/1/properties/d/type",keyword:"type",params:{type:"string"},message:"must be string"};s===null?s=[_]:s.push(_),a++}var I=h===a}else var I=!0}}}}var C=B===a;if(C&&w)w=!1,P=[P,1];else{C&&(w=!0,P=1,A!==!0&&(A=A||{},A.kty=!0,A.crv=!0,A.x=!0,A.d=!0));let l=a;if(t&&typeof t=="object"&&!Array.isArray(t)){let b;if(t.n===void 0&&(b="n")||t.e===void 0&&(b="e")){let _={instancePath:e,schemaPath:"https://identity.foundation/dwn/json-schemas/general-jwk.json/oneOf/2/required",keyword:"required",params:{missingProperty:b},message:"must have required property '"+b+"'"};s===null?s=[_]:s.push(_),a++}else{if(t.kty!==void 0){let _=a;if(t.kty!=="RSA"){let g={instancePath:e+"/kty",schemaPath:"https://identity.foundation/dwn/json-schemas/general-jwk.json/oneOf/2/properties/kty/const",keyword:"const",params:{allowedValue:"RSA"},message:"must be equal to constant"};s===null?s=[g]:s.push(g),a++}var k=_===a}else var k=!0;if(k){if(t.n!==void 0){let _=a;if(typeof t.n!="string"){let f={instancePath:e+"/n",schemaPath:"https://identity.foundation/dwn/json-schemas/general-jwk.json/oneOf/2/properties/n/type",keyword:"type",params:{type:"string"},message:"must be string"};s===null?s=[f]:s.push(f),a++}var k=_===a}else var k=!0;if(k){if(t.e!==void 0){let _=a;if(typeof t.e!="string"){let f={instancePath:e+"/e",schemaPath:"https://identity.foundation/dwn/json-schemas/general-jwk.json/oneOf/2/properties/e/type",keyword:"type",params:{type:"string"},message:"must be string"};s===null?s=[f]:s.push(f),a++}var k=_===a}else var k=!0;if(k){if(t.d!==void 0){let _=a;if(typeof t.d!="string"){let f={instancePath:e+"/d",schemaPath:"https://identity.foundation/dwn/json-schemas/general-jwk.json/oneOf/2/properties/d/type",keyword:"type",params:{type:"string"},message:"must be string"};s===null?s=[f]:s.push(f),a++}var k=_===a}else var k=!0;if(k){if(t.p!==void 0){let _=a;if(typeof t.p!="string"){let f={instancePath:e+"/p",schemaPath:"https://identity.foundation/dwn/json-schemas/general-jwk.json/oneOf/2/properties/p/type",keyword:"type",params:{type:"string"},message:"must be string"};s===null?s=[f]:s.push(f),a++}var k=_===a}else var k=!0;if(k){if(t.q!==void 0){let _=a;if(typeof t.q!="string"){let f={instancePath:e+"/q",schemaPath:"https://identity.foundation/dwn/json-schemas/general-jwk.json/oneOf/2/properties/q/type",keyword:"type",params:{type:"string"},message:"must be string"};s===null?s=[f]:s.push(f),a++}var k=_===a}else var k=!0;if(k){if(t.dp!==void 0){let _=a;if(typeof t.dp!="string"){let f={instancePath:e+"/dp",schemaPath:"https://identity.foundation/dwn/json-schemas/general-jwk.json/oneOf/2/properties/dp/type",keyword:"type",params:{type:"string"},message:"must be string"};s===null?s=[f]:s.push(f),a++}var k=_===a}else var k=!0;if(k){if(t.dq!==void 0){let _=a;if(typeof t.dq!="string"){let f={instancePath:e+"/dq",schemaPath:"https://identity.foundation/dwn/json-schemas/general-jwk.json/oneOf/2/properties/dq/type",keyword:"type",params:{type:"string"},message:"must be string"};s===null?s=[f]:s.push(f),a++}var k=_===a}else var k=!0;if(k){if(t.qi!==void 0){let _=a;if(typeof t.qi!="string"){let f={instancePath:e+"/qi",schemaPath:"https://identity.foundation/dwn/json-schemas/general-jwk.json/oneOf/2/properties/qi/type",keyword:"type",params:{type:"string"},message:"must be string"};s===null?s=[f]:s.push(f),a++}var k=_===a}else var k=!0;if(k)if(t.oth!==void 0){let _=t.oth,g=a;if(!(_&&typeof _=="object"&&!Array.isArray(_))){let v={instancePath:e+"/oth",schemaPath:"https://identity.foundation/dwn/json-schemas/general-jwk.json/oneOf/2/properties/oth/type",keyword:"type",params:{type:"object"},message:"must be object"};s===null?s=[v]:s.push(v),a++}var k=g===a}else var k=!0}}}}}}}}}}var C=l===a;if(C&&w)w=!1,P=[P,2];else{C&&(w=!0,P=2,A!==!0&&(A=A||{},A.kty=!0,A.n=!0,A.e=!0,A.d=!0,A.p=!0,A.q=!0,A.dp=!0,A.dq=!0,A.qi=!0,A.oth=!0));let b=a;if(t&&typeof t=="object"&&!Array.isArray(t)){let g;if(t.k===void 0&&(g="k")){let f={instancePath:e,schemaPath:"https://identity.foundation/dwn/json-schemas/general-jwk.json/oneOf/3/required",keyword:"required",params:{missingProperty:g},message:"must have required property '"+g+"'"};s===null?s=[f]:s.push(f),a++}else{if(t.kty!==void 0){let f=a;if(t.kty!=="oct"){let v={instancePath:e+"/kty",schemaPath:"https://identity.foundation/dwn/json-schemas/general-jwk.json/oneOf/3/properties/kty/const",keyword:"const",params:{allowedValue:"oct"},message:"must be equal to constant"};s===null?s=[v]:s.push(v),a++}var q=f===a}else var q=!0;if(q)if(t.k!==void 0){let f=a;if(typeof t.k!="string"){let O={instancePath:e+"/k",schemaPath:"https://identity.foundation/dwn/json-schemas/general-jwk.json/oneOf/3/properties/k/type",keyword:"type",params:{type:"string"},message:"must be string"};s===null?s=[O]:s.push(O),a++}var q=f===a}else var q=!0}}var C=b===a;C&&w?(w=!1,P=[P,3]):C&&(w=!0,P=3,A!==!0&&(A=A||{},A.kty=!0,A.k=!0))}}if(w)a=p,s!==null&&(p?s.length=p:s=null);else{let l={instancePath:e,schemaPath:"https://identity.foundation/dwn/json-schemas/general-jwk.json/oneOf",keyword:"oneOf",params:{passingSchemas:P},message:"must match exactly one schema in oneOf"};return s===null?s=[l]:s.push(l),a++,an.errors=s,!1}if(a===m)if(t&&typeof t=="object"&&!Array.isArray(t)){let l;if(t.kty===void 0&&(l="kty"))return an.errors=[{instancePath:e,schemaPath:"https://identity.foundation/dwn/json-schemas/general-jwk.json/required",keyword:"required",params:{missingProperty:l},message:"must have required property '"+l+"'"}],!1;if(A!==!0&&(A=A||{},A.alg=!0,A.kid=!0,A.kty=!0,A.crv=!0,A.use=!0,A.key_ops=!0,A.x5u=!0,A.x5c=!0,A.x5t=!0,A["x5t#S256"]=!0),t.alg!==void 0){let h=a;if(typeof t.alg!="string")return an.errors=[{instancePath:e+"/alg",schemaPath:"https://identity.foundation/dwn/json-schemas/general-jwk.json/properties/alg/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var L=h===a}else var L=!0;if(L){if(t.kid!==void 0){let h=a;if(typeof t.kid!="string")return an.errors=[{instancePath:e+"/kid",schemaPath:"https://identity.foundation/dwn/json-schemas/general-jwk.json/properties/kid/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var L=h===a}else var L=!0;if(L){if(t.kty!==void 0){let h=t.kty,b=a;if(!(h==="EC"||h==="RSA"||h==="oct"||h==="OKP"))return an.errors=[{instancePath:e+"/kty",schemaPath:"https://identity.foundation/dwn/json-schemas/general-jwk.json/properties/kty/enum",keyword:"enum",params:{allowedValues:lz.properties.kty.enum},message:"must be equal to one of the allowed values"}],!1;var L=b===a}else var L=!0;if(L){if(t.crv!==void 0){let h=a;if(typeof t.crv!="string")return an.errors=[{instancePath:e+"/crv",schemaPath:"https://identity.foundation/dwn/json-schemas/general-jwk.json/properties/crv/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var L=h===a}else var L=!0;if(L){if(t.use!==void 0){let h=a;if(typeof t.use!="string")return an.errors=[{instancePath:e+"/use",schemaPath:"https://identity.foundation/dwn/json-schemas/general-jwk.json/properties/use/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var L=h===a}else var L=!0;if(L){if(t.key_ops!==void 0){let h=a;if(typeof t.key_ops!="string")return an.errors=[{instancePath:e+"/key_ops",schemaPath:"https://identity.foundation/dwn/json-schemas/general-jwk.json/properties/key_ops/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var L=h===a}else var L=!0;if(L){if(t.x5u!==void 0){let h=a;if(typeof t.x5u!="string")return an.errors=[{instancePath:e+"/x5u",schemaPath:"https://identity.foundation/dwn/json-schemas/general-jwk.json/properties/x5u/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var L=h===a}else var L=!0;if(L){if(t.x5c!==void 0){let h=a;if(typeof t.x5c!="string")return an.errors=[{instancePath:e+"/x5c",schemaPath:"https://identity.foundation/dwn/json-schemas/general-jwk.json/properties/x5c/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var L=h===a}else var L=!0;if(L){if(t.x5t!==void 0){let h=a;if(typeof t.x5t!="string")return an.errors=[{instancePath:e+"/x5t",schemaPath:"https://identity.foundation/dwn/json-schemas/general-jwk.json/properties/x5t/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var L=h===a}else var L=!0;if(L)if(t["x5t#S256"]!==void 0){let h=a;if(typeof t["x5t#S256"]!="string")return an.errors=[{instancePath:e+"/x5t#S256",schemaPath:"https://identity.foundation/dwn/json-schemas/general-jwk.json/properties/x5t%23S256/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var L=h===a}else var L=!0}}}}}}}}}else return an.errors=[{instancePath:e,schemaPath:"https://identity.foundation/dwn/json-schemas/general-jwk.json/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;var U=m===a;if(U){let l=a,h=a,b=a,_=!1,g=a,f=a,v=!1,O=a;if(t&&typeof t=="object"&&!Array.isArray(t)){let Ne;if(t.d===void 0&&(Ne="d")){let ie={};s===null?s=[ie]:s.push(ie),a++}}var F=O===a;if(v=v||F,v)a=f,s!==null&&(f?s.length=f:s=null);else{let Ne={};s===null?s=[Ne]:s.push(Ne),a++}if(a===g)if(t&&typeof t=="object"&&!Array.isArray(t)){if(t.kty!==void 0&&t.kty!=="EC"){let Ne={};s===null?s=[Ne]:s.push(Ne),a++}}else{let Ne={};s===null?s=[Ne]:s.push(Ne),a++}var u=g===a;if(_=_||u,u){var N={};N.kty=!0}let T=a,R=a,z=!1,V=a;if(t&&typeof t=="object"&&!Array.isArray(t)){let Ne;if(t.d===void 0&&(Ne="d")){let ie={};s===null?s=[ie]:s.push(ie),a++}}var G=V===a;if(z=z||G,z)a=R,s!==null&&(R?s.length=R:s=null);else{let Ne={};s===null?s=[Ne]:s.push(Ne),a++}if(a===T)if(t&&typeof t=="object"&&!Array.isArray(t)){if(t.kty!==void 0&&t.kty!=="OKP"){let Ne={};s===null?s=[Ne]:s.push(Ne),a++}}else{let Ne={};s===null?s=[Ne]:s.push(Ne),a++}var u=T===a;_=_||u,u&&N!==!0&&(N=N||{},N.kty=!0);let W=a,Z=a,J=!1,X=a;if(t&&typeof t=="object"&&!Array.isArray(t)){let Ne;if(t.d===void 0&&(Ne="d")){let ie={};s===null?s=[ie]:s.push(ie),a++}}var x=X===a;J=J||x;let Ee=a;if(t&&typeof t=="object"&&!Array.isArray(t)){let Ne;if(t.p===void 0&&(Ne="p")){let ie={};s===null?s=[ie]:s.push(ie),a++}}var x=Ee===a;J=J||x;let re=a;if(t&&typeof t=="object"&&!Array.isArray(t)){let Ne;if(t.q===void 0&&(Ne="q")){let ie={};s===null?s=[ie]:s.push(ie),a++}}var x=re===a;J=J||x;let ne=a;if(t&&typeof t=="object"&&!Array.isArray(t)){let Ne;if(t.dp===void 0&&(Ne="dp")){let ie={};s===null?s=[ie]:s.push(ie),a++}}var x=ne===a;J=J||x;let qe=a;if(t&&typeof t=="object"&&!Array.isArray(t)){let Ne;if(t.dq===void 0&&(Ne="dq")){let ie={};s===null?s=[ie]:s.push(ie),a++}}var x=qe===a;J=J||x;let ce=a;if(t&&typeof t=="object"&&!Array.isArray(t)){let Ne;if(t.qi===void 0&&(Ne="qi")){let ie={};s===null?s=[ie]:s.push(ie),a++}}var x=ce===a;J=J||x;let ye=a;if(t&&typeof t=="object"&&!Array.isArray(t)){let Ne;if(t.oth===void 0&&(Ne="oth")){let ie={};s===null?s=[ie]:s.push(ie),a++}}var x=ye===a;if(J=J||x,J)a=Z,s!==null&&(Z?s.length=Z:s=null);else{let Ne={};s===null?s=[Ne]:s.push(Ne),a++}if(a===W)if(t&&typeof t=="object"&&!Array.isArray(t)){if(t.kty!==void 0){let Ne=a;if(t.kty!=="RSA"){let ie={};s===null?s=[ie]:s.push(ie),a++}var c=Ne===a}else var c=!0;if(c)if(t.oth!==void 0){let Ne=t.oth,ie=a;if(!(Ne&&typeof Ne=="object"&&!Array.isArray(Ne))){let ze={};s===null?s=[ze]:s.push(ze),a++}var c=ie===a}else var c=!0}else{let Ne={};s===null?s=[Ne]:s.push(Ne),a++}var u=W===a;if(_=_||u,u&&N!==!0&&(N=N||{},N.kty=!0,N.d=!0,N.p=!0,N.q=!0,N.dp=!0,N.dq=!0,N.qi=!0,N.oth=!0),_)a=b,s!==null&&(b?s.length=b:s=null);else{let Ne={};s===null?s=[Ne]:s.push(Ne),a++}var y=h===a;if(y)return an.errors=[{instancePath:e,schemaPath:"#/not",keyword:"not",params:{},message:"must NOT be valid"}],!1;a=l,s!==null&&(l?s.length=l:s=null)}return an.errors=s,d.props=A,a===0}an.evaluated={dynamicProps:!0,dynamicItems:!1};var eR=Object.prototype.hasOwnProperty;function Xe(t,{instancePath:e="",parentData:r,parentDataProperty:n,rootData:i=t,dynamicAnchors:o={}}={}){let s=null,a=0,d=Xe.evaluated;d.dynamicProps&&(d.props=void 0),d.dynamicItems&&(d.items=void 0);let m=a,p=!1,w=a;if(t&&typeof t=="object"&&!Array.isArray(t)){let T;if(t.contextId===void 0&&(T="contextId")){let R={instancePath:e,schemaPath:"#/anyOf/0/required",keyword:"required",params:{missingProperty:T},message:"must have required property '"+T+"'"};s===null?s=[R]:s.push(R),a++}else if(t.descriptor!==void 0){let R=t.descriptor;if(a===a)if(R&&typeof R=="object"&&!Array.isArray(R)){let V;if(R.protocol===void 0&&(V="protocol")||R.protocolPath===void 0&&(V="protocolPath")){let W={instancePath:e+"/descriptor",schemaPath:"#/anyOf/0/properties/descriptor/required",keyword:"required",params:{missingProperty:V},message:"must have required property '"+V+"'"};s===null?s=[W]:s.push(W),a++}}else{let V={instancePath:e+"/descriptor",schemaPath:"#/anyOf/0/properties/descriptor/type",keyword:"type",params:{type:"object"},message:"must be object"};s===null?s=[V]:s.push(V),a++}}}var L=w===a;if(p=p||L,L){var P={};P.descriptor=!0}let S=a,M=a,A=a,B=a;if(t&&typeof t=="object"&&!Array.isArray(t)){let T;if(t.contextId===void 0&&(T="contextId")){let R={};s===null?s=[R]:s.push(R),a++}}var I=B===a;if(I){let T={instancePath:e,schemaPath:"#/anyOf/1/allOf/0/not",keyword:"not",params:{},message:"must NOT be valid"};s===null?s=[T]:s.push(T),a++}else a=A,s!==null&&(A?s.length=A:s=null);var C=M===a;if(C){let T=a;if(t&&typeof t=="object"&&!Array.isArray(t)&&t.descriptor!==void 0){let z=t.descriptor;if(!(z&&typeof z=="object"&&!Array.isArray(z))){let Z={instancePath:e+"/descriptor",schemaPath:"#/anyOf/1/allOf/1/properties/descriptor/type",keyword:"type",params:{type:"object"},message:"must be object"};s===null?s=[Z]:s.push(Z),a++}let V=a,W=a;if(z&&typeof z=="object"&&!Array.isArray(z)){let Z;if(z.protocol===void 0&&(Z="protocol")){let J={};s===null?s=[J]:s.push(J),a++}}var k=W===a;if(k){let Z={instancePath:e+"/descriptor",schemaPath:"#/anyOf/1/allOf/1/properties/descriptor/not",keyword:"not",params:{},message:"must NOT be valid"};s===null?s=[Z]:s.push(Z),a++}else a=V,s!==null&&(V?s.length=V:s=null)}var C=T===a;if(C){let z=a;if(t&&typeof t=="object"&&!Array.isArray(t)&&t.descriptor!==void 0){let W=t.descriptor;if(!(W&&typeof W=="object"&&!Array.isArray(W))){let X={instancePath:e+"/descriptor",schemaPath:"#/anyOf/1/allOf/2/properties/descriptor/type",keyword:"type",params:{type:"object"},message:"must be object"};s===null?s=[X]:s.push(X),a++}let Z=a,J=a;if(W&&typeof W=="object"&&!Array.isArray(W)){let X;if(W.protocolPath===void 0&&(X="protocolPath")){let Ee={};s===null?s=[Ee]:s.push(Ee),a++}}var q=J===a;if(q){let X={instancePath:e+"/descriptor",schemaPath:"#/anyOf/1/allOf/2/properties/descriptor/not",keyword:"not",params:{},message:"must NOT be valid"};s===null?s=[X]:s.push(X),a++}else a=Z,s!==null&&(Z?s.length=Z:s=null)}var C=z===a}}var L=S===a;if(p=p||L,L&&P!==!0&&(P=P||{},P.descriptor=!0),p)a=m,s!==null&&(m?s.length=m:s=null);else{let T={instancePath:e,schemaPath:"#/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf"};return s===null?s=[T]:s.push(T),a++,Xe.errors=s,!1}if(a===0)if(t&&typeof t=="object"&&!Array.isArray(t)){let T;if(t.descriptor===void 0&&(T="descriptor"))return Xe.errors=[{instancePath:e,schemaPath:"#/required",keyword:"required",params:{missingProperty:T},message:"must have required property '"+T+"'"}],!1;if(P!==!0&&(P=P||{},P.recordId=!0,P.contextId=!0,P.attestation=!0,P.authorization=!0,P.encryption=!0,P.descriptor=!0),t.recordId!==void 0){let R=a;if(typeof t.recordId!="string")return Xe.errors=[{instancePath:e+"/recordId",schemaPath:"#/properties/recordId/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var U=R===a}else var U=!0;if(U){if(t.contextId!==void 0){let R=t.contextId,z=a;if(a===z)if(typeof R=="string"){if(!Vwe.test(R))return Xe.errors=[{instancePath:e+"/contextId",schemaPath:"#/properties/contextId/pattern",keyword:"pattern",params:{pattern:"^[a-zA-Z0-9]+(/[a-zA-Z0-9]+)*$"},message:'must match pattern "^[a-zA-Z0-9]+(/[a-zA-Z0-9]+)*$"'}],!1}else return Xe.errors=[{instancePath:e+"/contextId",schemaPath:"#/properties/contextId/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var U=z===a}else var U=!0;if(U){if(t.attestation!==void 0){let R=a;cn(t.attestation,{instancePath:e+"/attestation",parentData:t,parentDataProperty:"attestation",rootData:i,dynamicAnchors:o})||(s=s===null?cn.errors:s.concat(cn.errors),a=s.length);var U=R===a}else var U=!0;if(U){if(t.authorization!==void 0){let R=a;Iu(t.authorization,{instancePath:e+"/authorization",parentData:t,parentDataProperty:"authorization",rootData:i,dynamicAnchors:o})||(s=s===null?Iu.errors:s.concat(Iu.errors),a=s.length);var U=R===a}else var U=!0;if(U){if(t.encryption!==void 0){let R=t.encryption,z=a;if(a===z)if(R&&typeof R=="object"&&!Array.isArray(R)){let W;if(R.algorithm===void 0&&(W="algorithm")||R.initializationVector===void 0&&(W="initializationVector")||R.keyEncryption===void 0&&(W="keyEncryption"))return Xe.errors=[{instancePath:e+"/encryption",schemaPath:"#/properties/encryption/required",keyword:"required",params:{missingProperty:W},message:"must have required property '"+W+"'"}],!1;{let Z=a;for(let J in R)if(!(J==="algorithm"||J==="initializationVector"||J==="keyEncryption")){return Xe.errors=[{instancePath:e+"/encryption",schemaPath:"#/properties/encryption/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:J},message:"must NOT have additional properties"}],!1;break}if(Z===a){if(R.algorithm!==void 0){let J=R.algorithm,X=a;if(typeof J!="string")return Xe.errors=[{instancePath:e+"/encryption/algorithm",schemaPath:"#/properties/encryption/properties/algorithm/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;if(J!=="A256CTR")return Xe.errors=[{instancePath:e+"/encryption/algorithm",schemaPath:"#/properties/encryption/properties/algorithm/enum",keyword:"enum",params:{allowedValues:Kh.properties.encryption.properties.algorithm.enum},message:"must be equal to one of the allowed values"}],!1;var F=X===a}else var F=!0;if(F){if(R.initializationVector!==void 0){let J=R.initializationVector,X=a;if(a===a)if(typeof J=="string"){if(!z0.test(J))return Xe.errors=[{instancePath:e+"/encryption/initializationVector",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/$defs/base64url/pattern",keyword:"pattern",params:{pattern:"^[A-Za-z0-9_-]+$"},message:'must match pattern "^[A-Za-z0-9_-]+$"'}],!1}else return Xe.errors=[{instancePath:e+"/encryption/initializationVector",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/$defs/base64url/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var F=X===a}else var F=!0;if(F)if(R.keyEncryption!==void 0){let J=R.keyEncryption,X=a;if(a===X)if(Array.isArray(J)){if(J.length<1)return Xe.errors=[{instancePath:e+"/encryption/keyEncryption",schemaPath:"#/properties/encryption/properties/keyEncryption/minItems",keyword:"minItems",params:{limit:1},message:"must NOT have fewer than 1 items"}],!1;{var N=!0;let re=J.length;for(let ne=0;ne<re;ne++){let qe=J[ne],ce=a;if(a===ce)if(qe&&typeof qe=="object"&&!Array.isArray(qe)){let Ne;if(qe.rootKeyId===void 0&&(Ne="rootKeyId")||qe.derivationScheme===void 0&&(Ne="derivationScheme")||qe.algorithm===void 0&&(Ne="algorithm")||qe.encryptedKey===void 0&&(Ne="encryptedKey")||qe.initializationVector===void 0&&(Ne="initializationVector")||qe.ephemeralPublicKey===void 0&&(Ne="ephemeralPublicKey")||qe.messageAuthenticationCode===void 0&&(Ne="messageAuthenticationCode"))return Xe.errors=[{instancePath:e+"/encryption/keyEncryption/"+ne,schemaPath:"#/properties/encryption/properties/keyEncryption/items/required",keyword:"required",params:{missingProperty:Ne},message:"must have required property '"+Ne+"'"}],!1;{let ie=a;for(let oe in qe)if(!(oe==="rootKeyId"||oe==="derivationScheme"||oe==="derivedPublicKey"||oe==="algorithm"||oe==="encryptedKey"||oe==="initializationVector"||oe==="ephemeralPublicKey"||oe==="messageAuthenticationCode")){return Xe.errors=[{instancePath:e+"/encryption/keyEncryption/"+ne,schemaPath:"#/properties/encryption/properties/keyEncryption/items/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:oe},message:"must NOT have additional properties"}],!1;break}if(ie===a){if(qe.rootKeyId!==void 0){let oe=a;if(typeof qe.rootKeyId!="string")return Xe.errors=[{instancePath:e+"/encryption/keyEncryption/"+ne+"/rootKeyId",schemaPath:"#/properties/encryption/properties/keyEncryption/items/properties/rootKeyId/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var G=oe===a}else var G=!0;if(G){if(qe.derivationScheme!==void 0){let oe=qe.derivationScheme,ze=a;if(typeof oe!="string")return Xe.errors=[{instancePath:e+"/encryption/keyEncryption/"+ne+"/derivationScheme",schemaPath:"#/properties/encryption/properties/keyEncryption/items/properties/derivationScheme/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;if(!(oe==="dataFormats"||oe==="protocolContext"||oe==="protocolPath"||oe==="schemas"))return Xe.errors=[{instancePath:e+"/encryption/keyEncryption/"+ne+"/derivationScheme",schemaPath:"#/properties/encryption/properties/keyEncryption/items/properties/derivationScheme/enum",keyword:"enum",params:{allowedValues:Kh.properties.encryption.properties.keyEncryption.items.properties.derivationScheme.enum},message:"must be equal to one of the allowed values"}],!1;var G=ze===a}else var G=!0;if(G){if(qe.derivedPublicKey!==void 0){let oe=a;an(qe.derivedPublicKey,{instancePath:e+"/encryption/keyEncryption/"+ne+"/derivedPublicKey",parentData:qe,parentDataProperty:"derivedPublicKey",rootData:i,dynamicAnchors:o})||(s=s===null?an.errors:s.concat(an.errors),a=s.length);var G=oe===a}else var G=!0;if(G){if(qe.algorithm!==void 0){let oe=qe.algorithm,ze=a;if(typeof oe!="string")return Xe.errors=[{instancePath:e+"/encryption/keyEncryption/"+ne+"/algorithm",schemaPath:"#/properties/encryption/properties/keyEncryption/items/properties/algorithm/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;if(oe!=="ECIES-ES256K")return Xe.errors=[{instancePath:e+"/encryption/keyEncryption/"+ne+"/algorithm",schemaPath:"#/properties/encryption/properties/keyEncryption/items/properties/algorithm/enum",keyword:"enum",params:{allowedValues:Kh.properties.encryption.properties.keyEncryption.items.properties.algorithm.enum},message:"must be equal to one of the allowed values"}],!1;var G=ze===a}else var G=!0;if(G){if(qe.encryptedKey!==void 0){let oe=qe.encryptedKey,ze=a;if(a===a)if(typeof oe=="string"){if(!z0.test(oe))return Xe.errors=[{instancePath:e+"/encryption/keyEncryption/"+ne+"/encryptedKey",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/$defs/base64url/pattern",keyword:"pattern",params:{pattern:"^[A-Za-z0-9_-]+$"},message:'must match pattern "^[A-Za-z0-9_-]+$"'}],!1}else return Xe.errors=[{instancePath:e+"/encryption/keyEncryption/"+ne+"/encryptedKey",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/$defs/base64url/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var G=ze===a}else var G=!0;if(G){if(qe.initializationVector!==void 0){let oe=qe.initializationVector,ze=a;if(a===a)if(typeof oe=="string"){if(!z0.test(oe))return Xe.errors=[{instancePath:e+"/encryption/keyEncryption/"+ne+"/initializationVector",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/$defs/base64url/pattern",keyword:"pattern",params:{pattern:"^[A-Za-z0-9_-]+$"},message:'must match pattern "^[A-Za-z0-9_-]+$"'}],!1}else return Xe.errors=[{instancePath:e+"/encryption/keyEncryption/"+ne+"/initializationVector",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/$defs/base64url/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var G=ze===a}else var G=!0;if(G){if(qe.ephemeralPublicKey!==void 0){let oe=a;an(qe.ephemeralPublicKey,{instancePath:e+"/encryption/keyEncryption/"+ne+"/ephemeralPublicKey",parentData:qe,parentDataProperty:"ephemeralPublicKey",rootData:i,dynamicAnchors:o})||(s=s===null?an.errors:s.concat(an.errors),a=s.length);var G=oe===a}else var G=!0;if(G)if(qe.messageAuthenticationCode!==void 0){let oe=qe.messageAuthenticationCode,ze=a;if(a===a)if(typeof oe=="string"){if(!z0.test(oe))return Xe.errors=[{instancePath:e+"/encryption/keyEncryption/"+ne+"/messageAuthenticationCode",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/$defs/base64url/pattern",keyword:"pattern",params:{pattern:"^[A-Za-z0-9_-]+$"},message:'must match pattern "^[A-Za-z0-9_-]+$"'}],!1}else return Xe.errors=[{instancePath:e+"/encryption/keyEncryption/"+ne+"/messageAuthenticationCode",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/$defs/base64url/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var G=ze===a}else var G=!0}}}}}}}}}else return Xe.errors=[{instancePath:e+"/encryption/keyEncryption/"+ne,schemaPath:"#/properties/encryption/properties/keyEncryption/items/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;var N=ce===a;if(!N)break}}}else return Xe.errors=[{instancePath:e+"/encryption/keyEncryption",schemaPath:"#/properties/encryption/properties/keyEncryption/type",keyword:"type",params:{type:"array"},message:"must be array"}],!1;var F=X===a}else var F=!0}}}}else return Xe.errors=[{instancePath:e+"/encryption",schemaPath:"#/properties/encryption/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;var U=z===a}else var U=!0;if(U)if(t.descriptor!==void 0){let R=t.descriptor,z=a,V=a,W=!1,Z=a;if(R&&typeof R=="object"&&!Array.isArray(R)){let Ne;if(R.published===void 0&&(Ne="published")||R.datePublished===void 0&&(Ne="datePublished")){let ie={instancePath:e+"/descriptor",schemaPath:"#/properties/descriptor/allOf/0/anyOf/0/required",keyword:"required",params:{missingProperty:Ne},message:"must have required property '"+Ne+"'"};s===null?s=[ie]:s.push(ie),a++}else if(R.published!==void 0){let ie=R.published;if(typeof ie!="boolean"){let oe={instancePath:e+"/descriptor/published",schemaPath:"#/properties/descriptor/allOf/0/anyOf/0/properties/published/type",keyword:"type",params:{type:"boolean"},message:"must be boolean"};s===null?s=[oe]:s.push(oe),a++}if(ie!==!0){let oe={instancePath:e+"/descriptor/published",schemaPath:"#/properties/descriptor/allOf/0/anyOf/0/properties/published/enum",keyword:"enum",params:{allowedValues:Kh.properties.descriptor.allOf[0].anyOf[0].properties.published.enum},message:"must be equal to one of the allowed values"};s===null?s=[oe]:s.push(oe),a++}}}var h=Z===a;if(W=W||h,h){var x={};x.published=!0}let J=a,X=a,Ee=a;if(R&&typeof R=="object"&&!Array.isArray(R)){let Ne;if(R.datePublished===void 0&&(Ne="datePublished")){let ie={};s===null?s=[ie]:s.push(ie),a++}}var c=Ee===a;if(c){let Ne={instancePath:e+"/descriptor",schemaPath:"#/properties/descriptor/allOf/0/anyOf/1/not",keyword:"not",params:{},message:"must NOT be valid"};s===null?s=[Ne]:s.push(Ne),a++}else a=X,s!==null&&(X?s.length=X:s=null);if(a===J&&R&&typeof R=="object"&&!Array.isArray(R)&&R.published!==void 0){let Ne=R.published;if(typeof Ne!="boolean"){let ie={instancePath:e+"/descriptor/published",schemaPath:"#/properties/descriptor/allOf/0/anyOf/1/properties/published/type",keyword:"type",params:{type:"boolean"},message:"must be boolean"};s===null?s=[ie]:s.push(ie),a++}if(Ne!==!1){let ie={instancePath:e+"/descriptor/published",schemaPath:"#/properties/descriptor/allOf/0/anyOf/1/properties/published/enum",keyword:"enum",params:{allowedValues:Kh.properties.descriptor.allOf[0].anyOf[1].properties.published.enum},message:"must be equal to one of the allowed values"};s===null?s=[ie]:s.push(ie),a++}}var h=J===a;W=W||h,h&&x!==!0&&(x=x||{},x.published=!0);let re=a,ne=a,qe=a,ce=a;if(R&&typeof R=="object"&&!Array.isArray(R)){let Ne;if(R.published===void 0&&(Ne="published")){let ie={};s===null?s=[ie]:s.push(ie),a++}}var u=ce===a;if(u){let Ne={instancePath:e+"/descriptor",schemaPath:"#/properties/descriptor/allOf/0/anyOf/2/allOf/0/not",keyword:"not",params:{},message:"must NOT be valid"};s===null?s=[Ne]:s.push(Ne),a++}else a=qe,s!==null&&(qe?s.length=qe:s=null);var y=ne===a;if(y){let Ne=a,ie=a,oe=a;if(R&&typeof R=="object"&&!Array.isArray(R)){let le;if(R.datePublished===void 0&&(le="datePublished")){let me={};s===null?s=[me]:s.push(me),a++}}var l=oe===a;if(l){let le={instancePath:e+"/descriptor",schemaPath:"#/properties/descriptor/allOf/0/anyOf/2/allOf/1/not",keyword:"not",params:{},message:"must NOT be valid"};s===null?s=[le]:s.push(le),a++}else a=ie,s!==null&&(ie?s.length=ie:s=null);var y=Ne===a}var h=re===a;if(W=W||h,W)a=V,s!==null&&(V?s.length=V:s=null);else{let Ne={instancePath:e+"/descriptor",schemaPath:"#/properties/descriptor/allOf/0/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf"};return s===null?s=[Ne]:s.push(Ne),a++,Xe.errors=s,!1}if(a===z)if(R&&typeof R=="object"&&!Array.isArray(R)){let Ne;if(R.interface===void 0&&(Ne="interface")||R.method===void 0&&(Ne="method")||R.dataCid===void 0&&(Ne="dataCid")||R.dataSize===void 0&&(Ne="dataSize")||R.dateCreated===void 0&&(Ne="dateCreated")||R.messageTimestamp===void 0&&(Ne="messageTimestamp")||R.dataFormat===void 0&&(Ne="dataFormat"))return Xe.errors=[{instancePath:e+"/descriptor",schemaPath:"#/properties/descriptor/required",keyword:"required",params:{missingProperty:Ne},message:"must have required property '"+Ne+"'"}],!1;{let ie=a;for(let oe in R)if(!eR.call(Kh.properties.descriptor.properties,oe)){return Xe.errors=[{instancePath:e+"/descriptor",schemaPath:"#/properties/descriptor/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:oe},message:"must NOT have additional properties"}],!1;break}if(ie===a){let oe;if(R.parentId!==void 0&&R.protocol===void 0&&(oe="protocol"))return Xe.errors=[{instancePath:e+"/descriptor",schemaPath:"#/properties/descriptor/dependencies",keyword:"dependencies",params:{property:"parentId",missingProperty:oe,depsCount:1,deps:"protocol"},message:"must have property protocol when property parentId is present"}],!1;if(R.interface!==void 0){let ze=R.interface,le=a;if(typeof ze!="string")return Xe.errors=[{instancePath:e+"/descriptor/interface",schemaPath:"#/properties/descriptor/properties/interface/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;if(ze!=="Records")return Xe.errors=[{instancePath:e+"/descriptor/interface",schemaPath:"#/properties/descriptor/properties/interface/enum",keyword:"enum",params:{allowedValues:Kh.properties.descriptor.properties.interface.enum},message:"must be equal to one of the allowed values"}],!1;var b=le===a}else var b=!0;if(b){if(R.method!==void 0){let ze=R.method,le=a;if(typeof ze!="string")return Xe.errors=[{instancePath:e+"/descriptor/method",schemaPath:"#/properties/descriptor/properties/method/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;if(ze!=="Write")return Xe.errors=[{instancePath:e+"/descriptor/method",schemaPath:"#/properties/descriptor/properties/method/enum",keyword:"enum",params:{allowedValues:Kh.properties.descriptor.properties.method.enum},message:"must be equal to one of the allowed values"}],!1;var b=le===a}else var b=!0;if(b){if(R.recipient!==void 0){let ze=R.recipient,le=a;if(a===a)if(typeof ze=="string"){if(!K0.test(ze))return Xe.errors=[{instancePath:e+"/descriptor/recipient",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/$defs/did/pattern",keyword:"pattern",params:{pattern:"^did:([a-z0-9]+):((?:(?:[a-zA-Z0-9._-]|(?:%[0-9a-fA-F]{2}))*:)*((?:[a-zA-Z0-9._-]|(?:%[0-9a-fA-F]{2}))+))((;[a-zA-Z0-9_.:%-]+=[a-zA-Z0-9_.:%-]*)*)(/[^#?]*)?([?][^#]*)?(#.*)?$"},message:'must match pattern "^did:([a-z0-9]+):((?:(?:[a-zA-Z0-9._-]|(?:%[0-9a-fA-F]{2}))*:)*((?:[a-zA-Z0-9._-]|(?:%[0-9a-fA-F]{2}))+))((;[a-zA-Z0-9_.:%-]+=[a-zA-Z0-9_.:%-]*)*)(/[^#?]*)?([?][^#]*)?(#.*)?$"'}],!1}else return Xe.errors=[{instancePath:e+"/descriptor/recipient",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/$defs/did/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var b=le===a}else var b=!0;if(b){if(R.protocol!==void 0){let ze=a;if(typeof R.protocol!="string")return Xe.errors=[{instancePath:e+"/descriptor/protocol",schemaPath:"#/properties/descriptor/properties/protocol/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var b=ze===a}else var b=!0;if(b){if(R.protocolPath!==void 0){let ze=R.protocolPath,le=a;if(a===le)if(typeof ze=="string"){if(!Hwe.test(ze))return Xe.errors=[{instancePath:e+"/descriptor/protocolPath",schemaPath:"#/properties/descriptor/properties/protocolPath/pattern",keyword:"pattern",params:{pattern:"^[a-zA-Z]+(/[a-zA-Z]+)*$"},message:'must match pattern "^[a-zA-Z]+(/[a-zA-Z]+)*$"'}],!1}else return Xe.errors=[{instancePath:e+"/descriptor/protocolPath",schemaPath:"#/properties/descriptor/properties/protocolPath/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var b=le===a}else var b=!0;if(b){if(R.schema!==void 0){let ze=a;if(typeof R.schema!="string")return Xe.errors=[{instancePath:e+"/descriptor/schema",schemaPath:"#/properties/descriptor/properties/schema/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var b=ze===a}else var b=!0;if(b){if(R.tags!==void 0){let ze=R.tags,le=a;if(a===le)if(ze&&typeof ze=="object"&&!Array.isArray(ze)){if(Object.keys(ze).length>10)return Xe.errors=[{instancePath:e+"/descriptor/tags",schemaPath:"#/properties/descriptor/properties/tags/maxProperties",keyword:"maxProperties",params:{limit:10},message:"must NOT have more than 10 properties"}],!1;if(Object.keys(ze).length<1)return Xe.errors=[{instancePath:e+"/descriptor/tags",schemaPath:"#/properties/descriptor/properties/tags/minProperties",keyword:"minProperties",params:{limit:1},message:"must NOT have fewer than 1 properties"}],!1;for(let ot in ze){let ue=ze[ot],he=a,lt=a,se=!1,fe=null,Lt=a;if(typeof ue!="string"){let ve={instancePath:e+"/descriptor/tags/"+ot.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/properties/descriptor/properties/tags/additionalProperties/oneOf/0/type",keyword:"type",params:{type:"string"},message:"must be string"};s===null?s=[ve]:s.push(ve),a++}var _=Lt===a;_&&(se=!0,fe=0);let ge=a;if(!(typeof ue=="number"&&isFinite(ue))){let ve={instancePath:e+"/descriptor/tags/"+ot.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/properties/descriptor/properties/tags/additionalProperties/oneOf/1/type",keyword:"type",params:{type:"number"},message:"must be number"};s===null?s=[ve]:s.push(ve),a++}var _=ge===a;if(_&&se)se=!1,fe=[fe,1];else{_&&(se=!0,fe=1);let ve=a;if(typeof ue!="boolean"){let xe={instancePath:e+"/descriptor/tags/"+ot.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/properties/descriptor/properties/tags/additionalProperties/oneOf/2/type",keyword:"type",params:{type:"boolean"},message:"must be boolean"};s===null?s=[xe]:s.push(xe),a++}var _=ve===a;if(_&&se)se=!1,fe=[fe,2];else{_&&(se=!0,fe=2);let xe=a;if(a===xe)if(Array.isArray(ue))if(ue.length>10){let jr={instancePath:e+"/descriptor/tags/"+ot.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/properties/descriptor/properties/tags/additionalProperties/oneOf/3/maxItems",keyword:"maxItems",params:{limit:10},message:"must NOT have more than 10 items"};s===null?s=[jr]:s.push(jr),a++}else if(ue.length<1){let jr={instancePath:e+"/descriptor/tags/"+ot.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/properties/descriptor/properties/tags/additionalProperties/oneOf/3/minItems",keyword:"minItems",params:{limit:1},message:"must NOT have fewer than 1 items"};s===null?s=[jr]:s.push(jr),a++}else{var g=!0;let jr=ue.length;for(let Se=0;Se<jr;Se++){let _e=a;if(typeof ue[Se]!="string"){let Me={instancePath:e+"/descriptor/tags/"+ot.replace(/~/g,"~0").replace(/\//g,"~1")+"/"+Se,schemaPath:"#/properties/descriptor/properties/tags/additionalProperties/oneOf/3/items/type",keyword:"type",params:{type:"string"},message:"must be string"};s===null?s=[Me]:s.push(Me),a++}var g=_e===a;if(!g)break}}else{let jr={instancePath:e+"/descriptor/tags/"+ot.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/properties/descriptor/properties/tags/additionalProperties/oneOf/3/type",keyword:"type",params:{type:"array"},message:"must be array"};s===null?s=[jr]:s.push(jr),a++}var _=xe===a;if(_&&se)se=!1,fe=[fe,3];else{if(_){se=!0,fe=3;var f=!0}let jr=a;if(a===jr)if(Array.isArray(ue))if(ue.length>10){let _e={instancePath:e+"/descriptor/tags/"+ot.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/properties/descriptor/properties/tags/additionalProperties/oneOf/4/maxItems",keyword:"maxItems",params:{limit:10},message:"must NOT have more than 10 items"};s===null?s=[_e]:s.push(_e),a++}else if(ue.length<1){let _e={instancePath:e+"/descriptor/tags/"+ot.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/properties/descriptor/properties/tags/additionalProperties/oneOf/4/minItems",keyword:"minItems",params:{limit:1},message:"must NOT have fewer than 1 items"};s===null?s=[_e]:s.push(_e),a++}else{var v=!0;let _e=ue.length;for(let Mn=0;Mn<_e;Mn++){let Me=ue[Mn],Te=a;if(!(typeof Me=="number"&&isFinite(Me))){let Ae={instancePath:e+"/descriptor/tags/"+ot.replace(/~/g,"~0").replace(/\//g,"~1")+"/"+Mn,schemaPath:"#/properties/descriptor/properties/tags/additionalProperties/oneOf/4/items/type",keyword:"type",params:{type:"number"},message:"must be number"};s===null?s=[Ae]:s.push(Ae),a++}var v=Te===a;if(!v)break}}else{let _e={instancePath:e+"/descriptor/tags/"+ot.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/properties/descriptor/properties/tags/additionalProperties/oneOf/4/type",keyword:"type",params:{type:"array"},message:"must be array"};s===null?s=[_e]:s.push(_e),a++}var _=jr===a;_&&se?(se=!1,fe=[fe,4]):_&&(se=!0,fe=4,f!==!0&&(f=!0))}}}if(se)a=lt,s!==null&&(lt?s.length=lt:s=null);else{let ve={instancePath:e+"/descriptor/tags/"+ot.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/properties/descriptor/properties/tags/additionalProperties/oneOf",keyword:"oneOf",params:{passingSchemas:fe},message:"must match exactly one schema in oneOf"};return s===null?s=[ve]:s.push(ve),a++,Xe.errors=s,!1}var O=he===a;if(!O)break}}else return Xe.errors=[{instancePath:e+"/descriptor/tags",schemaPath:"#/properties/descriptor/properties/tags/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;var b=le===a}else var b=!0;if(b){if(R.parentId!==void 0){let ze=a;if(typeof R.parentId!="string")return Xe.errors=[{instancePath:e+"/descriptor/parentId",schemaPath:"#/properties/descriptor/properties/parentId/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var b=ze===a}else var b=!0;if(b){if(R.dataCid!==void 0){let ze=a;if(typeof R.dataCid!="string")return Xe.errors=[{instancePath:e+"/descriptor/dataCid",schemaPath:"#/properties/descriptor/properties/dataCid/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var b=ze===a}else var b=!0;if(b){if(R.dataSize!==void 0){let ze=R.dataSize,le=a;if(!(typeof ze=="number"&&isFinite(ze)))return Xe.errors=[{instancePath:e+"/descriptor/dataSize",schemaPath:"#/properties/descriptor/properties/dataSize/type",keyword:"type",params:{type:"number"},message:"must be number"}],!1;var b=le===a}else var b=!0;if(b){if(R.dateCreated!==void 0){let ze=R.dateCreated,le=a;if(a===a)if(typeof ze=="string"){if(!Jn.test(ze))return Xe.errors=[{instancePath:e+"/descriptor/dateCreated",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/$defs/date-time/pattern",keyword:"pattern",params:{pattern:"^\\d{4}-[0-1]\\d-[0-3]\\dT(?:[0-2]\\d:[0-5]\\d:[0-5]\\d|23:59:60)\\.\\d{6}Z$"},message:'must match pattern "^\\d{4}-[0-1]\\d-[0-3]\\dT(?:[0-2]\\d:[0-5]\\d:[0-5]\\d|23:59:60)\\.\\d{6}Z$"'}],!1}else return Xe.errors=[{instancePath:e+"/descriptor/dateCreated",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/$defs/date-time/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var b=le===a}else var b=!0;if(b){if(R.messageTimestamp!==void 0){let ze=R.messageTimestamp,le=a;if(a===a)if(typeof ze=="string"){if(!Jn.test(ze))return Xe.errors=[{instancePath:e+"/descriptor/messageTimestamp",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/$defs/date-time/pattern",keyword:"pattern",params:{pattern:"^\\d{4}-[0-1]\\d-[0-3]\\dT(?:[0-2]\\d:[0-5]\\d:[0-5]\\d|23:59:60)\\.\\d{6}Z$"},message:'must match pattern "^\\d{4}-[0-1]\\d-[0-3]\\dT(?:[0-2]\\d:[0-5]\\d:[0-5]\\d|23:59:60)\\.\\d{6}Z$"'}],!1}else return Xe.errors=[{instancePath:e+"/descriptor/messageTimestamp",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/$defs/date-time/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var b=le===a}else var b=!0;if(b){if(R.published!==void 0){let ze=a;if(typeof R.published!="boolean")return Xe.errors=[{instancePath:e+"/descriptor/published",schemaPath:"#/properties/descriptor/properties/published/type",keyword:"type",params:{type:"boolean"},message:"must be boolean"}],!1;var b=ze===a}else var b=!0;if(b){if(R.datePublished!==void 0){let ze=R.datePublished,le=a;if(a===a)if(typeof ze=="string"){if(!Jn.test(ze))return Xe.errors=[{instancePath:e+"/descriptor/datePublished",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/$defs/date-time/pattern",keyword:"pattern",params:{pattern:"^\\d{4}-[0-1]\\d-[0-3]\\dT(?:[0-2]\\d:[0-5]\\d:[0-5]\\d|23:59:60)\\.\\d{6}Z$"},message:'must match pattern "^\\d{4}-[0-1]\\d-[0-3]\\dT(?:[0-2]\\d:[0-5]\\d:[0-5]\\d|23:59:60)\\.\\d{6}Z$"'}],!1}else return Xe.errors=[{instancePath:e+"/descriptor/datePublished",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/$defs/date-time/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var b=le===a}else var b=!0;if(b)if(R.dataFormat!==void 0){let ze=a;if(typeof R.dataFormat!="string")return Xe.errors=[{instancePath:e+"/descriptor/dataFormat",schemaPath:"#/properties/descriptor/properties/dataFormat/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var b=ze===a}else var b=!0}}}}}}}}}}}}}}}}else return Xe.errors=[{instancePath:e+"/descriptor",schemaPath:"#/properties/descriptor/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;var U=z===a}else var U=!0}}}}}else return Xe.errors=[{instancePath:e,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;return Xe.errors=s,d.props=P,a===0}Xe.evaluated={dynamicProps:!0,dynamicItems:!1};function Sc(t,{instancePath:e="",parentData:r,parentDataProperty:n,rootData:i=t,dynamicAnchors:o={}}={}){let s=null,a=0,d=Sc.evaluated;if(d.dynamicProps&&(d.props=void 0),d.dynamicItems&&(d.items=void 0),!Xe(t,{instancePath:e,parentData:r,parentDataProperty:n,rootData:i,dynamicAnchors:o}))s=s===null?Xe.errors:s.concat(Xe.errors),a=s.length;else var m=Xe.evaluated.props;if(a===0)if(t&&typeof t=="object"&&!Array.isArray(t)){let w;if(t.recordId===void 0&&(w="recordId")||t.authorization===void 0&&(w="authorization")||t.encodedData===void 0&&(w="encodedData"))return Sc.errors=[{instancePath:e,schemaPath:"#/required",keyword:"required",params:{missingProperty:w},message:"must have required property '"+w+"'"}],!1;if(m!==!0&&(m=m||{},m.encodedData=!0),t.encodedData!==void 0){let P=a;if(typeof t.encodedData!="string")return Sc.errors=[{instancePath:e+"/encodedData",schemaPath:"#/properties/encodedData/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var p=P===a}else var p=!0;if(p&&m!==!0){for(let P in t)if(!m||!m[P]){return Sc.errors=[{instancePath:e,schemaPath:"#/unevaluatedProperties",keyword:"unevaluatedProperties",params:{unevaluatedProperty:P},message:"must NOT have unevaluated properties"}],!1;break}}}else return Sc.errors=[{instancePath:e,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;return Sc.errors=s,a===0}Sc.evaluated={props:!0,dynamicProps:!1,dynamicItems:!1};function So(t,{instancePath:e="",parentData:r,parentDataProperty:n,rootData:i=t,dynamicAnchors:o={}}={}){let s=null,a=0,d=So.evaluated;if(d.dynamicProps&&(d.props=void 0),d.dynamicItems&&(d.items=void 0),a===0)if(t&&typeof t=="object"&&!Array.isArray(t)){let p=a;for(let w in t)if(!(w==="signature"||w==="authorDelegatedGrant")){return So.errors=[{instancePath:e,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:w},message:"must NOT have additional properties"}],!1;break}if(p===a){if(t.signature!==void 0){let w=a;cn(t.signature,{instancePath:e+"/signature",parentData:t,parentDataProperty:"signature",rootData:i,dynamicAnchors:o})||(s=s===null?cn.errors:s.concat(cn.errors),a=s.length);var m=w===a}else var m=!0;if(m)if(t.authorDelegatedGrant!==void 0){let w=a;Sc(t.authorDelegatedGrant,{instancePath:e+"/authorDelegatedGrant",parentData:t,parentDataProperty:"authorDelegatedGrant",rootData:i,dynamicAnchors:o})||(s=s===null?Sc.errors:s.concat(Sc.errors),a=s.length);var m=w===a}else var m=!0}}else return So.errors=[{instancePath:e,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;return So.errors=s,a===0}So.evaluated={props:!0,dynamicProps:!1,dynamicItems:!1};var Zwe=Iu,Jwe=Eo,QF={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://identity.foundation/dwn/json-schemas/records-delete.json",type:"object",additionalProperties:!1,required:["authorization","descriptor"],properties:{authorization:{$ref:"https://identity.foundation/dwn/json-schemas/authorization-delegated-grant.json"},descriptor:{type:"object",additionalProperties:!1,required:["interface","method","messageTimestamp","recordId","prune"],properties:{interface:{enum:["Records"],type:"string"},method:{enum:["Delete"],type:"string"},messageTimestamp:{$ref:"https://identity.foundation/dwn/json-schemas/defs.json#/$defs/date-time"},recordId:{type:"string"},prune:{type:"boolean"}}}}};function Eo(t,{instancePath:e="",parentData:r,parentDataProperty:n,rootData:i=t,dynamicAnchors:o={}}={}){let s=null,a=0,d=Eo.evaluated;if(d.dynamicProps&&(d.props=void 0),d.dynamicItems&&(d.items=void 0),a===0)if(t&&typeof t=="object"&&!Array.isArray(t)){let w;if(t.authorization===void 0&&(w="authorization")||t.descriptor===void 0&&(w="descriptor"))return Eo.errors=[{instancePath:e,schemaPath:"#/required",keyword:"required",params:{missingProperty:w},message:"must have required property '"+w+"'"}],!1;{let P=a;for(let S in t)if(!(S==="authorization"||S==="descriptor")){return Eo.errors=[{instancePath:e,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:S},message:"must NOT have additional properties"}],!1;break}if(P===a){if(t.authorization!==void 0){let S=a;So(t.authorization,{instancePath:e+"/authorization",parentData:t,parentDataProperty:"authorization",rootData:i,dynamicAnchors:o})||(s=s===null?So.errors:s.concat(So.errors),a=s.length);var m=S===a}else var m=!0;if(m)if(t.descriptor!==void 0){let S=t.descriptor,M=a;if(a===M)if(S&&typeof S=="object"&&!Array.isArray(S)){let B;if(S.interface===void 0&&(B="interface")||S.method===void 0&&(B="method")||S.messageTimestamp===void 0&&(B="messageTimestamp")||S.recordId===void 0&&(B="recordId")||S.prune===void 0&&(B="prune"))return Eo.errors=[{instancePath:e+"/descriptor",schemaPath:"#/properties/descriptor/required",keyword:"required",params:{missingProperty:B},message:"must have required property '"+B+"'"}],!1;{let I=a;for(let C in S)if(!(C==="interface"||C==="method"||C==="messageTimestamp"||C==="recordId"||C==="prune")){return Eo.errors=[{instancePath:e+"/descriptor",schemaPath:"#/properties/descriptor/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:C},message:"must NOT have additional properties"}],!1;break}if(I===a){if(S.interface!==void 0){let C=S.interface,k=a;if(typeof C!="string")return Eo.errors=[{instancePath:e+"/descriptor/interface",schemaPath:"#/properties/descriptor/properties/interface/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;if(C!=="Records")return Eo.errors=[{instancePath:e+"/descriptor/interface",schemaPath:"#/properties/descriptor/properties/interface/enum",keyword:"enum",params:{allowedValues:QF.properties.descriptor.properties.interface.enum},message:"must be equal to one of the allowed values"}],!1;var p=k===a}else var p=!0;if(p){if(S.method!==void 0){let C=S.method,k=a;if(typeof C!="string")return Eo.errors=[{instancePath:e+"/descriptor/method",schemaPath:"#/properties/descriptor/properties/method/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;if(C!=="Delete")return Eo.errors=[{instancePath:e+"/descriptor/method",schemaPath:"#/properties/descriptor/properties/method/enum",keyword:"enum",params:{allowedValues:QF.properties.descriptor.properties.method.enum},message:"must be equal to one of the allowed values"}],!1;var p=k===a}else var p=!0;if(p){if(S.messageTimestamp!==void 0){let C=S.messageTimestamp,k=a;if(a===a)if(typeof C=="string"){if(!Jn.test(C))return Eo.errors=[{instancePath:e+"/descriptor/messageTimestamp",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/$defs/date-time/pattern",keyword:"pattern",params:{pattern:"^\\d{4}-[0-1]\\d-[0-3]\\dT(?:[0-2]\\d:[0-5]\\d:[0-5]\\d|23:59:60)\\.\\d{6}Z$"},message:'must match pattern "^\\d{4}-[0-1]\\d-[0-3]\\dT(?:[0-2]\\d:[0-5]\\d:[0-5]\\d|23:59:60)\\.\\d{6}Z$"'}],!1}else return Eo.errors=[{instancePath:e+"/descriptor/messageTimestamp",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/$defs/date-time/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var p=k===a}else var p=!0;if(p){if(S.recordId!==void 0){let C=a;if(typeof S.recordId!="string")return Eo.errors=[{instancePath:e+"/descriptor/recordId",schemaPath:"#/properties/descriptor/properties/recordId/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var p=C===a}else var p=!0;if(p)if(S.prune!==void 0){let C=a;if(typeof S.prune!="boolean")return Eo.errors=[{instancePath:e+"/descriptor/prune",schemaPath:"#/properties/descriptor/properties/prune/type",keyword:"type",params:{type:"boolean"},message:"must be boolean"}],!1;var p=C===a}else var p=!0}}}}}}else return Eo.errors=[{instancePath:e+"/descriptor",schemaPath:"#/properties/descriptor/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;var m=M===a}else var m=!0}}}else return Eo.errors=[{instancePath:e,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;return Eo.errors=s,a===0}Eo.evaluated={props:!0,dynamicProps:!1,dynamicItems:!1};var Ywe=yn,QT={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://identity.foundation/dwn/json-schemas/records-query.json",type:"object",additionalProperties:!1,required:["descriptor"],properties:{authorization:{$ref:"https://identity.foundation/dwn/json-schemas/authorization-delegated-grant.json"},descriptor:{type:"object",additionalProperties:!1,required:["interface","method","messageTimestamp","filter"],properties:{interface:{enum:["Records"],type:"string"},method:{enum:["Query"],type:"string"},messageTimestamp:{$ref:"https://identity.foundation/dwn/json-schemas/defs.json#/$defs/date-time"},filter:{$ref:"https://identity.foundation/dwn/json-schemas/records-filter.json"},pagination:{type:"object",additionalProperties:!1,properties:{limit:{type:"number",minimum:1},cursor:{$ref:"https://identity.foundation/dwn/json-schemas/pagination-cursor.json"}}},dateSort:{enum:["createdAscending","createdDescending","publishedAscending","publishedDescending"],type:"string"}}}}},zE={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://identity.foundation/dwn/json-schemas/pagination-cursor.json",type:"object",minProperties:1,additionalProperties:!1,required:["messageCid","value"],properties:{messageCid:{type:"string"},value:{type:["string","number"]}}},XF={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://identity.foundation/dwn/json-schemas/records-filter.json",type:"object",minProperties:1,additionalProperties:!1,properties:{protocol:{type:"string"},protocolPath:{type:"string"},author:{$ref:"https://identity.foundation/dwn/json-schemas/defs.json#/$defs/did"},attester:{$ref:"https://identity.foundation/dwn/json-schemas/defs.json#/$defs/did"},recipient:{$ref:"https://identity.foundation/dwn/json-schemas/defs.json#/$defs/did"},contextId:{type:"string"},schema:{type:"string"},tags:{type:"object",minProperties:1,additionalProperties:{oneOf:[{type:"string"},{type:"number"},{type:"boolean"},{type:"object",minProperties:1,additionalProperties:!1,properties:{startsWith:{type:"string"}}},{$ref:"https://identity.foundation/dwn/json-schemas/string-range-filter.json"},{$ref:"https://identity.foundation/dwn/json-schemas/number-range-filter.json"}]}},recordId:{type:"string"},parentId:{type:"string"},published:{type:"boolean"},dataFormat:{type:"string"},dataSize:{$ref:"https://identity.foundation/dwn/json-schemas/number-range-filter.json"},dataCid:{type:"string"},dateCreated:{type:"object",minProperties:1,additionalProperties:!1,properties:{from:{$ref:"https://identity.foundation/dwn/json-schemas/defs.json#/$defs/date-time"},to:{$ref:"https://identity.foundation/dwn/json-schemas/defs.json#/$defs/date-time"}}},datePublished:{type:"object",minProperties:1,additionalProperties:!1,properties:{from:{$ref:"https://identity.foundation/dwn/json-schemas/defs.json#/$defs/date-time"},to:{$ref:"https://identity.foundation/dwn/json-schemas/defs.json#/$defs/date-time"}}},dateUpdated:{type:"object",minProperties:1,additionalProperties:!1,properties:{from:{$ref:"https://identity.foundation/dwn/json-schemas/defs.json#/$defs/date-time"},to:{$ref:"https://identity.foundation/dwn/json-schemas/defs.json#/$defs/date-time"}}}},dependencies:{datePublished:{oneOf:[{properties:{published:{enum:[!0]}},required:["published"]},{not:{required:["published"]}}]}}};function it(t,{instancePath:e="",parentData:r,parentDataProperty:n,rootData:i=t,dynamicAnchors:o={}}={}){let s=null,a=0,d=it.evaluated;if(d.dynamicProps&&(d.props=void 0),d.dynamicItems&&(d.items=void 0),a===0)if(t&&typeof t=="object"&&!Array.isArray(t)){if(Object.keys(t).length<1)return it.errors=[{instancePath:e,schemaPath:"#/minProperties",keyword:"minProperties",params:{limit:1},message:"must NOT have fewer than 1 properties"}],!1;{let T=a;for(let R in t)if(!eR.call(XF.properties,R)){return it.errors=[{instancePath:e,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:R},message:"must NOT have additional properties"}],!1;break}if(T===a){if(t.datePublished!==void 0){let R=a,z=a,V=!1,W=null,Z=a;if(t&&typeof t=="object"&&!Array.isArray(t)){let re;if(t.published===void 0&&(re="published")){let ne={instancePath:e,schemaPath:"#/dependencies/datePublished/oneOf/0/required",keyword:"required",params:{missingProperty:re},message:"must have required property '"+re+"'"};s===null?s=[ne]:s.push(ne),a++}else if(t.published!==void 0&&t.published!==!0){let ne={instancePath:e+"/published",schemaPath:"#/dependencies/datePublished/oneOf/0/properties/published/enum",keyword:"enum",params:{allowedValues:XF.dependencies.datePublished.oneOf[0].properties.published.enum},message:"must be equal to one of the allowed values"};s===null?s=[ne]:s.push(ne),a++}}var w=Z===a;if(w){V=!0,W=0;var m={};m.published=!0}let J=a,X=a,Ee=a;if(t&&typeof t=="object"&&!Array.isArray(t)){let re;if(t.published===void 0&&(re="published")){let ne={};s===null?s=[ne]:s.push(ne),a++}}var p=Ee===a;if(p){let re={instancePath:e,schemaPath:"#/dependencies/datePublished/oneOf/1/not",keyword:"not",params:{},message:"must NOT be valid"};s===null?s=[re]:s.push(re),a++}else a=X,s!==null&&(X?s.length=X:s=null);var w=J===a;if(w&&V?(V=!1,W=[W,1]):w&&(V=!0,W=1),V)a=z,s!==null&&(z?s.length=z:s=null);else{let re={instancePath:e,schemaPath:"#/dependencies/datePublished/oneOf",keyword:"oneOf",params:{passingSchemas:W},message:"must match exactly one schema in oneOf"};return s===null?s=[re]:s.push(re),a++,it.errors=s,!1}var P=R===a}else var P=!0;if(P){if(t.protocol!==void 0){let R=a;if(typeof t.protocol!="string")return it.errors=[{instancePath:e+"/protocol",schemaPath:"#/properties/protocol/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var S=R===a}else var S=!0;if(S){if(t.protocolPath!==void 0){let R=a;if(typeof t.protocolPath!="string")return it.errors=[{instancePath:e+"/protocolPath",schemaPath:"#/properties/protocolPath/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var S=R===a}else var S=!0;if(S){if(t.author!==void 0){let R=t.author,z=a;if(a===a)if(typeof R=="string"){if(!K0.test(R))return it.errors=[{instancePath:e+"/author",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/$defs/did/pattern",keyword:"pattern",params:{pattern:"^did:([a-z0-9]+):((?:(?:[a-zA-Z0-9._-]|(?:%[0-9a-fA-F]{2}))*:)*((?:[a-zA-Z0-9._-]|(?:%[0-9a-fA-F]{2}))+))((;[a-zA-Z0-9_.:%-]+=[a-zA-Z0-9_.:%-]*)*)(/[^#?]*)?([?][^#]*)?(#.*)?$"},message:'must match pattern "^did:([a-z0-9]+):((?:(?:[a-zA-Z0-9._-]|(?:%[0-9a-fA-F]{2}))*:)*((?:[a-zA-Z0-9._-]|(?:%[0-9a-fA-F]{2}))+))((;[a-zA-Z0-9_.:%-]+=[a-zA-Z0-9_.:%-]*)*)(/[^#?]*)?([?][^#]*)?(#.*)?$"'}],!1}else return it.errors=[{instancePath:e+"/author",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/$defs/did/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var S=z===a}else var S=!0;if(S){if(t.attester!==void 0){let R=t.attester,z=a;if(a===a)if(typeof R=="string"){if(!K0.test(R))return it.errors=[{instancePath:e+"/attester",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/$defs/did/pattern",keyword:"pattern",params:{pattern:"^did:([a-z0-9]+):((?:(?:[a-zA-Z0-9._-]|(?:%[0-9a-fA-F]{2}))*:)*((?:[a-zA-Z0-9._-]|(?:%[0-9a-fA-F]{2}))+))((;[a-zA-Z0-9_.:%-]+=[a-zA-Z0-9_.:%-]*)*)(/[^#?]*)?([?][^#]*)?(#.*)?$"},message:'must match pattern "^did:([a-z0-9]+):((?:(?:[a-zA-Z0-9._-]|(?:%[0-9a-fA-F]{2}))*:)*((?:[a-zA-Z0-9._-]|(?:%[0-9a-fA-F]{2}))+))((;[a-zA-Z0-9_.:%-]+=[a-zA-Z0-9_.:%-]*)*)(/[^#?]*)?([?][^#]*)?(#.*)?$"'}],!1}else return it.errors=[{instancePath:e+"/attester",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/$defs/did/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var S=z===a}else var S=!0;if(S){if(t.recipient!==void 0){let R=t.recipient,z=a;if(a===a)if(typeof R=="string"){if(!K0.test(R))return it.errors=[{instancePath:e+"/recipient",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/$defs/did/pattern",keyword:"pattern",params:{pattern:"^did:([a-z0-9]+):((?:(?:[a-zA-Z0-9._-]|(?:%[0-9a-fA-F]{2}))*:)*((?:[a-zA-Z0-9._-]|(?:%[0-9a-fA-F]{2}))+))((;[a-zA-Z0-9_.:%-]+=[a-zA-Z0-9_.:%-]*)*)(/[^#?]*)?([?][^#]*)?(#.*)?$"},message:'must match pattern "^did:([a-z0-9]+):((?:(?:[a-zA-Z0-9._-]|(?:%[0-9a-fA-F]{2}))*:)*((?:[a-zA-Z0-9._-]|(?:%[0-9a-fA-F]{2}))+))((;[a-zA-Z0-9_.:%-]+=[a-zA-Z0-9_.:%-]*)*)(/[^#?]*)?([?][^#]*)?(#.*)?$"'}],!1}else return it.errors=[{instancePath:e+"/recipient",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/$defs/did/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var S=z===a}else var S=!0;if(S){if(t.contextId!==void 0){let R=a;if(typeof t.contextId!="string")return it.errors=[{instancePath:e+"/contextId",schemaPath:"#/properties/contextId/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var S=R===a}else var S=!0;if(S){if(t.schema!==void 0){let R=a;if(typeof t.schema!="string")return it.errors=[{instancePath:e+"/schema",schemaPath:"#/properties/schema/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var S=R===a}else var S=!0;if(S){if(t.tags!==void 0){let R=t.tags,z=a;if(a===z)if(R&&typeof R=="object"&&!Array.isArray(R)){if(Object.keys(R).length<1)return it.errors=[{instancePath:e+"/tags",schemaPath:"#/properties/tags/minProperties",keyword:"minProperties",params:{limit:1},message:"must NOT have fewer than 1 properties"}],!1;for(let W in R){let Z=R[W],J=a,X=a,Ee=!1,re=null,ne=a;if(typeof Z!="string"){let ce={instancePath:e+"/tags/"+W.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/properties/tags/additionalProperties/oneOf/0/type",keyword:"type",params:{type:"string"},message:"must be string"};s===null?s=[ce]:s.push(ce),a++}var M=ne===a;M&&(Ee=!0,re=0);let qe=a;if(!(typeof Z=="number"&&isFinite(Z))){let ce={instancePath:e+"/tags/"+W.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/properties/tags/additionalProperties/oneOf/1/type",keyword:"type",params:{type:"number"},message:"must be number"};s===null?s=[ce]:s.push(ce),a++}var M=qe===a;if(M&&Ee)Ee=!1,re=[re,1];else{M&&(Ee=!0,re=1);let ce=a;if(typeof Z!="boolean"){let Ne={instancePath:e+"/tags/"+W.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/properties/tags/additionalProperties/oneOf/2/type",keyword:"type",params:{type:"boolean"},message:"must be boolean"};s===null?s=[Ne]:s.push(Ne),a++}var M=ce===a;if(M&&Ee)Ee=!1,re=[re,2];else{M&&(Ee=!0,re=2);let Ne=a;if(a===Ne)if(Z&&typeof Z=="object"&&!Array.isArray(Z))if(Object.keys(Z).length<1){let oe={instancePath:e+"/tags/"+W.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/properties/tags/additionalProperties/oneOf/3/minProperties",keyword:"minProperties",params:{limit:1},message:"must NOT have fewer than 1 properties"};s===null?s=[oe]:s.push(oe),a++}else{let oe=a;for(let ze in Z)if(ze!=="startsWith"){let le={instancePath:e+"/tags/"+W.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/properties/tags/additionalProperties/oneOf/3/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:ze},message:"must NOT have additional properties"};s===null?s=[le]:s.push(le),a++;break}if(oe===a&&Z.startsWith!==void 0&&typeof Z.startsWith!="string"){let ze={instancePath:e+"/tags/"+W.replace(/~/g,"~0").replace(/\//g,"~1")+"/startsWith",schemaPath:"#/properties/tags/additionalProperties/oneOf/3/properties/startsWith/type",keyword:"type",params:{type:"string"},message:"must be string"};s===null?s=[ze]:s.push(ze),a++}}else{let oe={instancePath:e+"/tags/"+W.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/properties/tags/additionalProperties/oneOf/3/type",keyword:"type",params:{type:"object"},message:"must be object"};s===null?s=[oe]:s.push(oe),a++}var M=Ne===a;if(M&&Ee)Ee=!1,re=[re,3];else{if(M){Ee=!0,re=3;var A=!0}let oe=a;if(a===a)if(Z&&typeof Z=="object"&&!Array.isArray(Z))if(Object.keys(Z).length<1){let me={instancePath:e+"/tags/"+W.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"https://identity.foundation/dwn/json-schemas/string-range-filter.json/minProperties",keyword:"minProperties",params:{limit:1},message:"must NOT have fewer than 1 properties"};s===null?s=[me]:s.push(me),a++}else{let me=a;for(let ot in Z)if(!(ot==="gt"||ot==="gte"||ot==="lt"||ot==="lte")){let ue={instancePath:e+"/tags/"+W.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"https://identity.foundation/dwn/json-schemas/string-range-filter.json/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:ot},message:"must NOT have additional properties"};s===null?s=[ue]:s.push(ue),a++;break}if(me===a){if(Z.gt!==void 0){let ot=a,ue=a,he=a;if(Z&&typeof Z=="object"&&!Array.isArray(Z)){let lt;if(Z.gte===void 0&&(lt="gte")){let se={};s===null?s=[se]:s.push(se),a++}}var B=he===a;if(B){let lt={instancePath:e+"/tags/"+W.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"https://identity.foundation/dwn/json-schemas/string-range-filter.json/dependencies/gt/not",keyword:"not",params:{},message:"must NOT be valid"};s===null?s=[lt]:s.push(lt),a++}else a=ue,s!==null&&(ue?s.length=ue:s=null);var I=ot===a}else var I=!0;if(I){if(Z.gte!==void 0){let ot=a,ue=a,he=a;if(Z&&typeof Z=="object"&&!Array.isArray(Z)){let se;if(Z.gt===void 0&&(se="gt")){let fe={};s===null?s=[fe]:s.push(fe),a++}}var C=he===a;if(C){let se={instancePath:e+"/tags/"+W.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"https://identity.foundation/dwn/json-schemas/string-range-filter.json/dependencies/gte/not",keyword:"not",params:{},message:"must NOT be valid"};s===null?s=[se]:s.push(se),a++}else a=ue,s!==null&&(ue?s.length=ue:s=null);var I=ot===a}else var I=!0;if(I){if(Z.lt!==void 0){let ot=a,ue=a,he=a;if(Z&&typeof Z=="object"&&!Array.isArray(Z)){let se;if(Z.lte===void 0&&(se="lte")){let fe={};s===null?s=[fe]:s.push(fe),a++}}var k=he===a;if(k){let se={instancePath:e+"/tags/"+W.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"https://identity.foundation/dwn/json-schemas/string-range-filter.json/dependencies/lt/not",keyword:"not",params:{},message:"must NOT be valid"};s===null?s=[se]:s.push(se),a++}else a=ue,s!==null&&(ue?s.length=ue:s=null);var I=ot===a}else var I=!0;if(I){if(Z.lte!==void 0){let ot=a,ue=a,he=a;if(Z&&typeof Z=="object"&&!Array.isArray(Z)){let se;if(Z.lt===void 0&&(se="lt")){let fe={};s===null?s=[fe]:s.push(fe),a++}}var q=he===a;if(q){let se={instancePath:e+"/tags/"+W.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"https://identity.foundation/dwn/json-schemas/string-range-filter.json/dependencies/lte/not",keyword:"not",params:{},message:"must NOT be valid"};s===null?s=[se]:s.push(se),a++}else a=ue,s!==null&&(ue?s.length=ue:s=null);var I=ot===a}else var I=!0;if(I){if(Z.gt!==void 0){let ot=a;if(typeof Z.gt!="string"){let ue={instancePath:e+"/tags/"+W.replace(/~/g,"~0").replace(/\//g,"~1")+"/gt",schemaPath:"https://identity.foundation/dwn/json-schemas/string-range-filter.json/properties/gt/type",keyword:"type",params:{type:"string"},message:"must be string"};s===null?s=[ue]:s.push(ue),a++}var L=ot===a}else var L=!0;if(L){if(Z.gte!==void 0){let ot=a;if(typeof Z.gte!="string"){let he={instancePath:e+"/tags/"+W.replace(/~/g,"~0").replace(/\//g,"~1")+"/gte",schemaPath:"https://identity.foundation/dwn/json-schemas/string-range-filter.json/properties/gte/type",keyword:"type",params:{type:"string"},message:"must be string"};s===null?s=[he]:s.push(he),a++}var L=ot===a}else var L=!0;if(L){if(Z.lt!==void 0){let ot=a;if(typeof Z.lt!="string"){let he={instancePath:e+"/tags/"+W.replace(/~/g,"~0").replace(/\//g,"~1")+"/lt",schemaPath:"https://identity.foundation/dwn/json-schemas/string-range-filter.json/properties/lt/type",keyword:"type",params:{type:"string"},message:"must be string"};s===null?s=[he]:s.push(he),a++}var L=ot===a}else var L=!0;if(L)if(Z.lte!==void 0){let ot=a;if(typeof Z.lte!="string"){let he={instancePath:e+"/tags/"+W.replace(/~/g,"~0").replace(/\//g,"~1")+"/lte",schemaPath:"https://identity.foundation/dwn/json-schemas/string-range-filter.json/properties/lte/type",keyword:"type",params:{type:"string"},message:"must be string"};s===null?s=[he]:s.push(he),a++}var L=ot===a}else var L=!0}}}}}}}}else{let me={instancePath:e+"/tags/"+W.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"https://identity.foundation/dwn/json-schemas/string-range-filter.json/type",keyword:"type",params:{type:"object"},message:"must be object"};s===null?s=[me]:s.push(me),a++}var M=oe===a;if(M&&Ee)Ee=!1,re=[re,4];else{M&&(Ee=!0,re=4,A!==!0&&(A=!0));let me=a;if(a===a)if(Z&&typeof Z=="object"&&!Array.isArray(Z))if(Object.keys(Z).length<1){let he={instancePath:e+"/tags/"+W.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"https://identity.foundation/dwn/json-schemas/number-range-filter.json/minProperties",keyword:"minProperties",params:{limit:1},message:"must NOT have fewer than 1 properties"};s===null?s=[he]:s.push(he),a++}else{let he=a;for(let lt in Z)if(!(lt==="gt"||lt==="gte"||lt==="lt"||lt==="lte")){let se={instancePath:e+"/tags/"+W.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"https://identity.foundation/dwn/json-schemas/number-range-filter.json/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:lt},message:"must NOT have additional properties"};s===null?s=[se]:s.push(se),a++;break}if(he===a){if(Z.gt!==void 0){let lt=a,se=a,fe=a;if(Z&&typeof Z=="object"&&!Array.isArray(Z)){let Lt;if(Z.gte===void 0&&(Lt="gte")){let ge={};s===null?s=[ge]:s.push(ge),a++}}var U=fe===a;if(U){let Lt={instancePath:e+"/tags/"+W.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"https://identity.foundation/dwn/json-schemas/number-range-filter.json/dependencies/gt/not",keyword:"not",params:{},message:"must NOT be valid"};s===null?s=[Lt]:s.push(Lt),a++}else a=se,s!==null&&(se?s.length=se:s=null);var F=lt===a}else var F=!0;if(F){if(Z.gte!==void 0){let lt=a,se=a,fe=a;if(Z&&typeof Z=="object"&&!Array.isArray(Z)){let ge;if(Z.gt===void 0&&(ge="gt")){let ve={};s===null?s=[ve]:s.push(ve),a++}}var N=fe===a;if(N){let ge={instancePath:e+"/tags/"+W.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"https://identity.foundation/dwn/json-schemas/number-range-filter.json/dependencies/gte/not",keyword:"not",params:{},message:"must NOT be valid"};s===null?s=[ge]:s.push(ge),a++}else a=se,s!==null&&(se?s.length=se:s=null);var F=lt===a}else var F=!0;if(F){if(Z.lt!==void 0){let lt=a,se=a,fe=a;if(Z&&typeof Z=="object"&&!Array.isArray(Z)){let ge;if(Z.lte===void 0&&(ge="lte")){let ve={};s===null?s=[ve]:s.push(ve),a++}}var G=fe===a;if(G){let ge={instancePath:e+"/tags/"+W.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"https://identity.foundation/dwn/json-schemas/number-range-filter.json/dependencies/lt/not",keyword:"not",params:{},message:"must NOT be valid"};s===null?s=[ge]:s.push(ge),a++}else a=se,s!==null&&(se?s.length=se:s=null);var F=lt===a}else var F=!0;if(F){if(Z.lte!==void 0){let lt=a,se=a,fe=a;if(Z&&typeof Z=="object"&&!Array.isArray(Z)){let ge;if(Z.lt===void 0&&(ge="lt")){let ve={};s===null?s=[ve]:s.push(ve),a++}}var x=fe===a;if(x){let ge={instancePath:e+"/tags/"+W.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"https://identity.foundation/dwn/json-schemas/number-range-filter.json/dependencies/lte/not",keyword:"not",params:{},message:"must NOT be valid"};s===null?s=[ge]:s.push(ge),a++}else a=se,s!==null&&(se?s.length=se:s=null);var F=lt===a}else var F=!0;if(F){if(Z.gt!==void 0){let lt=Z.gt,se=a;if(!(typeof lt=="number"&&isFinite(lt))){let fe={instancePath:e+"/tags/"+W.replace(/~/g,"~0").replace(/\//g,"~1")+"/gt",schemaPath:"https://identity.foundation/dwn/json-schemas/number-range-filter.json/properties/gt/type",keyword:"type",params:{type:"number"},message:"must be number"};s===null?s=[fe]:s.push(fe),a++}var c=se===a}else var c=!0;if(c){if(Z.gte!==void 0){let lt=Z.gte,se=a;if(!(typeof lt=="number"&&isFinite(lt))){let Lt={instancePath:e+"/tags/"+W.replace(/~/g,"~0").replace(/\//g,"~1")+"/gte",schemaPath:"https://identity.foundation/dwn/json-schemas/number-range-filter.json/properties/gte/type",keyword:"type",params:{type:"number"},message:"must be number"};s===null?s=[Lt]:s.push(Lt),a++}var c=se===a}else var c=!0;if(c){if(Z.lt!==void 0){let lt=Z.lt,se=a;if(!(typeof lt=="number"&&isFinite(lt))){let Lt={instancePath:e+"/tags/"+W.replace(/~/g,"~0").replace(/\//g,"~1")+"/lt",schemaPath:"https://identity.foundation/dwn/json-schemas/number-range-filter.json/properties/lt/type",keyword:"type",params:{type:"number"},message:"must be number"};s===null?s=[Lt]:s.push(Lt),a++}var c=se===a}else var c=!0;if(c)if(Z.lte!==void 0){let lt=Z.lte,se=a;if(!(typeof lt=="number"&&isFinite(lt))){let Lt={instancePath:e+"/tags/"+W.replace(/~/g,"~0").replace(/\//g,"~1")+"/lte",schemaPath:"https://identity.foundation/dwn/json-schemas/number-range-filter.json/properties/lte/type",keyword:"type",params:{type:"number"},message:"must be number"};s===null?s=[Lt]:s.push(Lt),a++}var c=se===a}else var c=!0}}}}}}}}else{let he={instancePath:e+"/tags/"+W.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"https://identity.foundation/dwn/json-schemas/number-range-filter.json/type",keyword:"type",params:{type:"object"},message:"must be object"};s===null?s=[he]:s.push(he),a++}var M=me===a;M&&Ee?(Ee=!1,re=[re,5]):M&&(Ee=!0,re=5,A!==!0&&(A=!0))}}}}if(Ee)a=X,s!==null&&(X?s.length=X:s=null);else{let ce={instancePath:e+"/tags/"+W.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/properties/tags/additionalProperties/oneOf",keyword:"oneOf",params:{passingSchemas:re},message:"must match exactly one schema in oneOf"};return s===null?s=[ce]:s.push(ce),a++,it.errors=s,!1}var u=J===a;if(!u)break}}else return it.errors=[{instancePath:e+"/tags",schemaPath:"#/properties/tags/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;var S=z===a}else var S=!0;if(S){if(t.recordId!==void 0){let R=a;if(typeof t.recordId!="string")return it.errors=[{instancePath:e+"/recordId",schemaPath:"#/properties/recordId/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var S=R===a}else var S=!0;if(S){if(t.parentId!==void 0){let R=a;if(typeof t.parentId!="string")return it.errors=[{instancePath:e+"/parentId",schemaPath:"#/properties/parentId/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var S=R===a}else var S=!0;if(S){if(t.published!==void 0){let R=a;if(typeof t.published!="boolean")return it.errors=[{instancePath:e+"/published",schemaPath:"#/properties/published/type",keyword:"type",params:{type:"boolean"},message:"must be boolean"}],!1;var S=R===a}else var S=!0;if(S){if(t.dataFormat!==void 0){let R=a;if(typeof t.dataFormat!="string")return it.errors=[{instancePath:e+"/dataFormat",schemaPath:"#/properties/dataFormat/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var S=R===a}else var S=!0;if(S){if(t.dataSize!==void 0){let R=t.dataSize,z=a;if(a===a)if(R&&typeof R=="object"&&!Array.isArray(R)){if(Object.keys(R).length<1)return it.errors=[{instancePath:e+"/dataSize",schemaPath:"https://identity.foundation/dwn/json-schemas/number-range-filter.json/minProperties",keyword:"minProperties",params:{limit:1},message:"must NOT have fewer than 1 properties"}],!1;{let Z=a;for(let J in R)if(!(J==="gt"||J==="gte"||J==="lt"||J==="lte")){return it.errors=[{instancePath:e+"/dataSize",schemaPath:"https://identity.foundation/dwn/json-schemas/number-range-filter.json/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:J},message:"must NOT have additional properties"}],!1;break}if(Z===a){if(R.gt!==void 0){let J=a,X=a,Ee=a;if(R&&typeof R=="object"&&!Array.isArray(R)){let re;if(R.gte===void 0&&(re="gte")){let ne={};s===null?s=[ne]:s.push(ne),a++}}var y=Ee===a;if(y)return it.errors=[{instancePath:e+"/dataSize",schemaPath:"https://identity.foundation/dwn/json-schemas/number-range-filter.json/dependencies/gt/not",keyword:"not",params:{},message:"must NOT be valid"}],!1;a=X,s!==null&&(X?s.length=X:s=null);var l=J===a}else var l=!0;if(l){if(R.gte!==void 0){let J=a,X=a,Ee=a;if(R&&typeof R=="object"&&!Array.isArray(R)){let ne;if(R.gt===void 0&&(ne="gt")){let qe={};s===null?s=[qe]:s.push(qe),a++}}var h=Ee===a;if(h)return it.errors=[{instancePath:e+"/dataSize",schemaPath:"https://identity.foundation/dwn/json-schemas/number-range-filter.json/dependencies/gte/not",keyword:"not",params:{},message:"must NOT be valid"}],!1;a=X,s!==null&&(X?s.length=X:s=null);var l=J===a}else var l=!0;if(l){if(R.lt!==void 0){let J=a,X=a,Ee=a;if(R&&typeof R=="object"&&!Array.isArray(R)){let ne;if(R.lte===void 0&&(ne="lte")){let qe={};s===null?s=[qe]:s.push(qe),a++}}var b=Ee===a;if(b)return it.errors=[{instancePath:e+"/dataSize",schemaPath:"https://identity.foundation/dwn/json-schemas/number-range-filter.json/dependencies/lt/not",keyword:"not",params:{},message:"must NOT be valid"}],!1;a=X,s!==null&&(X?s.length=X:s=null);var l=J===a}else var l=!0;if(l){if(R.lte!==void 0){let J=a,X=a,Ee=a;if(R&&typeof R=="object"&&!Array.isArray(R)){let ne;if(R.lt===void 0&&(ne="lt")){let qe={};s===null?s=[qe]:s.push(qe),a++}}var _=Ee===a;if(_)return it.errors=[{instancePath:e+"/dataSize",schemaPath:"https://identity.foundation/dwn/json-schemas/number-range-filter.json/dependencies/lte/not",keyword:"not",params:{},message:"must NOT be valid"}],!1;a=X,s!==null&&(X?s.length=X:s=null);var l=J===a}else var l=!0;if(l){if(R.gt!==void 0){let J=R.gt,X=a;if(!(typeof J=="number"&&isFinite(J)))return it.errors=[{instancePath:e+"/dataSize/gt",schemaPath:"https://identity.foundation/dwn/json-schemas/number-range-filter.json/properties/gt/type",keyword:"type",params:{type:"number"},message:"must be number"}],!1;var g=X===a}else var g=!0;if(g){if(R.gte!==void 0){let J=R.gte,X=a;if(!(typeof J=="number"&&isFinite(J)))return it.errors=[{instancePath:e+"/dataSize/gte",schemaPath:"https://identity.foundation/dwn/json-schemas/number-range-filter.json/properties/gte/type",keyword:"type",params:{type:"number"},message:"must be number"}],!1;var g=X===a}else var g=!0;if(g){if(R.lt!==void 0){let J=R.lt,X=a;if(!(typeof J=="number"&&isFinite(J)))return it.errors=[{instancePath:e+"/dataSize/lt",schemaPath:"https://identity.foundation/dwn/json-schemas/number-range-filter.json/properties/lt/type",keyword:"type",params:{type:"number"},message:"must be number"}],!1;var g=X===a}else var g=!0;if(g)if(R.lte!==void 0){let J=R.lte,X=a;if(!(typeof J=="number"&&isFinite(J)))return it.errors=[{instancePath:e+"/dataSize/lte",schemaPath:"https://identity.foundation/dwn/json-schemas/number-range-filter.json/properties/lte/type",keyword:"type",params:{type:"number"},message:"must be number"}],!1;var g=X===a}else var g=!0}}}}}}}}}else return it.errors=[{instancePath:e+"/dataSize",schemaPath:"https://identity.foundation/dwn/json-schemas/number-range-filter.json/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;var S=z===a}else var S=!0;if(S){if(t.dataCid!==void 0){let R=a;if(typeof t.dataCid!="string")return it.errors=[{instancePath:e+"/dataCid",schemaPath:"#/properties/dataCid/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var S=R===a}else var S=!0;if(S){if(t.dateCreated!==void 0){let R=t.dateCreated,z=a;if(a===z)if(R&&typeof R=="object"&&!Array.isArray(R)){if(Object.keys(R).length<1)return it.errors=[{instancePath:e+"/dateCreated",schemaPath:"#/properties/dateCreated/minProperties",keyword:"minProperties",params:{limit:1},message:"must NOT have fewer than 1 properties"}],!1;{let W=a;for(let Z in R)if(!(Z==="from"||Z==="to")){return it.errors=[{instancePath:e+"/dateCreated",schemaPath:"#/properties/dateCreated/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:Z},message:"must NOT have additional properties"}],!1;break}if(W===a){if(R.from!==void 0){let Z=R.from,J=a;if(a===a)if(typeof Z=="string"){if(!Jn.test(Z))return it.errors=[{instancePath:e+"/dateCreated/from",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/$defs/date-time/pattern",keyword:"pattern",params:{pattern:"^\\d{4}-[0-1]\\d-[0-3]\\dT(?:[0-2]\\d:[0-5]\\d:[0-5]\\d|23:59:60)\\.\\d{6}Z$"},message:'must match pattern "^\\d{4}-[0-1]\\d-[0-3]\\dT(?:[0-2]\\d:[0-5]\\d:[0-5]\\d|23:59:60)\\.\\d{6}Z$"'}],!1}else return it.errors=[{instancePath:e+"/dateCreated/from",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/$defs/date-time/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var f=J===a}else var f=!0;if(f)if(R.to!==void 0){let Z=R.to,J=a;if(a===a)if(typeof Z=="string"){if(!Jn.test(Z))return it.errors=[{instancePath:e+"/dateCreated/to",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/$defs/date-time/pattern",keyword:"pattern",params:{pattern:"^\\d{4}-[0-1]\\d-[0-3]\\dT(?:[0-2]\\d:[0-5]\\d:[0-5]\\d|23:59:60)\\.\\d{6}Z$"},message:'must match pattern "^\\d{4}-[0-1]\\d-[0-3]\\dT(?:[0-2]\\d:[0-5]\\d:[0-5]\\d|23:59:60)\\.\\d{6}Z$"'}],!1}else return it.errors=[{instancePath:e+"/dateCreated/to",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/$defs/date-time/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var f=J===a}else var f=!0}}}else return it.errors=[{instancePath:e+"/dateCreated",schemaPath:"#/properties/dateCreated/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;var S=z===a}else var S=!0;if(S){if(t.datePublished!==void 0){let R=t.datePublished,z=a;if(a===z)if(R&&typeof R=="object"&&!Array.isArray(R)){if(Object.keys(R).length<1)return it.errors=[{instancePath:e+"/datePublished",schemaPath:"#/properties/datePublished/minProperties",keyword:"minProperties",params:{limit:1},message:"must NOT have fewer than 1 properties"}],!1;{let W=a;for(let Z in R)if(!(Z==="from"||Z==="to")){return it.errors=[{instancePath:e+"/datePublished",schemaPath:"#/properties/datePublished/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:Z},message:"must NOT have additional properties"}],!1;break}if(W===a){if(R.from!==void 0){let Z=R.from,J=a;if(a===a)if(typeof Z=="string"){if(!Jn.test(Z))return it.errors=[{instancePath:e+"/datePublished/from",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/$defs/date-time/pattern",keyword:"pattern",params:{pattern:"^\\d{4}-[0-1]\\d-[0-3]\\dT(?:[0-2]\\d:[0-5]\\d:[0-5]\\d|23:59:60)\\.\\d{6}Z$"},message:'must match pattern "^\\d{4}-[0-1]\\d-[0-3]\\dT(?:[0-2]\\d:[0-5]\\d:[0-5]\\d|23:59:60)\\.\\d{6}Z$"'}],!1}else return it.errors=[{instancePath:e+"/datePublished/from",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/$defs/date-time/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var v=J===a}else var v=!0;if(v)if(R.to!==void 0){let Z=R.to,J=a;if(a===a)if(typeof Z=="string"){if(!Jn.test(Z))return it.errors=[{instancePath:e+"/datePublished/to",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/$defs/date-time/pattern",keyword:"pattern",params:{pattern:"^\\d{4}-[0-1]\\d-[0-3]\\dT(?:[0-2]\\d:[0-5]\\d:[0-5]\\d|23:59:60)\\.\\d{6}Z$"},message:'must match pattern "^\\d{4}-[0-1]\\d-[0-3]\\dT(?:[0-2]\\d:[0-5]\\d:[0-5]\\d|23:59:60)\\.\\d{6}Z$"'}],!1}else return it.errors=[{instancePath:e+"/datePublished/to",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/$defs/date-time/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var v=J===a}else var v=!0}}}else return it.errors=[{instancePath:e+"/datePublished",schemaPath:"#/properties/datePublished/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;var S=z===a}else var S=!0;if(S)if(t.dateUpdated!==void 0){let R=t.dateUpdated,z=a;if(a===z)if(R&&typeof R=="object"&&!Array.isArray(R)){if(Object.keys(R).length<1)return it.errors=[{instancePath:e+"/dateUpdated",schemaPath:"#/properties/dateUpdated/minProperties",keyword:"minProperties",params:{limit:1},message:"must NOT have fewer than 1 properties"}],!1;{let W=a;for(let Z in R)if(!(Z==="from"||Z==="to")){return it.errors=[{instancePath:e+"/dateUpdated",schemaPath:"#/properties/dateUpdated/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:Z},message:"must NOT have additional properties"}],!1;break}if(W===a){if(R.from!==void 0){let Z=R.from,J=a;if(a===a)if(typeof Z=="string"){if(!Jn.test(Z))return it.errors=[{instancePath:e+"/dateUpdated/from",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/$defs/date-time/pattern",keyword:"pattern",params:{pattern:"^\\d{4}-[0-1]\\d-[0-3]\\dT(?:[0-2]\\d:[0-5]\\d:[0-5]\\d|23:59:60)\\.\\d{6}Z$"},message:'must match pattern "^\\d{4}-[0-1]\\d-[0-3]\\dT(?:[0-2]\\d:[0-5]\\d:[0-5]\\d|23:59:60)\\.\\d{6}Z$"'}],!1}else return it.errors=[{instancePath:e+"/dateUpdated/from",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/$defs/date-time/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var O=J===a}else var O=!0;if(O)if(R.to!==void 0){let Z=R.to,J=a;if(a===a)if(typeof Z=="string"){if(!Jn.test(Z))return it.errors=[{instancePath:e+"/dateUpdated/to",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/$defs/date-time/pattern",keyword:"pattern",params:{pattern:"^\\d{4}-[0-1]\\d-[0-3]\\dT(?:[0-2]\\d:[0-5]\\d:[0-5]\\d|23:59:60)\\.\\d{6}Z$"},message:'must match pattern "^\\d{4}-[0-1]\\d-[0-3]\\dT(?:[0-2]\\d:[0-5]\\d:[0-5]\\d|23:59:60)\\.\\d{6}Z$"'}],!1}else return it.errors=[{instancePath:e+"/dateUpdated/to",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/$defs/date-time/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var O=J===a}else var O=!0}}}else return it.errors=[{instancePath:e+"/dateUpdated",schemaPath:"#/properties/dateUpdated/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;var S=z===a}else var S=!0}}}}}}}}}}}}}}}}}}}else return it.errors=[{instancePath:e,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;return it.errors=s,a===0}it.evaluated={props:!0,dynamicProps:!1,dynamicItems:!1};function yn(t,{instancePath:e="",parentData:r,parentDataProperty:n,rootData:i=t,dynamicAnchors:o={}}={}){let s=null,a=0,d=yn.evaluated;if(d.dynamicProps&&(d.props=void 0),d.dynamicItems&&(d.items=void 0),a===0)if(t&&typeof t=="object"&&!Array.isArray(t)){let S;if(t.descriptor===void 0&&(S="descriptor"))return yn.errors=[{instancePath:e,schemaPath:"#/required",keyword:"required",params:{missingProperty:S},message:"must have required property '"+S+"'"}],!1;{let M=a;for(let A in t)if(!(A==="authorization"||A==="descriptor")){return yn.errors=[{instancePath:e,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:A},message:"must NOT have additional properties"}],!1;break}if(M===a){if(t.authorization!==void 0){let A=a;So(t.authorization,{instancePath:e+"/authorization",parentData:t,parentDataProperty:"authorization",rootData:i,dynamicAnchors:o})||(s=s===null?So.errors:s.concat(So.errors),a=s.length);var m=A===a}else var m=!0;if(m)if(t.descriptor!==void 0){let A=t.descriptor,B=a;if(a===B)if(A&&typeof A=="object"&&!Array.isArray(A)){let C;if(A.interface===void 0&&(C="interface")||A.method===void 0&&(C="method")||A.messageTimestamp===void 0&&(C="messageTimestamp")||A.filter===void 0&&(C="filter"))return yn.errors=[{instancePath:e+"/descriptor",schemaPath:"#/properties/descriptor/required",keyword:"required",params:{missingProperty:C},message:"must have required property '"+C+"'"}],!1;{let k=a;for(let q in A)if(!(q==="interface"||q==="method"||q==="messageTimestamp"||q==="filter"||q==="pagination"||q==="dateSort")){return yn.errors=[{instancePath:e+"/descriptor",schemaPath:"#/properties/descriptor/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:q},message:"must NOT have additional properties"}],!1;break}if(k===a){if(A.interface!==void 0){let q=A.interface,L=a;if(typeof q!="string")return yn.errors=[{instancePath:e+"/descriptor/interface",schemaPath:"#/properties/descriptor/properties/interface/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;if(q!=="Records")return yn.errors=[{instancePath:e+"/descriptor/interface",schemaPath:"#/properties/descriptor/properties/interface/enum",keyword:"enum",params:{allowedValues:QT.properties.descriptor.properties.interface.enum},message:"must be equal to one of the allowed values"}],!1;var p=L===a}else var p=!0;if(p){if(A.method!==void 0){let q=A.method,L=a;if(typeof q!="string")return yn.errors=[{instancePath:e+"/descriptor/method",schemaPath:"#/properties/descriptor/properties/method/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;if(q!=="Query")return yn.errors=[{instancePath:e+"/descriptor/method",schemaPath:"#/properties/descriptor/properties/method/enum",keyword:"enum",params:{allowedValues:QT.properties.descriptor.properties.method.enum},message:"must be equal to one of the allowed values"}],!1;var p=L===a}else var p=!0;if(p){if(A.messageTimestamp!==void 0){let q=A.messageTimestamp,L=a;if(a===a)if(typeof q=="string"){if(!Jn.test(q))return yn.errors=[{instancePath:e+"/descriptor/messageTimestamp",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/$defs/date-time/pattern",keyword:"pattern",params:{pattern:"^\\d{4}-[0-1]\\d-[0-3]\\dT(?:[0-2]\\d:[0-5]\\d:[0-5]\\d|23:59:60)\\.\\d{6}Z$"},message:'must match pattern "^\\d{4}-[0-1]\\d-[0-3]\\dT(?:[0-2]\\d:[0-5]\\d:[0-5]\\d|23:59:60)\\.\\d{6}Z$"'}],!1}else return yn.errors=[{instancePath:e+"/descriptor/messageTimestamp",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/$defs/date-time/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var p=L===a}else var p=!0;if(p){if(A.filter!==void 0){let q=a;it(A.filter,{instancePath:e+"/descriptor/filter",parentData:A,parentDataProperty:"filter",rootData:i,dynamicAnchors:o})||(s=s===null?it.errors:s.concat(it.errors),a=s.length);var p=q===a}else var p=!0;if(p){if(A.pagination!==void 0){let q=A.pagination,L=a;if(a===L)if(q&&typeof q=="object"&&!Array.isArray(q)){let F=a;for(let N in q)if(!(N==="limit"||N==="cursor")){return yn.errors=[{instancePath:e+"/descriptor/pagination",schemaPath:"#/properties/descriptor/properties/pagination/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:N},message:"must NOT have additional properties"}],!1;break}if(F===a){if(q.limit!==void 0){let N=q.limit,G=a;if(a===G)if(typeof N=="number"&&isFinite(N)){if(N<1||isNaN(N))return yn.errors=[{instancePath:e+"/descriptor/pagination/limit",schemaPath:"#/properties/descriptor/properties/pagination/properties/limit/minimum",keyword:"minimum",params:{comparison:">=",limit:1},message:"must be >= 1"}],!1}else return yn.errors=[{instancePath:e+"/descriptor/pagination/limit",schemaPath:"#/properties/descriptor/properties/pagination/properties/limit/type",keyword:"type",params:{type:"number"},message:"must be number"}],!1;var w=G===a}else var w=!0;if(w)if(q.cursor!==void 0){let N=q.cursor,G=a;if(a===a)if(N&&typeof N=="object"&&!Array.isArray(N)){if(Object.keys(N).length<1)return yn.errors=[{instancePath:e+"/descriptor/pagination/cursor",schemaPath:"https://identity.foundation/dwn/json-schemas/pagination-cursor.json/minProperties",keyword:"minProperties",params:{limit:1},message:"must NOT have fewer than 1 properties"}],!1;{let u;if(N.messageCid===void 0&&(u="messageCid")||N.value===void 0&&(u="value"))return yn.errors=[{instancePath:e+"/descriptor/pagination/cursor",schemaPath:"https://identity.foundation/dwn/json-schemas/pagination-cursor.json/required",keyword:"required",params:{missingProperty:u},message:"must have required property '"+u+"'"}],!1;{let y=a;for(let l in N)if(!(l==="messageCid"||l==="value")){return yn.errors=[{instancePath:e+"/descriptor/pagination/cursor",schemaPath:"https://identity.foundation/dwn/json-schemas/pagination-cursor.json/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:l},message:"must NOT have additional properties"}],!1;break}if(y===a){if(N.messageCid!==void 0){let l=a;if(typeof N.messageCid!="string")return yn.errors=[{instancePath:e+"/descriptor/pagination/cursor/messageCid",schemaPath:"https://identity.foundation/dwn/json-schemas/pagination-cursor.json/properties/messageCid/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var P=l===a}else var P=!0;if(P)if(N.value!==void 0){let l=N.value,h=a;if(typeof l!="string"&&!(typeof l=="number"&&isFinite(l)))return yn.errors=[{instancePath:e+"/descriptor/pagination/cursor/value",schemaPath:"https://identity.foundation/dwn/json-schemas/pagination-cursor.json/properties/value/type",keyword:"type",params:{type:zE.properties.value.type},message:"must be string,number"}],!1;var P=h===a}else var P=!0}}}}else return yn.errors=[{instancePath:e+"/descriptor/pagination/cursor",schemaPath:"https://identity.foundation/dwn/json-schemas/pagination-cursor.json/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;var w=G===a}else var w=!0}}else return yn.errors=[{instancePath:e+"/descriptor/pagination",schemaPath:"#/properties/descriptor/properties/pagination/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;var p=L===a}else var p=!0;if(p)if(A.dateSort!==void 0){let q=A.dateSort,L=a;if(typeof q!="string")return yn.errors=[{instancePath:e+"/descriptor/dateSort",schemaPath:"#/properties/descriptor/properties/dateSort/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;if(!(q==="createdAscending"||q==="createdDescending"||q==="publishedAscending"||q==="publishedDescending"))return yn.errors=[{instancePath:e+"/descriptor/dateSort",schemaPath:"#/properties/descriptor/properties/dateSort/enum",keyword:"enum",params:{allowedValues:QT.properties.descriptor.properties.dateSort.enum},message:"must be equal to one of the allowed values"}],!1;var p=L===a}else var p=!0}}}}}}}else return yn.errors=[{instancePath:e+"/descriptor",schemaPath:"#/properties/descriptor/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;var m=B===a}else var m=!0}}}else return yn.errors=[{instancePath:e,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;return yn.errors=s,a===0}yn.evaluated={props:!0,dynamicProps:!1,dynamicItems:!1};var Qwe=Ss,ez={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://identity.foundation/dwn/json-schemas/records-subscribe.json",type:"object",additionalProperties:!1,required:["descriptor"],properties:{authorization:{$ref:"https://identity.foundation/dwn/json-schemas/authorization-delegated-grant.json"},descriptor:{type:"object",additionalProperties:!1,required:["interface","method","messageTimestamp","filter"],properties:{interface:{enum:["Records"],type:"string"},method:{enum:["Subscribe"],type:"string"},messageTimestamp:{$ref:"https://identity.foundation/dwn/json-schemas/defs.json#/$defs/date-time"},filter:{$ref:"https://identity.foundation/dwn/json-schemas/records-filter.json"}}}}};function Ss(t,{instancePath:e="",parentData:r,parentDataProperty:n,rootData:i=t,dynamicAnchors:o={}}={}){let s=null,a=0,d=Ss.evaluated;if(d.dynamicProps&&(d.props=void 0),d.dynamicItems&&(d.items=void 0),a===0)if(t&&typeof t=="object"&&!Array.isArray(t)){let w;if(t.descriptor===void 0&&(w="descriptor"))return Ss.errors=[{instancePath:e,schemaPath:"#/required",keyword:"required",params:{missingProperty:w},message:"must have required property '"+w+"'"}],!1;{let P=a;for(let S in t)if(!(S==="authorization"||S==="descriptor")){return Ss.errors=[{instancePath:e,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:S},message:"must NOT have additional properties"}],!1;break}if(P===a){if(t.authorization!==void 0){let S=a;So(t.authorization,{instancePath:e+"/authorization",parentData:t,parentDataProperty:"authorization",rootData:i,dynamicAnchors:o})||(s=s===null?So.errors:s.concat(So.errors),a=s.length);var m=S===a}else var m=!0;if(m)if(t.descriptor!==void 0){let S=t.descriptor,M=a;if(a===M)if(S&&typeof S=="object"&&!Array.isArray(S)){let B;if(S.interface===void 0&&(B="interface")||S.method===void 0&&(B="method")||S.messageTimestamp===void 0&&(B="messageTimestamp")||S.filter===void 0&&(B="filter"))return Ss.errors=[{instancePath:e+"/descriptor",schemaPath:"#/properties/descriptor/required",keyword:"required",params:{missingProperty:B},message:"must have required property '"+B+"'"}],!1;{let I=a;for(let C in S)if(!(C==="interface"||C==="method"||C==="messageTimestamp"||C==="filter")){return Ss.errors=[{instancePath:e+"/descriptor",schemaPath:"#/properties/descriptor/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:C},message:"must NOT have additional properties"}],!1;break}if(I===a){if(S.interface!==void 0){let C=S.interface,k=a;if(typeof C!="string")return Ss.errors=[{instancePath:e+"/descriptor/interface",schemaPath:"#/properties/descriptor/properties/interface/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;if(C!=="Records")return Ss.errors=[{instancePath:e+"/descriptor/interface",schemaPath:"#/properties/descriptor/properties/interface/enum",keyword:"enum",params:{allowedValues:ez.properties.descriptor.properties.interface.enum},message:"must be equal to one of the allowed values"}],!1;var p=k===a}else var p=!0;if(p){if(S.method!==void 0){let C=S.method,k=a;if(typeof C!="string")return Ss.errors=[{instancePath:e+"/descriptor/method",schemaPath:"#/properties/descriptor/properties/method/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;if(C!=="Subscribe")return Ss.errors=[{instancePath:e+"/descriptor/method",schemaPath:"#/properties/descriptor/properties/method/enum",keyword:"enum",params:{allowedValues:ez.properties.descriptor.properties.method.enum},message:"must be equal to one of the allowed values"}],!1;var p=k===a}else var p=!0;if(p){if(S.messageTimestamp!==void 0){let C=S.messageTimestamp,k=a;if(a===a)if(typeof C=="string"){if(!Jn.test(C))return Ss.errors=[{instancePath:e+"/descriptor/messageTimestamp",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/$defs/date-time/pattern",keyword:"pattern",params:{pattern:"^\\d{4}-[0-1]\\d-[0-3]\\dT(?:[0-2]\\d:[0-5]\\d:[0-5]\\d|23:59:60)\\.\\d{6}Z$"},message:'must match pattern "^\\d{4}-[0-1]\\d-[0-3]\\dT(?:[0-2]\\d:[0-5]\\d:[0-5]\\d|23:59:60)\\.\\d{6}Z$"'}],!1}else return Ss.errors=[{instancePath:e+"/descriptor/messageTimestamp",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/$defs/date-time/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var p=k===a}else var p=!0;if(p)if(S.filter!==void 0){let C=a;it(S.filter,{instancePath:e+"/descriptor/filter",parentData:S,parentDataProperty:"filter",rootData:i,dynamicAnchors:o})||(s=s===null?it.errors:s.concat(it.errors),a=s.length);var p=C===a}else var p=!0}}}}}else return Ss.errors=[{instancePath:e+"/descriptor",schemaPath:"#/properties/descriptor/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;var m=M===a}else var m=!0}}}else return Ss.errors=[{instancePath:e,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;return Ss.errors=s,a===0}Ss.evaluated={props:!0,dynamicProps:!1,dynamicItems:!1};var Xwe=U0;function U0(t,{instancePath:e="",parentData:r,parentDataProperty:n,rootData:i=t,dynamicAnchors:o={}}={}){let s=null,a=0,d=U0.evaluated;if(d.dynamicProps&&(d.props=void 0),d.dynamicItems&&(d.items=void 0),!Xe(t,{instancePath:e,parentData:r,parentDataProperty:n,rootData:i,dynamicAnchors:o}))s=s===null?Xe.errors:s.concat(Xe.errors),a=s.length;else var m=Xe.evaluated.props;if(a===0)if(t&&typeof t=="object"&&!Array.isArray(t)){let p;if(t.recordId===void 0&&(p="recordId")||t.authorization===void 0&&(p="authorization"))return U0.errors=[{instancePath:e,schemaPath:"#/required",keyword:"required",params:{missingProperty:p},message:"must have required property '"+p+"'"}],!1;if(m!==!0){for(let w in t)if(!m||!m[w]){return U0.errors=[{instancePath:e,schemaPath:"#/unevaluatedProperties",keyword:"unevaluatedProperties",params:{unevaluatedProperty:w},message:"must NOT have unevaluated properties"}],!1;break}}}else return U0.errors=[{instancePath:e,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;return U0.errors=s,a===0}U0.evaluated={props:!0,dynamicProps:!1,dynamicItems:!1};var e1e=Sc,t1e=Xe,r1e=gt,FE={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://identity.foundation/dwn/json-schemas/events-filter.json",type:"object",additionalProperties:!1,minProperties:1,properties:{interface:{enum:["Permissions","Protocols","Records"],type:"string"},method:{enum:["Configure","Delete","Grant","Revoke","Write"],type:"string"},protocol:{type:"string"},protocolPath:{type:"string"},recipient:{$ref:"https://identity.foundation/dwn/json-schemas/defs.json#/$defs/did"},contextId:{type:"string"},schema:{type:"string"},recordId:{type:"string"},parentId:{type:"string"},dataFormat:{type:"string"},dataSize:{$ref:"https://identity.foundation/dwn/json-schemas/number-range-filter.json"},dateCreated:{type:"object",minProperties:1,additionalProperties:!1,properties:{from:{$ref:"https://identity.foundation/dwn/json-schemas/defs.json#/$defs/date-time"},to:{$ref:"https://identity.foundation/dwn/json-schemas/defs.json#/$defs/date-time"}}},datePublished:{type:"object",minProperties:1,additionalProperties:!1,properties:{from:{$ref:"https://identity.foundation/dwn/json-schemas/defs.json#/$defs/date-time"},to:{$ref:"https://identity.foundation/dwn/json-schemas/defs.json#/$defs/date-time"}}},dateUpdated:{type:"object",minProperties:1,additionalProperties:!1,properties:{from:{$ref:"https://identity.foundation/dwn/json-schemas/defs.json#/$defs/date-time"},to:{$ref:"https://identity.foundation/dwn/json-schemas/defs.json#/$defs/date-time"}}}},dependencies:{datePublished:{oneOf:[{properties:{published:{enum:[!0]}},required:["published"]},{not:{required:["published"]}}]}}};function gt(t,{instancePath:e="",parentData:r,parentDataProperty:n,rootData:i=t,dynamicAnchors:o={}}={}){let s=null,a=0,d=gt.evaluated;if(d.dynamicProps&&(d.props=void 0),d.dynamicItems&&(d.items=void 0),a===0)if(t&&typeof t=="object"&&!Array.isArray(t)){if(Object.keys(t).length<1)return gt.errors=[{instancePath:e,schemaPath:"#/minProperties",keyword:"minProperties",params:{limit:1},message:"must NOT have fewer than 1 properties"}],!1;{let F=a;for(let N in t)if(!eR.call(FE.properties,N)){return gt.errors=[{instancePath:e,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:N},message:"must NOT have additional properties"}],!1;break}if(F===a){if(t.datePublished!==void 0){let N=a,G=a,x=!1,c=null,u=a;if(t&&typeof t=="object"&&!Array.isArray(t)){let b;if(t.published===void 0&&(b="published")){let _={instancePath:e,schemaPath:"#/dependencies/datePublished/oneOf/0/required",keyword:"required",params:{missingProperty:b},message:"must have required property '"+b+"'"};s===null?s=[_]:s.push(_),a++}else if(t.published!==void 0&&t.published!==!0){let _={instancePath:e+"/published",schemaPath:"#/dependencies/datePublished/oneOf/0/properties/published/enum",keyword:"enum",params:{allowedValues:FE.dependencies.datePublished.oneOf[0].properties.published.enum},message:"must be equal to one of the allowed values"};s===null?s=[_]:s.push(_),a++}}var w=u===a;if(w){x=!0,c=0;var m={};m.published=!0}let y=a,l=a,h=a;if(t&&typeof t=="object"&&!Array.isArray(t)){let b;if(t.published===void 0&&(b="published")){let _={};s===null?s=[_]:s.push(_),a++}}var p=h===a;if(p){let b={instancePath:e,schemaPath:"#/dependencies/datePublished/oneOf/1/not",keyword:"not",params:{},message:"must NOT be valid"};s===null?s=[b]:s.push(b),a++}else a=l,s!==null&&(l?s.length=l:s=null);var w=y===a;if(w&&x?(x=!1,c=[c,1]):w&&(x=!0,c=1),x)a=G,s!==null&&(G?s.length=G:s=null);else{let b={instancePath:e,schemaPath:"#/dependencies/datePublished/oneOf",keyword:"oneOf",params:{passingSchemas:c},message:"must match exactly one schema in oneOf"};return s===null?s=[b]:s.push(b),a++,gt.errors=s,!1}var P=N===a}else var P=!0;if(P){if(t.interface!==void 0){let N=t.interface,G=a;if(typeof N!="string")return gt.errors=[{instancePath:e+"/interface",schemaPath:"#/properties/interface/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;if(!(N==="Permissions"||N==="Protocols"||N==="Records"))return gt.errors=[{instancePath:e+"/interface",schemaPath:"#/properties/interface/enum",keyword:"enum",params:{allowedValues:FE.properties.interface.enum},message:"must be equal to one of the allowed values"}],!1;var S=G===a}else var S=!0;if(S){if(t.method!==void 0){let N=t.method,G=a;if(typeof N!="string")return gt.errors=[{instancePath:e+"/method",schemaPath:"#/properties/method/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;if(!(N==="Configure"||N==="Delete"||N==="Grant"||N==="Revoke"||N==="Write"))return gt.errors=[{instancePath:e+"/method",schemaPath:"#/properties/method/enum",keyword:"enum",params:{allowedValues:FE.properties.method.enum},message:"must be equal to one of the allowed values"}],!1;var S=G===a}else var S=!0;if(S){if(t.protocol!==void 0){let N=a;if(typeof t.protocol!="string")return gt.errors=[{instancePath:e+"/protocol",schemaPath:"#/properties/protocol/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var S=N===a}else var S=!0;if(S){if(t.protocolPath!==void 0){let N=a;if(typeof t.protocolPath!="string")return gt.errors=[{instancePath:e+"/protocolPath",schemaPath:"#/properties/protocolPath/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var S=N===a}else var S=!0;if(S){if(t.recipient!==void 0){let N=t.recipient,G=a;if(a===a)if(typeof N=="string"){if(!K0.test(N))return gt.errors=[{instancePath:e+"/recipient",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/$defs/did/pattern",keyword:"pattern",params:{pattern:"^did:([a-z0-9]+):((?:(?:[a-zA-Z0-9._-]|(?:%[0-9a-fA-F]{2}))*:)*((?:[a-zA-Z0-9._-]|(?:%[0-9a-fA-F]{2}))+))((;[a-zA-Z0-9_.:%-]+=[a-zA-Z0-9_.:%-]*)*)(/[^#?]*)?([?][^#]*)?(#.*)?$"},message:'must match pattern "^did:([a-z0-9]+):((?:(?:[a-zA-Z0-9._-]|(?:%[0-9a-fA-F]{2}))*:)*((?:[a-zA-Z0-9._-]|(?:%[0-9a-fA-F]{2}))+))((;[a-zA-Z0-9_.:%-]+=[a-zA-Z0-9_.:%-]*)*)(/[^#?]*)?([?][^#]*)?(#.*)?$"'}],!1}else return gt.errors=[{instancePath:e+"/recipient",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/$defs/did/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var S=G===a}else var S=!0;if(S){if(t.contextId!==void 0){let N=a;if(typeof t.contextId!="string")return gt.errors=[{instancePath:e+"/contextId",schemaPath:"#/properties/contextId/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var S=N===a}else var S=!0;if(S){if(t.schema!==void 0){let N=a;if(typeof t.schema!="string")return gt.errors=[{instancePath:e+"/schema",schemaPath:"#/properties/schema/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var S=N===a}else var S=!0;if(S){if(t.recordId!==void 0){let N=a;if(typeof t.recordId!="string")return gt.errors=[{instancePath:e+"/recordId",schemaPath:"#/properties/recordId/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var S=N===a}else var S=!0;if(S){if(t.parentId!==void 0){let N=a;if(typeof t.parentId!="string")return gt.errors=[{instancePath:e+"/parentId",schemaPath:"#/properties/parentId/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var S=N===a}else var S=!0;if(S){if(t.dataFormat!==void 0){let N=a;if(typeof t.dataFormat!="string")return gt.errors=[{instancePath:e+"/dataFormat",schemaPath:"#/properties/dataFormat/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var S=N===a}else var S=!0;if(S){if(t.dataSize!==void 0){let N=t.dataSize,G=a;if(a===a)if(N&&typeof N=="object"&&!Array.isArray(N)){if(Object.keys(N).length<1)return gt.errors=[{instancePath:e+"/dataSize",schemaPath:"https://identity.foundation/dwn/json-schemas/number-range-filter.json/minProperties",keyword:"minProperties",params:{limit:1},message:"must NOT have fewer than 1 properties"}],!1;{let u=a;for(let y in N)if(!(y==="gt"||y==="gte"||y==="lt"||y==="lte")){return gt.errors=[{instancePath:e+"/dataSize",schemaPath:"https://identity.foundation/dwn/json-schemas/number-range-filter.json/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:y},message:"must NOT have additional properties"}],!1;break}if(u===a){if(N.gt!==void 0){let y=a,l=a,h=a;if(N&&typeof N=="object"&&!Array.isArray(N)){let b;if(N.gte===void 0&&(b="gte")){let _={};s===null?s=[_]:s.push(_),a++}}var M=h===a;if(M)return gt.errors=[{instancePath:e+"/dataSize",schemaPath:"https://identity.foundation/dwn/json-schemas/number-range-filter.json/dependencies/gt/not",keyword:"not",params:{},message:"must NOT be valid"}],!1;a=l,s!==null&&(l?s.length=l:s=null);var A=y===a}else var A=!0;if(A){if(N.gte!==void 0){let y=a,l=a,h=a;if(N&&typeof N=="object"&&!Array.isArray(N)){let _;if(N.gt===void 0&&(_="gt")){let g={};s===null?s=[g]:s.push(g),a++}}var B=h===a;if(B)return gt.errors=[{instancePath:e+"/dataSize",schemaPath:"https://identity.foundation/dwn/json-schemas/number-range-filter.json/dependencies/gte/not",keyword:"not",params:{},message:"must NOT be valid"}],!1;a=l,s!==null&&(l?s.length=l:s=null);var A=y===a}else var A=!0;if(A){if(N.lt!==void 0){let y=a,l=a,h=a;if(N&&typeof N=="object"&&!Array.isArray(N)){let _;if(N.lte===void 0&&(_="lte")){let g={};s===null?s=[g]:s.push(g),a++}}var I=h===a;if(I)return gt.errors=[{instancePath:e+"/dataSize",schemaPath:"https://identity.foundation/dwn/json-schemas/number-range-filter.json/dependencies/lt/not",keyword:"not",params:{},message:"must NOT be valid"}],!1;a=l,s!==null&&(l?s.length=l:s=null);var A=y===a}else var A=!0;if(A){if(N.lte!==void 0){let y=a,l=a,h=a;if(N&&typeof N=="object"&&!Array.isArray(N)){let _;if(N.lt===void 0&&(_="lt")){let g={};s===null?s=[g]:s.push(g),a++}}var C=h===a;if(C)return gt.errors=[{instancePath:e+"/dataSize",schemaPath:"https://identity.foundation/dwn/json-schemas/number-range-filter.json/dependencies/lte/not",keyword:"not",params:{},message:"must NOT be valid"}],!1;a=l,s!==null&&(l?s.length=l:s=null);var A=y===a}else var A=!0;if(A){if(N.gt!==void 0){let y=N.gt,l=a;if(!(typeof y=="number"&&isFinite(y)))return gt.errors=[{instancePath:e+"/dataSize/gt",schemaPath:"https://identity.foundation/dwn/json-schemas/number-range-filter.json/properties/gt/type",keyword:"type",params:{type:"number"},message:"must be number"}],!1;var k=l===a}else var k=!0;if(k){if(N.gte!==void 0){let y=N.gte,l=a;if(!(typeof y=="number"&&isFinite(y)))return gt.errors=[{instancePath:e+"/dataSize/gte",schemaPath:"https://identity.foundation/dwn/json-schemas/number-range-filter.json/properties/gte/type",keyword:"type",params:{type:"number"},message:"must be number"}],!1;var k=l===a}else var k=!0;if(k){if(N.lt!==void 0){let y=N.lt,l=a;if(!(typeof y=="number"&&isFinite(y)))return gt.errors=[{instancePath:e+"/dataSize/lt",schemaPath:"https://identity.foundation/dwn/json-schemas/number-range-filter.json/properties/lt/type",keyword:"type",params:{type:"number"},message:"must be number"}],!1;var k=l===a}else var k=!0;if(k)if(N.lte!==void 0){let y=N.lte,l=a;if(!(typeof y=="number"&&isFinite(y)))return gt.errors=[{instancePath:e+"/dataSize/lte",schemaPath:"https://identity.foundation/dwn/json-schemas/number-range-filter.json/properties/lte/type",keyword:"type",params:{type:"number"},message:"must be number"}],!1;var k=l===a}else var k=!0}}}}}}}}}else return gt.errors=[{instancePath:e+"/dataSize",schemaPath:"https://identity.foundation/dwn/json-schemas/number-range-filter.json/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;var S=G===a}else var S=!0;if(S){if(t.dateCreated!==void 0){let N=t.dateCreated,G=a;if(a===G)if(N&&typeof N=="object"&&!Array.isArray(N)){if(Object.keys(N).length<1)return gt.errors=[{instancePath:e+"/dateCreated",schemaPath:"#/properties/dateCreated/minProperties",keyword:"minProperties",params:{limit:1},message:"must NOT have fewer than 1 properties"}],!1;{let c=a;for(let u in N)if(!(u==="from"||u==="to")){return gt.errors=[{instancePath:e+"/dateCreated",schemaPath:"#/properties/dateCreated/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:u},message:"must NOT have additional properties"}],!1;break}if(c===a){if(N.from!==void 0){let u=N.from,y=a;if(a===a)if(typeof u=="string"){if(!Jn.test(u))return gt.errors=[{instancePath:e+"/dateCreated/from",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/$defs/date-time/pattern",keyword:"pattern",params:{pattern:"^\\d{4}-[0-1]\\d-[0-3]\\dT(?:[0-2]\\d:[0-5]\\d:[0-5]\\d|23:59:60)\\.\\d{6}Z$"},message:'must match pattern "^\\d{4}-[0-1]\\d-[0-3]\\dT(?:[0-2]\\d:[0-5]\\d:[0-5]\\d|23:59:60)\\.\\d{6}Z$"'}],!1}else return gt.errors=[{instancePath:e+"/dateCreated/from",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/$defs/date-time/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var q=y===a}else var q=!0;if(q)if(N.to!==void 0){let u=N.to,y=a;if(a===a)if(typeof u=="string"){if(!Jn.test(u))return gt.errors=[{instancePath:e+"/dateCreated/to",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/$defs/date-time/pattern",keyword:"pattern",params:{pattern:"^\\d{4}-[0-1]\\d-[0-3]\\dT(?:[0-2]\\d:[0-5]\\d:[0-5]\\d|23:59:60)\\.\\d{6}Z$"},message:'must match pattern "^\\d{4}-[0-1]\\d-[0-3]\\dT(?:[0-2]\\d:[0-5]\\d:[0-5]\\d|23:59:60)\\.\\d{6}Z$"'}],!1}else return gt.errors=[{instancePath:e+"/dateCreated/to",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/$defs/date-time/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var q=y===a}else var q=!0}}}else return gt.errors=[{instancePath:e+"/dateCreated",schemaPath:"#/properties/dateCreated/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;var S=G===a}else var S=!0;if(S){if(t.datePublished!==void 0){let N=t.datePublished,G=a;if(a===G)if(N&&typeof N=="object"&&!Array.isArray(N)){if(Object.keys(N).length<1)return gt.errors=[{instancePath:e+"/datePublished",schemaPath:"#/properties/datePublished/minProperties",keyword:"minProperties",params:{limit:1},message:"must NOT have fewer than 1 properties"}],!1;{let c=a;for(let u in N)if(!(u==="from"||u==="to")){return gt.errors=[{instancePath:e+"/datePublished",schemaPath:"#/properties/datePublished/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:u},message:"must NOT have additional properties"}],!1;break}if(c===a){if(N.from!==void 0){let u=N.from,y=a;if(a===a)if(typeof u=="string"){if(!Jn.test(u))return gt.errors=[{instancePath:e+"/datePublished/from",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/$defs/date-time/pattern",keyword:"pattern",params:{pattern:"^\\d{4}-[0-1]\\d-[0-3]\\dT(?:[0-2]\\d:[0-5]\\d:[0-5]\\d|23:59:60)\\.\\d{6}Z$"},message:'must match pattern "^\\d{4}-[0-1]\\d-[0-3]\\dT(?:[0-2]\\d:[0-5]\\d:[0-5]\\d|23:59:60)\\.\\d{6}Z$"'}],!1}else return gt.errors=[{instancePath:e+"/datePublished/from",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/$defs/date-time/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var L=y===a}else var L=!0;if(L)if(N.to!==void 0){let u=N.to,y=a;if(a===a)if(typeof u=="string"){if(!Jn.test(u))return gt.errors=[{instancePath:e+"/datePublished/to",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/$defs/date-time/pattern",keyword:"pattern",params:{pattern:"^\\d{4}-[0-1]\\d-[0-3]\\dT(?:[0-2]\\d:[0-5]\\d:[0-5]\\d|23:59:60)\\.\\d{6}Z$"},message:'must match pattern "^\\d{4}-[0-1]\\d-[0-3]\\dT(?:[0-2]\\d:[0-5]\\d:[0-5]\\d|23:59:60)\\.\\d{6}Z$"'}],!1}else return gt.errors=[{instancePath:e+"/datePublished/to",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/$defs/date-time/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var L=y===a}else var L=!0}}}else return gt.errors=[{instancePath:e+"/datePublished",schemaPath:"#/properties/datePublished/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;var S=G===a}else var S=!0;if(S)if(t.dateUpdated!==void 0){let N=t.dateUpdated,G=a;if(a===G)if(N&&typeof N=="object"&&!Array.isArray(N)){if(Object.keys(N).length<1)return gt.errors=[{instancePath:e+"/dateUpdated",schemaPath:"#/properties/dateUpdated/minProperties",keyword:"minProperties",params:{limit:1},message:"must NOT have fewer than 1 properties"}],!1;{let c=a;for(let u in N)if(!(u==="from"||u==="to")){return gt.errors=[{instancePath:e+"/dateUpdated",schemaPath:"#/properties/dateUpdated/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:u},message:"must NOT have additional properties"}],!1;break}if(c===a){if(N.from!==void 0){let u=N.from,y=a;if(a===a)if(typeof u=="string"){if(!Jn.test(u))return gt.errors=[{instancePath:e+"/dateUpdated/from",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/$defs/date-time/pattern",keyword:"pattern",params:{pattern:"^\\d{4}-[0-1]\\d-[0-3]\\dT(?:[0-2]\\d:[0-5]\\d:[0-5]\\d|23:59:60)\\.\\d{6}Z$"},message:'must match pattern "^\\d{4}-[0-1]\\d-[0-3]\\dT(?:[0-2]\\d:[0-5]\\d:[0-5]\\d|23:59:60)\\.\\d{6}Z$"'}],!1}else return gt.errors=[{instancePath:e+"/dateUpdated/from",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/$defs/date-time/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var U=y===a}else var U=!0;if(U)if(N.to!==void 0){let u=N.to,y=a;if(a===a)if(typeof u=="string"){if(!Jn.test(u))return gt.errors=[{instancePath:e+"/dateUpdated/to",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/$defs/date-time/pattern",keyword:"pattern",params:{pattern:"^\\d{4}-[0-1]\\d-[0-3]\\dT(?:[0-2]\\d:[0-5]\\d:[0-5]\\d|23:59:60)\\.\\d{6}Z$"},message:'must match pattern "^\\d{4}-[0-1]\\d-[0-3]\\dT(?:[0-2]\\d:[0-5]\\d:[0-5]\\d|23:59:60)\\.\\d{6}Z$"'}],!1}else return gt.errors=[{instancePath:e+"/dateUpdated/to",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/$defs/date-time/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var U=y===a}else var U=!0}}}else return gt.errors=[{instancePath:e+"/dateUpdated",schemaPath:"#/properties/dateUpdated/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;var S=G===a}else var S=!0}}}}}}}}}}}}}}}}else return gt.errors=[{instancePath:e,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;return gt.errors=s,a===0}gt.evaluated={props:!0,dynamicProps:!1,dynamicItems:!1};var n1e=ji,tz={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://identity.foundation/dwn/json-schemas/events-get.json",type:"object",additionalProperties:!1,required:["authorization","descriptor"],properties:{authorization:{$ref:"https://identity.foundation/dwn/json-schemas/authorization.json"},descriptor:{type:"object",additionalProperties:!1,required:["interface","method","messageTimestamp"],properties:{interface:{enum:["Events"],type:"string"},method:{enum:["Get"],type:"string"},messageTimestamp:{type:"string"},cursor:{$ref:"https://identity.foundation/dwn/json-schemas/pagination-cursor.json"}}}}};function ji(t,{instancePath:e="",parentData:r,parentDataProperty:n,rootData:i=t,dynamicAnchors:o={}}={}){let s=null,a=0,d=ji.evaluated;if(d.dynamicProps&&(d.props=void 0),d.dynamicItems&&(d.items=void 0),a===0)if(t&&typeof t=="object"&&!Array.isArray(t)){let P;if(t.authorization===void 0&&(P="authorization")||t.descriptor===void 0&&(P="descriptor"))return ji.errors=[{instancePath:e,schemaPath:"#/required",keyword:"required",params:{missingProperty:P},message:"must have required property '"+P+"'"}],!1;{let S=a;for(let M in t)if(!(M==="authorization"||M==="descriptor")){return ji.errors=[{instancePath:e,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:M},message:"must NOT have additional properties"}],!1;break}if(S===a){if(t.authorization!==void 0){let M=a;Yn(t.authorization,{instancePath:e+"/authorization",parentData:t,parentDataProperty:"authorization",rootData:i,dynamicAnchors:o})||(s=s===null?Yn.errors:s.concat(Yn.errors),a=s.length);var m=M===a}else var m=!0;if(m)if(t.descriptor!==void 0){let M=t.descriptor,A=a;if(a===A)if(M&&typeof M=="object"&&!Array.isArray(M)){let I;if(M.interface===void 0&&(I="interface")||M.method===void 0&&(I="method")||M.messageTimestamp===void 0&&(I="messageTimestamp"))return ji.errors=[{instancePath:e+"/descriptor",schemaPath:"#/properties/descriptor/required",keyword:"required",params:{missingProperty:I},message:"must have required property '"+I+"'"}],!1;{let C=a;for(let k in M)if(!(k==="interface"||k==="method"||k==="messageTimestamp"||k==="cursor")){return ji.errors=[{instancePath:e+"/descriptor",schemaPath:"#/properties/descriptor/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:k},message:"must NOT have additional properties"}],!1;break}if(C===a){if(M.interface!==void 0){let k=M.interface,q=a;if(typeof k!="string")return ji.errors=[{instancePath:e+"/descriptor/interface",schemaPath:"#/properties/descriptor/properties/interface/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;if(k!=="Events")return ji.errors=[{instancePath:e+"/descriptor/interface",schemaPath:"#/properties/descriptor/properties/interface/enum",keyword:"enum",params:{allowedValues:tz.properties.descriptor.properties.interface.enum},message:"must be equal to one of the allowed values"}],!1;var p=q===a}else var p=!0;if(p){if(M.method!==void 0){let k=M.method,q=a;if(typeof k!="string")return ji.errors=[{instancePath:e+"/descriptor/method",schemaPath:"#/properties/descriptor/properties/method/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;if(k!=="Get")return ji.errors=[{instancePath:e+"/descriptor/method",schemaPath:"#/properties/descriptor/properties/method/enum",keyword:"enum",params:{allowedValues:tz.properties.descriptor.properties.method.enum},message:"must be equal to one of the allowed values"}],!1;var p=q===a}else var p=!0;if(p){if(M.messageTimestamp!==void 0){let k=a;if(typeof M.messageTimestamp!="string")return ji.errors=[{instancePath:e+"/descriptor/messageTimestamp",schemaPath:"#/properties/descriptor/properties/messageTimestamp/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var p=k===a}else var p=!0;if(p)if(M.cursor!==void 0){let k=M.cursor,q=a;if(a===a)if(k&&typeof k=="object"&&!Array.isArray(k)){if(Object.keys(k).length<1)return ji.errors=[{instancePath:e+"/descriptor/cursor",schemaPath:"https://identity.foundation/dwn/json-schemas/pagination-cursor.json/minProperties",keyword:"minProperties",params:{limit:1},message:"must NOT have fewer than 1 properties"}],!1;{let F;if(k.messageCid===void 0&&(F="messageCid")||k.value===void 0&&(F="value"))return ji.errors=[{instancePath:e+"/descriptor/cursor",schemaPath:"https://identity.foundation/dwn/json-schemas/pagination-cursor.json/required",keyword:"required",params:{missingProperty:F},message:"must have required property '"+F+"'"}],!1;{let N=a;for(let G in k)if(!(G==="messageCid"||G==="value")){return ji.errors=[{instancePath:e+"/descriptor/cursor",schemaPath:"https://identity.foundation/dwn/json-schemas/pagination-cursor.json/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:G},message:"must NOT have additional properties"}],!1;break}if(N===a){if(k.messageCid!==void 0){let G=a;if(typeof k.messageCid!="string")return ji.errors=[{instancePath:e+"/descriptor/cursor/messageCid",schemaPath:"https://identity.foundation/dwn/json-schemas/pagination-cursor.json/properties/messageCid/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var w=G===a}else var w=!0;if(w)if(k.value!==void 0){let G=k.value,x=a;if(typeof G!="string"&&!(typeof G=="number"&&isFinite(G)))return ji.errors=[{instancePath:e+"/descriptor/cursor/value",schemaPath:"https://identity.foundation/dwn/json-schemas/pagination-cursor.json/properties/value/type",keyword:"type",params:{type:zE.properties.value.type},message:"must be string,number"}],!1;var w=x===a}else var w=!0}}}}else return ji.errors=[{instancePath:e+"/descriptor/cursor",schemaPath:"https://identity.foundation/dwn/json-schemas/pagination-cursor.json/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;var p=q===a}else var p=!0}}}}}else return ji.errors=[{instancePath:e+"/descriptor",schemaPath:"#/properties/descriptor/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;var m=A===a}else var m=!0}}}else return ji.errors=[{instancePath:e,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;return ji.errors=s,a===0}ji.evaluated={props:!0,dynamicProps:!1,dynamicItems:!1};var i1e=Zn,rz={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://identity.foundation/dwn/json-schemas/events-query.json",type:"object",additionalProperties:!1,required:["authorization","descriptor"],properties:{authorization:{$ref:"https://identity.foundation/dwn/json-schemas/authorization.json"},descriptor:{type:"object",additionalProperties:!1,required:["interface","method","messageTimestamp","filters"],properties:{interface:{enum:["Events"],type:"string"},method:{enum:["Query"],type:"string"},messageTimestamp:{$ref:"https://identity.foundation/dwn/json-schemas/defs.json#/$defs/date-time"},filters:{type:"array",minItems:1,items:{$ref:"https://identity.foundation/dwn/json-schemas/events-filter.json"}},cursor:{$ref:"https://identity.foundation/dwn/json-schemas/pagination-cursor.json"}}}}};function Zn(t,{instancePath:e="",parentData:r,parentDataProperty:n,rootData:i=t,dynamicAnchors:o={}}={}){let s=null,a=0,d=Zn.evaluated;if(d.dynamicProps&&(d.props=void 0),d.dynamicItems&&(d.items=void 0),a===0)if(t&&typeof t=="object"&&!Array.isArray(t)){let S;if(t.authorization===void 0&&(S="authorization")||t.descriptor===void 0&&(S="descriptor"))return Zn.errors=[{instancePath:e,schemaPath:"#/required",keyword:"required",params:{missingProperty:S},message:"must have required property '"+S+"'"}],!1;{let M=a;for(let A in t)if(!(A==="authorization"||A==="descriptor")){return Zn.errors=[{instancePath:e,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:A},message:"must NOT have additional properties"}],!1;break}if(M===a){if(t.authorization!==void 0){let A=a;Yn(t.authorization,{instancePath:e+"/authorization",parentData:t,parentDataProperty:"authorization",rootData:i,dynamicAnchors:o})||(s=s===null?Yn.errors:s.concat(Yn.errors),a=s.length);var m=A===a}else var m=!0;if(m)if(t.descriptor!==void 0){let A=t.descriptor,B=a;if(a===B)if(A&&typeof A=="object"&&!Array.isArray(A)){let C;if(A.interface===void 0&&(C="interface")||A.method===void 0&&(C="method")||A.messageTimestamp===void 0&&(C="messageTimestamp")||A.filters===void 0&&(C="filters"))return Zn.errors=[{instancePath:e+"/descriptor",schemaPath:"#/properties/descriptor/required",keyword:"required",params:{missingProperty:C},message:"must have required property '"+C+"'"}],!1;{let k=a;for(let q in A)if(!(q==="interface"||q==="method"||q==="messageTimestamp"||q==="filters"||q==="cursor")){return Zn.errors=[{instancePath:e+"/descriptor",schemaPath:"#/properties/descriptor/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:q},message:"must NOT have additional properties"}],!1;break}if(k===a){if(A.interface!==void 0){let q=A.interface,L=a;if(typeof q!="string")return Zn.errors=[{instancePath:e+"/descriptor/interface",schemaPath:"#/properties/descriptor/properties/interface/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;if(q!=="Events")return Zn.errors=[{instancePath:e+"/descriptor/interface",schemaPath:"#/properties/descriptor/properties/interface/enum",keyword:"enum",params:{allowedValues:rz.properties.descriptor.properties.interface.enum},message:"must be equal to one of the allowed values"}],!1;var p=L===a}else var p=!0;if(p){if(A.method!==void 0){let q=A.method,L=a;if(typeof q!="string")return Zn.errors=[{instancePath:e+"/descriptor/method",schemaPath:"#/properties/descriptor/properties/method/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;if(q!=="Query")return Zn.errors=[{instancePath:e+"/descriptor/method",schemaPath:"#/properties/descriptor/properties/method/enum",keyword:"enum",params:{allowedValues:rz.properties.descriptor.properties.method.enum},message:"must be equal to one of the allowed values"}],!1;var p=L===a}else var p=!0;if(p){if(A.messageTimestamp!==void 0){let q=A.messageTimestamp,L=a;if(a===a)if(typeof q=="string"){if(!Jn.test(q))return Zn.errors=[{instancePath:e+"/descriptor/messageTimestamp",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/$defs/date-time/pattern",keyword:"pattern",params:{pattern:"^\\d{4}-[0-1]\\d-[0-3]\\dT(?:[0-2]\\d:[0-5]\\d:[0-5]\\d|23:59:60)\\.\\d{6}Z$"},message:'must match pattern "^\\d{4}-[0-1]\\d-[0-3]\\dT(?:[0-2]\\d:[0-5]\\d:[0-5]\\d|23:59:60)\\.\\d{6}Z$"'}],!1}else return Zn.errors=[{instancePath:e+"/descriptor/messageTimestamp",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/$defs/date-time/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var p=L===a}else var p=!0;if(p){if(A.filters!==void 0){let q=A.filters,L=a;if(a===L)if(Array.isArray(q)){if(q.length<1)return Zn.errors=[{instancePath:e+"/descriptor/filters",schemaPath:"#/properties/descriptor/properties/filters/minItems",keyword:"minItems",params:{limit:1},message:"must NOT have fewer than 1 items"}],!1;{var w=!0;let F=q.length;for(let N=0;N<F;N++){let G=a;gt(q[N],{instancePath:e+"/descriptor/filters/"+N,parentData:q,parentDataProperty:N,rootData:i,dynamicAnchors:o})||(s=s===null?gt.errors:s.concat(gt.errors),a=s.length);var w=G===a;if(!w)break}}}else return Zn.errors=[{instancePath:e+"/descriptor/filters",schemaPath:"#/properties/descriptor/properties/filters/type",keyword:"type",params:{type:"array"},message:"must be array"}],!1;var p=L===a}else var p=!0;if(p)if(A.cursor!==void 0){let q=A.cursor,L=a;if(a===a)if(q&&typeof q=="object"&&!Array.isArray(q)){if(Object.keys(q).length<1)return Zn.errors=[{instancePath:e+"/descriptor/cursor",schemaPath:"https://identity.foundation/dwn/json-schemas/pagination-cursor.json/minProperties",keyword:"minProperties",params:{limit:1},message:"must NOT have fewer than 1 properties"}],!1;{let N;if(q.messageCid===void 0&&(N="messageCid")||q.value===void 0&&(N="value"))return Zn.errors=[{instancePath:e+"/descriptor/cursor",schemaPath:"https://identity.foundation/dwn/json-schemas/pagination-cursor.json/required",keyword:"required",params:{missingProperty:N},message:"must have required property '"+N+"'"}],!1;{let G=a;for(let x in q)if(!(x==="messageCid"||x==="value")){return Zn.errors=[{instancePath:e+"/descriptor/cursor",schemaPath:"https://identity.foundation/dwn/json-schemas/pagination-cursor.json/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:x},message:"must NOT have additional properties"}],!1;break}if(G===a){if(q.messageCid!==void 0){let x=a;if(typeof q.messageCid!="string")return Zn.errors=[{instancePath:e+"/descriptor/cursor/messageCid",schemaPath:"https://identity.foundation/dwn/json-schemas/pagination-cursor.json/properties/messageCid/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var P=x===a}else var P=!0;if(P)if(q.value!==void 0){let x=q.value,c=a;if(typeof x!="string"&&!(typeof x=="number"&&isFinite(x)))return Zn.errors=[{instancePath:e+"/descriptor/cursor/value",schemaPath:"https://identity.foundation/dwn/json-schemas/pagination-cursor.json/properties/value/type",keyword:"type",params:{type:zE.properties.value.type},message:"must be string,number"}],!1;var P=c===a}else var P=!0}}}}else return Zn.errors=[{instancePath:e+"/descriptor/cursor",schemaPath:"https://identity.foundation/dwn/json-schemas/pagination-cursor.json/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;var p=L===a}else var p=!0}}}}}}else return Zn.errors=[{instancePath:e+"/descriptor",schemaPath:"#/properties/descriptor/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;var m=B===a}else var m=!0}}}else return Zn.errors=[{instancePath:e,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;return Zn.errors=s,a===0}Zn.evaluated={props:!0,dynamicProps:!1,dynamicItems:!1};var o1e=Ms,nz={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://identity.foundation/dwn/json-schemas/events-subscribe.json",type:"object",additionalProperties:!1,required:["descriptor","authorization"],properties:{authorization:{$ref:"https://identity.foundation/dwn/json-schemas/authorization.json"},descriptor:{type:"object",additionalProperties:!1,required:["interface","method","messageTimestamp","filters"],properties:{interface:{enum:["Events"],type:"string"},method:{enum:["Subscribe"],type:"string"},messageTimestamp:{type:"string"},filters:{type:"array",items:{$ref:"https://identity.foundation/dwn/json-schemas/events-filter.json"}}}}}};function Ms(t,{instancePath:e="",parentData:r,parentDataProperty:n,rootData:i=t,dynamicAnchors:o={}}={}){let s=null,a=0,d=Ms.evaluated;if(d.dynamicProps&&(d.props=void 0),d.dynamicItems&&(d.items=void 0),a===0)if(t&&typeof t=="object"&&!Array.isArray(t)){let P;if(t.descriptor===void 0&&(P="descriptor")||t.authorization===void 0&&(P="authorization"))return Ms.errors=[{instancePath:e,schemaPath:"#/required",keyword:"required",params:{missingProperty:P},message:"must have required property '"+P+"'"}],!1;{let S=a;for(let M in t)if(!(M==="authorization"||M==="descriptor")){return Ms.errors=[{instancePath:e,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:M},message:"must NOT have additional properties"}],!1;break}if(S===a){if(t.authorization!==void 0){let M=a;Yn(t.authorization,{instancePath:e+"/authorization",parentData:t,parentDataProperty:"authorization",rootData:i,dynamicAnchors:o})||(s=s===null?Yn.errors:s.concat(Yn.errors),a=s.length);var m=M===a}else var m=!0;if(m)if(t.descriptor!==void 0){let M=t.descriptor,A=a;if(a===A)if(M&&typeof M=="object"&&!Array.isArray(M)){let I;if(M.interface===void 0&&(I="interface")||M.method===void 0&&(I="method")||M.messageTimestamp===void 0&&(I="messageTimestamp")||M.filters===void 0&&(I="filters"))return Ms.errors=[{instancePath:e+"/descriptor",schemaPath:"#/properties/descriptor/required",keyword:"required",params:{missingProperty:I},message:"must have required property '"+I+"'"}],!1;{let C=a;for(let k in M)if(!(k==="interface"||k==="method"||k==="messageTimestamp"||k==="filters")){return Ms.errors=[{instancePath:e+"/descriptor",schemaPath:"#/properties/descriptor/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:k},message:"must NOT have additional properties"}],!1;break}if(C===a){if(M.interface!==void 0){let k=M.interface,q=a;if(typeof k!="string")return Ms.errors=[{instancePath:e+"/descriptor/interface",schemaPath:"#/properties/descriptor/properties/interface/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;if(k!=="Events")return Ms.errors=[{instancePath:e+"/descriptor/interface",schemaPath:"#/properties/descriptor/properties/interface/enum",keyword:"enum",params:{allowedValues:nz.properties.descriptor.properties.interface.enum},message:"must be equal to one of the allowed values"}],!1;var p=q===a}else var p=!0;if(p){if(M.method!==void 0){let k=M.method,q=a;if(typeof k!="string")return Ms.errors=[{instancePath:e+"/descriptor/method",schemaPath:"#/properties/descriptor/properties/method/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;if(k!=="Subscribe")return Ms.errors=[{instancePath:e+"/descriptor/method",schemaPath:"#/properties/descriptor/properties/method/enum",keyword:"enum",params:{allowedValues:nz.properties.descriptor.properties.method.enum},message:"must be equal to one of the allowed values"}],!1;var p=q===a}else var p=!0;if(p){if(M.messageTimestamp!==void 0){let k=a;if(typeof M.messageTimestamp!="string")return Ms.errors=[{instancePath:e+"/descriptor/messageTimestamp",schemaPath:"#/properties/descriptor/properties/messageTimestamp/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var p=k===a}else var p=!0;if(p)if(M.filters!==void 0){let k=M.filters,q=a;if(a===q)if(Array.isArray(k)){var w=!0;let U=k.length;for(let F=0;F<U;F++){let N=a;gt(k[F],{instancePath:e+"/descriptor/filters/"+F,parentData:k,parentDataProperty:F,rootData:i,dynamicAnchors:o})||(s=s===null?gt.errors:s.concat(gt.errors),a=s.length);var w=N===a;if(!w)break}}else return Ms.errors=[{instancePath:e+"/descriptor/filters",schemaPath:"#/properties/descriptor/properties/filters/type",keyword:"type",params:{type:"array"},message:"must be array"}],!1;var p=q===a}else var p=!0}}}}}else return Ms.errors=[{instancePath:e+"/descriptor",schemaPath:"#/properties/descriptor/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;var m=A===a}else var m=!0}}}else return Ms.errors=[{instancePath:e,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;return Ms.errors=s,a===0}Ms.evaluated={props:!0,dynamicProps:!1,dynamicItems:!1};var s1e=R1;function R1(t,{instancePath:e="",parentData:r,parentDataProperty:n,rootData:i=t,dynamicAnchors:o={}}={}){let s=null,a=0,d=R1.evaluated;return d.dynamicProps&&(d.props=void 0),d.dynamicItems&&(d.items=void 0),t&&typeof t=="object"&&!Array.isArray(t)?(R1.errors=s,a===0):(R1.errors=[{instancePath:e,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1)}R1.evaluated={dynamicProps:!1,dynamicItems:!1};var a1e=zo;function zo(t,{instancePath:e="",parentData:r,parentDataProperty:n,rootData:i=t,dynamicAnchors:o={}}={}){let s=null,a=0,d=zo.evaluated;d.dynamicProps&&(d.props=void 0),d.dynamicItems&&(d.items=void 0);let m=a,p=!1,w=null,P=a;if(t&&typeof t=="object"&&!Array.isArray(t)){let L;if(t.crv===void 0&&(L="crv")||t.x===void 0&&(L="x")){let U={instancePath:e,schemaPath:"#/oneOf/0/required",keyword:"required",params:{missingProperty:L},message:"must have required property '"+L+"'"};s===null?s=[U]:s.push(U),a++}else{if(t.kty!==void 0){let U=a;if(t.kty!=="EC"){let F={instancePath:e+"/kty",schemaPath:"#/oneOf/0/properties/kty/const",keyword:"const",params:{allowedValue:"EC"},message:"must be equal to constant"};s===null?s=[F]:s.push(F),a++}var S=U===a}else var S=!0;if(S){if(t.crv!==void 0){let U=a;if(typeof t.crv!="string"){let N={instancePath:e+"/crv",schemaPath:"#/oneOf/0/properties/crv/type",keyword:"type",params:{type:"string"},message:"must be string"};s===null?s=[N]:s.push(N),a++}var S=U===a}else var S=!0;if(S){if(t.x!==void 0){let U=a;if(typeof t.x!="string"){let N={instancePath:e+"/x",schemaPath:"#/oneOf/0/properties/x/type",keyword:"type",params:{type:"string"},message:"must be string"};s===null?s=[N]:s.push(N),a++}var S=U===a}else var S=!0;if(S){if(t.y!==void 0){let U=a;if(typeof t.y!="string"){let N={instancePath:e+"/y",schemaPath:"#/oneOf/0/properties/y/type",keyword:"type",params:{type:"string"},message:"must be string"};s===null?s=[N]:s.push(N),a++}var S=U===a}else var S=!0;if(S)if(t.d!==void 0){let U=a;if(typeof t.d!="string"){let N={instancePath:e+"/d",schemaPath:"#/oneOf/0/properties/d/type",keyword:"type",params:{type:"string"},message:"must be string"};s===null?s=[N]:s.push(N),a++}var S=U===a}else var S=!0}}}}}var I=P===a;if(I){p=!0,w=0;var M={};M.kty=!0,M.crv=!0,M.x=!0,M.y=!0,M.d=!0}let A=a;if(t&&typeof t=="object"&&!Array.isArray(t)){let L;if(t.crv===void 0&&(L="crv")||t.x===void 0&&(L="x")){let U={instancePath:e,schemaPath:"#/oneOf/1/required",keyword:"required",params:{missingProperty:L},message:"must have required property '"+L+"'"};s===null?s=[U]:s.push(U),a++}else{if(t.kty!==void 0){let U=a;if(t.kty!=="OKP"){let F={instancePath:e+"/kty",schemaPath:"#/oneOf/1/properties/kty/const",keyword:"const",params:{allowedValue:"OKP"},message:"must be equal to constant"};s===null?s=[F]:s.push(F),a++}var B=U===a}else var B=!0;if(B){if(t.crv!==void 0){let U=a;if(typeof t.crv!="string"){let N={instancePath:e+"/crv",schemaPath:"#/oneOf/1/properties/crv/type",keyword:"type",params:{type:"string"},message:"must be string"};s===null?s=[N]:s.push(N),a++}var B=U===a}else var B=!0;if(B){if(t.x!==void 0){let U=a;if(typeof t.x!="string"){let N={instancePath:e+"/x",schemaPath:"#/oneOf/1/properties/x/type",keyword:"type",params:{type:"string"},message:"must be string"};s===null?s=[N]:s.push(N),a++}var B=U===a}else var B=!0;if(B)if(t.d!==void 0){let U=a;if(typeof t.d!="string"){let N={instancePath:e+"/d",schemaPath:"#/oneOf/1/properties/d/type",keyword:"type",params:{type:"string"},message:"must be string"};s===null?s=[N]:s.push(N),a++}var B=U===a}else var B=!0}}}}var I=A===a;if(I&&p)p=!1,w=[w,1];else{I&&(p=!0,w=1,M!==!0&&(M=M||{},M.kty=!0,M.crv=!0,M.x=!0,M.d=!0));let L=a;if(t&&typeof t=="object"&&!Array.isArray(t)){let F;if(t.n===void 0&&(F="n")||t.e===void 0&&(F="e")){let N={instancePath:e,schemaPath:"#/oneOf/2/required",keyword:"required",params:{missingProperty:F},message:"must have required property '"+F+"'"};s===null?s=[N]:s.push(N),a++}else{if(t.kty!==void 0){let N=a;if(t.kty!=="RSA"){let G={instancePath:e+"/kty",schemaPath:"#/oneOf/2/properties/kty/const",keyword:"const",params:{allowedValue:"RSA"},message:"must be equal to constant"};s===null?s=[G]:s.push(G),a++}var C=N===a}else var C=!0;if(C){if(t.n!==void 0){let N=a;if(typeof t.n!="string"){let x={instancePath:e+"/n",schemaPath:"#/oneOf/2/properties/n/type",keyword:"type",params:{type:"string"},message:"must be string"};s===null?s=[x]:s.push(x),a++}var C=N===a}else var C=!0;if(C){if(t.e!==void 0){let N=a;if(typeof t.e!="string"){let x={instancePath:e+"/e",schemaPath:"#/oneOf/2/properties/e/type",keyword:"type",params:{type:"string"},message:"must be string"};s===null?s=[x]:s.push(x),a++}var C=N===a}else var C=!0;if(C){if(t.d!==void 0){let N=a;if(typeof t.d!="string"){let x={instancePath:e+"/d",schemaPath:"#/oneOf/2/properties/d/type",keyword:"type",params:{type:"string"},message:"must be string"};s===null?s=[x]:s.push(x),a++}var C=N===a}else var C=!0;if(C){if(t.p!==void 0){let N=a;if(typeof t.p!="string"){let x={instancePath:e+"/p",schemaPath:"#/oneOf/2/properties/p/type",keyword:"type",params:{type:"string"},message:"must be string"};s===null?s=[x]:s.push(x),a++}var C=N===a}else var C=!0;if(C){if(t.q!==void 0){let N=a;if(typeof t.q!="string"){let x={instancePath:e+"/q",schemaPath:"#/oneOf/2/properties/q/type",keyword:"type",params:{type:"string"},message:"must be string"};s===null?s=[x]:s.push(x),a++}var C=N===a}else var C=!0;if(C){if(t.dp!==void 0){let N=a;if(typeof t.dp!="string"){let x={instancePath:e+"/dp",schemaPath:"#/oneOf/2/properties/dp/type",keyword:"type",params:{type:"string"},message:"must be string"};s===null?s=[x]:s.push(x),a++}var C=N===a}else var C=!0;if(C){if(t.dq!==void 0){let N=a;if(typeof t.dq!="string"){let x={instancePath:e+"/dq",schemaPath:"#/oneOf/2/properties/dq/type",keyword:"type",params:{type:"string"},message:"must be string"};s===null?s=[x]:s.push(x),a++}var C=N===a}else var C=!0;if(C){if(t.qi!==void 0){let N=a;if(typeof t.qi!="string"){let x={instancePath:e+"/qi",schemaPath:"#/oneOf/2/properties/qi/type",keyword:"type",params:{type:"string"},message:"must be string"};s===null?s=[x]:s.push(x),a++}var C=N===a}else var C=!0;if(C)if(t.oth!==void 0){let N=t.oth,G=a;if(!(N&&typeof N=="object"&&!Array.isArray(N))){let c={instancePath:e+"/oth",schemaPath:"#/oneOf/2/properties/oth/type",keyword:"type",params:{type:"object"},message:"must be object"};s===null?s=[c]:s.push(c),a++}var C=G===a}else var C=!0}}}}}}}}}}var I=L===a;if(I&&p)p=!1,w=[w,2];else{I&&(p=!0,w=2,M!==!0&&(M=M||{},M.kty=!0,M.n=!0,M.e=!0,M.d=!0,M.p=!0,M.q=!0,M.dp=!0,M.dq=!0,M.qi=!0,M.oth=!0));let F=a;if(t&&typeof t=="object"&&!Array.isArray(t)){let G;if(t.k===void 0&&(G="k")){let x={instancePath:e,schemaPath:"#/oneOf/3/required",keyword:"required",params:{missingProperty:G},message:"must have required property '"+G+"'"};s===null?s=[x]:s.push(x),a++}else{if(t.kty!==void 0){let x=a;if(t.kty!=="oct"){let c={instancePath:e+"/kty",schemaPath:"#/oneOf/3/properties/kty/const",keyword:"const",params:{allowedValue:"oct"},message:"must be equal to constant"};s===null?s=[c]:s.push(c),a++}var k=x===a}else var k=!0;if(k)if(t.k!==void 0){let x=a;if(typeof t.k!="string"){let u={instancePath:e+"/k",schemaPath:"#/oneOf/3/properties/k/type",keyword:"type",params:{type:"string"},message:"must be string"};s===null?s=[u]:s.push(u),a++}var k=x===a}else var k=!0}}var I=F===a;I&&p?(p=!1,w=[w,3]):I&&(p=!0,w=3,M!==!0&&(M=M||{},M.kty=!0,M.k=!0))}}if(p)a=m,s!==null&&(m?s.length=m:s=null);else{let L={instancePath:e,schemaPath:"#/oneOf",keyword:"oneOf",params:{passingSchemas:w},message:"must match exactly one schema in oneOf"};return s===null?s=[L]:s.push(L),a++,zo.errors=s,!1}if(a===0)if(t&&typeof t=="object"&&!Array.isArray(t)){let L;if(t.kty===void 0&&(L="kty"))return zo.errors=[{instancePath:e,schemaPath:"#/required",keyword:"required",params:{missingProperty:L},message:"must have required property '"+L+"'"}],!1;if(M!==!0&&(M=M||{},M.alg=!0,M.kid=!0,M.kty=!0,M.crv=!0,M.use=!0,M.key_ops=!0,M.x5u=!0,M.x5c=!0,M.x5t=!0,M["x5t#S256"]=!0),t.alg!==void 0){let U=a;if(typeof t.alg!="string")return zo.errors=[{instancePath:e+"/alg",schemaPath:"#/properties/alg/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var q=U===a}else var q=!0;if(q){if(t.kid!==void 0){let U=a;if(typeof t.kid!="string")return zo.errors=[{instancePath:e+"/kid",schemaPath:"#/properties/kid/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var q=U===a}else var q=!0;if(q){if(t.kty!==void 0){let U=t.kty,F=a;if(!(U==="EC"||U==="RSA"||U==="oct"||U==="OKP"))return zo.errors=[{instancePath:e+"/kty",schemaPath:"#/properties/kty/enum",keyword:"enum",params:{allowedValues:lz.properties.kty.enum},message:"must be equal to one of the allowed values"}],!1;var q=F===a}else var q=!0;if(q){if(t.crv!==void 0){let U=a;if(typeof t.crv!="string")return zo.errors=[{instancePath:e+"/crv",schemaPath:"#/properties/crv/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var q=U===a}else var q=!0;if(q){if(t.use!==void 0){let U=a;if(typeof t.use!="string")return zo.errors=[{instancePath:e+"/use",schemaPath:"#/properties/use/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var q=U===a}else var q=!0;if(q){if(t.key_ops!==void 0){let U=a;if(typeof t.key_ops!="string")return zo.errors=[{instancePath:e+"/key_ops",schemaPath:"#/properties/key_ops/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var q=U===a}else var q=!0;if(q){if(t.x5u!==void 0){let U=a;if(typeof t.x5u!="string")return zo.errors=[{instancePath:e+"/x5u",schemaPath:"#/properties/x5u/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var q=U===a}else var q=!0;if(q){if(t.x5c!==void 0){let U=a;if(typeof t.x5c!="string")return zo.errors=[{instancePath:e+"/x5c",schemaPath:"#/properties/x5c/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var q=U===a}else var q=!0;if(q){if(t.x5t!==void 0){let U=a;if(typeof t.x5t!="string")return zo.errors=[{instancePath:e+"/x5t",schemaPath:"#/properties/x5t/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var q=U===a}else var q=!0;if(q)if(t["x5t#S256"]!==void 0){let U=a;if(typeof t["x5t#S256"]!="string")return zo.errors=[{instancePath:e+"/x5t#S256",schemaPath:"#/properties/x5t%23S256/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var q=U===a}else var q=!0}}}}}}}}}else return zo.errors=[{instancePath:e,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;return zo.errors=s,d.props=M,a===0}zo.evaluated={dynamicProps:!0,dynamicItems:!1};var c1e=cn,f1e=_f,u1e={$id:"https://identity.foundation/dwn/json-schemas/jwk-verification-method.json",$schema:"https://json-schema.org/draft/2020-12/schema",type:"object",additionalProperties:!1,required:["id","type","controller","publicKeyJwk"],properties:{id:{type:"string"},type:{enum:["JsonWebKey","JsonWebKey2020"]},controller:{$ref:"https://identity.foundation/dwn/json-schemas/defs.json#/$defs/did"},publicKeyJwk:{$ref:"https://identity.foundation/dwn/json-schemas/public-jwk.json"}}};function _f(t,{instancePath:e="",parentData:r,parentDataProperty:n,rootData:i=t,dynamicAnchors:o={}}={}){let s=null,a=0,d=_f.evaluated;if(d.dynamicProps&&(d.props=void 0),d.dynamicItems&&(d.items=void 0),a===0)if(t&&typeof t=="object"&&!Array.isArray(t)){let p;if(t.id===void 0&&(p="id")||t.type===void 0&&(p="type")||t.controller===void 0&&(p="controller")||t.publicKeyJwk===void 0&&(p="publicKeyJwk"))return _f.errors=[{instancePath:e,schemaPath:"#/required",keyword:"required",params:{missingProperty:p},message:"must have required property '"+p+"'"}],!1;{let w=a;for(let P in t)if(!(P==="id"||P==="type"||P==="controller"||P==="publicKeyJwk")){return _f.errors=[{instancePath:e,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:P},message:"must NOT have additional properties"}],!1;break}if(w===a){if(t.id!==void 0){let P=a;if(typeof t.id!="string")return _f.errors=[{instancePath:e+"/id",schemaPath:"#/properties/id/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var m=P===a}else var m=!0;if(m){if(t.type!==void 0){let P=t.type,S=a;if(!(P==="JsonWebKey"||P==="JsonWebKey2020"))return _f.errors=[{instancePath:e+"/type",schemaPath:"#/properties/type/enum",keyword:"enum",params:{allowedValues:u1e.properties.type.enum},message:"must be equal to one of the allowed values"}],!1;var m=S===a}else var m=!0;if(m){if(t.controller!==void 0){let P=t.controller,S=a;if(a===a)if(typeof P=="string"){if(!K0.test(P))return _f.errors=[{instancePath:e+"/controller",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/$defs/did/pattern",keyword:"pattern",params:{pattern:"^did:([a-z0-9]+):((?:(?:[a-zA-Z0-9._-]|(?:%[0-9a-fA-F]{2}))*:)*((?:[a-zA-Z0-9._-]|(?:%[0-9a-fA-F]{2}))+))((;[a-zA-Z0-9_.:%-]+=[a-zA-Z0-9_.:%-]*)*)(/[^#?]*)?([?][^#]*)?(#.*)?$"},message:'must match pattern "^did:([a-z0-9]+):((?:(?:[a-zA-Z0-9._-]|(?:%[0-9a-fA-F]{2}))*:)*((?:[a-zA-Z0-9._-]|(?:%[0-9a-fA-F]{2}))+))((;[a-zA-Z0-9_.:%-]+=[a-zA-Z0-9_.:%-]*)*)(/[^#?]*)?([?][^#]*)?(#.*)?$"'}],!1}else return _f.errors=[{instancePath:e+"/controller",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/$defs/did/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var m=S===a}else var m=!0;if(m)if(t.publicKeyJwk!==void 0){let P=a;an(t.publicKeyJwk,{instancePath:e+"/publicKeyJwk",parentData:t,parentDataProperty:"publicKeyJwk",rootData:i,dynamicAnchors:o})||(s=s===null?an.errors:s.concat(an.errors),a=s.length);var m=P===a}else var m=!0}}}}}else return _f.errors=[{instancePath:e,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;return _f.errors=s,a===0}_f.evaluated={props:!0,dynamicProps:!1,dynamicItems:!1};var l1e=so,iz={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://identity.foundation/dwn/json-schemas/messages-get.json",type:"object",additionalProperties:!1,required:["authorization","descriptor"],properties:{authorization:{$ref:"https://identity.foundation/dwn/json-schemas/authorization.json"},descriptor:{type:"object",additionalProperties:!1,required:["interface","method","messageTimestamp"],properties:{interface:{enum:["Messages"],type:"string"},method:{enum:["Get"],type:"string"},messageTimestamp:{$ref:"https://identity.foundation/dwn/json-schemas/defs.json#/$defs/date-time"},messageCids:{type:"array",items:{type:"string"},minItems:1}}}}};function so(t,{instancePath:e="",parentData:r,parentDataProperty:n,rootData:i=t,dynamicAnchors:o={}}={}){let s=null,a=0,d=so.evaluated;if(d.dynamicProps&&(d.props=void 0),d.dynamicItems&&(d.items=void 0),a===0)if(t&&typeof t=="object"&&!Array.isArray(t)){let P;if(t.authorization===void 0&&(P="authorization")||t.descriptor===void 0&&(P="descriptor"))return so.errors=[{instancePath:e,schemaPath:"#/required",keyword:"required",params:{missingProperty:P},message:"must have required property '"+P+"'"}],!1;{let S=a;for(let M in t)if(!(M==="authorization"||M==="descriptor")){return so.errors=[{instancePath:e,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:M},message:"must NOT have additional properties"}],!1;break}if(S===a){if(t.authorization!==void 0){let M=a;Yn(t.authorization,{instancePath:e+"/authorization",parentData:t,parentDataProperty:"authorization",rootData:i,dynamicAnchors:o})||(s=s===null?Yn.errors:s.concat(Yn.errors),a=s.length);var m=M===a}else var m=!0;if(m)if(t.descriptor!==void 0){let M=t.descriptor,A=a;if(a===A)if(M&&typeof M=="object"&&!Array.isArray(M)){let I;if(M.interface===void 0&&(I="interface")||M.method===void 0&&(I="method")||M.messageTimestamp===void 0&&(I="messageTimestamp"))return so.errors=[{instancePath:e+"/descriptor",schemaPath:"#/properties/descriptor/required",keyword:"required",params:{missingProperty:I},message:"must have required property '"+I+"'"}],!1;{let C=a;for(let k in M)if(!(k==="interface"||k==="method"||k==="messageTimestamp"||k==="messageCids")){return so.errors=[{instancePath:e+"/descriptor",schemaPath:"#/properties/descriptor/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:k},message:"must NOT have additional properties"}],!1;break}if(C===a){if(M.interface!==void 0){let k=M.interface,q=a;if(typeof k!="string")return so.errors=[{instancePath:e+"/descriptor/interface",schemaPath:"#/properties/descriptor/properties/interface/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;if(k!=="Messages")return so.errors=[{instancePath:e+"/descriptor/interface",schemaPath:"#/properties/descriptor/properties/interface/enum",keyword:"enum",params:{allowedValues:iz.properties.descriptor.properties.interface.enum},message:"must be equal to one of the allowed values"}],!1;var p=q===a}else var p=!0;if(p){if(M.method!==void 0){let k=M.method,q=a;if(typeof k!="string")return so.errors=[{instancePath:e+"/descriptor/method",schemaPath:"#/properties/descriptor/properties/method/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;if(k!=="Get")return so.errors=[{instancePath:e+"/descriptor/method",schemaPath:"#/properties/descriptor/properties/method/enum",keyword:"enum",params:{allowedValues:iz.properties.descriptor.properties.method.enum},message:"must be equal to one of the allowed values"}],!1;var p=q===a}else var p=!0;if(p){if(M.messageTimestamp!==void 0){let k=M.messageTimestamp,q=a;if(a===a)if(typeof k=="string"){if(!Jn.test(k))return so.errors=[{instancePath:e+"/descriptor/messageTimestamp",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/$defs/date-time/pattern",keyword:"pattern",params:{pattern:"^\\d{4}-[0-1]\\d-[0-3]\\dT(?:[0-2]\\d:[0-5]\\d:[0-5]\\d|23:59:60)\\.\\d{6}Z$"},message:'must match pattern "^\\d{4}-[0-1]\\d-[0-3]\\dT(?:[0-2]\\d:[0-5]\\d:[0-5]\\d|23:59:60)\\.\\d{6}Z$"'}],!1}else return so.errors=[{instancePath:e+"/descriptor/messageTimestamp",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/$defs/date-time/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var p=q===a}else var p=!0;if(p)if(M.messageCids!==void 0){let k=M.messageCids,q=a;if(a===q)if(Array.isArray(k)){if(k.length<1)return so.errors=[{instancePath:e+"/descriptor/messageCids",schemaPath:"#/properties/descriptor/properties/messageCids/minItems",keyword:"minItems",params:{limit:1},message:"must NOT have fewer than 1 items"}],!1;{var w=!0;let U=k.length;for(let F=0;F<U;F++){let N=a;if(typeof k[F]!="string")return so.errors=[{instancePath:e+"/descriptor/messageCids/"+F,schemaPath:"#/properties/descriptor/properties/messageCids/items/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var w=N===a;if(!w)break}}}else return so.errors=[{instancePath:e+"/descriptor/messageCids",schemaPath:"#/properties/descriptor/properties/messageCids/type",keyword:"type",params:{type:"array"},message:"must be array"}],!1;var p=q===a}else var p=!0}}}}}else return so.errors=[{instancePath:e+"/descriptor",schemaPath:"#/properties/descriptor/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;var m=A===a}else var m=!0}}}else return so.errors=[{instancePath:e,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;return so.errors=s,a===0}so.evaluated={props:!0,dynamicProps:!1,dynamicItems:!1};var d1e=Ys;function Ys(t,{instancePath:e="",parentData:r,parentDataProperty:n,rootData:i=t,dynamicAnchors:o={}}={}){let s=null,a=0,d=Ys.evaluated;if(d.dynamicProps&&(d.props=void 0),d.dynamicItems&&(d.items=void 0),a===0)if(t&&typeof t=="object"&&!Array.isArray(t)){if(Object.keys(t).length<1)return Ys.errors=[{instancePath:e,schemaPath:"#/minProperties",keyword:"minProperties",params:{limit:1},message:"must NOT have fewer than 1 properties"}],!1;{let A=a;for(let B in t)if(!(B==="gt"||B==="gte"||B==="lt"||B==="lte")){return Ys.errors=[{instancePath:e,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:B},message:"must NOT have additional properties"}],!1;break}if(A===a){if(t.gt!==void 0){let B=a,I=a,C=a;if(t&&typeof t=="object"&&!Array.isArray(t)){let k;if(t.gte===void 0&&(k="gte")){let q={};s===null?s=[q]:s.push(q),a++}}var m=C===a;if(m)return Ys.errors=[{instancePath:e,schemaPath:"#/dependencies/gt/not",keyword:"not",params:{},message:"must NOT be valid"}],!1;a=I,s!==null&&(I?s.length=I:s=null);var p=B===a}else var p=!0;if(p){if(t.gte!==void 0){let B=a,I=a,C=a;if(t&&typeof t=="object"&&!Array.isArray(t)){let q;if(t.gt===void 0&&(q="gt")){let L={};s===null?s=[L]:s.push(L),a++}}var w=C===a;if(w)return Ys.errors=[{instancePath:e,schemaPath:"#/dependencies/gte/not",keyword:"not",params:{},message:"must NOT be valid"}],!1;a=I,s!==null&&(I?s.length=I:s=null);var p=B===a}else var p=!0;if(p){if(t.lt!==void 0){let B=a,I=a,C=a;if(t&&typeof t=="object"&&!Array.isArray(t)){let q;if(t.lte===void 0&&(q="lte")){let L={};s===null?s=[L]:s.push(L),a++}}var P=C===a;if(P)return Ys.errors=[{instancePath:e,schemaPath:"#/dependencies/lt/not",keyword:"not",params:{},message:"must NOT be valid"}],!1;a=I,s!==null&&(I?s.length=I:s=null);var p=B===a}else var p=!0;if(p){if(t.lte!==void 0){let B=a,I=a,C=a;if(t&&typeof t=="object"&&!Array.isArray(t)){let q;if(t.lt===void 0&&(q="lt")){let L={};s===null?s=[L]:s.push(L),a++}}var S=C===a;if(S)return Ys.errors=[{instancePath:e,schemaPath:"#/dependencies/lte/not",keyword:"not",params:{},message:"must NOT be valid"}],!1;a=I,s!==null&&(I?s.length=I:s=null);var p=B===a}else var p=!0;if(p){if(t.gt!==void 0){let B=t.gt,I=a;if(!(typeof B=="number"&&isFinite(B)))return Ys.errors=[{instancePath:e+"/gt",schemaPath:"#/properties/gt/type",keyword:"type",params:{type:"number"},message:"must be number"}],!1;var M=I===a}else var M=!0;if(M){if(t.gte!==void 0){let B=t.gte,I=a;if(!(typeof B=="number"&&isFinite(B)))return Ys.errors=[{instancePath:e+"/gte",schemaPath:"#/properties/gte/type",keyword:"type",params:{type:"number"},message:"must be number"}],!1;var M=I===a}else var M=!0;if(M){if(t.lt!==void 0){let B=t.lt,I=a;if(!(typeof B=="number"&&isFinite(B)))return Ys.errors=[{instancePath:e+"/lt",schemaPath:"#/properties/lt/type",keyword:"type",params:{type:"number"},message:"must be number"}],!1;var M=I===a}else var M=!0;if(M)if(t.lte!==void 0){let B=t.lte,I=a;if(!(typeof B=="number"&&isFinite(B)))return Ys.errors=[{instancePath:e+"/lte",schemaPath:"#/properties/lte/type",keyword:"type",params:{type:"number"},message:"must be number"}],!1;var M=I===a}else var M=!0}}}}}}}}}else return Ys.errors=[{instancePath:e,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;return Ys.errors=s,a===0}Ys.evaluated={props:!0,dynamicProps:!1,dynamicItems:!1};var h1e=Ru;function Ru(t,{instancePath:e="",parentData:r,parentDataProperty:n,rootData:i=t,dynamicAnchors:o={}}={}){let s=null,a=0,d=Ru.evaluated;if(d.dynamicProps&&(d.props=void 0),d.dynamicItems&&(d.items=void 0),a===0)if(t&&typeof t=="object"&&!Array.isArray(t)){if(Object.keys(t).length<1)return Ru.errors=[{instancePath:e,schemaPath:"#/minProperties",keyword:"minProperties",params:{limit:1},message:"must NOT have fewer than 1 properties"}],!1;{let p;if(t.messageCid===void 0&&(p="messageCid")||t.value===void 0&&(p="value"))return Ru.errors=[{instancePath:e,schemaPath:"#/required",keyword:"required",params:{missingProperty:p},message:"must have required property '"+p+"'"}],!1;{let w=a;for(let P in t)if(!(P==="messageCid"||P==="value")){return Ru.errors=[{instancePath:e,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:P},message:"must NOT have additional properties"}],!1;break}if(w===a){if(t.messageCid!==void 0){let P=a;if(typeof t.messageCid!="string")return Ru.errors=[{instancePath:e+"/messageCid",schemaPath:"#/properties/messageCid/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var m=P===a}else var m=!0;if(m)if(t.value!==void 0){let P=t.value,S=a;if(typeof P!="string"&&!(typeof P=="number"&&isFinite(P)))return Ru.errors=[{instancePath:e+"/value",schemaPath:"#/properties/value/type",keyword:"type",params:{type:zE.properties.value.type},message:"must be string,number"}],!1;var m=S===a}else var m=!0}}}}else return Ru.errors=[{instancePath:e,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;return Ru.errors=s,a===0}Ru.evaluated={props:!0,dynamicProps:!1,dynamicItems:!1};var p1e=Ps;var dz={type:"object",additionalProperties:!1,properties:{publication:{enum:["Required","Prohibited"],type:"string"}}};function G0(t,{instancePath:e="",parentData:r,parentDataProperty:n,rootData:i=t,dynamicAnchors:o={}}={}){let s=null,a=0,d=G0.evaluated;d.dynamicProps&&(d.props=void 0),d.dynamicItems&&(d.items=void 0);let m=a,p=!1,w=null,P=a;if(a===a)if(t&&typeof t=="object"&&!Array.isArray(t)){if(t.interface!==void 0){let N=a;if(t.interface!=="Protocols"){let G={instancePath:e+"/interface",schemaPath:"https://identity.foundation/dwn/json-schemas/permissions/scopes.json#/$defs/protocols-query-scope/properties/interface/const",keyword:"const",params:{allowedValue:"Protocols"},message:"must be equal to constant"};s===null?s=[G]:s.push(G),a++}var M=N===a}else var M=!0;if(M)if(t.method!==void 0){let N=a;if(t.method!=="Query"){let x={instancePath:e+"/method",schemaPath:"https://identity.foundation/dwn/json-schemas/permissions/scopes.json#/$defs/protocols-query-scope/properties/method/const",keyword:"const",params:{allowedValue:"Query"},message:"must be equal to constant"};s===null?s=[x]:s.push(x),a++}var M=N===a}else var M=!0}else{let N={instancePath:e,schemaPath:"https://identity.foundation/dwn/json-schemas/permissions/scopes.json#/$defs/protocols-query-scope/type",keyword:"type",params:{type:"object"},message:"must be object"};s===null?s=[N]:s.push(N),a++}var k=P===a;if(k){p=!0,w=0;var A={};A.interface=!0,A.method=!0}let B=a;if(a===a)if(t&&typeof t=="object"&&!Array.isArray(t)){let N;if(t.interface===void 0&&(N="interface")||t.method===void 0&&(N="method")){let G={instancePath:e,schemaPath:"https://identity.foundation/dwn/json-schemas/permissions/scopes.json#/$defs/records-read-scope/required",keyword:"required",params:{missingProperty:N},message:"must have required property '"+N+"'"};s===null?s=[G]:s.push(G),a++}else{if(t.interface!==void 0){let G=a;if(t.interface!=="Records"){let x={instancePath:e+"/interface",schemaPath:"https://identity.foundation/dwn/json-schemas/permissions/scopes.json#/$defs/records-read-scope/properties/interface/const",keyword:"const",params:{allowedValue:"Records"},message:"must be equal to constant"};s===null?s=[x]:s.push(x),a++}var C=G===a}else var C=!0;if(C){if(t.method!==void 0){let G=a;if(t.method!=="Read"){let c={instancePath:e+"/method",schemaPath:"https://identity.foundation/dwn/json-schemas/permissions/scopes.json#/$defs/records-read-scope/properties/method/const",keyword:"const",params:{allowedValue:"Read"},message:"must be equal to constant"};s===null?s=[c]:s.push(c),a++}var C=G===a}else var C=!0;if(C){if(t.schema!==void 0){let G=a;if(typeof t.schema!="string"){let c={instancePath:e+"/schema",schemaPath:"https://identity.foundation/dwn/json-schemas/permissions/scopes.json#/$defs/records-read-scope/properties/schema/type",keyword:"type",params:{type:"string"},message:"must be string"};s===null?s=[c]:s.push(c),a++}var C=G===a}else var C=!0;if(C){if(t.protocol!==void 0){let G=a;if(typeof t.protocol!="string"){let c={instancePath:e+"/protocol",schemaPath:"https://identity.foundation/dwn/json-schemas/permissions/scopes.json#/$defs/records-read-scope/properties/protocol/type",keyword:"type",params:{type:"string"},message:"must be string"};s===null?s=[c]:s.push(c),a++}var C=G===a}else var C=!0;if(C){if(t.contextId!==void 0){let G=a;if(typeof t.contextId!="string"){let c={instancePath:e+"/contextId",schemaPath:"https://identity.foundation/dwn/json-schemas/permissions/scopes.json#/$defs/records-read-scope/properties/contextId/type",keyword:"type",params:{type:"string"},message:"must be string"};s===null?s=[c]:s.push(c),a++}var C=G===a}else var C=!0;if(C)if(t.protocolPath!==void 0){let G=a;if(typeof t.protocolPath!="string"){let c={instancePath:e+"/protocolPath",schemaPath:"https://identity.foundation/dwn/json-schemas/permissions/scopes.json#/$defs/records-read-scope/properties/protocolPath/type",keyword:"type",params:{type:"string"},message:"must be string"};s===null?s=[c]:s.push(c),a++}var C=G===a}else var C=!0}}}}}}else{let N={instancePath:e,schemaPath:"https://identity.foundation/dwn/json-schemas/permissions/scopes.json#/$defs/records-read-scope/type",keyword:"type",params:{type:"object"},message:"must be object"};s===null?s=[N]:s.push(N),a++}var k=B===a;if(k&&p)p=!1,w=[w,1];else{k&&(p=!0,w=1,A!==!0&&(A=A||{},A.interface=!0,A.method=!0,A.schema=!0,A.protocol=!0,A.contextId=!0,A.protocolPath=!0));let N=a;if(a===a)if(t&&typeof t=="object"&&!Array.isArray(t)){let c;if(t.interface===void 0&&(c="interface")||t.method===void 0&&(c="method")){let u={instancePath:e,schemaPath:"https://identity.foundation/dwn/json-schemas/permissions/scopes.json#/$defs/records-delete-scope/required",keyword:"required",params:{missingProperty:c},message:"must have required property '"+c+"'"};s===null?s=[u]:s.push(u),a++}else{if(t.interface!==void 0){let u=a;if(t.interface!=="Records"){let y={instancePath:e+"/interface",schemaPath:"https://identity.foundation/dwn/json-schemas/permissions/scopes.json#/$defs/records-delete-scope/properties/interface/const",keyword:"const",params:{allowedValue:"Records"},message:"must be equal to constant"};s===null?s=[y]:s.push(y),a++}var q=u===a}else var q=!0;if(q){if(t.method!==void 0){let u=a;if(t.method!=="Delete"){let l={instancePath:e+"/method",schemaPath:"https://identity.foundation/dwn/json-schemas/permissions/scopes.json#/$defs/records-delete-scope/properties/method/const",keyword:"const",params:{allowedValue:"Delete"},message:"must be equal to constant"};s===null?s=[l]:s.push(l),a++}var q=u===a}else var q=!0;if(q){if(t.protocol!==void 0){let u=a;if(typeof t.protocol!="string"){let l={instancePath:e+"/protocol",schemaPath:"https://identity.foundation/dwn/json-schemas/permissions/scopes.json#/$defs/records-delete-scope/properties/protocol/type",keyword:"type",params:{type:"string"},message:"must be string"};s===null?s=[l]:s.push(l),a++}var q=u===a}else var q=!0;if(q)if(t.schema!==void 0){let u=a;if(typeof t.schema!="string"){let l={instancePath:e+"/schema",schemaPath:"https://identity.foundation/dwn/json-schemas/permissions/scopes.json#/$defs/records-delete-scope/properties/schema/type",keyword:"type",params:{type:"string"},message:"must be string"};s===null?s=[l]:s.push(l),a++}var q=u===a}else var q=!0}}}}else{let c={instancePath:e,schemaPath:"https://identity.foundation/dwn/json-schemas/permissions/scopes.json#/$defs/records-delete-scope/type",keyword:"type",params:{type:"object"},message:"must be object"};s===null?s=[c]:s.push(c),a++}var k=N===a;if(k&&p)p=!1,w=[w,2];else{k&&(p=!0,w=2,A!==!0&&(A=A||{},A.interface=!0,A.method=!0,A.protocol=!0,A.schema=!0));let c=a;if(a===a)if(t&&typeof t=="object"&&!Array.isArray(t)){let l;if(t.interface===void 0&&(l="interface")||t.method===void 0&&(l="method")){let h={instancePath:e,schemaPath:"https://identity.foundation/dwn/json-schemas/permissions/scopes.json#/$defs/records-write-scope/required",keyword:"required",params:{missingProperty:l},message:"must have required property '"+l+"'"};s===null?s=[h]:s.push(h),a++}else{if(t.interface!==void 0){let h=a;if(t.interface!=="Records"){let b={instancePath:e+"/interface",schemaPath:"https://identity.foundation/dwn/json-schemas/permissions/scopes.json#/$defs/records-write-scope/properties/interface/const",keyword:"const",params:{allowedValue:"Records"},message:"must be equal to constant"};s===null?s=[b]:s.push(b),a++}var L=h===a}else var L=!0;if(L){if(t.method!==void 0){let h=a;if(t.method!=="Write"){let _={instancePath:e+"/method",schemaPath:"https://identity.foundation/dwn/json-schemas/permissions/scopes.json#/$defs/records-write-scope/properties/method/const",keyword:"const",params:{allowedValue:"Write"},message:"must be equal to constant"};s===null?s=[_]:s.push(_),a++}var L=h===a}else var L=!0;if(L){if(t.schema!==void 0){let h=a;if(typeof t.schema!="string"){let _={instancePath:e+"/schema",schemaPath:"https://identity.foundation/dwn/json-schemas/permissions/scopes.json#/$defs/records-write-scope/properties/schema/type",keyword:"type",params:{type:"string"},message:"must be string"};s===null?s=[_]:s.push(_),a++}var L=h===a}else var L=!0;if(L){if(t.protocol!==void 0){let h=a;if(typeof t.protocol!="string"){let _={instancePath:e+"/protocol",schemaPath:"https://identity.foundation/dwn/json-schemas/permissions/scopes.json#/$defs/records-write-scope/properties/protocol/type",keyword:"type",params:{type:"string"},message:"must be string"};s===null?s=[_]:s.push(_),a++}var L=h===a}else var L=!0;if(L){if(t.contextId!==void 0){let h=a;if(typeof t.contextId!="string"){let _={instancePath:e+"/contextId",schemaPath:"https://identity.foundation/dwn/json-schemas/permissions/scopes.json#/$defs/records-write-scope/properties/contextId/type",keyword:"type",params:{type:"string"},message:"must be string"};s===null?s=[_]:s.push(_),a++}var L=h===a}else var L=!0;if(L)if(t.protocolPath!==void 0){let h=a;if(typeof t.protocolPath!="string"){let _={instancePath:e+"/protocolPath",schemaPath:"https://identity.foundation/dwn/json-schemas/permissions/scopes.json#/$defs/records-write-scope/properties/protocolPath/type",keyword:"type",params:{type:"string"},message:"must be string"};s===null?s=[_]:s.push(_),a++}var L=h===a}else var L=!0}}}}}}else{let l={instancePath:e,schemaPath:"https://identity.foundation/dwn/json-schemas/permissions/scopes.json#/$defs/records-write-scope/type",keyword:"type",params:{type:"object"},message:"must be object"};s===null?s=[l]:s.push(l),a++}var k=c===a;if(k&&p)p=!1,w=[w,3];else{k&&(p=!0,w=3,A!==!0&&(A=A||{},A.interface=!0,A.method=!0,A.schema=!0,A.protocol=!0,A.contextId=!0,A.protocolPath=!0));let l=a;if(a===a)if(t&&typeof t=="object"&&!Array.isArray(t)){let _;if(t.interface===void 0&&(_="interface")||t.method===void 0&&(_="method")){let g={instancePath:e,schemaPath:"https://identity.foundation/dwn/json-schemas/permissions/scopes.json#/$defs/records-query-scope/required",keyword:"required",params:{missingProperty:_},message:"must have required property '"+_+"'"};s===null?s=[g]:s.push(g),a++}else{if(t.interface!==void 0){let g=a;if(t.interface!=="Records"){let f={instancePath:e+"/interface",schemaPath:"https://identity.foundation/dwn/json-schemas/permissions/scopes.json#/$defs/records-query-scope/properties/interface/const",keyword:"const",params:{allowedValue:"Records"},message:"must be equal to constant"};s===null?s=[f]:s.push(f),a++}var U=g===a}else var U=!0;if(U){if(t.method!==void 0){let g=a;if(t.method!=="Query"){let v={instancePath:e+"/method",schemaPath:"https://identity.foundation/dwn/json-schemas/permissions/scopes.json#/$defs/records-query-scope/properties/method/const",keyword:"const",params:{allowedValue:"Query"},message:"must be equal to constant"};s===null?s=[v]:s.push(v),a++}var U=g===a}else var U=!0;if(U)if(t.protocol!==void 0){let g=a;if(typeof t.protocol!="string"){let v={instancePath:e+"/protocol",schemaPath:"https://identity.foundation/dwn/json-schemas/permissions/scopes.json#/$defs/records-query-scope/properties/protocol/type",keyword:"type",params:{type:"string"},message:"must be string"};s===null?s=[v]:s.push(v),a++}var U=g===a}else var U=!0}}}else{let _={instancePath:e,schemaPath:"https://identity.foundation/dwn/json-schemas/permissions/scopes.json#/$defs/records-query-scope/type",keyword:"type",params:{type:"object"},message:"must be object"};s===null?s=[_]:s.push(_),a++}var k=l===a;if(k&&p)p=!1,w=[w,4];else{k&&(p=!0,w=4,A!==!0&&(A=A||{},A.interface=!0,A.method=!0,A.protocol=!0));let _=a;if(a===a)if(t&&typeof t=="object"&&!Array.isArray(t)){let v;if(t.interface===void 0&&(v="interface")||t.method===void 0&&(v="method")){let O={instancePath:e,schemaPath:"https://identity.foundation/dwn/json-schemas/permissions/scopes.json#/$defs/records-subscribe-scope/required",keyword:"required",params:{missingProperty:v},message:"must have required property '"+v+"'"};s===null?s=[O]:s.push(O),a++}else{if(t.interface!==void 0){let O=a;if(t.interface!=="Records"){let T={instancePath:e+"/interface",schemaPath:"https://identity.foundation/dwn/json-schemas/permissions/scopes.json#/$defs/records-subscribe-scope/properties/interface/const",keyword:"const",params:{allowedValue:"Records"},message:"must be equal to constant"};s===null?s=[T]:s.push(T),a++}var F=O===a}else var F=!0;if(F){if(t.method!==void 0){let O=a;if(t.method!=="Subscribe"){let R={instancePath:e+"/method",schemaPath:"https://identity.foundation/dwn/json-schemas/permissions/scopes.json#/$defs/records-subscribe-scope/properties/method/const",keyword:"const",params:{allowedValue:"Subscribe"},message:"must be equal to constant"};s===null?s=[R]:s.push(R),a++}var F=O===a}else var F=!0;if(F)if(t.protocol!==void 0){let O=a;if(typeof t.protocol!="string"){let R={instancePath:e+"/protocol",schemaPath:"https://identity.foundation/dwn/json-schemas/permissions/scopes.json#/$defs/records-subscribe-scope/properties/protocol/type",keyword:"type",params:{type:"string"},message:"must be string"};s===null?s=[R]:s.push(R),a++}var F=O===a}else var F=!0}}}else{let v={instancePath:e,schemaPath:"https://identity.foundation/dwn/json-schemas/permissions/scopes.json#/$defs/records-subscribe-scope/type",keyword:"type",params:{type:"object"},message:"must be object"};s===null?s=[v]:s.push(v),a++}var k=_===a;k&&p?(p=!1,w=[w,5]):k&&(p=!0,w=5,A!==!0&&(A=A||{},A.interface=!0,A.method=!0,A.protocol=!0))}}}}if(p)a=m,s!==null&&(m?s.length=m:s=null);else{let N={instancePath:e,schemaPath:"#/oneOf",keyword:"oneOf",params:{passingSchemas:w},message:"must match exactly one schema in oneOf"};return s===null?s=[N]:s.push(N),a++,G0.errors=s,!1}return G0.errors=s,d.props=A,a===0}G0.evaluated={dynamicProps:!0,dynamicItems:!1};function Ps(t,{instancePath:e="",parentData:r,parentDataProperty:n,rootData:i=t,dynamicAnchors:o={}}={}){let s=null,a=0,d=Ps.evaluated;if(d.dynamicProps&&(d.props=void 0),d.dynamicItems&&(d.items=void 0),a===0)if(t&&typeof t=="object"&&!Array.isArray(t)){let p;if(t.dateExpires===void 0&&(p="dateExpires")||t.scope===void 0&&(p="scope"))return Ps.errors=[{instancePath:e,schemaPath:"#/required",keyword:"required",params:{missingProperty:p},message:"must have required property '"+p+"'"}],!1;{let w=a;for(let P in t)if(!(P==="description"||P==="dateExpires"||P==="requestId"||P==="delegated"||P==="scope"||P==="conditions")){return Ps.errors=[{instancePath:e,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:P},message:"must NOT have additional properties"}],!1;break}if(w===a){if(t.description!==void 0){let P=a;if(typeof t.description!="string")return Ps.errors=[{instancePath:e+"/description",schemaPath:"#/properties/description/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var m=P===a}else var m=!0;if(m){if(t.dateExpires!==void 0){let P=t.dateExpires,S=a;if(a===a)if(typeof P=="string"){if(!Jn.test(P))return Ps.errors=[{instancePath:e+"/dateExpires",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/$defs/date-time/pattern",keyword:"pattern",params:{pattern:"^\\d{4}-[0-1]\\d-[0-3]\\dT(?:[0-2]\\d:[0-5]\\d:[0-5]\\d|23:59:60)\\.\\d{6}Z$"},message:'must match pattern "^\\d{4}-[0-1]\\d-[0-3]\\dT(?:[0-2]\\d:[0-5]\\d:[0-5]\\d|23:59:60)\\.\\d{6}Z$"'}],!1}else return Ps.errors=[{instancePath:e+"/dateExpires",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/$defs/date-time/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var m=S===a}else var m=!0;if(m){if(t.requestId!==void 0){let P=a;if(typeof t.requestId!="string")return Ps.errors=[{instancePath:e+"/requestId",schemaPath:"#/properties/requestId/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var m=P===a}else var m=!0;if(m){if(t.delegated!==void 0){let P=a;if(typeof t.delegated!="boolean")return Ps.errors=[{instancePath:e+"/delegated",schemaPath:"#/properties/delegated/type",keyword:"type",params:{type:"boolean"},message:"must be boolean"}],!1;var m=P===a}else var m=!0;if(m){if(t.scope!==void 0){let P=a;G0(t.scope,{instancePath:e+"/scope",parentData:t,parentDataProperty:"scope",rootData:i,dynamicAnchors:o})||(s=s===null?G0.errors:s.concat(G0.errors),a=s.length);var m=P===a}else var m=!0;if(m)if(t.conditions!==void 0){let P=t.conditions,S=a;if(a===a)if(P&&typeof P=="object"&&!Array.isArray(P)){let B=a;for(let I in P)if(I!=="publication"){return Ps.errors=[{instancePath:e+"/conditions",schemaPath:"https://identity.foundation/dwn/json-schemas/permissions/defs.json#/$defs/conditions/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:I},message:"must NOT have additional properties"}],!1;break}if(B===a&&P.publication!==void 0){let I=P.publication;if(typeof I!="string")return Ps.errors=[{instancePath:e+"/conditions/publication",schemaPath:"https://identity.foundation/dwn/json-schemas/permissions/defs.json#/$defs/conditions/properties/publication/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;if(!(I==="Required"||I==="Prohibited"))return Ps.errors=[{instancePath:e+"/conditions/publication",schemaPath:"https://identity.foundation/dwn/json-schemas/permissions/defs.json#/$defs/conditions/properties/publication/enum",keyword:"enum",params:{allowedValues:dz.properties.publication.enum},message:"must be equal to one of the allowed values"}],!1}}else return Ps.errors=[{instancePath:e+"/conditions",schemaPath:"https://identity.foundation/dwn/json-schemas/permissions/defs.json#/$defs/conditions/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;var m=S===a}else var m=!0}}}}}}}else return Ps.errors=[{instancePath:e,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;return Ps.errors=s,a===0}Ps.evaluated={props:!0,dynamicProps:!1,dynamicItems:!1};var m1e=Fa;function W0(t,{instancePath:e="",parentData:r,parentDataProperty:n,rootData:i=t,dynamicAnchors:o={}}={}){let s=null,a=0,d=W0.evaluated;d.dynamicProps&&(d.props=void 0),d.dynamicItems&&(d.items=void 0);let m=a,p=!1,w=null,P=a;if(a===a)if(t&&typeof t=="object"&&!Array.isArray(t)){if(t.interface!==void 0){let N=a;if(t.interface!=="Protocols"){let G={instancePath:e+"/interface",schemaPath:"https://identity.foundation/dwn/json-schemas/permissions/scopes.json#/$defs/protocols-query-scope/properties/interface/const",keyword:"const",params:{allowedValue:"Protocols"},message:"must be equal to constant"};s===null?s=[G]:s.push(G),a++}var M=N===a}else var M=!0;if(M)if(t.method!==void 0){let N=a;if(t.method!=="Query"){let x={instancePath:e+"/method",schemaPath:"https://identity.foundation/dwn/json-schemas/permissions/scopes.json#/$defs/protocols-query-scope/properties/method/const",keyword:"const",params:{allowedValue:"Query"},message:"must be equal to constant"};s===null?s=[x]:s.push(x),a++}var M=N===a}else var M=!0}else{let N={instancePath:e,schemaPath:"https://identity.foundation/dwn/json-schemas/permissions/scopes.json#/$defs/protocols-query-scope/type",keyword:"type",params:{type:"object"},message:"must be object"};s===null?s=[N]:s.push(N),a++}var k=P===a;if(k){p=!0,w=0;var A={};A.interface=!0,A.method=!0}let B=a;if(a===a)if(t&&typeof t=="object"&&!Array.isArray(t)){let N;if(t.interface===void 0&&(N="interface")||t.method===void 0&&(N="method")){let G={instancePath:e,schemaPath:"https://identity.foundation/dwn/json-schemas/permissions/scopes.json#/$defs/records-read-scope/required",keyword:"required",params:{missingProperty:N},message:"must have required property '"+N+"'"};s===null?s=[G]:s.push(G),a++}else{if(t.interface!==void 0){let G=a;if(t.interface!=="Records"){let x={instancePath:e+"/interface",schemaPath:"https://identity.foundation/dwn/json-schemas/permissions/scopes.json#/$defs/records-read-scope/properties/interface/const",keyword:"const",params:{allowedValue:"Records"},message:"must be equal to constant"};s===null?s=[x]:s.push(x),a++}var C=G===a}else var C=!0;if(C){if(t.method!==void 0){let G=a;if(t.method!=="Read"){let c={instancePath:e+"/method",schemaPath:"https://identity.foundation/dwn/json-schemas/permissions/scopes.json#/$defs/records-read-scope/properties/method/const",keyword:"const",params:{allowedValue:"Read"},message:"must be equal to constant"};s===null?s=[c]:s.push(c),a++}var C=G===a}else var C=!0;if(C){if(t.schema!==void 0){let G=a;if(typeof t.schema!="string"){let c={instancePath:e+"/schema",schemaPath:"https://identity.foundation/dwn/json-schemas/permissions/scopes.json#/$defs/records-read-scope/properties/schema/type",keyword:"type",params:{type:"string"},message:"must be string"};s===null?s=[c]:s.push(c),a++}var C=G===a}else var C=!0;if(C){if(t.protocol!==void 0){let G=a;if(typeof t.protocol!="string"){let c={instancePath:e+"/protocol",schemaPath:"https://identity.foundation/dwn/json-schemas/permissions/scopes.json#/$defs/records-read-scope/properties/protocol/type",keyword:"type",params:{type:"string"},message:"must be string"};s===null?s=[c]:s.push(c),a++}var C=G===a}else var C=!0;if(C){if(t.contextId!==void 0){let G=a;if(typeof t.contextId!="string"){let c={instancePath:e+"/contextId",schemaPath:"https://identity.foundation/dwn/json-schemas/permissions/scopes.json#/$defs/records-read-scope/properties/contextId/type",keyword:"type",params:{type:"string"},message:"must be string"};s===null?s=[c]:s.push(c),a++}var C=G===a}else var C=!0;if(C)if(t.protocolPath!==void 0){let G=a;if(typeof t.protocolPath!="string"){let c={instancePath:e+"/protocolPath",schemaPath:"https://identity.foundation/dwn/json-schemas/permissions/scopes.json#/$defs/records-read-scope/properties/protocolPath/type",keyword:"type",params:{type:"string"},message:"must be string"};s===null?s=[c]:s.push(c),a++}var C=G===a}else var C=!0}}}}}}else{let N={instancePath:e,schemaPath:"https://identity.foundation/dwn/json-schemas/permissions/scopes.json#/$defs/records-read-scope/type",keyword:"type",params:{type:"object"},message:"must be object"};s===null?s=[N]:s.push(N),a++}var k=B===a;if(k&&p)p=!1,w=[w,1];else{k&&(p=!0,w=1,A!==!0&&(A=A||{},A.interface=!0,A.method=!0,A.schema=!0,A.protocol=!0,A.contextId=!0,A.protocolPath=!0));let N=a;if(a===a)if(t&&typeof t=="object"&&!Array.isArray(t)){let c;if(t.interface===void 0&&(c="interface")||t.method===void 0&&(c="method")){let u={instancePath:e,schemaPath:"https://identity.foundation/dwn/json-schemas/permissions/scopes.json#/$defs/records-delete-scope/required",keyword:"required",params:{missingProperty:c},message:"must have required property '"+c+"'"};s===null?s=[u]:s.push(u),a++}else{if(t.interface!==void 0){let u=a;if(t.interface!=="Records"){let y={instancePath:e+"/interface",schemaPath:"https://identity.foundation/dwn/json-schemas/permissions/scopes.json#/$defs/records-delete-scope/properties/interface/const",keyword:"const",params:{allowedValue:"Records"},message:"must be equal to constant"};s===null?s=[y]:s.push(y),a++}var q=u===a}else var q=!0;if(q){if(t.method!==void 0){let u=a;if(t.method!=="Delete"){let l={instancePath:e+"/method",schemaPath:"https://identity.foundation/dwn/json-schemas/permissions/scopes.json#/$defs/records-delete-scope/properties/method/const",keyword:"const",params:{allowedValue:"Delete"},message:"must be equal to constant"};s===null?s=[l]:s.push(l),a++}var q=u===a}else var q=!0;if(q){if(t.protocol!==void 0){let u=a;if(typeof t.protocol!="string"){let l={instancePath:e+"/protocol",schemaPath:"https://identity.foundation/dwn/json-schemas/permissions/scopes.json#/$defs/records-delete-scope/properties/protocol/type",keyword:"type",params:{type:"string"},message:"must be string"};s===null?s=[l]:s.push(l),a++}var q=u===a}else var q=!0;if(q)if(t.schema!==void 0){let u=a;if(typeof t.schema!="string"){let l={instancePath:e+"/schema",schemaPath:"https://identity.foundation/dwn/json-schemas/permissions/scopes.json#/$defs/records-delete-scope/properties/schema/type",keyword:"type",params:{type:"string"},message:"must be string"};s===null?s=[l]:s.push(l),a++}var q=u===a}else var q=!0}}}}else{let c={instancePath:e,schemaPath:"https://identity.foundation/dwn/json-schemas/permissions/scopes.json#/$defs/records-delete-scope/type",keyword:"type",params:{type:"object"},message:"must be object"};s===null?s=[c]:s.push(c),a++}var k=N===a;if(k&&p)p=!1,w=[w,2];else{k&&(p=!0,w=2,A!==!0&&(A=A||{},A.interface=!0,A.method=!0,A.protocol=!0,A.schema=!0));let c=a;if(a===a)if(t&&typeof t=="object"&&!Array.isArray(t)){let l;if(t.interface===void 0&&(l="interface")||t.method===void 0&&(l="method")){let h={instancePath:e,schemaPath:"https://identity.foundation/dwn/json-schemas/permissions/scopes.json#/$defs/records-write-scope/required",keyword:"required",params:{missingProperty:l},message:"must have required property '"+l+"'"};s===null?s=[h]:s.push(h),a++}else{if(t.interface!==void 0){let h=a;if(t.interface!=="Records"){let b={instancePath:e+"/interface",schemaPath:"https://identity.foundation/dwn/json-schemas/permissions/scopes.json#/$defs/records-write-scope/properties/interface/const",keyword:"const",params:{allowedValue:"Records"},message:"must be equal to constant"};s===null?s=[b]:s.push(b),a++}var L=h===a}else var L=!0;if(L){if(t.method!==void 0){let h=a;if(t.method!=="Write"){let _={instancePath:e+"/method",schemaPath:"https://identity.foundation/dwn/json-schemas/permissions/scopes.json#/$defs/records-write-scope/properties/method/const",keyword:"const",params:{allowedValue:"Write"},message:"must be equal to constant"};s===null?s=[_]:s.push(_),a++}var L=h===a}else var L=!0;if(L){if(t.schema!==void 0){let h=a;if(typeof t.schema!="string"){let _={instancePath:e+"/schema",schemaPath:"https://identity.foundation/dwn/json-schemas/permissions/scopes.json#/$defs/records-write-scope/properties/schema/type",keyword:"type",params:{type:"string"},message:"must be string"};s===null?s=[_]:s.push(_),a++}var L=h===a}else var L=!0;if(L){if(t.protocol!==void 0){let h=a;if(typeof t.protocol!="string"){let _={instancePath:e+"/protocol",schemaPath:"https://identity.foundation/dwn/json-schemas/permissions/scopes.json#/$defs/records-write-scope/properties/protocol/type",keyword:"type",params:{type:"string"},message:"must be string"};s===null?s=[_]:s.push(_),a++}var L=h===a}else var L=!0;if(L){if(t.contextId!==void 0){let h=a;if(typeof t.contextId!="string"){let _={instancePath:e+"/contextId",schemaPath:"https://identity.foundation/dwn/json-schemas/permissions/scopes.json#/$defs/records-write-scope/properties/contextId/type",keyword:"type",params:{type:"string"},message:"must be string"};s===null?s=[_]:s.push(_),a++}var L=h===a}else var L=!0;if(L)if(t.protocolPath!==void 0){let h=a;if(typeof t.protocolPath!="string"){let _={instancePath:e+"/protocolPath",schemaPath:"https://identity.foundation/dwn/json-schemas/permissions/scopes.json#/$defs/records-write-scope/properties/protocolPath/type",keyword:"type",params:{type:"string"},message:"must be string"};s===null?s=[_]:s.push(_),a++}var L=h===a}else var L=!0}}}}}}else{let l={instancePath:e,schemaPath:"https://identity.foundation/dwn/json-schemas/permissions/scopes.json#/$defs/records-write-scope/type",keyword:"type",params:{type:"object"},message:"must be object"};s===null?s=[l]:s.push(l),a++}var k=c===a;if(k&&p)p=!1,w=[w,3];else{k&&(p=!0,w=3,A!==!0&&(A=A||{},A.interface=!0,A.method=!0,A.schema=!0,A.protocol=!0,A.contextId=!0,A.protocolPath=!0));let l=a;if(a===a)if(t&&typeof t=="object"&&!Array.isArray(t)){let _;if(t.interface===void 0&&(_="interface")||t.method===void 0&&(_="method")){let g={instancePath:e,schemaPath:"https://identity.foundation/dwn/json-schemas/permissions/scopes.json#/$defs/records-query-scope/required",keyword:"required",params:{missingProperty:_},message:"must have required property '"+_+"'"};s===null?s=[g]:s.push(g),a++}else{if(t.interface!==void 0){let g=a;if(t.interface!=="Records"){let f={instancePath:e+"/interface",schemaPath:"https://identity.foundation/dwn/json-schemas/permissions/scopes.json#/$defs/records-query-scope/properties/interface/const",keyword:"const",params:{allowedValue:"Records"},message:"must be equal to constant"};s===null?s=[f]:s.push(f),a++}var U=g===a}else var U=!0;if(U){if(t.method!==void 0){let g=a;if(t.method!=="Query"){let v={instancePath:e+"/method",schemaPath:"https://identity.foundation/dwn/json-schemas/permissions/scopes.json#/$defs/records-query-scope/properties/method/const",keyword:"const",params:{allowedValue:"Query"},message:"must be equal to constant"};s===null?s=[v]:s.push(v),a++}var U=g===a}else var U=!0;if(U)if(t.protocol!==void 0){let g=a;if(typeof t.protocol!="string"){let v={instancePath:e+"/protocol",schemaPath:"https://identity.foundation/dwn/json-schemas/permissions/scopes.json#/$defs/records-query-scope/properties/protocol/type",keyword:"type",params:{type:"string"},message:"must be string"};s===null?s=[v]:s.push(v),a++}var U=g===a}else var U=!0}}}else{let _={instancePath:e,schemaPath:"https://identity.foundation/dwn/json-schemas/permissions/scopes.json#/$defs/records-query-scope/type",keyword:"type",params:{type:"object"},message:"must be object"};s===null?s=[_]:s.push(_),a++}var k=l===a;if(k&&p)p=!1,w=[w,4];else{k&&(p=!0,w=4,A!==!0&&(A=A||{},A.interface=!0,A.method=!0,A.protocol=!0));let _=a;if(a===a)if(t&&typeof t=="object"&&!Array.isArray(t)){let v;if(t.interface===void 0&&(v="interface")||t.method===void 0&&(v="method")){let O={instancePath:e,schemaPath:"https://identity.foundation/dwn/json-schemas/permissions/scopes.json#/$defs/records-subscribe-scope/required",keyword:"required",params:{missingProperty:v},message:"must have required property '"+v+"'"};s===null?s=[O]:s.push(O),a++}else{if(t.interface!==void 0){let O=a;if(t.interface!=="Records"){let T={instancePath:e+"/interface",schemaPath:"https://identity.foundation/dwn/json-schemas/permissions/scopes.json#/$defs/records-subscribe-scope/properties/interface/const",keyword:"const",params:{allowedValue:"Records"},message:"must be equal to constant"};s===null?s=[T]:s.push(T),a++}var F=O===a}else var F=!0;if(F){if(t.method!==void 0){let O=a;if(t.method!=="Subscribe"){let R={instancePath:e+"/method",schemaPath:"https://identity.foundation/dwn/json-schemas/permissions/scopes.json#/$defs/records-subscribe-scope/properties/method/const",keyword:"const",params:{allowedValue:"Subscribe"},message:"must be equal to constant"};s===null?s=[R]:s.push(R),a++}var F=O===a}else var F=!0;if(F)if(t.protocol!==void 0){let O=a;if(typeof t.protocol!="string"){let R={instancePath:e+"/protocol",schemaPath:"https://identity.foundation/dwn/json-schemas/permissions/scopes.json#/$defs/records-subscribe-scope/properties/protocol/type",keyword:"type",params:{type:"string"},message:"must be string"};s===null?s=[R]:s.push(R),a++}var F=O===a}else var F=!0}}}else{let v={instancePath:e,schemaPath:"https://identity.foundation/dwn/json-schemas/permissions/scopes.json#/$defs/records-subscribe-scope/type",keyword:"type",params:{type:"object"},message:"must be object"};s===null?s=[v]:s.push(v),a++}var k=_===a;k&&p?(p=!1,w=[w,5]):k&&(p=!0,w=5,A!==!0&&(A=A||{},A.interface=!0,A.method=!0,A.protocol=!0))}}}}if(p)a=m,s!==null&&(m?s.length=m:s=null);else{let N={instancePath:e,schemaPath:"#/oneOf",keyword:"oneOf",params:{passingSchemas:w},message:"must match exactly one schema in oneOf"};return s===null?s=[N]:s.push(N),a++,W0.errors=s,!1}return W0.errors=s,d.props=A,a===0}W0.evaluated={dynamicProps:!0,dynamicItems:!1};function Fa(t,{instancePath:e="",parentData:r,parentDataProperty:n,rootData:i=t,dynamicAnchors:o={}}={}){let s=null,a=0,d=Fa.evaluated;if(d.dynamicProps&&(d.props=void 0),d.dynamicItems&&(d.items=void 0),a===0)if(t&&typeof t=="object"&&!Array.isArray(t)){let p;if(t.delegated===void 0&&(p="delegated")||t.scope===void 0&&(p="scope"))return Fa.errors=[{instancePath:e,schemaPath:"#/required",keyword:"required",params:{missingProperty:p},message:"must have required property '"+p+"'"}],!1;{let w=a;for(let P in t)if(!(P==="description"||P==="delegated"||P==="scope"||P==="conditions")){return Fa.errors=[{instancePath:e,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:P},message:"must NOT have additional properties"}],!1;break}if(w===a){if(t.description!==void 0){let P=a;if(typeof t.description!="string")return Fa.errors=[{instancePath:e+"/description",schemaPath:"#/properties/description/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var m=P===a}else var m=!0;if(m){if(t.delegated!==void 0){let P=a;if(typeof t.delegated!="boolean")return Fa.errors=[{instancePath:e+"/delegated",schemaPath:"#/properties/delegated/type",keyword:"type",params:{type:"boolean"},message:"must be boolean"}],!1;var m=P===a}else var m=!0;if(m){if(t.scope!==void 0){let P=a;W0(t.scope,{instancePath:e+"/scope",parentData:t,parentDataProperty:"scope",rootData:i,dynamicAnchors:o})||(s=s===null?W0.errors:s.concat(W0.errors),a=s.length);var m=P===a}else var m=!0;if(m)if(t.conditions!==void 0){let P=t.conditions,S=a;if(a===a)if(P&&typeof P=="object"&&!Array.isArray(P)){let B=a;for(let I in P)if(I!=="publication"){return Fa.errors=[{instancePath:e+"/conditions",schemaPath:"https://identity.foundation/dwn/json-schemas/permissions/defs.json#/$defs/conditions/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:I},message:"must NOT have additional properties"}],!1;break}if(B===a&&P.publication!==void 0){let I=P.publication;if(typeof I!="string")return Fa.errors=[{instancePath:e+"/conditions/publication",schemaPath:"https://identity.foundation/dwn/json-schemas/permissions/defs.json#/$defs/conditions/properties/publication/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;if(!(I==="Required"||I==="Prohibited"))return Fa.errors=[{instancePath:e+"/conditions/publication",schemaPath:"https://identity.foundation/dwn/json-schemas/permissions/defs.json#/$defs/conditions/properties/publication/enum",keyword:"enum",params:{allowedValues:dz.properties.publication.enum},message:"must be equal to one of the allowed values"}],!1}}else return Fa.errors=[{instancePath:e+"/conditions",schemaPath:"https://identity.foundation/dwn/json-schemas/permissions/defs.json#/$defs/conditions/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;var m=S===a}else var m=!0}}}}}else return Fa.errors=[{instancePath:e,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;return Fa.errors=s,a===0}Fa.evaluated={props:!0,dynamicProps:!1,dynamicItems:!1};var y1e=F0;function F0(t,{instancePath:e="",parentData:r,parentDataProperty:n,rootData:i=t,dynamicAnchors:o={}}={}){let s=null,a=0,d=F0.evaluated;if(d.dynamicProps&&(d.props=void 0),d.dynamicItems&&(d.items=void 0),a===0)if(t&&typeof t=="object"&&!Array.isArray(t)){let m=a;for(let p in t)if(p!=="description"){return F0.errors=[{instancePath:e,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:p},message:"must NOT have additional properties"}],!1;break}if(m===a&&t.description!==void 0&&typeof t.description!="string")return F0.errors=[{instancePath:e+"/description",schemaPath:"#/properties/description/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1}else return F0.errors=[{instancePath:e,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;return F0.errors=s,a===0}F0.evaluated={props:!0,dynamicProps:!1,dynamicItems:!1};var g1e=I1;function I1(t,{instancePath:e="",parentData:r,parentDataProperty:n,rootData:i=t,dynamicAnchors:o={}}={}){let s=null,a=0,d=I1.evaluated;return d.dynamicProps&&(d.props=void 0),d.dynamicItems&&(d.items=void 0),t&&typeof t=="object"&&!Array.isArray(t)?(I1.errors=s,a===0):(I1.errors=[{instancePath:e,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1)}I1.evaluated={dynamicProps:!1,dynamicItems:!1};var v1e=k1;function k1(t,{instancePath:e="",parentData:r,parentDataProperty:n,rootData:i=t,dynamicAnchors:o={}}={}){let s=null,a=0,d=k1.evaluated;return d.dynamicProps&&(d.props=void 0),d.dynamicItems&&(d.items=void 0),t&&typeof t=="object"&&!Array.isArray(t)?(k1.errors=s,a===0):(k1.errors=[{instancePath:e,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1)}k1.evaluated={dynamicProps:!1,dynamicItems:!1};var b1e=Zi;var oz=new RegExp(".*","u"),Vg={$id:"https://identity.foundation/dwn/json-schemas/protocol-rule-set.json",$schema:"https://json-schema.org/draft/2020-12/schema",type:"object",additionalProperties:!1,properties:{$encryption:{type:"object",additionalProperties:!1,properties:{rootKeyId:{type:"string"},publicKeyJwk:{$ref:"https://identity.foundation/dwn/json-schemas/public-jwk.json"}},required:["rootKeyId","publicKeyJwk"]},$actions:{type:"array",minItems:1,items:{type:"object",oneOf:[{required:["who","can"],additionalProperties:!1,properties:{who:{type:"string",enum:["anyone","author","recipient"]},of:{type:"string"},can:{type:"array",minItems:1,items:{type:"string",enum:["co-delete","co-prune","co-update","create","delete","prune","read","update"]}}}},{required:["role","can"],properties:{role:{$comment:"Must be the protocol path of a role record type",type:"string"},can:{type:"array",minItems:1,items:{type:"string",enum:["co-delete","co-update","create","delete","query","subscribe","read","update"]}}}}]}},$role:{$comment:"When `true`, this turns a record into `role` that may be used within a context/sub-context",type:"boolean"},$size:{type:"object",additionalProperties:!1,properties:{min:{type:"number",minimum:0},max:{type:"number",minimum:0}}},$tags:{type:"object",minProperties:1,properties:{$requiredTags:{type:"array",items:{type:"string"}},$allowUndefinedTags:{type:"boolean"}},patternProperties:{"^(?!\\$requiredTags$|\\$allowUndefinedTags$).*$":{type:"object",additionalProperties:!1,properties:{type:{enum:["string","number","integer","boolean","array"]},items:{type:"object",properties:{type:{enum:["string","number","integer"]}},patternProperties:{"^(enum|minimum|maximum|exclusiveMinimum|exclusiveMaximum|minLength|maxLength)$":{}}},contains:{type:"object",properties:{type:{enum:["string","number","integer"]}},patternProperties:{"^(enum|minimum|maximum|exclusiveMinimum|exclusiveMaximum|minLength|maxLength)$":{}}}},patternProperties:{"^(enum|minimum|maximum|exclusiveMinimum|exclusiveMaximum|minLength|maxLength|minItems|maxItems|uniqueItems|minContains|maxContains)$":{}}}}}},patternProperties:{"^[^$].*$":{$ref:"https://identity.foundation/dwn/json-schemas/protocol-rule-set.json"}}},sz=new RegExp("^[^$].*$","u"),w1e=new RegExp("^(?!\\$requiredTags$|\\$allowUndefinedTags$).*$","u"),_1e=new RegExp("^(enum|minimum|maximum|exclusiveMinimum|exclusiveMaximum|minLength|maxLength|minItems|maxItems|uniqueItems|minContains|maxContains)$","u"),az=new RegExp("^(enum|minimum|maximum|exclusiveMinimum|exclusiveMaximum|minLength|maxLength)$","u"),XT={validate:Ir};function Ir(t,{instancePath:e="",parentData:r,parentDataProperty:n,rootData:i=t,dynamicAnchors:o={}}={}){let s=null,a=0,d=Ir.evaluated;if(d.dynamicProps&&(d.props=void 0),d.dynamicItems&&(d.items=void 0),a===0)if(t&&typeof t=="object"&&!Array.isArray(t)){let u=a;for(let y in t)if(!(y==="$encryption"||y==="$actions"||y==="$role"||y==="$size"||y==="$tags"||sz.test(y))){return Ir.errors=[{instancePath:e,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:y},message:"must NOT have additional properties"}],!1;break}if(u===a){if(t.$encryption!==void 0){let y=t.$encryption,l=a;if(a===l)if(y&&typeof y=="object"&&!Array.isArray(y)){let h;if(y.rootKeyId===void 0&&(h="rootKeyId")||y.publicKeyJwk===void 0&&(h="publicKeyJwk"))return Ir.errors=[{instancePath:e+"/$encryption",schemaPath:"#/properties/%24encryption/required",keyword:"required",params:{missingProperty:h},message:"must have required property '"+h+"'"}],!1;{let b=a;for(let _ in y)if(!(_==="rootKeyId"||_==="publicKeyJwk")){return Ir.errors=[{instancePath:e+"/$encryption",schemaPath:"#/properties/%24encryption/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:_},message:"must NOT have additional properties"}],!1;break}if(b===a){if(y.rootKeyId!==void 0){let _=a;if(typeof y.rootKeyId!="string")return Ir.errors=[{instancePath:e+"/$encryption/rootKeyId",schemaPath:"#/properties/%24encryption/properties/rootKeyId/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var m=_===a}else var m=!0;if(m)if(y.publicKeyJwk!==void 0){let _=a;an(y.publicKeyJwk,{instancePath:e+"/$encryption/publicKeyJwk",parentData:y,parentDataProperty:"publicKeyJwk",rootData:i,dynamicAnchors:o})||(s=s===null?an.errors:s.concat(an.errors),a=s.length);var m=_===a}else var m=!0}}}else return Ir.errors=[{instancePath:e+"/$encryption",schemaPath:"#/properties/%24encryption/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;var p=l===a}else var p=!0;if(p){if(t.$actions!==void 0){let y=t.$actions,l=a;if(a===l)if(Array.isArray(y)){if(y.length<1)return Ir.errors=[{instancePath:e+"/$actions",schemaPath:"#/properties/%24actions/minItems",keyword:"minItems",params:{limit:1},message:"must NOT have fewer than 1 items"}],!1;{var w=!0;let b=y.length;for(let _=0;_<b;_++){let g=y[_],f=a;if(!(g&&typeof g=="object"&&!Array.isArray(g)))return Ir.errors=[{instancePath:e+"/$actions/"+_,schemaPath:"#/properties/%24actions/items/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;let v=a,O=!1,T=null,R=a;if(g&&typeof g=="object"&&!Array.isArray(g)){let W;if(g.who===void 0&&(W="who")||g.can===void 0&&(W="can")){let Z={instancePath:e+"/$actions/"+_,schemaPath:"#/properties/%24actions/items/oneOf/0/required",keyword:"required",params:{missingProperty:W},message:"must have required property '"+W+"'"};s===null?s=[Z]:s.push(Z),a++}else{let Z=a;for(let J in g)if(!(J==="who"||J==="of"||J==="can")){let X={instancePath:e+"/$actions/"+_,schemaPath:"#/properties/%24actions/items/oneOf/0/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:J},message:"must NOT have additional properties"};s===null?s=[X]:s.push(X),a++;break}if(Z===a){if(g.who!==void 0){let J=g.who,X=a;if(typeof J!="string"){let Ee={instancePath:e+"/$actions/"+_+"/who",schemaPath:"#/properties/%24actions/items/oneOf/0/properties/who/type",keyword:"type",params:{type:"string"},message:"must be string"};s===null?s=[Ee]:s.push(Ee),a++}if(!(J==="anyone"||J==="author"||J==="recipient")){let Ee={instancePath:e+"/$actions/"+_+"/who",schemaPath:"#/properties/%24actions/items/oneOf/0/properties/who/enum",keyword:"enum",params:{allowedValues:Vg.properties.$actions.items.oneOf[0].properties.who.enum},message:"must be equal to one of the allowed values"};s===null?s=[Ee]:s.push(Ee),a++}var P=X===a}else var P=!0;if(P){if(g.of!==void 0){let J=a;if(typeof g.of!="string"){let Ee={instancePath:e+"/$actions/"+_+"/of",schemaPath:"#/properties/%24actions/items/oneOf/0/properties/of/type",keyword:"type",params:{type:"string"},message:"must be string"};s===null?s=[Ee]:s.push(Ee),a++}var P=J===a}else var P=!0;if(P)if(g.can!==void 0){let J=g.can,X=a;if(a===X)if(Array.isArray(J))if(J.length<1){let re={instancePath:e+"/$actions/"+_+"/can",schemaPath:"#/properties/%24actions/items/oneOf/0/properties/can/minItems",keyword:"minItems",params:{limit:1},message:"must NOT have fewer than 1 items"};s===null?s=[re]:s.push(re),a++}else{var S=!0;let re=J.length;for(let ne=0;ne<re;ne++){let qe=J[ne],ce=a;if(typeof qe!="string"){let Ne={instancePath:e+"/$actions/"+_+"/can/"+ne,schemaPath:"#/properties/%24actions/items/oneOf/0/properties/can/items/type",keyword:"type",params:{type:"string"},message:"must be string"};s===null?s=[Ne]:s.push(Ne),a++}if(!(qe==="co-delete"||qe==="co-prune"||qe==="co-update"||qe==="create"||qe==="delete"||qe==="prune"||qe==="read"||qe==="update")){let Ne={instancePath:e+"/$actions/"+_+"/can/"+ne,schemaPath:"#/properties/%24actions/items/oneOf/0/properties/can/items/enum",keyword:"enum",params:{allowedValues:Vg.properties.$actions.items.oneOf[0].properties.can.items.enum},message:"must be equal to one of the allowed values"};s===null?s=[Ne]:s.push(Ne),a++}var S=ce===a;if(!S)break}}else{let re={instancePath:e+"/$actions/"+_+"/can",schemaPath:"#/properties/%24actions/items/oneOf/0/properties/can/type",keyword:"type",params:{type:"array"},message:"must be array"};s===null?s=[re]:s.push(re),a++}var P=X===a}else var P=!0}}}}var I=R===a;if(I){O=!0,T=0;var M=!0}let z=a;if(g&&typeof g=="object"&&!Array.isArray(g)){let W;if(g.role===void 0&&(W="role")||g.can===void 0&&(W="can")){let Z={instancePath:e+"/$actions/"+_,schemaPath:"#/properties/%24actions/items/oneOf/1/required",keyword:"required",params:{missingProperty:W},message:"must have required property '"+W+"'"};s===null?s=[Z]:s.push(Z),a++}else{if(g.role!==void 0){let Z=a;if(typeof g.role!="string"){let J={instancePath:e+"/$actions/"+_+"/role",schemaPath:"#/properties/%24actions/items/oneOf/1/properties/role/type",keyword:"type",params:{type:"string"},message:"must be string"};s===null?s=[J]:s.push(J),a++}var A=Z===a}else var A=!0;if(A)if(g.can!==void 0){let Z=g.can,J=a;if(a===J)if(Array.isArray(Z))if(Z.length<1){let Ee={instancePath:e+"/$actions/"+_+"/can",schemaPath:"#/properties/%24actions/items/oneOf/1/properties/can/minItems",keyword:"minItems",params:{limit:1},message:"must NOT have fewer than 1 items"};s===null?s=[Ee]:s.push(Ee),a++}else{var B=!0;let Ee=Z.length;for(let re=0;re<Ee;re++){let ne=Z[re],qe=a;if(typeof ne!="string"){let ye={instancePath:e+"/$actions/"+_+"/can/"+re,schemaPath:"#/properties/%24actions/items/oneOf/1/properties/can/items/type",keyword:"type",params:{type:"string"},message:"must be string"};s===null?s=[ye]:s.push(ye),a++}if(!(ne==="co-delete"||ne==="co-update"||ne==="create"||ne==="delete"||ne==="query"||ne==="subscribe"||ne==="read"||ne==="update")){let ye={instancePath:e+"/$actions/"+_+"/can/"+re,schemaPath:"#/properties/%24actions/items/oneOf/1/properties/can/items/enum",keyword:"enum",params:{allowedValues:Vg.properties.$actions.items.oneOf[1].properties.can.items.enum},message:"must be equal to one of the allowed values"};s===null?s=[ye]:s.push(ye),a++}var B=qe===a;if(!B)break}}else{let Ee={instancePath:e+"/$actions/"+_+"/can",schemaPath:"#/properties/%24actions/items/oneOf/1/properties/can/type",keyword:"type",params:{type:"array"},message:"must be array"};s===null?s=[Ee]:s.push(Ee),a++}var A=J===a}else var A=!0}}var I=z===a;if(I&&O?(O=!1,T=[T,1]):I&&(O=!0,T=1,M!==!0&&(M=M||{},M.role=!0,M.can=!0)),O)a=v,s!==null&&(v?s.length=v:s=null);else{let W={instancePath:e+"/$actions/"+_,schemaPath:"#/properties/%24actions/items/oneOf",keyword:"oneOf",params:{passingSchemas:T},message:"must match exactly one schema in oneOf"};return s===null?s=[W]:s.push(W),a++,Ir.errors=s,!1}var w=f===a;if(!w)break}}}else return Ir.errors=[{instancePath:e+"/$actions",schemaPath:"#/properties/%24actions/type",keyword:"type",params:{type:"array"},message:"must be array"}],!1;var p=l===a}else var p=!0;if(p){if(t.$role!==void 0){let y=a;if(typeof t.$role!="boolean")return Ir.errors=[{instancePath:e+"/$role",schemaPath:"#/properties/%24role/type",keyword:"type",params:{type:"boolean"},message:"must be boolean"}],!1;var p=y===a}else var p=!0;if(p){if(t.$size!==void 0){let y=t.$size,l=a;if(a===l)if(y&&typeof y=="object"&&!Array.isArray(y)){let b=a;for(let _ in y)if(!(_==="min"||_==="max")){return Ir.errors=[{instancePath:e+"/$size",schemaPath:"#/properties/%24size/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:_},message:"must NOT have additional properties"}],!1;break}if(b===a){if(y.min!==void 0){let _=y.min,g=a;if(a===g)if(typeof _=="number"&&isFinite(_)){if(_<0||isNaN(_))return Ir.errors=[{instancePath:e+"/$size/min",schemaPath:"#/properties/%24size/properties/min/minimum",keyword:"minimum",params:{comparison:">=",limit:0},message:"must be >= 0"}],!1}else return Ir.errors=[{instancePath:e+"/$size/min",schemaPath:"#/properties/%24size/properties/min/type",keyword:"type",params:{type:"number"},message:"must be number"}],!1;var C=g===a}else var C=!0;if(C)if(y.max!==void 0){let _=y.max,g=a;if(a===g)if(typeof _=="number"&&isFinite(_)){if(_<0||isNaN(_))return Ir.errors=[{instancePath:e+"/$size/max",schemaPath:"#/properties/%24size/properties/max/minimum",keyword:"minimum",params:{comparison:">=",limit:0},message:"must be >= 0"}],!1}else return Ir.errors=[{instancePath:e+"/$size/max",schemaPath:"#/properties/%24size/properties/max/type",keyword:"type",params:{type:"number"},message:"must be number"}],!1;var C=g===a}else var C=!0}}else return Ir.errors=[{instancePath:e+"/$size",schemaPath:"#/properties/%24size/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;var p=l===a}else var p=!0;if(p){if(t.$tags!==void 0){let y=t.$tags,l=a;if(a===l)if(y&&typeof y=="object"&&!Array.isArray(y)){if(Object.keys(y).length<1)return Ir.errors=[{instancePath:e+"/$tags",schemaPath:"#/properties/%24tags/minProperties",keyword:"minProperties",params:{limit:1},message:"must NOT have fewer than 1 properties"}],!1;if(y.$requiredTags!==void 0){let b=y.$requiredTags,_=a;if(a===_)if(Array.isArray(b)){var k=!0;let g=b.length;for(let f=0;f<g;f++){let v=a;if(typeof b[f]!="string")return Ir.errors=[{instancePath:e+"/$tags/$requiredTags/"+f,schemaPath:"#/properties/%24tags/properties/%24requiredTags/items/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var k=v===a;if(!k)break}}else return Ir.errors=[{instancePath:e+"/$tags/$requiredTags",schemaPath:"#/properties/%24tags/properties/%24requiredTags/type",keyword:"type",params:{type:"array"},message:"must be array"}],!1;var q=_===a}else var q=!0;if(q){if(y.$allowUndefinedTags!==void 0){let b=a;if(typeof y.$allowUndefinedTags!="boolean")return Ir.errors=[{instancePath:e+"/$tags/$allowUndefinedTags",schemaPath:"#/properties/%24tags/properties/%24allowUndefinedTags/type",keyword:"type",params:{type:"boolean"},message:"must be boolean"}],!1;var q=b===a}else var q=!0;if(q){var L={};L.$requiredTags=!0,L.$allowUndefinedTags=!0;for(let b in y)if(w1e.test(b)){let _=y[b];if(a===a)if(_&&typeof _=="object"&&!Array.isArray(_)){let f=a;for(let v in _)if(!(v==="type"||v==="items"||v==="contains"||_1e.test(v))){return Ir.errors=[{instancePath:e+"/$tags/"+b.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/properties/%24tags/patternProperties/%5E(%3F!%5C%24requiredTags%24%7C%5C%24allowUndefinedTags%24).*%24/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:v},message:"must NOT have additional properties"}],!1;break}if(f===a){if(_.type!==void 0){let v=_.type,O=a;if(!(v==="string"||v==="number"||v==="integer"||v==="boolean"||v==="array"))return Ir.errors=[{instancePath:e+"/$tags/"+b.replace(/~/g,"~0").replace(/\//g,"~1")+"/type",schemaPath:"#/properties/%24tags/patternProperties/%5E(%3F!%5C%24requiredTags%24%7C%5C%24allowUndefinedTags%24).*%24/properties/type/enum",keyword:"enum",params:{allowedValues:Vg.properties.$tags.patternProperties["^(?!\\$requiredTags$|\\$allowUndefinedTags$).*$"].properties.type.enum},message:"must be equal to one of the allowed values"}],!1;var U=O===a}else var U=!0;if(U){if(_.items!==void 0){let v=_.items,O=a;if(a===O)if(v&&typeof v=="object"&&!Array.isArray(v)){if(v.type!==void 0){let R=v.type,z=a;if(!(R==="string"||R==="number"||R==="integer"))return Ir.errors=[{instancePath:e+"/$tags/"+b.replace(/~/g,"~0").replace(/\//g,"~1")+"/items/type",schemaPath:"#/properties/%24tags/patternProperties/%5E(%3F!%5C%24requiredTags%24%7C%5C%24allowUndefinedTags%24).*%24/properties/items/properties/type/enum",keyword:"enum",params:{allowedValues:Vg.properties.$tags.patternProperties["^(?!\\$requiredTags$|\\$allowUndefinedTags$).*$"].properties.items.properties.type.enum},message:"must be equal to one of the allowed values"}],!1;var F=z===a}else var F=!0;if(F){var N={};N.type=!0;for(let R in v)az.test(R)&&(N[R]=!0)}}else return Ir.errors=[{instancePath:e+"/$tags/"+b.replace(/~/g,"~0").replace(/\//g,"~1")+"/items",schemaPath:"#/properties/%24tags/patternProperties/%5E(%3F!%5C%24requiredTags%24%7C%5C%24allowUndefinedTags%24).*%24/properties/items/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;var U=O===a}else var U=!0;if(U)if(_.contains!==void 0){let v=_.contains,O=a;if(a===O)if(v&&typeof v=="object"&&!Array.isArray(v)){if(v.type!==void 0){let R=v.type,z=a;if(!(R==="string"||R==="number"||R==="integer"))return Ir.errors=[{instancePath:e+"/$tags/"+b.replace(/~/g,"~0").replace(/\//g,"~1")+"/contains/type",schemaPath:"#/properties/%24tags/patternProperties/%5E(%3F!%5C%24requiredTags%24%7C%5C%24allowUndefinedTags%24).*%24/properties/contains/properties/type/enum",keyword:"enum",params:{allowedValues:Vg.properties.$tags.patternProperties["^(?!\\$requiredTags$|\\$allowUndefinedTags$).*$"].properties.contains.properties.type.enum},message:"must be equal to one of the allowed values"}],!1;var G=z===a}else var G=!0;if(G){var x={};x.type=!0;for(let R in v)az.test(R)&&(x[R]=!0)}}else return Ir.errors=[{instancePath:e+"/$tags/"+b.replace(/~/g,"~0").replace(/\//g,"~1")+"/contains",schemaPath:"#/properties/%24tags/patternProperties/%5E(%3F!%5C%24requiredTags%24%7C%5C%24allowUndefinedTags%24).*%24/properties/contains/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;var U=O===a}else var U=!0}}}else return Ir.errors=[{instancePath:e+"/$tags/"+b.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/properties/%24tags/patternProperties/%5E(%3F!%5C%24requiredTags%24%7C%5C%24allowUndefinedTags%24).*%24/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;L[b]=!0}}}}else return Ir.errors=[{instancePath:e+"/$tags",schemaPath:"#/properties/%24tags/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;var p=l===a}else var p=!0;if(p){var c=!0;for(let y in t)if(sz.test(y)){let l=a;XT.validate(t[y],{instancePath:e+"/"+y.replace(/~/g,"~0").replace(/\//g,"~1"),parentData:t,parentDataProperty:y,rootData:i,dynamicAnchors:o})||(s=s===null?XT.validate.errors:s.concat(XT.validate.errors),a=s.length);var c=l===a;if(!c)break}}}}}}}}else return Ir.errors=[{instancePath:e,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;return Ir.errors=s,a===0}Ir.evaluated={props:!0,dynamicProps:!1,dynamicItems:!1};function Zi(t,{instancePath:e="",parentData:r,parentDataProperty:n,rootData:i=t,dynamicAnchors:o={}}={}){let s=null,a=0,d=Zi.evaluated;if(d.dynamicProps&&(d.props=void 0),d.dynamicItems&&(d.items=void 0),a===0)if(t&&typeof t=="object"&&!Array.isArray(t)){let M;if(t.protocol===void 0&&(M="protocol")||t.published===void 0&&(M="published")||t.types===void 0&&(M="types")||t.structure===void 0&&(M="structure"))return Zi.errors=[{instancePath:e,schemaPath:"#/required",keyword:"required",params:{missingProperty:M},message:"must have required property '"+M+"'"}],!1;{let A=a;for(let B in t)if(!(B==="protocol"||B==="published"||B==="types"||B==="structure")){return Zi.errors=[{instancePath:e,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:B},message:"must NOT have additional properties"}],!1;break}if(A===a){if(t.protocol!==void 0){let B=a;if(typeof t.protocol!="string")return Zi.errors=[{instancePath:e+"/protocol",schemaPath:"#/properties/protocol/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var m=B===a}else var m=!0;if(m){if(t.published!==void 0){let B=a;if(typeof t.published!="boolean")return Zi.errors=[{instancePath:e+"/published",schemaPath:"#/properties/published/type",keyword:"type",params:{type:"boolean"},message:"must be boolean"}],!1;var m=B===a}else var m=!0;if(m){if(t.types!==void 0){let B=t.types,I=a;if(a===I)if(B&&typeof B=="object"&&!Array.isArray(B)){var p={};for(let k in B)if(oz.test(k)){let q=B[k];if(a===a)if(q&&typeof q=="object"&&!Array.isArray(q)){let U=a;for(let F in q)if(!(F==="schema"||F==="dataFormats")){return Zi.errors=[{instancePath:e+"/types/"+k.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/properties/types/patternProperties/.*/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:F},message:"must NOT have additional properties"}],!1;break}if(U===a){if(q.schema!==void 0){let F=a;if(typeof q.schema!="string")return Zi.errors=[{instancePath:e+"/types/"+k.replace(/~/g,"~0").replace(/\//g,"~1")+"/schema",schemaPath:"#/properties/types/patternProperties/.*/properties/schema/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var w=F===a}else var w=!0;if(w)if(q.dataFormats!==void 0){let F=q.dataFormats,N=a;if(a===N)if(Array.isArray(F)){if(F.length<1)return Zi.errors=[{instancePath:e+"/types/"+k.replace(/~/g,"~0").replace(/\//g,"~1")+"/dataFormats",schemaPath:"#/properties/types/patternProperties/.*/properties/dataFormats/minItems",keyword:"minItems",params:{limit:1},message:"must NOT have fewer than 1 items"}],!1;{var P=!0;let x=F.length;for(let c=0;c<x;c++){let u=a;if(typeof F[c]!="string")return Zi.errors=[{instancePath:e+"/types/"+k.replace(/~/g,"~0").replace(/\//g,"~1")+"/dataFormats/"+c,schemaPath:"#/properties/types/patternProperties/.*/properties/dataFormats/items/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var P=u===a;if(!P)break}}}else return Zi.errors=[{instancePath:e+"/types/"+k.replace(/~/g,"~0").replace(/\//g,"~1")+"/dataFormats",schemaPath:"#/properties/types/patternProperties/.*/properties/dataFormats/type",keyword:"type",params:{type:"array"},message:"must be array"}],!1;var w=N===a}else var w=!0}}else return Zi.errors=[{instancePath:e+"/types/"+k.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/properties/types/patternProperties/.*/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;p[k]=!0}}else return Zi.errors=[{instancePath:e+"/types",schemaPath:"#/properties/types/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;var m=I===a}else var m=!0;if(m)if(t.structure!==void 0){let B=t.structure,I=a;if(a===I)if(B&&typeof B=="object"&&!Array.isArray(B)){var S={};for(let k in B)oz.test(k)&&(Ir(B[k],{instancePath:e+"/structure/"+k.replace(/~/g,"~0").replace(/\//g,"~1"),parentData:B,parentDataProperty:k,rootData:i,dynamicAnchors:o})||(s=s===null?Ir.errors:s.concat(Ir.errors),a=s.length),S[k]=!0)}else return Zi.errors=[{instancePath:e+"/structure",schemaPath:"#/properties/structure/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;var m=I===a}else var m=!0}}}}}else return Zi.errors=[{instancePath:e,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;return Zi.errors=s,a===0}Zi.evaluated={props:!0,dynamicProps:!1,dynamicItems:!1};var x1e=Ir,E1e=As,cz={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://identity.foundation/dwn/json-schemas/protocols-configure.json",type:"object",additionalProperties:!1,required:["authorization","descriptor"],properties:{authorization:{$ref:"https://identity.foundation/dwn/json-schemas/authorization.json"},descriptor:{type:"object",additionalProperties:!1,required:["interface","method","messageTimestamp","definition"],properties:{interface:{enum:["Protocols"],type:"string"},method:{enum:["Configure"],type:"string"},messageTimestamp:{$ref:"https://identity.foundation/dwn/json-schemas/defs.json#/$defs/date-time"},definition:{$ref:"https://identity.foundation/dwn/json-schemas/protocol-definition.json"}}}}};function As(t,{instancePath:e="",parentData:r,parentDataProperty:n,rootData:i=t,dynamicAnchors:o={}}={}){let s=null,a=0,d=As.evaluated;if(d.dynamicProps&&(d.props=void 0),d.dynamicItems&&(d.items=void 0),a===0)if(t&&typeof t=="object"&&!Array.isArray(t)){let w;if(t.authorization===void 0&&(w="authorization")||t.descriptor===void 0&&(w="descriptor"))return As.errors=[{instancePath:e,schemaPath:"#/required",keyword:"required",params:{missingProperty:w},message:"must have required property '"+w+"'"}],!1;{let P=a;for(let S in t)if(!(S==="authorization"||S==="descriptor")){return As.errors=[{instancePath:e,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:S},message:"must NOT have additional properties"}],!1;break}if(P===a){if(t.authorization!==void 0){let S=a;Yn(t.authorization,{instancePath:e+"/authorization",parentData:t,parentDataProperty:"authorization",rootData:i,dynamicAnchors:o})||(s=s===null?Yn.errors:s.concat(Yn.errors),a=s.length);var m=S===a}else var m=!0;if(m)if(t.descriptor!==void 0){let S=t.descriptor,M=a;if(a===M)if(S&&typeof S=="object"&&!Array.isArray(S)){let B;if(S.interface===void 0&&(B="interface")||S.method===void 0&&(B="method")||S.messageTimestamp===void 0&&(B="messageTimestamp")||S.definition===void 0&&(B="definition"))return As.errors=[{instancePath:e+"/descriptor",schemaPath:"#/properties/descriptor/required",keyword:"required",params:{missingProperty:B},message:"must have required property '"+B+"'"}],!1;{let I=a;for(let C in S)if(!(C==="interface"||C==="method"||C==="messageTimestamp"||C==="definition")){return As.errors=[{instancePath:e+"/descriptor",schemaPath:"#/properties/descriptor/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:C},message:"must NOT have additional properties"}],!1;break}if(I===a){if(S.interface!==void 0){let C=S.interface,k=a;if(typeof C!="string")return As.errors=[{instancePath:e+"/descriptor/interface",schemaPath:"#/properties/descriptor/properties/interface/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;if(C!=="Protocols")return As.errors=[{instancePath:e+"/descriptor/interface",schemaPath:"#/properties/descriptor/properties/interface/enum",keyword:"enum",params:{allowedValues:cz.properties.descriptor.properties.interface.enum},message:"must be equal to one of the allowed values"}],!1;var p=k===a}else var p=!0;if(p){if(S.method!==void 0){let C=S.method,k=a;if(typeof C!="string")return As.errors=[{instancePath:e+"/descriptor/method",schemaPath:"#/properties/descriptor/properties/method/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;if(C!=="Configure")return As.errors=[{instancePath:e+"/descriptor/method",schemaPath:"#/properties/descriptor/properties/method/enum",keyword:"enum",params:{allowedValues:cz.properties.descriptor.properties.method.enum},message:"must be equal to one of the allowed values"}],!1;var p=k===a}else var p=!0;if(p){if(S.messageTimestamp!==void 0){let C=S.messageTimestamp,k=a;if(a===a)if(typeof C=="string"){if(!Jn.test(C))return As.errors=[{instancePath:e+"/descriptor/messageTimestamp",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/$defs/date-time/pattern",keyword:"pattern",params:{pattern:"^\\d{4}-[0-1]\\d-[0-3]\\dT(?:[0-2]\\d:[0-5]\\d:[0-5]\\d|23:59:60)\\.\\d{6}Z$"},message:'must match pattern "^\\d{4}-[0-1]\\d-[0-3]\\dT(?:[0-2]\\d:[0-5]\\d:[0-5]\\d|23:59:60)\\.\\d{6}Z$"'}],!1}else return As.errors=[{instancePath:e+"/descriptor/messageTimestamp",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/$defs/date-time/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var p=k===a}else var p=!0;if(p)if(S.definition!==void 0){let C=a;Zi(S.definition,{instancePath:e+"/descriptor/definition",parentData:S,parentDataProperty:"definition",rootData:i,dynamicAnchors:o})||(s=s===null?Zi.errors:s.concat(Zi.errors),a=s.length);var p=C===a}else var p=!0}}}}}else return As.errors=[{instancePath:e+"/descriptor",schemaPath:"#/properties/descriptor/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;var m=M===a}else var m=!0}}}else return As.errors=[{instancePath:e,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;return As.errors=s,a===0}As.evaluated={props:!0,dynamicProps:!1,dynamicItems:!1};var S1e=Ei,fz={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://identity.foundation/dwn/json-schemas/protocols-query.json",type:"object",additionalProperties:!1,required:["descriptor"],properties:{authorization:{$ref:"https://identity.foundation/dwn/json-schemas/authorization.json"},descriptor:{type:"object",additionalProperties:!1,required:["interface","method","messageTimestamp"],properties:{interface:{enum:["Protocols"],type:"string"},method:{enum:["Query"],type:"string"},messageTimestamp:{$ref:"https://identity.foundation/dwn/json-schemas/defs.json#/$defs/date-time"},filter:{type:"object",minProperties:1,additionalProperties:!1,properties:{protocol:{type:"string"},recipient:{$ref:"https://identity.foundation/dwn/json-schemas/defs.json#/$defs/did"}}}}}}};function Ei(t,{instancePath:e="",parentData:r,parentDataProperty:n,rootData:i=t,dynamicAnchors:o={}}={}){let s=null,a=0,d=Ei.evaluated;if(d.dynamicProps&&(d.props=void 0),d.dynamicItems&&(d.items=void 0),a===0)if(t&&typeof t=="object"&&!Array.isArray(t)){let P;if(t.descriptor===void 0&&(P="descriptor"))return Ei.errors=[{instancePath:e,schemaPath:"#/required",keyword:"required",params:{missingProperty:P},message:"must have required property '"+P+"'"}],!1;{let S=a;for(let M in t)if(!(M==="authorization"||M==="descriptor")){return Ei.errors=[{instancePath:e,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:M},message:"must NOT have additional properties"}],!1;break}if(S===a){if(t.authorization!==void 0){let M=a;Yn(t.authorization,{instancePath:e+"/authorization",parentData:t,parentDataProperty:"authorization",rootData:i,dynamicAnchors:o})||(s=s===null?Yn.errors:s.concat(Yn.errors),a=s.length);var m=M===a}else var m=!0;if(m)if(t.descriptor!==void 0){let M=t.descriptor,A=a;if(a===A)if(M&&typeof M=="object"&&!Array.isArray(M)){let I;if(M.interface===void 0&&(I="interface")||M.method===void 0&&(I="method")||M.messageTimestamp===void 0&&(I="messageTimestamp"))return Ei.errors=[{instancePath:e+"/descriptor",schemaPath:"#/properties/descriptor/required",keyword:"required",params:{missingProperty:I},message:"must have required property '"+I+"'"}],!1;{let C=a;for(let k in M)if(!(k==="interface"||k==="method"||k==="messageTimestamp"||k==="filter")){return Ei.errors=[{instancePath:e+"/descriptor",schemaPath:"#/properties/descriptor/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:k},message:"must NOT have additional properties"}],!1;break}if(C===a){if(M.interface!==void 0){let k=M.interface,q=a;if(typeof k!="string")return Ei.errors=[{instancePath:e+"/descriptor/interface",schemaPath:"#/properties/descriptor/properties/interface/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;if(k!=="Protocols")return Ei.errors=[{instancePath:e+"/descriptor/interface",schemaPath:"#/properties/descriptor/properties/interface/enum",keyword:"enum",params:{allowedValues:fz.properties.descriptor.properties.interface.enum},message:"must be equal to one of the allowed values"}],!1;var p=q===a}else var p=!0;if(p){if(M.method!==void 0){let k=M.method,q=a;if(typeof k!="string")return Ei.errors=[{instancePath:e+"/descriptor/method",schemaPath:"#/properties/descriptor/properties/method/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;if(k!=="Query")return Ei.errors=[{instancePath:e+"/descriptor/method",schemaPath:"#/properties/descriptor/properties/method/enum",keyword:"enum",params:{allowedValues:fz.properties.descriptor.properties.method.enum},message:"must be equal to one of the allowed values"}],!1;var p=q===a}else var p=!0;if(p){if(M.messageTimestamp!==void 0){let k=M.messageTimestamp,q=a;if(a===a)if(typeof k=="string"){if(!Jn.test(k))return Ei.errors=[{instancePath:e+"/descriptor/messageTimestamp",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/$defs/date-time/pattern",keyword:"pattern",params:{pattern:"^\\d{4}-[0-1]\\d-[0-3]\\dT(?:[0-2]\\d:[0-5]\\d:[0-5]\\d|23:59:60)\\.\\d{6}Z$"},message:'must match pattern "^\\d{4}-[0-1]\\d-[0-3]\\dT(?:[0-2]\\d:[0-5]\\d:[0-5]\\d|23:59:60)\\.\\d{6}Z$"'}],!1}else return Ei.errors=[{instancePath:e+"/descriptor/messageTimestamp",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/$defs/date-time/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var p=q===a}else var p=!0;if(p)if(M.filter!==void 0){let k=M.filter,q=a;if(a===q)if(k&&typeof k=="object"&&!Array.isArray(k)){if(Object.keys(k).length<1)return Ei.errors=[{instancePath:e+"/descriptor/filter",schemaPath:"#/properties/descriptor/properties/filter/minProperties",keyword:"minProperties",params:{limit:1},message:"must NOT have fewer than 1 properties"}],!1;{let U=a;for(let F in k)if(!(F==="protocol"||F==="recipient")){return Ei.errors=[{instancePath:e+"/descriptor/filter",schemaPath:"#/properties/descriptor/properties/filter/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:F},message:"must NOT have additional properties"}],!1;break}if(U===a){if(k.protocol!==void 0){let F=a;if(typeof k.protocol!="string")return Ei.errors=[{instancePath:e+"/descriptor/filter/protocol",schemaPath:"#/properties/descriptor/properties/filter/properties/protocol/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var w=F===a}else var w=!0;if(w)if(k.recipient!==void 0){let F=k.recipient,N=a;if(a===a)if(typeof F=="string"){if(!K0.test(F))return Ei.errors=[{instancePath:e+"/descriptor/filter/recipient",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/$defs/did/pattern",keyword:"pattern",params:{pattern:"^did:([a-z0-9]+):((?:(?:[a-zA-Z0-9._-]|(?:%[0-9a-fA-F]{2}))*:)*((?:[a-zA-Z0-9._-]|(?:%[0-9a-fA-F]{2}))+))((;[a-zA-Z0-9_.:%-]+=[a-zA-Z0-9_.:%-]*)*)(/[^#?]*)?([?][^#]*)?(#.*)?$"},message:'must match pattern "^did:([a-z0-9]+):((?:(?:[a-zA-Z0-9._-]|(?:%[0-9a-fA-F]{2}))*:)*((?:[a-zA-Z0-9._-]|(?:%[0-9a-fA-F]{2}))+))((;[a-zA-Z0-9_.:%-]+=[a-zA-Z0-9_.:%-]*)*)(/[^#?]*)?([?][^#]*)?(#.*)?$"'}],!1}else return Ei.errors=[{instancePath:e+"/descriptor/filter/recipient",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/$defs/did/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var w=N===a}else var w=!0}}}else return Ei.errors=[{instancePath:e+"/descriptor/filter",schemaPath:"#/properties/descriptor/properties/filter/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;var p=q===a}else var p=!0}}}}}else return Ei.errors=[{instancePath:e+"/descriptor",schemaPath:"#/properties/descriptor/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;var m=A===a}else var m=!0}}}else return Ei.errors=[{instancePath:e,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;return Ei.errors=s,a===0}Ei.evaluated={props:!0,dynamicProps:!1,dynamicItems:!1};var M1e=Ts,uz={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://identity.foundation/dwn/json-schemas/records-read.json",type:"object",additionalProperties:!1,required:["descriptor"],properties:{authorization:{$ref:"https://identity.foundation/dwn/json-schemas/authorization-delegated-grant.json"},descriptor:{type:"object",additionalProperties:!1,required:["interface","method","messageTimestamp","filter"],properties:{interface:{enum:["Records"],type:"string"},method:{enum:["Read"],type:"string"},messageTimestamp:{$ref:"https://identity.foundation/dwn/json-schemas/defs.json#/$defs/date-time"},filter:{$ref:"https://identity.foundation/dwn/json-schemas/records-filter.json"}}}}};function Ts(t,{instancePath:e="",parentData:r,parentDataProperty:n,rootData:i=t,dynamicAnchors:o={}}={}){let s=null,a=0,d=Ts.evaluated;if(d.dynamicProps&&(d.props=void 0),d.dynamicItems&&(d.items=void 0),a===0)if(t&&typeof t=="object"&&!Array.isArray(t)){let w;if(t.descriptor===void 0&&(w="descriptor"))return Ts.errors=[{instancePath:e,schemaPath:"#/required",keyword:"required",params:{missingProperty:w},message:"must have required property '"+w+"'"}],!1;{let P=a;for(let S in t)if(!(S==="authorization"||S==="descriptor")){return Ts.errors=[{instancePath:e,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:S},message:"must NOT have additional properties"}],!1;break}if(P===a){if(t.authorization!==void 0){let S=a;So(t.authorization,{instancePath:e+"/authorization",parentData:t,parentDataProperty:"authorization",rootData:i,dynamicAnchors:o})||(s=s===null?So.errors:s.concat(So.errors),a=s.length);var m=S===a}else var m=!0;if(m)if(t.descriptor!==void 0){let S=t.descriptor,M=a;if(a===M)if(S&&typeof S=="object"&&!Array.isArray(S)){let B;if(S.interface===void 0&&(B="interface")||S.method===void 0&&(B="method")||S.messageTimestamp===void 0&&(B="messageTimestamp")||S.filter===void 0&&(B="filter"))return Ts.errors=[{instancePath:e+"/descriptor",schemaPath:"#/properties/descriptor/required",keyword:"required",params:{missingProperty:B},message:"must have required property '"+B+"'"}],!1;{let I=a;for(let C in S)if(!(C==="interface"||C==="method"||C==="messageTimestamp"||C==="filter")){return Ts.errors=[{instancePath:e+"/descriptor",schemaPath:"#/properties/descriptor/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:C},message:"must NOT have additional properties"}],!1;break}if(I===a){if(S.interface!==void 0){let C=S.interface,k=a;if(typeof C!="string")return Ts.errors=[{instancePath:e+"/descriptor/interface",schemaPath:"#/properties/descriptor/properties/interface/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;if(C!=="Records")return Ts.errors=[{instancePath:e+"/descriptor/interface",schemaPath:"#/properties/descriptor/properties/interface/enum",keyword:"enum",params:{allowedValues:uz.properties.descriptor.properties.interface.enum},message:"must be equal to one of the allowed values"}],!1;var p=k===a}else var p=!0;if(p){if(S.method!==void 0){let C=S.method,k=a;if(typeof C!="string")return Ts.errors=[{instancePath:e+"/descriptor/method",schemaPath:"#/properties/descriptor/properties/method/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;if(C!=="Read")return Ts.errors=[{instancePath:e+"/descriptor/method",schemaPath:"#/properties/descriptor/properties/method/enum",keyword:"enum",params:{allowedValues:uz.properties.descriptor.properties.method.enum},message:"must be equal to one of the allowed values"}],!1;var p=k===a}else var p=!0;if(p){if(S.messageTimestamp!==void 0){let C=S.messageTimestamp,k=a;if(a===a)if(typeof C=="string"){if(!Jn.test(C))return Ts.errors=[{instancePath:e+"/descriptor/messageTimestamp",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/$defs/date-time/pattern",keyword:"pattern",params:{pattern:"^\\d{4}-[0-1]\\d-[0-3]\\dT(?:[0-2]\\d:[0-5]\\d:[0-5]\\d|23:59:60)\\.\\d{6}Z$"},message:'must match pattern "^\\d{4}-[0-1]\\d-[0-3]\\dT(?:[0-2]\\d:[0-5]\\d:[0-5]\\d|23:59:60)\\.\\d{6}Z$"'}],!1}else return Ts.errors=[{instancePath:e+"/descriptor/messageTimestamp",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/$defs/date-time/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var p=k===a}else var p=!0;if(p)if(S.filter!==void 0){let C=a;it(S.filter,{instancePath:e+"/descriptor/filter",parentData:S,parentDataProperty:"filter",rootData:i,dynamicAnchors:o})||(s=s===null?it.errors:s.concat(it.errors),a=s.length);var p=C===a}else var p=!0}}}}}else return Ts.errors=[{instancePath:e+"/descriptor",schemaPath:"#/properties/descriptor/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;var m=M===a}else var m=!0}}}else return Ts.errors=[{instancePath:e,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;return Ts.errors=s,a===0}Ts.evaluated={props:!0,dynamicProps:!1,dynamicItems:!1};var P1e=it,A1e=an,T1e=xf;function xf(t,{instancePath:e="",parentData:r,parentDataProperty:n,rootData:i=t,dynamicAnchors:o={}}={}){let s=null,a=0,d=xf.evaluated;if(d.dynamicProps&&(d.props=void 0),d.dynamicItems&&(d.items=void 0),a===0)if(t&&typeof t=="object"&&!Array.isArray(t)){let p;if(t.descriptorCid===void 0&&(p="descriptorCid"))return xf.errors=[{instancePath:e,schemaPath:"#/required",keyword:"required",params:{missingProperty:p},message:"must have required property '"+p+"'"}],!1;{let w=a;for(let P in t)if(!(P==="descriptorCid"||P==="delegatedGrantId"||P==="permissionGrantId"||P==="protocolRole")){return xf.errors=[{instancePath:e,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:P},message:"must NOT have additional properties"}],!1;break}if(w===a){if(t.descriptorCid!==void 0){let P=a;if(typeof t.descriptorCid!="string")return xf.errors=[{instancePath:e+"/descriptorCid",schemaPath:"#/properties/descriptorCid/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var m=P===a}else var m=!0;if(m){if(t.delegatedGrantId!==void 0){let P=a;if(typeof t.delegatedGrantId!="string")return xf.errors=[{instancePath:e+"/delegatedGrantId",schemaPath:"#/properties/delegatedGrantId/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var m=P===a}else var m=!0;if(m){if(t.permissionGrantId!==void 0){let P=a;if(typeof t.permissionGrantId!="string")return xf.errors=[{instancePath:e+"/permissionGrantId",schemaPath:"#/properties/permissionGrantId/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var m=P===a}else var m=!0;if(m)if(t.protocolRole!==void 0){let P=a;if(typeof t.protocolRole!="string")return xf.errors=[{instancePath:e+"/protocolRole",schemaPath:"#/properties/protocolRole/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var m=P===a}else var m=!0}}}}}else return xf.errors=[{instancePath:e,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;return xf.errors=s,a===0}xf.evaluated={props:!0,dynamicProps:!1,dynamicItems:!1};var R1e=Qs;function Qs(t,{instancePath:e="",parentData:r,parentDataProperty:n,rootData:i=t,dynamicAnchors:o={}}={}){let s=null,a=0,d=Qs.evaluated;if(d.dynamicProps&&(d.props=void 0),d.dynamicItems&&(d.items=void 0),a===0)if(t&&typeof t=="object"&&!Array.isArray(t)){let p;if(t.descriptorCid===void 0&&(p="descriptorCid")||t.recordId===void 0&&(p="recordId"))return Qs.errors=[{instancePath:e,schemaPath:"#/required",keyword:"required",params:{missingProperty:p},message:"must have required property '"+p+"'"}],!1;{let w=a;for(let P in t)if(!(P==="descriptorCid"||P==="recordId"||P==="contextId"||P==="attestationCid"||P==="encryptionCid"||P==="delegatedGrantId"||P==="permissionGrantId"||P==="protocolRole")){return Qs.errors=[{instancePath:e,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:P},message:"must NOT have additional properties"}],!1;break}if(w===a){if(t.descriptorCid!==void 0){let P=a;if(typeof t.descriptorCid!="string")return Qs.errors=[{instancePath:e+"/descriptorCid",schemaPath:"#/properties/descriptorCid/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var m=P===a}else var m=!0;if(m){if(t.recordId!==void 0){let P=a;if(typeof t.recordId!="string")return Qs.errors=[{instancePath:e+"/recordId",schemaPath:"#/properties/recordId/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var m=P===a}else var m=!0;if(m){if(t.contextId!==void 0){let P=a;if(typeof t.contextId!="string")return Qs.errors=[{instancePath:e+"/contextId",schemaPath:"#/properties/contextId/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var m=P===a}else var m=!0;if(m){if(t.attestationCid!==void 0){let P=a;if(typeof t.attestationCid!="string")return Qs.errors=[{instancePath:e+"/attestationCid",schemaPath:"#/properties/attestationCid/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var m=P===a}else var m=!0;if(m){if(t.encryptionCid!==void 0){let P=a;if(typeof t.encryptionCid!="string")return Qs.errors=[{instancePath:e+"/encryptionCid",schemaPath:"#/properties/encryptionCid/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var m=P===a}else var m=!0;if(m){if(t.delegatedGrantId!==void 0){let P=a;if(typeof t.delegatedGrantId!="string")return Qs.errors=[{instancePath:e+"/delegatedGrantId",schemaPath:"#/properties/delegatedGrantId/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var m=P===a}else var m=!0;if(m){if(t.permissionGrantId!==void 0){let P=a;if(typeof t.permissionGrantId!="string")return Qs.errors=[{instancePath:e+"/permissionGrantId",schemaPath:"#/properties/permissionGrantId/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var m=P===a}else var m=!0;if(m)if(t.protocolRole!==void 0){let P=a;if(typeof t.protocolRole!="string")return Qs.errors=[{instancePath:e+"/protocolRole",schemaPath:"#/properties/protocolRole/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var m=P===a}else var m=!0}}}}}}}}}else return Qs.errors=[{instancePath:e,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;return Qs.errors=s,a===0}Qs.evaluated={props:!0,dynamicProps:!1,dynamicItems:!1};var I1e=Xs;function Xs(t,{instancePath:e="",parentData:r,parentDataProperty:n,rootData:i=t,dynamicAnchors:o={}}={}){let s=null,a=0,d=Xs.evaluated;if(d.dynamicProps&&(d.props=void 0),d.dynamicItems&&(d.items=void 0),a===0)if(t&&typeof t=="object"&&!Array.isArray(t)){if(Object.keys(t).length<1)return Xs.errors=[{instancePath:e,schemaPath:"#/minProperties",keyword:"minProperties",params:{limit:1},message:"must NOT have fewer than 1 properties"}],!1;{let A=a;for(let B in t)if(!(B==="gt"||B==="gte"||B==="lt"||B==="lte")){return Xs.errors=[{instancePath:e,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:B},message:"must NOT have additional properties"}],!1;break}if(A===a){if(t.gt!==void 0){let B=a,I=a,C=a;if(t&&typeof t=="object"&&!Array.isArray(t)){let k;if(t.gte===void 0&&(k="gte")){let q={};s===null?s=[q]:s.push(q),a++}}var m=C===a;if(m)return Xs.errors=[{instancePath:e,schemaPath:"#/dependencies/gt/not",keyword:"not",params:{},message:"must NOT be valid"}],!1;a=I,s!==null&&(I?s.length=I:s=null);var p=B===a}else var p=!0;if(p){if(t.gte!==void 0){let B=a,I=a,C=a;if(t&&typeof t=="object"&&!Array.isArray(t)){let q;if(t.gt===void 0&&(q="gt")){let L={};s===null?s=[L]:s.push(L),a++}}var w=C===a;if(w)return Xs.errors=[{instancePath:e,schemaPath:"#/dependencies/gte/not",keyword:"not",params:{},message:"must NOT be valid"}],!1;a=I,s!==null&&(I?s.length=I:s=null);var p=B===a}else var p=!0;if(p){if(t.lt!==void 0){let B=a,I=a,C=a;if(t&&typeof t=="object"&&!Array.isArray(t)){let q;if(t.lte===void 0&&(q="lte")){let L={};s===null?s=[L]:s.push(L),a++}}var P=C===a;if(P)return Xs.errors=[{instancePath:e,schemaPath:"#/dependencies/lt/not",keyword:"not",params:{},message:"must NOT be valid"}],!1;a=I,s!==null&&(I?s.length=I:s=null);var p=B===a}else var p=!0;if(p){if(t.lte!==void 0){let B=a,I=a,C=a;if(t&&typeof t=="object"&&!Array.isArray(t)){let q;if(t.lt===void 0&&(q="lt")){let L={};s===null?s=[L]:s.push(L),a++}}var S=C===a;if(S)return Xs.errors=[{instancePath:e,schemaPath:"#/dependencies/lte/not",keyword:"not",params:{},message:"must NOT be valid"}],!1;a=I,s!==null&&(I?s.length=I:s=null);var p=B===a}else var p=!0;if(p){if(t.gt!==void 0){let B=a;if(typeof t.gt!="string")return Xs.errors=[{instancePath:e+"/gt",schemaPath:"#/properties/gt/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var M=B===a}else var M=!0;if(M){if(t.gte!==void 0){let B=a;if(typeof t.gte!="string")return Xs.errors=[{instancePath:e+"/gte",schemaPath:"#/properties/gte/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var M=B===a}else var M=!0;if(M){if(t.lt!==void 0){let B=a;if(typeof t.lt!="string")return Xs.errors=[{instancePath:e+"/lt",schemaPath:"#/properties/lt/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var M=B===a}else var M=!0;if(M)if(t.lte!==void 0){let B=a;if(typeof t.lte!="string")return Xs.errors=[{instancePath:e+"/lte",schemaPath:"#/properties/lte/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var M=B===a}else var M=!0}}}}}}}}}else return Xs.errors=[{instancePath:e,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;return Xs.errors=s,a===0}Xs.evaluated={props:!0,dynamicProps:!1,dynamicItems:!1};function hd(t,e){let r=tR[t];if(!r)throw new be("SchemaValidatorSchemaNotFound",`schema for ${t} not found.`);if(r(e),!r.errors)return;let[n]=r.errors,{instancePath:i,message:o,keyword:s}=n;if(i||(i=t),s==="additionalProperties"){let a=n.params.additionalProperty;throw new be("SchemaValidatorAdditionalPropertyNotAllowed",`${o}: ${i}: ${a}`)}if(s==="unevaluatedProperties"){let a=n.params.unevaluatedProperty;throw new be("SchemaValidatorUnevaluatedPropertyNotAllowed",`${o}: ${i}: ${a}`)}throw new be("SchemaValidatorFailure",`${i}: ${o}`)}var _a=class{constructor(e){this.cache=e||new UE(600)}static get singleton(){return _a._singleton===void 0&&(_a._singleton=new _a),_a._singleton}static async verifySignatures(e,r){return await _a.singleton.verifySignatures(e,r)}async verifySignatures(e,r){let n=[];for(let i of e.signatures){let o,s=zt.getKid(i),a=`${i.protected}.${e.payload}.${i.signature}`,d=await this.cache.get(a);if(d===void 0){let p=await _a.getPublicKey(s,r);o=await zt.verifySignature(e.payload,i,p),await this.cache.set(a,o)}else o=d;let m=zt.extractDid(s);if(o)n.push(m);else throw new be("GeneralJwsVerifierInvalidSignature",`Signature verification failed for ${m}`)}return{signers:n}}static async getPublicKey(e,r){let n=zt.extractDid(e),{didDocument:i}=await r.resolve(n),{verificationMethod:o=[]}=i||{},s;for(let d of o)if(e.endsWith(d.id)){s=d;break}if(!s)throw new be("GeneralJwsVerifierGetPublicKeyNotFound","public key needed to verify signature not found in DID Document");hd("JwkVerificationMethod",s);let{publicKeyJwk:a}=s;return a}};E();E();var yd={};Di(yd,{code:()=>Vh,decode:()=>bR,encode:()=>F2e,name:()=>U2e});E();E();E();E();var k1e=["string","number","bigint","symbol"],O1e=["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 hz(t){if(t===null)return"null";if(t===void 0)return"undefined";if(t===!0||t===!1)return"boolean";let e=typeof t;if(k1e.includes(e))return e;if(e==="function")return"Function";if(Array.isArray(t))return"Array";if(B1e(t))return"Buffer";let r=D1e(t);return r||"Object"}function B1e(t){return t&&t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer.call(null,t)}function D1e(t){let e=Object.prototype.toString.call(t).slice(8,-1);if(O1e.includes(e))return e}E();var $e=class{constructor(e,r,n){this.major=e,this.majorEncoded=e<<5,this.name=r,this.terminal=n}toString(){return`Type[${this.major}].${this.name}`}compare(e){return this.major<e.major?-1:this.major>e.major?1:0}};$e.uint=new $e(0,"uint",!0);$e.negint=new $e(1,"negint",!0);$e.bytes=new $e(2,"bytes",!0);$e.string=new $e(3,"string",!0);$e.array=new $e(4,"array",!1);$e.map=new $e(5,"map",!1);$e.tag=new $e(6,"tag",!1);$e.float=new $e(7,"float",!0);$e.false=new $e(7,"false",!0);$e.true=new $e(7,"true",!0);$e.null=new $e(7,"null",!0);$e.undefined=new $e(7,"undefined",!0);$e.break=new $e(7,"break",!0);var tt=class{constructor(e,r,n){this.type=e,this.value=r,this.encodedLength=n,this.encodedBytes=void 0,this.byteValue=void 0}toString(){return`Token[${this.type}].${this.value}`}};E();E();var Hg=globalThis.process&&!globalThis.process.browser&&globalThis.Buffer&&typeof globalThis.Buffer.isBuffer=="function",C1e=new TextDecoder,j1e=new TextEncoder;function KE(t){return Hg&&globalThis.Buffer.isBuffer(t)}function rR(t){return t instanceof Uint8Array?KE(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):t:Uint8Array.from(t)}var gz=Hg?(t,e,r)=>r-e>64?globalThis.Buffer.from(t.subarray(e,r)).toString("utf8"):mz(t,e,r):(t,e,r)=>r-e>64?C1e.decode(t.subarray(e,r)):mz(t,e,r),vz=Hg?t=>t.length>64?globalThis.Buffer.from(t):pz(t):t=>t.length>64?j1e.encode(t):pz(t),ku=t=>Uint8Array.from(t),Zg=Hg?(t,e,r)=>KE(t)?new Uint8Array(t.subarray(e,r)):t.slice(e,r):(t,e,r)=>t.slice(e,r),bz=Hg?(t,e)=>(t=t.map(r=>r instanceof Uint8Array?r:globalThis.Buffer.from(r)),rR(globalThis.Buffer.concat(t,e))):(t,e)=>{let r=new Uint8Array(e),n=0;for(let i of t)n+i.length>r.length&&(i=i.subarray(0,r.length-n)),r.set(i,n),n+=i.length;return r},wz=Hg?t=>globalThis.Buffer.allocUnsafe(t):t=>new Uint8Array(t);function _z(t,e){if(KE(t)&&KE(e))return t.compare(e);for(let r=0;r<t.length;r++)if(t[r]!==e[r])return t[r]<e[r]?-1:1;return 0}function pz(t,e=1/0){let r,n=t.length,i=null,o=[];for(let s=0;s<n;++s){if(r=t.charCodeAt(s),r>55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&o.push(239,191,189);continue}else if(s+1===n){(e-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&o.push(239,191,189),i=r;continue}r=(i-55296<<10|r-56320)+65536}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;o.push(r)}else if(r<2048){if((e-=2)<0)break;o.push(r>>6|192,r&63|128)}else if(r<65536){if((e-=3)<0)break;o.push(r>>12|224,r>>6&63|128,r&63|128)}else if(r<1114112){if((e-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,r&63|128)}else throw new Error("Invalid code point")}return o}function mz(t,e,r){let n=[];for(;e<r;){let i=t[e],o=null,s=i>239?4:i>223?3:i>191?2:1;if(e+s<=r){let a,d,m,p;switch(s){case 1:i<128&&(o=i);break;case 2:a=t[e+1],(a&192)===128&&(p=(i&31)<<6|a&63,p>127&&(o=p));break;case 3:a=t[e+1],d=t[e+2],(a&192)===128&&(d&192)===128&&(p=(i&15)<<12|(a&63)<<6|d&63,p>2047&&(p<55296||p>57343)&&(o=p));break;case 4:a=t[e+1],d=t[e+2],m=t[e+3],(a&192)===128&&(d&192)===128&&(m&192)===128&&(p=(i&15)<<18|(a&63)<<12|(d&63)<<6|m&63,p>65535&&p<1114112&&(o=p))}}o===null?(o=65533,s=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|o&1023),n.push(o),e+=s}return N1e(n)}var yz=4096;function N1e(t){let e=t.length;if(e<=yz)return String.fromCharCode.apply(String,t);let r="",n=0;for(;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=yz));return r}var q1e=256,O1=class{constructor(e=q1e){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=[]),this._initReuseChunk!==null&&(this.chunks.push(this._initReuseChunk),this.maxCursor=this._initReuseChunk.length-1)}push(e){let r=this.chunks[this.chunks.length-1];if(this.cursor+e.length<=this.maxCursor+1){let i=r.length-(this.maxCursor-this.cursor)-1;r.set(e,i)}else{if(r){let i=r.length-(this.maxCursor-this.cursor)-1;i<r.length&&(this.chunks[this.chunks.length-1]=r.subarray(0,i),this.maxCursor=this.cursor-1)}e.length<64&&e.length<this.chunkSize?(r=wz(this.chunkSize),this.chunks.push(r),this.maxCursor+=r.length,this._initReuseChunk===null&&(this._initReuseChunk=r),r.set(e,0)):(this.chunks.push(e),this.maxCursor+=e.length)}this.cursor+=e.length}toBytes(e=!1){let r;if(this.chunks.length===1){let n=this.chunks[0];e&&this.cursor>n.length/2?(r=this.cursor===n.length?n:n.subarray(0,this.cursor),this._initReuseChunk=null,this.chunks=[]):r=Zg(n,0,this.cursor)}else r=bz(this.chunks,this.cursor);return e&&this.reset(),r}};E();var Ht="CBOR decode error:",nR="CBOR encode error:",B1=[];B1[23]=1;B1[24]=2;B1[25]=3;B1[26]=5;B1[27]=9;function pd(t,e,r){if(t.length-e<r)throw new Error(`${Ht} not enough data for type`)}E();E();var Mo=[24,256,65536,4294967296,BigInt("18446744073709551616")];function za(t,e,r){pd(t,e,1);let n=t[e];if(r.strict===!0&&n<Mo[0])throw new Error(`${Ht} integer encoded in more bytes than necessary (strict decode)`);return n}function Ka(t,e,r){pd(t,e,2);let n=t[e]<<8|t[e+1];if(r.strict===!0&&n<Mo[1])throw new Error(`${Ht} integer encoded in more bytes than necessary (strict decode)`);return n}function Ga(t,e,r){pd(t,e,4);let n=t[e]*16777216+(t[e+1]<<16)+(t[e+2]<<8)+t[e+3];if(r.strict===!0&&n<Mo[2])throw new Error(`${Ht} integer encoded in more bytes than necessary (strict decode)`);return n}function Wa(t,e,r){pd(t,e,8);let n=t[e]*16777216+(t[e+1]<<16)+(t[e+2]<<8)+t[e+3],i=t[e+4]*16777216+(t[e+5]<<16)+(t[e+6]<<8)+t[e+7],o=(BigInt(n)<<BigInt(32))+BigInt(i);if(r.strict===!0&&o<Mo[3])throw new Error(`${Ht} integer encoded in more bytes than necessary (strict decode)`);if(o<=Number.MAX_SAFE_INTEGER)return Number(o);if(r.allowBigInt===!0)return o;throw new Error(`${Ht} integers outside of the safe integer range are not supported`)}function xz(t,e,r,n){return new tt($e.uint,za(t,e+1,n),2)}function Ez(t,e,r,n){return new tt($e.uint,Ka(t,e+1,n),3)}function Sz(t,e,r,n){return new tt($e.uint,Ga(t,e+1,n),5)}function Mz(t,e,r,n){return new tt($e.uint,Wa(t,e+1,n),9)}function Mc(t,e){return Ko(t,0,e.value)}function Ko(t,e,r){if(r<Mo[0]){let n=Number(r);t.push([e|n])}else if(r<Mo[1]){let n=Number(r);t.push([e|24,n])}else if(r<Mo[2]){let n=Number(r);t.push([e|25,n>>>8,n&255])}else if(r<Mo[3]){let n=Number(r);t.push([e|26,n>>>24&255,n>>>16&255,n>>>8&255,n&255])}else{let n=BigInt(r);if(n<Mo[4]){let i=[e|27,0,0,0,0,0,0,0],o=Number(n&BigInt(4294967295)),s=Number(n>>BigInt(32)&BigInt(4294967295));i[8]=o&255,o=o>>8,i[7]=o&255,o=o>>8,i[6]=o&255,o=o>>8,i[5]=o&255,i[4]=s&255,s=s>>8,i[3]=s&255,s=s>>8,i[2]=s&255,s=s>>8,i[1]=s&255,t.push(i)}else throw new Error(`${Ht} encountered BigInt larger than allowable range`)}}Mc.encodedSize=function(e){return Ko.encodedSize(e.value)};Ko.encodedSize=function(e){return e<Mo[0]?1:e<Mo[1]?2:e<Mo[2]?3:e<Mo[3]?5:9};Mc.compareTokens=function(e,r){return e.value<r.value?-1:e.value>r.value?1:0};E();function Pz(t,e,r,n){return new tt($e.negint,-1-za(t,e+1,n),2)}function Az(t,e,r,n){return new tt($e.negint,-1-Ka(t,e+1,n),3)}function Tz(t,e,r,n){return new tt($e.negint,-1-Ga(t,e+1,n),5)}var iR=BigInt(-1),Rz=BigInt(1);function Iz(t,e,r,n){let i=Wa(t,e+1,n);if(typeof i!="bigint"){let o=-1-i;if(o>=Number.MIN_SAFE_INTEGER)return new tt($e.negint,o,9)}if(n.allowBigInt!==!0)throw new Error(`${Ht} integers outside of the safe integer range are not supported`);return new tt($e.negint,iR-BigInt(i),9)}function GE(t,e){let r=e.value,n=typeof r=="bigint"?r*iR-Rz:r*-1-1;Ko(t,e.type.majorEncoded,n)}GE.encodedSize=function(e){let r=e.value,n=typeof r=="bigint"?r*iR-Rz:r*-1-1;return n<Mo[0]?1:n<Mo[1]?2:n<Mo[2]?3:n<Mo[3]?5:9};GE.compareTokens=function(e,r){return e.value<r.value?1:e.value>r.value?-1:0};E();function D1(t,e,r,n){pd(t,e,r+n);let i=Zg(t,e+r,e+r+n);return new tt($e.bytes,i,r+n)}function kz(t,e,r,n){return D1(t,e,1,r)}function Oz(t,e,r,n){return D1(t,e,2,za(t,e+1,n))}function Bz(t,e,r,n){return D1(t,e,3,Ka(t,e+1,n))}function Dz(t,e,r,n){return D1(t,e,5,Ga(t,e+1,n))}function Cz(t,e,r,n){let i=Wa(t,e+1,n);if(typeof i=="bigint")throw new Error(`${Ht} 64-bit integer bytes lengths not supported`);return D1(t,e,9,i)}function WE(t){return t.encodedBytes===void 0&&(t.encodedBytes=t.type===$e.string?vz(t.value):t.value),t.encodedBytes}function Jg(t,e){let r=WE(e);Ko(t,e.type.majorEncoded,r.length),t.push(r)}Jg.encodedSize=function(e){let r=WE(e);return Ko.encodedSize(r.length)+r.length};Jg.compareTokens=function(e,r){return L1e(WE(e),WE(r))};function L1e(t,e){return t.length<e.length?-1:t.length>e.length?1:_z(t,e)}E();function C1(t,e,r,n,i){let o=r+n;pd(t,e,o);let s=new tt($e.string,gz(t,e+r,e+o),o);return i.retainStringBytes===!0&&(s.byteValue=Zg(t,e+r,e+o)),s}function jz(t,e,r,n){return C1(t,e,1,r,n)}function Nz(t,e,r,n){return C1(t,e,2,za(t,e+1,n),n)}function qz(t,e,r,n){return C1(t,e,3,Ka(t,e+1,n),n)}function $z(t,e,r,n){return C1(t,e,5,Ga(t,e+1,n),n)}function Lz(t,e,r,n){let i=Wa(t,e+1,n);if(typeof i=="bigint")throw new Error(`${Ht} 64-bit integer string lengths not supported`);return C1(t,e,9,i,n)}var Uz=Jg;E();function Yg(t,e,r,n){return new tt($e.array,n,r)}function Fz(t,e,r,n){return Yg(t,e,1,r)}function zz(t,e,r,n){return Yg(t,e,2,za(t,e+1,n))}function Kz(t,e,r,n){return Yg(t,e,3,Ka(t,e+1,n))}function Gz(t,e,r,n){return Yg(t,e,5,Ga(t,e+1,n))}function Wz(t,e,r,n){let i=Wa(t,e+1,n);if(typeof i=="bigint")throw new Error(`${Ht} 64-bit integer array lengths not supported`);return Yg(t,e,9,i)}function Vz(t,e,r,n){if(n.allowIndefinite===!1)throw new Error(`${Ht} indefinite length items not allowed`);return Yg(t,e,1,1/0)}function VE(t,e){Ko(t,$e.array.majorEncoded,e.value)}VE.compareTokens=Mc.compareTokens;VE.encodedSize=function(e){return Ko.encodedSize(e.value)};E();function Qg(t,e,r,n){return new tt($e.map,n,r)}function Hz(t,e,r,n){return Qg(t,e,1,r)}function Zz(t,e,r,n){return Qg(t,e,2,za(t,e+1,n))}function Jz(t,e,r,n){return Qg(t,e,3,Ka(t,e+1,n))}function Yz(t,e,r,n){return Qg(t,e,5,Ga(t,e+1,n))}function Qz(t,e,r,n){let i=Wa(t,e+1,n);if(typeof i=="bigint")throw new Error(`${Ht} 64-bit integer map lengths not supported`);return Qg(t,e,9,i)}function Xz(t,e,r,n){if(n.allowIndefinite===!1)throw new Error(`${Ht} indefinite length items not allowed`);return Qg(t,e,1,1/0)}function HE(t,e){Ko(t,$e.map.majorEncoded,e.value)}HE.compareTokens=Mc.compareTokens;HE.encodedSize=function(e){return Ko.encodedSize(e.value)};E();function eK(t,e,r,n){return new tt($e.tag,r,1)}function tK(t,e,r,n){return new tt($e.tag,za(t,e+1,n),2)}function rK(t,e,r,n){return new tt($e.tag,Ka(t,e+1,n),3)}function nK(t,e,r,n){return new tt($e.tag,Ga(t,e+1,n),5)}function iK(t,e,r,n){return new tt($e.tag,Wa(t,e+1,n),9)}function ZE(t,e){Ko(t,$e.tag.majorEncoded,e.value)}ZE.compareTokens=Mc.compareTokens;ZE.encodedSize=function(e){return Ko.encodedSize(e.value)};E();var W1e=20,V1e=21,H1e=22,Z1e=23;function oK(t,e,r,n){if(n.allowUndefined===!1)throw new Error(`${Ht} undefined values are not supported`);return n.coerceUndefinedToNull===!0?new tt($e.null,null,1):new tt($e.undefined,void 0,1)}function sK(t,e,r,n){if(n.allowIndefinite===!1)throw new Error(`${Ht} indefinite length items not allowed`);return new tt($e.break,void 0,1)}function oR(t,e,r){if(r){if(r.allowNaN===!1&&Number.isNaN(t))throw new Error(`${Ht} NaN values are not supported`);if(r.allowInfinity===!1&&(t===1/0||t===-1/0))throw new Error(`${Ht} Infinity values are not supported`)}return new tt($e.float,t,e)}function aK(t,e,r,n){return oR(sR(t,e+1),3,n)}function cK(t,e,r,n){return oR(aR(t,e+1),5,n)}function fK(t,e,r,n){return oR(hK(t,e+1),9,n)}function JE(t,e,r){let n=e.value;if(n===!1)t.push([$e.float.majorEncoded|W1e]);else if(n===!0)t.push([$e.float.majorEncoded|V1e]);else if(n===null)t.push([$e.float.majorEncoded|H1e]);else if(n===void 0)t.push([$e.float.majorEncoded|Z1e]);else{let i,o=!1;(!r||r.float64!==!0)&&(lK(n),i=sR(Ef,1),n===i||Number.isNaN(n)?(Ef[0]=249,t.push(Ef.slice(0,3)),o=!0):(dK(n),i=aR(Ef,1),n===i&&(Ef[0]=250,t.push(Ef.slice(0,5)),o=!0))),o||(J1e(n),i=hK(Ef,1),Ef[0]=251,t.push(Ef.slice(0,9)))}}JE.encodedSize=function(e,r){let n=e.value;if(n===!1||n===!0||n===null||n===void 0)return 1;if(!r||r.float64!==!0){lK(n);let i=sR(Ef,1);if(n===i||Number.isNaN(n))return 3;if(dK(n),i=aR(Ef,1),n===i)return 5}return 9};var uK=new ArrayBuffer(9),Pc=new DataView(uK,1),Ef=new Uint8Array(uK,0);function lK(t){if(t===1/0)Pc.setUint16(0,31744,!1);else if(t===-1/0)Pc.setUint16(0,64512,!1);else if(Number.isNaN(t))Pc.setUint16(0,32256,!1);else{Pc.setFloat32(0,t);let e=Pc.getUint32(0),r=(e&2139095040)>>23,n=e&8388607;if(r===255)Pc.setUint16(0,31744,!1);else if(r===0)Pc.setUint16(0,(t&2147483648)>>16|n>>13,!1);else{let i=r-127;i<-24?Pc.setUint16(0,0):i<-14?Pc.setUint16(0,(e&2147483648)>>16|1<<24+i,!1):Pc.setUint16(0,(e&2147483648)>>16|i+15<<10|n>>13,!1)}}}function sR(t,e){if(t.length-e<2)throw new Error(`${Ht} not enough data for float16`);let r=(t[e]<<8)+t[e+1];if(r===31744)return 1/0;if(r===64512)return-1/0;if(r===32256)return NaN;let n=r>>10&31,i=r&1023,o;return n===0?o=i*2**-24:n!==31?o=(i+1024)*2**(n-25):o=i===0?1/0:NaN,r&32768?-o:o}function dK(t){Pc.setFloat32(0,t,!1)}function aR(t,e){if(t.length-e<4)throw new Error(`${Ht} not enough data for float32`);let r=(t.byteOffset||0)+e;return new DataView(t.buffer,r,4).getFloat32(0,!1)}function J1e(t){Pc.setFloat64(0,t,!1)}function hK(t,e){if(t.length-e<8)throw new Error(`${Ht} not enough data for float64`);let r=(t.byteOffset||0)+e;return new DataView(t.buffer,r,8).getFloat64(0,!1)}JE.compareTokens=Mc.compareTokens;function en(t,e,r){throw new Error(`${Ht} encountered invalid minor (${r}) for major ${t[e]>>>5}`)}function YE(t){return()=>{throw new Error(`${Ht} ${t}`)}}var Ze=[];for(let t=0;t<=23;t++)Ze[t]=en;Ze[24]=xz;Ze[25]=Ez;Ze[26]=Sz;Ze[27]=Mz;Ze[28]=en;Ze[29]=en;Ze[30]=en;Ze[31]=en;for(let t=32;t<=55;t++)Ze[t]=en;Ze[56]=Pz;Ze[57]=Az;Ze[58]=Tz;Ze[59]=Iz;Ze[60]=en;Ze[61]=en;Ze[62]=en;Ze[63]=en;for(let t=64;t<=87;t++)Ze[t]=kz;Ze[88]=Oz;Ze[89]=Bz;Ze[90]=Dz;Ze[91]=Cz;Ze[92]=en;Ze[93]=en;Ze[94]=en;Ze[95]=YE("indefinite length bytes/strings are not supported");for(let t=96;t<=119;t++)Ze[t]=jz;Ze[120]=Nz;Ze[121]=qz;Ze[122]=$z;Ze[123]=Lz;Ze[124]=en;Ze[125]=en;Ze[126]=en;Ze[127]=YE("indefinite length bytes/strings are not supported");for(let t=128;t<=151;t++)Ze[t]=Fz;Ze[152]=zz;Ze[153]=Kz;Ze[154]=Gz;Ze[155]=Wz;Ze[156]=en;Ze[157]=en;Ze[158]=en;Ze[159]=Vz;for(let t=160;t<=183;t++)Ze[t]=Hz;Ze[184]=Zz;Ze[185]=Jz;Ze[186]=Yz;Ze[187]=Qz;Ze[188]=en;Ze[189]=en;Ze[190]=en;Ze[191]=Xz;for(let t=192;t<=215;t++)Ze[t]=eK;Ze[216]=tK;Ze[217]=rK;Ze[218]=nK;Ze[219]=iK;Ze[220]=en;Ze[221]=en;Ze[222]=en;Ze[223]=en;for(let t=224;t<=243;t++)Ze[t]=YE("simple values are not supported");Ze[244]=en;Ze[245]=en;Ze[246]=en;Ze[247]=oK;Ze[248]=YE("simple values are not supported");Ze[249]=aK;Ze[250]=cK;Ze[251]=fK;Ze[252]=en;Ze[253]=en;Ze[254]=en;Ze[255]=sK;var Sf=[];for(let t=0;t<24;t++)Sf[t]=new tt($e.uint,t,1);for(let t=-1;t>=-24;t--)Sf[31-t]=new tt($e.negint,t,1);Sf[64]=new tt($e.bytes,new Uint8Array(0),1);Sf[96]=new tt($e.string,"",1);Sf[128]=new tt($e.array,0,1);Sf[160]=new tt($e.map,0,1);Sf[244]=new tt($e.false,!1,1);Sf[245]=new tt($e.true,!0,1);Sf[246]=new tt($e.null,null,1);function pK(t){switch(t.type){case $e.false:return ku([244]);case $e.true:return ku([245]);case $e.null:return ku([246]);case $e.bytes:return t.value.length?void 0:ku([64]);case $e.string:return t.value===""?ku([96]):void 0;case $e.array:return t.value===0?ku([128]):void 0;case $e.map:return t.value===0?ku([160]):void 0;case $e.uint:return t.value<24?ku([Number(t.value)]):void 0;case $e.negint:if(t.value>=-24)return ku([31-Number(t.value)])}}var Q1e={float64:!1,mapSorter:t2e,quickEncodeToken:pK};function X1e(){let t=[];return t[$e.uint.major]=Mc,t[$e.negint.major]=GE,t[$e.bytes.major]=Jg,t[$e.string.major]=Uz,t[$e.array.major]=VE,t[$e.map.major]=HE,t[$e.tag.major]=ZE,t[$e.float.major]=JE,t}var mK=X1e(),cR=new O1,Xg=class{constructor(e,r){this.obj=e,this.parent=r}includes(e){let r=this;do if(r.obj===e)return!0;while(r=r.parent);return!1}static createCheck(e,r){if(e&&e.includes(r))throw new Error(`${nR} object contains circular references`);return new Xg(r,e)}},Gh={null:new tt($e.null,null),undefined:new tt($e.undefined,void 0),true:new tt($e.true,!0),false:new tt($e.false,!1),emptyArray:new tt($e.array,0),emptyMap:new tt($e.map,0)},Wh={number(t,e,r,n){return!Number.isInteger(t)||!Number.isSafeInteger(t)?new tt($e.float,t):t>=0?new tt($e.uint,t):new tt($e.negint,t)},bigint(t,e,r,n){return t>=BigInt(0)?new tt($e.uint,t):new tt($e.negint,t)},Uint8Array(t,e,r,n){return new tt($e.bytes,t)},string(t,e,r,n){return new tt($e.string,t)},boolean(t,e,r,n){return t?Gh.true:Gh.false},null(t,e,r,n){return Gh.null},undefined(t,e,r,n){return Gh.undefined},ArrayBuffer(t,e,r,n){return new tt($e.bytes,new Uint8Array(t))},DataView(t,e,r,n){return new tt($e.bytes,new Uint8Array(t.buffer,t.byteOffset,t.byteLength))},Array(t,e,r,n){if(!t.length)return r.addBreakTokens===!0?[Gh.emptyArray,new tt($e.break)]:Gh.emptyArray;n=Xg.createCheck(n,t);let i=[],o=0;for(let s of t)i[o++]=QE(s,r,n);return r.addBreakTokens?[new tt($e.array,t.length),i,new tt($e.break)]:[new tt($e.array,t.length),i]},Object(t,e,r,n){let i=e!=="Object",o=i?t.keys():Object.keys(t),s=i?t.size:o.length;if(!s)return r.addBreakTokens===!0?[Gh.emptyMap,new tt($e.break)]:Gh.emptyMap;n=Xg.createCheck(n,t);let a=[],d=0;for(let m of o)a[d++]=[QE(m,r,n),QE(i?t.get(m):t[m],r,n)];return e2e(a,r),r.addBreakTokens?[new tt($e.map,s),a,new tt($e.break)]:[new tt($e.map,s),a]}};Wh.Map=Wh.Object;Wh.Buffer=Wh.Uint8Array;for(let t of"Uint8Clamped Uint16 Uint32 Int8 Int16 Int32 BigUint64 BigInt64 Float32 Float64".split(" "))Wh[`${t}Array`]=Wh.DataView;function QE(t,e={},r){let n=hz(t),i=e&&e.typeEncoders&&e.typeEncoders[n]||Wh[n];if(typeof i=="function"){let s=i(t,n,e,r);if(s!=null)return s}let o=Wh[n];if(!o)throw new Error(`${nR} unsupported type: ${n}`);return o(t,n,e,r)}function e2e(t,e){e.mapSorter&&t.sort(e.mapSorter)}function t2e(t,e){let r=Array.isArray(t[0])?t[0][0]:t[0],n=Array.isArray(e[0])?e[0][0]:e[0];if(r.type!==n.type)return r.type.compare(n.type);let i=r.type.major,o=mK[i].compareTokens(r,n);return o===0&&console.warn("WARNING: complex key types used, CBOR key sorting guarantees are gone"),o}function yK(t,e,r,n){if(Array.isArray(e))for(let i of e)yK(t,i,r,n);else r[e.type.major](t,e,n)}function r2e(t,e,r){let n=QE(t,r);if(!Array.isArray(n)&&r.quickEncodeToken){let i=r.quickEncodeToken(n);if(i)return i;let o=e[n.type.major];if(o.encodedSize){let s=o.encodedSize(n,r),a=new O1(s);if(o(a,n,r),a.chunks.length!==1)throw new Error(`Unexpected error: pre-calculated length for ${n} was wrong`);return rR(a.chunks[0])}}return cR.reset(),yK(cR,n,e,r),cR.toBytes(!0)}function fR(t,e){return e=Object.assign({},Q1e,e),r2e(t,mK,e)}E();var n2e={strict:!1,allowIndefinite:!0,allowUndefined:!0,allowBigInt:!0},uR=class{constructor(e,r={}){this.pos=0,this.data=e,this.options=r}done(){return this.pos>=this.data.length}next(){let e=this.data[this.pos],r=Sf[e];if(r===void 0){let n=Ze[e];if(!n)throw new Error(`${Ht} no decoder for major type ${e>>>5} (byte 0x${e.toString(16).padStart(2,"0")})`);let i=e&31;r=n(this.data,this.pos,i,this.options)}return this.pos+=r.encodedLength,r}},j1=Symbol.for("DONE"),XE=Symbol.for("BREAK");function i2e(t,e,r){let n=[];for(let i=0;i<t.value;i++){let o=N1(e,r);if(o===XE){if(t.value===1/0)break;throw new Error(`${Ht} got unexpected break to lengthed array`)}if(o===j1)throw new Error(`${Ht} found array but not enough entries (got ${i}, expected ${t.value})`);n[i]=o}return n}function o2e(t,e,r){let n=r.useMaps===!0,i=n?void 0:{},o=n?new Map:void 0;for(let s=0;s<t.value;s++){let a=N1(e,r);if(a===XE){if(t.value===1/0)break;throw new Error(`${Ht} got unexpected break to lengthed map`)}if(a===j1)throw new Error(`${Ht} found map but not enough entries (got ${s} [no key], expected ${t.value})`);if(n!==!0&&typeof a!="string")throw new Error(`${Ht} non-string keys not supported (got ${typeof a})`);if(r.rejectDuplicateMapKeys===!0&&(n&&o.has(a)||!n&&a in i))throw new Error(`${Ht} found repeat map key "${a}"`);let d=N1(e,r);if(d===j1)throw new Error(`${Ht} found map but not enough entries (got ${s} [no value], expected ${t.value})`);n?o.set(a,d):i[a]=d}return n?o:i}function N1(t,e){if(t.done())return j1;let r=t.next();if(r.type===$e.break)return XE;if(r.type.terminal)return r.value;if(r.type===$e.array)return i2e(r,t,e);if(r.type===$e.map)return o2e(r,t,e);if(r.type===$e.tag){if(e.tags&&typeof e.tags[r.value]=="function"){let n=N1(t,e);return e.tags[r.value](n)}throw new Error(`${Ht} tag not supported (${r.value})`)}throw new Error("unsupported")}function lR(t,e){if(!(t instanceof Uint8Array))throw new Error(`${Ht} data to decode must be a Uint8Array`);e=Object.assign({},n2e,e);let r=e.tokenizer||new uR(t,e),n=N1(r,e);if(n===j1)throw new Error(`${Ht} did not find any content to decode`);if(n===XE)throw new Error(`${Ht} got unexpected break`);if(!r.done())throw new Error(`${Ht} too many terminals, data makes no sense`);return n}E();E();E();var a2e=bK,gK=128,c2e=127,f2e=~c2e,u2e=Math.pow(2,31);function bK(t,e,r){e=e||[],r=r||0;for(var n=r;t>=u2e;)e[r++]=t&255|gK,t/=128;for(;t&f2e;)e[r++]=t&255|gK,t>>>=7;return e[r]=t|0,bK.bytes=r-n+1,e}var l2e=dR,d2e=128,vK=127;function dR(t,n){var r=0,n=n||0,i=0,o=n,s,a=t.length;do{if(o>=a)throw dR.bytes=0,new RangeError("Could not decode varint");s=t[o++],r+=i<28?(s&vK)<<i:(s&vK)*Math.pow(2,i),i+=7}while(s>=d2e);return dR.bytes=o-n,r}var h2e=Math.pow(2,7),p2e=Math.pow(2,14),m2e=Math.pow(2,21),y2e=Math.pow(2,28),g2e=Math.pow(2,35),v2e=Math.pow(2,42),b2e=Math.pow(2,49),w2e=Math.pow(2,56),_2e=Math.pow(2,63),x2e=function(t){return t<h2e?1:t<p2e?2:t<m2e?3:t<y2e?4:t<g2e?5:t<v2e?6:t<b2e?7:t<w2e?8:t<_2e?9:10},E2e={encode:a2e,decode:l2e,encodingLength:x2e},S2e=E2e,q1=S2e;var $1=(t,e=0)=>[q1.decode(t,e),q1.decode.bytes],ev=(t,e,r=0)=>(q1.encode(t,e,r),e),tv=t=>q1.encodingLength(t);E();E();var rst=new Uint8Array(0);var _K=(t,e)=>{if(t===e)return!0;if(t.byteLength!==e.byteLength)return!1;for(let r=0;r<t.byteLength;r++)if(t[r]!==e[r])return!1;return!0},rv=t=>{if(t instanceof Uint8Array&&t.constructor.name==="Uint8Array")return t;if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);throw new Error("Unknown type, must be binary type")};var xK=(t,e)=>{let r=e.byteLength,n=tv(t),i=n+tv(r),o=new Uint8Array(i+r);return ev(t,o,0),ev(r,o,n),o.set(e,i),new nv(t,r,e,o)},EK=t=>{let e=rv(t),[r,n]=$1(e),[i,o]=$1(e.subarray(n)),s=e.subarray(n+o);if(s.byteLength!==i)throw new Error("Incorrect length");return new nv(r,i,s,e)},SK=(t,e)=>{if(t===e)return!0;{let r=e;return t.code===r.code&&t.size===r.size&&r.bytes instanceof Uint8Array&&_K(t.bytes,r.bytes)}},nv=class{constructor(e,r,n,i){this.code=e,this.size=r,this.digest=n,this.bytes=i}};E();E();E();function P2e(t,e){if(t.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 i=0;i<t.length;i++){var o=t.charAt(i),s=o.charCodeAt(0);if(r[s]!==255)throw new TypeError(o+" is ambiguous");r[s]=i}var a=t.length,d=t.charAt(0),m=Math.log(a)/Math.log(256),p=Math.log(256)/Math.log(a);function w(M){if(M instanceof Uint8Array||(ArrayBuffer.isView(M)?M=new Uint8Array(M.buffer,M.byteOffset,M.byteLength):Array.isArray(M)&&(M=Uint8Array.from(M))),!(M instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(M.length===0)return"";for(var A=0,B=0,I=0,C=M.length;I!==C&&M[I]===0;)I++,A++;for(var k=(C-I)*p+1>>>0,q=new Uint8Array(k);I!==C;){for(var L=M[I],U=0,F=k-1;(L!==0||U<B)&&F!==-1;F--,U++)L+=256*q[F]>>>0,q[F]=L%a>>>0,L=L/a>>>0;if(L!==0)throw new Error("Non-zero carry");B=U,I++}for(var N=k-B;N!==k&&q[N]===0;)N++;for(var G=d.repeat(A);N<k;++N)G+=t.charAt(q[N]);return G}function P(M){if(typeof M!="string")throw new TypeError("Expected String");if(M.length===0)return new Uint8Array;var A=0;if(M[A]!==" "){for(var B=0,I=0;M[A]===d;)B++,A++;for(var C=(M.length-A)*m+1>>>0,k=new Uint8Array(C);M[A];){var q=r[M.charCodeAt(A)];if(q===255)return;for(var L=0,U=C-1;(q!==0||L<I)&&U!==-1;U--,L++)q+=a*k[U]>>>0,k[U]=q%256>>>0,q=q/256>>>0;if(q!==0)throw new Error("Non-zero carry");I=L,A++}if(M[A]!==" "){for(var F=C-I;F!==C&&k[F]===0;)F++;for(var N=new Uint8Array(B+(C-F)),G=B;F!==C;)N[G++]=k[F++];return N}}}function S(M){var A=P(M);if(A)return A;throw new Error(`Non-${e} character`)}return{encode:w,decodeUnsafe:P,decode:S}}var A2e=P2e,T2e=A2e,MK=T2e;E();var hR=class{constructor(e,r,n){this.name=e,this.prefix=r,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},pR=class{constructor(e,r,n){if(this.name=e,this.prefix=r,r.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return PK(this,e)}},mR=class{constructor(e){this.decoders=e}or(e){return PK(this,e)}decode(e){let r=e[0],n=this.decoders[r];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}},PK=(t,e)=>new mR({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}}),yR=class{constructor(e,r,n,i){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new hR(e,r,n),this.decoder=new pR(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}},AK=({name:t,prefix:e,encode:r,decode:n})=>new yR(t,e,r,n),gR=({prefix:t,name:e,alphabet:r})=>{let{encode:n,decode:i}=MK(r,e);return AK({prefix:t,name:e,encode:n,decode:o=>rv(i(o))})},R2e=(t,e,r,n)=>{let i={};for(let p=0;p<e.length;++p)i[e[p]]=p;let o=t.length;for(;t[o-1]==="=";)--o;let s=new Uint8Array(o*r/8|0),a=0,d=0,m=0;for(let p=0;p<o;++p){let w=i[t[p]];if(w===void 0)throw new SyntaxError(`Non-${n} character`);d=d<<r|w,a+=r,a>=8&&(a-=8,s[m++]=255&d>>a)}if(a>=r||255&d<<8-a)throw new SyntaxError("Unexpected end of data");return s},I2e=(t,e,r)=>{let n=e[e.length-1]==="=",i=(1<<r)-1,o="",s=0,a=0;for(let d=0;d<t.length;++d)for(a=a<<8|t[d],s+=8;s>r;)s-=r,o+=e[i&a>>s];if(s&&(o+=e[i&a<<r-s]),n)for(;o.length*r&7;)o+="=";return o},Ou=({name:t,prefix:e,bitsPerChar:r,alphabet:n})=>AK({prefix:e,name:t,encode(i){return I2e(i,n,r)},decode(i){return R2e(i,n,r,t)}});var md=gR({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),yst=gR({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});E();var L1=Ou({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),wst=Ou({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),_st=Ou({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),xst=Ou({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),Est=Ou({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),Sst=Ou({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),Mst=Ou({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),Pst=Ou({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),Ast=Ou({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});E();var TK=(t,e)=>{let{bytes:r,version:n}=t;switch(n){case 0:return O2e(r,vR(t),e||md.encoder);default:return B2e(r,vR(t),e||L1.encoder)}};var RK=new WeakMap,vR=t=>{let e=RK.get(t);if(e==null){let r=new Map;return RK.set(t,r),r}return e},Ni=class{constructor(e,r,n,i){this.code=r,this.version=e,this.multihash=n,this.bytes=i,this["/"]=i}get asCID(){return this}get byteOffset(){return this.bytes.byteOffset}get byteLength(){return this.bytes.byteLength}toV0(){switch(this.version){case 0:return this;case 1:{let{code:e,multihash:r}=this;if(e!==U1)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(r.code!==D2e)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return Ni.createV0(r)}default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}toV1(){switch(this.version){case 0:{let{code:e,digest:r}=this.multihash,n=xK(e,r);return Ni.createV1(this.code,n)}case 1:return this;default:throw Error(`Can not convert CID version ${this.version} to version 1. This is a bug please report`)}}equals(e){return Ni.equals(this,e)}static equals(e,r){let n=r;return n&&e.code===n.code&&e.version===n.version&&SK(e.multihash,n.multihash)}toString(e){return TK(this,e)}toJSON(){return{"/":TK(this)}}link(){return this}get[Symbol.toStringTag](){return"CID"}[Symbol.for("nodejs.util.inspect.custom")](){return`CID(${this.toString()})`}static asCID(e){if(e==null)return null;let r=e;if(r instanceof Ni)return r;if(r["/"]!=null&&r["/"]===r.bytes||r.asCID===r){let{version:n,code:i,multihash:o,bytes:s}=r;return new Ni(n,i,o,s||IK(n,i,o.bytes))}else if(r[C2e]===!0){let{version:n,multihash:i,code:o}=r,s=EK(i);return Ni.create(n,o,s)}else return null}static create(e,r,n){if(typeof r!="number")throw new Error("String codecs are no longer supported");if(!(n.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(e){case 0:{if(r!==U1)throw new Error(`Version 0 CID must use dag-pb (code: ${U1}) block encoding`);return new Ni(e,r,n,n.bytes)}case 1:{let i=IK(e,r,n.bytes);return new Ni(e,r,n,i)}default:throw new Error("Invalid version")}}static createV0(e){return Ni.create(0,U1,e)}static createV1(e,r){return Ni.create(1,e,r)}static decode(e){let[r,n]=Ni.decodeFirst(e);if(n.length)throw new Error("Incorrect length");return r}static decodeFirst(e){let r=Ni.inspectBytes(e),n=r.size-r.multihashSize,i=rv(e.subarray(n,n+r.multihashSize));if(i.byteLength!==r.multihashSize)throw new Error("Incorrect length");let o=i.subarray(r.multihashSize-r.digestSize),s=new nv(r.multihashCode,r.digestSize,o,i);return[r.version===0?Ni.createV0(s):Ni.createV1(r.codec,s),e.subarray(r.size)]}static inspectBytes(e){let r=0,n=()=>{let[w,P]=$1(e.subarray(r));return r+=P,w},i=n(),o=U1;if(i===18?(i=0,r=0):o=n(),i!==0&&i!==1)throw new RangeError(`Invalid CID version ${i}`);let s=r,a=n(),d=n(),m=r+d,p=m-s;return{version:i,codec:o,multihashCode:a,digestSize:d,multihashSize:p,size:m}}static parse(e,r){let[n,i]=k2e(e,r),o=Ni.decode(i);if(o.version===0&&e[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return vR(o).set(n,e),o}},k2e=(t,e)=>{switch(t[0]){case"Q":{let r=e||md;return[md.prefix,r.decode(`${md.prefix}${t}`)]}case md.prefix:{let r=e||md;return[md.prefix,r.decode(t)]}case L1.prefix:{let r=e||L1;return[L1.prefix,r.decode(t)]}default:{if(e==null)throw Error("To parse non base32 or base58btc encoded CID multibase decoder must be provided");return[t[0],e.decode(t)]}}},O2e=(t,e,r)=>{let{prefix:n}=r;if(n!==md.prefix)throw Error(`Cannot string encode V0 in ${r.name} encoding`);let i=e.get(n);if(i==null){let o=r.encode(t).slice(1);return e.set(n,o),o}else return i},B2e=(t,e,r)=>{let{prefix:n}=r,i=e.get(n);if(i==null){let o=r.encode(t);return e.set(n,o),o}else return i},U1=112,D2e=18,IK=(t,e,r)=>{let n=tv(t),i=n+tv(e),o=new Uint8Array(i+r.byteLength);return ev(t,o,0),ev(e,o,n),o.set(r,i),o},C2e=Symbol.for("@ipld/js-cid/CID");var kK=42;function j2e(t){if(t.asCID!==t&&t["/"]!==t.bytes)return null;let e=Ni.asCID(t);if(!e)return null;let r=new Uint8Array(e.bytes.byteLength+1);return r.set(e.bytes,1),[new tt($e.tag,kK),new tt($e.bytes,r)]}function N2e(){throw new Error("`undefined` is not supported by the IPLD Data Model and cannot be encoded")}function q2e(t){if(Number.isNaN(t))throw new Error("`NaN` is not supported by the IPLD Data Model and cannot be encoded");if(t===1/0||t===-1/0)throw new Error("`Infinity` and `-Infinity` is not supported by the IPLD Data Model and cannot be encoded");return null}var $2e={float64:!0,typeEncoders:{Object:j2e,undefined:N2e,number:q2e}};function L2e(t){if(t[0]!==0)throw new Error("Invalid CID for CBOR tag 42; expected leading 0x00");return Ni.decode(t.subarray(1))}var OK={allowIndefinite:!1,coerceUndefinedToNull:!0,allowNaN:!1,allowInfinity:!1,allowBigInt:!0,strict:!0,useMaps:!1,rejectDuplicateMapKeys:!0,tags:[]};OK.tags[kK]=L2e;var U2e="dag-cbor",Vh=113,F2e=t=>fR(t,$2e),bR=t=>lR(t,OK);E();var F1=class{async open(){}async close(){}async put(e,r,n){return e}async get(e,r){return new Uint8Array}async has(e,r){return!1}async delete(e,r){}async isEmpty(e){return!0}async*putMany(e,r){for await(let n of e)await this.put(n.cid,n.block,r),yield n.cid}async*getMany(e,r){for await(let n of e)yield{cid:n,block:await this.get(n,r)}}async*getAll(e){let r=this.db.iterator({keys:!0,keyEncoding:"buffer"},e);for await(let[n,i]of r)yield{cid:St.decode(n),block:i}}async*deleteMany(e,r){for await(let n of e)await this.delete(n,r),yield n}async clear(){}};E();var Vxe=or(Va(),1);E();E();E();function K2e(t){return t[Symbol.asyncIterator]!=null}function G2e(t,e=1){return e=Number(e),K2e(t)?async function*(){let r=[];if(e<1&&(e=1),e!==Math.round(e))throw new Error("Batch size must be an integer");for await(let n of t)for(r.push(n);r.length>=e;)yield r.slice(0,e),r=r.slice(e);for(;r.length>0;)yield r.slice(0,e),r=r.slice(e)}():function*(){let r=[];if(e<1&&(e=1),e!==Math.round(e))throw new Error("Batch size must be an integer");for(let n of t)for(r.push(n);r.length>=e;)yield r.slice(0,e),r=r.slice(e);for(;r.length>0;)yield r.slice(0,e),r=r.slice(e)}()}var z1=G2e;async function*K1(t,e=1){for await(let r of z1(t,e)){let n=r.map(async i=>i().then(o=>({ok:!0,value:o}),o=>({ok:!1,err:o})));for(let i=0;i<n.length;i++){let o=await n[i];if(o.ok)yield o.value;else throw o.err}}}E();E();var jK=Symbol.for("@achingbrain/uint8arraylist");function CK(t,e){if(e==null||e<0)throw new RangeError("index is out of bounds");let r=0;for(let n of t){let i=r+n.byteLength;if(e<i)return{buf:n,index:e-r};r=i}throw new RangeError("index is out of bounds")}function e6(t){return Boolean(t?.[jK])}var Bu=class{constructor(...e){Object.defineProperty(this,jK,{value:!0}),this.bufs=[],this.length=0,e.length>0&&this.appendAll(e)}*[Symbol.iterator](){yield*this.bufs}get byteLength(){return this.length}append(...e){this.appendAll(e)}appendAll(e){let r=0;for(let n of e)if(n instanceof Uint8Array)r+=n.byteLength,this.bufs.push(n);else if(e6(n))r+=n.byteLength,this.bufs.push(...n.bufs);else throw new Error("Could not append value, must be an Uint8Array or a Uint8ArrayList");this.length+=r}prepend(...e){this.prependAll(e)}prependAll(e){let r=0;for(let n of e.reverse())if(n instanceof Uint8Array)r+=n.byteLength,this.bufs.unshift(n);else if(e6(n))r+=n.byteLength,this.bufs.unshift(...n.bufs);else throw new Error("Could not prepend value, must be an Uint8Array or a Uint8ArrayList");this.length+=r}get(e){let r=CK(this.bufs,e);return r.buf[r.index]}set(e,r){let n=CK(this.bufs,e);n.buf[n.index]=r}write(e,r=0){if(e instanceof Uint8Array)for(let n=0;n<e.length;n++)this.set(r+n,e[n]);else if(e6(e))for(let n=0;n<e.length;n++)this.set(r+n,e.get(n));else throw new Error("Could not write value, must be an Uint8Array or a Uint8ArrayList")}consume(e){if(e=Math.trunc(e),!(Number.isNaN(e)||e<=0)){if(e===this.byteLength){this.bufs=[],this.length=0;return}for(;this.bufs.length>0;)if(e>=this.bufs[0].byteLength)e-=this.bufs[0].byteLength,this.length-=this.bufs[0].byteLength,this.bufs.shift();else{this.bufs[0]=this.bufs[0].subarray(e),this.length-=e;break}}}slice(e,r){let{bufs:n,length:i}=this._subList(e,r);return $g(n,i)}subarray(e,r){let{bufs:n,length:i}=this._subList(e,r);return n.length===1?n[0]:$g(n,i)}sublist(e,r){let{bufs:n,length:i}=this._subList(e,r),o=new Bu;return o.length=i,o.bufs=n,o}_subList(e,r){if(e=e??0,r=r??this.length,e<0&&(e=this.length+e),r<0&&(r=this.length+r),e<0||r>this.length)throw new RangeError("index is out of bounds");if(e===r)return{bufs:[],length:0};if(e===0&&r===this.length)return{bufs:[...this.bufs],length:this.length};let n=[],i=0;for(let o=0;o<this.bufs.length;o++){let s=this.bufs[o],a=i,d=a+s.byteLength;if(i=d,e>=d)continue;let m=e>=a&&e<d,p=r>a&&r<=d;if(m&&p){if(e===a&&r===d){n.push(s);break}let w=e-a;n.push(s.subarray(w,w+(r-e)));break}if(m){if(e===0){n.push(s);continue}n.push(s.subarray(e-a));continue}if(p){if(r===d){n.push(s);break}n.push(s.subarray(0,r-a));break}n.push(s)}return{bufs:n,length:r-e}}indexOf(e,r=0){if(!e6(e)&&!(e instanceof Uint8Array))throw new TypeError('The "value" argument must be a Uint8ArrayList or Uint8Array');let n=e instanceof Uint8Array?e:e.subarray();if(r=Number(r??0),isNaN(r)&&(r=0),r<0&&(r=this.length+r),r<0&&(r=0),e.length===0)return r>this.length?this.length:r;let i=n.byteLength;if(i===0)throw new TypeError("search must be at least 1 byte long");let o=256,s=new Int32Array(o);for(let w=0;w<o;w++)s[w]=-1;for(let w=0;w<i;w++)s[n[w]]=w;let a=s,d=this.byteLength-n.byteLength,m=n.byteLength-1,p;for(let w=r;w<=d;w+=p){p=0;for(let P=m;P>=0;P--){let S=this.get(w+P);if(n[P]!==S){p=Math.max(1,P-a[S]);break}}if(p===0)return w}return-1}getInt8(e){let r=this.subarray(e,e+1);return new DataView(r.buffer,r.byteOffset,r.byteLength).getInt8(0)}setInt8(e,r){let n=Lh(1);new DataView(n.buffer,n.byteOffset,n.byteLength).setInt8(0,r),this.write(n,e)}getInt16(e,r){let n=this.subarray(e,e+2);return new DataView(n.buffer,n.byteOffset,n.byteLength).getInt16(0,r)}setInt16(e,r,n){let i=dd(2);new DataView(i.buffer,i.byteOffset,i.byteLength).setInt16(0,r,n),this.write(i,e)}getInt32(e,r){let n=this.subarray(e,e+4);return new DataView(n.buffer,n.byteOffset,n.byteLength).getInt32(0,r)}setInt32(e,r,n){let i=dd(4);new DataView(i.buffer,i.byteOffset,i.byteLength).setInt32(0,r,n),this.write(i,e)}getBigInt64(e,r){let n=this.subarray(e,e+8);return new DataView(n.buffer,n.byteOffset,n.byteLength).getBigInt64(0,r)}setBigInt64(e,r,n){let i=dd(8);new DataView(i.buffer,i.byteOffset,i.byteLength).setBigInt64(0,r,n),this.write(i,e)}getUint8(e){let r=this.subarray(e,e+1);return new DataView(r.buffer,r.byteOffset,r.byteLength).getUint8(0)}setUint8(e,r){let n=Lh(1);new DataView(n.buffer,n.byteOffset,n.byteLength).setUint8(0,r),this.write(n,e)}getUint16(e,r){let n=this.subarray(e,e+2);return new DataView(n.buffer,n.byteOffset,n.byteLength).getUint16(0,r)}setUint16(e,r,n){let i=dd(2);new DataView(i.buffer,i.byteOffset,i.byteLength).setUint16(0,r,n),this.write(i,e)}getUint32(e,r){let n=this.subarray(e,e+4);return new DataView(n.buffer,n.byteOffset,n.byteLength).getUint32(0,r)}setUint32(e,r,n){let i=dd(4);new DataView(i.buffer,i.byteOffset,i.byteLength).setUint32(0,r,n),this.write(i,e)}getBigUint64(e,r){let n=this.subarray(e,e+8);return new DataView(n.buffer,n.byteOffset,n.byteLength).getBigUint64(0,r)}setBigUint64(e,r,n){let i=dd(8);new DataView(i.buffer,i.byteOffset,i.byteLength).setBigUint64(0,r,n),this.write(i,e)}getFloat32(e,r){let n=this.subarray(e,e+4);return new DataView(n.buffer,n.byteOffset,n.byteLength).getFloat32(0,r)}setFloat32(e,r,n){let i=dd(4);new DataView(i.buffer,i.byteOffset,i.byteLength).setFloat32(0,r,n),this.write(i,e)}getFloat64(e,r){let n=this.subarray(e,e+8);return new DataView(n.buffer,n.byteOffset,n.byteLength).getFloat64(0,r)}setFloat64(e,r,n){let i=dd(8);new DataView(i.buffer,i.byteOffset,i.byteLength).setFloat64(0,r,n),this.write(i,e)}equals(e){if(e==null||!(e instanceof Bu)||e.bufs.length!==this.bufs.length)return!1;for(let r=0;r<this.bufs.length;r++)if(!CT(this.bufs[r],e.bufs[r]))return!1;return!0}static fromUint8Arrays(e,r){let n=new Bu;return n.bufs=e,r==null&&(r=e.reduce((i,o)=>i+o.byteLength,0)),n.length=r,n}};var W2e=262144,NK=(t={})=>{let e=t.chunkSize??W2e;return async function*(n){let i=new Bu,o=0,s=!1;for await(let a of n)for(i.append(a),o+=a.length;o>=e;)if(yield i.slice(0,e),s=!0,e===i.length)i=new Bu,o=0;else{let d=new Bu;d.append(i.sublist(e)),i=d,o-=e}(!s||o>0)&&(yield i.subarray(0,o))}};E();var H0={};Di(H0,{code:()=>J1,createLink:()=>aG,createNode:()=>sG,decode:()=>vd,encode:()=>Za,name:()=>O_e,prepare:()=>Ha,validate:()=>RR});E();E();E();E();var V2e=LK,qK=128,H2e=127,Z2e=~H2e,J2e=Math.pow(2,31);function LK(t,e,r){e=e||[],r=r||0;for(var n=r;t>=J2e;)e[r++]=t&255|qK,t/=128;for(;t&Z2e;)e[r++]=t&255|qK,t>>>=7;return e[r]=t|0,LK.bytes=r-n+1,e}var Y2e=wR,Q2e=128,$K=127;function wR(t,n){var r=0,n=n||0,i=0,o=n,s,a=t.length;do{if(o>=a)throw wR.bytes=0,new RangeError("Could not decode varint");s=t[o++],r+=i<28?(s&$K)<<i:(s&$K)*Math.pow(2,i),i+=7}while(s>=Q2e);return wR.bytes=o-n,r}var X2e=Math.pow(2,7),e_e=Math.pow(2,14),t_e=Math.pow(2,21),r_e=Math.pow(2,28),n_e=Math.pow(2,35),i_e=Math.pow(2,42),o_e=Math.pow(2,49),s_e=Math.pow(2,56),a_e=Math.pow(2,63),c_e=function(t){return t<X2e?1:t<e_e?2:t<t_e?3:t<r_e?4:t<n_e?5:t<i_e?6:t<o_e?7:t<s_e?8:t<a_e?9:10},f_e={encode:V2e,decode:Y2e,encodingLength:c_e},u_e=f_e,G1=u_e;var W1=(t,e=0)=>[G1.decode(t,e),G1.decode.bytes],iv=(t,e,r=0)=>(G1.encode(t,e,r),e),ov=t=>G1.encodingLength(t);E();E();var uat=new Uint8Array(0);var FK=(t,e)=>{if(t===e)return!0;if(t.byteLength!==e.byteLength)return!1;for(let r=0;r<t.byteLength;r++)if(t[r]!==e[r])return!1;return!0},sv=t=>{if(t instanceof Uint8Array&&t.constructor.name==="Uint8Array")return t;if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);throw new Error("Unknown type, must be binary type")};var zK=(t,e)=>{let r=e.byteLength,n=ov(t),i=n+ov(r),o=new Uint8Array(i+r);return iv(t,o,0),iv(r,o,n),o.set(e,i),new av(t,r,e,o)},KK=t=>{let e=sv(t),[r,n]=W1(e),[i,o]=W1(e.subarray(n)),s=e.subarray(n+o);if(s.byteLength!==i)throw new Error("Incorrect length");return new av(r,i,s,e)},GK=(t,e)=>{if(t===e)return!0;{let r=e;return t.code===r.code&&t.size===r.size&&r.bytes instanceof Uint8Array&&FK(t.bytes,r.bytes)}},av=class{constructor(e,r,n,i){this.code=e,this.size=r,this.digest=n,this.bytes=i}};E();E();E();function d_e(t,e){if(t.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 i=0;i<t.length;i++){var o=t.charAt(i),s=o.charCodeAt(0);if(r[s]!==255)throw new TypeError(o+" is ambiguous");r[s]=i}var a=t.length,d=t.charAt(0),m=Math.log(a)/Math.log(256),p=Math.log(256)/Math.log(a);function w(M){if(M instanceof Uint8Array||(ArrayBuffer.isView(M)?M=new Uint8Array(M.buffer,M.byteOffset,M.byteLength):Array.isArray(M)&&(M=Uint8Array.from(M))),!(M instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(M.length===0)return"";for(var A=0,B=0,I=0,C=M.length;I!==C&&M[I]===0;)I++,A++;for(var k=(C-I)*p+1>>>0,q=new Uint8Array(k);I!==C;){for(var L=M[I],U=0,F=k-1;(L!==0||U<B)&&F!==-1;F--,U++)L+=256*q[F]>>>0,q[F]=L%a>>>0,L=L/a>>>0;if(L!==0)throw new Error("Non-zero carry");B=U,I++}for(var N=k-B;N!==k&&q[N]===0;)N++;for(var G=d.repeat(A);N<k;++N)G+=t.charAt(q[N]);return G}function P(M){if(typeof M!="string")throw new TypeError("Expected String");if(M.length===0)return new Uint8Array;var A=0;if(M[A]!==" "){for(var B=0,I=0;M[A]===d;)B++,A++;for(var C=(M.length-A)*m+1>>>0,k=new Uint8Array(C);M[A];){var q=r[M.charCodeAt(A)];if(q===255)return;for(var L=0,U=C-1;(q!==0||L<I)&&U!==-1;U--,L++)q+=a*k[U]>>>0,k[U]=q%256>>>0,q=q/256>>>0;if(q!==0)throw new Error("Non-zero carry");I=L,A++}if(M[A]!==" "){for(var F=C-I;F!==C&&k[F]===0;)F++;for(var N=new Uint8Array(B+(C-F)),G=B;F!==C;)N[G++]=k[F++];return N}}}function S(M){var A=P(M);if(A)return A;throw new Error(`Non-${e} character`)}return{encode:w,decodeUnsafe:P,decode:S}}var h_e=d_e,p_e=h_e,WK=p_e;E();var _R=class{constructor(e,r,n){this.name=e,this.prefix=r,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},xR=class{constructor(e,r,n){if(this.name=e,this.prefix=r,r.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return VK(this,e)}},ER=class{constructor(e){this.decoders=e}or(e){return VK(this,e)}decode(e){let r=e[0],n=this.decoders[r];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}},VK=(t,e)=>new ER({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}}),SR=class{constructor(e,r,n,i){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new _R(e,r,n),this.decoder=new xR(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}},HK=({name:t,prefix:e,encode:r,decode:n})=>new SR(t,e,r,n),MR=({prefix:t,name:e,alphabet:r})=>{let{encode:n,decode:i}=WK(r,e);return HK({prefix:t,name:e,encode:n,decode:o=>sv(i(o))})},m_e=(t,e,r,n)=>{let i={};for(let p=0;p<e.length;++p)i[e[p]]=p;let o=t.length;for(;t[o-1]==="=";)--o;let s=new Uint8Array(o*r/8|0),a=0,d=0,m=0;for(let p=0;p<o;++p){let w=i[t[p]];if(w===void 0)throw new SyntaxError(`Non-${n} character`);d=d<<r|w,a+=r,a>=8&&(a-=8,s[m++]=255&d>>a)}if(a>=r||255&d<<8-a)throw new SyntaxError("Unexpected end of data");return s},y_e=(t,e,r)=>{let n=e[e.length-1]==="=",i=(1<<r)-1,o="",s=0,a=0;for(let d=0;d<t.length;++d)for(a=a<<8|t[d],s+=8;s>r;)s-=r,o+=e[i&a>>s];if(s&&(o+=e[i&a<<r-s]),n)for(;o.length*r&7;)o+="=";return o},Du=({name:t,prefix:e,bitsPerChar:r,alphabet:n})=>HK({prefix:e,name:t,encode(i){return y_e(i,n,r)},decode(i){return m_e(i,n,r,t)}});var gd=MR({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),Sat=MR({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});E();var V1=Du({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),Tat=Du({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),Rat=Du({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),Iat=Du({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),kat=Du({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),Oat=Du({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),Bat=Du({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),Dat=Du({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),Cat=Du({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});E();var ZK=(t,e)=>{let{bytes:r,version:n}=t;switch(n){case 0:return v_e(r,PR(t),e||gd.encoder);default:return b_e(r,PR(t),e||V1.encoder)}};var JK=new WeakMap,PR=t=>{let e=JK.get(t);if(e==null){let r=new Map;return JK.set(t,r),r}return e},Kn=class{constructor(e,r,n,i){this.code=r,this.version=e,this.multihash=n,this.bytes=i,this["/"]=i}get asCID(){return this}get byteOffset(){return this.bytes.byteOffset}get byteLength(){return this.bytes.byteLength}toV0(){switch(this.version){case 0:return this;case 1:{let{code:e,multihash:r}=this;if(e!==H1)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(r.code!==w_e)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return Kn.createV0(r)}default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}toV1(){switch(this.version){case 0:{let{code:e,digest:r}=this.multihash,n=zK(e,r);return Kn.createV1(this.code,n)}case 1:return this;default:throw Error(`Can not convert CID version ${this.version} to version 1. This is a bug please report`)}}equals(e){return Kn.equals(this,e)}static equals(e,r){let n=r;return n&&e.code===n.code&&e.version===n.version&&GK(e.multihash,n.multihash)}toString(e){return ZK(this,e)}toJSON(){return{"/":ZK(this)}}link(){return this}get[Symbol.toStringTag](){return"CID"}[Symbol.for("nodejs.util.inspect.custom")](){return`CID(${this.toString()})`}static asCID(e){if(e==null)return null;let r=e;if(r instanceof Kn)return r;if(r["/"]!=null&&r["/"]===r.bytes||r.asCID===r){let{version:n,code:i,multihash:o,bytes:s}=r;return new Kn(n,i,o,s||YK(n,i,o.bytes))}else if(r[__e]===!0){let{version:n,multihash:i,code:o}=r,s=KK(i);return Kn.create(n,o,s)}else return null}static create(e,r,n){if(typeof r!="number")throw new Error("String codecs are no longer supported");if(!(n.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(e){case 0:{if(r!==H1)throw new Error(`Version 0 CID must use dag-pb (code: ${H1}) block encoding`);return new Kn(e,r,n,n.bytes)}case 1:{let i=YK(e,r,n.bytes);return new Kn(e,r,n,i)}default:throw new Error("Invalid version")}}static createV0(e){return Kn.create(0,H1,e)}static createV1(e,r){return Kn.create(1,e,r)}static decode(e){let[r,n]=Kn.decodeFirst(e);if(n.length)throw new Error("Incorrect length");return r}static decodeFirst(e){let r=Kn.inspectBytes(e),n=r.size-r.multihashSize,i=sv(e.subarray(n,n+r.multihashSize));if(i.byteLength!==r.multihashSize)throw new Error("Incorrect length");let o=i.subarray(r.multihashSize-r.digestSize),s=new av(r.multihashCode,r.digestSize,o,i);return[r.version===0?Kn.createV0(s):Kn.createV1(r.codec,s),e.subarray(r.size)]}static inspectBytes(e){let r=0,n=()=>{let[w,P]=W1(e.subarray(r));return r+=P,w},i=n(),o=H1;if(i===18?(i=0,r=0):o=n(),i!==0&&i!==1)throw new RangeError(`Invalid CID version ${i}`);let s=r,a=n(),d=n(),m=r+d,p=m-s;return{version:i,codec:o,multihashCode:a,digestSize:d,multihashSize:p,size:m}}static parse(e,r){let[n,i]=g_e(e,r),o=Kn.decode(i);if(o.version===0&&e[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return PR(o).set(n,e),o}},g_e=(t,e)=>{switch(t[0]){case"Q":{let r=e||gd;return[gd.prefix,r.decode(`${gd.prefix}${t}`)]}case gd.prefix:{let r=e||gd;return[gd.prefix,r.decode(t)]}case V1.prefix:{let r=e||V1;return[V1.prefix,r.decode(t)]}default:{if(e==null)throw Error("To parse non base32 or base58btc encoded CID multibase decoder must be provided");return[t[0],e.decode(t)]}}},v_e=(t,e,r)=>{let{prefix:n}=r;if(n!==gd.prefix)throw Error(`Cannot string encode V0 in ${r.name} encoding`);let i=e.get(n);if(i==null){let o=r.encode(t).slice(1);return e.set(n,o),o}else return i},b_e=(t,e,r)=>{let{prefix:n}=r,i=e.get(n);if(i==null){let o=r.encode(t);return e.set(n,o),o}else return i},H1=112,w_e=18,YK=(t,e,r)=>{let n=ov(t),i=n+ov(e),o=new Uint8Array(i+r.byteLength);return iv(t,o,0),iv(e,o,n),o.set(r,i),o},__e=Symbol.for("@ipld/js-cid/CID");E();var x_e=new TextDecoder;function AR(t,e){let r=0;for(let n=0;;n+=7){if(n>=64)throw new Error("protobuf: varint overflow");if(e>=t.length)throw new Error("protobuf: unexpected end of data");let i=t[e++];if(r+=n<28?(i&127)<<n:(i&127)*2**n,i<128)break}return[r,e]}function t6(t,e){let r;[r,e]=AR(t,e);let n=e+r;if(r<0||n<0)throw new Error("protobuf: invalid length");if(n>t.length)throw new Error("protobuf: unexpected end of data");return[t.subarray(e,n),n]}function QK(t,e){let r;return[r,e]=AR(t,e),[r&7,r>>3,e]}function E_e(t){let e={},r=t.length,n=0;for(;n<r;){let i,o;if([i,o,n]=QK(t,n),o===1){if(e.Hash)throw new Error("protobuf: (PBLink) duplicate Hash section");if(i!==2)throw new Error(`protobuf: (PBLink) wrong wireType (${i}) for Hash`);if(e.Name!==void 0)throw new Error("protobuf: (PBLink) invalid order, found Name before Hash");if(e.Tsize!==void 0)throw new Error("protobuf: (PBLink) invalid order, found Tsize before Hash");[e.Hash,n]=t6(t,n)}else if(o===2){if(e.Name!==void 0)throw new Error("protobuf: (PBLink) duplicate Name section");if(i!==2)throw new Error(`protobuf: (PBLink) wrong wireType (${i}) for Name`);if(e.Tsize!==void 0)throw new Error("protobuf: (PBLink) invalid order, found Tsize before Name");let s;[s,n]=t6(t,n),e.Name=x_e.decode(s)}else if(o===3){if(e.Tsize!==void 0)throw new Error("protobuf: (PBLink) duplicate Tsize section");if(i!==0)throw new Error(`protobuf: (PBLink) wrong wireType (${i}) for Tsize`);[e.Tsize,n]=AR(t,n)}else throw new Error(`protobuf: (PBLink) invalid fieldNumber, expected 1, 2 or 3, got ${o}`)}if(n>r)throw new Error("protobuf: (PBLink) unexpected end of data");return e}function XK(t){let e=t.length,r=0,n,i=!1,o;for(;r<e;){let a,d;if([a,d,r]=QK(t,r),a!==2)throw new Error(`protobuf: (PBNode) invalid wireType, expected 2, got ${a}`);if(d===1){if(o)throw new Error("protobuf: (PBNode) duplicate Data section");[o,r]=t6(t,r),n&&(i=!0)}else if(d===2){if(i)throw new Error("protobuf: (PBNode) duplicate Links section");n||(n=[]);let m;[m,r]=t6(t,r),n.push(E_e(m))}else throw new Error(`protobuf: (PBNode) invalid fieldNumber, expected 1 or 2, got ${d}`)}if(r>e)throw new Error("protobuf: (PBNode) unexpected end of data");let s={};return o&&(s.Data=o),s.Links=n||[],s}E();var tG=new TextEncoder,eG=2**32,S_e=2**31;function M_e(t,e){let r=e.length;if(typeof t.Tsize=="number"){if(t.Tsize<0)throw new Error("Tsize cannot be negative");if(!Number.isSafeInteger(t.Tsize))throw new Error("Tsize too large for encoding");r=Z1(e,r,t.Tsize)-1,e[r]=24}if(typeof t.Name=="string"){let n=tG.encode(t.Name);r-=n.length,e.set(n,r),r=Z1(e,r,n.length)-1,e[r]=18}return t.Hash&&(r-=t.Hash.length,e.set(t.Hash,r),r=Z1(e,r,t.Hash.length)-1,e[r]=10),e.length-r}function rG(t){let e=A_e(t),r=new Uint8Array(e),n=e;if(t.Data&&(n-=t.Data.length,r.set(t.Data,n),n=Z1(r,n,t.Data.length)-1,r[n]=10),t.Links)for(let i=t.Links.length-1;i>=0;i--){let o=M_e(t.Links[i],r.subarray(0,n));n-=o,n=Z1(r,n,o)-1,r[n]=18}return r}function P_e(t){let e=0;if(t.Hash){let r=t.Hash.length;e+=1+r+cv(r)}if(typeof t.Name=="string"){let r=tG.encode(t.Name).length;e+=1+r+cv(r)}return typeof t.Tsize=="number"&&(e+=1+cv(t.Tsize)),e}function A_e(t){let e=0;if(t.Data){let r=t.Data.length;e+=1+r+cv(r)}if(t.Links)for(let r of t.Links){let n=P_e(r);e+=1+n+cv(n)}return e}function Z1(t,e,r){e-=cv(r);let n=e;for(;r>=S_e;)t[e++]=r&127|128,r/=128;for(;r>=128;)t[e++]=r&127|128,r>>>=7;return t[e]=r,n}function cv(t){return t%2===0&&t++,Math.floor((T_e(t)+6)/7)}function T_e(t){let e=0;return t>=eG&&(t=Math.floor(t/eG),e=32),t>=1<<16&&(t>>>=16,e+=16),t>=1<<8&&(t>>>=8,e+=8),e+R_e[t]}var R_e=[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];E();var I_e=["Data","Links"],k_e=["Hash","Name","Tsize"],TR=new TextEncoder;function iG(t,e){if(t===e)return 0;let r=t.Name?TR.encode(t.Name):[],n=e.Name?TR.encode(e.Name):[],i=r.length,o=n.length;for(let s=0,a=Math.min(i,o);s<a;++s)if(r[s]!==n[s]){i=r[s],o=n[s];break}return i<o?-1:o<i?1:0}function nG(t,e){return!Object.keys(t).some(r=>!e.includes(r))}function oG(t){if(typeof t.asCID=="object"){let r=Kn.asCID(t);if(!r)throw new TypeError("Invalid DAG-PB form");return{Hash:r}}if(typeof t!="object"||Array.isArray(t))throw new TypeError("Invalid DAG-PB form");let e={};if(t.Hash){let r=Kn.asCID(t.Hash);try{r||(typeof t.Hash=="string"?r=Kn.parse(t.Hash):t.Hash instanceof Uint8Array&&(r=Kn.decode(t.Hash)))}catch(n){throw new TypeError(`Invalid DAG-PB form: ${n.message}`)}r&&(e.Hash=r)}if(!e.Hash)throw new TypeError("Invalid DAG-PB form");return typeof t.Name=="string"&&(e.Name=t.Name),typeof t.Tsize=="number"&&(e.Tsize=t.Tsize),e}function Ha(t){if((t instanceof Uint8Array||typeof t=="string")&&(t={Data:t}),typeof t!="object"||Array.isArray(t))throw new TypeError("Invalid DAG-PB form");let e={};if(t.Data!==void 0)if(typeof t.Data=="string")e.Data=TR.encode(t.Data);else if(t.Data instanceof Uint8Array)e.Data=t.Data;else throw new TypeError("Invalid DAG-PB form");if(t.Links!==void 0)if(Array.isArray(t.Links))e.Links=t.Links.map(oG),e.Links.sort(iG);else throw new TypeError("Invalid DAG-PB form");else e.Links=[];return e}function RR(t){if(!t||typeof t!="object"||Array.isArray(t)||t instanceof Uint8Array||t["/"]&&t["/"]===t.bytes)throw new TypeError("Invalid DAG-PB form");if(!nG(t,I_e))throw new TypeError("Invalid DAG-PB form (extraneous properties)");if(t.Data!==void 0&&!(t.Data instanceof Uint8Array))throw new TypeError("Invalid DAG-PB form (Data must be bytes)");if(!Array.isArray(t.Links))throw new TypeError("Invalid DAG-PB form (Links must be a list)");for(let e=0;e<t.Links.length;e++){let r=t.Links[e];if(!r||typeof r!="object"||Array.isArray(r)||r instanceof Uint8Array||r["/"]&&r["/"]===r.bytes)throw new TypeError("Invalid DAG-PB form (bad link)");if(!nG(r,k_e))throw new TypeError("Invalid DAG-PB form (extraneous properties on link)");if(r.Hash===void 0)throw new TypeError("Invalid DAG-PB form (link must have a Hash)");if(r.Hash==null||!r.Hash["/"]||r.Hash["/"]!==r.Hash.bytes)throw new TypeError("Invalid DAG-PB form (link Hash must be a CID)");if(r.Name!==void 0&&typeof r.Name!="string")throw new TypeError("Invalid DAG-PB form (link Name must be a string)");if(r.Tsize!==void 0){if(typeof r.Tsize!="number"||r.Tsize%1!==0)throw new TypeError("Invalid DAG-PB form (link Tsize must be an integer)");if(r.Tsize<0)throw new TypeError("Invalid DAG-PB form (link Tsize cannot be negative)")}if(e>0&&iG(r,t.Links[e-1])===-1)throw new TypeError("Invalid DAG-PB form (links must be sorted by Name bytes)")}}function sG(t,e=[]){return Ha({Data:t,Links:e})}function aG(t,e,r){return oG({Hash:r,Name:t,Tsize:e})}var O_e="dag-pb",J1=112;function Za(t){RR(t);let e={};return t.Links&&(e.Links=t.Links.map(r=>{let n={};return r.Hash&&(n.Hash=r.Hash.bytes),r.Name!==void 0&&(n.Name=r.Name),r.Tsize!==void 0&&(n.Tsize=r.Tsize),n})),t.Data&&(e.Data=t.Data),rG(e)}function vd(t){let e=XK(t),r={};return e.Data&&(r.Data=e.Data),e.Links&&(r.Links=e.Links.map(n=>{let i={};try{i.Hash=Kn.decode(n.Hash)}catch{}if(!i.Hash)throw new Error("Invalid Hash field found in link, expected CID");return n.Name!==void 0&&(i.Name=n.Name),n.Tsize!==void 0&&(i.Tsize=n.Tsize),i})),r}E();var VR=or(Va(),1);E();E();E();E();var FR=or(DR(),1),HG=or(LG(),1),ZG=or(J0(),1),zR=or(UR(),1),JG=or(VG(),1);function U_e(){ZG.default._configure(),FR.default._configure(HG.default),zR.default._configure(JG.default)}U_e();var YG=["uint64","int64","sint64","fixed64","sfixed64"];function F_e(t){for(let e of YG){if(t[e]==null)continue;let r=t[e];t[e]=function(){return BigInt(r.call(this).toString())}}return t}function KR(t){return F_e(new FR.default(t))}function z_e(t){for(let e of YG){if(t[e]==null)continue;let r=t[e];t[e]=function(n){return r.call(this,n.toString())}}return t}function GR(){return z_e(zR.default.create())}function X1(t,e){let r=KR(t instanceof Uint8Array?t:t.subarray());return e.decode(r)}E();function e2(t,e){let r=GR();return e.encode(t,r,{lengthDelimited:!1}),r.finish()}E();E();var uv;(function(t){t[t.VARINT=0]="VARINT",t[t.BIT64=1]="BIT64",t[t.LENGTH_DELIMITED=2]="LENGTH_DELIMITED",t[t.START_GROUP=3]="START_GROUP",t[t.END_GROUP=4]="END_GROUP",t[t.BIT32=5]="BIT32"})(uv||(uv={}));function s6(t,e,r,n){return{name:t,type:e,encode:r,decode:n}}function WR(t){function e(i){if(t[i.toString()]==null)throw new Error("Invalid enum value");return t[i]}let r=function(o,s){let a=e(o);s.int32(a)},n=function(o){let s=o.int32();return e(s)};return s6("enum",uv.VARINT,r,n)}E();function t2(t,e){return s6("message",uv.LENGTH_DELIMITED,t,e)}var Tf;(function(t){let e;(function(i){i.Raw="Raw",i.Directory="Directory",i.File="File",i.Metadata="Metadata",i.Symlink="Symlink",i.HAMTShard="HAMTShard"})(e=t.DataType||(t.DataType={}));let r;(function(i){i[i.Raw=0]="Raw",i[i.Directory=1]="Directory",i[i.File=2]="File",i[i.Metadata=3]="Metadata",i[i.Symlink=4]="Symlink",i[i.HAMTShard=5]="HAMTShard"})(r||(r={})),function(i){i.codec=()=>WR(r)}(e=t.DataType||(t.DataType={}));let n;t.codec=()=>(n==null&&(n=t2((i,o,s={})=>{if(s.lengthDelimited!==!1&&o.fork(),i.Type!=null&&(o.uint32(8),t.DataType.codec().encode(i.Type,o)),i.Data!=null&&(o.uint32(18),o.bytes(i.Data)),i.filesize!=null&&(o.uint32(24),o.uint64(i.filesize)),i.blocksizes!=null)for(let a of i.blocksizes)o.uint32(32),o.uint64(a);i.hashType!=null&&(o.uint32(40),o.uint64(i.hashType)),i.fanout!=null&&(o.uint32(48),o.uint64(i.fanout)),i.mode!=null&&(o.uint32(56),o.uint32(i.mode)),i.mtime!=null&&(o.uint32(66),a6.codec().encode(i.mtime,o)),s.lengthDelimited!==!1&&o.ldelim()},(i,o)=>{let s={blocksizes:[]},a=o==null?i.len:i.pos+o;for(;i.pos<a;){let d=i.uint32();switch(d>>>3){case 1:s.Type=t.DataType.codec().decode(i);break;case 2:s.Data=i.bytes();break;case 3:s.filesize=i.uint64();break;case 4:s.blocksizes.push(i.uint64());break;case 5:s.hashType=i.uint64();break;case 6:s.fanout=i.uint64();break;case 7:s.mode=i.uint32();break;case 8:s.mtime=a6.codec().decode(i,i.uint32());break;default:i.skipType(d&7);break}}return s})),n),t.encode=i=>e2(i,t.codec()),t.decode=i=>X1(i,t.codec())})(Tf||(Tf={}));var a6;(function(t){let e;t.codec=()=>(e==null&&(e=t2((r,n,i={})=>{i.lengthDelimited!==!1&&n.fork(),r.Seconds!=null&&(n.uint32(8),n.int64(r.Seconds)),r.FractionalNanoseconds!=null&&(n.uint32(21),n.fixed32(r.FractionalNanoseconds)),i.lengthDelimited!==!1&&n.ldelim()},(r,n)=>{let i={},o=n==null?r.len:r.pos+n;for(;r.pos<o;){let s=r.uint32();switch(s>>>3){case 1:i.Seconds=r.int64();break;case 2:i.FractionalNanoseconds=r.fixed32();break;default:r.skipType(s&7);break}}return i})),e),t.encode=r=>e2(r,t.codec()),t.decode=r=>X1(r,t.codec())})(a6||(a6={}));var QG;(function(t){let e;t.codec=()=>(e==null&&(e=t2((r,n,i={})=>{i.lengthDelimited!==!1&&n.fork(),r.MimeType!=null&&(n.uint32(10),n.string(r.MimeType)),i.lengthDelimited!==!1&&n.ldelim()},(r,n)=>{let i={},o=n==null?r.len:r.pos+n;for(;r.pos<o;){let s=r.uint32();switch(s>>>3){case 1:i.MimeType=r.string();break;default:r.skipType(s&7);break}}return i})),e),t.encode=r=>e2(r,t.codec()),t.decode=r=>X1(r,t.codec())})(QG||(QG={}));var XG={Raw:"raw",Directory:"directory",File:"file",Metadata:"metadata",Symlink:"symlink",HAMTShard:"hamt-sharded-directory"},K_e=["directory","hamt-sharded-directory"],eW=parseInt("0644",8),tW=parseInt("0755",8),Ji=class{static unmarshal(e){let r=Tf.decode(e),n=new Ji({type:XG[r.Type!=null?r.Type.toString():"File"],data:r.Data,blockSizes:r.blocksizes,mode:r.mode,mtime:r.mtime!=null?{secs:r.mtime.Seconds??0n,nsecs:r.mtime.FractionalNanoseconds}:void 0});return n._originalMode=r.mode??0,n}type;data;blockSizes;hashType;fanout;mtime;_mode;_originalMode;constructor(e={type:"file"}){let{type:r,data:n,blockSizes:i,hashType:o,fanout:s,mtime:a,mode:d}=e;if(r!=null&&!Object.values(XG).includes(r))throw(0,VR.default)(new Error("Type: "+r+" is not valid"),"ERR_INVALID_TYPE");this.type=r??"file",this.data=n,this.hashType=o,this.fanout=s,this.blockSizes=i??[],this._originalMode=0,this.mode=d,this.mtime=a}set mode(e){e==null?this._mode=this.isDirectory()?tW:eW:this._mode=e&4095}get mode(){return this._mode}isDirectory(){return K_e.includes(this.type)}addBlockSize(e){this.blockSizes.push(e)}removeBlockSize(e){this.blockSizes.splice(e,1)}fileSize(){if(this.isDirectory())return 0n;let e=0n;return this.blockSizes.forEach(r=>{e+=r}),this.data!=null&&(e+=BigInt(this.data.length)),e}marshal(){let e;switch(this.type){case"raw":e=Tf.DataType.Raw;break;case"directory":e=Tf.DataType.Directory;break;case"file":e=Tf.DataType.File;break;case"metadata":e=Tf.DataType.Metadata;break;case"symlink":e=Tf.DataType.Symlink;break;case"hamt-sharded-directory":e=Tf.DataType.HAMTShard;break;default:throw(0,VR.default)(new Error(`Type: ${e} is not valid`),"ERR_INVALID_TYPE")}let r=this.data;(this.data==null||this.data.length===0)&&(r=void 0);let n;this.mode!=null&&(n=this._originalMode&4294963200|(this.mode??0),n===eW&&!this.isDirectory()&&(n=void 0),n===tW&&this.isDirectory()&&(n=void 0));let i;return this.mtime!=null&&(i={Seconds:this.mtime.secs,FractionalNanoseconds:this.mtime.nsecs}),Tf.encode({Type:e,Data:r,filesize:this.isDirectory()?void 0:this.fileSize(),blocksizes:this.blockSizes,hashType:this.hashType,fanout:this.fanout,mode:n,mtime:i})}};E();var Si=class extends Event{constructor(e,r){super(e),this.detail=r}};E();var Rf=async(t,e,r)=>{r.codec==null&&(r.codec=H0);let n=await xo.digest(t),i=St.create(r.cidVersion,r.codec.code,n);return await e.put(i,t,r),i};function rW(t){return async function*(r,n){let i=0n;for await(let o of r.content)yield async()=>{let s,a={codec:H0,cidVersion:t.cidVersion,onProgress:t.onProgress};t.rawLeaves?(a.codec=$0,a.cidVersion=1):(s=new Ji({type:t.leafType,data:o}),o=Za({Data:s.marshal(),Links:[]}));let d=await Rf(o,n,a);return i+=BigInt(o.byteLength),t.onProgress?.(new Si("unixfs:importer:progress:file:write",{bytesWritten:i,cid:d,path:r.path})),{cid:d,unixfs:s,size:BigInt(o.length),block:o}}}}E();var HR=or(Va(),1);E();var nW=async(t,e,r)=>{let n=new Ji({type:"directory",mtime:t.mtime,mode:t.mode}),i=Za(Ha({Data:n.marshal()})),o=await Rf(i,e,r),s=t.path;return{cid:o,path:s,unixfs:n,size:BigInt(i.length),originalPath:t.originalPath,block:i}};E();async function*G_e(t,e,r){let n=-1,i;for await(let o of K1(r.bufferImporter(t,e),r.blockWriteConcurrency)){if(n++,n===0){i={...o,single:!0};continue}else n===1&&i!=null&&(yield{...i,block:void 0,single:void 0},i=void 0);yield{...o,block:void 0}}i!=null&&(yield i)}function iW(t){return t.single===!0}var W_e=(t,e,r)=>async function(i){if(i.length===1&&iW(i[0])&&r.reduceSingleLeafToSelf){let p=i[0],w=p.block;return iW(p)&&(t.mtime!==void 0||t.mode!==void 0)&&(p.unixfs=new Ji({type:"file",mtime:t.mtime,mode:t.mode,data:p.block}),w={Data:p.unixfs.marshal(),Links:[]},p.block=Za(Ha(w)),p.cid=await Rf(p.block,e,{...r,cidVersion:r.cidVersion}),p.size=BigInt(p.block.length)),r.onProgress?.(new Si("unixfs:importer:progress:file:layout",{cid:p.cid,path:p.originalPath})),{cid:p.cid,path:t.path,unixfs:p.unixfs,size:p.size,originalPath:p.originalPath}}let o=new Ji({type:"file",mtime:t.mtime,mode:t.mode}),s=i.filter(p=>p.cid.code===Uh&&p.size>0||p.unixfs!=null&&p.unixfs.data==null&&p.unixfs.fileSize()>0n?!0:Boolean(p.unixfs?.data?.length)).map(p=>p.cid.code===Uh?(o.addBlockSize(p.size),{Name:"",Tsize:Number(p.size),Hash:p.cid}):(p.unixfs==null||p.unixfs.data==null?o.addBlockSize(p.unixfs?.fileSize()??0n):o.addBlockSize(BigInt(p.unixfs.data.length)),{Name:"",Tsize:Number(p.size),Hash:p.cid})),a={Data:o.marshal(),Links:s},d=Za(Ha(a)),m=await Rf(d,e,r);return r.onProgress?.(new Si("unixfs:importer:progress:file:layout",{cid:m,path:t.originalPath})),{cid:m,path:t.path,unixfs:o,size:BigInt(d.length+a.Links.reduce((p,w)=>p+(w.Tsize??0),0)),originalPath:t.originalPath,block:d}},oW=async(t,e,r)=>r.layout(G_e(t,e,r),W_e(t,e,r));function V_e(t){return Symbol.iterator in t}function H_e(t){return Symbol.asyncIterator in t}function Z_e(t){try{if(t instanceof Uint8Array)return async function*(){yield t}();if(V_e(t))return async function*(){yield*t}();if(H_e(t))return t}catch{throw(0,HR.default)(new Error("Content was invalid"),"ERR_INVALID_CONTENT")}throw(0,HR.default)(new Error("Content was invalid"),"ERR_INVALID_CONTENT")}function sW(t){return async function*(r,n){for await(let i of r){let o;if(i.path!=null&&(o=i.path,i.path=i.path.split("/").filter(s=>s!=null&&s!==".").join("/")),J_e(i)){let s={path:i.path,mtime:i.mtime,mode:i.mode,content:async function*(){let a=0n;for await(let d of t.chunker(t.chunkValidator(Z_e(i.content)))){let m=BigInt(d.byteLength);a+=m,t.onProgress?.(new Si("unixfs:importer:progress:file:read",{bytesRead:a,chunkSize:m,path:i.path})),yield d}}(),originalPath:o};yield async()=>oW(s,n,t)}else if(i.path!=null){let s={path:i.path,mtime:i.mtime,mode:i.mode,originalPath:o};yield async()=>nW(s,n,t)}else throw new Error("Import candidate must have content or path or both")}}}function J_e(t){return t.content!=null}E();var ZR=or(Va(),1);var aW=()=>async function*(e){for await(let r of e){if(r.length===void 0)throw(0,ZR.default)(new Error("Content was invalid"),"ERR_INVALID_CONTENT");if(typeof r=="string"||r instanceof String)yield L0(r.toString());else if(Array.isArray(r))yield Uint8Array.from(r);else if(r instanceof Uint8Array)yield r;else throw(0,ZR.default)(new Error("Content was invalid"),"ERR_INVALID_CONTENT")}};E();E();var Y_e=174;function JR(t){let e=t?.maxChildrenPerNode??Y_e;return async function r(n,i){let o=[];for await(let s of z1(n,e))o.push(await i(s));return o.length>1?r(o,i):o[0]}}E();E();E();E();E();E();var ju=class{options;root;dir;path;dirty;flat;parent;parentKey;unixfs;mode;mtime;cid;size;nodeSize;constructor(e,r){this.options=r??{},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}},r2=St.parse("QmUNLLsPACCz1vLxQVkXqqLX5R1X345qqfHbsf67hvA3Nn"),n2=St.parse("zdj7WbTaiJT1fgatdet9Ei9iDB5hdCxkbVyhyh8YTUnXMiwYi");var Q0=class extends ju{_children;constructor(e,r){super(e,r),this._children=new Map}async put(e,r){this.cid=void 0,this.size=void 0,this.nodeSize=void 0,this._children.set(e,r)}async get(e){return Promise.resolve(this._children.get(e))}childCount(){return this._children.size}directChildrenCount(){return this.childCount()}onlyChild(){return this._children.values().next().value}async*eachChildSeries(){for(let[e,r]of this._children.entries())yield{key:e,child:r}}estimateNodeSize(){if(this.nodeSize!==void 0)return this.nodeSize;this.nodeSize=0;for(let[e,r]of this._children.entries())r.size!=null&&r.cid!=null&&(this.nodeSize+=e.length+(this.options.cidVersion===1?n2.bytes.byteLength:r2.bytes.byteLength));return this.nodeSize}async*flush(e){let r=[];for(let[d,m]of this._children.entries()){let p=m;if(m instanceof ju)for await(let w of m.flush(e))p=w,yield w;p.size!=null&&p.cid!=null&&r.push({Name:d,Tsize:Number(p.size),Hash:p.cid})}let n=new Ji({type:"directory",mtime:this.mtime,mode:this.mode}),i={Data:n.marshal(),Links:r},o=Za(Ha(i)),s=await Rf(o,e,this.options),a=o.length+i.Links.reduce((d,m)=>d+(m.Tsize==null?0:m.Tsize),0);this.cid=s,this.size=a,yield{cid:s,unixfs:n,path:this.path,size:BigInt(a)}}};E();E();E();E();E();E();E();var Q_e=uW,cW=128,X_e=127,exe=~X_e,txe=Math.pow(2,31);function uW(t,e,r){e=e||[],r=r||0;for(var n=r;t>=txe;)e[r++]=t&255|cW,t/=128;for(;t&exe;)e[r++]=t&255|cW,t>>>=7;return e[r]=t|0,uW.bytes=r-n+1,e}var rxe=YR,nxe=128,fW=127;function YR(t,n){var r=0,n=n||0,i=0,o=n,s,a=t.length;do{if(o>=a)throw YR.bytes=0,new RangeError("Could not decode varint");s=t[o++],r+=i<28?(s&fW)<<i:(s&fW)*Math.pow(2,i),i+=7}while(s>=nxe);return YR.bytes=o-n,r}var ixe=Math.pow(2,7),oxe=Math.pow(2,14),sxe=Math.pow(2,21),axe=Math.pow(2,28),cxe=Math.pow(2,35),fxe=Math.pow(2,42),uxe=Math.pow(2,49),lxe=Math.pow(2,56),dxe=Math.pow(2,63),hxe=function(t){return t<ixe?1:t<oxe?2:t<sxe?3:t<axe?4:t<cxe?5:t<fxe?6:t<uxe?7:t<lxe?8:t<dxe?9:10},pxe={encode:Q_e,decode:rxe,encodingLength:hxe},mxe=pxe,i2=mxe;var o2=(t,e=0)=>[i2.decode(t,e),i2.decode.bytes],lv=(t,e,r=0)=>(i2.encode(t,e,r),e),dv=t=>i2.encodingLength(t);E();var s2={};Di(s2,{coerce:()=>X0,empty:()=>lW,equals:()=>XR,fromHex:()=>gxe,fromString:()=>bxe,isBinary:()=>vxe,toHex:()=>yxe,toString:()=>wxe});E();var lW=new Uint8Array(0),yxe=t=>t.reduce((e,r)=>e+r.toString(16).padStart(2,"0"),""),gxe=t=>{let e=t.match(/../g);return e?new Uint8Array(e.map(r=>parseInt(r,16))):lW},XR=(t,e)=>{if(t===e)return!0;if(t.byteLength!==e.byteLength)return!1;for(let r=0;r<t.byteLength;r++)if(t[r]!==e[r])return!1;return!0},X0=t=>{if(t instanceof Uint8Array&&t.constructor.name==="Uint8Array")return t;if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);throw new Error("Unknown type, must be binary type")},vxe=t=>t instanceof ArrayBuffer||ArrayBuffer.isView(t),bxe=t=>new TextEncoder().encode(t),wxe=t=>new TextDecoder().decode(t);var a2=(t,e)=>{let r=e.byteLength,n=dv(t),i=n+dv(r),o=new Uint8Array(i+r);return lv(t,o,0),lv(r,o,n),o.set(e,i),new hv(t,r,e,o)},dW=t=>{let e=X0(t),[r,n]=o2(e),[i,o]=o2(e.subarray(n)),s=e.subarray(n+o);if(s.byteLength!==i)throw new Error("Incorrect length");return new hv(r,i,s,e)},hW=(t,e)=>{if(t===e)return!0;{let r=e;return t.code===r.code&&t.size===r.size&&r.bytes instanceof Uint8Array&&XR(t.bytes,r.bytes)}},hv=class{constructor(e,r,n,i){this.code=e,this.size=r,this.digest=n,this.bytes=i}};E();E();E();function _xe(t,e){if(t.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 i=0;i<t.length;i++){var o=t.charAt(i),s=o.charCodeAt(0);if(r[s]!==255)throw new TypeError(o+" is ambiguous");r[s]=i}var a=t.length,d=t.charAt(0),m=Math.log(a)/Math.log(256),p=Math.log(256)/Math.log(a);function w(M){if(M instanceof Uint8Array||(ArrayBuffer.isView(M)?M=new Uint8Array(M.buffer,M.byteOffset,M.byteLength):Array.isArray(M)&&(M=Uint8Array.from(M))),!(M instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(M.length===0)return"";for(var A=0,B=0,I=0,C=M.length;I!==C&&M[I]===0;)I++,A++;for(var k=(C-I)*p+1>>>0,q=new Uint8Array(k);I!==C;){for(var L=M[I],U=0,F=k-1;(L!==0||U<B)&&F!==-1;F--,U++)L+=256*q[F]>>>0,q[F]=L%a>>>0,L=L/a>>>0;if(L!==0)throw new Error("Non-zero carry");B=U,I++}for(var N=k-B;N!==k&&q[N]===0;)N++;for(var G=d.repeat(A);N<k;++N)G+=t.charAt(q[N]);return G}function P(M){if(typeof M!="string")throw new TypeError("Expected String");if(M.length===0)return new Uint8Array;var A=0;if(M[A]!==" "){for(var B=0,I=0;M[A]===d;)B++,A++;for(var C=(M.length-A)*m+1>>>0,k=new Uint8Array(C);M[A];){var q=r[M.charCodeAt(A)];if(q===255)return;for(var L=0,U=C-1;(q!==0||L<I)&&U!==-1;U--,L++)q+=a*k[U]>>>0,k[U]=q%256>>>0,q=q/256>>>0;if(q!==0)throw new Error("Non-zero carry");I=L,A++}if(M[A]!==" "){for(var F=C-I;F!==C&&k[F]===0;)F++;for(var N=new Uint8Array(B+(C-F)),G=B;F!==C;)N[G++]=k[F++];return N}}}function S(M){var A=P(M);if(A)return A;throw new Error(`Non-${e} character`)}return{encode:w,decodeUnsafe:P,decode:S}}var xxe=_xe,Exe=xxe,pW=Exe;E();var tI=class{constructor(e,r,n){this.name=e,this.prefix=r,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},rI=class{constructor(e,r,n){if(this.name=e,this.prefix=r,r.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return mW(this,e)}},nI=class{constructor(e){this.decoders=e}or(e){return mW(this,e)}decode(e){let r=e[0],n=this.decoders[r];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}},mW=(t,e)=>new nI({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}}),iI=class{constructor(e,r,n,i){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new tI(e,r,n),this.decoder=new rI(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}},yW=({name:t,prefix:e,encode:r,decode:n})=>new iI(t,e,r,n),oI=({prefix:t,name:e,alphabet:r})=>{let{encode:n,decode:i}=pW(r,e);return yW({prefix:t,name:e,encode:n,decode:o=>X0(i(o))})},Sxe=(t,e,r,n)=>{let i={};for(let p=0;p<e.length;++p)i[e[p]]=p;let o=t.length;for(;t[o-1]==="=";)--o;let s=new Uint8Array(o*r/8|0),a=0,d=0,m=0;for(let p=0;p<o;++p){let w=i[t[p]];if(w===void 0)throw new SyntaxError(`Non-${n} character`);d=d<<r|w,a+=r,a>=8&&(a-=8,s[m++]=255&d>>a)}if(a>=r||255&d<<8-a)throw new SyntaxError("Unexpected end of data");return s},Mxe=(t,e,r)=>{let n=e[e.length-1]==="=",i=(1<<r)-1,o="",s=0,a=0;for(let d=0;d<t.length;++d)for(a=a<<8|t[d],s+=8;s>r;)s-=r,o+=e[i&a>>s];if(s&&(o+=e[i&a<<r-s]),n)for(;o.length*r&7;)o+="=";return o},Nu=({name:t,prefix:e,bitsPerChar:r,alphabet:n})=>yW({prefix:e,name:t,encode(i){return Mxe(i,n,r)},decode(i){return Sxe(i,n,r,t)}});var bd=oI({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),Mut=oI({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});E();var c2=Nu({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),Rut=Nu({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),Iut=Nu({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),kut=Nu({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),Out=Nu({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),But=Nu({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),Dut=Nu({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),Cut=Nu({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),jut=Nu({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});E();var gW=(t,e)=>{let{bytes:r,version:n}=t;switch(n){case 0:return Axe(r,sI(t),e||bd.encoder);default:return Txe(r,sI(t),e||c2.encoder)}};var vW=new WeakMap,sI=t=>{let e=vW.get(t);if(e==null){let r=new Map;return vW.set(t,r),r}return e},ao=class{constructor(e,r,n,i){this.code=r,this.version=e,this.multihash=n,this.bytes=i,this["/"]=i}get asCID(){return this}get byteOffset(){return this.bytes.byteOffset}get byteLength(){return this.bytes.byteLength}toV0(){switch(this.version){case 0:return this;case 1:{let{code:e,multihash:r}=this;if(e!==f2)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(r.code!==Rxe)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return ao.createV0(r)}default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}toV1(){switch(this.version){case 0:{let{code:e,digest:r}=this.multihash,n=a2(e,r);return ao.createV1(this.code,n)}case 1:return this;default:throw Error(`Can not convert CID version ${this.version} to version 1. This is a bug please report`)}}equals(e){return ao.equals(this,e)}static equals(e,r){let n=r;return n&&e.code===n.code&&e.version===n.version&&hW(e.multihash,n.multihash)}toString(e){return gW(this,e)}toJSON(){return{"/":gW(this)}}link(){return this}get[Symbol.toStringTag](){return"CID"}[Symbol.for("nodejs.util.inspect.custom")](){return`CID(${this.toString()})`}static asCID(e){if(e==null)return null;let r=e;if(r instanceof ao)return r;if(r["/"]!=null&&r["/"]===r.bytes||r.asCID===r){let{version:n,code:i,multihash:o,bytes:s}=r;return new ao(n,i,o,s||bW(n,i,o.bytes))}else if(r[Ixe]===!0){let{version:n,multihash:i,code:o}=r,s=dW(i);return ao.create(n,o,s)}else return null}static create(e,r,n){if(typeof r!="number")throw new Error("String codecs are no longer supported");if(!(n.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(e){case 0:{if(r!==f2)throw new Error(`Version 0 CID must use dag-pb (code: ${f2}) block encoding`);return new ao(e,r,n,n.bytes)}case 1:{let i=bW(e,r,n.bytes);return new ao(e,r,n,i)}default:throw new Error("Invalid version")}}static createV0(e){return ao.create(0,f2,e)}static createV1(e,r){return ao.create(1,e,r)}static decode(e){let[r,n]=ao.decodeFirst(e);if(n.length)throw new Error("Incorrect length");return r}static decodeFirst(e){let r=ao.inspectBytes(e),n=r.size-r.multihashSize,i=X0(e.subarray(n,n+r.multihashSize));if(i.byteLength!==r.multihashSize)throw new Error("Incorrect length");let o=i.subarray(r.multihashSize-r.digestSize),s=new hv(r.multihashCode,r.digestSize,o,i);return[r.version===0?ao.createV0(s):ao.createV1(r.codec,s),e.subarray(r.size)]}static inspectBytes(e){let r=0,n=()=>{let[w,P]=o2(e.subarray(r));return r+=P,w},i=n(),o=f2;if(i===18?(i=0,r=0):o=n(),i!==0&&i!==1)throw new RangeError(`Invalid CID version ${i}`);let s=r,a=n(),d=n(),m=r+d,p=m-s;return{version:i,codec:o,multihashCode:a,digestSize:d,multihashSize:p,size:m}}static parse(e,r){let[n,i]=Pxe(e,r),o=ao.decode(i);if(o.version===0&&e[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return sI(o).set(n,e),o}},Pxe=(t,e)=>{switch(t[0]){case"Q":{let r=e||bd;return[bd.prefix,r.decode(`${bd.prefix}${t}`)]}case bd.prefix:{let r=e||bd;return[bd.prefix,r.decode(t)]}case c2.prefix:{let r=e||c2;return[c2.prefix,r.decode(t)]}default:{if(e==null)throw Error("To parse non base32 or base58btc encoded CID multibase decoder must be provided");return[t[0],e.decode(t)]}}},Axe=(t,e,r)=>{let{prefix:n}=r;if(n!==bd.prefix)throw Error(`Cannot string encode V0 in ${r.name} encoding`);let i=e.get(n);if(i==null){let o=r.encode(t).slice(1);return e.set(n,o),o}else return i},Txe=(t,e,r)=>{let{prefix:n}=r,i=e.get(n);if(i==null){let o=r.encode(t);return e.set(n,o),o}else return i},f2=112,Rxe=18,bW=(t,e,r)=>{let n=dv(t),i=n+dv(e),o=new Uint8Array(i+r.byteLength);return lv(t,o,0),lv(e,o,n),o.set(r,i),o},Ixe=Symbol.for("@ipld/js-cid/CID");E();var c6=({name:t,code:e,encode:r})=>new aI(t,e,r),aI=class{constructor(e,r,n){this.name=e,this.code=r,this.encode=n}digest(e){if(e instanceof Uint8Array){let r=this.encode(e);return r instanceof Uint8Array?a2(this.code,r):r.then(n=>a2(this.code,n))}else throw Error("Unknown type, must be binary type")}};E();var u6=or(xW(),1);function Oxe(t){let e=new Array(4);for(let r=0;r<4;r++)e[r]=t&255,t=t>>8;return new Uint8Array(e)}var ilt=c6({name:"murmur3-32",code:35,encode:t=>Oxe(u6.default.x86.hash32(t))}),l6=c6({name:"murmur3-128",code:34,encode:t=>s2.fromHex(u6.default.x64.hash128(t))}),olt=c6({name:"murmur3-x64-64",code:34,encode:t=>s2.fromHex(u6.default.x64.hash128(t)).subarray(0,8)});E();E();var PW=or(MW(),1);var Ao=class{constructor(e,r,n=0){this._options=e,this._popCount=0,this._parent=r,this._posAtParent=n,this._children=new PW.default,this.key=null}async put(e,r){let n=await this._findNewBucketAndPos(e);await n.bucket._putAt(n,e,r)}async get(e){let r=await this._findChild(e);if(r!=null)return r.value}async del(e){let r=await this._findPlace(e),n=r.bucket._at(r.pos);n!=null&&n.key===e&&r.bucket._delAt(r.pos)}leafCount(){return this._children.compactArray().reduce((r,n)=>n instanceof Ao?r+n.leafCount():r+1,0)}childrenCount(){return this._children.length}onlyChild(){return this._children.get(0)}*eachLeafSeries(){let e=this._children.compactArray();for(let r of e)r instanceof Ao?yield*r.eachLeafSeries():yield r}serialize(e,r){let n=[];return r(this._children.reduce((i,o,s)=>(o!=null&&(o instanceof Ao?i.push(o.serialize(e,r)):i.push(e(o,s))),i),n))}async asyncTransform(e,r){return await AW(this,e,r)}toJSON(){return this.serialize(Nxe,qxe)}prettyPrint(){return JSON.stringify(this.toJSON(),null," ")}tableSize(){return Math.pow(2,this._options.bits)}async _findChild(e){let r=await this._findPlace(e),n=r.bucket._at(r.pos);if(!(n instanceof Ao)&&n!=null&&n.key===e)return n}async _findPlace(e){let r=this._options.hash(typeof e=="string"?L0(e):e),n=await r.take(this._options.bits),i=this._children.get(n);return i instanceof Ao?await i._findPlace(r):{bucket:this,pos:n,hash:r,existingChild:i}}async _findNewBucketAndPos(e){let r=await this._findPlace(e);if(r.existingChild!=null&&r.existingChild.key!==e){let n=new Ao(this._options,r.bucket,r.pos);r.bucket._putObjectAt(r.pos,n);let i=await n._findPlace(r.existingChild.hash);return i.bucket._putAt(i,r.existingChild.key,r.existingChild.value),await n._findNewBucketAndPos(r.hash)}return r}_putAt(e,r,n){this._putObjectAt(e.pos,{key:r,value:n,hash:e.hash})}_putObjectAt(e,r){this._children.get(e)==null&&this._popCount++,this._children.set(e,r)}_delAt(e){if(e===-1)throw new Error("Invalid position");this._children.get(e)!=null&&this._popCount--,this._children.unset(e),this._level()}_level(){if(this._parent!=null&&this._popCount<=1)if(this._popCount===1){let e=this._children.find(jxe);if(e!=null&&!(e instanceof Ao)){let r=e.hash;r.untake(this._options.bits);let n={pos:this._posAtParent,hash:r,bucket:this._parent};this._parent._putAt(n,e.key,e.value)}}else this._parent._delAt(this._posAtParent)}_at(e){return this._children.get(e)}};function jxe(t){return Boolean(t)}function Nxe(t,e){return t.key}function qxe(t){return t}async function AW(t,e,r){let n=[];for(let i of t._children.compactArray())if(i instanceof Ao)await AW(i,e,r);else{let o=await e(i);n.push({bitField:t._children.bitField(),children:o})}return await r(n)}E();E();var $xe=[255,254,252,248,240,224,192,128],Lxe=[1,3,7,15,31,63,127,255],d6=class{constructor(e){this._value=e,this._currentBytePos=e.length-1,this._currentBitPos=7}availableBits(){return this._currentBitPos+1+this._currentBytePos*8}totalBits(){return this._value.length*8}take(e){let r=e,n=0;for(;r>0&&this._haveBits();){let i=this._value[this._currentBytePos],o=this._currentBitPos+1,s=Math.min(o,r),a=Uxe(i,o-s,s);n=(n<<s)+a,r-=s,this._currentBitPos-=s,this._currentBitPos<0&&(this._currentBitPos=7,this._currentBytePos--)}return n}untake(e){for(this._currentBitPos+=e;this._currentBitPos>7;)this._currentBitPos-=8,this._currentBytePos+=1}_haveBits(){return this._currentBytePos>=0}};function Uxe(t,e,r){let n=Fxe(e,r);return(t&n)>>>e}function Fxe(t,e){return $xe[t]&Lxe[Math.min(e+t-1,7)]}function TW(t){function e(r){return r instanceof h6?r:new h6(r,t)}return e}var h6=class{constructor(e,r){if(!(e instanceof Uint8Array))throw new Error("can only hash Uint8Arrays");this._value=e,this._hashFn=r,this._depth=-1,this._availableBits=0,this._currentBufferIndex=0,this._buffers=[]}async take(e){let r=e;for(;this._availableBits<r;)await this._produceMoreBits();let n=0;for(;r>0;){let i=this._buffers[this._currentBufferIndex],o=Math.min(i.availableBits(),r),s=i.take(o);n=(n<<o)+s,r-=o,this._availableBits-=o,i.availableBits()===0&&this._currentBufferIndex++}return n}untake(e){let r=e;for(;r>0;){let n=this._buffers[this._currentBufferIndex],i=Math.min(n.totalBits()-n.availableBits(),r);n.untake(i),r-=i,this._availableBits+=i,this._currentBufferIndex>0&&n.totalBits()===n.availableBits()&&(this._depth--,this._currentBufferIndex--)}}async _produceMoreBits(){this._depth++;let e=this._depth>0?$g([this._value,Uint8Array.from([this._depth])]):this._value,r=await this._hashFn(e),n=new d6(r);this._buffers.push(n),this._availableBits+=n.availableBits()}};function p6(t){if(t==null||t.hashFn==null)throw new Error("please define an options.hashFn");let e={bits:t.bits??8,hash:TW(t.hashFn)};return new Ao(e)}async function zxe(t){return(await l6.encode(t)).slice(0,8).reverse()}var RW=BigInt(34),cI=class extends ju{_bucket;constructor(e,r){super(e,r),this._bucket=p6({hashFn:zxe,bits:8})}async put(e,r){this.cid=void 0,this.size=void 0,this.nodeSize=void 0,await this._bucket.put(e,r)}async 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(let{key:e,value:r}of this._bucket.eachLeafSeries())yield{key:e,child:r}}estimateNodeSize(){return this.nodeSize!==void 0?this.nodeSize:(this.nodeSize=OW(this._bucket,this,this.options),this.nodeSize)}async*flush(e){for await(let r of kW(this._bucket,e,this,this.options))yield{...r,path:this.path}}},IW=cI;async function*kW(t,e,r,n){let i=t._children,o=[],s=0n;for(let S=0;S<i.length;S++){let M=i.get(S);if(M==null)continue;let A=S.toString(16).toUpperCase().padStart(2,"0");if(M instanceof Ao){let B;for await(let I of kW(M,e,null,n))B=I;if(B==null)throw new Error("Could not flush sharded directory, no subshard found");o.push({Name:A,Tsize:Number(B.size),Hash:B.cid}),s+=B.size}else if(Kxe(M.value)){let B=M.value,I;for await(let k of B.flush(e))I=k,yield I;if(I==null)throw new Error("Did not flush dir");let C=A+M.key;o.push({Name:C,Tsize:Number(I.size),Hash:I.cid}),s+=I.size}else{let B=M.value;if(B.cid==null)continue;let I=A+M.key,C=B.size;o.push({Name:I,Tsize:Number(C),Hash:B.cid}),s+=BigInt(C??0)}}let a=Uint8Array.from(i.bitField().reverse()),d=new Ji({type:"hamt-sharded-directory",data:a,fanout:BigInt(t.tableSize()),hashType:RW,mtime:r?.mtime,mode:r?.mode}),m={Data:d.marshal(),Links:o},p=Za(Ha(m)),w=await Rf(p,e,n),P=BigInt(p.byteLength)+s;yield{cid:w,unixfs:d,size:P}}function Kxe(t){return typeof t.flush=="function"}function OW(t,e,r){let n=t._children,i=[];for(let d=0;d<n.length;d++){let m=n.get(d);if(m==null)continue;let p=d.toString(16).toUpperCase().padStart(2,"0");if(m instanceof Ao){let w=OW(m,null,r);i.push({Name:p,Tsize:Number(w),Hash:r.cidVersion===0?r2:n2})}else if(typeof m.value.flush=="function"){let P=m.value.nodeSize();i.push({Name:p+m.key,Tsize:Number(P),Hash:r.cidVersion===0?r2:n2})}else{let w=m.value;if(w.cid==null)continue;let P=p+m.key,S=w.size;i.push({Name:P,Tsize:Number(S),Hash:w.cid})}}let o=Uint8Array.from(n.bitField().reverse()),s=new Ji({type:"hamt-sharded-directory",data:o,fanout:BigInt(t.tableSize()),hashType:RW,mtime:e?.mtime,mode:e?.mode});return Za(Ha({Data:s.marshal(),Links:i})).length}async function fI(t,e,r,n){let i=e;e instanceof Q0&&e.estimateNodeSize()>r&&(i=await Gxe(e,n));let o=i.parent;if(o!=null){if(i!==e){if(t!=null&&(t.parent=i),i.parentKey==null)throw new Error("No parent key found");await o.put(i.parentKey,i)}return fI(i,o,r,n)}return i}async function Gxe(t,e){let r=new IW({root:t.root,dir:!0,parent:t.parent,parentKey:t.parentKey,path:t.path,dirty:t.dirty,flat:!1,mtime:t.mtime,mode:t.mode},e);for await(let{key:n,child:i}of t.eachChildSeries())await r.put(n,i);return r}E();var BW=(t="")=>(t.trim().match(/([^\\/]|\\\/)+/g)??[]).filter(Boolean);async function Wxe(t,e,r){let n=BW(t.path??""),i=n.length-1,o=e,s="";for(let a=0;a<n.length;a++){let d=n[a];s+=`${s!==""?"/":""}${d}`;let m=a===i;if(o.dirty=!0,o.cid=void 0,o.size=void 0,m)await o.put(d,t),e=await fI(null,o,r.shardSplitThresholdBytes,r);else{let p=await o.get(d);(p==null||!(p instanceof ju))&&(p=new Q0({root:!1,dir:!0,parent:o,parentKey:d,path:s,dirty:!0,flat:!0,mtime:p?.unixfs?.mtime,mode:p?.unixfs?.mode},r)),await o.put(d,p),o=p}}return e}async function*DW(t,e){if(!(t instanceof ju)){t.unixfs?.isDirectory()===!0&&(yield t);return}yield*t.flush(e)}function CW(t){return async function*(r,n){let i=new Q0({root:!0,dir:!0,path:"",dirty:!0,flat:!0},t),o,s=!1;for await(let a of r){if(a==null)continue;let d=`${a.originalPath??""}`.split("/")[0];d!=null&&d!==""&&(o==null?(o=d,s=!0):o!==d&&(s=!1)),i=await Wxe(a,i,t),(a.unixfs==null||!a.unixfs.isDirectory())&&(yield a)}if(t.wrapWithDirectory||s&&i.childCount()>1)yield*DW(i,n);else for await(let a of i.eachChildSeries())a!=null&&(yield*DW(a.child,n))}}async function*l2(t,e,r={}){let n;Symbol.asyncIterator in t||Symbol.iterator in t?n=t:n=[t];let i=r.wrapWithDirectory??!1,o=r.shardSplitThresholdBytes??262144,s=r.cidVersion??1,a=r.rawLeaves??!0,d=r.leafType??"file",m=r.fileImportConcurrency??50,p=r.blockWriteConcurrency??10,w=r.reduceSingleLeafToSelf??!0,P=r.chunker??NK(),S=r.chunkValidator??aW(),M=r.dagBuilder??sW({chunker:P,chunkValidator:S,wrapWithDirectory:i,layout:r.layout??JR(),bufferImporter:r.bufferImporter??rW({cidVersion:s,rawLeaves:a,leafType:d,onProgress:r.onProgress}),blockWriteConcurrency:p,reduceSingleLeafToSelf:w,cidVersion:s,onProgress:r.onProgress}),A=r.treeBuilder??CW({wrapWithDirectory:i,shardSplitThresholdBytes:o,cidVersion:s,onProgress:r.onProgress});for await(let B of A(K1(M(n,e),m),e))yield{cid:B.cid,path:B.path,unixfs:B.unixfs,size:B.size}}var jW={[xo.code]:xo},NW={[Vh]:yd},Qn=class{static async computeCid(e,r=Vh,n=xo.code){let i=NW[r];if(!i)throw new be("ComputeCidCodecNotSupported",`codec [${r}] not supported`);let o=jW[n];if(!o)throw new be("ComputeCidMultihashNotSupported",`multihash code [${n}] not supported`);let s=i.encode(e),a=await o.digest(s);return(await St.createV1(i.code,a)).toString()}static parseCid(e){let r=St.parse(e).toV1();if(!NW[r.code])throw new be("ParseCidCodecNotSupported",`codec [${r.code}] not supported`);if(!jW[r.multihash.code])throw new be("ParseCidMultihashNotSupported",`multihash code [${r.multihash.code}] not supported`);return r}static async computeDagPbCidFromBytes(e){let r=l2([{content:e}],new F1,{cidVersion:1}),n;for await(n of r);return n?n.cid.toString():""}static async computeDagPbCidFromStream(e){let r=l2([{content:e}],new F1,{cidVersion:1}),n;for await(n of r);return n?n.cid.toString():""}};E();var c8=or(JS(),1),Bp=or(roe(),1),mD=or(a8(),1);Bp.ECIES_CONFIG.isEphemeralKeyCompressed=!0;var Qc=class{static async aes256CtrEncrypt(e,r,n){let i=c8.createCipheriv("aes-256-ctr",e,r),o=new mD.Readable({read(){}});return n.on("data",s=>{let a=i.update(s);o.push(a)}),n.on("end",()=>{let s=i.final();o.push(s),o.push(null)}),n.on("error",s=>{o.emit("error",s)}),o}static async aes256CtrDecrypt(e,r,n){let i=c8.createDecipheriv("aes-256-ctr",e,r),o=new mD.Readable({read(){}});return n.on("data",s=>{let a=i.update(s);o.push(a)}),n.on("end",()=>{let s=i.final();o.push(s),o.push(null)}),n.on("error",s=>{o.emit("error",s)}),o}static async eciesSecp256k1Encrypt(e,r){let n=$.Buffer.from(e),i=$.Buffer.from(r),o=Bp.encrypt(n,i),s=0,a=Qc.isEphemeralKeyCompressed?33:65,d=o.subarray(s,a);s=a,a+=Bp.ECIES_CONFIG.symmetricNonceLength;let m=o.subarray(s,a);s=a,a+=16;let p=o.subarray(s,a);return{ciphertext:o.subarray(a),ephemeralPublicKey:d,initializationVector:m,messageAuthenticationCode:p}}static async eciesSecp256k1Decrypt(e){let r=$.Buffer.from(e.privateKey),n=$.Buffer.concat([e.ephemeralPublicKey,e.initializationVector,e.messageAuthenticationCode,e.ciphertext]);return Bp.decrypt(r,n)}static get isEphemeralKeyCompressed(){return Bp.ECIES_CONFIG.isEphemeralKeyCompressed}},yD=(r=>(r.Aes256Ctr="A256CTR",r.EciesSecp256k1="ECIES-ES256K",r))(yD||{});E();var Wd=class{constructor(e){this.jws=e}static async create(e,r=[]){let n={payload:et.bytesToBase64Url(e),signatures:[]},i=new Wd(n);for(let o of r)await i.addSignature(o);return i}async addSignature(e){let r={kid:e.keyId,alg:e.algorithm},n=JSON.stringify(r),i=et.stringToBase64Url(n),o=`${i}.${this.jws.payload}`,s=et.stringToBytes(o),a=await e.sign(s),d=et.bytesToBase64Url(a);this.jws.signatures.push({protected:i,signature:d})}getJws(){return this.jws}};E();E();E();var f8=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;function q_(){if(f8&&typeof f8.subtle=="object"&&f8.subtle!=null)return f8.subtle;throw new Error("crypto.subtle must be defined")}E();function Eqe(t){return t instanceof Uint8Array||t!=null&&typeof t=="object"&&t.constructor.name==="Uint8Array"}function $_(t,...e){if(!Eqe(t))throw new Error("Uint8Array expected");if(e.length>0&&!e.includes(t.length))throw new Error(`Uint8Array expected of length ${e}, not of length=${t.length}`)}var Gae={async encrypt(t,e,r,n){let i=q_(),o=await i.importKey("raw",t,e,!0,["encrypt"]),s=await i.encrypt(r,o,n);return new Uint8Array(s)},async decrypt(t,e,r,n){let i=q_(),o=await i.importKey("raw",t,e,!0,["decrypt"]),s=await i.decrypt(r,o,n);return new Uint8Array(s)}},ul={CBC:"AES-CBC",CTR:"AES-CTR",GCM:"AES-GCM"};function Sqe(t,e,r){if(t===ul.CBC)return{name:ul.CBC,iv:e};if(t===ul.CTR)return{name:ul.CTR,counter:e,length:64};if(t===ul.GCM)return r?{name:ul.GCM,iv:e,additionalData:r}:{name:ul.GCM,iv:e};throw new Error("unknown aes block mode")}function gD(t){return(e,r,n)=>{$_(e),$_(r);let i={name:t,length:e.length*8},o=Sqe(t,r,n);return{encrypt(s){return $_(s),Gae.encrypt(e,i,o,s)},decrypt(s){return $_(s),Gae.decrypt(e,i,o,s)}}}}var i1t=gD(ul.CBC),o1t=gD(ul.CTR),s1t=gD(ul.GCM);var Bb=(i=>(i.DataFormats="dataFormats",i.ProtocolContext="protocolContext",i.ProtocolPath="protocolPath",i.Schemas="schemas",i))(Bb||{}),ia=class{static async derivePrivateKey(e,r){let n=sn.privateJwkToBytes(e.derivedPrivateKey),i=e.derivationPath??[],o=await ia.derivePrivateKeyBytes(n,r),s=await sn.privateKeyToJwk(o);return{rootKeyId:e.rootKeyId,derivationScheme:e.derivationScheme,derivationPath:[...i,...r],derivedPrivateKey:s}}static async derivePublicKey(e,r){let n=await ia.derivePrivateKey(e,r);return await sn.getPublicJwk(n.derivedPrivateKey)}static async derivePrivateKeyBytes(e,r){ia.validateKeyDerivationPath(r);let n=e;for(let i of r){let o=et.stringToBytes(i);n=await ia.deriveKeyUsingHkdf({hashAlgorithm:"SHA-256",initialKeyMaterial:n,info:o,keyLengthInBytes:32})}return n}static async deriveKeyUsingHkdf(e){let{hashAlgorithm:r,initialKeyMaterial:n,info:i,keyLengthInBytes:o}=e,a=await q_().importKey("raw",n,{name:"HKDF"},!1,["deriveBits"]),d=await crypto.subtle.deriveBits({name:"HKDF",hash:r,salt:new Uint8Array(0),info:i},a,o*8);return new Uint8Array(d)}static validateKeyDerivationPath(e){if(e.includes(""))throw new be("HdKeyDerivationPathInvalid",`Invalid key derivation path: ${e}`)}};E();E();function L_(t,e){return t>e?1:t<e?-1:0}E();function U_(t){if(typeof t!="object")return!1;for(let e in t)return!1;return!0}function rn(t){Object.keys(t).forEach(e=>{t[e]===void 0?delete t[e]:typeof t[e]=="object"&&rn(t[e])})}var Ue=class{static validateJsonSchema(e){let r=e.descriptor.interface,n=e.descriptor.method,i=r+n;hd(i,e)}static getSigner(e){return e.authorization===void 0?void 0:zt.getSignerDid(e.authorization.signature.signatures[0])}static async getCid(e){let r={...e};return r.encodedData&&delete r.encodedData,await Qn.computeCid(r)}static async compareCid(e,r){let n=await Ue.getCid(e),i=await Ue.getCid(r);return L_(n,i)}static async createAuthorization(e){let{descriptor:r,signer:n,delegatedGrant:i,permissionGrantId:o,protocolRole:s}=e,a;i!==void 0&&(a=await Ue.getCid(i));let m={signature:await Ue.createSignature(r,n,{delegatedGrantId:a,permissionGrantId:o,protocolRole:s})};return i!==void 0&&(m.authorDelegatedGrant=i),m}static async createSignature(e,r,n){let o={descriptorCid:await Qn.computeCid(e),...n};rn(o);let s=et.objectToBytes(o);return(await Wd.create(s,[r])).getJws()}static async getNewestMessage(e){let r;for(let n of e)(r===void 0||await Ue.isNewer(n,r))&&(r=n);return r}static async getOldestMessage(e){let r;for(let n of e)(r===void 0||await Ue.isOlder(n,r))&&(r=n);return r}static async isNewer(e,r){return await Ue.compareMessageTimestamp(e,r)>0}static async isOlder(e,r){return await Ue.compareMessageTimestamp(e,r)<0}static isSignedByAuthorDelegate(e){return e.authorization?.authorDelegatedGrant!==void 0}static isSignedByOwnerDelegate(e){return e.authorization?.ownerDelegatedGrant!==void 0}static async compareMessageTimestamp(e,r){return e.descriptor.messageTimestamp>r.descriptor.messageTimestamp?1:e.descriptor.messageTimestamp<r.descriptor.messageTimestamp?-1:Ue.compareCid(e,r)}static async validateSignatureStructure(e,r,n="GenericSignaturePayload"){if(e.signatures.length!==1)throw new be("AuthenticationMoreThanOneSignatureNotSupported","expected no more than 1 signature for authorization purpose");let i=zt.decodePlainObjectPayload(e);hd(n,i);let{descriptorCid:o}=i,s=await Qn.computeCid(r);if(o!==s)throw new be("AuthenticateDescriptorCidMismatch",`provided descriptorCid ${o} does not match expected CID ${s}`);return i}};E();var Qi=class{static async parse(e){return new Qi(e)}constructor(e){this.id=e.recordId,this.grantor=Ue.getSigner(e),this.grantee=e.descriptor.recipient,this.dateGranted=e.descriptor.dateCreated;let r=e.encodedData,n=et.base64UrlToObject(r);this.dateExpires=n.dateExpires,this.delegated=n.delegated,this.description=n.description,this.requestId=n.requestId,this.scope=n.scope,this.conditions=n.conditions}};E();E();var F_=(i=>(i.CreatedAscending="createdAscending",i.CreatedDescending="createdDescending",i.PublishedAscending="publishedAscending",i.PublishedDescending="publishedDescending",i))(F_||{});E();var fi=class{static matchAnyFilter(e,r){if(r.length===0)return!0;for(let n of r)if(this.matchFilter(e,n))return!0;return!1}static matchFilter(e,r){for(let n in r){let i=r[n],o=e[n];if(o===void 0||!(Array.isArray(o)?this.matchAnyIndexValue(i,o):this.matchIndexValue(i,o)))return!1}return!0}static matchAnyIndexValue(e,r){for(let n of r)if(this.matchIndexValue(e,n))return!0;return!1}static matchIndexValue(e,r){if(typeof e=="object"){if(Array.isArray(e)){if(this.matchOneOf(e,r))return!0}else if(this.matchRange(e,r))return!0}else if(r===e)return!0;return!1}static matchOneOf(e,r){for(let n of e)if(r===n)return!0;return!1}static matchRange(e,r){return!(e.lt!==void 0&&r>=e.lt||e.lte!==void 0&&r>e.lte||e.gt!==void 0&&r<=e.gt||e.gte!==void 0&&r<e.gte)}static isEqualFilter(e){return typeof e!="object"}static isRangeFilter(e){return typeof e=="object"&&!Array.isArray(e)?"gt"in e||"lt"in e||"lte"in e||"gte"in e:!1}static isOneOfFilter(e){return!!(typeof e=="object"&&Array.isArray(e))}static convertRangeCriterion(e){let r;return e.to!==void 0&&e.from!==void 0?r={gte:e.from,lt:e.to}:e.to!==void 0?r={lt:e.to}:e.from!==void 0&&(r={gte:e.from}),r}static constructPrefixFilterAsRangeFilter(e){return{gte:e,lt:e+"\uFFFF"}}},u8=class{static reduceFilter(e){if(Object.keys(e).length<=1)return e;let{recordId:n,attester:i,parentId:o,recipient:s,contextId:a,author:d,protocolPath:m,schema:p,protocol:w,...P}=e;if(n!==void 0)return{recordId:n};if(i!==void 0)return{attester:i};if(o!==void 0)return{parentId:o};if(s!==void 0)return{recipient:s};if(a!==void 0)return{contextId:a};if(m!==void 0)return{protocolPath:m};if(p!==void 0)return{schema:p};if(w!==void 0)return{protocol:w};let M=Object.keys(P)[0],A={};return A[M]=e[M],A}};E();var jn=(i=>(i.Events="Events",i.Messages="Messages",i.Protocols="Protocols",i.Records="Records",i))(jn||{}),Nn=(w=>(w.Configure="Configure",w.Create="Create",w.Get="Get",w.Grant="Grant",w.Query="Query",w.Read="Read",w.Request="Request",w.Revoke="Revoke",w.Write="Write",w.Delete="Delete",w.Subscribe="Subscribe",w))(Nn||{});E();function Ta(t){let e;try{e=Jf(t)}catch{e=void 0}if(t!==e)throw new be("UrlProtocolNotNormalized",`Protocol URI ${t} must be normalized.`)}function Jf(t){return Wae(t)}function Xc(t){let e;try{e=Vd(t)}catch{e=void 0}if(t!==e)throw new be("UrlSchemaNotNormalized",`Schema URI ${t} must be normalized.`)}function Vd(t){return Wae(t)}function Wae(t){let e;/^[^:]+:(\/{2})?[^\/].*/.test(t)?e=t:e=`http://${t}`;try{let r=new URL(e);return r.search="",r.hash="",Mqe(r.href)}catch{throw new be("UrlProtocolNotNormalizable","Could not normalize protocol URI")}}function Mqe(t){return t.endsWith("/")?t.slice(0,-1):t}var pt=class{static isRecordsWrite(e){return e.descriptor.interface==="Records"&&e.descriptor.method==="Write"}static getAuthor(e){let r;return e.authorization.authorDelegatedGrant!==void 0?r=Ue.getSigner(e.authorization.authorDelegatedGrant):r=Ue.getSigner(e),r}static async decrypt(e,r,n){let{encryption:i}=e,o=i.keyEncryption.find(A=>A.rootKeyId===r.rootKeyId&&A.derivationScheme===r.derivationScheme);if(o===void 0)throw new be("RecordsDecryptNoMatchingKeyEncryptedFound",`Unable to find a symmetric key encrypted using key with ID '${r.rootKeyId}' and '${r.derivationScheme}' derivation scheme.`);let s=pt.constructKeyDerivationPath(o.derivationScheme,e),a=await pt.derivePrivateKey(r,s),d=et.base64UrlToBytes(o.encryptedKey),m=sn.publicJwkToBytes(o.ephemeralPublicKey),p=et.base64UrlToBytes(o.initializationVector),w=et.base64UrlToBytes(o.messageAuthenticationCode),P=await Qc.eciesSecp256k1Decrypt({ciphertext:d,ephemeralPublicKey:m,initializationVector:p,messageAuthenticationCode:w,privateKey:a}),S=et.base64UrlToBytes(i.initializationVector);return await Qc.aes256CtrDecrypt(P,S,n)}static constructKeyDerivationPath(e,r){let n=r.descriptor,i=r.contextId,o;return e==="dataFormats"?o=pt.constructKeyDerivationPathUsingDataFormatsScheme(n.schema,n.dataFormat):e==="protocolPath"?o=pt.constructKeyDerivationPathUsingProtocolPathScheme(n):e==="protocolContext"?o=pt.constructKeyDerivationPathUsingProtocolContextScheme(i):o=pt.constructKeyDerivationPathUsingSchemasScheme(n.schema),o}static constructKeyDerivationPathUsingDataFormatsScheme(e,r){return e!==void 0?["dataFormats",e,r]:["dataFormats",r]}static constructKeyDerivationPathUsingProtocolPathScheme(e){if(e.protocol===void 0)throw new be("RecordsProtocolPathDerivationSchemeMissingProtocol","Unable to construct key derivation path using `protocols` scheme because `protocol` is missing.");let r=e.protocolPath.split("/");return["protocolPath",e.protocol,...r]}static constructKeyDerivationPathUsingProtocolContextScheme(e){if(e===void 0)throw new be("RecordsProtocolContextDerivationSchemeMissingContextId","Unable to construct key derivation path using `protocolContext` scheme because `contextId` is missing.");let r=e.split("/")[0];return["protocolContext",r]}static constructKeyDerivationPathUsingSchemasScheme(e){if(e===void 0)throw new be("RecordsSchemasDerivationSchemeMissingSchema","Unable to construct key derivation path using `schemas` scheme because `schema` is missing.");return["schemas",e]}static async derivePrivateKey(e,r){if(e.derivedPrivateKey.crv!=="secp256k1")throw new be("RecordsDerivePrivateKeyUnSupportedCurve",`Curve ${e.derivedPrivateKey.crv} is not supported.`);let n=e.derivationPath??[];pt.validateAncestorKeyAndDescentKeyDerivationPathsMatch(n,r);let i=r.slice(n.length),o=sn.privateJwkToBytes(e.derivedPrivateKey);return await ia.derivePrivateKeyBytes(o,i)}static validateAncestorKeyAndDescentKeyDerivationPathsMatch(e,r){for(let n=0;n<e.length;n++){let i=e[n],o=r[n];if(i!==o)throw new be("RecordsInvalidAncestorKeyDerivationSegment",`Ancestor key derivation segment '${i}' mismatches against the descendant key derivation segment '${o}'.`)}}static getParentContextFromOfContextId(e){if(e===void 0)return;let r=e.lastIndexOf("/");return r===-1?"":e.substring(0,r)}static normalizeFilter(e){let r;e.protocol===void 0?r=void 0:r=Jf(e.protocol);let n;e.schema===void 0?n=void 0:n=Vd(e.schema);let i={...e,protocol:r,schema:n};return rn(i),i}static isStartsWithFilter(e){return typeof e=="object"&&"startsWith"in e&&typeof e.startsWith=="string"}static buildTagIndexes(e){let r={};for(let n in e){let i=e[n];r[`tag.${n}`]=i}return r}static convertTagsFilter(e){let r={};for(let n in e){let i=e[n];r[`tag.${n}`]=this.isStartsWithFilter(i)?fi.constructPrefixFilterAsRangeFilter(i.startsWith):i}return r}static convertFilter(e,r){let{tags:n,...i}=e,o={};n!==void 0&&(o={...this.convertTagsFilter(n)});let s={...i,...o},{dateCreated:a,datePublished:d,dateUpdated:m,contextId:p}=e,w=a?fi.convertRangeCriterion(a):void 0;w&&(s.dateCreated=w);let P=d?fi.convertRangeCriterion(d):void 0;P&&(s.published=!0,s.datePublished=P),s.published!==!0&&(r==="publishedAscending"||r==="publishedDescending")&&(s.published=!0);let S=m?fi.convertRangeCriterion(m):void 0;S&&(s.messageTimestamp=S,delete s.dateUpdated);let M=p?fi.constructPrefixFilterAsRangeFilter(p):void 0;return M&&(s.contextId=M),s}static async validateDelegatedGrantReferentialIntegrity(e,r,n){let i=r?.delegatedGrantId!==void 0,o=e.authorization?.authorDelegatedGrant!==void 0;if(i!==o)throw new be("RecordsAuthorDelegatedGrantAndIdExistenceMismatch",`delegatedGrantId in message (author) signature and authorDelegatedGrant must both exist or be undefined. delegatedGrantId in message (author) signature defined: ${i}, authorDelegatedGrant defined: ${o}`);if(o){let d=e.authorization.authorDelegatedGrant;if((await Qi.parse(d)).delegated!==!0)throw new be("RecordsAuthorDelegatedGrantNotADelegatedGrant","The owner delegated grant given is not a delegated grant.");let p=d.descriptor.recipient,w=Ue.getSigner(e);if(p!==w)throw new be("RecordsAuthorDelegatedGrantGrantedToAndOwnerSignatureMismatch",`grantedTo ${p} in author delegated grant must be the same as the signer ${w} of the message signature.`);let P=await Ue.getCid(d);if(P!==r.delegatedGrantId)throw new be("RecordsAuthorDelegatedGrantCidMismatch",`CID of the author delegated grant ${P} must be the same as the delegatedGrantId ${r.delegatedGrantId} in the message signature.`)}let s=n?.delegatedGrantId!==void 0,a=e.authorization?.ownerDelegatedGrant!==void 0;if(s!==a)throw new be("RecordsOwnerDelegatedGrantAndIdExistenceMismatch",`delegatedGrantId in owner signature and ownerDelegatedGrant must both exist or be undefined. delegatedGrantId in owner signature defined: ${s}, ownerDelegatedGrant defined: ${a}`);if(a){let d=e.authorization.ownerDelegatedGrant;if((await Qi.parse(d)).delegated!==!0)throw new be("RecordsOwnerDelegatedGrantNotADelegatedGrant","The owner delegated grant given is not a delegated grant.");let p=d.descriptor.recipient,w=zt.getSignerDid(e.authorization.ownerSignature.signatures[0]);if(p!==w)throw new be("RecordsOwnerDelegatedGrantGrantedToAndOwnerSignatureMismatch",`grantedTo ${p} in owner delegated grant must be the same as the signer ${w} of the owner signature.`);let P=await Ue.getCid(d);if(P!==n.delegatedGrantId)throw new be("RecordsOwnerDelegatedGrantCidMismatch",`CID of the owner delegated grant ${P} must be the same as the delegatedGrantId ${n.delegatedGrantId} in the owner signature.`)}}static shouldProtocolAuthorize(e){return e.protocolRole!==void 0}static filterIncludesPublishedRecords(e){return e.datePublished!==void 0||e.published!==!1}static filterIncludesUnpublishedRecords(e){return e.datePublished===void 0&&e.published===void 0?!0:e.published===!1}};E();E();var ic=class{static async performBaseValidation(e){let{incomingMessage:r,expectedGrantor:n,expectedGrantee:i,permissionGrant:o,messageStore:s}=e,a=r.descriptor;ic.verifyExpectedGrantorAndGrantee(n,i,o);let d=n;await ic.verifyGrantActive(d,a.messageTimestamp,o,s),await ic.verifyGrantScopeInterfaceAndMethod(a.interface,a.method,o)}static verifyExpectedGrantorAndGrantee(e,r,n){let i=n.grantee;if(r!==i)throw new be("GrantAuthorizationNotGrantedToAuthor",`Permission grant is granted to ${i}, but need to be granted to ${r}`);let o=n.grantor;if(e!==o)throw new be("GrantAuthorizationNotGrantedForTenant",`Permission grant is granted by ${o}, but need to be granted by ${e}`)}static async verifyGrantActive(e,r,n,i){if(r<n.dateGranted)throw new be("GrantAuthorizationGrantNotYetActive","The message has a timestamp before the associated permission grant becomes active");if(r>=n.dateExpires)throw new be("GrantAuthorizationGrantExpired","The message has timestamp after the expiry of the associated permission grant");let o={parentId:n.id,protocolPath:"grant/revocation",isLatestBaseState:!0},{messages:s}=await i.query(e,[o]),a=await Ue.getOldestMessage(s);if(a!==void 0&&a.descriptor.messageTimestamp<=r)throw new be("GrantAuthorizationGrantRevoked",`Permission grant with CID ${n.id} has been revoked`)}static async verifyGrantScopeInterfaceAndMethod(e,r,n){if(e!==n.scope.interface)throw new be("GrantAuthorizationInterfaceMismatch",`DWN Interface of incoming message is outside the scope of permission grant with ID ${n.id}`);if(r!==n.scope.method)throw new be("GrantAuthorizationMethodMismatch",`DWN Method of incoming message is outside the scope of permission grant with ID ${n.id}`)}};E();var ti=class{static async authorizeWrite(e){let{recordsWriteMessage:r,expectedGrantor:n,expectedGrantee:i,permissionGrant:o,messageStore:s}=e;await ic.performBaseValidation({incomingMessage:r,expectedGrantor:n,expectedGrantee:i,permissionGrant:o,messageStore:s}),ti.verifyScope(r,o.scope),ti.verifyConditions(r,o.conditions)}static async authorizeRead(e){let{recordsReadMessage:r,recordsWriteMessageToBeRead:n,expectedGrantor:i,expectedGrantee:o,permissionGrant:s,messageStore:a}=e;await ic.performBaseValidation({incomingMessage:r,expectedGrantor:i,expectedGrantee:o,permissionGrant:s,messageStore:a}),ti.verifyScope(n,s.scope)}static async authorizeQueryOrSubscribe(e){let{incomingMessage:r,expectedGrantor:n,expectedGrantee:i,permissionGrant:o,messageStore:s}=e;await ic.performBaseValidation({incomingMessage:r,expectedGrantor:n,expectedGrantee:i,permissionGrant:o,messageStore:s});let d=o.scope.protocol,m=r.descriptor.filter.protocol;if(d!==void 0&&m!==d)throw new be("RecordsGrantAuthorizationQueryOrSubscribeProtocolScopeMismatch",`Grant protocol scope ${d} does not match protocol in message ${m}`)}static async authorizeDelete(e){let{recordsDeleteMessage:r,recordsWriteToDelete:n,expectedGrantor:i,expectedGrantee:o,permissionGrant:s,messageStore:a}=e;await ic.performBaseValidation({incomingMessage:r,expectedGrantor:i,expectedGrantee:o,permissionGrant:s,messageStore:a});let m=s.scope.protocol,p=n.descriptor.protocol;if(m!==void 0&&p!==m)throw new be("RecordsGrantAuthorizationDeleteProtocolScopeMismatch",`Grant protocol scope ${m} does not match protocol in record to delete ${p}`)}static verifyScope(e,r){ti.isUnrestrictedScope(r)||(e.descriptor.protocol!==void 0?ti.verifyProtocolRecordScope(e,r):ti.verifyFlatRecordScope(e,r))}static verifyProtocolRecordScope(e,r){if(r.protocol===void 0)throw new be("RecordsGrantAuthorizationScopeMissingProtocol","Grant for protocol record must specify protocol in its scope");if(r.protocol!==e.descriptor.protocol)throw new be("RecordsGrantAuthorizationScopeProtocolMismatch","Grant scope specifies different protocol than what appears in the record");if(r.contextId!==void 0&&(e.contextId===void 0||!e.contextId.startsWith(r.contextId)))throw new be("RecordsGrantAuthorizationScopeContextIdMismatch","Grant scope specifies different contextId than what appears in the record");if(r.protocolPath!==void 0&&r.protocolPath!==e.descriptor.protocolPath)throw new be("RecordsGrantAuthorizationScopeProtocolPathMismatch","Grant scope specifies different protocolPath than what appears in the record")}static verifyFlatRecordScope(e,r){if(r.schema!==void 0&&r.schema!==e.descriptor.schema)throw new be("RecordsGrantAuthorizationScopeSchema",`Record does not have schema in permission grant scope with schema '${r.schema}'`)}static verifyConditions(e,r){if(r?.publication==="Required"&&!e.descriptor.published)throw new be("RecordsGrantAuthorizationConditionPublicationRequired","Permission grant requires message to be published");if(r?.publication==="Prohibited"&&e.descriptor.published)throw new be("RecordsGrantAuthorizationConditionPublicationProhibited","Permission grant prohibits message from being published")}static isUnrestrictedScope(e){return e.protocol===void 0&&e.schema===void 0}};E();E();var K=or(Vae(),1),PD={};function wl(t,e){Object.defineProperty(t.prototype,Symbol.toStringTag,{value:e,writable:!1,enumerable:!1,configurable:!0});for(let r of Object.getOwnPropertyNames(t)){let n=Object.getOwnPropertyDescriptor(t,r);n.configurable&&n.enumerable&&(n.enumerable=!1,Object.defineProperty(t,r,n))}for(let r of Object.getOwnPropertyNames(t.prototype)){let n=Object.getOwnPropertyDescriptor(t.prototype,r);n.configurable&&n.enumerable&&(n.enumerable=!1,Object.defineProperty(t.prototype,r,n))}In(e,t),In(`${e}.prototype`,t.prototype)}function In(t,e){let r=`%${t}%`;if(PD[r]!==void 0)throw new Error(`intrinsic ${t} already exists`);PD[r]=e}function Fe(t){return PD[t]}var Hae,Zae,mt="slot-epochNanoSeconds",dl="slot-timezone-identifier",Ge="slot-year",He="slot-month",Je="slot-day",Ot="slot-hour",Bt="slot-minute",Dt="slot-second",Ct="slot-millisecond",jt="slot-microsecond",Nt="slot-nanosecond",we="slot-calendar",Ice="slot-date-brand",kce="slot-year-month-brand",Oce="slot-month-day-brand",jo="slot-cached-instant",zr="slot-time-zone",Yo="slot-years",Xi="slot-months",Ls="slot-weeks",Qo="slot-days",Xo="slot-hours",es="slot-minutes",ts="slot-seconds",rs="slot-milliseconds",ns="slot-microseconds",is="slot-nanoseconds",Rn="slot-calendar-identifier",Bce=new WeakMap,AD=Symbol.for("@@Temporal__GetSlots");(Hae=globalThis)[AD]||(Hae[AD]=function(e){return Bce.get(e)});var rC=globalThis[AD],TD=Symbol.for("@@Temporal__CreateSlots");(Zae=globalThis)[TD]||(Zae[TD]=function(e){Bce.set(e,Object.create(null))});var _l=globalThis[TD];function zi(t,...e){if(!t||typeof t!="object")return!1;let r=rC(t);return!!r&&e.every(n=>n in r)}function D(t,e){let r=rC(t)?.[e];if(r===void 0)throw new TypeError(`Missing internal slot ${e}`);return r}function Ft(t,e,r){let n=rC(t);if(n===void 0)throw new TypeError("Missing slots for the given container");if(n[e])throw new TypeError(`${e} already has set`);n[e]=r}var Jae=/\.[-A-Za-z_]|\.\.[-A-Za-z._]{1,12}|\.[-A-Za-z_][-A-Za-z._]{0,12}|[A-Za-z_][-A-Za-z._]{0,13}/,tx=new RegExp("(?:"+[`(?:${Jae.source})(?:\\/(?:${Jae.source}))*`,"Etc/GMT(?:0|[-+]\\d{1,2})","GMT[-+]?0","EST5EDT","CST6CDT","MST7MDT","PST8PDT",/(?:[+\u2212-][0-2][0-9](?::?[0-5][0-9](?::?[0-5][0-9](?:[.,]\d{1,9})?)?)?)/.source].join("|")+")"),Dce=/(?:[+\u2212-]\d{6}|\d{4})/,y8=/(?:0[1-9]|1[0-2])/,RD=/(?:0[1-9]|[12]\d|3[01])/,Pqe=new RegExp(`(${Dce.source})(?:-(${y8.source})-(${RD.source})|(${y8.source})(${RD.source}))`),Cce=/(\d{2})(?::(\d{2})(?::(\d{2})(?:[.,](\d{1,9}))?)?|(\d{2})(?:(\d{2})(?:[.,](\d{1,9}))?)?)?/,jce=/([+\u2212-])([01][0-9]|2[0-3])(?::?([0-5][0-9])(?::?([0-5][0-9])(?:[.,](\d{1,9}))?)?)?/,Nce=new RegExp(`([zZ])|${jce.source}?`),zp=/\[(!)?([a-z_][a-z0-9_-]*)=([A-Za-z0-9]+(?:-[A-Za-z0-9]+)*)\]/g,Aqe=new RegExp([`^${Pqe.source}`,`(?:(?:T|\\s+)${Cce.source}(?:${Nce.source})?)?`,`(?:\\[!?(${tx.source})\\])?`,`((?:${zp.source})*)$`].join(""),"i"),Tqe=new RegExp([`^T?${Cce.source}`,`(?:${Nce.source})?`,`(?:\\[!?${tx.source}\\])?`,`((?:${zp.source})*)$`].join(""),"i"),Rqe=new RegExp(`^(${Dce.source})-?(${y8.source})(?:\\[!?${tx.source}\\])?((?:${zp.source})*)$`),Iqe=new RegExp(`^(?:--)?(${y8.source})-?(${RD.source})(?:\\[!?${tx.source}\\])?((?:${zp.source})*)$`),wD=/(\d+)(?:[.,](\d{1,9}))?/,kqe=new RegExp(`(?:${wD.source}H)?(?:${wD.source}M)?(?:${wD.source}S)?`),Oqe=new RegExp(`^([+\u2212-])?P${/(?:(\d+)Y)?(?:(\d+)M)?(?:(\d+)W)?(?:(\d+)D)?/.source}(?:T(?!$)${kqe.source})?$`,"i"),Bqe=Array.prototype.includes,qce=Array.prototype.push,$ce=globalThis.Intl.DateTimeFormat,Dqe=Math.min,Cqe=Math.max,hn=Math.abs,aa=Math.floor,Kb=Math.sign,ly=Math.trunc,O8=Number.isNaN,os=Number.isFinite,jqe=Number,rx=String,Nqe=Number.MAX_SAFE_INTEGER,qo=Object.create,qqe=Object.getOwnPropertyDescriptor,B8=Reflect.apply,$qe=Reflect.ownKeys,Un=K.default.BigInt(0),Xb=K.default.BigInt(1),pl=K.default.BigInt(60),Lce=K.default.BigInt(24),Tr=K.default.BigInt(1e3),cc=K.default.BigInt(1e6),ml=K.default.BigInt(1e9),Lqe=K.default.BigInt(-1),Uce=K.default.multiply(K.default.BigInt(3600),ml),Fce=K.default.multiply(pl,ml),gl=K.default.multiply(Uce,Lce),V_=K.default.multiply(K.default.BigInt(-86400),K.default.BigInt(1e17)),Gb=K.default.multiply(K.default.BigInt(86400),K.default.BigInt(1e17)),g8=-271821,v8=275760,Nb=K.default.multiply(K.default.BigInt(-388152),K.default.BigInt(1e13)),Uqe=K.default.multiply(gl,K.default.BigInt(3660)),zce=K.default.multiply(gl,K.default.BigInt(366)),Kce=K.default.multiply(gl,K.default.BigInt(14)),Fqe=["iso8601","hebrew","islamic","islamic-umalqura","islamic-tbla","islamic-civil","islamic-rgsa","islamicc","persian","ethiopic","ethioaa","coptic","chinese","dangi","roc","indian","buddhist","japanese","gregory"];function sc(t){return K.default.equal(t,Un)}function Br(t,e){let r=t[e];if(r!==void 0)return r}function nt(t,e,r){let n=arguments.length>2?r:[];return B8(t,e,n)}function pn(t){return typeof t=="object"&&t!==null||typeof t=="function"}function Wb(t){if(typeof t=="bigint")throw new TypeError("Cannot convert BigInt to number");return jqe(t)}function ui(t){let e=Wb(t);if(O8(e)||e===0)return 0;if(!os(e))return e;let r=aa(hn(e));return r===0?0:Kb(e)*r}function ka(t){if(typeof t!="number"||O8(t)||!os(t))return!1;let e=hn(t);return aa(e)===e}function as(t){if(typeof t=="symbol")throw new TypeError("Cannot convert a Symbol value to a String");return rx(t)}function br(t){let e=Wb(t);if(e===0)return 0;if(O8(e)||!os(e))throw new RangeError("invalid number value");let r=ly(e);return r===0?0:r}function Yae(t,e){let r=br(t);if(r<=0)throw e!==void 0?new RangeError(`property '${e}' cannot be a a number less than one`):new RangeError("Cannot convert a number less than one to a positive integer");return r}function Fi(t){let e=Wb(t);if(!os(e))throw new RangeError("infinity is out of range");if(!ka(e))throw new RangeError(`unsupported fractional value ${t}`);return e===0?0:e}function ri(t,e){return{quotient:K.default.divide(t,e),remainder:K.default.remainder(t,e)}}function b8(t){return K.default.lessThan(t,Un)}function Qae(t){return sc(t)?0:b8(t)?-1:1}function Yf(t){return K.default.lessThan(t,Un)?K.default.multiply(t,Lqe):t}var Xae=new Map([["year",br],["month",Yae],["monthCode",as],["day",Yae],["hour",br],["minute",br],["second",br],["millisecond",br],["microsecond",br],["nanosecond",br],["years",Fi],["months",Fi],["weeks",Fi],["days",Fi],["hours",Fi],["minutes",Fi],["seconds",Fi],["milliseconds",Fi],["microseconds",Fi],["nanoseconds",Fi],["era",as],["eraYear",ui],["offset",as]]),zqe=new Map([["hour",0],["minute",0],["second",0],["millisecond",0],["microsecond",0],["nanosecond",0]]),nx=[["years","year","date"],["months","month","date"],["weeks","week","date"],["days","day","date"],["hours","hour","time"],["minutes","minute","time"],["seconds","second","time"],["milliseconds","millisecond","time"],["microseconds","microsecond","time"],["nanoseconds","nanosecond","time"]],w8=new Map(nx.map(t=>[t[0],t[1]])),Kqe=new Map(nx.map(([t,e])=>[e,t])),ece=nx.map(([,t])=>t),tce=Array.from(w8.keys()).sort(),rce=new Map;function Gce(t){let e=rce.get(t);return e===void 0&&(e=new $ce("en-us",{timeZone:rx(t),hour12:!1,era:"short",year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric"}),rce.set(t,e)),e}function nce(t){if(t==null)throw new TypeError(`Expected object not ${t}`);return Object(t)}function qb(t,e,r,n){if(e==null)return;let i=$qe(e);for(let o of i)if(!r.some(s=>Object.is(s,o))&&Object.prototype.propertyIsEnumerable.call(e,o)){let s=e[o];if(n&&n.some(a=>Object.is(a,s)))continue;t[o]=s}}function Ii(t){return zi(t,mt)&&!zi(t,zr,we)}function oc(t){return zi(t,dl)}function qn(t){return zi(t,Rn)}function $n(t){return zi(t,Yo,Xi,Qo,Xo,es,ts,rs,ns,is)}function Jt(t){return zi(t,Ice)}function Ln(t){return zi(t,Ot,Bt,Dt,Ct,jt,Nt)&&!zi(t,Ge,He,Je)}function kt(t){return zi(t,Ge,He,Je,Ot,Bt,Dt,Ct,jt,Nt)}function Ar(t){return zi(t,kce)}function Ui(t){return zi(t,Oce)}function Qe(t){return zi(t,mt,zr,we)}function ew(t){if(zi(t,we)||zi(t,zr))throw new TypeError("with() does not support a calendar or timeZone property");if(Ln(t))throw new TypeError("with() does not accept Temporal.PlainTime, use withPlainTime() instead");if(t.calendar!==void 0)throw new TypeError("with() does not support a calendar property");if(t.timeZone!==void 0)throw new TypeError("with() does not support a timeZone property")}function Gqe(t){let{ianaName:e,offset:r,z:n}=function(o){if(new RegExp(`^${tx.source}$`,"i").test(o))return{ianaName:o};try{let s=xl(o);if(s.z||s.offset||s.ianaName)return s}catch{}throw new RangeError(`Invalid time zone: ${o}`)}(t);return e?hC(e):n?"UTC":G8(Np(r))}function nC(t,e){return e==="never"?"":iC(go(t),e)}function iC(t,e){return e==="never"||e==="auto"&&t==="iso8601"?"":`[${e==="critical"?"!":""}u-ca=${t}]`}function xl(t){let e=Aqe.exec(t);if(!e)throw new RangeError(`invalid ISO 8601 string: ${t}`);let r=e[1];if(r[0]==="\u2212"&&(r=`-${r.slice(1)}`),r==="-000000")throw new RangeError(`invalid ISO 8601 string: ${t}`);let n=ui(r),i=ui(e[2]||e[4]),o=ui(e[3]||e[5]),s=ui(e[6]),a=e[6]!==void 0,d=ui(e[7]||e[10]),m=ui(e[8]||e[11]);m===60&&(m=59);let p=(e[9]||e[12])+"000000000",w=ui(p.slice(0,3)),P=ui(p.slice(3,6)),S=ui(p.slice(6,9)),M,A=!1;if(e[13])M=void 0,A=!0;else if(e[14]&&e[15]){let k=e[14]==="-"||e[14]==="\u2212"?"-":"+",q=e[15]||"00",L=e[16]||"00",U=e[17]||"00",F=e[18]||"0";if(M=`${k}${q}:${L}`,+F){for(;F.endsWith("0");)F=F.slice(0,-1);M+=`:${U}.${F}`}else+U&&(M+=`:${U}`);M==="-00:00"&&(M="+00:00")}let B=e[19],I=e[20],C;for(let[,k,q,L]of I.matchAll(zp))if(q==="u-ca")C===void 0&&(C=L);else if(k==="!")throw new RangeError(`Unrecognized annotation: !${q}=${L}`);return yC(n,i,o,s,d,m,w,P,S),{year:n,month:i,day:o,hasTime:a,hour:s,minute:d,second:m,millisecond:w,microsecond:P,nanosecond:S,ianaName:B,offset:M,z:A,calendar:C}}function oC(t){let e=Rqe.exec(t),r,n,i,o;if(e){let s=e[1];if(s[0]==="\u2212"&&(s=`-${s.slice(1)}`),s==="-000000")throw new RangeError(`invalid ISO 8601 string: ${t}`);r=ui(s),n=ui(e[2]);let a=e[3];for(let[,d,m,p]of a.matchAll(zp))if(m==="u-ca")i===void 0&&(i=p);else if(d==="!")throw new RangeError(`Unrecognized annotation: !${m}=${p}`);if(i!==void 0&&i!=="iso8601")throw new RangeError("YYYY-MM format is only valid with iso8601 calendar")}else{let s;if({year:r,month:n,calendar:i,day:o,z:s}=xl(t),s)throw new RangeError("Z designator not supported for PlainYearMonth")}return{year:r,month:n,calendar:i,referenceISODay:o}}function sC(t){let e=Iqe.exec(t),r,n,i,o;if(e){r=ui(e[1]),n=ui(e[2]);let s=e[3];for(let[,a,d,m]of s.matchAll(zp))if(d==="u-ca")i===void 0&&(i=m);else if(a==="!")throw new RangeError(`Unrecognized annotation: !${d}=${m}`);if(i!==void 0&&i!=="iso8601")throw new RangeError("MM-DD format is only valid with iso8601 calendar")}else{let s;if({month:r,day:n,calendar:i,year:o,z:s}=xl(t),s)throw new RangeError("Z designator not supported for PlainMonthDay")}return{month:r,day:n,calendar:i,referenceISOYear:o}}function Wqe(t){let{year:e,month:r,day:n,hour:i,minute:o,second:s,millisecond:a,microsecond:d,nanosecond:m,offset:p,z:w}=function(A){let B=xl(A);if(!B.z&&!B.offset)throw new RangeError("Temporal.Instant requires a time zone offset");return B}(t);if(!w&&!p)throw new RangeError("Temporal.Instant requires a time zone offset");let P=w?0:Np(p);({year:e,month:r,day:n,hour:i,minute:o,second:s,millisecond:a,microsecond:d,nanosecond:m}=pC(e,r,n,i,o,s,a,d,m-P));let S=qp(e,r,n,i,o,s,a,d,m);if(S===null)throw new RangeError("DateTime outside of supported range");return S}function _8(t,e,r,n){let i=t,o=e,s=r;switch(n){case"reject":vl(i,o,s);break;case"constrain":({year:i,month:o,day:s}=cfe(i,o,s))}return{year:i,month:o,day:s}}function D8(t,e,r,n,i,o,s){let a=t,d=e,m=r,p=n,w=i,P=o;switch(s){case"reject":V8(a,d,m,p,w,P);break;case"constrain":({hour:a,minute:d,second:m,millisecond:p,microsecond:w,nanosecond:P}=function(M,A,B,I,C,k){let q=sa(M,0,23),L=sa(A,0,59),U=sa(B,0,59),F=sa(I,0,999),N=sa(C,0,999),G=sa(k,0,999);return{hour:q,minute:L,second:U,millisecond:F,microsecond:N,nanosecond:G}}(a,d,m,p,w,P))}return{hour:a,minute:d,second:m,millisecond:p,microsecond:w,nanosecond:P}}function Sy(t){if(!pn(t))return function(M){let A=Oqe.exec(M);if(!A)throw new RangeError(`invalid duration: ${M}`);if(A.slice(2).every(_=>_===void 0))throw new RangeError(`invalid duration: ${M}`);let B=A[1]==="-"||A[1]==="\u2212"?-1:1,I=A[2]===void 0?0:br(A[2])*B,C=A[3]===void 0?0:br(A[3])*B,k=A[4]===void 0?0:br(A[4])*B,q=A[5]===void 0?0:br(A[5])*B,L=A[6]===void 0?0:br(A[6])*B,U=A[7],F=A[8],N=A[9],G=A[10],x=A[11],c=0,u=0,y=0;if(U!==void 0){if(F??N??G??x)throw new RangeError("only the smallest unit can be fractional");y=3600*ui((U+"000000000").slice(0,9))*B}else if(c=F===void 0?0:br(F)*B,N!==void 0){if(G??x)throw new RangeError("only the smallest unit can be fractional");y=60*ui((N+"000000000").slice(0,9))*B}else u=G===void 0?0:br(G)*B,x!==void 0&&(y=ui((x+"000000000").slice(0,9))*B);let l=y%1e3,h=ly(y/1e3)%1e3,b=ly(y/1e6)%1e3;return u+=ly(y/1e9)%60,c+=ly(y/6e10),A8(I,C,k,q,L,c,u,b,h,l),{years:I,months:C,weeks:k,days:q,hours:L,minutes:c,seconds:u,milliseconds:b,microseconds:h,nanoseconds:l}}(as(t));if($n(t))return{years:D(t,Yo),months:D(t,Xi),weeks:D(t,Ls),days:D(t,Qo),hours:D(t,Xo),minutes:D(t,es),seconds:D(t,ts),milliseconds:D(t,rs),microseconds:D(t,ns),nanoseconds:D(t,is)};let e={years:0,months:0,weeks:0,days:0,hours:0,minutes:0,seconds:0,milliseconds:0,microseconds:0,nanoseconds:0},r=function(M){if(!pn(M))throw new TypeError("invalid duration-like");let A={years:void 0,months:void 0,weeks:void 0,days:void 0,hours:void 0,minutes:void 0,seconds:void 0,milliseconds:void 0,microseconds:void 0,nanoseconds:void 0},B=!1;for(let I of tce){let C=M[I];C!==void 0&&(B=!0,A[I]=Fi(C))}if(!B)throw new TypeError("invalid duration-like");return A}(t);for(let S of tce){let M=r[S];M!==void 0&&(e[S]=M)}let{years:n,months:i,weeks:o,days:s,hours:a,minutes:d,seconds:m,milliseconds:p,microseconds:w,nanoseconds:P}=e;return A8(n,i,o,s,a,d,m,p,w,P),{years:n,months:i,weeks:o,days:s,hours:a,minutes:d,seconds:m,milliseconds:p,microseconds:w,nanoseconds:P}}function ni(t){return t===void 0?"constrain":Lp(t,"overflow",["constrain","reject"],"constrain")}function Vb(t){return t===void 0?"compatible":Lp(t,"disambiguation",["compatible","earlier","later","reject"],"compatible")}function Xf(t,e){return Lp(t,"roundingMode",["ceil","floor","expand","trunc","halfCeil","halfFloor","halfExpand","halfTrunc","halfEven"],e)}function x8(t,e){return t===void 0?e:Lp(t,"offset",["prefer","use","ignore","reject"],e)}function ix(t){return Lp(t,"calendarName",["auto","always","never","critical"],"auto")}function tw(t){let e=t.roundingIncrement;if(e===void 0)return 1;if(e=Wb(e),!os(e))throw new RangeError("roundingIncrement must be finite");let r=ly(e);if(r<1||r>1e9)throw new RangeError(`roundingIncrement must be at least 1 and at most 1e9, not ${e}`);return r}function rw(t,e,r){let n=r?e:e-1;if(t>n)throw new RangeError(`roundingIncrement must be at least 1 and less than ${n}, not ${t}`);if(e%t!=0)throw new RangeError(`Rounding increment must divide evenly into ${e}`)}function ox(t){let e=t.fractionalSecondDigits;if(e===void 0)return"auto";if(typeof e!="number"){if(as(e)!=="auto")throw new RangeError(`fractionalSecondDigits must be 'auto' or 0 through 9, not ${e}`);return"auto"}let r=aa(e);if(!os(r)||r<0||r>9)throw new RangeError(`fractionalSecondDigits must be 'auto' or 0 through 9, not ${e}`);return r}function sx(t,e){switch(t){case"minute":return{precision:"minute",unit:"minute",increment:1};case"second":return{precision:0,unit:"second",increment:1};case"millisecond":return{precision:3,unit:"millisecond",increment:1};case"microsecond":return{precision:6,unit:"microsecond",increment:1};case"nanosecond":return{precision:9,unit:"nanosecond",increment:1}}switch(e){case"auto":return{precision:e,unit:"nanosecond",increment:1};case 0:return{precision:e,unit:"second",increment:1};case 1:case 2:case 3:return{precision:e,unit:"millisecond",increment:10**(3-e)};case 4:case 5:case 6:return{precision:e,unit:"microsecond",increment:10**(6-e)};case 7:case 8:case 9:return{precision:e,unit:"nanosecond",increment:10**(9-e)};default:throw new RangeError(`fractionalSecondDigits must be 'auto' or 0 through 9, not ${e}`)}}var yy=Symbol("~required~");function ca(t,e,r,n,i=[]){let o=[];for(let[,m,p]of nx)r!=="datetime"&&r!==p||o.push(m);o.push(...i);let s=n;s===yy?s=void 0:s!==void 0&&o.push(s);let a=[...o];for(let m of o){let p=Kqe.get(m);p!==void 0&&a.push(p)}let d=Lp(t,e,a,s);if(d===void 0&&n===yy)throw new RangeError(`${e} is required`);return w8.has(d)?w8.get(d):d}function d8(t){let e=t.relativeTo;if(e===void 0)return e;let r,n,i,o,s,a,d,m,p,w,P,S,M="option",A=!1;if(pn(e)){if(Qe(e)||Jt(e))return e;if(kt(e))return Zb(e);w=ux(e);let B=li(w,["day","hour","microsecond","millisecond","minute","month","monthCode","nanosecond","second","year"]);B.push("timeZone","offset");let I=Gt(e,B,[]),C=qo(null);C.overflow="constrain",{year:r,month:n,day:i,hour:o,minute:s,second:a,millisecond:d,microsecond:m,nanosecond:p}=ax(w,I,C),S=I.offset,S===void 0&&(M="wall"),P=I.timeZone,P!==void 0&&(P=No(P))}else{let B,I;if({year:r,month:n,day:i,hour:o,minute:s,second:a,millisecond:d,microsecond:m,nanosecond:p,calendar:w,ianaName:B,offset:S,z:I}=xl(as(e)),B)P=No(B),I?M="exact":S||(M="wall"),A=!0;else if(I)throw new RangeError("Z designator not supported for PlainDate relativeTo; either remove the Z or add a bracketed time zone");if(w||(w="iso8601"),!rh(w))throw new RangeError(`invalid calendar identifier ${w}`);w=bl(w)}return P===void 0?uc(r,n,i,w):po(S8(r,n,i,o,s,a,d,m,p,M,M==="option"?Np(S):0,P,"compatible","reject",A),P,w)}function ID(t,e,r,n,i,o,s,a,d,m){for(let[p,w]of[["years",t],["months",e],["weeks",r],["days",n],["hours",i],["minutes",o],["seconds",s],["milliseconds",a],["microseconds",d],["nanoseconds",m]])if(w!==0)return w8.get(p);return"nanosecond"}function gy(t,e){return ece.indexOf(t)>ece.indexOf(e)?e:t}function Gt(t,e,r,{emptySourceErrorMessage:n}={emptySourceErrorMessage:"no supported properties found"}){let i=qo(null),o=!1;e.sort();for(let s of e){let a=t[s];if(a!==void 0)o=!0,Xae.has(s)&&(a=Xae.get(s)(a)),i[s]=a;else if(r!=="partial"){if(Bqe.call(r,s))throw new TypeError(`required property '${s}' missing or undefined`);a=zqe.get(s),i[s]=a}}if(r==="partial"&&!o)throw new TypeError(n);return i}function E8(t,e="complete"){let r=["hour","microsecond","millisecond","minute","nanosecond","second"],n=Gt(t,r,"partial",{emptySourceErrorMessage:"invalid time-like"}),i={};for(let o of r){let s=qqe(n,o);s!==void 0?i[o]=s.value:e==="complete"&&(i[o]=0)}return i}function Wr(t,e){let r=t;if(pn(r)){if(Jt(r))return r;if(Qe(r)&&(ni(e),r=Ia(D(r,zr),D(r,jo),D(r,we))),kt(r))return ni(e),uc(D(r,Ge),D(r,He),D(r,Je),D(r,we));let d=ux(r);return eh(d,Gt(r,li(d,["day","month","monthCode","year"]),[]),e)}ni(e);let{year:n,month:i,day:o,calendar:s,z:a}=function(m){return xl(m)}(as(r));if(a)throw new RangeError("Z designator not supported for PlainDate");if(s||(s="iso8601"),!rh(s))throw new RangeError(`invalid calendar identifier ${s}`);return s=bl(s),uc(n,i,o,s)}function ax(t,e,r){let{hour:n,minute:i,second:o,millisecond:s,microsecond:a,nanosecond:d}=E8(e),m=ni(r),p=eh(t,e,r),w=D(p,Ge),P=D(p,He),S=D(p,Je);return{hour:n,minute:i,second:o,millisecond:s,microsecond:a,nanosecond:d}=D8(n,i,o,s,a,d,m),{year:w,month:P,day:S,hour:n,minute:i,second:o,millisecond:s,microsecond:a,nanosecond:d}}function dy(t,e){let r,n,i,o,s,a,d,m,p,w;if(pn(t)){if(kt(t))return t;if(Qe(t))return ni(e),Ia(D(t,zr),D(t,jo),D(t,we));if(Jt(t))return ni(e),oa(D(t,Ge),D(t,He),D(t,Je),0,0,0,0,0,0,D(t,we));w=ux(t);let P=Gt(t,li(w,["day","hour","microsecond","millisecond","minute","month","monthCode","nanosecond","second","year"]),[]);({year:r,month:n,day:i,hour:o,minute:s,second:a,millisecond:d,microsecond:m,nanosecond:p}=ax(w,P,e))}else{let P;if(ni(e),{year:r,month:n,day:i,hour:o,minute:s,second:a,millisecond:d,microsecond:m,nanosecond:p,calendar:w,z:P}=function(M){return xl(M)}(as(t)),P)throw new RangeError("Z designator not supported for PlainDateTime");if(yC(r,n,i,o,s,a,d,m,p),w||(w="iso8601"),!rh(w))throw new RangeError(`invalid calendar identifier ${w}`);w=bl(w)}return oa(r,n,i,o,s,a,d,m,p,w)}function $b(t){if($n(t))return t;let{years:e,months:r,weeks:n,days:i,hours:o,minutes:s,seconds:a,milliseconds:d,microseconds:m,nanoseconds:p}=Sy(t);return new(Fe("%Temporal.Duration%"))(e,r,n,i,o,s,a,d,m,p)}function Qf(t){if(Ii(t))return t;if(Qe(t))return new(Fe("%Temporal.Instant%"))(D(t,mt));let e=Wqe(as(t));return new(Fe("%Temporal.Instant%"))(e)}function ice(t,e){let r=t;if(pn(r)){if(Ui(r))return r;let a,d;if(zi(r,we))a=D(r,we),d=!1;else{let p=r.calendar;d=p===void 0,p===void 0&&(p="iso8601"),a=fa(p)}let m=Gt(r,li(a,["day","month","monthCode","year"]),[]);return d&&m.month!==void 0&&m.monthCode===void 0&&m.year===void 0&&(m.year=1972),Hb(a,m,e)}ni(e);let{month:n,day:i,referenceISOYear:o,calendar:s}=sC(as(r));if(s===void 0&&(s="iso8601"),!rh(s))throw new RangeError(`invalid calendar identifier ${s}`);return s=bl(s),o===void 0?(vl(1972,n,i),H_(n,i,s)):Hb(s,H_(n,i,s,o))}function Zd(t,e="constrain"){let r,n,i,o,s,a,d=t;if(pn(d)){if(Ln(d))return d;if(Qe(d)&&(d=Ia(D(d,zr),D(d,jo),D(d,we))),kt(d))return new(Fe("%Temporal.PlainTime%"))(D(d,Ot),D(d,Bt),D(d,Dt),D(d,Ct),D(d,jt),D(d,Nt));({hour:r,minute:n,second:i,millisecond:o,microsecond:s,nanosecond:a}=E8(d)),{hour:r,minute:n,second:i,millisecond:o,microsecond:s,nanosecond:a}=D8(r,n,i,o,s,a,e)}else({hour:r,minute:n,second:i,millisecond:o,microsecond:s,nanosecond:a}=function(p){let w=Tqe.exec(p),P,S,M,A,B,I,C;if(w){P=ui(w[1]),S=ui(w[2]||w[5]),M=ui(w[3]||w[6]),M===60&&(M=59);let k=(w[4]||w[7])+"000000000";A=ui(k.slice(0,3)),B=ui(k.slice(3,6)),I=ui(k.slice(6,9)),C=w[14];for(let[,q,L,U]of C.matchAll(zp))if(L!=="u-ca"&&q==="!")throw new RangeError(`Unrecognized annotation: !${L}=${U}`);if(w[8])throw new RangeError("Z designator not supported for PlainTime")}else{let k,q;if({hasTime:q,hour:P,minute:S,second:M,millisecond:A,microsecond:B,nanosecond:I,z:k}=xl(p),!q)throw new RangeError(`time is missing in string: ${p}`);if(k)throw new RangeError("Z designator not supported for PlainTime")}if(/[tT ][0-9][0-9]/.test(p))return{hour:P,minute:S,second:M,millisecond:A,microsecond:B,nanosecond:I};try{let{month:k,day:q}=sC(p);vl(1972,k,q)}catch{try{let{year:k,month:q}=oC(p);vl(k,q,1)}catch{return{hour:P,minute:S,second:M,millisecond:A,microsecond:B,nanosecond:I}}}throw new RangeError(`invalid ISO 8601 time-only string ${p}; may need a T prefix`)}(as(d))),V8(r,n,i,o,s,a);return new(Fe("%Temporal.PlainTime%"))(r,n,i,o,s,a)}function z_(t,e){if(pn(t)){if(Ar(t))return t;let s=ux(t);return by(s,Gt(t,li(s,["month","monthCode","year"]),[]),e)}ni(e);let{year:r,month:n,referenceISODay:i,calendar:o}=oC(as(t));if(o===void 0&&(o="iso8601"),!rh(o))throw new RangeError(`invalid calendar identifier ${o}`);return o=bl(o),i===void 0?(vl(r,n,1),Z_(r,n,o)):by(o,Z_(r,n,o,i))}function S8(t,e,r,n,i,o,s,a,d,m,p,w,P,S,M){let A=new(Fe("%Temporal.PlainDateTime%"))(t,e,r,n,i,o,s,a,d);if(m==="wall"||S==="ignore")return D(ss(w,A,P),mt);if(m==="exact"||S==="use"){let I=qp(t,e,r,n,i,o,s,a,d);if(I===null)throw new RangeError("ZonedDateTime outside of supported range");return K.default.subtract(I,K.default.BigInt(p))}let B=M8(w,A);for(let I of B){let C=eu(w,I),k=K.default.toNumber(Ra(K.default.BigInt(C),Fce,"halfExpand"));if(C===p||M&&k===p)return D(I,mt)}if(S==="reject"){let I=G8(p),C=oc(w)?D(w,dl):"time zone";throw new RangeError(`Offset ${I} is invalid for ${A.toString()} in ${C}`)}return D(efe(B,w,A,P),mt)}function K_(t,e){let r,n,i,o,s,a,d,m,p,w,P,S,M,A,B=!1,I="option";if(pn(t)){if(Qe(t))return t;S=ux(t);let k=li(S,["day","hour","microsecond","millisecond","minute","month","monthCode","nanosecond","second","year"]);k.push("timeZone","offset");let q=Gt(t,k,["timeZone"]);w=No(q.timeZone),P=q.offset,P===void 0&&(I="wall"),M=Vb(e),A=x8(e,"reject"),{year:r,month:n,day:i,hour:o,minute:s,second:a,millisecond:d,microsecond:m,nanosecond:p}=ax(S,q,e)}else{let k,q;if({year:r,month:n,day:i,hour:o,minute:s,second:a,millisecond:d,microsecond:m,nanosecond:p,ianaName:k,offset:P,z:q,calendar:S}=function(U){let F=xl(U);if(!F.ianaName)throw new RangeError("Temporal.ZonedDateTime requires a time zone ID in brackets");return F}(as(t)),w=No(k),q?I="exact":P||(I="wall"),S||(S="iso8601"),!rh(S))throw new RangeError(`invalid calendar identifier ${S}`);S=bl(S),B=!0,M=Vb(e),A=x8(e,"reject"),ni(e)}let C=0;return I==="option"&&(C=Np(P)),po(S8(r,n,i,o,s,a,d,m,p,I,C,w,M,A,B),w,S)}function Wce(t,e,r,n,i){vl(e,r,n),ffe(e,r,n),_l(t),Ft(t,Ge,e),Ft(t,He,r),Ft(t,Je,n),Ft(t,we,i),Ft(t,Ice,!0)}function uc(t,e,r,n="iso8601"){let i=Fe("%Temporal.PlainDate%"),o=qo(i.prototype);return Wce(o,t,e,r,n),o}function Vce(t,e,r,n,i,o,s,a,d,m,p){yC(e,r,n,i,o,s,a,d,m),ufe(e,r,n,i,o,s,a,d,m),_l(t),Ft(t,Ge,e),Ft(t,He,r),Ft(t,Je,n),Ft(t,Ot,i),Ft(t,Bt,o),Ft(t,Dt,s),Ft(t,Ct,a),Ft(t,jt,d),Ft(t,Nt,m),Ft(t,we,p)}function oa(t,e,r,n,i,o,s,a,d,m="iso8601"){let p=Fe("%Temporal.PlainDateTime%"),w=qo(p.prototype);return Vce(w,t,e,r,n,i,o,s,a,d,m),w}function Hce(t,e,r,n,i){vl(i,e,r),ffe(i,e,r),_l(t),Ft(t,He,e),Ft(t,Je,r),Ft(t,Ge,i),Ft(t,we,n),Ft(t,Oce,!0)}function H_(t,e,r="iso8601",n=1972){let i=Fe("%Temporal.PlainMonthDay%"),o=qo(i.prototype);return Hce(o,t,e,r,n),o}function Zce(t,e,r,n,i){vl(e,r,i),function(s,a){yo(s,g8,v8),s===g8?yo(a,4,12):s===v8&&yo(a,1,9)}(e,r),_l(t),Ft(t,Ge,e),Ft(t,He,r),Ft(t,Je,i),Ft(t,we,n),Ft(t,kce,!0)}function Z_(t,e,r="iso8601",n=1){let i=Fe("%Temporal.PlainYearMonth%"),o=qo(i.prototype);return Zce(o,t,e,r,n),o}function Jce(t,e,r,n){uy(e),_l(t),Ft(t,mt,e),Ft(t,zr,r),Ft(t,we,n);let i=new(Fe("%Temporal.Instant%"))(D(t,mt));Ft(t,jo,i)}function po(t,e,r="iso8601"){let n=Fe("%Temporal.ZonedDateTime%"),i=qo(n.prototype);return Jce(i,t,e,r),i}function li(t,e){if(typeof t=="string"){let i=new(Fe("%Temporal.Calendar%"))(t);return nt(Fe("%Temporal.Calendar.prototype.fields%"),i,[e])}let r=nt(Br(t,"fields"),t,[e]),n=[];for(let i of r){if(typeof i!="string")throw new TypeError("bad return from calendar.fields()");qce.call(n,i)}return n}function vy(t,e,r){if(typeof t=="string"){let i=new(Fe("%Temporal.Calendar%"))(t);return nt(Fe("%Temporal.Calendar.prototype.mergeFields%"),i,[e,r])}let n=nt(Br(t,"mergeFields"),t,[e,r]);if(!pn(n))throw new TypeError("bad return from calendar.mergeFields()");return n}function mo(t,e,r,n,i){let o=i;if(typeof t=="string"){let a=new(Fe("%Temporal.Calendar%"))(t);return nt(Fe("%Temporal.Calendar.prototype.dateAdd%"),a,[e,r,n])}o===void 0&&(o=Br(t,"dateAdd"));let s=B8(o,t,[e,r,n]);if(!Jt(s))throw new TypeError("invalid result");return s}function jp(t,e,r,n,i){let o=i;if(typeof t=="string"){let a=new(Fe("%Temporal.Calendar%"))(t);return nt(Fe("%Temporal.Calendar.prototype.dateUntil%"),a,[e,r,n])}o===void 0&&(o=Br(t,"dateUntil"));let s=B8(o,t,[e,r,n]);if(!$n(s))throw new TypeError("invalid result");return s}function C8(t,e){if(typeof t=="string"){let n=new(Fe("%Temporal.Calendar%"))(t);return nt(Fe("%Temporal.Calendar.prototype.year%"),n,[e])}let r=nt(Br(t,"year"),t,[e]);if(typeof r!="number")throw new TypeError("calendar year result must be an integer");if(!ka(r))throw new RangeError("calendar year result must be an integer");return r}function j8(t,e){if(typeof t=="string"){let n=new(Fe("%Temporal.Calendar%"))(t);return nt(Fe("%Temporal.Calendar.prototype.month%"),n,[e])}let r=nt(Br(t,"month"),t,[e]);if(typeof r!="number")throw new TypeError("calendar month result must be a positive integer");if(!ka(r)||r<1)throw new RangeError("calendar month result must be a positive integer");return r}function cx(t,e){if(typeof t=="string"){let n=new(Fe("%Temporal.Calendar%"))(t);return nt(Fe("%Temporal.Calendar.prototype.monthCode%"),n,[e])}let r=nt(Br(t,"monthCode"),t,[e]);if(typeof r!="string")throw new TypeError("calendar monthCode result must be a string");return r}function fx(t,e){if(typeof t=="string"){let n=new(Fe("%Temporal.Calendar%"))(t);return nt(Fe("%Temporal.Calendar.prototype.day%"),n,[e])}let r=nt(Br(t,"day"),t,[e]);if(typeof r!="number")throw new TypeError("calendar day result must be a positive integer");if(!ka(r)||r<1)throw new RangeError("calendar day result must be a positive integer");return r}function N8(t,e){if(typeof t=="string"){let n=new(Fe("%Temporal.Calendar%"))(t);return nt(Fe("%Temporal.Calendar.prototype.era%"),n,[e])}let r=nt(Br(t,"era"),t,[e]);if(r===void 0)return r;if(typeof r!="string")throw new TypeError("calendar era result must be a string or undefined");return r}function q8(t,e){if(typeof t=="string"){let n=new(Fe("%Temporal.Calendar%"))(t);return nt(Fe("%Temporal.Calendar.prototype.eraYear%"),n,[e])}let r=nt(Br(t,"eraYear"),t,[e]);if(r===void 0)return r;if(typeof r!="number")throw new TypeError("calendar eraYear result must be an integer or undefined");if(!ka(r))throw new RangeError("calendar eraYear result must be an integer or undefined");return r}function aC(t,e){if(typeof t=="string"){let n=new(Fe("%Temporal.Calendar%"))(t);return nt(Fe("%Temporal.Calendar.prototype.dayOfWeek%"),n,[e])}let r=nt(Br(t,"dayOfWeek"),t,[e]);if(typeof r!="number")throw new TypeError("calendar dayOfWeek result must be a positive integer");if(!ka(r)||r<1)throw new RangeError("calendar dayOfWeek result must be a positive integer");return r}function cC(t,e){if(typeof t=="string"){let n=new(Fe("%Temporal.Calendar%"))(t);return nt(Fe("%Temporal.Calendar.prototype.dayOfYear%"),n,[e])}let r=nt(Br(t,"dayOfYear"),t,[e]);if(typeof r!="number")throw new TypeError("calendar dayOfYear result must be a positive integer");if(!ka(r)||r<1)throw new RangeError("calendar dayOfYear result must be a positive integer");return r}function fC(t,e){if(typeof t=="string"){let n=new(Fe("%Temporal.Calendar%"))(t);return nt(Fe("%Temporal.Calendar.prototype.weekOfYear%"),n,[e])}let r=nt(Br(t,"weekOfYear"),t,[e]);if(typeof r!="number")throw new TypeError("calendar weekOfYear result must be a positive integer");if(!ka(r)||r<1)throw new RangeError("calendar weekOfYear result must be a positive integer");return r}function uC(t,e){if(typeof t=="string"){let n=new(Fe("%Temporal.Calendar%"))(t);return nt(Fe("%Temporal.Calendar.prototype.yearOfWeek%"),n,[e])}let r=nt(Br(t,"yearOfWeek"),t,[e]);if(typeof r!="number")throw new TypeError("calendar yearOfWeek result must be an integer");if(!ka(r))throw new RangeError("calendar yearOfWeek result must be an integer");return r}function lC(t,e){if(typeof t=="string"){let n=new(Fe("%Temporal.Calendar%"))(t);return nt(Fe("%Temporal.Calendar.prototype.daysInWeek%"),n,[e])}let r=nt(Br(t,"daysInWeek"),t,[e]);if(typeof r!="number")throw new TypeError("calendar daysInWeek result must be a positive integer");if(!ka(r)||r<1)throw new RangeError("calendar daysInWeek result must be a positive integer");return r}function $8(t,e){if(typeof t=="string"){let n=new(Fe("%Temporal.Calendar%"))(t);return nt(Fe("%Temporal.Calendar.prototype.daysInMonth%"),n,[e])}let r=nt(Br(t,"daysInMonth"),t,[e]);if(typeof r!="number")throw new TypeError("calendar daysInMonth result must be a positive integer");if(!ka(r)||r<1)throw new RangeError("calendar daysInMonth result must be a positive integer");return r}function L8(t,e){if(typeof t=="string"){let n=new(Fe("%Temporal.Calendar%"))(t);return nt(Fe("%Temporal.Calendar.prototype.daysInYear%"),n,[e])}let r=nt(Br(t,"daysInYear"),t,[e]);if(typeof r!="number")throw new TypeError("calendar daysInYear result must be a positive integer");if(!ka(r)||r<1)throw new RangeError("calendar daysInYear result must be a positive integer");return r}function U8(t,e){if(typeof t=="string"){let n=new(Fe("%Temporal.Calendar%"))(t);return nt(Fe("%Temporal.Calendar.prototype.monthsInYear%"),n,[e])}let r=nt(Br(t,"monthsInYear"),t,[e]);if(typeof r!="number")throw new TypeError("calendar monthsInYear result must be a positive integer");if(!ka(r)||r<1)throw new RangeError("calendar monthsInYear result must be a positive integer");return r}function F8(t,e){if(typeof t=="string"){let n=new(Fe("%Temporal.Calendar%"))(t);return nt(Fe("%Temporal.Calendar.prototype.inLeapYear%"),n,[e])}let r=nt(Br(t,"inLeapYear"),t,[e]);if(typeof r!="boolean")throw new TypeError("calendar inLeapYear result must be a boolean");return r}function fa(t){if(pn(t)){if(zi(t,we))return D(t,we);if(!function(i){return!!qn(i)||"dateAdd"in i&&"dateFromFields"in i&&"dateUntil"in i&&"day"in i&&"dayOfWeek"in i&&"dayOfYear"in i&&"daysInMonth"in i&&"daysInWeek"in i&&"daysInYear"in i&&"fields"in i&&"id"in i&&"inLeapYear"in i&&"mergeFields"in i&&"month"in i&&"monthCode"in i&&"monthDayFromFields"in i&&"monthsInYear"in i&&"weekOfYear"in i&&"year"in i&&"yearMonthFromFields"in i&&"yearOfWeek"in i}(t))throw new TypeError("expected a Temporal.Calendar or object implementing the Temporal.Calendar protocol");return t}let e=as(t);if(rh(e))return bl(e);let r;try{({calendar:r}=xl(e))}catch{try{({calendar:r}=oC(e))}catch{({calendar:r}=sC(e))}}if(r||(r="iso8601"),!rh(r))throw new RangeError(`invalid calendar identifier ${r}`);return bl(r)}function ux(t){if(zi(t,we))return D(t,we);let{calendar:e}=t;return e===void 0?"iso8601":fa(e)}function go(t){if(typeof t=="string")return t;let e=t.id;if(typeof e!="string")throw new TypeError("calendar.id should be a string");return e}function nw(t){return pn(t)?t:new(Fe("%Temporal.Calendar%"))(t)}function lx(t,e){return t===e?!0:go(t)===go(e)}function z8(t,e,r){if(t===e)return;let n=go(t),i=go(e);if(n!==i)throw new RangeError(`cannot ${r} of ${n} and ${i} calendars`)}function Yce(t,e){if(t===e)return e;let r=go(t),n=go(e);if(r===n||r==="iso8601")return e;if(n==="iso8601")return t;throw new RangeError("irreconcilable calendars")}function eh(t,e,r,n){if(typeof t=="string"){let o=new(Fe("%Temporal.Calendar%"))(t);return nt(Fe("%Temporal.Calendar.prototype.dateFromFields%"),o,[e,r])}let i=nt(n??Br(t,"dateFromFields"),t,[e,r]);if(!Jt(i))throw new TypeError("invalid result");return i}function by(t,e,r){if(typeof t=="string"){let i=new(Fe("%Temporal.Calendar%"))(t);return nt(Fe("%Temporal.Calendar.prototype.yearMonthFromFields%"),i,[e,r])}let n=nt(Br(t,"yearMonthFromFields"),t,[e,r]);if(!Ar(n))throw new TypeError("invalid result");return n}function Hb(t,e,r){if(typeof t=="string"){let i=new(Fe("%Temporal.Calendar%"))(t);return nt(Fe("%Temporal.Calendar.prototype.monthDayFromFields%"),i,[e,r])}let n=nt(Br(t,"monthDayFromFields"),t,[e,r]);if(!Ui(n))throw new TypeError("invalid result");return n}function No(t){if(pn(t)){if(Qe(t))return D(t,zr);if(!function(r){return!!oc(r)||"getOffsetNanosecondsFor"in r&&"getPossibleInstantsFor"in r&&"id"in r}(t))throw new TypeError("expected a Temporal.TimeZone or object implementing the Temporal.TimeZone protocol");return t}return Gqe(as(t))}function J_(t){if(typeof t=="string")return t;let e=t.id;if(typeof e!="string")throw new TypeError("timeZone.id should be a string");return e}function Qce(t){return pn(t)?t:new(Fe("%Temporal.TimeZone%"))(t)}function Xce(t,e){return t===e?!0:J_(t)===J_(e)}function Zb(t){return uc(D(t,Ge),D(t,He),D(t,Je),D(t,we))}function dC(t){return new(Fe("%Temporal.PlainTime%"))(D(t,Ot),D(t,Bt),D(t,Dt),D(t,Ct),D(t,jt),D(t,Nt))}function eu(t,e,r){if(typeof t=="string"){let i=new(Fe("%Temporal.TimeZone%"))(t);return nt(Fe("%Temporal.TimeZone.prototype.getOffsetNanosecondsFor%"),i,[e])}let n=nt(r??Br(t,"getOffsetNanosecondsFor"),t,[e]);if(typeof n!="number")throw new TypeError("bad return from getOffsetNanosecondsFor");if(!ka(n)||hn(n)>=864e11)throw new RangeError("out-of-range return from getOffsetNanosecondsFor");return n}function kD(t,e){return G8(eu(t,e))}function Ia(t,e,r){let n=D(e,mt),i=eu(t,e),{year:o,month:s,day:a,hour:d,minute:m,second:p,millisecond:w,microsecond:P,nanosecond:S}=rfe(n);return{year:o,month:s,day:a,hour:d,minute:m,second:p,millisecond:w,microsecond:P,nanosecond:S}=pC(o,s,a,d,m,p,w,P,S+i),oa(o,s,a,d,m,p,w,P,S,r)}function ss(t,e,r){return efe(M8(t,e),t,e,r)}function efe(t,e,r,n){let i=Fe("%Temporal.Instant%"),o=t.length;if(o===1)return t[0];if(o)switch(n){case"compatible":case"earlier":return t[0];case"later":return t[o-1];case"reject":throw new RangeError("multiple instants found")}let s=D(r,Ge),a=D(r,He),d=D(r,Je),m=D(r,Ot),p=D(r,Bt),w=D(r,Dt),P=D(r,Ct),S=D(r,jt),M=D(r,Nt),A=qp(s,a,d,m,p,w,P,S,M);if(A===null)throw new RangeError("DateTime outside of supported range");let B=new i(K.default.subtract(A,gl)),I=new i(K.default.add(A,gl)),C=eu(e,B),k=eu(e,I)-C;switch(n){case"earlier":{let q=D(r,we),L=Fe("%Temporal.PlainDateTime%"),U=CD(s,a,d,m,p,w,P,S,M,q,0,0,0,0,0,0,0,0,0,-k,void 0);return M8(e,new L(U.year,U.month,U.day,U.hour,U.minute,U.second,U.millisecond,U.microsecond,U.nanosecond,q))[0]}case"compatible":case"later":{let q=D(r,we),L=Fe("%Temporal.PlainDateTime%"),U=CD(s,a,d,m,p,w,P,S,M,q,0,0,0,0,0,0,0,0,0,k,void 0),F=M8(e,new L(U.year,U.month,U.day,U.hour,U.minute,U.second,U.millisecond,U.microsecond,U.nanosecond,q));return F[F.length-1]}case"reject":throw new RangeError("no such instant found")}}function M8(t,e,r){if(typeof t=="string"){let o=new(Fe("%Temporal.TimeZone%"))(t);return nt(Fe("%Temporal.TimeZone.prototype.getPossibleInstantsFor%"),o,[e])}let n=nt(r??Br(t,"getPossibleInstantsFor"),t,[e]),i=[];for(let o of n){if(!Ii(o))throw new TypeError("bad return from getPossibleInstantsFor");qce.call(i,o)}return i}function My(t){let e;return t<0||t>9999?e=(t<0?"-":"+")+`000000${hn(t)}`.slice(-6):e=`0000${t}`.slice(-4),e}function _n(t){return`00${t}`.slice(-2)}function K8(t,e,r,n,i){if(i==="minute")return"";let o=`:${_n(t)}`,s,a=1e6*e+1e3*r+n;if(i==="auto"){if(a===0)return o;for(s=`${a}`.padStart(9,"0");s[s.length-1]==="0";)s=s.slice(0,-1)}else{if(i===0)return o;s=`${a}`.padStart(9,"0").slice(0,i)}return`${o}.${s}`}function oce(t,e,r){let n=e;n===void 0&&(n="UTC");let i=Ia(n,t,"iso8601"),o=My(D(i,Ge)),s=_n(D(i,He)),a=_n(D(i,Je)),d=_n(D(i,Ot)),m=_n(D(i,Bt)),p=K8(D(i,Dt),D(i,Ct),D(i,jt),D(i,Nt),r),w="Z";return e!==void 0&&(w=tfe(eu(n,t))),`${o}-${s}-${a}T${d}:${m}${p}${w}`}function _D(t,e="auto",r){function n(G){return G<=Nqe?G.toString(10):K.default.BigInt(G).toString(10)}let i=D(t,Yo),o=D(t,Xi),s=D(t,Ls),a=D(t,Qo),d=D(t,Xo),m=D(t,es),p=D(t,ts),w=D(t,rs),P=D(t,ns),S=D(t,is),M=yl(i,o,s,a,d,m,p,w,P,S);if(r){let{unit:G,increment:x,roundingMode:c}=r;({seconds:p,milliseconds:w,microseconds:P,nanoseconds:S}=th(0,0,0,0,0,0,p,w,P,S,x,G,c))}let A=[];i&&A.push(`${n(hn(i))}Y`),o&&A.push(`${n(hn(o))}M`),s&&A.push(`${n(hn(s))}W`),a&&A.push(`${n(hn(a))}D`);let B=[];d&&B.push(`${n(hn(d))}H`),m&&B.push(`${n(hn(m))}M`);let I=[],C,k,q,L,U=Jb(0,0,0,p,w,P,S,0);({quotient:U,remainder:C}=ri(U,Tr)),{quotient:U,remainder:k}=ri(U,Tr),{quotient:L,remainder:q}=ri(U,Tr);let F=1e6*hn(K.default.toNumber(q))+1e3*hn(K.default.toNumber(k))+hn(K.default.toNumber(C)),N;if(e==="auto"){if(F!==0)for(N=`${F}`.padStart(9,"0");N[N.length-1]==="0";)N=N.slice(0,-1)}else e!==0&&(N=`${F}`.padStart(9,"0").slice(0,e));return N&&I.unshift(".",N),K.default.equal(L,Un)&&!I.length&&e==="auto"||I.unshift(Yf(L).toString()),I.length&&B.push(`${I.join("")}S`),B.length&&B.unshift("T"),A.length||B.length?`${M<0?"-":""}P${A.join("")}${B.join("")}`:"PT0S"}function sce(t,e="auto"){return`${My(D(t,Ge))}-${_n(D(t,He))}-${_n(D(t,Je))}${nC(D(t,we),e)}`}function ace(t,e,r="auto",n){let i=D(t,Ge),o=D(t,He),s=D(t,Je),a=D(t,Ot),d=D(t,Bt),m=D(t,Dt),p=D(t,Ct),w=D(t,jt),P=D(t,Nt);if(n){let{unit:S,increment:M,roundingMode:A}=n;({year:i,month:o,day:s,hour:a,minute:d,second:m,millisecond:p,microsecond:w,nanosecond:P}=wC(i,o,s,a,d,m,p,w,P,M,S,A))}return`${My(i)}-${_n(o)}-${_n(s)}T${_n(a)}:${_n(d)}${K8(m,p,w,P,e)}${nC(D(t,we),r)}`}function cce(t,e="auto"){let r=`${_n(D(t,He))}-${_n(D(t,Je))}`,n=go(D(t,we));(e==="always"||e==="critical"||n!=="iso8601")&&(r=`${My(D(t,Ge))}-${r}`);let i=iC(n,e);return i&&(r+=i),r}function fce(t,e="auto"){let r=`${My(D(t,Ge))}-${_n(D(t,He))}`,n=go(D(t,we));(e==="always"||e==="critical"||n!=="iso8601")&&(r+=`-${_n(D(t,Je))}`);let i=iC(n,e);return i&&(r+=i),r}function uce(t,e,r="auto",n="auto",i="auto",o){let s=D(t,jo);if(o){let{unit:p,increment:w,roundingMode:P}=o,S=T8(D(t,mt),w,p,P);s=new(Fe("%Temporal.Instant%"))(S)}let a=D(t,zr),d=Ia(a,s,"iso8601"),m=`${My(D(d,Ge))}-${_n(D(d,He))}-${_n(D(d,Je))}T${_n(D(d,Ot))}:${_n(D(d,Bt))}${K8(D(d,Dt),D(d,Ct),D(d,jt),D(d,Nt),e)}`;return i!=="never"&&(m+=tfe(eu(a,s))),n!=="never"&&(m+=`[${n==="critical"?"!":""}${J_(a)}]`),m+=nC(D(t,we),r),m}function jb(t){return gfe.test(rx(t))}function Np(t){let e=gfe.exec(rx(t));if(!e)throw new RangeError(`invalid time zone offset: ${t}`);return(e[1]==="-"||e[1]==="\u2212"?-1:1)*(1e9*(60*(60*+e[2]+ +(e[3]||0))+ +(e[4]||0))+ +((e[5]||0)+"000000000").slice(0,9))}function hC(t){return jb(t)?G8(Np(t)):Gce(rx(t)).resolvedOptions().timeZone}function Jd(t,e){let{year:r,month:n,day:i,hour:o,minute:s,second:a,millisecond:d,microsecond:m,nanosecond:p}=nfe(t,e),w=r%400,P=(r-w)/400,S=K.default.multiply(K.default.BigInt(146097),gl),M=qp(w,n,i,o,s,a,d,m,p),A=K.default.add(M,K.default.multiply(S,K.default.BigInt(P)));return K.default.toNumber(K.default.subtract(A,e))}function G8(t){let e=t<0?"-":"+",r=hn(t),n=r%1e9,i=aa(r/1e9)%60,o=aa(r/6e10)%60,s=_n(aa(r/36e11)),a=_n(o),d=_n(i),m="";if(n){let p=`${n}`.padStart(9,"0");for(;p[p.length-1]==="0";)p=p.slice(0,-1);m=`:${d}.${p}`}else i&&(m=`:${d}`);return`${e}${s}:${a}${m}`}function tfe(t){let e=K.default.toNumber(Ra(K.default.BigInt(t),Fce,"halfExpand")),r=e<0?"-":"+";e=hn(e);let n=e/6e10%60;return`${r}${_n(aa(e/36e11))}:${_n(n)}`}function qp(t,e,r,n,i,o,s,a,d){let m=new Date;m.setUTCHours(n,i,o,s),m.setUTCFullYear(t,e-1,r);let p=m.getTime();if(O8(p))return null;let w=K.default.multiply(K.default.BigInt(p),cc);return w=K.default.add(w,K.default.multiply(K.default.BigInt(a),Tr)),w=K.default.add(w,K.default.BigInt(d)),K.default.lessThan(w,V_)||K.default.greaterThan(w,Gb)?null:w}function rfe(t){let{quotient:e,remainder:r}=ri(t,cc),n=K.default.toNumber(e),i=K.default.toNumber(r);i<0&&(i+=1e6,n-=1);let o=aa(i/1e3)%1e3,s=i%1e3,a=new Date(n);return{epochMilliseconds:n,year:a.getUTCFullYear(),month:a.getUTCMonth()+1,day:a.getUTCDate(),hour:a.getUTCHours(),minute:a.getUTCMinutes(),second:a.getUTCSeconds(),millisecond:a.getUTCMilliseconds(),microsecond:o,nanosecond:s}}function nfe(t,e){let{epochMilliseconds:r,millisecond:n,microsecond:i,nanosecond:o}=rfe(e),{year:s,month:a,day:d,hour:m,minute:p,second:w}=function(S,M){let A=Gce(S).format(new Date(M));return function(I){let C=I.split(/[^\w]+/);if(C.length!==7)throw new RangeError(`expected 7 parts in "${I}`);let k=+C[0],q=+C[1],L=+C[2],U=C[3].toUpperCase();if(U==="B"||U==="BC")L=1-L;else if(U!=="A"&&U!=="AD")throw new RangeError(`Unknown era ${U} in "${I}`);let F=+C[4];F===24&&(F=0);let N=+C[5],G=+C[6];if(!(os(L)&&os(k)&&os(q)&&os(F)&&os(N)&&os(G)))throw new RangeError(`Invalid number in "${I}`);return{year:L,month:k,day:q,hour:F,minute:N,second:G}}(A)}(t,r);return pC(s,a,d,m,p,w,n,i,o)}function lce(t,e){return K.default.lessThan(t,e)?e:t}function ife(){return K.default.add(xC(),Uqe)}function ofe(t,e){if(K.default.lessThan(e,Nb))return ofe(t,Nb);let r=K.default.add(e,zce),n=lce(ife(),r),i=lce(Nb,e),o=Jd(t,i),s=i,a=o;for(;o===a&&K.default.lessThan(K.default.BigInt(i),n);){if(s=K.default.add(i,Kce),K.default.greaterThan(s,Gb))return null;a=Jd(t,s),o===a&&(i=s)}return o===a?null:vfe(d=>Jd(t,d),i,s,o,a)}function OD(t,e){let r=ife(),n=K.default.greaterThan(e,r),i=n?K.default.subtract(e,zce):Nb;if(t==="Africa/Casablanca"||t==="Africa/El_Aaiun"){let m=D(Qf("2088-01-01T00Z"),mt);if(K.default.lessThan(m,e))return OD(t,m)}let o=K.default.subtract(e,Xb);if(K.default.lessThan(o,Nb))return null;let s=Jd(t,o),a=o,d=s;for(;s===d&&K.default.greaterThan(o,i);){if(a=K.default.subtract(o,Kce),K.default.lessThan(a,Nb))return null;d=Jd(t,a),s===d&&(o=a)}if(s===d){if(n){let m=K.default.subtract(r,gl);return OD(t,m)}return null}return vfe(m=>Jd(t,m),a,o,d,s)}function $p(t){return t===void 0?!1:t%4==0&&(t%100!=0||t%400==0)}function Yd(t,e){return{standard:[31,28,31,30,31,30,31,31,30,31,30,31],leapyear:[31,29,31,30,31,30,31,31,30,31,30,31]}[$p(t)?"leapyear":"standard"][e-1]}function BD(t,e,r){let n=e+(e<3?10:-2),i=t-(e<3?1:0),o=aa(i/100),s=i-100*o,a=(r+aa(2.6*n-.2)+(s+aa(s/4))+(aa(o/4)-2*o))%7;return a+(a<=0?7:0)}function P8(t,e,r){let n=r;for(let i=e-1;i>0;i--)n+=Yd(t,i);return n}function dce(t,e,r){let n=P8(t,e,r),i=BD(t,e,r)||7,o=BD(t,1,1),s=aa((n-i+10)/7);return s<1?o===5||o===6&&$p(t-1)?{week:53,year:t-1}:{week:52,year:t-1}:s===53&&($p(t)?366:365)-n<4-i?{week:1,year:t+1}:{week:s,year:t}}function yl(t,e,r,n,i,o,s,a,d,m){for(let p of[t,e,r,n,i,o,s,a,d,m])if(p!==0)return p<0?-1:1;return 0}function h8(t,e){let r=t,n=e;if(!os(r)||!os(n))throw new RangeError("infinity is out of range");return n-=1,r+=aa(n/12),n%=12,n<0&&(n+=12),n+=1,{year:r,month:n}}function W8(t,e,r){let n=t,i=e,o=r;if(!os(o))throw new RangeError("infinity is out of range");({year:n,month:i}=h8(n,i));let s=146097;if(hn(o)>s){let m=ly(o/s);n+=400*m,o-=m*s}let a=0,d=i>2?n:n-1;for(;a=$p(d)?366:365,o<-a;)n-=1,d-=1,o+=a;for(d+=1;a=$p(d)?366:365,o>a;)n+=1,d+=1,o-=a;for(;o<1;)({year:n,month:i}=h8(n,i-1)),o+=Yd(n,i);for(;o>Yd(n,i);)o-=Yd(n,i),{year:n,month:i}=h8(n,i+1);return{year:n,month:i,day:o}}function pC(t,e,r,n,i,o,s,a,d){let{deltaDays:m,hour:p,minute:w,second:P,millisecond:S,microsecond:M,nanosecond:A}=Hd(n,i,o,s,a,d),{year:B,month:I,day:C}=W8(t,e,r+m);return{year:B,month:I,day:C,hour:p,minute:w,second:P,millisecond:S,microsecond:M,nanosecond:A}}function Hd(t,e,r,n,i,o){let s,a=K.default.BigInt(t),d=K.default.BigInt(e),m=K.default.BigInt(r),p=K.default.BigInt(n),w=K.default.BigInt(i),P=K.default.BigInt(o);return{quotient:s,remainder:P}=fy(P,Tr),w=K.default.add(w,s),{quotient:s,remainder:w}=fy(w,Tr),p=K.default.add(p,s),{quotient:s,remainder:p}=fy(p,Tr),m=K.default.add(m,s),{quotient:s,remainder:m}=fy(m,pl),d=K.default.add(d,s),{quotient:s,remainder:d}=fy(d,pl),a=K.default.add(a,s),{quotient:s,remainder:a}=fy(a,Lce),{deltaDays:K.default.toNumber(s),hour:K.default.toNumber(a),minute:K.default.toNumber(d),second:K.default.toNumber(m),millisecond:K.default.toNumber(p),microsecond:K.default.toNumber(w),nanosecond:K.default.toNumber(P)}}function Jb(t,e,r,n,i,o,s,a){let d=K.default.BigInt(t),m=K.default.BigInt(s);t!==0&&(m=K.default.subtract(K.default.BigInt(s),K.default.BigInt(a)));let p=K.default.add(K.default.BigInt(e),K.default.multiply(d,K.default.BigInt(24))),w=K.default.add(K.default.BigInt(r),K.default.multiply(p,pl)),P=K.default.add(K.default.BigInt(n),K.default.multiply(w,pl)),S=K.default.add(K.default.BigInt(i),K.default.multiply(P,Tr)),M=K.default.add(K.default.BigInt(o),K.default.multiply(S,Tr));return K.default.add(K.default.BigInt(m),K.default.multiply(M,Tr))}function mC(t,e){let r=Fe("%Temporal.Instant%"),n=Kb(K.default.toNumber(t)),i=K.default.BigInt(t),o=864e11;if(n===0)return{days:0,nanoseconds:Un,dayLengthNs:o};if(!Qe(e)){let k;return{quotient:k,remainder:i}=ri(i,K.default.BigInt(o)),{days:K.default.toNumber(k),nanoseconds:i,dayLengthNs:o}}let s=D(e,mt),a=D(e,jo),d=K.default.add(s,i),m=new r(d),p=D(e,zr),w=D(e,we),P=Ia(p,a,w),S=Ia(p,m,w),{days:M}=bC(D(P,Ge),D(P,He),D(P,Je),D(P,Ot),D(P,Bt),D(P,Dt),D(P,Ct),D(P,jt),D(P,Nt),D(S,Ge),D(S,He),D(S,Je),D(S,Ot),D(S,Bt),D(S,Dt),D(S,Ct),D(S,jt),D(S,Nt),w,"day",qo(null)),A=fc(a,p,w,0,0,0,M,0,0,0,0,0,0),B=K.default.BigInt(M);if(n===1)for(;K.default.greaterThan(B,Un)&&K.default.greaterThan(A,d);)B=K.default.subtract(B,Xb),A=fc(a,p,w,0,0,0,K.default.toNumber(B),0,0,0,0,0,0);i=K.default.subtract(d,A);let I=!1,C=new r(A);do{let k=fc(C,p,w,0,0,0,n,0,0,0,0,0,0),q=D(C,mt);o=K.default.toNumber(K.default.subtract(k,q)),I=K.default.greaterThanOrEqual(K.default.multiply(K.default.subtract(i,K.default.BigInt(o)),K.default.BigInt(n)),Un),I&&(i=K.default.subtract(i,K.default.BigInt(o)),C=new r(k),B=K.default.add(B,K.default.BigInt(n)))}while(I);if(!sc(B)&&Qae(B)!==n)throw new RangeError("Time zone or calendar converted nanoseconds into a number of days with the opposite sign");if(!sc(i)&&Qae(i)!==n)throw b8(i)&&n===1?new Error("assert not reached"):new RangeError("Time zone or calendar ended up with a remainder of nanoseconds with the opposite sign");if(K.default.greaterThanOrEqual(Yf(i),Yf(K.default.BigInt(o))))throw new Error("assert not reached");return{days:K.default.toNumber(B),nanoseconds:i,dayLengthNs:hn(o)}}function tf(t,e,r,n,i,o,s,a,d){let m=sfe(t,e,r,n,i,o,s,a,d);if(m==="positive overflow"||m==="negative overflow")throw new RangeError("Duration out of range");return m}function sfe(t,e,r,n,i,o,s,a,d){let m,p,w,P,S,M,A=t;if(Qe(d)){let F=fc(D(d,jo),D(d,zr),D(d,we),0,0,0,A,e,r,n,i,o,s),N=D(d,mt);m=K.default.subtract(F,N)}else m=Jb(A,e,r,n,i,o,s,0);a==="year"||a==="month"||a==="week"||a==="day"?{days:A,nanoseconds:m}=mC(m,d):A=0;let B=K.default.lessThan(m,Un)?-1:1;switch(m=Yf(m),p=w=P=S=M=Un,a){case"year":case"month":case"week":case"day":case"hour":({quotient:p,remainder:m}=ri(m,Tr)),{quotient:w,remainder:p}=ri(p,Tr),{quotient:P,remainder:w}=ri(w,Tr),{quotient:S,remainder:P}=ri(P,pl),{quotient:M,remainder:S}=ri(S,pl);break;case"minute":({quotient:p,remainder:m}=ri(m,Tr)),{quotient:w,remainder:p}=ri(p,Tr),{quotient:P,remainder:w}=ri(w,Tr),{quotient:S,remainder:P}=ri(P,pl);break;case"second":({quotient:p,remainder:m}=ri(m,Tr)),{quotient:w,remainder:p}=ri(p,Tr),{quotient:P,remainder:w}=ri(w,Tr);break;case"millisecond":({quotient:p,remainder:m}=ri(m,Tr)),{quotient:w,remainder:p}=ri(p,Tr);break;case"microsecond":({quotient:p,remainder:m}=ri(m,Tr));break;case"nanosecond":break;default:throw new Error("assert not reached")}let I=K.default.toNumber(M)*B,C=K.default.toNumber(S)*B,k=K.default.toNumber(P)*B,q=K.default.toNumber(w)*B,L=K.default.toNumber(p)*B,U=K.default.toNumber(m)*B;for(let F of[A,I,C,k,q,L,U])if(!os(F))return B===1?"positive overflow":"negative overflow";return{days:A,hours:I,minutes:C,seconds:k,milliseconds:q,microseconds:L,nanoseconds:U}}function l8(t,e,r,n,i,o){let s=Fe("%Temporal.Duration%"),a=yl(t,e,r,n,0,0,0,0,0,0);if(a===0)return{years:t,months:e,weeks:r,days:n};let d=K.default.BigInt(a),m,p,w=K.default.BigInt(t),P=K.default.BigInt(e),S=K.default.BigInt(r),M=K.default.BigInt(n);o&&(p=Wr(o),m=D(p,we));let A=new s(a),B=new s(0,a),I=new s(0,0,a);switch(i){case"year":break;case"month":{if(!m)throw new RangeError("a starting point is required for months balancing");let C,k;for(typeof m!="string"&&(C=Br(m,"dateAdd"),k=Br(m,"dateUntil"));!sc(w);){let q=mo(m,p,A,void 0,C),L=qo(null);L.largestUnit="month";let U=jp(m,p,q,L,k),F=K.default.BigInt(D(U,Xi));p=q,P=K.default.add(P,F),w=K.default.subtract(w,d)}}break;case"week":{if(!m)throw new RangeError("a starting point is required for weeks balancing");let C=typeof m!="string"?Br(m,"dateAdd"):void 0;for(;!sc(w);){let k;({relativeTo:p,days:k}=Co(m,p,A,C)),M=K.default.add(M,K.default.BigInt(k)),w=K.default.subtract(w,d)}for(;!sc(P);){let k;({relativeTo:p,days:k}=Co(m,p,B,C)),M=K.default.add(M,K.default.BigInt(k)),P=K.default.subtract(P,d)}break}default:{if(sc(w)&&sc(P)&&sc(S))break;if(!m)throw new RangeError("a starting point is required for balancing calendar units");let C=typeof m!="string"?Br(m,"dateAdd"):void 0;for(;!sc(w);){let k;({relativeTo:p,days:k}=Co(m,p,A,C)),M=K.default.add(M,K.default.BigInt(k)),w=K.default.subtract(w,d)}for(;!sc(P);){let k;({relativeTo:p,days:k}=Co(m,p,B,C)),M=K.default.add(M,K.default.BigInt(k)),P=K.default.subtract(P,d)}for(;!sc(S);){let k;({relativeTo:p,days:k}=Co(m,p,I,C)),M=K.default.add(M,K.default.BigInt(k)),S=K.default.subtract(S,d)}break}}return{years:K.default.toNumber(w),months:K.default.toNumber(P),weeks:K.default.toNumber(S),days:K.default.toNumber(M)}}function hce(t,e,r,n,i){if(Qe(t)){let o=D(t,jo),s=D(t,zr),a=D(t,we),d=eu(s,o),m=fc(o,s,a,e,r,n,i,0,0,0,0,0,0);return eu(s,new(Fe("%Temporal.Instant%"))(m))-d}return 0}function afe(t){return new(Fe("%Temporal.Duration%"))(-D(t,Yo),-D(t,Xi),-D(t,Ls),-D(t,Qo),-D(t,Xo),-D(t,es),-D(t,ts),-D(t,rs),-D(t,ns),-D(t,is))}function sa(t,e,r){return Dqe(r,Cqe(e,t))}function cfe(t,e,r){let n=sa(e,1,12);return{year:t,month:n,day:sa(r,1,Yd(t,n))}}function yo(t,e,r){if(t<e||t>r)throw new RangeError(`value out of range: ${e} <= ${t} <= ${r}`)}function vl(t,e,r){yo(e,1,12),yo(r,1,Yd(t,e))}function ffe(t,e,r){ufe(t,e,r,12,0,0,0,0,0)}function V8(t,e,r,n,i,o){yo(t,0,23),yo(e,0,59),yo(r,0,59),yo(n,0,999),yo(i,0,999),yo(o,0,999)}function yC(t,e,r,n,i,o,s,a,d){vl(t,e,r),V8(n,i,o,s,a,d)}function ufe(t,e,r,n,i,o,s,a,d){if(yo(t,g8,v8),t===g8&&qp(t,e,r+1,n,i,o,s,a,d-1)==null||t===v8&&qp(t,e,r-1,n,i,o,s,a,d+1)==null)throw new RangeError("DateTime outside of supported range")}function uy(t){if(K.default.lessThan(t,V_)||K.default.greaterThan(t,Gb))throw new RangeError("Instant outside of supported range")}function A8(t,e,r,n,i,o,s,a,d,m){let p=yl(t,e,r,n,i,o,s,a,d,m);for(let w of[t,e,r,n,i,o,s,a,d,m]){if(!os(w))throw new RangeError("infinite values not allowed as duration fields");let P=Kb(w);if(P!==0&&P!==p)throw new RangeError("mixed-sign values not allowed as duration fields")}}function gC(t,e,r,n,i,o,s){switch(s){case"year":case"month":{let a=-Cp(t,e,r,n,i,o);if(a===0)return{years:0,months:0,weeks:0,days:0};let d={year:t,month:e,day:r},m={year:n,month:i,day:o},p=m.year-d.year,w=hy(t,e,r,p,0,0,0,"constrain"),P=-Cp(w.year,w.month,w.day,n,i,o);if(P===0)return s==="year"?{years:p,months:0,weeks:0,days:0}:{years:0,months:12*p,weeks:0,days:0};let S=m.month-d.month;if(P!==a&&(p-=a,S+=12*a),w=hy(t,e,r,p,S,0,0,"constrain"),P=-Cp(w.year,w.month,w.day,n,i,o),P===0)return s==="year"?{years:p,months:S,weeks:0,days:0}:{years:0,months:S+12*p,weeks:0,days:0};P!==a&&(S-=a,S===-a&&(p-=a,S=11*a),w=hy(t,e,r,p,S,0,0,"constrain"));let M=0;return M=w.month===m.month?m.day-w.day:a<0?-w.day-(Yd(m.year,m.month)-m.day):m.day+(Yd(w.year,w.month)-w.day),s==="month"&&(S+=12*p,p=0),{years:p,months:S,weeks:0,days:M}}case"week":case"day":{let a,d,m;Cp(t,e,r,n,i,o)<0?(d={year:t,month:e,day:r},a={year:n,month:i,day:o},m=1):(d={year:n,month:i,day:o},a={year:t,month:e,day:r},m=-1);let p=P8(a.year,a.month,a.day)-P8(d.year,d.month,d.day);for(let P=d.year;P<a.year;++P)p+=$p(P)?366:365;let w=0;return s==="week"&&(w=aa(p/7),p%=7),w*=m,p*=m,{years:0,months:0,weeks:w,days:p}}default:throw new Error("assert not reached")}}function lfe(t,e,r,n,i,o,s,a,d,m,p,w){let P=s-t,S=a-e,M=d-r,A=m-n,B=p-i,I=w-o,C=yl(0,0,0,0,P,S,M,A,B,I);P*=C,S*=C,M*=C,A*=C,B*=C,I*=C;let k=0;if({deltaDays:k,hour:P,minute:S,second:M,millisecond:A,microsecond:B,nanosecond:I}=Hd(P,S,M,A,B,I),k!=0)throw new Error("assertion failure in DifferenceTime: _bt_.[[Days]] should be 0");return P*=C,S*=C,M*=C,A*=C,B*=C,I*=C,{hours:P,minutes:S,seconds:M,milliseconds:A,microseconds:B,nanoseconds:I}}function vC(t,e,r,n,i,o){let s=K.default.subtract(e,t),a=0,d=0,m=K.default.toNumber(K.default.remainder(s,Tr)),p=K.default.toNumber(K.default.remainder(K.default.divide(s,Tr),Tr)),w=K.default.toNumber(K.default.remainder(K.default.divide(s,cc),Tr)),P=K.default.toNumber(K.default.divide(s,ml));return{hours:a,minutes:d,seconds:P,milliseconds:w,microseconds:p,nanoseconds:m}=th(0,0,0,0,0,0,P,w,p,m,r,n,o),tf(0,a,d,P,w,p,m,i)}function bC(t,e,r,n,i,o,s,a,d,m,p,w,P,S,M,A,B,I,C,k,q){let L=t,U=e,F=r,{hours:N,minutes:G,seconds:x,milliseconds:c,microseconds:u,nanoseconds:y}=lfe(n,i,o,s,a,d,P,S,M,A,B,I),l=yl(0,0,0,0,N,G,x,c,u,y);Cp(m,p,w,L,U,F)===-l&&({year:L,month:U,day:F}=W8(L,U,F-l),{hours:N,minutes:G,seconds:x,milliseconds:c,microseconds:u,nanoseconds:y}=tf(-l,N,G,x,c,u,y,k));let h=uc(L,U,F,C),b=uc(m,p,w,C),_=gy("day",k),g=Kp(q);g.largestUnit=_;let{years:f,months:v,weeks:O,days:T}=jp(C,h,b,g);return{days:T,hours:N,minutes:G,seconds:x,milliseconds:c,microseconds:u,nanoseconds:y}=tf(T,N,G,x,c,u,y,k),{years:f,months:v,weeks:O,days:T,hours:N,minutes:G,seconds:x,milliseconds:c,microseconds:u,nanoseconds:y}}function dfe(t,e,r,n,i,o){let s=K.default.subtract(e,t);if(K.default.equal(s,Un))return{years:0,months:0,weeks:0,days:0,hours:0,minutes:0,seconds:0,milliseconds:0,microseconds:0,nanoseconds:0};let a=Fe("%Temporal.Instant%"),d=new a(t),m=new a(e),p=Ia(r,d,n),w=Ia(r,m,n),{years:P,months:S,weeks:M,days:A}=bC(D(p,Ge),D(p,He),D(p,Je),D(p,Ot),D(p,Bt),D(p,Dt),D(p,Ct),D(p,jt),D(p,Nt),D(w,Ge),D(w,He),D(w,Je),D(w,Ot),D(w,Bt),D(w,Dt),D(w,Ct),D(w,jt),D(w,Nt),n,i,o),B=fc(d,r,n,P,S,M,0,0,0,0,0,0,0),I=K.default.subtract(e,B),C=po(B,r,n);({nanoseconds:I,days:A}=mC(I,C));let{hours:k,minutes:q,seconds:L,milliseconds:U,microseconds:F,nanoseconds:N}=tf(0,0,0,0,0,0,K.default.toNumber(I),"hour");return{years:P,months:S,weeks:M,days:A,hours:k,minutes:q,seconds:L,milliseconds:U,microseconds:F,nanoseconds:N}}function iw(t,e,r,n,i,o){let s=nx.reduce((S,M)=>{let A=M[0],B=M[1],I=M[2];return r!=="datetime"&&I!==r||n.includes(B)||S.push(B,A),S},[]),a=ca(e,"largestUnit",r,"auto");if(n.includes(a))throw new RangeError(`largestUnit must be one of ${s.join(", ")}, not ${a}`);let d=tw(e),m=Xf(e,"trunc");t==="since"&&(m=function(M){switch(M){case"ceil":return"floor";case"floor":return"ceil";case"halfCeil":return"halfFloor";case"halfFloor":return"halfCeil";default:return M}}(m));let p=ca(e,"smallestUnit",r,i);if(n.includes(p))throw new RangeError(`smallestUnit must be one of ${s.join(", ")}, not ${p}`);let w=gy(o,p);if(a==="auto"&&(a=w),gy(a,p)!==a)throw new RangeError(`largestUnit ${a} cannot be smaller than smallestUnit ${p}`);let P={hour:24,minute:60,second:60,millisecond:1e3,microsecond:1e3,nanosecond:1e3}[p];return P!==void 0&&rw(d,P,!1),{largestUnit:a,roundingIncrement:d,roundingMode:m,smallestUnit:p}}function pce(t,e,r,n){let i=t==="since"?-1:1,o=Qf(r),s=iw(t,Kp(n),"time",[],"nanosecond","second"),a=D(e,mt),d=D(o,mt),{hours:m,minutes:p,seconds:w,milliseconds:P,microseconds:S,nanoseconds:M}=vC(a,d,s.roundingIncrement,s.smallestUnit,s.largestUnit,s.roundingMode);return new(Fe("%Temporal.Duration%"))(0,0,0,0,i*m,i*p,i*w,i*P,i*S,i*M)}function mce(t,e,r,n){let i=t==="since"?-1:1,o=Wr(r),s=D(e,we);z8(s,D(o,we),"compute difference between dates");let a=Kp(n),d=iw(t,a,"date",[],"day","day");a.largestUnit=d.largestUnit;let{years:m,months:p,weeks:w,days:P}=jp(s,e,o,a);return d.smallestUnit==="day"&&d.roundingIncrement===1||({years:m,months:p,weeks:w,days:P}=th(m,p,w,P,0,0,0,0,0,0,d.roundingIncrement,d.smallestUnit,d.roundingMode,e)),new(Fe("%Temporal.Duration%"))(i*m,i*p,i*w,i*P,0,0,0,0,0,0)}function yce(t,e,r,n){let i=t==="since"?-1:1,o=dy(r),s=D(e,we);z8(s,D(o,we),"compute difference between dates");let a=Kp(n),d=iw(t,a,"datetime",[],"nanosecond","day"),{years:m,months:p,weeks:w,days:P,hours:S,minutes:M,seconds:A,milliseconds:B,microseconds:I,nanoseconds:C}=bC(D(e,Ge),D(e,He),D(e,Je),D(e,Ot),D(e,Bt),D(e,Dt),D(e,Ct),D(e,jt),D(e,Nt),D(o,Ge),D(o,He),D(o,Je),D(o,Ot),D(o,Bt),D(o,Dt),D(o,Ct),D(o,jt),D(o,Nt),s,d.largestUnit,a),k=Zb(e);return{years:m,months:p,weeks:w,days:P,hours:S,minutes:M,seconds:A,milliseconds:B,microseconds:I,nanoseconds:C}=th(m,p,w,P,S,M,A,B,I,C,d.roundingIncrement,d.smallestUnit,d.roundingMode,k),{days:P,hours:S,minutes:M,seconds:A,milliseconds:B,microseconds:I,nanoseconds:C}=tf(P,S,M,A,B,I,C,d.largestUnit),new(Fe("%Temporal.Duration%"))(i*m,i*p,i*w,i*P,i*S,i*M,i*A,i*B,i*I,i*C)}function gce(t,e,r,n){let i=t==="since"?-1:1,o=Zd(r),s=iw(t,Kp(n),"time",[],"nanosecond","hour"),{hours:a,minutes:d,seconds:m,milliseconds:p,microseconds:w,nanoseconds:P}=lfe(D(e,Ot),D(e,Bt),D(e,Dt),D(e,Ct),D(e,jt),D(e,Nt),D(o,Ot),D(o,Bt),D(o,Dt),D(o,Ct),D(o,jt),D(o,Nt));return{hours:a,minutes:d,seconds:m,milliseconds:p,microseconds:w,nanoseconds:P}=th(0,0,0,0,a,d,m,p,w,P,s.roundingIncrement,s.smallestUnit,s.roundingMode),{hours:a,minutes:d,seconds:m,milliseconds:p,microseconds:w,nanoseconds:P}=tf(0,a,d,m,p,w,P,s.largestUnit),new(Fe("%Temporal.Duration%"))(0,0,0,0,i*a,i*d,i*m,i*p,i*w,i*P)}function vce(t,e,r,n){let i=t==="since"?-1:1,o=z_(r),s=D(e,we);z8(s,D(o,we),"compute difference between months");let a=Kp(n),d=iw(t,a,"date",["week","day"],"month","year");a.largestUnit=d.largestUnit;let m=li(s,["monthCode","year"]),p=Gt(e,m,[]);p.day=1;let w=eh(s,p),P=Gt(o,m,[]);P.day=1;let S=eh(s,P),{years:M,months:A}=jp(s,w,S,a);return d.smallestUnit==="month"&&d.roundingIncrement===1||({years:M,months:A}=th(M,A,0,0,0,0,0,0,0,0,d.roundingIncrement,d.smallestUnit,d.roundingMode,w)),new(Fe("%Temporal.Duration%"))(i*M,i*A,0,0,0,0,0,0,0,0)}function bce(t,e,r,n){let i=t==="since"?-1:1,o=K_(r),s=D(e,we);z8(s,D(o,we),"compute difference between dates");let a=Kp(n),d=iw(t,a,"datetime",[],"nanosecond","hour");a.largestUnit=d.largestUnit;let m=D(e,mt),p=D(o,mt),w,P,S,M,A,B,I,C,k,q;if(d.largestUnit!=="year"&&d.largestUnit!=="month"&&d.largestUnit!=="week"&&d.largestUnit!=="day")w=0,P=0,S=0,M=0,{hours:A,minutes:B,seconds:I,milliseconds:C,microseconds:k,nanoseconds:q}=vC(m,p,d.roundingIncrement,d.smallestUnit,d.largestUnit,d.roundingMode);else{let L=D(e,zr);if(!Xce(L,D(o,zr)))throw new RangeError("When calculating difference between time zones, largestUnit must be 'hours' or smaller because day lengths can vary between time zones due to DST or time zone offset changes.");({years:w,months:P,weeks:S,days:M,hours:A,minutes:B,seconds:I,milliseconds:C,microseconds:k,nanoseconds:q}=dfe(m,p,L,s,d.largestUnit,a)),{years:w,months:P,weeks:S,days:M,hours:A,minutes:B,seconds:I,milliseconds:C,microseconds:k,nanoseconds:q}=th(w,P,S,M,A,B,I,C,k,q,d.roundingIncrement,d.smallestUnit,d.roundingMode,e),{years:w,months:P,weeks:S,days:M,hours:A,minutes:B,seconds:I,milliseconds:C,microseconds:k,nanoseconds:q}=yfe(w,P,S,M,A,B,I,C,k,q,d.roundingIncrement,d.smallestUnit,d.roundingMode,e)}return new(Fe("%Temporal.Duration%"))(i*w,i*P,i*S,i*M,i*A,i*B,i*I,i*C,i*k,i*q)}function hy(t,e,r,n,i,o,s,a){let d=t,m=e,p=r,w=o,P=s;return d+=n,m+=i,{year:d,month:m}=h8(d,m),{year:d,month:m,day:p}=_8(d,m,p,a),P+=7*w,p+=P,{year:d,month:m,day:p}=W8(d,m,p),{year:d,month:m,day:p}}function hfe(t,e,r,n,i,o,s,a,d,m,p,w){let P=t,S=e,M=r,A=n,B=i,I=o;P+=s,S+=a,M+=d,A+=m,B+=p,I+=w;let C=0;return{deltaDays:C,hour:P,minute:S,second:M,millisecond:A,microsecond:B,nanosecond:I}=Hd(P,S,M,A,B,I),{deltaDays:C,hour:P,minute:S,second:M,millisecond:A,microsecond:B,nanosecond:I}}function pfe(t,e,r,n,i,o,s,a,d,m,p,w,P,S,M,A,B,I,C,k,q){let L=gy(ID(t,e,r,n,i,o,s,a,d,m),ID(p,w,P,S,M,A,B,I,C,k)),U,F,N,G,x,c,u,y,l,h;if(q)if(Jt(q)){let b=Fe("%Temporal.Duration%"),_=D(q,we),g=new b(t,e,r,n,0,0,0,0,0,0),f=new b(p,w,P,S,0,0,0,0,0,0),v=typeof _!="string"?Br(_,"dateAdd"):void 0,O=mo(_,q,g,void 0,v),T=mo(_,O,f,void 0,v),R=gy("day",L),z=qo(null);z.largestUnit=R,{years:U,months:F,weeks:N,days:G}=jp(_,q,T,z),{days:G,hours:x,minutes:c,seconds:u,milliseconds:y,microseconds:l,nanoseconds:h}=tf(G,K.default.add(K.default.BigInt(i),K.default.BigInt(M)),K.default.add(K.default.BigInt(o),K.default.BigInt(A)),K.default.add(K.default.BigInt(s),K.default.BigInt(B)),K.default.add(K.default.BigInt(a),K.default.BigInt(I)),K.default.add(K.default.BigInt(d),K.default.BigInt(C)),K.default.add(K.default.BigInt(m),K.default.BigInt(k)),L)}else{let b=Fe("%Temporal.Instant%"),_=D(q,zr),g=D(q,we),f=fc(D(q,jo),_,g,t,e,r,n,i,o,s,a,d,m),v=fc(new b(f),_,g,p,w,P,S,M,A,B,I,C,k);L!=="year"&&L!=="month"&&L!=="week"&&L!=="day"?(U=0,F=0,N=0,G=0,{hours:x,minutes:c,seconds:u,milliseconds:y,microseconds:l,nanoseconds:h}=vC(D(q,mt),v,1,"nanosecond",L,"halfExpand")):{years:U,months:F,weeks:N,days:G,hours:x,minutes:c,seconds:u,milliseconds:y,microseconds:l,nanoseconds:h}=dfe(D(q,mt),v,_,g,L,qo(null))}else{if(L==="year"||L==="month"||L==="week")throw new RangeError("relativeTo is required for years, months, or weeks arithmetic");U=F=N=0,{days:G,hours:x,minutes:c,seconds:u,milliseconds:y,microseconds:l,nanoseconds:h}=tf(n+S,K.default.add(K.default.BigInt(i),K.default.BigInt(M)),K.default.add(K.default.BigInt(o),K.default.BigInt(A)),K.default.add(K.default.BigInt(s),K.default.BigInt(B)),K.default.add(K.default.BigInt(a),K.default.BigInt(I)),K.default.add(K.default.BigInt(d),K.default.BigInt(C)),K.default.add(K.default.BigInt(m),K.default.BigInt(k)),L)}return A8(U,F,N,G,x,c,u,y,l,h),{years:U,months:F,weeks:N,days:G,hours:x,minutes:c,seconds:u,milliseconds:y,microseconds:l,nanoseconds:h}}function DD(t,e,r,n,i,o,s){let a=Un;a=K.default.add(a,K.default.BigInt(s)),a=K.default.add(a,K.default.multiply(K.default.BigInt(o),Tr)),a=K.default.add(a,K.default.multiply(K.default.BigInt(i),cc)),a=K.default.add(a,K.default.multiply(K.default.BigInt(n),ml)),a=K.default.add(a,K.default.multiply(K.default.BigInt(r),K.default.BigInt(6e10))),a=K.default.add(a,K.default.multiply(K.default.BigInt(e),K.default.BigInt(36e11)));let d=K.default.add(t,a);return uy(d),d}function CD(t,e,r,n,i,o,s,a,d,m,p,w,P,S,M,A,B,I,C,k,q){let L=S,{deltaDays:U,hour:F,minute:N,second:G,millisecond:x,microsecond:c,nanosecond:u}=hfe(n,i,o,s,a,d,M,A,B,I,C,k);L+=U;let y=Fe("%Temporal.Duration%"),l=mo(m,uc(t,e,r,m),new y(p,w,P,L,0,0,0,0,0,0),q);return{year:D(l,Ge),month:D(l,He),day:D(l,Je),hour:F,minute:N,second:G,millisecond:x,microsecond:c,nanosecond:u}}function fc(t,e,r,n,i,o,s,a,d,m,p,w,P,S){let M=Fe("%Temporal.Duration%");if(yl(n,i,o,s,0,0,0,0,0,0)===0)return DD(D(t,mt),a,d,m,p,w,P);let A=Ia(e,t,r),B=mo(r,uc(D(A,Ge),D(A,He),D(A,Je),r),new M(n,i,o,s,0,0,0,0,0,0),S),I=oa(D(B,Ge),D(B,He),D(B,Je),D(A,Ot),D(A,Bt),D(A,Dt),D(A,Ct),D(A,jt),D(A,Nt),r);return DD(D(ss(e,I,"compatible"),mt),a,d,m,p,w,P)}function wce(t,e,r,n){let i=t==="subtract"?-1:1,{years:o,months:s,weeks:a,days:d,hours:m,minutes:p,seconds:w,milliseconds:P,microseconds:S,nanoseconds:M}=Sy(r),A=d8(Xt(n));return{years:o,months:s,weeks:a,days:d,hours:m,minutes:p,seconds:w,milliseconds:P,microseconds:S,nanoseconds:M}=pfe(D(e,Yo),D(e,Xi),D(e,Ls),D(e,Qo),D(e,Xo),D(e,es),D(e,ts),D(e,rs),D(e,ns),D(e,is),i*o,i*s,i*a,i*d,i*m,i*p,i*w,i*P,i*S,i*M,A),new(Fe("%Temporal.Duration%"))(o,s,a,d,m,p,w,P,S,M)}function _ce(t,e,r){let n=t==="subtract"?-1:1,{hours:i,minutes:o,seconds:s,milliseconds:a,microseconds:d,nanoseconds:m}=function(P,S){let M=Sy(P);for(let A of S)if(M[A]!==0)throw new RangeError(`Duration field ${A} not supported by Temporal.Instant. Try Temporal.ZonedDateTime instead.`);return M}(r,["years","months","weeks","days"]),p=DD(D(e,mt),n*i,n*o,n*s,n*a,n*d,n*m);return new(Fe("%Temporal.Instant%"))(p)}function xce(t,e,r,n){let i=t==="subtract"?-1:1,{years:o,months:s,weeks:a,days:d,hours:m,minutes:p,seconds:w,milliseconds:P,microseconds:S,nanoseconds:M}=Sy(r),A=Xt(n),B=D(e,we),{year:I,month:C,day:k,hour:q,minute:L,second:U,millisecond:F,microsecond:N,nanosecond:G}=CD(D(e,Ge),D(e,He),D(e,Je),D(e,Ot),D(e,Bt),D(e,Dt),D(e,Ct),D(e,jt),D(e,Nt),B,i*o,i*s,i*a,i*d,i*m,i*p,i*w,i*P,i*S,i*M,A);return oa(I,C,k,q,L,U,F,N,G,B)}function Ece(t,e,r){let n=t==="subtract"?-1:1,{hours:i,minutes:o,seconds:s,milliseconds:a,microseconds:d,nanoseconds:m}=Sy(r),{hour:p,minute:w,second:P,millisecond:S,microsecond:M,nanosecond:A}=hfe(D(e,Ot),D(e,Bt),D(e,Dt),D(e,Ct),D(e,jt),D(e,Nt),n*i,n*o,n*s,n*a,n*d,n*m);return{hour:p,minute:w,second:P,millisecond:S,microsecond:M,nanosecond:A}=D8(p,w,P,S,M,A,"reject"),new(Fe("%Temporal.PlainTime%"))(p,w,P,S,M,A)}function Sce(t,e,r,n){let i=Sy(r);t==="subtract"&&(i={years:-i.years,months:-i.months,weeks:-i.weeks,days:-i.days,hours:-i.hours,minutes:-i.minutes,seconds:-i.seconds,milliseconds:-i.milliseconds,microseconds:-i.microseconds,nanoseconds:-i.nanoseconds});let{years:o,months:s,weeks:a,days:d,hours:m,minutes:p,seconds:w,milliseconds:P,microseconds:S,nanoseconds:M}=i;({days:d}=tf(d,m,p,w,P,S,M,"day"));let A=Xt(n),B=D(e,we),I=li(B,["monthCode","year"]),C=Gt(e,I,[]),k=qo(null);qb(k,C,[]),C.day=1;let q=eh(B,C),L=yl(o,s,a,d,0,0,0,0,0,0),U=Br(B,"dateAdd"),F=Fe("%Temporal.Duration%");if(L<0){let x=mo(B,q,new F(0,1,0,0,0,0,0,0,0,0),void 0,U),c=mo(B,x,new F(0,0,0,-1,0,0,0,0,0,0),void 0,U);k.day=fx(B,c),q=eh(B,k)}let N=new F(o,s,a,d,0,0,0,0,0,0),G=Kp(A);return by(B,Gt(mo(B,q,N,A,U),I,[]),G)}function Mce(t,e,r,n){let i=t==="subtract"?-1:1,{years:o,months:s,weeks:a,days:d,hours:m,minutes:p,seconds:w,milliseconds:P,microseconds:S,nanoseconds:M}=Sy(r),A=Xt(n),B=D(e,zr),I=D(e,we);return po(fc(D(e,jo),B,I,i*o,i*s,i*a,i*d,i*m,i*p,i*w,i*P,i*S,i*M,A),B,I)}function Ra(t,e,r){if(K.default.equal(e,Xb))return t;let{quotient:n,remainder:i}=ri(t,e);if(K.default.equal(i,Un))return t;let o=K.default.lessThan(i,Un)?-1:1,s=Yf(K.default.multiply(i,K.default.BigInt(2))),a=K.default.equal(s,e),d=K.default.greaterThan(s,e);switch(r){case"ceil":o>0&&(n=K.default.add(n,K.default.BigInt(o)));break;case"floor":o<0&&(n=K.default.add(n,K.default.BigInt(o)));break;case"expand":n=K.default.add(n,K.default.BigInt(o));break;case"trunc":break;case"halfCeil":(d||a&&o>0)&&(n=K.default.add(n,K.default.BigInt(o)));break;case"halfFloor":(d||a&&o<0)&&(n=K.default.add(n,K.default.BigInt(o)));break;case"halfExpand":(d||a)&&(n=K.default.add(n,K.default.BigInt(o)));break;case"halfTrunc":d&&(n=K.default.add(n,K.default.BigInt(o)));break;case"halfEven":(d||a&&K.default.toNumber(K.default.remainder(Yf(n),K.default.BigInt(2)))===1)&&(n=K.default.add(n,K.default.BigInt(o)))}return K.default.multiply(n,e)}function T8(t,e,r,n){let{remainder:i}=fy(t,gl),o=K.default.subtract(t,i),s=Ra(i,K.default.BigInt(bfe[r]*e),n);return K.default.add(o,s)}function wC(t,e,r,n,i,o,s,a,d,m,p,w,P=864e11){let{deltaDays:S,hour:M,minute:A,second:B,millisecond:I,microsecond:C,nanosecond:k}=_C(n,i,o,s,a,d,m,p,w,P),{year:q,month:L,day:U}=W8(t,e,r+S);return{year:q,month:L,day:U,hour:M,minute:A,second:B,millisecond:I,microsecond:C,nanosecond:k}}function _C(t,e,r,n,i,o,s,a,d,m=864e11){let p=Un;switch(a){case"day":case"hour":p=K.default.BigInt(t);case"minute":p=K.default.add(K.default.multiply(p,pl),K.default.BigInt(e));case"second":p=K.default.add(K.default.multiply(p,pl),K.default.BigInt(r));case"millisecond":p=K.default.add(K.default.multiply(p,Tr),K.default.BigInt(n));case"microsecond":p=K.default.add(K.default.multiply(p,Tr),K.default.BigInt(i));case"nanosecond":p=K.default.add(K.default.multiply(p,Tr),K.default.BigInt(o))}let w=a==="day"?m:bfe[a],P=Ra(p,K.default.BigInt(w*s),d),S=K.default.toNumber(K.default.divide(P,K.default.BigInt(w)));switch(a){case"day":return{deltaDays:S,hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0};case"hour":return Hd(S,0,0,0,0,0);case"minute":return Hd(t,S,0,0,0,0);case"second":return Hd(t,e,S,0,0,0);case"millisecond":return Hd(t,e,r,S,0,0);case"microsecond":return Hd(t,e,r,n,S,0);case"nanosecond":return Hd(t,e,r,n,i,S);default:throw new Error(`Invalid unit ${a}`)}}function p8(t,e){return gC(D(t,Ge),D(t,He),D(t,Je),D(e,Ge),D(e,He),D(e,Je),"day").days}function Co(t,e,r,n){let i=mo(t,e,r,void 0,n);return{relativeTo:i,days:p8(e,i)}}function mfe(t,e,r,n,i){let o=D(t,zr),s=D(t,we);return po(fc(D(t,jo),o,s,e,r,n,i,0,0,0,0,0,0),o,s)}function yfe(t,e,r,n,i,o,s,a,d,m,p,w,P,S){let M=t,A=e,B=r,I=n,C=i,k=o,q=s,L=a,U=d,F=m;if(!Qe(S)||w==="year"||w==="month"||w==="week"||w==="day"||w==="nanosecond"&&p===1)return{years:M,months:A,weeks:B,days:I,hours:C,minutes:k,seconds:q,milliseconds:L,microseconds:U,nanoseconds:F};let N=Jb(0,C,k,q,L,U,F,0),G=Kb(K.default.toNumber(N)),x=D(S,zr),c=D(S,we),u=fc(D(S,jo),x,c,M,A,B,I,0,0,0,0,0,0),y=fc(new(Fe("%Temporal.Instant%"))(u),x,c,0,0,0,G,0,0,0,0,0,0),l=K.default.subtract(y,u);return K.default.greaterThanOrEqual(K.default.multiply(K.default.subtract(N,l),K.default.BigInt(G)),Un)&&({years:M,months:A,weeks:B,days:I}=pfe(M,A,B,I,0,0,0,0,0,0,0,0,0,G,0,0,0,0,0,0,S),N=T8(K.default.subtract(N,l),p,w,P),{hours:C,minutes:k,seconds:q,milliseconds:L,microseconds:U,nanoseconds:F}=tf(0,0,0,0,0,0,K.default.toNumber(N),"hour")),{years:M,months:A,weeks:B,days:I,hours:C,minutes:k,seconds:q,milliseconds:L,microseconds:U,nanoseconds:F}}function th(t,e,r,n,i,o,s,a,d,m,p,w,P,S){let M=t,A=e,B=r,I=n,C=i,k=o,q=s,L=a,U=d,F=K.default.BigInt(m),N=Fe("%Temporal.Duration%"),G,x,c,u,y=S;if(y){if(Qe(y))x=y,y=Wr(y);else if(!Jt(y))throw new TypeError("starting point must be PlainDate or ZonedDateTime");G=D(y,we)}if(w==="year"||w==="month"||w==="week"||w==="day"){let l,h,b;F=Jb(0,C,k,q,L,U,m,0),x&&(l=mfe(x,M,A,B,I)),{days:h,nanoseconds:F,dayLengthNs:b}=mC(F,l),c=K.default.BigInt(b),I+=h,C=k=q=L=U=0}switch(w){case"year":{if(!G)throw new RangeError("A starting point is required for years rounding");let l=new N(M),h=typeof G!="string"?Br(G,"dateAdd"):void 0,b=mo(G,y,l,void 0,h),_=mo(G,y,new N(M,A,B),void 0,h);y=b,I+=p8(b,_);let g=mo(G,y,new N(0,0,0,I),void 0,h),f=qo(null);f.largestUnit="year";let v=jp(G,y,g,f).years;M+=v;let O=y;y=mo(G,y,new N(v),void 0,h),I-=p8(O,y);let T=new N(I<0?-1:1),{days:R}=Co(G,y,T,h);R=hn(R);let z=K.default.multiply(K.default.BigInt(R),c);F=K.default.add(K.default.add(K.default.multiply(z,K.default.BigInt(M)),K.default.multiply(K.default.BigInt(I),c)),F);let V=Ra(F,K.default.multiply(z,K.default.BigInt(p)),P);u=ll(F,z),M=K.default.toNumber(K.default.divide(V,z)),F=Un,A=B=I=0;break}case"month":{if(!G)throw new RangeError("A starting point is required for months rounding");let l=new N(M,A),h=typeof G!="string"?Br(G,"dateAdd"):void 0,b=mo(G,y,l,void 0,h),_=mo(G,y,new N(M,A,B),void 0,h);y=b,I+=p8(b,_);let g=Kb(I),f=new N(0,I<0?-1:1),v;for({relativeTo:y,days:v}=Co(G,y,f,h);hn(I)>=hn(v);)A+=g,I-=v,{relativeTo:y,days:v}=Co(G,y,f,h);v=hn(v);let O=K.default.multiply(K.default.BigInt(v),c);F=K.default.add(K.default.add(K.default.multiply(O,K.default.BigInt(A)),K.default.multiply(K.default.BigInt(I),c)),F);let T=Ra(F,K.default.multiply(O,K.default.BigInt(p)),P);u=ll(F,O),A=K.default.toNumber(K.default.divide(T,O)),F=Un,B=I=0;break}case"week":{if(!G)throw new RangeError("A starting point is required for weeks rounding");let l=Kb(I),h=new N(0,0,I<0?-1:1),b=typeof G!="string"?Br(G,"dateAdd"):void 0,_;for({relativeTo:y,days:_}=Co(G,y,h,b);hn(I)>=hn(_);)B+=l,I-=_,{relativeTo:y,days:_}=Co(G,y,h,b);_=hn(_);let g=K.default.multiply(K.default.BigInt(_),c);F=K.default.add(K.default.add(K.default.multiply(g,K.default.BigInt(B)),K.default.multiply(K.default.BigInt(I),c)),F);let f=Ra(F,K.default.multiply(g,K.default.BigInt(p)),P);u=ll(F,g),B=K.default.toNumber(K.default.divide(f,g)),F=Un,I=0;break}case"day":{let l=c;F=K.default.add(K.default.multiply(l,K.default.BigInt(I)),F);let h=Ra(F,K.default.multiply(l,K.default.BigInt(p)),P);u=ll(F,l),I=K.default.toNumber(K.default.divide(h,l)),F=Un;break}case"hour":{let h=K.default.multiply(K.default.BigInt(C),K.default.BigInt(36e11));h=K.default.add(h,K.default.multiply(K.default.BigInt(k),K.default.BigInt(6e10))),h=K.default.add(h,K.default.multiply(K.default.BigInt(q),ml)),h=K.default.add(h,K.default.multiply(K.default.BigInt(L),cc)),h=K.default.add(h,K.default.multiply(K.default.BigInt(U),Tr)),h=K.default.add(h,F),u=ll(h,K.default.BigInt(36e11));let b=Ra(h,K.default.BigInt(36e11*p),P);C=K.default.toNumber(K.default.divide(b,K.default.BigInt(36e11))),F=Un,k=q=L=U=0;break}case"minute":{let h=K.default.multiply(K.default.BigInt(k),K.default.BigInt(6e10));h=K.default.add(h,K.default.multiply(K.default.BigInt(q),ml)),h=K.default.add(h,K.default.multiply(K.default.BigInt(L),cc)),h=K.default.add(h,K.default.multiply(K.default.BigInt(U),Tr)),h=K.default.add(h,F),u=ll(h,K.default.BigInt(6e10));let b=Ra(h,K.default.BigInt(6e10*p),P);k=K.default.toNumber(K.default.divide(b,K.default.BigInt(6e10))),F=Un,q=L=U=0;break}case"second":{let h=K.default.multiply(K.default.BigInt(q),ml);h=K.default.add(h,K.default.multiply(K.default.BigInt(L),cc)),h=K.default.add(h,K.default.multiply(K.default.BigInt(U),Tr)),h=K.default.add(h,F),u=ll(h,K.default.BigInt(1e9));let b=Ra(h,K.default.BigInt(1e9*p),P);q=K.default.toNumber(K.default.divide(b,K.default.BigInt(1e9))),F=Un,L=U=0;break}case"millisecond":{let h=K.default.multiply(K.default.BigInt(L),cc);h=K.default.add(h,K.default.multiply(K.default.BigInt(U),Tr)),h=K.default.add(h,F),u=ll(h,K.default.BigInt(1e6));let b=Ra(h,K.default.BigInt(1e6*p),P);L=K.default.toNumber(K.default.divide(b,K.default.BigInt(1e6))),F=Un,U=0;break}case"microsecond":{let h=K.default.multiply(K.default.BigInt(U),Tr);h=K.default.add(h,F),u=ll(h,K.default.BigInt(1e3));let b=Ra(h,K.default.BigInt(1e3*p),P);U=K.default.toNumber(K.default.divide(b,K.default.BigInt(1e3))),F=Un;break}case"nanosecond":u=K.default.toNumber(F),F=Ra(K.default.BigInt(F),K.default.BigInt(p),P)}return{years:M,months:A,weeks:B,days:I,hours:C,minutes:k,seconds:q,milliseconds:L,microseconds:U,nanoseconds:K.default.toNumber(F),total:u}}function Cp(t,e,r,n,i,o){for(let[s,a]of[[t,n],[e,i],[r,o]])if(s!==a)return py(s-a);return 0}function fy(t,e){let{quotient:r,remainder:n}=ri(t,e);return K.default.lessThan(n,Un)&&(r=K.default.subtract(r,Xb),n=K.default.add(n,e)),{quotient:r,remainder:n}}function Lb(t,e){let{quotient:r,remainder:n}=ri(t,e);return sc(n)||!b8(t)==!b8(e)?r:K.default.subtract(r,Xb)}function ll(t,e){let{quotient:r,remainder:n}=ri(t,e);return K.default.toNumber(r)+K.default.toNumber(n)/K.default.toNumber(e)}function R8(t){let e=G_(t);return globalThis.BigInt!==void 0?globalThis.BigInt(e.toString(10)):e}function G_(t){let e=t;if(typeof t=="object"){let r=t[Symbol.toPrimitive];r&&typeof r=="function"&&(e=B8(r,t,["number"]))}if(typeof e=="number")throw new TypeError("cannot convert number to bigint");return typeof e=="bigint"?K.default.BigInt(e.toString(10)):K.default.BigInt(e)}var xC=(()=>{let t=K.default.BigInt(Date.now()%1e6);return()=>{let e=K.default.BigInt(Date.now()),r=K.default.add(K.default.multiply(e,cc),t);return t=K.default.remainder(e,cc),K.default.greaterThan(r,Gb)?Gb:K.default.lessThan(r,V_)?V_:r}})();function Dp(){return new $ce().resolvedOptions().timeZone}function py(t){return t<0?-1:t>0?1:t}function Xt(t){if(t===void 0)return qo(null);if(pn(t)&&t!==null)return t;throw new TypeError("Options parameter must be an object, not "+(t===null?"null":typeof t))}function Yb(t,e){let r=qo(null);return r[t]=e,r}function Kp(t){let e=qo(null);return qb(e,Xt(t),[]),e}function Lp(t,e,r,n){let i=t[e];if(i!==void 0){if(i=as(i),!r.includes(i))throw new RangeError(`${e} must be one of ${r.join(", ")}, not ${i}`);return i}return n}function rh(t){return Fqe.includes(bl(t))}function bl(t){return t.replace(/[A-Z]/g,e=>{let r=e.charCodeAt(0);return String.fromCharCode(r+32)})}var gfe=new RegExp(`^${jce.source}$`);function vfe(t,e,r,n=t(e),i=t(r)){let o=K.default.BigInt(e),s=K.default.BigInt(r),a=n,d=i;for(;K.default.greaterThan(K.default.subtract(s,o),Xb);){let m=K.default.divide(K.default.add(o,s),K.default.BigInt(2)),p=t(m);if(p===a)o=m,a=p;else{if(p!==d)throw new Error(`invalid state in bisection ${a} - ${p} - ${d}`);s=m,d=p}}return s}var bfe={hour:36e11,minute:6e10,second:1e9,millisecond:1e6,microsecond:1e3,nanosecond:1},wfe=Symbol("date"),_fe=Symbol("ym"),xfe=Symbol("md"),Efe=Symbol("time"),Sfe=Symbol("datetime"),Mfe=Symbol("instant"),Ub=Symbol("original"),Cb=Symbol("timezone"),ef=Symbol("calendar-id"),Pfe=Symbol("locale"),jD=Symbol("options"),W_=t=>({value:t,enumerable:!0,writable:!1,configurable:!0}),Fb=globalThis.Intl.DateTimeFormat,nh=Object.assign,Vqe=Object.prototype.hasOwnProperty,Hqe=Reflect.apply;function Db(t,e){let r=t[e];return typeof r=="function"&&(r=new Fb(t[Pfe],r(t[jD])),t[e]=r),r}function wy(t,e={}){if(!(this instanceof wy))return new wy(t,e);let r=e!==void 0,n=r?nh({},e):{},i=new Fb(t,n),o=i.resolvedOptions();if(r){let s=nh({},o);for(let a in s)Hqe(Vqe,n,[a])||delete s[a];this[jD]=s}else this[jD]=n;this[Pfe]=o.locale,this[Ub]=i,this[Cb]=o.timeZone,this[ef]=o.calendar,this[wfe]=Qqe,this[_fe]=Jqe,this[xfe]=Yqe,this[Efe]=Zqe,this[Sfe]=Xqe,this[Mfe]=e$e}Object.defineProperty(wy,"name",{writable:!0,value:"DateTimeFormat"}),wy.supportedLocalesOf=function(t,e){return Fb.supportedLocalesOf(t,e)};var xD={resolvedOptions:W_(function(){return this[Ub].resolvedOptions()}),format:W_(function(e,...r){let{instant:n,formatter:i}=zb(e,this);return n&&i?i.format(n.epochMilliseconds):this[Ub].format(e,...r)}),formatRange:W_(function(e,r){if(Qb(e)||Qb(r)){if(!Afe(e,r))throw new TypeError("Intl.DateTimeFormat.formatRange accepts two values of the same type");let{instant:n,formatter:i}=zb(e,this),{instant:o,formatter:s}=zb(r,this);if(n&&o&&i&&s&&i===s)return i.formatRange(n.epochMilliseconds,o.epochMilliseconds)}return this[Ub].formatRange(e,r)})};"formatToParts"in Fb.prototype&&(xD.formatToParts=W_(function(e,...r){let{instant:n,formatter:i}=zb(e,this);return n&&i?i.formatToParts(n.epochMilliseconds):this[Ub].formatToParts(e,...r)})),"formatRangeToParts"in Fb.prototype&&(xD.formatRangeToParts=W_(function(e,r){if(Qb(e)||Qb(r)){if(!Afe(e,r))throw new TypeError("Intl.DateTimeFormat.formatRangeToParts accepts two values of the same type");let{instant:n,formatter:i}=zb(e,this),{instant:o,formatter:s}=zb(r,this);if(n&&o&&i&&s&&i===s)return i.formatRangeToParts(n.epochMilliseconds,o.epochMilliseconds)}return this[Ub].formatRangeToParts(e,r)})),wy.prototype=Object.create(Fb.prototype,xD),Object.defineProperty(wy,"prototype",{writable:!1,enumerable:!1,configurable:!1});var ih=wy;function dx(t={},e={}){let r=nh({},t);for(let n of["year","month","day","hour","minute","second","weekday","dayPeriod","timeZoneName","dateStyle","timeStyle"])r[n]=n in e?e[n]:r[n],r[n]!==!1&&r[n]!==void 0||delete r[n];return r}function Zqe(t){let e=dx(t,{year:!1,month:!1,day:!1,weekday:!1,timeZoneName:!1,dateStyle:!1});return SC(e)||(e=nh({},e,{hour:"numeric",minute:"numeric",second:"numeric"})),e}function Jqe(t){let e=dx(t,{day:!1,hour:!1,minute:!1,second:!1,weekday:!1,dayPeriod:!1,timeZoneName:!1,dateStyle:!1,timeStyle:!1});return"year"in e||"month"in e||(e=nh(e,{year:"numeric",month:"numeric"})),e}function Yqe(t){let e=dx(t,{year:!1,hour:!1,minute:!1,second:!1,weekday:!1,dayPeriod:!1,timeZoneName:!1,dateStyle:!1,timeStyle:!1});return"month"in e||"day"in e||(e=nh({},e,{month:"numeric",day:"numeric"})),e}function Qqe(t){let e=dx(t,{hour:!1,minute:!1,second:!1,dayPeriod:!1,timeZoneName:!1,timeStyle:!1});return EC(e)||(e=nh({},e,{year:"numeric",month:"numeric",day:"numeric"})),e}function Xqe(t){let e=dx(t,{timeZoneName:!1});return SC(e)||EC(e)||(e=nh({},e,{year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric"})),e}function e$e(t){let e=t;return SC(e)||EC(e)||(e=nh({},e,{year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric"})),e}function EC(t){return"year"in t||"month"in t||"day"in t||"weekday"in t||"dateStyle"in t}function SC(t){return"hour"in t||"minute"in t||"second"in t||"timeStyle"in t||"dayPeriod"in t}function Qb(t){return Jt(t)||Ln(t)||kt(t)||Qe(t)||Ar(t)||Ui(t)||Ii(t)}function Afe(t,e){return!(!Qb(t)||!Qb(e))&&!(Ln(t)&&!Ln(e))&&!(Jt(t)&&!Jt(e))&&!(kt(t)&&!kt(e))&&!(Qe(t)&&!Qe(e))&&!(Ar(t)&&!Ar(e))&&!(Ui(t)&&!Ui(e))&&!(Ii(t)&&!Ii(e))}function zb(t,e){let r=Fe("%Temporal.PlainDateTime%");if(Ln(t)){let n=new r(1970,1,1,D(t,Ot),D(t,Bt),D(t,Dt),D(t,Ct),D(t,jt),D(t,Nt),e[ef]);return{instant:ss(e[Cb],n,"compatible"),formatter:Db(e,Efe)}}if(Ar(t)){let n=D(t,Ge),i=D(t,He),o=D(t,Je),s=go(D(t,we));if(s!==e[ef])throw new RangeError(`cannot format PlainYearMonth with calendar ${s} in locale with calendar ${e[ef]}`);let a=new r(n,i,o,12,0,0,0,0,0,s);return{instant:ss(e[Cb],a,"compatible"),formatter:Db(e,_fe)}}if(Ui(t)){let n=D(t,Ge),i=D(t,He),o=D(t,Je),s=go(D(t,we));if(s!==e[ef])throw new RangeError(`cannot format PlainMonthDay with calendar ${s} in locale with calendar ${e[ef]}`);let a=new r(n,i,o,12,0,0,0,0,0,s);return{instant:ss(e[Cb],a,"compatible"),formatter:Db(e,xfe)}}if(Jt(t)){let n=D(t,Ge),i=D(t,He),o=D(t,Je),s=go(D(t,we));if(s!=="iso8601"&&s!==e[ef])throw new RangeError(`cannot format PlainDate with calendar ${s} in locale with calendar ${e[ef]}`);let a=new r(n,i,o,12,0,0,0,0,0,e[ef]);return{instant:ss(e[Cb],a,"compatible"),formatter:Db(e,wfe)}}if(kt(t)){let n=D(t,Ge),i=D(t,He),o=D(t,Je),s=D(t,Ot),a=D(t,Bt),d=D(t,Dt),m=D(t,Ct),p=D(t,jt),w=D(t,Nt),P=go(D(t,we));if(P!=="iso8601"&&P!==e[ef])throw new RangeError(`cannot format PlainDateTime with calendar ${P} in locale with calendar ${e[ef]}`);let S=t;return P==="iso8601"&&(S=new r(n,i,o,s,a,d,m,p,w,e[ef])),{instant:ss(e[Cb],S,"compatible"),formatter:Db(e,Sfe)}}if(Qe(t))throw new TypeError("Temporal.ZonedDateTime not supported in DateTimeFormat methods. Use toLocaleString() instead.");return Ii(t)?{instant:t,formatter:Db(e,Mfe)}:{}}var y2t=Object.freeze({__proto__:null,DateTimeFormat:ih}),ac=class{constructor(e){if(arguments.length<1)throw new TypeError("missing argument: epochNanoseconds is required");let r=G_(e);uy(r),_l(this),Ft(this,mt,r)}get epochSeconds(){if(!Ii(this))throw new TypeError("invalid receiver");let e=D(this,mt);return K.default.toNumber(Lb(e,ml))}get epochMilliseconds(){if(!Ii(this))throw new TypeError("invalid receiver");let e=K.default.BigInt(D(this,mt));return K.default.toNumber(Lb(e,cc))}get epochMicroseconds(){if(!Ii(this))throw new TypeError("invalid receiver");return R8(Lb(K.default.BigInt(D(this,mt)),Tr))}get epochNanoseconds(){if(!Ii(this))throw new TypeError("invalid receiver");return R8(K.default.BigInt(D(this,mt)))}add(e){if(!Ii(this))throw new TypeError("invalid receiver");return _ce("add",this,e)}subtract(e){if(!Ii(this))throw new TypeError("invalid receiver");return _ce("subtract",this,e)}until(e,r){if(!Ii(this))throw new TypeError("invalid receiver");return pce("until",this,e,r)}since(e,r){if(!Ii(this))throw new TypeError("invalid receiver");return pce("since",this,e,r)}round(e){if(!Ii(this))throw new TypeError("invalid receiver");if(e===void 0)throw new TypeError("options parameter is required");let r=typeof e=="string"?Yb("smallestUnit",e):Xt(e),n=tw(r),i=Xf(r,"halfExpand"),o=ca(r,"smallestUnit","time",yy);rw(n,{hour:24,minute:1440,second:86400,millisecond:864e5,microsecond:864e8,nanosecond:864e11}[o],!0);let s=T8(D(this,mt),n,o,i);return new ac(s)}equals(e){if(!Ii(this))throw new TypeError("invalid receiver");let r=Qf(e),n=D(this,mt),i=D(r,mt);return K.default.equal(K.default.BigInt(n),K.default.BigInt(i))}toString(e){if(!Ii(this))throw new TypeError("invalid receiver");let r=Xt(e),n=ox(r),i=Xf(r,"trunc"),o=ca(r,"smallestUnit","time",void 0);if(o==="hour")throw new RangeError('smallestUnit must be a time unit other than "hour"');let s=r.timeZone;s!==void 0&&(s=No(s));let{precision:a,unit:d,increment:m}=sx(o,n),p=T8(D(this,mt),m,d,i);return oce(new ac(p),s,a)}toJSON(){if(!Ii(this))throw new TypeError("invalid receiver");return oce(this,void 0,"auto")}toLocaleString(e,r){if(!Ii(this))throw new TypeError("invalid receiver");return new ih(e,r).format(this)}valueOf(){throw new TypeError("use compare() or equals() to compare Temporal.Instant")}toZonedDateTime(e){if(!Ii(this))throw new TypeError("invalid receiver");if(!pn(e))throw new TypeError("invalid argument in toZonedDateTime");let r=e.calendar;if(r===void 0)throw new TypeError("missing calendar property in toZonedDateTime");let n=fa(r),i=e.timeZone;if(i===void 0)throw new TypeError("missing timeZone property in toZonedDateTime");let o=No(i);return po(D(this,mt),o,n)}toZonedDateTimeISO(e){if(!Ii(this))throw new TypeError("invalid receiver");let r=No(e);return po(D(this,mt),r,"iso8601")}static fromEpochSeconds(e){let r=Wb(e),n=K.default.multiply(K.default.BigInt(r),ml);return uy(n),new ac(n)}static fromEpochMilliseconds(e){let r=Wb(e),n=K.default.multiply(K.default.BigInt(r),cc);return uy(n),new ac(n)}static fromEpochMicroseconds(e){let r=G_(e),n=K.default.multiply(r,Tr);return uy(n),new ac(n)}static fromEpochNanoseconds(e){let r=G_(e);return uy(r),new ac(r)}static from(e){return Ii(e)?new ac(D(e,mt)):Qf(e)}static compare(e,r){let n=Qf(e),i=Qf(r),o=D(n,mt),s=D(i,mt);return K.default.lessThan(o,s)?-1:K.default.greaterThan(o,s)?1:0}};wl(ac,"Temporal.Instant");var Tfe=Array.prototype.includes,t$e=Array.prototype.push,r$e=globalThis.Intl.DateTimeFormat,n$e=Array.prototype.sort,i$e=Math.abs,o$e=Math.floor,ED=Object.create,ND=Object.entries,Rfe=Set,Pce=Reflect.ownKeys,Do=Set.prototype.add,Ife=Set.prototype.values,wn={},bn=class{constructor(e){if(arguments.length<1)throw new RangeError("missing argument: id is required");let r=as(e);if(!rh(r))throw new RangeError(`invalid calendar identifier ${r}`);_l(this),Ft(this,Rn,bl(r))}get id(){if(!qn(this))throw new TypeError("invalid receiver");return D(this,Rn)}dateFromFields(e,r){if(!qn(this))throw new TypeError("invalid receiver");if(!pn(e))throw new TypeError("invalid fields");let n=Xt(r),i=D(this,Rn);return wn[i].dateFromFields(e,n,i)}yearMonthFromFields(e,r){if(!qn(this))throw new TypeError("invalid receiver");if(!pn(e))throw new TypeError("invalid fields");let n=Xt(r),i=D(this,Rn);return wn[i].yearMonthFromFields(e,n,i)}monthDayFromFields(e,r){if(!qn(this))throw new TypeError("invalid receiver");if(!pn(e))throw new TypeError("invalid fields");let n=Xt(r),i=D(this,Rn);return wn[i].monthDayFromFields(e,n,i)}fields(e){if(!qn(this))throw new TypeError("invalid receiver");let r=[],n=new Set(["year","month","monthCode","day","hour","minute","second","millisecond","microsecond","nanosecond"]);for(let i of e){if(typeof i!="string")throw new TypeError("invalid fields");if(!n.has(i))throw new RangeError(`invalid field name ${i}`);n.delete(i),t$e.call(r,i)}return wn[D(this,Rn)].fields(r)}mergeFields(e,r){if(!qn(this))throw new TypeError("invalid receiver");let n=nce(e),i=ED(null);qb(i,n,[],[void 0]);let o=nce(r),s=ED(null);qb(s,o,[],[void 0]);let a=Pce(s),d=wn[D(this,Rn)].fieldKeysToIgnore(a),m=ED(null),p=Pce(i);for(let w of p){let P;P=nt(Tfe,d,[w])?s[w]:i[w],P!==void 0&&(m[w]=P)}return qb(m,s,[]),m}dateAdd(e,r,n){if(!qn(this))throw new TypeError("invalid receiver");let i=Wr(e),o=$b(r),s=ni(Xt(n)),{days:a}=tf(D(o,Qo),D(o,Xo),D(o,es),D(o,ts),D(o,rs),D(o,ns),D(o,is),"day"),d=D(this,Rn);return wn[d].dateAdd(i,D(o,Yo),D(o,Xi),D(o,Ls),a,s,d)}dateUntil(e,r,n){if(!qn(this))throw new TypeError("invalid receiver");let i=Wr(e),o=Wr(r),s=ca(Xt(n),"largestUnit","date","auto");s==="auto"&&(s="day");let{years:a,months:d,weeks:m,days:p}=wn[D(this,Rn)].dateUntil(i,o,s);return new(Fe("%Temporal.Duration%"))(a,d,m,p,0,0,0,0,0,0)}year(e){let r=e;if(!qn(this))throw new TypeError("invalid receiver");return Ar(r)||(r=Wr(r)),wn[D(this,Rn)].year(r)}month(e){let r=e;if(!qn(this))throw new TypeError("invalid receiver");if(Ui(r))throw new TypeError("use monthCode on PlainMonthDay instead");return Ar(r)||(r=Wr(r)),wn[D(this,Rn)].month(r)}monthCode(e){let r=e;if(!qn(this))throw new TypeError("invalid receiver");return Ar(r)||Ui(r)||(r=Wr(r)),wn[D(this,Rn)].monthCode(r)}day(e){let r=e;if(!qn(this))throw new TypeError("invalid receiver");return Ui(r)||(r=Wr(r)),wn[D(this,Rn)].day(r)}era(e){let r=e;if(!qn(this))throw new TypeError("invalid receiver");return Ar(r)||(r=Wr(r)),wn[D(this,Rn)].era(r)}eraYear(e){let r=e;if(!qn(this))throw new TypeError("invalid receiver");return Ar(r)||(r=Wr(r)),wn[D(this,Rn)].eraYear(r)}dayOfWeek(e){if(!qn(this))throw new TypeError("invalid receiver");let r=Wr(e);return wn[D(this,Rn)].dayOfWeek(r)}dayOfYear(e){if(!qn(this))throw new TypeError("invalid receiver");let r=Wr(e);return wn[D(this,Rn)].dayOfYear(r)}weekOfYear(e){if(!qn(this))throw new TypeError("invalid receiver");let r=Wr(e);return wn[D(this,Rn)].weekOfYear(r)}yearOfWeek(e){if(!qn(this))throw new TypeError("invalid receiver");let r=Wr(e);return wn[D(this,Rn)].yearOfWeek(r)}daysInWeek(e){if(!qn(this))throw new TypeError("invalid receiver");let r=Wr(e);return wn[D(this,Rn)].daysInWeek(r)}daysInMonth(e){let r=e;if(!qn(this))throw new TypeError("invalid receiver");return Ar(r)||(r=Wr(r)),wn[D(this,Rn)].daysInMonth(r)}daysInYear(e){let r=e;if(!qn(this))throw new TypeError("invalid receiver");return Ar(r)||(r=Wr(r)),wn[D(this,Rn)].daysInYear(r)}monthsInYear(e){let r=e;if(!qn(this))throw new TypeError("invalid receiver");return Ar(r)||(r=Wr(r)),wn[D(this,Rn)].monthsInYear(r)}inLeapYear(e){let r=e;if(!qn(this))throw new TypeError("invalid receiver");return Ar(r)||(r=Wr(r)),wn[D(this,Rn)].inLeapYear(r)}toString(){if(!qn(this))throw new TypeError("invalid receiver");return D(this,Rn)}toJSON(){if(!qn(this))throw new TypeError("invalid receiver");return D(this,Rn)}static from(e){return nw(fa(e))}};function MC(t){if(!t.startsWith("M"))throw new RangeError(`Invalid month code: ${t}. Month codes must start with M.`);let e=+t.slice(1);if(isNaN(e))throw new RangeError(`Invalid month code: ${t}`);return e}function Qd(t,e=!1){return`M${t.toString().padStart(2,"0")}${e?"L":""}`}function m8(t,e,r=12){let{month:n,monthCode:i}=t;if(i===void 0){if(n===void 0)throw new TypeError("Either month or monthCode are required");e==="reject"&&yo(n,1,r),e==="constrain"&&(n=sa(n,1,r)),i=Qd(n)}else{let o=MC(i);if(n!==void 0&&n!==o)throw new RangeError(`monthCode ${i} and month ${n} must match if both are present`);if(i!==Qd(o))throw new RangeError(`Invalid month code: ${i}`);if(n=o,n<1||n>r)throw new RangeError(`Invalid monthCode: ${i}`)}return{...t,month:n,monthCode:i}}wl(bn,"Temporal.Calendar"),In("Temporal.Calendar.from",bn.from),In("Temporal.Calendar.prototype.dateAdd",bn.prototype.dateAdd),In("Temporal.Calendar.prototype.dateFromFields",bn.prototype.dateFromFields),In("Temporal.Calendar.prototype.dateUntil",bn.prototype.dateUntil),In("Temporal.Calendar.prototype.day",bn.prototype.day),In("Temporal.Calendar.prototype.dayOfWeek",bn.prototype.dayOfWeek),In("Temporal.Calendar.prototype.dayOfYear",bn.prototype.dayOfYear),In("Temporal.Calendar.prototype.daysInMonth",bn.prototype.daysInMonth),In("Temporal.Calendar.prototype.daysInWeek",bn.prototype.daysInWeek),In("Temporal.Calendar.prototype.daysInYear",bn.prototype.daysInYear),In("Temporal.Calendar.prototype.era",bn.prototype.era),In("Temporal.Calendar.prototype.eraYear",bn.prototype.eraYear),In("Temporal.Calendar.prototype.fields",bn.prototype.fields),In("Temporal.Calendar.prototype.inLeapYear",bn.prototype.inLeapYear),In("Temporal.Calendar.prototype.mergeFields",bn.prototype.mergeFields),In("Temporal.Calendar.prototype.month",bn.prototype.month),In("Temporal.Calendar.prototype.monthCode",bn.prototype.monthCode),In("Temporal.Calendar.prototype.monthDayFromFields",bn.prototype.monthDayFromFields),In("Temporal.Calendar.prototype.monthsInYear",bn.prototype.monthsInYear),In("Temporal.Calendar.prototype.weekOfYear",bn.prototype.weekOfYear),In("Temporal.Calendar.prototype.year",bn.prototype.year),In("Temporal.Calendar.prototype.yearMonthFromFields",bn.prototype.yearMonthFromFields),In("Temporal.Calendar.prototype.yearOfWeek",bn.prototype.yearOfWeek),wn.iso8601={dateFromFields(t,e,r){let n=Gt(t,["day","month","monthCode","year"],["year","day"]),i=ni(e);n=m8(n);let{year:o,month:s,day:a}=n;return{year:o,month:s,day:a}=_8(o,s,a,i),uc(o,s,a,r)},yearMonthFromFields(t,e,r){let n=Gt(t,["month","monthCode","year"],["year"]),i=ni(e);n=m8(n);let{year:o,month:s}=n;return{year:o,month:s}=function(d,m,p){let w=d,P=m;switch(p){case"reject":vl(w,P,1);break;case"constrain":({year:w,month:P}=cfe(w,P))}return{year:w,month:P}}(o,s,i),Z_(o,s,r,1)},monthDayFromFields(t,e,r){let n=Gt(t,["day","month","monthCode","year"],["day"]),i=ni(e);if(n.month!==void 0&&n.year===void 0&&n.monthCode===void 0)throw new TypeError("either year or monthCode required with month");let o=n.monthCode===void 0;n=m8(n);let{month:s,day:a,year:d}=n;return{month:s,day:a}=_8(o?d:1972,s,a,i),H_(s,a,r,1972)},fields:t=>t,fieldKeysToIgnore(t){let e=new Rfe;for(let r=0;r<t.length;r++){let n=t[r];nt(Do,e,[n]),n==="month"?nt(Do,e,["monthCode"]):n==="monthCode"&&nt(Do,e,["month"])}return[...nt(Ife,e,[])]},dateAdd(t,e,r,n,i,o,s){let a=D(t,Ge),d=D(t,He),m=D(t,Je);return{year:a,month:d,day:m}=hy(a,d,m,e,r,n,i,o),uc(a,d,m,s)},dateUntil:(t,e,r)=>gC(D(t,Ge),D(t,He),D(t,Je),D(e,Ge),D(e,He),D(e,Je),r),year:t=>D(t,Ge),era(){},eraYear(){},month:t=>D(t,He),monthCode:t=>Qd(D(t,He)),day:t=>D(t,Je),dayOfWeek:t=>BD(D(t,Ge),D(t,He),D(t,Je)),dayOfYear:t=>P8(D(t,Ge),D(t,He),D(t,Je)),weekOfYear:t=>dce(D(t,Ge),D(t,He),D(t,Je)).week,yearOfWeek:t=>dce(D(t,Ge),D(t,He),D(t,Je)).year,daysInWeek:()=>7,daysInMonth:t=>Yd(D(t,Ge),D(t,He)),daysInYear(t){let e=t;return zi(e,Ge)||(e=Wr(e)),$p(D(e,Ge))?366:365},monthsInYear:()=>12,inLeapYear(t){let e=t;return zi(e,Ge)||(e=Wr(e)),$p(D(e,Ge))}};var dn=class{constructor(e){if(this.map=new Map,this.calls=0,this.hits=0,this.misses=0,this.now=globalThis.performance?globalThis.performance.now():Date.now(),e!==void 0){let r=0;for(let n of e.map.entries()){if(++r>dn.MAX_CACHE_ENTRIES)break;this.map.set(...n)}}}get(e){let r=this.map.get(e);return r&&(this.hits++,this.report()),this.calls++,r}set(e,r){this.map.set(e,r),this.misses++,this.report()}report(){}setObject(e){if(dn.objectMap.get(e))throw new RangeError("object already cached");dn.objectMap.set(e,this),this.report()}static getCacheForObject(e){let r=dn.objectMap.get(e);return r||(r=new dn,dn.objectMap.set(e,r)),r}};function kfe({isoYear:t,isoMonth:e,isoDay:r}){return`${My(t)}-${_n(e)}-${_n(r)}T00:00Z`}function SD(t,e){return{years:t.year-e.year,months:t.month-e.month,days:t.day-e.day}}dn.objectMap=new WeakMap,dn.MAX_CACHE_ENTRIES=1e3;var Up=class{constructor(){this.eraLength="short",this.hasEra=!0,this.erasBeginMidYear=!1}getFormatter(){return this.formatter===void 0&&(this.formatter=new r$e(`en-US-u-ca-${this.id}`,{day:"numeric",month:"numeric",year:"numeric",era:this.eraLength,timeZone:"UTC"})),this.formatter}isoToCalendarDate(e,r){let{year:n,month:i,day:o}=e,s=JSON.stringify({func:"isoToCalendarDate",isoYear:n,isoMonth:i,isoDay:o,id:this.id}),a=r.get(s);if(a)return a;let d=this.getFormatter(),m,p;try{p=kfe({isoYear:n,isoMonth:i,isoDay:o}),m=d.formatToParts(new Date(p))}catch{throw new RangeError(`Invalid ISO date: ${JSON.stringify({isoYear:n,isoMonth:i,isoDay:o})}`)}let w={};for(let{type:S,value:M}of m){if(S==="year"&&(w.eraYear=+M),S==="relatedYear"&&(w.eraYear=+M),S==="month"){let A=/^([0-9]*)(.*?)$/.exec(M);if(!A||A.length!=3||!A[1]&&!A[2])throw new RangeError(`Unexpected month: ${M}`);if(w.month=A[1]?+A[1]:1,w.month<1)throw new RangeError(`Invalid month ${M} from ${p}[u-ca-${this.id}] (probably due to https://bugs.chromium.org/p/v8/issues/detail?id=10527)`);if(w.month>13)throw new RangeError(`Invalid month ${M} from ${p}[u-ca-${this.id}] (probably due to https://bugs.chromium.org/p/v8/issues/detail?id=10529)`);A[2]&&(w.monthExtra=A[2])}S==="day"&&(w.day=+M),this.hasEra&&S==="era"&&M!=null&&M!==""&&(M=M.split(" (")[0],w.era=M.normalize("NFD").replace(/[^-0-9 \p{L}]/gu,"").replace(" ","-").toLowerCase())}if(w.eraYear===void 0)throw new RangeError(`Intl.DateTimeFormat.formatToParts lacks relatedYear in ${this.id} calendar. Try Node 14+ or modern browsers.`);if(this.reviseIntlEra){let{era:S,eraYear:M}=this.reviseIntlEra(w,e);w.era=S,w.eraYear=M}this.checkIcuBugs&&this.checkIcuBugs(e);let P=this.adjustCalendarDate(w,r,"constrain",!0);if(P.year===void 0)throw new RangeError(`Missing year converting ${JSON.stringify(e)}`);if(P.month===void 0)throw new RangeError(`Missing month converting ${JSON.stringify(e)}`);if(P.day===void 0)throw new RangeError(`Missing day converting ${JSON.stringify(e)}`);return r.set(s,P),["constrain","reject"].forEach(S=>{let M=JSON.stringify({func:"calendarToIsoDate",year:P.year,month:P.month,day:P.day,overflow:S,id:this.id});r.set(M,e)}),P}validateCalendarDate(e){let{era:r,month:n,year:i,day:o,eraYear:s,monthCode:a,monthExtra:d}=e;if(d!==void 0)throw new RangeError("Unexpected `monthExtra` value");if(i===void 0&&s===void 0)throw new TypeError("year or eraYear is required");if(n===void 0&&a===void 0)throw new TypeError("month or monthCode is required");if(o===void 0)throw new RangeError("Missing day");if(a!==void 0){if(typeof a!="string")throw new RangeError("monthCode must be a string, not "+typeof a);if(!/^M([01]?\d)(L?)$/.test(a))throw new RangeError(`Invalid monthCode: ${a}`)}if(this.constantEra){if(r!==void 0&&r!==this.constantEra)throw new RangeError(`era must be ${this.constantEra}, not ${r}`);if(s!==void 0&&i!==void 0&&s!==i)throw new RangeError(`eraYear ${s} does not match year ${i}`)}if(this.hasEra&&e.era===void 0!=(e.eraYear===void 0))throw new RangeError("properties 'era' and 'eraYear' must be provided together")}adjustCalendarDate(e,r,n="constrain",i=!1){if(this.calendarType==="lunisolar")throw new RangeError("Override required for lunisolar calendars");let o=e;if(this.validateCalendarDate(o),this.constantEra){let{year:m,eraYear:p}=o;o={...o,era:this.constantEra,year:m!==void 0?m:p,eraYear:p!==void 0?p:m}}let s=this.monthsInYear(o,r),{month:a,monthCode:d}=o;return{month:a,monthCode:d}=m8(o,n,s),{...o,month:a,monthCode:d}}regulateMonthDayNaive(e,r,n){let i=this.monthsInYear(e,n),{month:o,day:s}=e;return r==="reject"?(yo(o,1,i),yo(s,1,this.maximumMonthLength(e))):(o=sa(o,1,i),s=sa(s,1,this.maximumMonthLength({...e,month:o}))),{...e,month:o,day:s}}calendarToIsoDate(e,r="constrain",n){let i=e,o=this.adjustCalendarDate(e,n,r,!1);o=this.regulateMonthDayNaive(o,r,n);let{year:s,month:a,day:d}=o,m=JSON.stringify({func:"calendarToIsoDate",year:s,month:a,day:d,overflow:r,id:this.id}),p,w=n.get(m);if(w||i.year!==void 0&&i.month!==void 0&&i.day!==void 0&&(i.year!==o.year||i.month!==o.month||i.day!==o.day)&&(p=JSON.stringify({func:"calendarToIsoDate",year:i.year,month:i.month,day:i.day,overflow:r,id:this.id}),w=n.get(p),w))return w;let P=this.estimateIsoDate({year:s,month:a,day:d}),S=C=>{let k=this.addDaysIso(P,C);if(o.day>this.minimumMonthLength(o)){let q=this.isoToCalendarDate(k,n);for(;q.month!==a||q.year!==s;){if(r==="reject")throw new RangeError(`day ${d} does not exist in month ${a} of year ${s}`);k=this.addDaysIso(k,-1),q=this.isoToCalendarDate(k,n)}}return k},M=0,A=this.isoToCalendarDate(P,n),B=SD(o,A);if(B.years!==0||B.months!==0||B.days!==0){let C=365*B.years+30*B.months+B.days;P=this.addDaysIso(P,C),A=this.isoToCalendarDate(P,n),B=SD(o,A),B.years===0&&B.months===0?P=S(B.days):M=this.compareCalendarDates(o,A)}let I=8;for(;M;){P=this.addDaysIso(P,M*I);let C=A;A=this.isoToCalendarDate(P,n);let k=M;if(M=this.compareCalendarDates(o,A),M){if(B=SD(o,A),B.years===0&&B.months===0)P=S(B.days),M=0;else if(k&&M!==k)if(I>1)I/=2;else{if(r==="reject")throw new RangeError(`Can't find ISO date from calendar date: ${JSON.stringify({...i})}`);this.compareCalendarDates(A,C)>0&&(P=this.addDaysIso(P,-1)),M=0}}}if(n.set(m,P),p&&n.set(p,P),o.year===void 0||o.month===void 0||o.day===void 0||o.monthCode===void 0||this.hasEra&&(o.era===void 0||o.eraYear===void 0))throw new RangeError("Unexpected missing property");return P}temporalToCalendarDate(e,r){let n={year:D(e,Ge),month:D(e,He),day:D(e,Je)};return this.isoToCalendarDate(n,r)}compareCalendarDates(e,r){let n=Gt(e,["day","month","year"],["day","month","year"]),i=Gt(r,["day","month","year"],["day","month","year"]);return n.year!==i.year?py(n.year-i.year):n.month!==i.month?py(n.month-i.month):n.day!==i.day?py(n.day-i.day):0}regulateDate(e,r="constrain",n){let i=this.calendarToIsoDate(e,r,n);return this.isoToCalendarDate(i,n)}addDaysIso(e,r){return hy(e.year,e.month,e.day,0,0,0,r,"constrain")}addDaysCalendar(e,r,n){let i=this.calendarToIsoDate(e,"constrain",n),o=this.addDaysIso(i,r);return this.isoToCalendarDate(o,n)}addMonthsCalendar(e,r,n,i){let o=e,{day:s}=o;for(let a=0,d=i$e(r);a<d;a++){let{month:m}=o,p=o,w=r<0?-Math.max(s,this.daysInPreviousMonth(o,i)):this.daysInMonth(o,i),P=this.calendarToIsoDate(o,"constrain",i),S=this.addDaysIso(P,w);if(o=this.isoToCalendarDate(S,i),r>0){let M=this.monthsInYear(p,i);for(;o.month-1!=m%M;)S=this.addDaysIso(S,-1),o=this.isoToCalendarDate(S,i)}o.day!==s&&(o=this.regulateDate({...o,day:s},"constrain",i))}if(n==="reject"&&o.day!==s)throw new RangeError(`Day ${s} does not exist in resulting calendar month`);return o}addCalendar(e,{years:r=0,months:n=0,weeks:i=0,days:o=0},s,a){let{year:d,day:m,monthCode:p}=e,w=this.adjustCalendarDate({year:d+r,monthCode:p,day:m},a),P=this.addMonthsCalendar(w,n,s,a),S=o+7*i;return this.addDaysCalendar(P,S,a)}untilCalendar(e,r,n,i){let o=0,s=0,a=0,d=0;switch(n){case"day":o=this.calendarDaysUntil(e,r,i);break;case"week":{let m=this.calendarDaysUntil(e,r,i);o=m%7,s=(m-o)/7;break}case"month":case"year":{let m=this.compareCalendarDates(r,e);if(!m)return{years:0,months:0,weeks:0,days:0};let p=r.year-e.year,w=r.day-e.day;if(n==="year"&&p){let M=0;r.monthCode>e.monthCode&&(M=1),r.monthCode<e.monthCode&&(M=-1),M||(M=Math.sign(w)),d=M*m<0?p-m:p}let P,S=d?this.addCalendar(e,{years:d},"constrain",i):e;do a+=m,P=S,S=this.addMonthsCalendar(P,m,"constrain",i),S.day!==e.day&&(S=this.regulateDate({...S,day:e.day},"constrain",i));while(this.compareCalendarDates(r,S)*m>=0);a-=m,o=this.calendarDaysUntil(P,r,i);break}}return{years:d,months:a,weeks:s,days:o}}daysInMonth(e,r){let{day:n}=e,i=this.maximumMonthLength(e),o=this.minimumMonthLength(e);if(o===i)return o;let s=n<=i-o?i:o,a=this.calendarToIsoDate(e,"constrain",r),d=this.addDaysIso(a,s),m=this.isoToCalendarDate(d,r),p=this.addDaysIso(d,-m.day);return this.isoToCalendarDate(p,r).day}daysInPreviousMonth(e,r){let{day:n,month:i,year:o}=e,s={year:i>1?o:o-1,month:i,day:1},a=i>1?i-1:this.monthsInYear(s,r);s={...s,month:a};let d=this.minimumMonthLength(s),m=this.maximumMonthLength(s);if(d===m)return m;let p=this.calendarToIsoDate(e,"constrain",r),w=this.addDaysIso(p,-n);return this.isoToCalendarDate(w,r).day}startOfCalendarYear(e){return{year:e.year,month:1,monthCode:"M01",day:1}}startOfCalendarMonth(e){return{year:e.year,month:e.month,day:1}}calendarDaysUntil(e,r,n){let i=this.calendarToIsoDate(e,"constrain",n),o=this.calendarToIsoDate(r,"constrain",n);return this.isoDaysUntil(i,o)}isoDaysUntil(e,r){return gC(e.year,e.month,e.day,r.year,r.month,r.day,"day").days}monthDayFromFields(e,r,n){let i,o,s,a,d,{monthCode:m,day:p}=e;if(m===void 0){let{year:S,era:M,eraYear:A}=e;if(S===void 0&&(M===void 0||A===void 0))throw new TypeError("when `monthCode` is omitted, `year` (or `era` and `eraYear`) and `month` are required");({monthCode:m,day:p}=this.isoToCalendarDate(this.calendarToIsoDate(e,r,n),n))}let w=this.isoToCalendarDate({year:1972,month:12,day:31},n),P=w.monthCode>m||w.monthCode===m&&w.day>=p?w.year:w.year-1;for(let S=0;S<100;S++){let M=this.adjustCalendarDate({day:p,monthCode:m,year:P-S},n),A=this.calendarToIsoDate(M,"constrain",n),B=this.isoToCalendarDate(A,n);if({year:i,month:o,day:s}=A,B.monthCode===m&&B.day===p)return{month:o,day:s,year:i};r==="constrain"&&(a===void 0||B.monthCode===a.monthCode&&B.day>a.day)&&(a=B,d=A)}if(r==="constrain"&&d!==void 0)return d;throw new RangeError(`No recent ${this.id} year with monthCode ${m} and day ${p}`)}},qD=class extends Up{constructor(){super(...arguments),this.id="hebrew",this.calendarType="lunisolar",this.months={Tishri:{leap:1,regular:1,monthCode:"M01",days:30},Heshvan:{leap:2,regular:2,monthCode:"M02",days:{min:29,max:30}},Kislev:{leap:3,regular:3,monthCode:"M03",days:{min:29,max:30}},Tevet:{leap:4,regular:4,monthCode:"M04",days:29},Shevat:{leap:5,regular:5,monthCode:"M05",days:30},Adar:{leap:void 0,regular:6,monthCode:"M06",days:29},"Adar I":{leap:6,regular:void 0,monthCode:"M05L",days:30},"Adar II":{leap:7,regular:void 0,monthCode:"M06",days:29},Nisan:{leap:8,regular:7,monthCode:"M07",days:30},Iyar:{leap:9,regular:8,monthCode:"M08",days:29},Sivan:{leap:10,regular:9,monthCode:"M09",days:30},Tamuz:{leap:11,regular:10,monthCode:"M10",days:29},Av:{leap:12,regular:11,monthCode:"M11",days:30},Elul:{leap:13,regular:12,monthCode:"M12",days:29}},this.hasEra=!1}inLeapYear(e){let{year:r}=e;return(7*r+1)%19<7}monthsInYear(e){return this.inLeapYear(e)?13:12}minimumMonthLength(e){return this.minMaxMonthLength(e,"min")}maximumMonthLength(e){return this.minMaxMonthLength(e,"max")}minMaxMonthLength(e,r){let{month:n,year:i}=e,o=this.getMonthCode(i,n),s=ND(this.months).find(d=>d[1].monthCode===o);if(s===void 0)throw new RangeError(`unmatched Hebrew month: ${n}`);let a=s[1].days;return typeof a=="number"?a:a[r]}estimateIsoDate(e){let{year:r}=e;return{year:r-3760,month:1,day:1}}getMonthCode(e,r){return this.inLeapYear({year:e})?r===6?Qd(5,!0):Qd(r<6?r:r-1):Qd(r)}adjustCalendarDate(e,r,n="constrain",i=!1){let{year:o,eraYear:s,month:a,monthCode:d,day:m,monthExtra:p}=e;if(o===void 0&&s!==void 0&&(o=s),s===void 0&&o!==void 0&&(s=o),i){if(p){let w=this.months[p];if(!w)throw new RangeError(`Unrecognized month from formatToParts: ${p}`);a=this.inLeapYear({year:o})?w.leap:w.regular}return d=this.getMonthCode(o,a),{year:o,month:a,day:m,era:void 0,eraYear:s,monthCode:d}}if(this.validateCalendarDate(e),a===void 0)if(d.endsWith("L")){if(d!=="M05L")throw new RangeError(`Hebrew leap month must have monthCode M05L, not ${d}`);if(a=6,!this.inLeapYear({year:o})){if(n==="reject")throw new RangeError(`Hebrew monthCode M05L is invalid in year ${o} which is not a leap year`);a=6,d="M06"}}else{a=MC(d),this.inLeapYear({year:o})&&a>=6&&a++;let w=this.monthsInYear({year:o});if(a<1||a>w)throw new RangeError(`Invalid monthCode: ${d}`)}else if(n==="reject"?(yo(a,1,this.monthsInYear({year:o})),yo(m,1,this.maximumMonthLength({year:o,month:a}))):(a=sa(a,1,this.monthsInYear({year:o})),m=sa(m,1,this.maximumMonthLength({year:o,month:a}))),d===void 0)d=this.getMonthCode(o,a);else if(this.getMonthCode(o,a)!==d)throw new RangeError(`monthCode ${d} doesn't correspond to month ${a} in Hebrew year ${o}`);return{...e,day:m,month:a,monthCode:d,year:o,eraYear:s}}},Fp=class extends Up{constructor(){super(...arguments),this.calendarType="lunar",this.DAYS_PER_ISLAMIC_YEAR=354+11/30,this.DAYS_PER_ISO_YEAR=365.2425,this.constantEra="ah"}inLeapYear(e,r){return this.daysInMonth({year:e.year,month:12,day:1},r)===30}monthsInYear(){return 12}minimumMonthLength(){return 29}maximumMonthLength(){return 30}estimateIsoDate(e){let{year:r}=this.adjustCalendarDate(e);return{year:o$e(r*this.DAYS_PER_ISLAMIC_YEAR/this.DAYS_PER_ISO_YEAR)+622,month:1,day:1}}},I8=class extends Fp{constructor(){super(...arguments),this.id="islamic"}},$D=class extends Fp{constructor(){super(...arguments),this.id="islamic-umalqura"}},LD=class extends Fp{constructor(){super(...arguments),this.id="islamic-tbla"}},UD=class extends Fp{constructor(){super(...arguments),this.id="islamic-civil"}},FD=class extends Fp{constructor(){super(...arguments),this.id="islamic-rgsa"}},zD=class extends Fp{constructor(){super(...arguments),this.id="islamicc"}},KD=class extends Up{constructor(){super(...arguments),this.id="persian",this.calendarType="solar",this.constantEra="ap"}inLeapYear(e,r){return I8.prototype.inLeapYear.call(this,e,r)}monthsInYear(){return 12}minimumMonthLength(e){let{month:r}=e;return r===12?29:r<=6?31:30}maximumMonthLength(e){let{month:r}=e;return r===12?30:r<=6?31:30}estimateIsoDate(e){let{year:r}=this.adjustCalendarDate(e);return{year:r+621,month:1,day:1}}},GD=class extends Up{constructor(){super(...arguments),this.id="indian",this.calendarType="solar",this.constantEra="saka",this.months={1:{length:30,month:3,day:22,leap:{length:31,month:3,day:21}},2:{length:31,month:4,day:21},3:{length:31,month:5,day:22},4:{length:31,month:6,day:22},5:{length:31,month:7,day:23},6:{length:31,month:8,day:23},7:{length:30,month:9,day:23},8:{length:30,month:10,day:23},9:{length:30,month:11,day:22},10:{length:30,month:12,day:22},11:{length:30,month:1,nextYear:!0,day:21},12:{length:30,month:2,nextYear:!0,day:20}},this.vulnerableToBceBug=new Date("0000-01-01T00:00Z").toLocaleDateString("en-US-u-ca-indian",{timeZone:"UTC"})!=="10/11/-79 Saka"}inLeapYear(e){return Ofe(e.year+78)}monthsInYear(){return 12}minimumMonthLength(e){return this.getMonthInfo(e).length}maximumMonthLength(e){return this.getMonthInfo(e).length}getMonthInfo(e){let{month:r}=e,n=this.months[r];if(n===void 0)throw new RangeError(`Invalid month: ${r}`);return this.inLeapYear(e)&&n.leap&&(n=n.leap),n}estimateIsoDate(e){let r=this.adjustCalendarDate(e),n=this.getMonthInfo(r);return hy(r.year+78+(n.nextYear?1:0),n.month,n.day,0,0,0,r.day-1,"constrain")}checkIcuBugs(e){if(this.vulnerableToBceBug&&e.year<1)throw new RangeError(`calendar '${this.id}' is broken for ISO dates before 0001-01-01 (see https://bugs.chromium.org/p/v8/issues/detail?id=10529)`)}};function Ofe(t){return t%4==0&&(t%100!=0||t%400==0)}var _y=class extends Up{constructor(e,r){super(),this.calendarType="solar",this.v8IsVulnerableToJulianBug=new Date("+001001-01-01T00:00Z").toLocaleDateString("en-US-u-ca-japanese",{timeZone:"UTC"}).startsWith("12"),this.calendarIsVulnerableToJulianBug=!1,this.id=e;let{eras:n,anchorEra:i}=function(s){let a,d=s;if(d.length===0)throw new RangeError("Invalid era data: eras are required");if(d.length===1&&d[0].reverseOf)throw new RangeError("Invalid era data: anchor era cannot count years backwards");if(d.length===1&&!d[0].name)throw new RangeError("Invalid era data: at least one named era is required");if(d.filter(p=>p.reverseOf!=null).length>1)throw new RangeError("Invalid era data: only one era can count years backwards");d.forEach(p=>{if(p.isAnchor||!p.anchorEpoch&&!p.reverseOf){if(a)throw new RangeError("Invalid era data: cannot have multiple anchor eras");a=p,p.anchorEpoch={year:p.hasYearZero?0:1}}else if(!p.name)throw new RangeError("If era name is blank, it must be the anchor era")}),d=d.filter(p=>p.name),d.forEach(p=>{let{reverseOf:w}=p;if(w){let P=d.find(S=>S.name===w);if(P===void 0)throw new RangeError(`Invalid era data: unmatched reverseOf era: ${w}`);p.reverseOf=P,p.anchorEpoch=P.anchorEpoch,p.isoEpoch=P.isoEpoch}p.anchorEpoch.month===void 0&&(p.anchorEpoch.month=1),p.anchorEpoch.day===void 0&&(p.anchorEpoch.day=1)}),n$e.call(d,(p,w)=>{if(p.reverseOf)return 1;if(w.reverseOf)return-1;if(!p.isoEpoch||!w.isoEpoch)throw new RangeError("Invalid era data: missing ISO epoch");return w.isoEpoch.year-p.isoEpoch.year});let m=d[d.length-1].reverseOf;if(m&&m!==d[d.length-2])throw new RangeError("Invalid era data: invalid reverse-sign era");return d.forEach((p,w)=>{p.genericName="era"+(d.length-1-w)}),{eras:d,anchorEra:a||d[0]}}(r);this.anchorEra=i,this.eras=n}inLeapYear(e){let{year:r}=this.estimateIsoDate({month:1,day:1,year:e.year});return Ofe(r)}monthsInYear(){return 12}minimumMonthLength(e){let{month:r}=e;return r===2?this.inLeapYear(e)?29:28:[4,6,9,11].indexOf(r)>=0?30:31}maximumMonthLength(e){return this.minimumMonthLength(e)}completeEraYear(e){let r=(a,d)=>{let m=e[a];if(m!=null&&m!=d)throw new RangeError(`Input ${a} ${m} doesn't match calculated value ${d}`)},n=a=>{let d,m={...e,year:a},p=this.eras.find((w,P)=>{if(P===this.eras.length-1){if(w.reverseOf){if(a>0)throw new RangeError(`Signed year ${a} is invalid for era ${w.name}`);return d=w.anchorEpoch.year-a,!0}return d=a-w.anchorEpoch.year+(w.hasYearZero?0:1),!0}return this.compareCalendarDates(m,w.anchorEpoch)>=0&&(d=a-w.anchorEpoch.year+(w.hasYearZero?0:1),!0)});if(!p)throw new RangeError(`Year ${a} was not matched by any era`);return{eraYear:d,era:p.name}},{year:i,eraYear:o,era:s}=e;if(i!=null)({eraYear:o,era:s}=n(i)),r("era",s),r("eraYear",o);else{if(o==null)throw new RangeError("Either `year` or `eraYear` and `era` are required");{let a=s===void 0?void 0:this.eras.find(d=>d.name===s||d.genericName===s);if(!a)throw new RangeError(`Era ${s} (ISO year ${o}) was not matched by any era`);if(o<1&&a.reverseOf)throw new RangeError(`Years in ${s} era must be positive, not ${i}`);i=a.reverseOf?a.anchorEpoch.year-o:o+a.anchorEpoch.year-(a.hasYearZero?0:1),r("year",i),{eraYear:o,era:s}=n(i)}}return{...e,year:i,eraYear:o,era:s}}adjustCalendarDate(e,r,n="constrain"){let i=e,{month:o,monthCode:s}=i;return o===void 0&&(i={...i,month:MC(s)}),this.validateCalendarDate(i),i=this.completeEraYear(i),super.adjustCalendarDate(i,r,n)}estimateIsoDate(e){let r=this.adjustCalendarDate(e),{year:n,month:i,day:o}=r,{anchorEra:s}=this;return _8(n+s.isoEpoch.year-(s.hasYearZero?0:1),i,o,"constrain")}checkIcuBugs(e){if(this.calendarIsVulnerableToJulianBug&&this.v8IsVulnerableToJulianBug&&Cp(e.year,e.month,e.day,1582,10,15)<0)throw new RangeError(`calendar '${this.id}' is broken for ISO dates before 1582-10-15 (see https://bugs.chromium.org/p/chromium/issues/detail?id=1173158)`)}},Y_=class extends _y{constructor(e,r){super(e,r)}inLeapYear(e){let{year:r}=e;return(r+1)%4==0}monthsInYear(){return 13}minimumMonthLength(e){let{month:r}=e;return r===13?this.inLeapYear(e)?6:5:30}maximumMonthLength(e){return this.minimumMonthLength(e)}},WD=class extends Y_{constructor(){super("ethioaa",[{name:"era0",isoEpoch:{year:-5492,month:7,day:17}}])}},VD=class extends Y_{constructor(){super("coptic",[{name:"era1",isoEpoch:{year:284,month:8,day:29}},{name:"era0",reverseOf:"era1"}])}},HD=class extends Y_{constructor(){super("ethiopic",[{name:"era0",isoEpoch:{year:-5492,month:7,day:17}},{name:"era1",isoEpoch:{year:8,month:8,day:27},anchorEpoch:{year:5501}}])}},ZD=class extends _y{constructor(){super("roc",[{name:"minguo",isoEpoch:{year:1912,month:1,day:1}},{name:"before-roc",reverseOf:"minguo"}]),this.calendarIsVulnerableToJulianBug=!0}},JD=class extends _y{constructor(){super("buddhist",[{name:"be",hasYearZero:!0,isoEpoch:{year:-543,month:1,day:1}}]),this.calendarIsVulnerableToJulianBug=!0}},YD=class extends _y{constructor(){super("gregory",[{name:"ce",isoEpoch:{year:1,month:1,day:1}},{name:"bce",reverseOf:"ce"}])}reviseIntlEra(e){let{era:r,eraYear:n}=e;return r!=="bc"&&r!=="b"||(r="bce"),r!=="ad"&&r!=="a"||(r="ce"),{era:r,eraYear:n}}},QD=class extends _y{constructor(){super("japanese",[{name:"reiwa",isoEpoch:{year:2019,month:5,day:1},anchorEpoch:{year:2019,month:5,day:1}},{name:"heisei",isoEpoch:{year:1989,month:1,day:8},anchorEpoch:{year:1989,month:1,day:8}},{name:"showa",isoEpoch:{year:1926,month:12,day:25},anchorEpoch:{year:1926,month:12,day:25}},{name:"taisho",isoEpoch:{year:1912,month:7,day:30},anchorEpoch:{year:1912,month:7,day:30}},{name:"meiji",isoEpoch:{year:1868,month:9,day:8},anchorEpoch:{year:1868,month:9,day:8}},{name:"ce",isoEpoch:{year:1,month:1,day:1}},{name:"bce",reverseOf:"ce"}]),this.calendarIsVulnerableToJulianBug=!0,this.eraLength="long",this.erasBeginMidYear=!0}reviseIntlEra(e,r){let{era:n,eraYear:i}=e,{year:o}=r;return this.eras.find(s=>s.name===n)?{era:n,eraYear:i}:o<1?{era:"bce",eraYear:1-o}:{era:"ce",eraYear:o}}},k8=class extends Up{constructor(){super(...arguments),this.calendarType="lunisolar",this.hasEra=!1}inLeapYear(e,r){let n=this.getMonthList(e.year,r);return ND(n).length===13}monthsInYear(e,r){return this.inLeapYear(e,r)?13:12}minimumMonthLength(){return 29}maximumMonthLength(){return 30}getMonthList(e,r){if(e===void 0)throw new TypeError("Missing year");let n=JSON.stringify({func:"getMonthList",calendarYear:e,id:this.id}),i=r.get(n);if(i)return i;let o=this.getFormatter(),s=(B,I)=>{let C=kfe({isoYear:B,isoMonth:2,isoDay:1}),k=new Date(C);k.setUTCDate(I+1);let q=o.formatToParts(k),L=q.find(N=>N.type==="month").value,U=+q.find(N=>N.type==="day").value,F=q.find(N=>N.type==="relatedYear");if(F===void 0)throw new RangeError(`Intl.DateTimeFormat.formatToParts lacks relatedYear in ${this.id} calendar. Try Node 14+ or modern browsers.`);return F=+F.value,{calendarMonthString:L,calendarDay:U,calendarYearToVerify:F}},a=17,{calendarMonthString:d,calendarDay:m,calendarYearToVerify:p}=s(e,a);d!=="1"&&(a+=29,{calendarMonthString:d,calendarDay:m}=s(e,a)),a-=m-5;let w={},P,S,M=1,A=!1;do({calendarMonthString:d,calendarDay:m,calendarYearToVerify:p}=s(e,a)),P&&(w[S].daysInMonth=P+30-m),p!==e?A=!0:(w[d]={monthIndex:M++},a+=30),P=m,S=d;while(!A);return w[S].daysInMonth=P+30-m,r.set(n,w),w}estimateIsoDate(e){let{year:r,month:n}=e;return{year:r,month:n>=12?12:n+1,day:1}}adjustCalendarDate(e,r,n="constrain",i=!1){let{year:o,month:s,monthExtra:a,day:d,monthCode:m,eraYear:p}=e;if(i){if(o=p,a&&a!=="bis")throw new RangeError(`Unexpected leap month suffix: ${a}`);let w=Qd(s,a!==void 0),P=`${s}${a||""}`,S=this.getMonthList(o,r)[P];if(S===void 0)throw new RangeError(`Unmatched month ${P} in Chinese year ${o}`);return s=S.monthIndex,{year:o,month:s,day:d,era:void 0,eraYear:p,monthCode:w}}if(this.validateCalendarDate(e),o===void 0&&(o=p),p===void 0&&(p=o),s===void 0){let w=this.getMonthList(o,r),P=m.replace("L","bis").slice(1);P[0]==="0"&&(P=P.slice(1));let S=w[P];if(s=S&&S.monthIndex,s===void 0&&m.endsWith("L")&&m!="M13L"&&n==="constrain"){let M=m.slice(1,-1);M[0]==="0"&&(M=M.slice(1)),S=w[M],S&&(s=S.monthIndex,m=Qd(M))}if(s===void 0)throw new RangeError(`Unmatched month ${m} in Chinese year ${o}`)}else if(m===void 0){let w=this.getMonthList(o,r),P=ND(w),S=P.length;n==="reject"?(yo(s,1,S),yo(d,1,this.maximumMonthLength())):(s=sa(s,1,S),d=sa(d,1,this.maximumMonthLength()));let M=P.find(([,A])=>A.monthIndex===s);if(M===void 0)throw new RangeError(`Invalid month ${s} in Chinese year ${o}`);m=Qd(M[0].replace("bis",""),M[0].indexOf("bis")!==-1)}else{let w=this.getMonthList(o,r),P=m.replace("L","bis").slice(1);P[0]==="0"&&(P=P.slice(1));let S=w[P];if(!S)throw new RangeError(`Unmatched monthCode ${m} in Chinese year ${o}`);if(s!==S.monthIndex)throw new RangeError(`monthCode ${m} doesn't correspond to month ${s} in Chinese year ${o}`)}return{...e,year:o,eraYear:p,month:s,monthCode:m,day:d}}},XD=class extends k8{constructor(){super(...arguments),this.id="chinese"}},eC=class extends k8{constructor(){super(...arguments),this.id="dangi"}},tC=class{constructor(e){this.helper=e}dateFromFields(e,r,n){let i=new dn,o=Gt(e,this.fields(["day","month","monthCode","year"]),[]),s=ni(r),{year:a,month:d,day:m}=this.helper.calendarToIsoDate(o,s,i),p=uc(a,d,m,n);return i.setObject(p),p}yearMonthFromFields(e,r,n){let i=new dn,o=Gt(e,this.fields(["month","monthCode","year"]),[]),s=ni(r),{year:a,month:d,day:m}=this.helper.calendarToIsoDate({...o,day:1},s,i),p=Z_(a,d,n,m);return i.setObject(p),p}monthDayFromFields(e,r,n){let i=new dn,o=Gt(e,this.fields(["day","month","monthCode","year"]),[]),s=ni(r),{year:a,month:d,day:m}=this.helper.monthDayFromFields(o,s,i),p=H_(d,m,n,a);return i.setObject(p),p}fields(e){let r=e;return Tfe.call(r,"year")&&(r=[...r,"era","eraYear"]),r}fieldKeysToIgnore(e){let r=new Rfe;for(let n=0;n<e.length;n++){let i=e[n];switch(nt(Do,r,[i]),i){case"era":nt(Do,r,["eraYear"]),nt(Do,r,["year"]);break;case"eraYear":nt(Do,r,["era"]),nt(Do,r,["year"]);break;case"year":nt(Do,r,["era"]),nt(Do,r,["eraYear"]);break;case"month":nt(Do,r,["monthCode"]),this.helper.erasBeginMidYear&&(nt(Do,r,["era"]),nt(Do,r,["eraYear"]));break;case"monthCode":nt(Do,r,["month"]),this.helper.erasBeginMidYear&&(nt(Do,r,["era"]),nt(Do,r,["eraYear"]));break;case"day":this.helper.erasBeginMidYear&&(nt(Do,r,["era"]),nt(Do,r,["eraYear"]))}}return[...nt(Ife,r,[])]}dateAdd(e,r,n,i,o,s,a){let d=dn.getCacheForObject(e),m=this.helper.temporalToCalendarDate(e,d),p=this.helper.addCalendar(m,{years:r,months:n,weeks:i,days:o},s,d),w=this.helper.calendarToIsoDate(p,"constrain",d),{year:P,month:S,day:M}=w,A=uc(P,S,M,a);return new dn(d).setObject(A),A}dateUntil(e,r,n){let i=dn.getCacheForObject(e),o=dn.getCacheForObject(r),s=this.helper.temporalToCalendarDate(e,i),a=this.helper.temporalToCalendarDate(r,o);return this.helper.untilCalendar(s,a,n,i)}year(e){let r=dn.getCacheForObject(e);return this.helper.temporalToCalendarDate(e,r).year}month(e){let r=dn.getCacheForObject(e);return this.helper.temporalToCalendarDate(e,r).month}day(e){let r=dn.getCacheForObject(e);return this.helper.temporalToCalendarDate(e,r).day}era(e){if(!this.helper.hasEra)return;let r=dn.getCacheForObject(e);return this.helper.temporalToCalendarDate(e,r).era}eraYear(e){if(!this.helper.hasEra)return;let r=dn.getCacheForObject(e);return this.helper.temporalToCalendarDate(e,r).eraYear}monthCode(e){let r=dn.getCacheForObject(e);return this.helper.temporalToCalendarDate(e,r).monthCode}dayOfWeek(e){return wn.iso8601.dayOfWeek(e)}dayOfYear(e){let r=dn.getCacheForObject(e),n=this.helper.isoToCalendarDate(e,r),i=this.helper.startOfCalendarYear(n);return this.helper.calendarDaysUntil(i,n,r)+1}weekOfYear(e){return wn.iso8601.weekOfYear(e)}yearOfWeek(e){return wn.iso8601.yearOfWeek(e)}daysInWeek(e){return wn.iso8601.daysInWeek(e)}daysInMonth(e){let r=dn.getCacheForObject(e),n=this.helper.temporalToCalendarDate(e,r),i=this.helper.maximumMonthLength(n);if(i===this.helper.minimumMonthLength(n))return i;let o=this.helper.startOfCalendarMonth(n),s=this.helper.addMonthsCalendar(o,1,"constrain",r);return this.helper.calendarDaysUntil(o,s,r)}daysInYear(e){let r=e;zi(r,Ge)||(r=Wr(r));let n=dn.getCacheForObject(r),i=this.helper.temporalToCalendarDate(r,n),o=this.helper.startOfCalendarYear(i),s=this.helper.addCalendar(o,{years:1},"constrain",n);return this.helper.calendarDaysUntil(o,s,n)}monthsInYear(e){let r=dn.getCacheForObject(e),n=this.helper.temporalToCalendarDate(e,r);return this.helper.monthsInYear(n,r)}inLeapYear(e){let r=e;zi(r,Ge)||(r=Wr(r));let n=dn.getCacheForObject(r),i=this.helper.temporalToCalendarDate(r,n);return this.helper.inLeapYear(i,n)}};for(let t of[qD,KD,HD,WD,VD,XD,eC,ZD,GD,JD,YD,QD,I8,$D,LD,UD,FD,zD]){let e=new t;wn[e.id]=new tC(e)}var xy=class{constructor(e,r,n,i="iso8601"){Wce(this,br(e),br(r),br(n),fa(i))}get calendarId(){if(!Jt(this))throw new TypeError("invalid receiver");return go(D(this,we))}get era(){if(!Jt(this))throw new TypeError("invalid receiver");return N8(D(this,we),this)}get eraYear(){if(!Jt(this))throw new TypeError("invalid receiver");return q8(D(this,we),this)}get year(){if(!Jt(this))throw new TypeError("invalid receiver");return C8(D(this,we),this)}get month(){if(!Jt(this))throw new TypeError("invalid receiver");return j8(D(this,we),this)}get monthCode(){if(!Jt(this))throw new TypeError("invalid receiver");return cx(D(this,we),this)}get day(){if(!Jt(this))throw new TypeError("invalid receiver");return fx(D(this,we),this)}get dayOfWeek(){if(!Jt(this))throw new TypeError("invalid receiver");return aC(D(this,we),this)}get dayOfYear(){if(!Jt(this))throw new TypeError("invalid receiver");return cC(D(this,we),this)}get weekOfYear(){if(!Jt(this))throw new TypeError("invalid receiver");return fC(D(this,we),this)}get yearOfWeek(){if(!Jt(this))throw new TypeError("invalid receiver");return uC(D(this,we),this)}get daysInWeek(){if(!Jt(this))throw new TypeError("invalid receiver");return lC(D(this,we),this)}get daysInMonth(){if(!Jt(this))throw new TypeError("invalid receiver");return $8(D(this,we),this)}get daysInYear(){if(!Jt(this))throw new TypeError("invalid receiver");return L8(D(this,we),this)}get monthsInYear(){if(!Jt(this))throw new TypeError("invalid receiver");return U8(D(this,we),this)}get inLeapYear(){if(!Jt(this))throw new TypeError("invalid receiver");return F8(D(this,we),this)}with(e,r){if(!Jt(this))throw new TypeError("invalid receiver");if(!pn(e))throw new TypeError("invalid argument");ew(e);let n=Xt(r),i=D(this,we),o=li(i,["day","month","monthCode","year"]),s=Gt(this,o,[]);return s=vy(i,s,Gt(e,o,"partial")),s=Gt(s,o,[]),eh(i,s,n)}withCalendar(e){if(!Jt(this))throw new TypeError("invalid receiver");let r=fa(e);return new xy(D(this,Ge),D(this,He),D(this,Je),r)}add(e,r){if(!Jt(this))throw new TypeError("invalid receiver");let n=$b(e),i=Xt(r);return mo(D(this,we),this,n,i)}subtract(e,r){if(!Jt(this))throw new TypeError("invalid receiver");let n=afe($b(e)),i=Xt(r);return mo(D(this,we),this,n,i)}until(e,r){if(!Jt(this))throw new TypeError("invalid receiver");return mce("until",this,e,r)}since(e,r){if(!Jt(this))throw new TypeError("invalid receiver");return mce("since",this,e,r)}equals(e){if(!Jt(this))throw new TypeError("invalid receiver");let r=Wr(e);for(let n of[Ge,He,Je])if(D(this,n)!==D(r,n))return!1;return lx(D(this,we),D(r,we))}toString(e){if(!Jt(this))throw new TypeError("invalid receiver");return sce(this,ix(Xt(e)))}toJSON(){if(!Jt(this))throw new TypeError("invalid receiver");return sce(this)}toLocaleString(e,r){if(!Jt(this))throw new TypeError("invalid receiver");return new ih(e,r).format(this)}valueOf(){throw new TypeError("use compare() or equals() to compare Temporal.PlainDate")}toPlainDateTime(e){if(!Jt(this))throw new TypeError("invalid receiver");let r=D(this,Ge),n=D(this,He),i=D(this,Je),o=D(this,we);if(e===void 0)return oa(r,n,i,0,0,0,0,0,0,o);let s=Zd(e);return oa(r,n,i,D(s,Ot),D(s,Bt),D(s,Dt),D(s,Ct),D(s,jt),D(s,Nt),o)}toZonedDateTime(e){if(!Jt(this))throw new TypeError("invalid receiver");let r,n;if(pn(e))if(oc(e))r=e;else{let M=e.timeZone;M===void 0?r=No(e):(r=No(M),n=e.plainTime)}else r=No(e);let i=D(this,Ge),o=D(this,He),s=D(this,Je),a=D(this,we),d=0,m=0,p=0,w=0,P=0,S=0;return n!==void 0&&(n=Zd(n),d=D(n,Ot),m=D(n,Bt),p=D(n,Dt),w=D(n,Ct),P=D(n,jt),S=D(n,Nt)),po(D(ss(r,oa(i,o,s,d,m,p,w,P,S,a),"compatible"),mt),r,a)}toPlainYearMonth(){if(!Jt(this))throw new TypeError("invalid receiver");let e=D(this,we);return by(e,Gt(this,li(e,["monthCode","year"]),[]))}toPlainMonthDay(){if(!Jt(this))throw new TypeError("invalid receiver");let e=D(this,we);return Hb(e,Gt(this,li(e,["day","monthCode"]),[]))}getISOFields(){if(!Jt(this))throw new TypeError("invalid receiver");return{calendar:D(this,we),isoDay:D(this,Je),isoMonth:D(this,He),isoYear:D(this,Ge)}}getCalendar(){if(!Jt(this))throw new TypeError("invalid receiver");return nw(D(this,we))}static from(e,r){let n=Xt(r);return Jt(e)?(ni(n),uc(D(e,Ge),D(e,He),D(e,Je),D(e,we))):Wr(e,n)}static compare(e,r){let n=Wr(e),i=Wr(r);return Cp(D(n,Ge),D(n,He),D(n,Je),D(i,Ge),D(i,He),D(i,Je))}};wl(xy,"Temporal.PlainDate");var Ey=class{constructor(e,r,n,i=0,o=0,s=0,a=0,d=0,m=0,p="iso8601"){Vce(this,br(e),br(r),br(n),i===void 0?0:br(i),o===void 0?0:br(o),s===void 0?0:br(s),a===void 0?0:br(a),d===void 0?0:br(d),m===void 0?0:br(m),fa(p))}get calendarId(){if(!kt(this))throw new TypeError("invalid receiver");return go(D(this,we))}get year(){if(!kt(this))throw new TypeError("invalid receiver");return C8(D(this,we),this)}get month(){if(!kt(this))throw new TypeError("invalid receiver");return j8(D(this,we),this)}get monthCode(){if(!kt(this))throw new TypeError("invalid receiver");return cx(D(this,we),this)}get day(){if(!kt(this))throw new TypeError("invalid receiver");return fx(D(this,we),this)}get hour(){if(!kt(this))throw new TypeError("invalid receiver");return D(this,Ot)}get minute(){if(!kt(this))throw new TypeError("invalid receiver");return D(this,Bt)}get second(){if(!kt(this))throw new TypeError("invalid receiver");return D(this,Dt)}get millisecond(){if(!kt(this))throw new TypeError("invalid receiver");return D(this,Ct)}get microsecond(){if(!kt(this))throw new TypeError("invalid receiver");return D(this,jt)}get nanosecond(){if(!kt(this))throw new TypeError("invalid receiver");return D(this,Nt)}get era(){if(!kt(this))throw new TypeError("invalid receiver");return N8(D(this,we),this)}get eraYear(){if(!kt(this))throw new TypeError("invalid receiver");return q8(D(this,we),this)}get dayOfWeek(){if(!kt(this))throw new TypeError("invalid receiver");return aC(D(this,we),this)}get dayOfYear(){if(!kt(this))throw new TypeError("invalid receiver");return cC(D(this,we),this)}get weekOfYear(){if(!kt(this))throw new TypeError("invalid receiver");return fC(D(this,we),this)}get yearOfWeek(){if(!kt(this))throw new TypeError("invalid receiver");return uC(D(this,we),this)}get daysInWeek(){if(!kt(this))throw new TypeError("invalid receiver");return lC(D(this,we),this)}get daysInYear(){if(!kt(this))throw new TypeError("invalid receiver");return L8(D(this,we),this)}get daysInMonth(){if(!kt(this))throw new TypeError("invalid receiver");return $8(D(this,we),this)}get monthsInYear(){if(!kt(this))throw new TypeError("invalid receiver");return U8(D(this,we),this)}get inLeapYear(){if(!kt(this))throw new TypeError("invalid receiver");return F8(D(this,we),this)}with(e,r){if(!kt(this))throw new TypeError("invalid receiver");if(!pn(e))throw new TypeError("invalid argument");ew(e);let n=Xt(r),i=D(this,we),o=li(i,["day","hour","microsecond","millisecond","minute","month","monthCode","nanosecond","second","year"]),s=Gt(this,o,[]);s=vy(i,s,Gt(e,o,"partial")),s=Gt(s,o,[]);let{year:a,month:d,day:m,hour:p,minute:w,second:P,millisecond:S,microsecond:M,nanosecond:A}=ax(i,s,n);return oa(a,d,m,p,w,P,S,M,A,i)}withPlainTime(e){if(!kt(this))throw new TypeError("invalid receiver");let r=D(this,Ge),n=D(this,He),i=D(this,Je),o=D(this,we);if(e===void 0)return oa(r,n,i,0,0,0,0,0,0,o);let s=Zd(e);return oa(r,n,i,D(s,Ot),D(s,Bt),D(s,Dt),D(s,Ct),D(s,jt),D(s,Nt),o)}withPlainDate(e){if(!kt(this))throw new TypeError("invalid receiver");let r=Wr(e),n=D(r,Ge),i=D(r,He),o=D(r,Je),s=D(r,we),a=D(this,Ot),d=D(this,Bt),m=D(this,Dt),p=D(this,Ct),w=D(this,jt),P=D(this,Nt);return s=Yce(D(this,we),s),oa(n,i,o,a,d,m,p,w,P,s)}withCalendar(e){if(!kt(this))throw new TypeError("invalid receiver");let r=fa(e);return new Ey(D(this,Ge),D(this,He),D(this,Je),D(this,Ot),D(this,Bt),D(this,Dt),D(this,Ct),D(this,jt),D(this,Nt),r)}add(e,r){if(!kt(this))throw new TypeError("invalid receiver");return xce("add",this,e,r)}subtract(e,r){if(!kt(this))throw new TypeError("invalid receiver");return xce("subtract",this,e,r)}until(e,r){if(!kt(this))throw new TypeError("invalid receiver");return yce("until",this,e,r)}since(e,r){if(!kt(this))throw new TypeError("invalid receiver");return yce("since",this,e,r)}round(e){if(!kt(this))throw new TypeError("invalid receiver");if(e===void 0)throw new TypeError("options parameter is required");let r=typeof e=="string"?Yb("smallestUnit",e):Xt(e),n=tw(r),i=Xf(r,"halfExpand"),o=ca(r,"smallestUnit","time",yy,["day"]),s={day:1,hour:24,minute:60,second:60,millisecond:1e3,microsecond:1e3,nanosecond:1e3}[o];rw(n,s,s===1);let a=D(this,Ge),d=D(this,He),m=D(this,Je),p=D(this,Ot),w=D(this,Bt),P=D(this,Dt),S=D(this,Ct),M=D(this,jt),A=D(this,Nt);return{year:a,month:d,day:m,hour:p,minute:w,second:P,millisecond:S,microsecond:M,nanosecond:A}=wC(a,d,m,p,w,P,S,M,A,n,o,i),oa(a,d,m,p,w,P,S,M,A,D(this,we))}equals(e){if(!kt(this))throw new TypeError("invalid receiver");let r=dy(e);for(let n of[Ge,He,Je,Ot,Bt,Dt,Ct,jt,Nt])if(D(this,n)!==D(r,n))return!1;return lx(D(this,we),D(r,we))}toString(e){if(!kt(this))throw new TypeError("invalid receiver");let r=Xt(e),n=ix(r),i=ox(r),o=Xf(r,"trunc"),s=ca(r,"smallestUnit","time",void 0);if(s==="hour")throw new RangeError('smallestUnit must be a time unit other than "hour"');let{precision:a,unit:d,increment:m}=sx(s,i);return ace(this,a,n,{unit:d,increment:m,roundingMode:o})}toJSON(){if(!kt(this))throw new TypeError("invalid receiver");return ace(this,"auto")}toLocaleString(e,r){if(!kt(this))throw new TypeError("invalid receiver");return new ih(e,r).format(this)}valueOf(){throw new TypeError("use compare() or equals() to compare Temporal.PlainDateTime")}toZonedDateTime(e,r){if(!kt(this))throw new TypeError("invalid receiver");let n=No(e);return po(D(ss(n,this,Vb(Xt(r))),mt),n,D(this,we))}toPlainDate(){if(!kt(this))throw new TypeError("invalid receiver");return Zb(this)}toPlainYearMonth(){if(!kt(this))throw new TypeError("invalid receiver");let e=D(this,we);return by(e,Gt(this,li(e,["monthCode","year"]),[]))}toPlainMonthDay(){if(!kt(this))throw new TypeError("invalid receiver");let e=D(this,we);return Hb(e,Gt(this,li(e,["day","monthCode"]),[]))}toPlainTime(){if(!kt(this))throw new TypeError("invalid receiver");return dC(this)}getISOFields(){if(!kt(this))throw new TypeError("invalid receiver");return{calendar:D(this,we),isoDay:D(this,Je),isoHour:D(this,Ot),isoMicrosecond:D(this,jt),isoMillisecond:D(this,Ct),isoMinute:D(this,Bt),isoMonth:D(this,He),isoNanosecond:D(this,Nt),isoSecond:D(this,Dt),isoYear:D(this,Ge)}}getCalendar(){if(!kt(this))throw new TypeError("invalid receiver");return nw(D(this,we))}static from(e,r){let n=Xt(r);return kt(e)?(ni(n),oa(D(e,Ge),D(e,He),D(e,Je),D(e,Ot),D(e,Bt),D(e,Dt),D(e,Ct),D(e,jt),D(e,Nt),D(e,we))):dy(e,n)}static compare(e,r){let n=dy(e),i=dy(r);for(let o of[Ge,He,Je,Ot,Bt,Dt,Ct,jt,Nt]){let s=D(n,o),a=D(i,o);if(s!==a)return py(s-a)}return 0}};wl(Ey,"Temporal.PlainDateTime");var hl=class{constructor(e=0,r=0,n=0,i=0,o=0,s=0,a=0,d=0,m=0,p=0){let w=e===void 0?0:Fi(e),P=r===void 0?0:Fi(r),S=n===void 0?0:Fi(n),M=i===void 0?0:Fi(i),A=o===void 0?0:Fi(o),B=s===void 0?0:Fi(s),I=a===void 0?0:Fi(a),C=d===void 0?0:Fi(d),k=m===void 0?0:Fi(m),q=p===void 0?0:Fi(p);A8(w,P,S,M,A,B,I,C,k,q),_l(this),Ft(this,Yo,w),Ft(this,Xi,P),Ft(this,Ls,S),Ft(this,Qo,M),Ft(this,Xo,A),Ft(this,es,B),Ft(this,ts,I),Ft(this,rs,C),Ft(this,ns,k),Ft(this,is,q)}get years(){if(!$n(this))throw new TypeError("invalid receiver");return D(this,Yo)}get months(){if(!$n(this))throw new TypeError("invalid receiver");return D(this,Xi)}get weeks(){if(!$n(this))throw new TypeError("invalid receiver");return D(this,Ls)}get days(){if(!$n(this))throw new TypeError("invalid receiver");return D(this,Qo)}get hours(){if(!$n(this))throw new TypeError("invalid receiver");return D(this,Xo)}get minutes(){if(!$n(this))throw new TypeError("invalid receiver");return D(this,es)}get seconds(){if(!$n(this))throw new TypeError("invalid receiver");return D(this,ts)}get milliseconds(){if(!$n(this))throw new TypeError("invalid receiver");return D(this,rs)}get microseconds(){if(!$n(this))throw new TypeError("invalid receiver");return D(this,ns)}get nanoseconds(){if(!$n(this))throw new TypeError("invalid receiver");return D(this,is)}get sign(){if(!$n(this))throw new TypeError("invalid receiver");return yl(D(this,Yo),D(this,Xi),D(this,Ls),D(this,Qo),D(this,Xo),D(this,es),D(this,ts),D(this,rs),D(this,ns),D(this,is))}get blank(){if(!$n(this))throw new TypeError("invalid receiver");return yl(D(this,Yo),D(this,Xi),D(this,Ls),D(this,Qo),D(this,Xo),D(this,es),D(this,ts),D(this,rs),D(this,ns),D(this,is))===0}with(e){if(!$n(this))throw new TypeError("invalid receiver");let r=Gt(e,["days","hours","microseconds","milliseconds","minutes","months","nanoseconds","seconds","weeks","years"],"partial"),{years:n=D(this,Yo),months:i=D(this,Xi),weeks:o=D(this,Ls),days:s=D(this,Qo),hours:a=D(this,Xo),minutes:d=D(this,es),seconds:m=D(this,ts),milliseconds:p=D(this,rs),microseconds:w=D(this,ns),nanoseconds:P=D(this,is)}=r;return new hl(n,i,o,s,a,d,m,p,w,P)}negated(){if(!$n(this))throw new TypeError("invalid receiver");return afe(this)}abs(){if(!$n(this))throw new TypeError("invalid receiver");return new hl(Math.abs(D(this,Yo)),Math.abs(D(this,Xi)),Math.abs(D(this,Ls)),Math.abs(D(this,Qo)),Math.abs(D(this,Xo)),Math.abs(D(this,es)),Math.abs(D(this,ts)),Math.abs(D(this,rs)),Math.abs(D(this,ns)),Math.abs(D(this,is)))}add(e,r){if(!$n(this))throw new TypeError("invalid receiver");return wce("add",this,e,r)}subtract(e,r){if(!$n(this))throw new TypeError("invalid receiver");return wce("subtract",this,e,r)}round(e){if(!$n(this))throw new TypeError("invalid receiver");if(e===void 0)throw new TypeError("options parameter is required");let r=D(this,Yo),n=D(this,Xi),i=D(this,Ls),o=D(this,Qo),s=D(this,Xo),a=D(this,es),d=D(this,ts),m=D(this,rs),p=D(this,ns),w=D(this,is),P=ID(r,n,i,o,s,a,d,m,p,w),S=typeof e=="string"?Yb("smallestUnit",e):Xt(e),M=ca(S,"largestUnit","datetime",void 0,["auto"]),A=d8(S),B=tw(S),I=Xf(S,"halfExpand"),C=ca(S,"smallestUnit","datetime",void 0),k=!0;C||(k=!1,C="nanosecond"),P=gy(P,C);let q=!0;if(M||(q=!1,M=P),M==="auto"&&(M=P),!k&&!q)throw new RangeError("at least one of smallestUnit or largestUnit is required");if(gy(M,C)!==M)throw new RangeError(`largestUnit ${M} cannot be smaller than smallestUnit ${C}`);let L={hour:24,minute:60,second:60,millisecond:1e3,microsecond:1e3,nanosecond:1e3}[C];return L!==void 0&&rw(B,L,!1),{years:r,months:n,weeks:i,days:o}=l8(r,n,i,o,M,A),{years:r,months:n,weeks:i,days:o,hours:s,minutes:a,seconds:d,milliseconds:m,microseconds:p,nanoseconds:w}=th(r,n,i,o,s,a,d,m,p,w,B,C,I,A),{years:r,months:n,weeks:i,days:o,hours:s,minutes:a,seconds:d,milliseconds:m,microseconds:p,nanoseconds:w}=yfe(r,n,i,o,s,a,d,m,p,w,B,C,I,A),{days:o,hours:s,minutes:a,seconds:d,milliseconds:m,microseconds:p,nanoseconds:w}=tf(o,s,a,d,m,p,w,M,A),{years:r,months:n,weeks:i,days:o}=function(F,N,G,x,c,u){let y=Fe("%Temporal.Duration%"),l=yl(F,N,G,x,0,0,0,0,0,0);if(l===0)return{years:F,months:N,weeks:G,days:x};let h=K.default.BigInt(l),b,_,g=K.default.BigInt(F),f=K.default.BigInt(N),v=K.default.BigInt(G),O=K.default.BigInt(x);u&&(_=Wr(u),b=D(_,we));let T=new y(l),R=new y(0,l),z=new y(0,0,l);switch(c){case"year":{if(!b)throw new RangeError("a starting point is required for years balancing");let V=typeof b!="string"?Br(b,"dateAdd"):void 0,W,Z,J;for({relativeTo:W,days:Z}=Co(b,_,T,V);K.default.greaterThanOrEqual(Yf(O),K.default.BigInt(hn(Z)));)O=K.default.subtract(O,K.default.BigInt(Z)),g=K.default.add(g,h),_=W,{relativeTo:W,days:Z}=Co(b,_,T,V);for({relativeTo:W,days:J}=Co(b,_,R,V);K.default.greaterThanOrEqual(Yf(O),K.default.BigInt(hn(J)));)O=K.default.subtract(O,K.default.BigInt(J)),f=K.default.add(f,h),_=W,{relativeTo:W,days:J}=Co(b,_,R,V);W=mo(b,_,T,void 0,V);let X=typeof b!="string"?Br(b,"dateUntil"):void 0,Ee=qo(null);Ee.largestUnit="month";let re=jp(b,_,W,Ee,X),ne=D(re,Xi);for(;K.default.greaterThanOrEqual(Yf(f),K.default.BigInt(hn(ne)));){f=K.default.subtract(f,K.default.BigInt(ne)),g=K.default.add(g,h),_=W,W=mo(b,_,T,void 0,V);let qe=qo(null);qe.largestUnit="month",re=jp(b,_,W,qe,X),ne=D(re,Xi)}break}case"month":{if(!b)throw new RangeError("a starting point is required for months balancing");let V=typeof b!="string"?Br(b,"dateAdd"):void 0,W,Z;for({relativeTo:W,days:Z}=Co(b,_,R,V);K.default.greaterThanOrEqual(Yf(O),K.default.BigInt(hn(Z)));)O=K.default.subtract(O,K.default.BigInt(Z)),f=K.default.add(f,h),_=W,{relativeTo:W,days:Z}=Co(b,_,R,V);break}case"week":{if(!b)throw new RangeError("a starting point is required for weeks balancing");let V=typeof b!="string"?Br(b,"dateAdd"):void 0,W,Z;for({relativeTo:W,days:Z}=Co(b,_,z,V);K.default.greaterThanOrEqual(Yf(O),K.default.BigInt(hn(Z)));)O=K.default.subtract(O,K.default.BigInt(Z)),v=K.default.add(v,h),_=W,{relativeTo:W,days:Z}=Co(b,_,z,V);break}}return{years:K.default.toNumber(g),months:K.default.toNumber(f),weeks:K.default.toNumber(v),days:K.default.toNumber(O)}}(r,n,i,o,M,A),new hl(r,n,i,o,s,a,d,m,p,w)}total(e){if(!$n(this))throw new TypeError("invalid receiver");let r=D(this,Yo),n=D(this,Xi),i=D(this,Ls),o=D(this,Qo),s=D(this,Xo),a=D(this,es),d=D(this,ts),m=D(this,rs),p=D(this,ns),w=D(this,is);if(e===void 0)throw new TypeError("options argument is required");let P=typeof e=="string"?Yb("unit",e):Xt(e),S=d8(P),M=ca(P,"unit","datetime",yy),A;({years:r,months:n,weeks:i,days:o}=l8(r,n,i,o,M,S)),Qe(S)&&(A=mfe(S,r,n,i,0));let B=sfe(o,s,a,d,m,p,w,M,A);if(B==="positive overflow")return 1/0;if(B==="negative overflow")return-1/0;({days:o,hours:s,minutes:a,seconds:d,milliseconds:m,microseconds:p,nanoseconds:w}=B);let{total:I}=th(r,n,i,o,s,a,d,m,p,w,1,M,"trunc",S);return I}toString(e){if(!$n(this))throw new TypeError("invalid receiver");let r=Xt(e),n=ox(r),i=Xf(r,"trunc"),o=ca(r,"smallestUnit","time",void 0);if(o==="hour"||o==="minute")throw new RangeError('smallestUnit must be a time unit other than "hours" or "minutes"');let{precision:s,unit:a,increment:d}=sx(o,n);return _D(this,s,{unit:a,increment:d,roundingMode:i})}toJSON(){if(!$n(this))throw new TypeError("invalid receiver");return _D(this)}toLocaleString(e,r){if(!$n(this))throw new TypeError("invalid receiver");return typeof Intl<"u"&&Intl.DurationFormat!==void 0?new Intl.DurationFormat(e,r).format(this):(console.warn("Temporal.Duration.prototype.toLocaleString() requires Intl.DurationFormat."),_D(this))}valueOf(){throw new TypeError("use compare() to compare Temporal.Duration")}static from(e){return $n(e)?new hl(D(e,Yo),D(e,Xi),D(e,Ls),D(e,Qo),D(e,Xo),D(e,es),D(e,ts),D(e,rs),D(e,ns),D(e,is)):$b(e)}static compare(e,r,n){let i=$b(e),o=$b(r),s=d8(Xt(n)),a=D(i,Yo),d=D(i,Xi),m=D(i,Ls),p=D(i,Qo),w=D(i,Xo),P=D(i,es),S=D(i,ts),M=D(i,rs),A=D(i,ns),B=D(i,is),I=D(o,Yo),C=D(o,Xi),k=D(o,Ls),q=D(o,Qo),L=D(o,Xo),U=D(o,es),F=D(o,ts),N=D(o,rs),G=D(o,ns),x=D(o,is),c=hce(s,a,d,m,p),u=hce(s,I,C,k,q);a===0&&I===0&&d===0&&C===0&&m===0&&k===0||({days:p}=l8(a,d,m,p,"day",s),{days:q}=l8(I,C,k,q,"day",s));let y=Jb(p,w,P,S,M,A,B,c),l=Jb(q,L,U,F,N,G,x,u);return py(K.default.toNumber(K.default.subtract(y,l)))}};wl(hl,"Temporal.Duration");var s$e=Object.create,Q_=class{constructor(e,r,n="iso8601",i=1972){Hce(this,br(e),br(r),fa(n),br(i))}get monthCode(){if(!Ui(this))throw new TypeError("invalid receiver");return cx(D(this,we),this)}get day(){if(!Ui(this))throw new TypeError("invalid receiver");return fx(D(this,we),this)}get calendarId(){if(!Ui(this))throw new TypeError("invalid receiver");return go(D(this,we))}with(e,r){if(!Ui(this))throw new TypeError("invalid receiver");if(!pn(e))throw new TypeError("invalid argument");ew(e);let n=Xt(r),i=D(this,we),o=li(i,["day","month","monthCode","year"]),s=Gt(this,o,[]);return s=vy(i,s,Gt(e,o,"partial")),s=Gt(s,o,[]),Hb(i,s,n)}equals(e){if(!Ui(this))throw new TypeError("invalid receiver");let r=ice(e);for(let n of[He,Je,Ge])if(D(this,n)!==D(r,n))return!1;return lx(D(this,we),D(r,we))}toString(e){if(!Ui(this))throw new TypeError("invalid receiver");return cce(this,ix(Xt(e)))}toJSON(){if(!Ui(this))throw new TypeError("invalid receiver");return cce(this)}toLocaleString(e,r){if(!Ui(this))throw new TypeError("invalid receiver");return new ih(e,r).format(this)}valueOf(){throw new TypeError("use equals() to compare Temporal.PlainMonthDay")}toPlainDate(e){if(!Ui(this))throw new TypeError("invalid receiver");if(!pn(e))throw new TypeError("argument should be an object");let r=D(this,we),n=li(r,["day","monthCode"]),i=Gt(this,n,[]),o=li(r,["year"]),s=vy(r,i,Gt(e,o,[]));s=Gt(s,[...new Set([...n,...o])],[]);let a=s$e(null);return a.overflow="reject",eh(r,s,a)}getISOFields(){if(!Ui(this))throw new TypeError("invalid receiver");return{calendar:D(this,we),isoDay:D(this,Je),isoMonth:D(this,He),isoYear:D(this,Ge)}}getCalendar(){if(!Ui(this))throw new TypeError("invalid receiver");return nw(D(this,we))}static from(e,r){let n=Xt(r);return Ui(e)?(ni(n),H_(D(e,He),D(e,Je),D(e,we),D(e,Ge))):ice(e,n)}};wl(Q_,"Temporal.PlainMonthDay");var PC=()=>new(Fe("%Temporal.Instant%"))(xC()),Ace=(t,e=Dp())=>{let r=No(e),n=fa(t);return Ia(r,PC(),n)},MD=(t=Dp())=>Ia(No(t),PC(),"iso8601"),Tce=(t,e=Dp())=>{let r=No(e),n=fa(t);return po(xC(),r,n)},Bfe={instant:PC,plainDateTime:Ace,plainDateTimeISO:MD,plainDate:(t,e=Dp())=>Zb(Ace(t,e)),plainDateISO:(t=Dp())=>Zb(MD(t)),plainTimeISO:(t=Dp())=>dC(MD(t)),timeZoneId:()=>Dp(),zonedDateTime:Tce,zonedDateTimeISO:(t=Dp())=>Tce("iso8601",t),[Symbol.toStringTag]:"Temporal.Now"};Object.defineProperty(Bfe,Symbol.toStringTag,{value:"Temporal.Now",writable:!1,enumerable:!1,configurable:!0});var a$e=Object.assign;function Rce(t,e,r){let n=D(t,Ot),i=D(t,Bt),o=D(t,Dt),s=D(t,Ct),a=D(t,jt),d=D(t,Nt);if(r){let{unit:m,increment:p,roundingMode:w}=r;({hour:n,minute:i,second:o,millisecond:s,microsecond:a,nanosecond:d}=_C(n,i,o,s,a,d,p,m,w))}return`${_n(n)}:${_n(i)}${K8(o,s,a,d,e)}`}var Xd=class{constructor(e=0,r=0,n=0,i=0,o=0,s=0){let a=e===void 0?0:br(e),d=r===void 0?0:br(r),m=n===void 0?0:br(n),p=i===void 0?0:br(i),w=o===void 0?0:br(o),P=s===void 0?0:br(s);V8(a,d,m,p,w,P),_l(this),Ft(this,Ot,a),Ft(this,Bt,d),Ft(this,Dt,m),Ft(this,Ct,p),Ft(this,jt,w),Ft(this,Nt,P)}get hour(){if(!Ln(this))throw new TypeError("invalid receiver");return D(this,Ot)}get minute(){if(!Ln(this))throw new TypeError("invalid receiver");return D(this,Bt)}get second(){if(!Ln(this))throw new TypeError("invalid receiver");return D(this,Dt)}get millisecond(){if(!Ln(this))throw new TypeError("invalid receiver");return D(this,Ct)}get microsecond(){if(!Ln(this))throw new TypeError("invalid receiver");return D(this,jt)}get nanosecond(){if(!Ln(this))throw new TypeError("invalid receiver");return D(this,Nt)}with(e,r){if(!Ln(this))throw new TypeError("invalid receiver");if(!pn(e))throw new TypeError("invalid argument");ew(e);let n=ni(Xt(r)),i=E8(e,"partial"),o=E8(this),{hour:s,minute:a,second:d,millisecond:m,microsecond:p,nanosecond:w}=a$e(o,i);return{hour:s,minute:a,second:d,millisecond:m,microsecond:p,nanosecond:w}=D8(s,a,d,m,p,w,n),new Xd(s,a,d,m,p,w)}add(e){if(!Ln(this))throw new TypeError("invalid receiver");return Ece("add",this,e)}subtract(e){if(!Ln(this))throw new TypeError("invalid receiver");return Ece("subtract",this,e)}until(e,r){if(!Ln(this))throw new TypeError("invalid receiver");return gce("until",this,e,r)}since(e,r){if(!Ln(this))throw new TypeError("invalid receiver");return gce("since",this,e,r)}round(e){if(!Ln(this))throw new TypeError("invalid receiver");if(e===void 0)throw new TypeError("options parameter is required");let r=typeof e=="string"?Yb("smallestUnit",e):Xt(e),n=tw(r),i=Xf(r,"halfExpand"),o=ca(r,"smallestUnit","time",yy);rw(n,{hour:24,minute:60,second:60,millisecond:1e3,microsecond:1e3,nanosecond:1e3}[o],!1);let s=D(this,Ot),a=D(this,Bt),d=D(this,Dt),m=D(this,Ct),p=D(this,jt),w=D(this,Nt);return{hour:s,minute:a,second:d,millisecond:m,microsecond:p,nanosecond:w}=_C(s,a,d,m,p,w,n,o,i),new Xd(s,a,d,m,p,w)}equals(e){if(!Ln(this))throw new TypeError("invalid receiver");let r=Zd(e);for(let n of[Ot,Bt,Dt,Ct,jt,Nt])if(D(this,n)!==D(r,n))return!1;return!0}toString(e){if(!Ln(this))throw new TypeError("invalid receiver");let r=Xt(e),n=ox(r),i=Xf(r,"trunc"),o=ca(r,"smallestUnit","time",void 0);if(o==="hour")throw new RangeError('smallestUnit must be a time unit other than "hour"');let{precision:s,unit:a,increment:d}=sx(o,n);return Rce(this,s,{unit:a,increment:d,roundingMode:i})}toJSON(){if(!Ln(this))throw new TypeError("invalid receiver");return Rce(this,"auto")}toLocaleString(e,r){if(!Ln(this))throw new TypeError("invalid receiver");return new ih(e,r).format(this)}valueOf(){throw new TypeError("use compare() or equals() to compare Temporal.PlainTime")}toPlainDateTime(e){if(!Ln(this))throw new TypeError("invalid receiver");let r=Wr(e),n=D(r,Ge),i=D(r,He),o=D(r,Je),s=D(r,we);return oa(n,i,o,D(this,Ot),D(this,Bt),D(this,Dt),D(this,Ct),D(this,jt),D(this,Nt),s)}toZonedDateTime(e){if(!Ln(this))throw new TypeError("invalid receiver");if(!pn(e))throw new TypeError("invalid argument");let r=e.plainDate;if(r===void 0)throw new TypeError("missing date property");let n=Wr(r),i=e.timeZone;if(i===void 0)throw new TypeError("missing timeZone property");let o=No(i),s=D(n,Ge),a=D(n,He),d=D(n,Je),m=D(n,we),p=D(this,Ot),w=D(this,Bt),P=D(this,Dt),S=D(this,Ct),M=D(this,jt),A=D(this,Nt);return po(D(ss(o,new(Fe("%Temporal.PlainDateTime%"))(s,a,d,p,w,P,S,M,A,m),"compatible"),mt),o,m)}getISOFields(){if(!Ln(this))throw new TypeError("invalid receiver");return{isoHour:D(this,Ot),isoMicrosecond:D(this,jt),isoMillisecond:D(this,Ct),isoMinute:D(this,Bt),isoNanosecond:D(this,Nt),isoSecond:D(this,Dt)}}static from(e,r){let n=ni(Xt(r));return Ln(e)?new Xd(D(e,Ot),D(e,Bt),D(e,Dt),D(e,Ct),D(e,jt),D(e,Nt)):Zd(e,n)}static compare(e,r){let n=Zd(e),i=Zd(r);for(let o of[Ot,Bt,Dt,Ct,jt,Nt]){let s=D(n,o),a=D(i,o);if(s!==a)return py(s-a)}return 0}};wl(Xd,"Temporal.PlainTime");var my=class{constructor(e){if(arguments.length<1)throw new RangeError("missing argument: identifier is required");let r=hC(e);_l(this),Ft(this,dl,r)}get id(){if(!oc(this))throw new TypeError("invalid receiver");return D(this,dl)}getOffsetNanosecondsFor(e){if(!oc(this))throw new TypeError("invalid receiver");let r=Qf(e),n=D(this,dl);return jb(n)?Np(n):Jd(n,D(r,mt))}getOffsetStringFor(e){if(!oc(this))throw new TypeError("invalid receiver");return kD(this,Qf(e))}getPlainDateTimeFor(e,r="iso8601"){if(!oc(this))throw new TypeError("invalid receiver");return Ia(this,Qf(e),fa(r))}getInstantFor(e,r){if(!oc(this))throw new TypeError("invalid receiver");return ss(this,dy(e),Vb(Xt(r)))}getPossibleInstantsFor(e){if(!oc(this))throw new TypeError("invalid receiver");let r=dy(e),n=Fe("%Temporal.Instant%"),i=D(this,dl);if(jb(i)){let s=qp(D(r,Ge),D(r,He),D(r,Je),D(r,Ot),D(r,Bt),D(r,Dt),D(r,Ct),D(r,jt),D(r,Nt));if(s===null)throw new RangeError("DateTime outside of supported range");let a=Np(i);return[new n(K.default.subtract(s,K.default.BigInt(a)))]}return function(a,d,m,p,w,P,S,M,A,B){let I=qp(d,m,p,w,P,S,M,A,B);if(I===null)throw new RangeError("DateTime outside of supported range");let C=K.default.subtract(I,gl);K.default.lessThan(C,V_)&&(C=I);let k=K.default.add(I,gl);K.default.greaterThan(k,Gb)&&(k=I);let q=Jd(a,C),L=Jd(a,k);return(q===L?[q]:[q,L]).map(U=>{let F=K.default.subtract(I,K.default.BigInt(U)),N=nfe(a,F);if(d===N.year&&m===N.month&&p===N.day&&w===N.hour&&P===N.minute&&S===N.second&&M===N.millisecond&&A===N.microsecond&&B===N.nanosecond)return F}).filter(U=>U!==void 0)}(i,D(r,Ge),D(r,He),D(r,Je),D(r,Ot),D(r,Bt),D(r,Dt),D(r,Ct),D(r,jt),D(r,Nt)).map(s=>new n(s))}getNextTransition(e){if(!oc(this))throw new TypeError("invalid receiver");let r=Qf(e),n=D(this,dl);if(jb(n)||n==="UTC")return null;let i=D(r,mt),o=Fe("%Temporal.Instant%");return i=ofe(n,i),i===null?null:new o(i)}getPreviousTransition(e){if(!oc(this))throw new TypeError("invalid receiver");let r=Qf(e),n=D(this,dl);if(jb(n)||n==="UTC")return null;let i=D(r,mt),o=Fe("%Temporal.Instant%");return i=OD(n,i),i===null?null:new o(i)}toString(){if(!oc(this))throw new TypeError("invalid receiver");return D(this,dl)}toJSON(){if(!oc(this))throw new TypeError("invalid receiver");return D(this,dl)}static from(e){return Qce(No(e))}};wl(my,"Temporal.TimeZone"),In("Temporal.TimeZone.prototype.getOffsetNanosecondsFor",my.prototype.getOffsetNanosecondsFor),In("Temporal.TimeZone.prototype.getPossibleInstantsFor",my.prototype.getPossibleInstantsFor);var c$e=Object.create,X_=class{constructor(e,r,n="iso8601",i=1){Zce(this,br(e),br(r),fa(n),br(i))}get year(){if(!Ar(this))throw new TypeError("invalid receiver");return C8(D(this,we),this)}get month(){if(!Ar(this))throw new TypeError("invalid receiver");return j8(D(this,we),this)}get monthCode(){if(!Ar(this))throw new TypeError("invalid receiver");return cx(D(this,we),this)}get calendarId(){if(!Ar(this))throw new TypeError("invalid receiver");return go(D(this,we))}get era(){if(!Ar(this))throw new TypeError("invalid receiver");return N8(D(this,we),this)}get eraYear(){if(!Ar(this))throw new TypeError("invalid receiver");return q8(D(this,we),this)}get daysInMonth(){if(!Ar(this))throw new TypeError("invalid receiver");return $8(D(this,we),this)}get daysInYear(){if(!Ar(this))throw new TypeError("invalid receiver");return L8(D(this,we),this)}get monthsInYear(){if(!Ar(this))throw new TypeError("invalid receiver");return U8(D(this,we),this)}get inLeapYear(){if(!Ar(this))throw new TypeError("invalid receiver");return F8(D(this,we),this)}with(e,r){if(!Ar(this))throw new TypeError("invalid receiver");if(!pn(e))throw new TypeError("invalid argument");ew(e);let n=Xt(r),i=D(this,we),o=li(i,["month","monthCode","year"]),s=Gt(this,o,[]);return s=vy(i,s,Gt(e,o,"partial")),s=Gt(s,o,[]),by(i,s,n)}add(e,r){if(!Ar(this))throw new TypeError("invalid receiver");return Sce("add",this,e,r)}subtract(e,r){if(!Ar(this))throw new TypeError("invalid receiver");return Sce("subtract",this,e,r)}until(e,r){if(!Ar(this))throw new TypeError("invalid receiver");return vce("until",this,e,r)}since(e,r){if(!Ar(this))throw new TypeError("invalid receiver");return vce("since",this,e,r)}equals(e){if(!Ar(this))throw new TypeError("invalid receiver");let r=z_(e);for(let n of[Ge,He,Je])if(D(this,n)!==D(r,n))return!1;return lx(D(this,we),D(r,we))}toString(e){if(!Ar(this))throw new TypeError("invalid receiver");return fce(this,ix(Xt(e)))}toJSON(){if(!Ar(this))throw new TypeError("invalid receiver");return fce(this)}toLocaleString(e,r){if(!Ar(this))throw new TypeError("invalid receiver");return new ih(e,r).format(this)}valueOf(){throw new TypeError("use compare() or equals() to compare Temporal.PlainYearMonth")}toPlainDate(e){if(!Ar(this))throw new TypeError("invalid receiver");if(!pn(e))throw new TypeError("argument should be an object");let r=D(this,we),n=li(r,["monthCode","year"]),i=Gt(this,n,[]),o=li(r,["day"]),s=vy(r,i,Gt(e,o,[]));s=Gt(s,[...new Set([...n,...o])],[]);let a=c$e(null);return a.overflow="reject",eh(r,s,a)}getISOFields(){if(!Ar(this))throw new TypeError("invalid receiver");return{calendar:D(this,we),isoDay:D(this,Je),isoMonth:D(this,He),isoYear:D(this,Ge)}}getCalendar(){if(!Ar(this))throw new TypeError("invalid receiver");return nw(D(this,we))}static from(e,r){let n=Xt(r);return Ar(e)?(ni(n),Z_(D(e,Ge),D(e,He),D(e,we),D(e,Je))):z_(e,n)}static compare(e,r){let n=z_(e),i=z_(r);return Cp(D(n,Ge),D(n,He),D(n,Je),D(i,Ge),D(i,He),D(i,Je))}};wl(X_,"Temporal.PlainYearMonth");var f$e=ih.prototype.resolvedOptions,u$e=Object.create,ex=class{constructor(e,r,n="iso8601"){if(arguments.length<1)throw new TypeError("missing argument: epochNanoseconds is required");Jce(this,G_(e),No(r),fa(n))}get calendarId(){if(!Qe(this))throw new TypeError("invalid receiver");return go(D(this,we))}get timeZoneId(){if(!Qe(this))throw new TypeError("invalid receiver");return J_(D(this,zr))}get year(){if(!Qe(this))throw new TypeError("invalid receiver");return C8(D(this,we),un(this))}get month(){if(!Qe(this))throw new TypeError("invalid receiver");return j8(D(this,we),un(this))}get monthCode(){if(!Qe(this))throw new TypeError("invalid receiver");return cx(D(this,we),un(this))}get day(){if(!Qe(this))throw new TypeError("invalid receiver");return fx(D(this,we),un(this))}get hour(){if(!Qe(this))throw new TypeError("invalid receiver");return D(un(this),Ot)}get minute(){if(!Qe(this))throw new TypeError("invalid receiver");return D(un(this),Bt)}get second(){if(!Qe(this))throw new TypeError("invalid receiver");return D(un(this),Dt)}get millisecond(){if(!Qe(this))throw new TypeError("invalid receiver");return D(un(this),Ct)}get microsecond(){if(!Qe(this))throw new TypeError("invalid receiver");return D(un(this),jt)}get nanosecond(){if(!Qe(this))throw new TypeError("invalid receiver");return D(un(this),Nt)}get era(){if(!Qe(this))throw new TypeError("invalid receiver");return N8(D(this,we),un(this))}get eraYear(){if(!Qe(this))throw new TypeError("invalid receiver");return q8(D(this,we),un(this))}get epochSeconds(){if(!Qe(this))throw new TypeError("invalid receiver");let e=D(this,mt);return K.default.toNumber(Lb(e,ml))}get epochMilliseconds(){if(!Qe(this))throw new TypeError("invalid receiver");let e=D(this,mt);return K.default.toNumber(Lb(e,cc))}get epochMicroseconds(){if(!Qe(this))throw new TypeError("invalid receiver");return R8(Lb(D(this,mt),Tr))}get epochNanoseconds(){if(!Qe(this))throw new TypeError("invalid receiver");return R8(D(this,mt))}get dayOfWeek(){if(!Qe(this))throw new TypeError("invalid receiver");return aC(D(this,we),un(this))}get dayOfYear(){if(!Qe(this))throw new TypeError("invalid receiver");return cC(D(this,we),un(this))}get weekOfYear(){if(!Qe(this))throw new TypeError("invalid receiver");return fC(D(this,we),un(this))}get yearOfWeek(){if(!Qe(this))throw new TypeError("invalid receiver");return uC(D(this,we),un(this))}get hoursInDay(){if(!Qe(this))throw new TypeError("invalid receiver");let e=un(this),r=Fe("%Temporal.PlainDateTime%"),n=D(e,Ge),i=D(e,He),o=D(e,Je),s=new r(n,i,o,0,0,0,0,0,0),a=hy(n,i,o,0,0,0,1,"reject"),d=new r(a.year,a.month,a.day,0,0,0,0,0,0),m=D(this,zr),p=D(ss(m,s,"compatible"),mt),w=D(ss(m,d,"compatible"),mt);return ll(K.default.subtract(w,p),Uce)}get daysInWeek(){if(!Qe(this))throw new TypeError("invalid receiver");return lC(D(this,we),un(this))}get daysInMonth(){if(!Qe(this))throw new TypeError("invalid receiver");return $8(D(this,we),un(this))}get daysInYear(){if(!Qe(this))throw new TypeError("invalid receiver");return L8(D(this,we),un(this))}get monthsInYear(){if(!Qe(this))throw new TypeError("invalid receiver");return U8(D(this,we),un(this))}get inLeapYear(){if(!Qe(this))throw new TypeError("invalid receiver");return F8(D(this,we),un(this))}get offset(){if(!Qe(this))throw new TypeError("invalid receiver");return kD(D(this,zr),D(this,jo))}get offsetNanoseconds(){if(!Qe(this))throw new TypeError("invalid receiver");return eu(D(this,zr),D(this,jo))}with(e,r){if(!Qe(this))throw new TypeError("invalid receiver");if(!pn(e))throw new TypeError("invalid zoned-date-time-like");ew(e);let n=Xt(r),i=D(this,we),o=li(i,["day","hour","microsecond","millisecond","minute","month","monthCode","nanosecond","second","year"]);o.push("offset");let s=Gt(this,o,["offset"]);s=vy(i,s,Gt(e,o,"partial")),s=Gt(s,o,["offset"]);let a=Vb(n),d=x8(n,"prefer"),{year:m,month:p,day:w,hour:P,minute:S,second:M,millisecond:A,microsecond:B,nanosecond:I}=ax(i,s,n),C=Np(s.offset),k=D(this,zr);return po(S8(m,p,w,P,S,M,A,B,I,"option",C,k,a,d,!1),k,i)}withPlainDate(e){if(!Qe(this))throw new TypeError("invalid receiver");let r=Wr(e),n=D(r,Ge),i=D(r,He),o=D(r,Je),s=D(r,we),a=un(this),d=D(a,Ot),m=D(a,Bt),p=D(a,Dt),w=D(a,Ct),P=D(a,jt),S=D(a,Nt);s=Yce(D(this,we),s);let M=D(this,zr);return po(D(ss(M,new(Fe("%Temporal.PlainDateTime%"))(n,i,o,d,m,p,w,P,S,s),"compatible"),mt),M,s)}withPlainTime(e){if(!Qe(this))throw new TypeError("invalid receiver");let r=Fe("%Temporal.PlainTime%"),n=e===void 0?new r:Zd(e),i=un(this),o=D(i,Ge),s=D(i,He),a=D(i,Je),d=D(this,we),m=D(n,Ot),p=D(n,Bt),w=D(n,Dt),P=D(n,Ct),S=D(n,jt),M=D(n,Nt),A=D(this,zr);return po(D(ss(A,new(Fe("%Temporal.PlainDateTime%"))(o,s,a,m,p,w,P,S,M,d),"compatible"),mt),A,d)}withTimeZone(e){if(!Qe(this))throw new TypeError("invalid receiver");let r=No(e);return po(D(this,mt),r,D(this,we))}withCalendar(e){if(!Qe(this))throw new TypeError("invalid receiver");let r=fa(e);return po(D(this,mt),D(this,zr),r)}add(e,r){if(!Qe(this))throw new TypeError("invalid receiver");return Mce("add",this,e,r)}subtract(e,r){if(!Qe(this))throw new TypeError("invalid receiver");return Mce("subtract",this,e,r)}until(e,r){if(!Qe(this))throw new TypeError("invalid receiver");return bce("until",this,e,r)}since(e,r){if(!Qe(this))throw new TypeError("invalid receiver");return bce("since",this,e,r)}round(e){if(!Qe(this))throw new TypeError("invalid receiver");if(e===void 0)throw new TypeError("options parameter is required");let r=typeof e=="string"?Yb("smallestUnit",e):Xt(e),n=tw(r),i=Xf(r,"halfExpand"),o=ca(r,"smallestUnit","time",yy,["day"]),s={day:1,hour:24,minute:60,second:60,millisecond:1e3,microsecond:1e3,nanosecond:1e3}[o];rw(n,s,s===1);let a=un(this),d=D(a,Ge),m=D(a,He),p=D(a,Je),w=D(a,Ot),P=D(a,Bt),S=D(a,Dt),M=D(a,Ct),A=D(a,jt),B=D(a,Nt),I=Fe("%Temporal.PlainDateTime%"),C=D(this,zr),k=D(this,we),q=ss(C,new I(D(a,Ge),D(a,He),D(a,Je),0,0,0,0,0,0),"compatible"),L=fc(q,C,k,0,0,0,1,0,0,0,0,0,0),U=K.default.subtract(L,K.default.BigInt(D(q,mt)));if(K.default.lessThanOrEqual(U,Un))throw new RangeError("cannot round a ZonedDateTime in a calendar with zero or negative length days");return{year:d,month:m,day:p,hour:w,minute:P,second:S,millisecond:M,microsecond:A,nanosecond:B}=wC(d,m,p,w,P,S,M,A,B,n,o,i,K.default.toNumber(U)),po(S8(d,m,p,w,P,S,M,A,B,"option",eu(C,D(this,jo)),C,"compatible","prefer",!1),C,D(this,we))}equals(e){if(!Qe(this))throw new TypeError("invalid receiver");let r=K_(e),n=D(this,mt),i=D(r,mt);return!!K.default.equal(K.default.BigInt(n),K.default.BigInt(i))&&!!Xce(D(this,zr),D(r,zr))&&lx(D(this,we),D(r,we))}toString(e){if(!Qe(this))throw new TypeError("invalid receiver");let r=Xt(e),n=ix(r),i=ox(r),o=function(S){return Lp(S,"offset",["auto","never"],"auto")}(r),s=Xf(r,"trunc"),a=ca(r,"smallestUnit","time",void 0);if(a==="hour")throw new RangeError('smallestUnit must be a time unit other than "hour"');let d=function(S){return Lp(S,"timeZoneName",["auto","never","critical"],"auto")}(r),{precision:m,unit:p,increment:w}=sx(a,i);return uce(this,m,n,d,o,{unit:p,increment:w,roundingMode:s})}toLocaleString(e,r){if(!Qe(this))throw new TypeError("invalid receiver");let n=Xt(r),i=u$e(null);if(qb(i,n,["timeZone"]),n.timeZone!==void 0)throw new TypeError("ZonedDateTime toLocaleString does not accept a timeZone option");i.year===void 0&&i.month===void 0&&i.day===void 0&&i.weekday===void 0&&i.dateStyle===void 0&&i.hour===void 0&&i.minute===void 0&&i.second===void 0&&i.timeStyle===void 0&&i.dayPeriod===void 0&&i.timeZoneName===void 0&&(i.timeZoneName="short");let o=J_(D(this,zr));if(jb(o))throw new RangeError("toLocaleString does not support offset string time zones");o=hC(o),i.timeZone=o;let s=new ih(e,i),a=nt(f$e,s,[]).calendar,d=go(D(this,we));if(d!=="iso8601"&&a!=="iso8601"&&a!==d)throw new RangeError(`cannot format ZonedDateTime with calendar ${d} in locale with calendar ${a}`);return s.format(D(this,jo))}toJSON(){if(!Qe(this))throw new TypeError("invalid receiver");return uce(this,"auto")}valueOf(){throw new TypeError("use compare() or equals() to compare Temporal.ZonedDateTime")}startOfDay(){if(!Qe(this))throw new TypeError("invalid receiver");let e=un(this),r=Fe("%Temporal.PlainDateTime%"),n=D(this,we),i=new r(D(e,Ge),D(e,He),D(e,Je),0,0,0,0,0,0,n),o=D(this,zr);return po(D(ss(o,i,"compatible"),mt),o,n)}toInstant(){if(!Qe(this))throw new TypeError("invalid receiver");return new(Fe("%Temporal.Instant%"))(D(this,mt))}toPlainDate(){if(!Qe(this))throw new TypeError("invalid receiver");return Zb(un(this))}toPlainTime(){if(!Qe(this))throw new TypeError("invalid receiver");return dC(un(this))}toPlainDateTime(){if(!Qe(this))throw new TypeError("invalid receiver");return un(this)}toPlainYearMonth(){if(!Qe(this))throw new TypeError("invalid receiver");let e=D(this,we);return by(e,Gt(this,li(e,["monthCode","year"]),[]))}toPlainMonthDay(){if(!Qe(this))throw new TypeError("invalid receiver");let e=D(this,we);return Hb(e,Gt(this,li(e,["day","monthCode"]),[]))}getISOFields(){if(!Qe(this))throw new TypeError("invalid receiver");let e=un(this),r=D(this,zr);return{calendar:D(this,we),isoDay:D(e,Je),isoHour:D(e,Ot),isoMicrosecond:D(e,jt),isoMillisecond:D(e,Ct),isoMinute:D(e,Bt),isoMonth:D(e,He),isoNanosecond:D(e,Nt),isoSecond:D(e,Dt),isoYear:D(e,Ge),offset:kD(r,D(this,jo)),timeZone:r}}getCalendar(){if(!Qe(this))throw new TypeError("invalid receiver");return nw(D(this,we))}getTimeZone(){if(!Qe(this))throw new TypeError("invalid receiver");return Qce(D(this,zr))}static from(e,r){let n=Xt(r);return Qe(e)?(Vb(n),x8(n,"reject"),ni(n),po(D(e,mt),D(e,zr),D(e,we))):K_(e,n)}static compare(e,r){let n=K_(e),i=K_(r),o=D(n,mt),s=D(i,mt);return K.default.lessThan(K.default.BigInt(o),K.default.BigInt(s))?-1:K.default.greaterThan(K.default.BigInt(o),K.default.BigInt(s))?1:0}};function un(t){return Ia(D(t,zr),D(t,jo),D(t,we))}wl(ex,"Temporal.ZonedDateTime");var Py=Object.freeze({__proto__:null,Calendar:bn,Duration:hl,Instant:ac,Now:Bfe,PlainDate:xy,PlainDateTime:Ey,PlainMonthDay:Q_,PlainTime:Xd,PlainYearMonth:X_,TimeZone:my,ZonedDateTime:ex});var l$e=[ac,bn,xy,Ey,hl,Q_,Xd,my,X_,ex];for(let t of l$e){let e=Object.getOwnPropertyDescriptor(t,"prototype");(e.configurable||e.enumerable||e.writable)&&(e.configurable=!1,e.enumerable=!1,e.writable=!1,Object.defineProperty(t,"prototype",e))}var Zt=class{static async sleep(e){return new Promise(r=>setTimeout(r,e))}static async minimalSleep(){await Zt.sleep(2)}static getCurrentTimestamp(){return Py.Now.instant().toString({smallestUnit:"microseconds"})}static createTimestamp(e){let{year:r,month:n,day:i,hour:o,minute:s,second:a,millisecond:d,microsecond:m}=e;return Py.ZonedDateTime.from({timeZone:"UTC",year:r,month:n,day:i,hour:o,minute:s,second:a,millisecond:d,microsecond:m}).toInstant().toString({smallestUnit:"microseconds"})}static createOffsetTimestamp(e,r){let n=r?Py.Instant.from(r):Py.Now.instant(),i=Py.Duration.from(e);return n.add(i).toString({smallestUnit:"microseconds"})}static validateTimestamp(e){try{Py.Instant.from(e)}catch{throw new be("TimestampInvalid",`Invalid timestamp: ${e}`)}}};var At=class{get message(){if(this._message.authorization===void 0)throw new be("RecordsWriteMissingSigner","This RecordsWrite is not yet signed, JSON message cannot be generated from an incomplete state.");return this._message}get author(){return this._author}get signaturePayload(){return this._signaturePayload}get owner(){return this._owner}get ownerSignaturePayload(){return this._ownerSignaturePayload}get isSignedByAuthorDelegate(){return Ue.isSignedByAuthorDelegate(this._message)}get isSignedByOwnerDelegate(){return Ue.isSignedByOwnerDelegate(this._message)}get signer(){return Ue.getSigner(this._message)}get ownerSignatureSigner(){return this._message.authorization?.ownerSignature===void 0?void 0:zt.getSignerDid(this._message.authorization.ownerSignature.signatures[0])}constructor(e,r){this.parentContextId=r,this._message=e,e.authorization!==void 0&&(this._author=pt.getAuthor(e),this._signaturePayload=zt.decodePlainObjectPayload(e.authorization.signature),e.authorization.ownerSignature!==void 0&&(e.authorization.ownerDelegatedGrant!==void 0?this._owner=Ue.getSigner(e.authorization.ownerDelegatedGrant):this._owner=zt.getSignerDid(e.authorization.ownerSignature.signatures[0]),this._ownerSignaturePayload=zt.decodePlainObjectPayload(e.authorization.ownerSignature))),this.attesters=At.getAttesters(e)}static async parse(e){let r=JSON.parse(JSON.stringify(e));await Ue.validateSignatureStructure(r.authorization.signature,r.descriptor,"RecordsWriteSignaturePayload"),r.authorization.ownerSignature!==void 0&&await Ue.validateSignatureStructure(r.authorization.ownerSignature,r.descriptor),await At.validateAttestationIntegrity(r);let n=new At(r);return await n.validateIntegrity(),n}static async create(e){if(e.protocol===void 0&&e.protocolPath!==void 0||e.protocol!==void 0&&e.protocolPath===void 0)throw new be("RecordsWriteCreateProtocolAndProtocolPathMutuallyInclusive","`protocol` and `protocolPath` must both be defined or undefined at the same time");if(e.data===void 0&&e.dataCid===void 0||e.data!==void 0&&e.dataCid!==void 0)throw new be("RecordsWriteCreateDataAndDataCidMutuallyExclusive","one and only one parameter between `data` and `dataCid` is required");if(e.dataCid===void 0&&e.dataSize!==void 0||e.dataCid!==void 0&&e.dataSize===void 0)throw new be("RecordsWriteCreateDataCidAndDataSizeMutuallyInclusive","`dataCid` and `dataSize` must both be defined or undefined at the same time");if(e.signer===void 0&&e.delegatedGrant!==void 0)throw new be("RecordsWriteCreateMissingSigner","`signer` must be given when `delegatedGrant` is given");let r=e.dataCid??await Qn.computeDagPbCidFromBytes(e.data),n=e.dataSize??e.data.length,i=Zt.getCurrentTimestamp(),o={interface:"Records",method:"Write",protocol:e.protocol!==void 0?Jf(e.protocol):void 0,protocolPath:e.protocolPath,recipient:e.recipient,schema:e.schema!==void 0?Vd(e.schema):void 0,tags:e.tags,parentId:At.getRecordIdFromContextId(e.parentContextId),dataCid:r,dataSize:n,dateCreated:e.dateCreated??i,messageTimestamp:e.messageTimestamp??i,published:e.published,datePublished:e.datePublished,dataFormat:e.dataFormat};e.published===!0&&e.datePublished===void 0&&(o.datePublished=i),rn(o);let s=e.recordId,a=await Qn.computeCid(o),d=await At.createAttestation(a,e.attestationSigners),m=await At.createEncryptionProperty(o,e.encryptionInput),p={recordId:s,descriptor:o};d!==void 0&&(p.attestation=d),m!==void 0&&(p.encryption=m);let w=new At(p,e.parentContextId);return e.signer!==void 0&&await w.sign({signer:e.signer,delegatedGrant:e.delegatedGrant,permissionGrantId:e.permissionGrantId,protocolRole:e.protocolRole}),w}static getRecordIdFromContextId(e){return e?.split("/").filter(r=>r!=="").pop()}static async createFrom(e){let r=e.recordsWriteMessage,n=await At.parse(r),i=Zt.getCurrentTimestamp(),o=e.published??(e.datePublished?!0:r.descriptor.published),s;e.datePublished?s=e.datePublished:o&&(r.descriptor.published?s=r.descriptor.datePublished:s=i);let a={recipient:r.descriptor.recipient,recordId:r.recordId,dateCreated:r.descriptor.dateCreated,protocol:r.descriptor.protocol,protocolPath:r.descriptor.protocolPath,schema:r.descriptor.schema,parentContextId:pt.getParentContextFromOfContextId(r.contextId),messageTimestamp:e.messageTimestamp??i,published:o,datePublished:s,tags:e.tags,data:e.data,dataCid:e.data?void 0:r.descriptor.dataCid,dataSize:e.data?void 0:r.descriptor.dataSize,dataFormat:e.dataFormat??r.descriptor.dataFormat,protocolRole:e.protocolRole??n.signaturePayload.protocolRole,delegatedGrant:e.delegatedGrant,signer:e.signer,attestationSigners:e.attestationSigners};return await At.create(a)}toJSON(){return this.message}async encryptSymmetricEncryptionKey(e){this._message.encryption=await At.createEncryptionProperty(this._message.descriptor,e),delete this._message.authorization,this._signaturePayload=void 0,this._author=void 0}async sign(e){let{signer:r,delegatedGrant:n,permissionGrantId:i,protocolRole:o}=e,s,a;n!==void 0?(s=await Ue.getCid(n),a=zt.getSignerDid(n.authorization.signature.signatures[0])):a=zt.extractDid(r.keyId);let d=this._message.descriptor,m=await Qn.computeCid(d);this._message.recordId=this._message.recordId??await At.getEntryId(a,d),this._message.descriptor.protocol!==void 0&&(this.parentContextId===void 0||this.parentContextId===""?this._message.contextId=this._message.recordId:this._message.contextId=this.parentContextId+"/"+this._message.recordId);let p=await At.createSignerSignature({recordId:this._message.recordId,contextId:this._message.contextId,descriptorCid:m,attestation:this._message.attestation,encryption:this._message.encryption,signer:r,delegatedGrantId:s,permissionGrantId:i,protocolRole:o});this._message.authorization={signature:p},n!==void 0&&(this._message.authorization.authorDelegatedGrant=n),this._signaturePayload=zt.decodePlainObjectPayload(p),this._author=a}async signAsOwner(e){if(this._author===void 0)throw new be("RecordsWriteSignAsOwnerUnknownAuthor","Unable to sign as owner without message signature because owner needs to sign over `recordId` which depends on author DID.");let r=this._message.descriptor,n=await Ue.createSignature(r,e);this._message.authorization.ownerSignature=n,this._ownerSignaturePayload=zt.decodePlainObjectPayload(n),this._owner=zt.extractDid(e.keyId)}async signAsOwnerDelegate(e,r){if(this._author===void 0)throw new be("RecordsWriteSignAsOwnerDelegateUnknownAuthor","Unable to sign as owner delegate without message signature because owner delegate needs to sign over `recordId` which depends on author DID.");let n=await Ue.getCid(r),i=this._message.descriptor,o=await Ue.createSignature(i,e,{delegatedGrantId:n});this._message.authorization.ownerSignature=o,this._message.authorization.ownerDelegatedGrant=r,this._ownerSignaturePayload=zt.decodePlainObjectPayload(o),this._owner=zt.getSignerDid(r.authorization.signature.signatures[0])}async validateIntegrity(){if(await this.isInitialWrite()){let n=this.message.descriptor.dateCreated,i=this.message.descriptor.messageTimestamp;if(i!==n)throw new be("RecordsWriteValidateIntegrityDateCreatedMismatch",`messageTimestamp ${i} must match dateCreated ${n} for the initial write`);if(this.message.descriptor.protocol!==void 0&&this.message.descriptor.parentId===void 0){let o=await this.getEntryId();if(this.message.contextId!==o)throw new be("RecordsWriteValidateIntegrityContextIdMismatch",`contextId in message: ${this.message.contextId} does not match deterministic contextId: ${o}`)}}let r=this.signaturePayload;if(this.message.recordId!==r.recordId)throw new be("RecordsWriteValidateIntegrityRecordIdUnauthorized",`recordId in message ${this.message.recordId} does not match recordId in authorization: ${r.recordId}`);if(this.message.contextId!==r.contextId)throw new be("RecordsWriteValidateIntegrityContextIdNotInSignerSignaturePayload",`contextId in message ${this.message.contextId} does not match contextId in authorization: ${r.contextId}`);if(await pt.validateDelegatedGrantReferentialIntegrity(this.message,r,this.ownerSignaturePayload),r.attestationCid!==void 0){let n=await Qn.computeCid(this.message.attestation),i=r.attestationCid;if(i!==n)throw new be("RecordsWriteValidateIntegrityAttestationMismatch",`CID ${n} of attestation property in message does not match attestationCid in authorization: ${i}`)}if(r.encryptionCid!==void 0){let n=await Qn.computeCid(this.message.encryption),i=r.encryptionCid;if(i!==n)throw new be("RecordsWriteValidateIntegrityEncryptionCidMismatch",`CID ${n} of encryption property in message does not match encryptionCid in authorization: ${i}`)}this.message.descriptor.protocol!==void 0&&Ta(this.message.descriptor.protocol),this.message.descriptor.schema!==void 0&&Xc(this.message.descriptor.schema),Zt.validateTimestamp(this.message.descriptor.messageTimestamp),Zt.validateTimestamp(this.message.descriptor.dateCreated),this.message.descriptor.datePublished&&Zt.validateTimestamp(this.message.descriptor.datePublished)}static async validateAttestationIntegrity(e){if(e.attestation===void 0)return;if(e.attestation.signatures.length!==1)throw new be("RecordsWriteAttestationIntegrityMoreThanOneSignature",`Currently implementation only supports 1 attester, but got ${e.attestation.signatures.length}`);let r=zt.decodePlainObjectPayload(e.attestation),{descriptorCid:n}=r,i=await Qn.computeCid(e.descriptor);if(n!==i)throw new be("RecordsWriteAttestationIntegrityDescriptorCidMismatch",`descriptorCid ${n} does not match expected descriptorCid ${i}`);let o=Object.keys(r).length;if(o>1)throw new be("RecordsWriteAttestationIntegrityInvalidPayloadProperty",`Only 'descriptorCid' is allowed in attestation payload, but got ${o} properties.`)}async getEntryId(){return await At.getEntryId(this.author,this.message.descriptor)}static async getEntryId(e,r){if(e===void 0)throw new be("RecordsWriteGetEntryIdUndefinedAuthor","Property `author` is needed to compute entry ID.");let n={...r};return n.author=e,await Qn.computeCid(n)}async isInitialWrite(){return await this.getEntryId()===this.message.recordId}async constructIndexes(e){let r=this.message,{tags:n,...i}=r.descriptor;delete i.published;let o={...i,isLatestBaseState:e,published:!!r.descriptor.published,author:this.author,recordId:r.recordId,entryId:await At.getEntryId(this.author,this.message.descriptor)};if(n!==void 0&&e===!0){let s=pt.buildTagIndexes({...n});o={...o,...s}}return this.attesters.length>0&&(o.attester=this.attesters[0]),r.contextId!==void 0&&(o.contextId=r.contextId),o}async authorizeAuthorDelegate(e){let r=await Qi.parse(this.message.authorization.authorDelegatedGrant);await ti.authorizeWrite({recordsWriteMessage:this.message,expectedGrantor:this.author,expectedGrantee:this.signer,permissionGrant:r,messageStore:e})}async authorizeOwnerDelegate(e){let r=await Qi.parse(this.message.authorization.ownerDelegatedGrant);await ti.authorizeWrite({recordsWriteMessage:this.message,expectedGrantor:this.owner,expectedGrantee:this.ownerSignatureSigner,permissionGrant:r,messageStore:e})}static async isInitialWrite(e){if(e.descriptor.interface!=="Records"||e.descriptor.method!=="Write")return!1;let r=e,n=pt.getAuthor(r);return await At.getEntryId(n,r.descriptor)===r.recordId}static async createEncryptionProperty(e,r){if(r===void 0)return;let n=[];for(let o of r.keyEncryptionInputs){if(o.derivationScheme==="protocolPath"&&e.protocol===void 0)throw new be("RecordsWriteMissingProtocol","`protocols` encryption scheme cannot be applied to record without the `protocol` property.");if(o.derivationScheme==="schemas"&&e.schema===void 0)throw new be("RecordsWriteMissingSchema","`schemas` encryption scheme cannot be applied to record without the `schema` property.");let s=sn.publicJwkToBytes(o.publicKey),a=await Qc.eciesSecp256k1Encrypt(s,r.key),d=et.bytesToBase64Url(a.ciphertext),m=await sn.publicKeyToJwk(a.ephemeralPublicKey),p=et.bytesToBase64Url(a.initializationVector),w=et.bytesToBase64Url(a.messageAuthenticationCode),P={rootKeyId:o.publicKeyId,algorithm:o.algorithm??"ECIES-ES256K",derivationScheme:o.derivationScheme,ephemeralPublicKey:m,initializationVector:p,messageAuthenticationCode:w,encryptedKey:d};o.derivationScheme==="protocolContext"&&(P.derivedPublicKey=o.publicKey),n.push(P)}return{algorithm:r.algorithm??"A256CTR",initializationVector:et.bytesToBase64Url(r.initializationVector),keyEncryption:n}}static async createAttestation(e,r){if(r===void 0||r.length===0)return;let n={descriptorCid:e},i=et.objectToBytes(n);return(await Wd.create(i,r)).getJws()}static async createSignerSignature(e){let{recordId:r,contextId:n,descriptorCid:i,attestation:o,encryption:s,signer:a,delegatedGrantId:d,permissionGrantId:m,protocolRole:p}=e,w=o?await Qn.computeCid(o):void 0,P=s?await Qn.computeCid(s):void 0,S={recordId:r,descriptorCid:i,contextId:n,attestationCid:w,encryptionCid:P,delegatedGrantId:d,permissionGrantId:m,protocolRole:p};rn(S);let M=et.objectToBytes(S);return(await Wd.create(M,[a])).getJws()}static async getInitialWrite(e){for(let r of e)if(await At.isInitialWrite(r))return r;throw new be("RecordsWriteGetInitialWriteNotFound","Initial write is not found.")}static verifyEqualityOfImmutableProperties(e,r){let n=["dataCid","dataSize","dataFormat","datePublished","published","messageTimestamp","tags"],i=[];i.push(...Object.keys(e.descriptor)),i.push(...Object.keys(r.descriptor)),i=[...new Set(i)];for(let o of i)if(n.indexOf(o)===-1){let s=e.descriptor[o],a=r.descriptor[o];if(a!==s)throw new be("RecordsWriteImmutablePropertyChanged",`${o} is an immutable property: cannot change '${s}' to '${a}'`)}return!0}static getAttesters(e){return(e.attestation?.signatures??[]).map(i=>zt.getSignerDid(i))}static async fetchInitialRecordsWrite(e,r,n){let i={entryId:n},{messages:o}=await e.query(r,[i]);return o.length===0?void 0:await At.parse(o[0])}};async function di(t,e){if(t===void 0)throw new be("AuthenticateJwsMissing","Missing JWS.");if(await _a.verifySignatures(t.signature,e),t.ownerSignature!==void 0&&await _a.verifySignatures(t.ownerSignature,e),t.authorDelegatedGrant!==void 0){let r=await At.parse(t.authorDelegatedGrant);await _a.verifySignatures(r.message.authorization.signature,e)}if(t.ownerDelegatedGrant!==void 0){let r=await At.parse(t.ownerDelegatedGrant);await _a.verifySignatures(r.message.authorization.signature,e)}}async function El(t,e){if(e.author!==t)throw new be("AuthorizationAuthorNotOwner",`Message authored by ${e.author}, not authored by expected owner ${t}.`)}E();var hx=class{async isActiveTenant(e){return{isActiveTenant:!0}}};E();E();var ki=class{get message(){return this._message}get signer(){return this._signer}get author(){return this._author}get signaturePayload(){return this._signaturePayload}constructor(e){this._message=e,e.authorization!==void 0&&(this._signer=Ue.getSigner(e),e.authorization.authorDelegatedGrant!==void 0?this._author=Ue.getSigner(e.authorization.authorDelegatedGrant):this._author=this._signer,this._signaturePayload=zt.decodePlainObjectPayload(e.authorization.signature))}toJSON(){return this.message}};var Sl=class extends ki{static async parse(e){if(e.descriptor.filter.published===!1&&(e.descriptor.dateSort==="publishedAscending"||e.descriptor.dateSort==="publishedDescending"))throw new be("RecordsQueryParseFilterPublishedSortInvalid",`queries must not filter for \`published:false\` and sort by ${e.descriptor.dateSort}`);let r;if(e.authorization!==void 0&&(r=await Ue.validateSignatureStructure(e.authorization.signature,e.descriptor)),await pt.validateDelegatedGrantReferentialIntegrity(e,r),r?.protocolRole!==void 0&&e.descriptor.filter.protocolPath===void 0)throw new be("RecordsQueryFilterMissingRequiredProperties","Role-authorized queries must include `protocolPath` in the filter");return e.descriptor.filter.protocol!==void 0&&Ta(e.descriptor.filter.protocol),e.descriptor.filter.schema!==void 0&&Xc(e.descriptor.filter.schema),Zt.validateTimestamp(e.descriptor.messageTimestamp),new Sl(e)}static async create(e){let r={interface:"Records",method:"Query",messageTimestamp:e.messageTimestamp??Zt.getCurrentTimestamp(),filter:pt.normalizeFilter(e.filter),dateSort:e.dateSort,pagination:e.pagination};if(e.filter.published===!1&&(e.dateSort==="publishedAscending"||e.dateSort==="publishedDescending"))throw new be("RecordsQueryCreateFilterPublishedSortInvalid",`queries must not filter for \`published:false\` and sort by ${e.dateSort}`);rn(r);let n=e.signer,i;n&&(i=await Ue.createAuthorization({descriptor:r,signer:n,protocolRole:e.protocolRole,delegatedGrant:e.delegatedGrant}));let o={descriptor:r,authorization:i};return Ue.validateJsonSchema(o),new Sl(o)}async authorizeDelegate(e){let r=await Qi.parse(this.message.authorization.authorDelegatedGrant);await ti.authorizeQueryOrSubscribe({incomingMessage:this.message,expectedGrantee:this.signer,expectedGrantor:this.author,permissionGrant:r,messageStore:e})}};E();E();var H8=or(a8(),1),cs=class{static async toBytes(e){return new Promise((r,n)=>{let i=[];e.on("data",o=>{i.push(o)}),e.on("end",()=>{let o=cs.concatenateArrayOfBytes(i);r(o)}),e.on("error",n)})}static async toObject(e){let r=await cs.toBytes(e);return et.bytesToObject(r)}static concatenateArrayOfBytes(e){let r=e.reduce((o,s)=>o+s.length,0),n=new Uint8Array(r),i=0;for(let o of e)n.set(o,i),i+=o.length;return n}static fromBytes(e){let n=0;return new H8.Readable({read(o){n+1e5>e.length?(this.push(e.subarray(n)),this.push(null)):(this.push(e.subarray(n,n+1e5)),n=n+1e5)}})}static fromObject(e){let r=et.objectToBytes(e);return cs.fromBytes(r)}static duplicateDataStream(e,r){let n=[];for(let i=0;i<r;i++){let o=new H8.PassThrough;e.pipe(o),n.push(o)}return n}};E();E();E();var Ml=class extends ki{static async parse(e){return Ue.validateJsonSchema(e),await Ue.validateSignatureStructure(e.authorization.signature,e.descriptor),Zt.validateTimestamp(e.descriptor.messageTimestamp),new Ml(e)}static async create(e){let r={interface:"Events",method:"Get",messageTimestamp:e.messageTimestamp??Zt.getCurrentTimestamp()};e.cursor&&(r.cursor=e.cursor);let n=await Ue.createAuthorization({descriptor:r,signer:e.signer}),i={descriptor:r,authorization:n};return Ue.validateJsonSchema(i),new Ml(i)}};E();function er(t,e){let r=t instanceof Error?t.message:"Error";return{status:{code:e,detail:r}}}var Z8=class{constructor(e,r){this.didResolver=e;this.eventLog=r}async handle({tenant:e,message:r}){let n;try{n=await Ml.parse(r)}catch(a){return er(a,400)}try{await di(r.authorization,this.didResolver),await El(e,n)}catch(a){return er(a,401)}let{cursor:i}=r.descriptor,{events:o,cursor:s}=await this.eventLog.getEvents(e,i);return{status:{code:200,detail:"OK"},entries:o,cursor:s}}};E();E();var Gp=class{static normalizeFilters(e){let r=[];for(let n of e){let i;this.isRecordsFilter(n)?i=pt.normalizeFilter(n):i=n,rn(i),U_(i)||r.push(i)}return r}static convertFilters(e){let r=[];for(let n of e)this.isRecordsFilter(n)?r.push(pt.convertFilter(n)):r.push(this.convertFilter(n));return r}static convertFilter(e){let r={...e},{dateUpdated:n}=e,i=n?fi.convertRangeCriterion(n):void 0;return i&&(r.messageTimestamp=i,delete r.dateUpdated),r}static isRecordsFilter(e){return"author"in e||"dateCreated"in e||"dataFormat"in e||"dataSize"in e||"parentId"in e||"recordId"in e||"schema"in e||"protocol"in e||"protocolPath"in e||"recipient"in e}};E();var Pl=class extends ki{static async parse(e){Ue.validateJsonSchema(e),await Ue.validateSignatureStructure(e.authorization.signature,e.descriptor);for(let r of e.descriptor.filters)"protocol"in r&&r.protocol!==void 0&&Ta(r.protocol),"schema"in r&&r.schema!==void 0&&Xc(r.schema);return new Pl(e)}static async create(e){let r={interface:"Events",method:"Query",filters:Gp.normalizeFilters(e.filters),messageTimestamp:e.messageTimestamp??Zt.getCurrentTimestamp(),cursor:e.cursor};rn(r);let n=await Ue.createAuthorization({descriptor:r,signer:e.signer}),i={descriptor:r,authorization:n};return Ue.validateJsonSchema(i),new Pl(i)}};var J8=class{constructor(e,r){this.didResolver=e;this.eventLog=r}async handle({tenant:e,message:r}){let n;try{n=await Pl.parse(r)}catch(a){return er(a,400)}try{await di(r.authorization,this.didResolver),await El(e,n)}catch(a){return er(a,401)}let i=Gp.convertFilters(r.descriptor.filters),{events:o,cursor:s}=await this.eventLog.queryEvents(e,i,r.descriptor.cursor);return{status:{code:200,detail:"OK"},entries:o,cursor:s}}};E();E();var Al=class extends ki{static async parse(e){Ue.validateJsonSchema(e),await Ue.validateSignatureStructure(e.authorization.signature,e.descriptor);for(let r of e.descriptor.filters)"protocol"in r&&r.protocol!==void 0&&Ta(r.protocol),"schema"in r&&r.schema!==void 0&&Xc(r.schema);return Zt.validateTimestamp(e.descriptor.messageTimestamp),new Al(e)}static async create(e){let r=Zt.getCurrentTimestamp(),n={interface:"Events",method:"Subscribe",filters:e.filters??[],messageTimestamp:e.messageTimestamp??r};rn(n);let i=await Ue.createAuthorization({descriptor:n,signer:e.signer}),o={descriptor:n,authorization:i};return Ue.validateJsonSchema(o),new Al(o)}};var Y8=class{constructor(e,r){this.didResolver=e;this.eventStream=r}async handle({tenant:e,message:r,subscriptionHandler:n}){if(this.eventStream===void 0)return er(new be("EventsSubscribeEventStreamUnimplemented","Subscriptions are not supported"),501);let i;try{i=await Al.parse(r)}catch(p){return er(p,400)}try{await di(r.authorization,this.didResolver),await El(e,i)}catch(p){return er(p,401)}let{filters:o}=r.descriptor,s=Gp.convertFilters(o),a=await Ue.getCid(r),d=(p,w,P)=>{e===p&&fi.matchAnyFilter(P,s)&&n(w)},m=await this.eventStream.subscribe(e,a,d);return{status:{code:200,detail:"OK"},subscription:m}}};E();E();var tu=class extends ki{static async parse(e){return Ue.validateJsonSchema(e),this.validateMessageCids(e.descriptor.messageCids),await Ue.validateSignatureStructure(e.authorization.signature,e.descriptor),Zt.validateTimestamp(e.descriptor.messageTimestamp),new tu(e)}static async create(e){let r={interface:"Messages",method:"Get",messageCids:e.messageCids,messageTimestamp:e?.messageTimestamp??Zt.getCurrentTimestamp()},n=await Ue.createAuthorization({descriptor:r,signer:e.signer}),i={descriptor:r,authorization:n};return Ue.validateJsonSchema(i),tu.validateMessageCids(e.messageCids),new tu(i)}static validateMessageCids(e){for(let r of e)try{Qn.parseCid(r)}catch{throw new be("MessageGetInvalidCid",`${r} is not a valid CID`)}}};var Q8=class{constructor(e,r,n){this.didResolver=e;this.messageStore=r;this.dataStore=n}async handle({tenant:e,message:r}){let n;try{n=await tu.parse(r)}catch(a){return er(a,400)}try{await di(r.authorization,this.didResolver),await El(e,n)}catch(a){return er(a,401)}let i=[],o=new Set(r.descriptor.messageCids);for(let a of o){let d=this.messageStore.get(e,a).then(m=>({messageCid:a,message:m})).catch(m=>({messageCid:a,message:void 0,error:`Failed to get message ${a}`}));i.push(d)}let s=await Promise.all(i);for(let a of s){let{message:d}=a;if(!d)continue;let{interface:m,method:p}=d.descriptor;if(m!=="Records"||p!=="Write")continue;let w=d;w.encodedData!==void 0&&(a.encodedData=w.encodedData,delete w.encodedData)}return{status:{code:200,detail:"OK"},entries:s}}};E();E();var bde=or(_N(),1);E();var $o=class extends ki{static async parse(e){return Ue.validateJsonSchema(e),$o.validateProtocolDefinition(e.descriptor.definition),await Ue.validateSignatureStructure(e.authorization.signature,e.descriptor),Zt.validateTimestamp(e.descriptor.messageTimestamp),new $o(e)}static async create(e){let r={interface:"Protocols",method:"Configure",messageTimestamp:e.messageTimestamp??Zt.getCurrentTimestamp(),definition:$o.normalizeDefinition(e.definition)},n=await Ue.createAuthorization({descriptor:r,signer:e.signer,permissionGrantId:e.permissionGrantId}),i={descriptor:r,authorization:n};return Ue.validateJsonSchema(i),$o.validateProtocolDefinition(i.descriptor.definition),new $o(i)}static validateProtocolDefinition(e){let{protocol:r,types:n}=e;Ta(r);for(let i in n){let o=n[i].schema;o!==void 0&&Xc(o)}$o.validateStructure(e)}static validateStructure(e){let r=Object.keys(e.types),n=$o.fetchAllRolePathsRecursively("",e.structure,[]);$o.validateRuleSetRecursively({ruleSet:e.structure,ruleSetProtocolPath:"",recordTypes:r,roles:n})}static fetchAllRolePathsRecursively(e,r,n){if(e.split("/").length>10)throw new be("ProtocolsConfigureRecordNestingDepthExceeded","Record nesting depth exceeded 10 levels.");for(let i in r){if(i.startsWith("$"))continue;let o=r[i],s;e===""?s=i:s=`${e}/${i}`,o.$role?n.push(s):$o.fetchAllRolePathsRecursively(s,o,n)}return n}static validateRuleSetRecursively(e){let{ruleSet:r,ruleSetProtocolPath:n,recordTypes:i,roles:o}=e;if(r.$size!==void 0){let{min:a=0,max:d}=r.$size;if(d!==void 0&&d<a)throw new be("ProtocolsConfigureInvalidSize",`Invalid size range found: max limit ${d} less than min limit ${a} at protocol path '${n}'`)}if(r.$tags){let a=new bde.default.default,{$allowUndefinedTags:d,$requiredTags:m,...p}=r.$tags;for(let w in p){let P=p[w];if(!a.validateSchema(P)){let S=a.errorsText(a.errors,{dataVar:`${n}/$tags/${w}`});throw new be("ProtocolsConfigureInvalidTagSchema",`tags schema validation error: ${S}`)}}}let s=r.$actions??[];for(let a=0;a<s.length;a++){let d=s[a];if(d.role!==void 0&&!o.includes(d.role))throw new be("ProtocolsConfigureRoleDoesNotExistAtGivenPath",`Role in action ${JSON.stringify(d)} for rule set ${n} does not exist.`);if(d.who==="anyone"&&d.of)throw new be("ProtocolsConfigureInvalidActionOfNotAllowed",`'of' is not allowed at rule set protocol path (${n})`);if(d.who==="recipient"&&d.of===void 0&&d.can.some(p=>!["co-update","co-delete","co-prune"].includes(p)))throw new be("ProtocolsConfigureInvalidRecipientOfAction","Rules for `recipient` without `of` property must have `can` containing only `co-update`, `co-delete`, and `co-prune`.");if(d.who==="author"&&!d.of)throw new be("ProtocolsConfigureInvalidActionMissingOf","'of' is required when 'author' is specified as 'who'");if(d.can!==void 0){if(d.can.includes("update")&&!d.can.includes("create"))throw new be("ProtocolsConfigureInvalidActionUpdateWithoutCreate",`Action rule ${JSON.stringify(d)} contains 'update' action but missing the required 'create' action.`);if(d.can.includes("delete")&&!d.can.includes("create"))throw new be("ProtocolsConfigureInvalidActionDeleteWithoutCreate",`Action rule ${JSON.stringify(d)} contains 'delete' action but missing the required 'create' action.`)}for(let m=a+1;m<s.length;m++){let p=s[m];if(d.who!==void 0){if(d.who===p.who&&d.of===p.of)throw new be("ProtocolsConfigureDuplicateActorInRuleSet",`More than one action rule per actor ${d.who} of ${d.of} not allowed within a rule set: ${JSON.stringify(d)}`)}else if(d.role===p.role)throw new be("ProtocolsConfigureDuplicateRoleInRuleSet",`More than one action rule per role ${d.role} not allowed within a rule set: ${JSON.stringify(d)}`)}}for(let a in r){if(a.startsWith("$"))continue;if(!i.includes(a))throw new be("ProtocolsConfigureInvalidRuleSetRecordType",`Rule set ${a} is not declared as an allowed type in the protocol definition.`);let d=r[a],m;n===""?m=a:m=`${n}/${a}`,$o.validateRuleSetRecursively({ruleSet:d,ruleSetProtocolPath:m,recordTypes:i,roles:o})}}static normalizeDefinition(e){let r={...e.types};for(let n in r){let i=r[n].schema;i!==void 0&&(r[n].schema=Vd(i))}return{...e,protocol:Jf(e.protocol),types:r}}};var gw=class{constructor(e,r,n,i){this.didResolver=e;this.messageStore=r;this.eventLog=n;this.eventStream=i}async handle({tenant:e,message:r}){let n;try{n=await $o.parse(r)}catch(p){return er(p,400)}try{await di(r.authorization,this.didResolver),await El(e,n)}catch(p){return er(p,401)}let i={interface:"Protocols",method:"Configure",protocol:r.descriptor.definition.protocol},{messages:o}=await this.messageStore.query(e,[i]),s=await Ue.getNewestMessage(o),a=!1;(s===void 0||await Ue.isNewer(r,s))&&(a=!0,s=r);let d;if(a){let p=gw.constructIndexes(n);await this.messageStore.put(e,r,p);let w=await Ue.getCid(r);await this.eventLog.append(e,w,p),this.eventStream!==void 0&&this.eventStream.emit(e,{message:r},p),d={status:{code:202,detail:"Accepted"}}}else d={status:{code:409,detail:"Conflict"}};let m=[];for(let p of o)if(await Ue.isNewer(s,p)){let w=await Ue.getCid(p);m.push(w),await this.messageStore.delete(e,w)}return await this.eventLog.deleteEventsByCid(e,m),d}static constructIndexes(e){let{definition:r,...n}=e.message.descriptor,{author:i}=e;return{...n,author:i,protocol:r.protocol,published:r.published}}};E();E();E();var ds=class{static parseRequest(e){return et.base64UrlToObject(e)}static async createRequest(e){let r=ds.normalizePermissionScope(e.scope),n={description:e.description,delegated:e.delegated,scope:r,conditions:e.conditions},i=et.objectToBytes(n);return{recordsWrite:await At.create({signer:e.signer,messageTimestamp:e.dateRequested,protocol:ds.uri,protocolPath:ds.requestPath,dataFormat:"application/json",data:i}),permissionRequestData:n,permissionRequestBytes:i}}static async createGrant(e){let r=ds.normalizePermissionScope(e.scope),n={dateExpires:e.dateExpires,requestId:e.requestId,description:e.description,delegated:e.delegated,scope:r,conditions:e.conditions},i=et.objectToBytes(n),o=await At.create({signer:e.signer,messageTimestamp:e.dateGranted,dateCreated:e.dateGranted,recipient:e.grantedTo,protocol:ds.uri,protocolPath:ds.grantPath,dataFormat:"application/json",data:i}),s={...o.message,encodedData:et.bytesToBase64Url(i)};return{recordsWrite:o,permissionGrantData:n,permissionGrantBytes:i,dataEncodedMessage:s}}static async createRevocation(e){let r={description:e.description},n=et.objectToBytes(r);return{recordsWrite:await At.create({signer:e.signer,parentContextId:e.grantId,protocol:ds.uri,protocolPath:ds.revocationPath,dataFormat:"application/json",data:n}),permissionRevocationData:r,permissionRevocationBytes:n}}static validateSchema(e,r){let n=et.bytesToString(r),i=JSON.parse(n);if(e.descriptor.protocolPath===ds.requestPath)hd("PermissionRequestData",i);else if(e.descriptor.protocolPath===ds.grantPath){hd("PermissionGrantData",i);let o=i;ds.validateScope(o.scope),Zt.validateTimestamp(o.dateExpires)}else if(e.descriptor.protocolPath===ds.revocationPath)hd("PermissionRevocationData",i);else throw new be("PermissionsProtocolValidateSchemaUnexpectedRecord",`Unexpected permission record: ${e.descriptor.protocolPath}`)}static async fetchGrant(e,r,n){let i={recordId:n,isLatestBaseState:!0},{messages:o}=await r.query(e,[i]),s=o[0],a=s?.descriptor.interface,d=s?.descriptor.method;if(a!=="Records"||d!=="Write"||s.descriptor.protocolPath!==ds.grantPath)throw new be("GrantAuthorizationGrantMissing",`Could not find permission grant with record ID ${n}.`);let m=s;return await Qi.parse(m)}static normalizePermissionScope(e){let r={...e};return ds.isRecordPermissionScope(r)&&(r.protocol!==void 0&&(r.protocol=Jf(r.protocol)),r.schema!==void 0&&(r.schema=Vd(r.schema))),r}static isRecordPermissionScope(e){return e.interface==="Records"}static validateScope(e){if(this.isRecordPermissionScope(e)){if(e.schema!==void 0&&(e.protocol!==void 0||e.contextId!==void 0||e.protocolPath))throw new be("PermissionsProtocolValidateScopeSchemaProhibitedProperties","Permission grants that have `schema` present cannot also have protocol-related properties present");if(e.protocol!==void 0&&e.contextId!==void 0&&e.protocolPath!==void 0)throw new be("PermissionsProtocolValidateScopeContextIdProhibitedProperties","Permission grants cannot have both `contextId` and `protocolPath` present")}}},Gi=ds;Gi.uri="https://tbd.website/dwn/permissions",Gi.requestPath="request",Gi.grantPath="grant",Gi.revocationPath="grant/revocation",Gi.definition={published:!0,protocol:ds.uri,types:{request:{dataFormats:["application/json"]},grant:{dataFormats:["application/json"]},revocation:{dataFormats:["application/json"]}},structure:{request:{$size:{max:1e4},$actions:[{who:"anyone",can:["create"]}]},grant:{$size:{max:1e4},$actions:[{who:"recipient",of:"grant",can:["read","query"]}],revocation:{$size:{max:1e4},$actions:[{who:"anyone",can:["read"]}]}}}};var au=class extends ki{static async parse(e){return e.authorization!==void 0&&await Ue.validateSignatureStructure(e.authorization.signature,e.descriptor),e.descriptor.filter!==void 0&&Ta(e.descriptor.filter.protocol),Zt.validateTimestamp(e.descriptor.messageTimestamp),new au(e)}static async create(e){let r={interface:"Protocols",method:"Query",messageTimestamp:e.messageTimestamp??Zt.getCurrentTimestamp(),filter:e.filter?au.normalizeFilter(e.filter):void 0};rn(r);let n;e.signer!==void 0&&(n=await Ue.createAuthorization({descriptor:r,signer:e.signer,permissionGrantId:e.permissionGrantId}));let i={descriptor:r,authorization:n};return Ue.validateJsonSchema(i),new au(i)}static normalizeFilter(e){return{...e,protocol:Jf(e.protocol)}}async authorize(e,r){if(this.author!==e)if(this.author!==void 0&&this.signaturePayload.permissionGrantId){let n=await Gi.fetchGrant(e,r,this.signaturePayload.permissionGrantId);await ic.performBaseValidation({incomingMessage:this.message,expectedGrantor:e,expectedGrantee:this.author,permissionGrant:n,messageStore:r})}else throw new be("ProtocolsQueryUnauthorized","The ProtocolsQuery failed authorization")}};var k4=class{constructor(e,r,n){this.didResolver=e;this.messageStore=r;this.dataStore=n}async handle({tenant:e,message:r}){let n;try{n=await au.parse(r)}catch(s){return er(s,400)}try{await di(r.authorization,this.didResolver),await n.authorize(e,this.messageStore)}catch(s){if(s.code==="AuthenticateJwsMissing"||s.code==="ProtocolsQueryUnauthorized"){let a=await this.fetchPublishedProtocolsConfigure(e,n);return{status:{code:200,detail:"OK"},entries:a}}else return er(s,401)}let i={...r.descriptor.filter,interface:"Protocols",method:"Configure"};rn(i);let{messages:o}=await this.messageStore.query(e,[i]);return{status:{code:200,detail:"OK"},entries:o}}async fetchPublishedProtocolsConfigure(e,r){let n={...r.message.descriptor.filter,interface:"Protocols",method:"Configure",published:!0},{messages:i}=await this.messageStore.query(e,[n]);return i}};E();E();var wde=or(_N(),1);var qt=class{static async validateReferentialIntegrity(e,r,n){let i=await qt.fetchProtocolDefinition(e,r.message.descriptor.protocol,n);qt.verifyType(r.message,i.types),await qt.verifyProtocolPathAndContextId(e,r,n);let o=qt.getRuleSet(r.message.descriptor.protocolPath,i);await qt.verifyAsRoleRecordIfNeeded(e,r,o,n),qt.verifySizeLimit(r,o),qt.verifyTagsIfNeeded(r,o)}static async authorizeWrite(e,r,n){let i=await qt.fetchInitialWrite(e,r.message.recordId,n),o;i===void 0?o=await qt.constructRecordChain(e,r.message.descriptor.parentId,n):o=await qt.constructRecordChain(e,r.message.recordId,n);let s=await qt.fetchProtocolDefinition(e,r.message.descriptor.protocol,n),a=qt.getRuleSet(r.message.descriptor.protocolPath,s);await qt.verifyInvokedRole(e,r,r.message.descriptor.protocol,r.message.contextId,s,n),await qt.authorizeAgainstAllowedActions(e,r,a,o,n)}static async authorizeRead(e,r,n,i){let o=await qt.constructRecordChain(e,n.message.recordId,i),s=await qt.fetchProtocolDefinition(e,n.message.descriptor.protocol,i),a=qt.getRuleSet(n.message.descriptor.protocolPath,s);await qt.verifyInvokedRole(e,r,n.message.descriptor.protocol,n.message.contextId,s,i),await qt.authorizeAgainstAllowedActions(e,r,a,o,i)}static async authorizeQueryOrSubscribe(e,r,n){let{protocol:i,protocolPath:o,contextId:s}=r.message.descriptor.filter,a=await qt.fetchProtocolDefinition(e,i,n),d=qt.getRuleSet(o,a);await qt.verifyInvokedRole(e,r,i,s,a,n),await qt.authorizeAgainstAllowedActions(e,r,d,[],n)}static async authorizeDelete(e,r,n,i){let o=await qt.constructRecordChain(e,r.message.descriptor.recordId,i),s=await qt.fetchProtocolDefinition(e,n.message.descriptor.protocol,i),a=qt.getRuleSet(n.message.descriptor.protocolPath,s);await qt.verifyInvokedRole(e,r,n.message.descriptor.protocol,n.message.contextId,s,i),await qt.authorizeAgainstAllowedActions(e,r,a,o,i)}static async fetchProtocolDefinition(e,r,n){if(r===Gi.uri)return Gi.definition;let i={interface:"Protocols",method:"Configure",protocol:r},{messages:o}=await n.query(e,[i]);if(o.length===0)throw new be("ProtocolAuthorizationProtocolNotFound",`unable to find protocol definition for ${r}`);return o[0].descriptor.definition}static async constructRecordChain(e,r,n){if(r===void 0)return[];let i=[],o=r;for(;o!==void 0;){let s=await qt.fetchInitialWrite(e,o,n);if(s===void 0)throw new be("ProtocolAuthorizationParentNotFoundConstructingRecordChain",`Unexpected error that should never trigger: no parent found with ID ${o} when constructing record chain.`);i.push(s),o=s.descriptor.parentId}return i.reverse()}static async fetchInitialWrite(e,r,n){let i={interface:"Records",method:"Write",recordId:r},{messages:o}=await n.query(e,[i]);return o.length===0?void 0:await At.getInitialWrite(o)}static getRuleSet(e,r){let n=qt.getRuleSetAtProtocolPath(e,r);if(n===void 0)throw new be("ProtocolAuthorizationMissingRuleSet",`No rule set defined for protocolPath ${e}`);return n}static async verifyProtocolPathAndContextId(e,r,n){let i=r.message.descriptor.protocolPath,o=qt.getTypeName(i),s=r.message.descriptor.parentId;if(s===void 0){if(i!==o)throw new be("ProtocolAuthorizationParentlessIncorrectProtocolPath",`Declared protocol path '${i}' is not valid for records with no parent'.`);return}let a=r.message.descriptor.protocol,d={isLatestBaseState:!0,interface:"Records",method:"Write",protocol:a,recordId:s},{messages:m}=await n.query(e,[d]),p=m[0];if(`${p?.descriptor?.protocolPath}/${o}`!==i)throw new be("ProtocolAuthorizationIncorrectProtocolPath",`Could not find matching parent record to verify declared protocol path '${i}'.`);let S=`${p.contextId}/${r.message.recordId}`,M=r.message.contextId;if(M!==S)throw new be("ProtocolAuthorizationIncorrectContextId",`Declared contextId '${M}' is not the same as expected: '${S}'.`)}static verifyType(e,r){let n=Object.keys(r),i=e.descriptor.protocolPath,o=qt.getTypeName(i);if(!n.includes(o))throw new be("ProtocolAuthorizationInvalidType",`record with type ${o} not allowed in protocol`);let s=e.descriptor.protocolPath,a=qt.getTypeName(s),d=r[a],{schema:m}=e.descriptor;if(d.schema!==void 0&&d.schema!==m)throw new be("ProtocolAuthorizationInvalidSchema",`type '${a}' must have schema '${d.schema}', instead has '${m}'`);let{dataFormat:p}=e.descriptor;if(d.dataFormats!==void 0&&!d.dataFormats.includes(p))throw new be("ProtocolAuthorizationIncorrectDataFormat",`type '${a}' must have data format in (${d.dataFormats}), instead has '${p}'`)}static async verifyInvokedRole(e,r,n,i,o,s){let a=r.signaturePayload?.protocolRole;if(a===void 0)return;let d=qt.getRuleSetAtProtocolPath(a,o);if(d===void 0||!d.$role)throw new be("ProtocolAuthorizationNotARole",`Protocol path ${a} does not match role record type.`);let m={interface:"Records",method:"Write",protocol:n,protocolPath:a,recipient:r.author,isLatestBaseState:!0},p=a.split("/").length-1;if(i===void 0&&p>0)throw new be("ProtocolAuthorizationMissingContextId","Could not verify role because contextId is missing.");if(p>0){let S=i.split("/").slice(0,p).join("/"),M=fi.constructPrefixFilterAsRangeFilter(S);m.contextId=M}let{messages:w}=await s.query(e,[m]);if(w.length===0)throw new be("ProtocolAuthorizationMatchingRoleRecordNotFound",`No matching role record found for protocol path ${a}`)}static async getActionsSeekingARuleMatch(e,r,n){switch(r.message.descriptor.method){case"Delete":let i=r,o=i.message.descriptor.recordId,s=await At.fetchInitialRecordsWrite(n,e,o);if(s===void 0)return[];let a=[];return i.message.descriptor.prune?(a.push("co-prune"),r.author===s.author&&a.push("prune")):(a.push("co-delete"),r.author===s.author&&a.push("delete")),a;case"Query":return["query"];case"Read":return["read"];case"Subscribe":return["subscribe"];case"Write":if(await r.isInitialWrite())return["create"];{let p=r.message.recordId,w=await At.fetchInitialRecordsWrite(n,e,p);return w===void 0?[]:r.author===w.author?["co-update","update"]:["co-update"]}}return[]}static async authorizeAgainstAllowedActions(e,r,n,i,o){let s=r.message.descriptor.method,a=await qt.getActionsSeekingARuleMatch(e,r,o),d=r.author,m=n.$actions;if(m===void 0)throw new be("ProtocolAuthorizationActionRulesNotFound",`no action rule defined for Records${s}, ${d} is unauthorized`);let p=r.signaturePayload?.protocolRole;for(let w of m){if(!w.can.some(M=>a.includes(M)))continue;if(w.who==="anyone")return;if(d===void 0)continue;if(p!==void 0){if(w.role===p)return;continue}if(w.who==="recipient"&&w.of===void 0){let M;if(r.message.descriptor.method==="Write"?M=r.message:M=i[i.length-1],M.descriptor.recipient===d)return;continue}if(await qt.checkActor(d,w,i))return}throw new be("ProtocolAuthorizationActionNotAllowed",`Inbound message action Records${s} by author ${r.author} not allowed.`)}static verifySizeLimit(e,r){let{min:n=0,max:i}=r.$size||{},o=e.message.descriptor.dataSize;if(o<n)throw new be("ProtocolAuthorizationMinSizeInvalid",`data size ${o} is less than allowed ${n}`);if(i!==void 0&&o>i)throw new be("ProtocolAuthorizationMaxSizeInvalid",`data size ${o} is more than allowed ${i}`)}static verifyTagsIfNeeded(e,r){if(r.$tags!==void 0){let{tags:n={},protocol:i,protocolPath:o}=e.message.descriptor,{$allowUndefinedTags:s,$requiredTags:a,...d}=r.$tags,m=s||!1,p=a||[],w=new wde.default.default,P=w.compile({type:"object",properties:d,required:p,additionalProperties:m});if(!P(n)){let M=w.errorsText(P.errors,{dataVar:`${i}/${o}/$tags`});throw new be("ProtocolAuthorizationTagsInvalidSchema",`tags schema validation error: ${M}`)}}}static async verifyAsRoleRecordIfNeeded(e,r,n,i){if(!n.$role)return;let o=r,s=o.message.descriptor.recipient;if(s===void 0)throw new be("ProtocolAuthorizationRoleMissingRecipient","Role records must have a recipient");let a=o.message.descriptor.protocolPath,d={interface:"Records",method:"Write",isLatestBaseState:!0,protocol:o.message.descriptor.protocol,protocolPath:a,recipient:s},m=pt.getParentContextFromOfContextId(o.message.contextId);if(m!==""){let S=fi.constructPrefixFilterAsRangeFilter(m);d.contextId=S}let{messages:p}=await i.query(e,[d]);if(p.filter(S=>S.recordId!==o.message.recordId).length>0)throw new be("ProtocolAuthorizationDuplicateRoleRecipient",`DID '${s}' is already recipient of a role record at protocol path '${a} under the parent context ${m}.`)}static getRuleSetAtProtocolPath(e,r){let n=e.split("/"),i=r.structure,o=0;for(;o<n.length;){let s=n[o],a=i[s];if(a===void 0)return;i=a,o++}return i}static async checkActor(e,r,n){let i=n.find(o=>o.descriptor.protocolPath===r.of);if(i===void 0)return!1;if(r.who==="recipient")return e===i.descriptor.recipient;{let o=(await At.parse(i)).author;return e===o}}static getTypeName(e){return e.split("/").slice(-1)[0]}};E();var kl=class extends ki{static async parse(e){let r;return e.authorization!==void 0&&(r=await Ue.validateSignatureStructure(e.authorization.signature,e.descriptor)),await pt.validateDelegatedGrantReferentialIntegrity(e,r),Zt.validateTimestamp(e.descriptor.messageTimestamp),new kl(e)}static async create(e){let r=e.recordId,n=Zt.getCurrentTimestamp(),i={interface:"Records",method:"Delete",messageTimestamp:e.messageTimestamp??n,recordId:r,prune:e.prune??!1},o=await Ue.createAuthorization({descriptor:i,signer:e.signer,protocolRole:e.protocolRole,delegatedGrant:e.delegatedGrant}),s={descriptor:i,authorization:o};return Ue.validateJsonSchema(s),new kl(s)}constructIndexes(e){let n={...this.message.descriptor},{protocol:i,protocolPath:o,recipient:s,schema:a,parentId:d,dateCreated:m}=e.descriptor,p={protocol:i,protocolPath:o,recipient:s,schema:a,parentId:d,dateCreated:m,contextId:e.contextId,author:this.author,...n};return rn(p),p}async authorizeDelegate(e,r){let n=await Qi.parse(this.message.authorization.authorDelegatedGrant);await ti.authorizeDelete({recordsDeleteMessage:this.message,recordsWriteToDelete:e,expectedGrantor:this.author,expectedGrantee:this.signer,permissionGrant:n,messageStore:r})}};E();E();var ch=class{};ch.maxDataSizeAllowedToBeEncoded=3e4;var cu=class{static async deleteFromDataStoreIfNeeded(e,r,n,i){if(n.descriptor.method!=="Write")return;let o=n;o.descriptor.dataSize<=ch.maxDataSizeAllowedToBeEncoded||o.descriptor.dataCid!==i.descriptor.dataCid&&await e.delete(r,o.recordId,o.descriptor.dataCid)}static async purgeRecordDescendants(e,r,n,i,o){let s={interface:"Records",parentId:r},{messages:a}=await n.query(e,[s]),d=new Map;for(let m of a){let p;pt.isRecordsWrite(m)?p=m.recordId:p=m.descriptor.recordId,d.has(p)||d.set(p,[]),d.get(p).push(m)}for(let m of d.keys())await cu.purgeRecordDescendants(e,m,n,i,o);for(let m of d.keys())await cu.purgeRecordMessages(e,d.get(m),n,i,o)}static async purgeRecordMessages(e,r,n,i,o){let s=r.filter(m=>m.descriptor.method==="Write"),a=await Ue.getNewestMessage(s);await i.delete(e,a.recordId,a.descriptor.dataCid);let d=await Promise.all(r.map(m=>Ue.getCid(m)));await o.deleteEventsByCid(e,d),await Promise.all(d.map(m=>n.delete(e,m)))}static async deleteAllOlderMessagesButKeepInitialWrite(e,r,n,i,o,s){let a=[];for(let d of r){if(await Ue.isOlder(d,n)){await cu.deleteFromDataStoreIfNeeded(o,e,d,n);let p=await Ue.getCid(d);if(await i.delete(e,p),await At.isInitialWrite(d)){let P=await At.parse(d),S=!1,M=await P.constructIndexes(S),A=d;delete A.encodedData,await i.put(e,A,M)}else{let P=await Ue.getCid(d);a.push(P)}}await s.deleteEventsByCid(e,a)}}};var vw=class{constructor(e,r,n,i,o){this.didResolver=e;this.messageStore=r;this.dataStore=n;this.eventLog=i;this.eventStream=o}async handle({tenant:e,message:r}){let n;try{n=await kl.parse(r)}catch(S){return er(S,400)}try{await di(r.authorization,this.didResolver)}catch(S){return er(S,401)}let i={interface:"Records",recordId:r.descriptor.recordId},{messages:o}=await this.messageStore.query(e,[i]),s=await Ue.getNewestMessage(o),a=!1,d;if(s===void 0||await Ue.isNewer(r,s)?(a=!0,d=r):d=s,!a)return{status:{code:409,detail:"Conflict"}};if(s===void 0||s.descriptor.method==="Delete")return{status:{code:404,detail:"Not Found"}};try{await vw.authorizeRecordsDelete(e,n,await At.parse(s),this.messageStore)}catch(S){return er(S,401)}let m=await At.getInitialWrite(o),p=n.constructIndexes(m),w=await Ue.getCid(r);return await this.messageStore.put(e,r,p),await this.eventLog.append(e,w,p),this.eventStream!==void 0&&this.eventStream.emit(e,{message:r,initialWrite:m},p),r.descriptor.prune&&await cu.purgeRecordDescendants(e,r.descriptor.recordId,this.messageStore,this.dataStore,this.eventLog),await cu.deleteAllOlderMessagesButKeepInitialWrite(e,o,d,this.messageStore,this.dataStore,this.eventLog),{status:{code:202,detail:"Accepted"}}}static async authorizeRecordsDelete(e,r,n,i){if(Ue.isSignedByAuthorDelegate(r.message)&&await r.authorizeDelegate(n.message,i),r.author!==e)if(n.message.descriptor.protocol!==void 0)await qt.authorizeDelete(e,r,n,i);else throw new be("RecordsDeleteAuthorizationFailed","RecordsDelete message failed authorization")}};E();E();var Gx=(r=>(r[r.Descending=-1]="Descending",r[r.Ascending=1]="Ascending",r))(Gx||{});var fu=class{constructor(e,r,n){this.didResolver=e;this.messageStore=r;this.dataStore=n}async handle({tenant:e,message:r}){let n;try{n=await Sl.parse(r)}catch(s){return er(s,400)}let i,o;if(pt.filterIncludesPublishedRecords(n.message.descriptor.filter)&&n.author===void 0){let s=await this.fetchPublishedRecords(e,n);i=s.messages,o=s.cursor}else{try{await di(r.authorization,this.didResolver),await fu.authorizeRecordsQuery(e,n,this.messageStore)}catch(s){return er(s,401)}if(n.author===e){let s=await this.fetchRecordsAsOwner(e,n);i=s.messages,o=s.cursor}else{let s=await this.fetchRecordsAsNonOwner(e,n);i=s.messages,o=s.cursor}}for(let s of i)if(!await At.isInitialWrite(s)){let d=(await this.messageStore.query(e,[{recordId:s.recordId,isLatestBaseState:!1,method:"Write"}])).messages[0];delete d.encodedData,s.initialWrite=d}return{status:{code:200,detail:"OK"},entries:i,cursor:o}}convertDateSort(e){switch(e){case"createdAscending":return{dateCreated:1};case"createdDescending":return{dateCreated:-1};case"publishedAscending":return{datePublished:1};case"publishedDescending":return{datePublished:-1};default:return{dateCreated:1}}}async fetchRecordsAsOwner(e,r){let{dateSort:n,filter:i,pagination:o}=r.message.descriptor,s={...pt.convertFilter(i,n),interface:"Records",method:"Write",isLatestBaseState:!0},a=this.convertDateSort(n);return this.messageStore.query(e,[s],a,o)}async fetchRecordsAsNonOwner(e,r){let{dateSort:n,pagination:i,filter:o}=r.message.descriptor,s=[];if(pt.filterIncludesPublishedRecords(o)&&s.push(fu.buildPublishedRecordsFilter(r)),pt.filterIncludesUnpublishedRecords(o)){s.push(fu.buildUnpublishedRecordsByQueryAuthorFilter(r));let d=r.message.descriptor.filter.recipient;(d===void 0||d===r.author)&&s.push(fu.buildUnpublishedRecordsForQueryAuthorFilter(r)),pt.shouldProtocolAuthorize(r.signaturePayload)&&s.push(fu.buildUnpublishedProtocolAuthorizedRecordsFilter(r))}let a=this.convertDateSort(n);return this.messageStore.query(e,s,a,i)}async fetchPublishedRecords(e,r){let{dateSort:n,pagination:i}=r.message.descriptor,o=fu.buildPublishedRecordsFilter(r),s=this.convertDateSort(n);return this.messageStore.query(e,[o],s,i)}static buildPublishedRecordsFilter(e){let{dateSort:r,filter:n}=e.message.descriptor;return{...pt.convertFilter(n,r),interface:"Records",method:"Write",published:!0,isLatestBaseState:!0}}static buildUnpublishedRecordsForQueryAuthorFilter(e){let{dateSort:r,filter:n}=e.message.descriptor;return{...pt.convertFilter(n,r),interface:"Records",method:"Write",recipient:e.author,isLatestBaseState:!0,published:!1}}static buildUnpublishedProtocolAuthorizedRecordsFilter(e){let{dateSort:r,filter:n}=e.message.descriptor;return{...pt.convertFilter(n,r),interface:"Records",method:"Write",isLatestBaseState:!0,published:!1}}static buildUnpublishedRecordsByQueryAuthorFilter(e){let{dateSort:r,filter:n}=e.message.descriptor;return{...pt.convertFilter(n,r),author:e.author,interface:"Records",method:"Write",isLatestBaseState:!0,published:!1}}static async authorizeRecordsQuery(e,r,n){Ue.isSignedByAuthorDelegate(r.message)&&await r.authorizeDelegate(n),pt.shouldProtocolAuthorize(r.signaturePayload)&&await qt.authorizeQueryOrSubscribe(e,r,n)}};E();E();var e0=class extends ki{static async parse(e){let r;return e.authorization!==void 0&&(r=await Ue.validateSignatureStructure(e.authorization.signature,e.descriptor)),await pt.validateDelegatedGrantReferentialIntegrity(e,r),Zt.validateTimestamp(e.descriptor.messageTimestamp),new e0(e)}static async create(e){let{filter:r,signer:n,permissionGrantId:i,protocolRole:o}=e,s=Zt.getCurrentTimestamp(),a={interface:"Records",method:"Read",filter:pt.normalizeFilter(r),messageTimestamp:e.messageTimestamp??s};rn(a);let d;n!==void 0&&(d=await Ue.createAuthorization({descriptor:a,signer:n,permissionGrantId:i,protocolRole:o,delegatedGrant:e.delegatedGrant}));let m={descriptor:a,authorization:d};return Ue.validateJsonSchema(m),new e0(m)}async authorizeDelegate(e,r){let n=await Qi.parse(this.message.authorization.authorDelegatedGrant);await ti.authorizeRead({recordsReadMessage:this.message,recordsWriteMessageToBeRead:e,expectedGrantor:this.author,expectedGrantee:this.signer,permissionGrant:n,messageStore:r})}};var bw=class{constructor(e,r,n){this.didResolver=e;this.messageStore=r;this.dataStore=n}async handle({tenant:e,message:r}){let n;try{n=await e0.parse(r)}catch(p){return er(p,400)}try{n.author!==void 0&&await di(r.authorization,this.didResolver)}catch(p){return er(p,401)}let i={interface:"Records",isLatestBaseState:!0,...pt.convertFilter(r.descriptor.filter)},{messages:o}=await this.messageStore.query(e,[i]);if(o.length===0)return{status:{code:404,detail:"Not Found"}};if(o.length>1)return er(new be("RecordsReadReturnedMultiple","Multiple records exist for the RecordsRead filter"),400);let s=o[0];try{await bw.authorizeRecordsRead(e,n,await At.parse(s),this.messageStore)}catch(p){return er(p,401)}let a;if(s.encodedData!==void 0){let p=et.base64UrlToBytes(s.encodedData);a=cs.fromBytes(p),delete s.encodedData}else{let p=await this.dataStore.get(e,s.recordId,s.descriptor.dataCid);if(p?.dataStream===void 0)return{status:{code:404,detail:"Not Found"}};a=p.dataStream}let d={...s,data:a};if(!await At.isInitialWrite(d)){let w=(await this.messageStore.query(e,[{recordId:d.recordId,isLatestBaseState:!1,method:"Write"}])).messages[0];delete w.encodedData,d.initialWrite=w}return{status:{code:200,detail:"OK"},record:d}}static async authorizeRecordsRead(e,r,n,i){Ue.isSignedByAuthorDelegate(r.message)&&await r.authorizeDelegate(n.message,i);let{descriptor:o}=n.message;if(r.author!==e){if(o.published===!0)return;if(r.author!==void 0&&r.author===o.recipient)return;if(r.author!==void 0&&r.signaturePayload.permissionGrantId!==void 0){let s=await Gi.fetchGrant(e,i,r.signaturePayload.permissionGrantId);await ti.authorizeRead({recordsReadMessage:r.message,recordsWriteMessageToBeRead:n.message,expectedGrantor:e,expectedGrantee:r.author,permissionGrant:s,messageStore:i})}else if(o.protocol!==void 0)await qt.authorizeRead(e,r,n,i);else throw new be("RecordsReadAuthorizationFailed","message failed authorization")}}};E();E();var Ol=class extends ki{static async parse(e){let r;if(e.authorization!==void 0&&(r=await Ue.validateSignatureStructure(e.authorization.signature,e.descriptor)),await pt.validateDelegatedGrantReferentialIntegrity(e,r),r?.protocolRole!==void 0&&e.descriptor.filter.protocolPath===void 0)throw new be("RecordsSubscribeFilterMissingRequiredProperties","Role-authorized subscriptions must include `protocolPath` in the filter");return e.descriptor.filter.protocol!==void 0&&Ta(e.descriptor.filter.protocol),e.descriptor.filter.schema!==void 0&&Xc(e.descriptor.filter.schema),Zt.validateTimestamp(e.descriptor.messageTimestamp),new Ol(e)}static async create(e){let r={interface:"Records",method:"Subscribe",messageTimestamp:e.messageTimestamp??Zt.getCurrentTimestamp(),filter:pt.normalizeFilter(e.filter)};rn(r);let n=e.signer,i;n&&(i=await Ue.createAuthorization({descriptor:r,signer:n,protocolRole:e.protocolRole,delegatedGrant:e.delegatedGrant}));let o={descriptor:r,authorization:i};return Ue.validateJsonSchema(o),new Ol(o)}async authorizeDelegate(e){let r=await Qi.parse(this.message.authorization.authorDelegatedGrant);await ti.authorizeQueryOrSubscribe({incomingMessage:this.message,expectedGrantor:this.author,expectedGrantee:this.signer,permissionGrant:r,messageStore:e})}};var lc=class{constructor(e,r,n){this.didResolver=e;this.messageStore=r;this.eventStream=n}async handle({tenant:e,message:r,subscriptionHandler:n}){if(this.eventStream===void 0)return er(new be("RecordsSubscribeEventStreamUnimplemented","Subscriptions are not supported"),501);let i;try{i=await Ol.parse(r)}catch(m){return er(m,400)}let o=[];if(pt.filterIncludesPublishedRecords(i.message.descriptor.filter)&&i.author===void 0)o=[lc.buildPublishedRecordsFilter(i)],delete r.authorization;else{try{await di(r.authorization,this.didResolver),await lc.authorizeRecordsSubscribe(e,i,this.messageStore)}catch(m){return er(m,401)}i.author===e?o=await lc.filterAsOwner(i):o=await lc.filterAsNonOwner(i)}let s=(m,p,w)=>{e===m&&fi.matchAnyFilter(w,o)&&n(p)},a=await Ue.getCid(r),d=await this.eventStream.subscribe(e,a,s);return{status:{code:200,detail:"OK"},subscription:d}}static async filterAsOwner(e){let{filter:r}=e.message.descriptor;return[{...pt.convertFilter(r),interface:"Records",method:["Write","Delete"]}]}static async filterAsNonOwner(e){let r=[],{filter:n}=e.message.descriptor;if(pt.filterIncludesPublishedRecords(n)&&r.push(lc.buildPublishedRecordsFilter(e)),pt.filterIncludesUnpublishedRecords(n)){r.push(lc.buildUnpublishedRecordsBySubscribeAuthorFilter(e));let i=e.message.descriptor.filter.recipient;(i===void 0||i===e.author)&&r.push(lc.buildUnpublishedRecordsForSubscribeAuthorFilter(e)),pt.shouldProtocolAuthorize(e.signaturePayload)&&r.push(lc.buildUnpublishedProtocolAuthorizedRecordsFilter(e))}return r}static buildPublishedRecordsFilter(e){return{...pt.convertFilter(e.message.descriptor.filter),interface:"Records",method:["Write","Delete"],published:!0}}static buildUnpublishedRecordsForSubscribeAuthorFilter(e){return{...pt.convertFilter(e.message.descriptor.filter),interface:"Records",method:["Write","Delete"],recipient:e.author,published:!1}}static buildUnpublishedProtocolAuthorizedRecordsFilter(e){return{...pt.convertFilter(e.message.descriptor.filter),interface:"Records",method:["Write","Delete"],published:!1}}static buildUnpublishedRecordsBySubscribeAuthorFilter(e){return{...pt.convertFilter(e.message.descriptor.filter),author:e.author,interface:"Records",method:["Write","Delete"],published:!1}}static async authorizeRecordsSubscribe(e,r,n){Ue.isSignedByAuthorDelegate(r.message)&&await r.authorizeDelegate(n),pt.shouldProtocolAuthorize(r.signaturePayload)&&await qt.authorizeQueryOrSubscribe(e,r,n)}};E();var Bl=class{constructor(e,r,n,i,o){this.didResolver=e;this.messageStore=r;this.dataStore=n;this.eventLog=i;this.eventStream=o}async handle({tenant:e,message:r,dataStream:n}){let i;try{i=await At.parse(r),r.descriptor.protocol!==void 0&&await qt.validateReferentialIntegrity(e,i,this.messageStore)}catch(S){return er(S,400)}try{await di(r.authorization,this.didResolver),await Bl.authorizeRecordsWrite(e,i,this.messageStore)}catch(S){return er(S,401)}let o={interface:"Records",recordId:r.recordId},{messages:s}=await this.messageStore.query(e,[o]),a=await i.isInitialWrite(),d;if(!a)try{d=await At.getInitialWrite(s),At.verifyEqualityOfImmutableProperties(d,r)}catch(S){return er(S,400)}let m=await Ue.getNewestMessage(s),p=!1,w;if(m===void 0||await Ue.isNewer(r,m)?(p=!0,w=r):w=m,!p)return{status:{code:409,detail:"Conflict"}};try{let S=!1,M=r;if(n!==void 0)M=await this.processMessageWithDataStream(e,r,n),S=!0;else{if(m?.descriptor.method==="Delete")throw new be("RecordsWriteMissingDataStream","No data stream was provided with the previous message being a delete");if(!a){let B=m;M=await this.processMessageWithoutDataStream(e,r,B),S=!0}}let A=await i.constructIndexes(S);await this.messageStore.put(e,M,A),await this.eventLog.append(e,await Ue.getCid(r),A),this.eventStream!==void 0&&S&&this.eventStream.emit(e,{message:r,initialWrite:d},A)}catch(S){let M=S;if(M.code!==void 0&&(M.code==="RecordsWriteMissingEncodedDataInPrevious"||M.code==="RecordsWriteMissingDataInPrevious"||M.code==="RecordsWriteMissingDataStream"||M.code==="RecordsWriteDataCidMismatch"||M.code==="RecordsWriteDataSizeMismatch"||M.code.startsWith("PermissionsProtocolValidate")||M.code.startsWith("SchemaValidator")))return er(S,400);throw S}let P={status:{code:202,detail:"Accepted"}};return await cu.deleteAllOlderMessagesButKeepInitialWrite(e,s,w,this.messageStore,this.dataStore,this.eventLog),await this.postProcessingForCoreRecordsWrite(e,i),P}static validateSchemaForCoreRecordsWrite(e,r){e.descriptor.protocol===Gi.uri&&Gi.validateSchema(e,r)}async postProcessingForCoreRecordsWrite(e,r){if(r.message.descriptor.protocol===Gi.uri&&r.message.descriptor.protocolPath===Gi.revocationPath){let i={permissionGrantId:r.message.descriptor.parentId,dateCreated:{gte:r.message.descriptor.messageTimestamp}},{messages:o}=await this.messageStore.query(e,[i]),s=[];for(let a of o){let d=await Ue.getCid(a);await this.messageStore.delete(e,d)}this.eventLog.deleteEventsByCid(e,s)}}async cloneAndAddEncodedData(e,r){let n={...e};return n.encodedData=et.bytesToBase64Url(r),n}async processMessageWithDataStream(e,r,n){let i=r;if(r.descriptor.dataSize<=ch.maxDataSizeAllowedToBeEncoded){let o=await cs.toBytes(n),s=await Qn.computeDagPbCidFromBytes(o);Bl.validateDataIntegrity(r.descriptor.dataCid,r.descriptor.dataSize,s,o.length),Bl.validateSchemaForCoreRecordsWrite(r,o),i=await this.cloneAndAddEncodedData(r,o)}else{let[o,s]=cs.duplicateDataStream(n,2);try{let[a,d]=await Promise.all([Qn.computeDagPbCidFromStream(o),this.dataStore.put(e,r.recordId,r.descriptor.dataCid,s)]);Bl.validateDataIntegrity(r.descriptor.dataCid,r.descriptor.dataSize,a,d.dataSize)}catch(a){throw await this.dataStore.delete(e,r.recordId,r.descriptor.dataCid),a}}return i}async processMessageWithoutDataStream(e,r,n){let i={...r},{dataCid:o,dataSize:s}=r.descriptor;if(Bl.validateDataIntegrity(o,s,n.descriptor.dataCid,n.descriptor.dataSize),s<=ch.maxDataSizeAllowedToBeEncoded)if(n.encodedData!==void 0)i.encodedData=n.encodedData;else throw new be("RecordsWriteMissingEncodedDataInPrevious","No dataStream was provided and unable to get data from previous message");else if(await this.dataStore.get(e,n.recordId,r.descriptor.dataCid)===void 0)throw new be("RecordsWriteMissingDataInPrevious","No dataStream was provided and unable to get data from previous message");return i}static validateDataIntegrity(e,r,n,i){if(e!==n)throw new be("RecordsWriteDataCidMismatch",`actual data CID ${n} does not match dataCid in descriptor: ${e}`);if(r!==i)throw new be("RecordsWriteDataSizeMismatch",`actual data size ${i} bytes does not match dataSize in descriptor: ${r}`)}static async authorizeRecordsWrite(e,r,n){if(r.owner!==void 0&&r.owner!==e)throw new be("RecordsWriteOwnerAndTenantMismatch",`Owner ${r.owner} must be the same as tenant ${e} when specified.`);if(r.isSignedByAuthorDelegate&&await r.authorizeAuthorDelegate(n),r.isSignedByOwnerDelegate&&await r.authorizeOwnerDelegate(n),r.owner===void 0){if(r.author===e)return;if(r.author!==void 0&&r.signaturePayload.permissionGrantId!==void 0){let i=await Gi.fetchGrant(e,n,r.signaturePayload.permissionGrantId);await ti.authorizeWrite({recordsWriteMessage:r.message,expectedGrantor:e,expectedGrantee:r.author,permissionGrant:i,messageStore:n})}else if(r.message.descriptor.protocol!==void 0)await qt.authorizeWrite(e,r,n);else throw new be("RecordsWriteAuthorizationFailed","message failed authorization")}}};E();E();var Ny;(function(t){t.authentication="authentication",t.assertionMethod="assertionMethod",t.keyAgreement="keyAgreement",t.capabilityInvocation="capabilityInvocation",t.capabilityDelegation="capabilityDelegation"})(Ny||(Ny={}));E();var pi={"@context":"https://w3id.org/did-resolution/v1",didResolutionMetadata:{},didDocument:null,didDocumentMetadata:{}};E();var cr=class{constructor({method:e,id:r,path:n,query:i,fragment:o,params:s}){this.uri=`did:${e}:${r}`,this.method=e,this.id=r,this.path=n,this.query=i,this.fragment=o,this.params=s}static parse(e){if(!e)return null;let r=cr.DID_URI_PATTERN.exec(e);if(!r||!r.groups)return null;let{method:n,id:i,path:o,query:s,fragment:a}=r.groups,d={uri:`did:${n}:${i}`,method:n,id:i};if(o&&(d.path=o),s&&(d.query=s.slice(1)),a&&(d.fragment=a.slice(1)),s){let m={},p=s.slice(1).split("&");for(let w of p){let[P,S]=w.split("=");m[P]=S}d.params=m}return d}};cr.METHOD_PATTERN="([a-z0-9]+)";cr.PCT_ENCODED_PATTERN="(?:%[0-9a-fA-F]{2})";cr.ID_CHAR_PATTERN=`(?:[a-zA-Z0-9._-]|${cr.PCT_ENCODED_PATTERN})`;cr.METHOD_ID_PATTERN=`((?:${cr.ID_CHAR_PATTERN}*:)*(${cr.ID_CHAR_PATTERN}+))`;cr.PATH_PATTERN="(/[^#?]*)?";cr.QUERY_PATTERN="([?][^#]*)?";cr.FRAGMENT_PATTERN="(#.*)?";cr.DID_URI_PATTERN=new RegExp(`^did:(?<method>${cr.METHOD_PATTERN}):(?<id>${cr.METHOD_ID_PATTERN})(?<path>${cr.PATH_PATTERN})(?<query>${cr.QUERY_PATTERN})(?<fragment>${cr.FRAGMENT_PATTERN})$`);E();var ft=class extends Error{constructor(e,r){super(`${e}: ${r}`),this.code=e,this.name="DidError",Object.setPrototypeOf(this,new.target.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,ft)}},ut;(function(t){t.InvalidDid="invalidDid",t.MethodNotSupported="methodNotSupported",t.InternalError="internalError",t.InvalidDidDocument="invalidDidDocument",t.InvalidDidDocumentLength="invalidDidDocumentLength",t.InvalidDidUrl="invalidDidUrl",t.InvalidPreviousDidProof="invalidPreviousDidProof",t.InvalidPublicKey="invalidPublicKey",t.InvalidPublicKeyLength="invalidPublicKeyLength",t.InvalidPublicKeyType="invalidPublicKeyType",t.InvalidSignature="invalidSignature",t.NotFound="notFound",t.RepresentationNotSupported="representationNotSupported",t.UnsupportedPublicKeyType="unsupportedPublicKeyType"})(ut||(ut={}));E();E();E();E();E();var fGe=or(xde(),1);E();E();function Ede(t){return t.byteOffset!==0||t.byteLength!==t.buffer.byteLength}function Sde(t){return typeof t!="object"||t===null?!1:typeof t[Symbol.asyncIterator]=="function"}function ww(t){let r=Object.prototype.toString.call(t).match(/\s([a-zA-Z0-9]+)/),[n,i]=r;return i}var Vx=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(p){try{m(n.next(p))}catch(w){s(w)}}function d(p){try{m(n.throw(p))}catch(w){s(w)}}function m(p){p.done?o(p.value):i(p.value).then(a,d)}m((n=n.apply(t,e||[])).next())})},Mde=function(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof __values=="function"?__values(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(o){r[o]=t[o]&&function(s){return new Promise(function(a,d){s=t[o](s),i(a,d,s.done,s.value)})}}function i(o,s,a,d){Promise.resolve(d).then(function(m){o({value:m,done:a})},s)}},B4=new TextEncoder,qy=new TextDecoder,We=class{constructor(e,r){this.data=e,this.format=r}static arrayBuffer(e){return new We(e,"ArrayBuffer")}static asyncIterable(e){if(!Sde(e))throw new TypeError("Input must be of type AsyncIterable.");return new We(e,"AsyncIterable")}static base32Z(e){return new We(e,"Base32Z")}static base58Btc(e){return new We(e,"Base58Btc")}static base64Url(e){return new We(e,"Base64Url")}static bufferSource(e){return new We(e,"BufferSource")}static hex(e){if(typeof e!="string")throw new TypeError("Hex input must be a string.");if(e.length%2!==0)throw new TypeError("Hex input must have an even number of characters.");return new We(e,"Hex")}static multibase(e){return new We(e,"Multibase")}static object(e){return new We(e,"Object")}static string(e){return new We(e,"String")}static uint8Array(e){return new We(e,"Uint8Array")}toArrayBuffer(){switch(this.format){case"Base58Btc":return Zs.baseDecode(this.data).buffer;case"Base64Url":return _s.baseDecode(this.data).buffer;case"BufferSource":{if(ww(this.data)==="ArrayBuffer")return this.data;if(ArrayBuffer.isView(this.data))return Ede(this.data)?this.data.buffer.slice(this.data.byteOffset,this.data.byteOffset+this.data.byteLength):this.data.buffer;throw new TypeError(`${this.format} value is not of type: ArrayBuffer, DataView, or TypedArray.`)}case"Hex":return this.toUint8Array().buffer;case"String":return this.toUint8Array().buffer;case"Uint8Array":return this.data.buffer;default:throw new TypeError(`Conversion from ${this.format} to ArrayBuffer is not supported.`)}}toArrayBufferAsync(){return Vx(this,void 0,void 0,function*(){switch(this.format){case"AsyncIterable":return yield(yield this.toBlobAsync()).arrayBuffer();default:throw new TypeError(`Asynchronous conversion from ${this.format} to ArrayBuffer is not supported.`)}})}toBase32Z(){switch(this.format){case"Uint8Array":return NE.baseEncode(this.data);default:throw new TypeError(`Conversion from ${this.format} to Base64Z is not supported.`)}}toBase58Btc(){switch(this.format){case"ArrayBuffer":{let e=new Uint8Array(this.data);return Zs.baseEncode(e)}case"Multibase":return this.data.substring(1);case"Uint8Array":return Zs.baseEncode(this.data);default:throw new TypeError(`Conversion from ${this.format} to Base58Btc is not supported.`)}}toBase64Url(){switch(this.format){case"ArrayBuffer":{let e=new Uint8Array(this.data);return _s.baseEncode(e)}case"BufferSource":{let e=this.toUint8Array();return _s.baseEncode(e)}case"Object":{let e=JSON.stringify(this.data),r=B4.encode(e);return _s.baseEncode(r)}case"String":{let e=B4.encode(this.data);return _s.baseEncode(e)}case"Uint8Array":return _s.baseEncode(this.data);default:throw new TypeError(`Conversion from ${this.format} to Base64Url is not supported.`)}}toBlobAsync(){var e,r,n,i;return Vx(this,void 0,void 0,function*(){switch(this.format){case"AsyncIterable":{let d=[];try{for(var o=!0,s=Mde(this.data),a;a=yield s.next(),e=a.done,!e;o=!0){i=a.value,o=!1;let p=i;d.push(p)}}catch(p){r={error:p}}finally{try{!o&&!e&&(n=s.return)&&(yield n.call(s))}finally{if(r)throw r.error}}return new Blob(d)}default:throw new TypeError(`Asynchronous conversion from ${this.format} to Blob is not supported.`)}})}toHex(){let e=Array.from({length:256},(r,n)=>n.toString(16).padStart(2,"0"));switch(this.format){case"ArrayBuffer":{let r=this.toUint8Array();return We.uint8Array(r).toHex()}case"Base64Url":{let r=this.toUint8Array();return We.uint8Array(r).toHex()}case"Uint8Array":{let r="";for(let n=0;n<this.data.length;n++)r+=e[this.data[n]];return r}default:throw new TypeError(`Conversion from ${this.format} to Hex is not supported.`)}}toMultibase(){switch(this.format){case"Base58Btc":return`z${this.data}`;default:throw new TypeError(`Conversion from ${this.format} to Multibase is not supported.`)}}toObject(){switch(this.format){case"Base64Url":{let e=_s.baseDecode(this.data),r=qy.decode(e);return JSON.parse(r)}case"String":return JSON.parse(this.data);case"Uint8Array":{let e=qy.decode(this.data);return JSON.parse(e)}default:throw new TypeError(`Conversion from ${this.format} to Object is not supported.`)}}toObjectAsync(){return Vx(this,void 0,void 0,function*(){switch(this.format){case"AsyncIterable":{let e=yield this.toStringAsync();return JSON.parse(e)}default:throw new TypeError(`Asynchronous conversion from ${this.format} to Object is not supported.`)}})}toString(){switch(this.format){case"ArrayBuffer":return qy.decode(this.data);case"Base64Url":{let e=_s.baseDecode(this.data);return qy.decode(e)}case"Object":return JSON.stringify(this.data);case"Uint8Array":return qy.decode(this.data);default:throw new TypeError(`Conversion from ${this.format} to String is not supported.`)}}toStringAsync(){var e,r,n,i;return Vx(this,void 0,void 0,function*(){switch(this.format){case"AsyncIterable":{let d="";try{for(var o=!0,s=Mde(this.data),a;a=yield s.next(),e=a.done,!e;o=!0){i=a.value,o=!1;let m=i;typeof m=="string"?d+=m:d+=qy.decode(m,{stream:!0})}}catch(m){r={error:m}}finally{try{!o&&!e&&(n=s.return)&&(yield n.call(s))}finally{if(r)throw r.error}}return d+=qy.decode(void 0,{stream:!1}),d}default:throw new TypeError(`Asynchronous conversion from ${this.format} to String is not supported.`)}})}toUint8Array(){switch(this.format){case"ArrayBuffer":return new Uint8Array(this.data);case"Base32Z":return NE.baseDecode(this.data);case"Base58Btc":return Zs.baseDecode(this.data);case"Base64Url":return _s.baseDecode(this.data);case"BufferSource":{let e=ww(this.data);if(e==="Uint8Array")return this.data;if(e==="ArrayBuffer")return new Uint8Array(this.data);if(ArrayBuffer.isView(this.data))return new Uint8Array(this.data.buffer,this.data.byteOffset,this.data.byteLength);throw new TypeError(`${this.format} value is not of type: ArrayBuffer, DataView, or TypedArray.`)}case"Hex":{let e=new Uint8Array(this.data.length/2);for(let r=0;r<this.data.length;r+=2){let n=parseInt(this.data.substring(r,r+2),16);if(isNaN(n))throw new TypeError("Input is not a valid hexadecimal string.");e[r/2]=n}return e}case"Object":{let e=JSON.stringify(this.data);return B4.encode(e)}case"String":return B4.encode(this.data);default:throw new TypeError(`Conversion from ${this.format} to Uint8Array is not supported.`)}}toUint8ArrayAsync(){return Vx(this,void 0,void 0,function*(){switch(this.format){case"AsyncIterable":{let e=yield this.toArrayBufferAsync();return new Uint8Array(e)}default:throw new TypeError(`Asynchronous conversion from ${this.format} to Uint8Array is not supported.`)}})}};E();var ii=class{static addPrefix(e){var r;let{code:n,data:i,name:o}=e;if(!(o?!n:n))throw new Error("Either 'name' or 'code' must be defined, but not both.");if(n=ii.codeToName.has(n)?n:ii.nameToCode.get(o),n===void 0)throw new Error(`Unsupported multicodec: ${(r=e.name)!==null&&r!==void 0?r:e.code}`);let s=Tu.encodingLength(n),a=new Uint8Array(s+i.byteLength);return a.set(i,s),Tu.encodeTo(n,a),a}static getCodeFromData(e){let{prefixedData:r}=e,[n,i]=Tu.decode(r);return n}static getCodeFromName(e){let{name:r}=e,n=ii.nameToCode.get(r);if(n===void 0)throw new Error(`Unsupported multicodec: ${r}`);return n}static getNameFromCode(e){let{code:r}=e,n=ii.codeToName.get(r);if(n===void 0)throw new Error(`Unsupported multicodec: ${r}`);return n}static registerCodec(e){ii.codeToName.set(e.code,e.name),ii.nameToCode.set(e.name,e.code)}static removePrefix(e){let{prefixedData:r}=e,[n,i]=Tu.decode(r),o=ii.codeToName.get(n);if(o===void 0)throw new Error(`Unsupported multicodec: ${n}`);return{code:n,data:r.slice(i),name:o}}};ii.codeToName=new Map;ii.nameToCode=new Map;ii.registerCodec({code:237,name:"ed25519-pub"});ii.registerCodec({code:4864,name:"ed25519-priv"});ii.registerCodec({code:236,name:"x25519-pub"});ii.registerCodec({code:4866,name:"x25519-priv"});ii.registerCodec({code:231,name:"secp256k1-pub"});ii.registerCodec({code:4865,name:"secp256k1-priv"});E();function EN(t){Object.keys(t).forEach(e=>{t[e]===void 0?delete t[e]:typeof t[e]=="object"&&EN(t[e])})}E();var fWe=or(mq(),1),Xy=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(p){try{m(n.next(p))}catch(w){s(w)}}function d(p){try{m(n.throw(p))}catch(w){s(w)}}function m(p){p.done?o(p.value):i(p.value).then(a,d)}m((n=n.apply(t,e||[])).next())})};var oP=class{constructor(){this.store=new Map}clear(){return Xy(this,void 0,void 0,function*(){this.store.clear()})}close(){return Xy(this,void 0,void 0,function*(){})}delete(e){return Xy(this,void 0,void 0,function*(){return this.store.delete(e)})}get(e){return Xy(this,void 0,void 0,function*(){return this.store.get(e)})}has(e){return Xy(this,void 0,void 0,function*(){return this.store.has(e)})}list(){return Xy(this,void 0,void 0,function*(){return Array.from(this.store.values())})}set(e,r){return Xy(this,void 0,void 0,function*(){this.store.set(e,r)})}};E();E();var GJe=or(_$(),1);var WJe=or(_$(),1);E();E();var VJe=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(p){try{m(n.next(p))}catch(w){s(w)}}function d(p){try{m(n.throw(p))}catch(w){s(w)}}function m(p){p.done?o(p.value):i(p.value).then(a,d)}m((n=n.apply(t,e||[])).next())})},$w=class{static digest({data:e}){return VJe(this,void 0,void 0,function*(){return Ec(e)})}};E();var zl=class{};var HJe=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(p){try{m(n.next(p))}catch(w){s(w)}}function d(p){try{m(n.throw(p))}catch(w){s(w)}}function m(p){p.done?o(p.value):i(p.value).then(a,d)}m((n=n.apply(t,e||[])).next())})},BP=class extends zl{digest({algorithm:e,data:r}){return HJe(this,void 0,void 0,function*(){switch(e){case"SHA-256":return yield $w.digest({data:r})}})}};E();E();E();var rme=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),eme=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),ZJe=BigInt(1),x$=BigInt(2),tme=(t,e)=>(t+e/x$)/e;function JJe(t){let e=rme,r=BigInt(3),n=BigInt(6),i=BigInt(11),o=BigInt(22),s=BigInt(23),a=BigInt(44),d=BigInt(88),m=t*t*t%e,p=m*m*t%e,w=zn(p,r,e)*p%e,P=zn(w,r,e)*p%e,S=zn(P,x$,e)*m%e,M=zn(S,i,e)*S%e,A=zn(M,o,e)*M%e,B=zn(A,a,e)*A%e,I=zn(B,d,e)*B%e,C=zn(I,a,e)*A%e,k=zn(C,r,e)*p%e,q=zn(k,s,e)*M%e,L=zn(q,n,e)*m%e,U=zn(L,x$,e);if(!E$.eql(E$.sqr(U),t))throw new Error("Cannot find square root");return U}var E$=Ng(rme,void 0,void 0,{sqrt:JJe}),ja=jE({a:BigInt(0),b:BigInt(7),Fp:E$,n:eme,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:t=>{let e=eme,r=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),n=-ZJe*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),i=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),o=r,s=BigInt("0x100000000000000000000000000000000"),a=tme(o*t,e),d=tme(-n*t,e),m=tn(t-a*r-d*i,e),p=tn(-a*n-d*o,e),w=m>s,P=p>s;if(w&&(m=e-m),P&&(p=e-p),m>s||p>s)throw new Error("splitScalar: Endomorphism failed, k="+t);return{k1neg:w,k1:m,k2neg:P,k2:p}}}},Ec),IPt=BigInt(0);var kPt=ja.ProjectivePoint;E();E();function nme(t){let e=n=>{if(n!==null&&typeof n=="object"&&!Array.isArray(n)){let i=Object.keys(n).sort(),o={};for(let s of i)o[s]=e(n[s]);return o}return n},r=e(t);return JSON.stringify(r)}var YJe=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(p){try{m(n.next(p))}catch(w){s(w)}}function d(p){try{m(n.throw(p))}catch(w){s(w)}}function m(p){p.done?o(p.value):i(p.value).then(a,d)}m((n=n.apply(t,e||[])).next())})},S$="urn:jwk:";function rr({jwk:t}){return YJe(this,void 0,void 0,function*(){let e=t.kty,r;if(e==="EC")r={crv:t.crv,kty:t.kty,x:t.x,y:t.y};else if(e==="oct")r={k:t.k,kty:t.kty};else if(e==="OKP")r={crv:t.crv,kty:t.kty,x:t.x};else if(e==="RSA")r={e:t.e,kty:t.kty,n:t.n};else throw new Error(`Unsupported key type: ${e}`);EN(r);let n=nme(r),i=We.string(n).toUint8Array(),o=yield $w.digest({data:i});return We.uint8Array(o).toBase64Url()})}function Kl(t){return!(!t||typeof t!="object"||!("kty"in t&&"crv"in t&&"x"in t&&"d"in t)||t.kty!=="EC"||typeof t.d!="string"||typeof t.x!="string")}function Lw(t){return!(!t||typeof t!="object"||!("kty"in t&&"crv"in t&&"x"in t)||"d"in t||t.kty!=="EC"||typeof t.x!="string")}function Gl(t){return!(!t||typeof t!="object"||!("kty"in t&&"crv"in t&&"x"in t&&"d"in t)||t.kty!=="OKP"||typeof t.d!="string"||typeof t.x!="string")}function Uw(t){return!(!t||typeof t!="object"||"d"in t||!("kty"in t&&"crv"in t&&"x"in t)||t.kty!=="OKP"||typeof t.x!="string")}function ime(t){if(!t||typeof t!="object")return!1;switch(t.kty){case"EC":case"OKP":case"RSA":return"d"in t;case"oct":return"k"in t;default:return!1}}var ps=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(p){try{m(n.next(p))}catch(w){s(w)}}function d(p){try{m(n.throw(p))}catch(w){s(w)}}function m(p){p.done?o(p.value):i(p.value).then(a,d)}m((n=n.apply(t,e||[])).next())})},QJe=function(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(t);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(t,n[i])&&(r[n[i]]=t[n[i]]);return r},En=class{static adjustSignatureToLowS({signature:e}){return ps(this,void 0,void 0,function*(){let r=ja.Signature.fromCompact(e);return r.hasHighS()?r.normalizeS().toCompactRawBytes():e})}static bytesToPrivateKey({privateKeyBytes:e}){return ps(this,void 0,void 0,function*(){let r=yield En.getCurvePoint({keyBytes:e}),n={kty:"EC",crv:"secp256k1",d:We.uint8Array(e).toBase64Url(),x:We.uint8Array(r.x).toBase64Url(),y:We.uint8Array(r.y).toBase64Url()};return n.kid=yield rr({jwk:n}),n})}static bytesToPublicKey({publicKeyBytes:e}){return ps(this,void 0,void 0,function*(){let r=yield En.getCurvePoint({keyBytes:e}),n={kty:"EC",crv:"secp256k1",x:We.uint8Array(r.x).toBase64Url(),y:We.uint8Array(r.y).toBase64Url()};return n.kid=yield rr({jwk:n}),n})}static compressPublicKey({publicKeyBytes:e}){return ps(this,void 0,void 0,function*(){return ja.ProjectivePoint.fromHex(e).toRawBytes(!0)})}static computePublicKey({key:e}){return ps(this,void 0,void 0,function*(){let r=yield En.privateKeyToBytes({privateKey:e}),n=yield En.getCurvePoint({keyBytes:r}),i={kty:"EC",crv:"secp256k1",x:We.uint8Array(n.x).toBase64Url(),y:We.uint8Array(n.y).toBase64Url()};return i.kid=yield rr({jwk:i}),i})}static convertDerToCompactSignature({derSignature:e}){return ps(this,void 0,void 0,function*(){return ja.Signature.fromDER(e).toCompactRawBytes()})}static decompressPublicKey({publicKeyBytes:e}){return ps(this,void 0,void 0,function*(){return ja.ProjectivePoint.fromHex(e).toRawBytes(!1)})}static generateKey(){return ps(this,void 0,void 0,function*(){let e=ja.utils.randomPrivateKey(),r=yield En.bytesToPrivateKey({privateKeyBytes:e});return r.kid=yield rr({jwk:r}),r})}static getPublicKey({key:e}){var r;return ps(this,void 0,void 0,function*(){if(!(Kl(e)&&e.crv==="secp256k1"))throw new Error("Secp256k1: The provided key is not a secp256k1 private JWK.");let{d:n}=e,i=QJe(e,["d"]);return(r=i.kid)!==null&&r!==void 0||(i.kid=yield rr({jwk:i})),i})}static privateKeyToBytes({privateKey:e}){return ps(this,void 0,void 0,function*(){if(!Kl(e))throw new Error("Secp256k1: The provided key is not a valid EC private key.");return We.base64Url(e.d).toUint8Array()})}static publicKeyToBytes({publicKey:e}){return ps(this,void 0,void 0,function*(){if(!(Lw(e)&&e.y))throw new Error("Secp256k1: The provided key is not a valid EC public key.");let r=new Uint8Array([4]),n=We.base64Url(e.x).toUint8Array(),i=We.base64Url(e.y).toUint8Array();return new Uint8Array([...r,...n,...i])})}static sharedSecret({privateKeyA:e,publicKeyB:r}){return ps(this,void 0,void 0,function*(){if("x"in e&&"x"in r&&e.x===r.x)throw new Error("Secp256k1: ECDH shared secret cannot be computed from a single key pair's public and private keys.");let n=yield En.privateKeyToBytes({privateKey:e}),i=yield En.publicKeyToBytes({publicKey:r});return ja.getSharedSecret(n,i,!0).slice(1)})}static sign({data:e,key:r}){return ps(this,void 0,void 0,function*(){let n=yield En.privateKeyToBytes({privateKey:r}),i=Ec(e);return ja.sign(i,n).toCompactRawBytes()})}static validatePrivateKey({privateKeyBytes:e}){return ps(this,void 0,void 0,function*(){return ja.utils.isValidPrivateKey(e)})}static validatePublicKey({publicKeyBytes:e}){return ps(this,void 0,void 0,function*(){try{ja.ProjectivePoint.fromHex(e).assertValidity()}catch{return!1}return!0})}static verify({key:e,signature:r,data:n}){return ps(this,void 0,void 0,function*(){let i=yield En.publicKeyToBytes({publicKey:e}),o=Ec(n);return ja.verify(r,o,i,{lowS:!1})})}static getCurvePoint({keyBytes:e}){return ps(this,void 0,void 0,function*(){e.byteLength===32&&(e=ja.getPublicKey(e));let r=ja.ProjectivePoint.fromHex(e),n=wa(r.x,32),i=wa(r.y,32);return{x:n,y:i}})}};E();var ms=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(p){try{m(n.next(p))}catch(w){s(w)}}function d(p){try{m(n.throw(p))}catch(w){s(w)}}function m(p){p.done?o(p.value):i(p.value).then(a,d)}m((n=n.apply(t,e||[])).next())})},XJe=function(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(t);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(t,n[i])&&(r[n[i]]=t[n[i]]);return r},On=class{static adjustSignatureToLowS({signature:e}){return ms(this,void 0,void 0,function*(){let r=Hs.Signature.fromCompact(e);return r.hasHighS()?r.normalizeS().toCompactRawBytes():e})}static bytesToPrivateKey({privateKeyBytes:e}){return ms(this,void 0,void 0,function*(){let r=yield On.getCurvePoint({keyBytes:e}),n={kty:"EC",crv:"P-256",d:We.uint8Array(e).toBase64Url(),x:We.uint8Array(r.x).toBase64Url(),y:We.uint8Array(r.y).toBase64Url()};return n.kid=yield rr({jwk:n}),n})}static bytesToPublicKey({publicKeyBytes:e}){return ms(this,void 0,void 0,function*(){let r=yield On.getCurvePoint({keyBytes:e}),n={kty:"EC",crv:"P-256",x:We.uint8Array(r.x).toBase64Url(),y:We.uint8Array(r.y).toBase64Url()};return n.kid=yield rr({jwk:n}),n})}static compressPublicKey({publicKeyBytes:e}){return ms(this,void 0,void 0,function*(){return Hs.ProjectivePoint.fromHex(e).toRawBytes(!0)})}static computePublicKey({key:e}){return ms(this,void 0,void 0,function*(){let r=yield On.privateKeyToBytes({privateKey:e}),n=yield On.getCurvePoint({keyBytes:r}),i={kty:"EC",crv:"P-256",x:We.uint8Array(n.x).toBase64Url(),y:We.uint8Array(n.y).toBase64Url()};return i.kid=yield rr({jwk:i}),i})}static convertDerToCompactSignature({derSignature:e}){return ms(this,void 0,void 0,function*(){return Hs.Signature.fromDER(e).toCompactRawBytes()})}static decompressPublicKey({publicKeyBytes:e}){return ms(this,void 0,void 0,function*(){return Hs.ProjectivePoint.fromHex(e).toRawBytes(!1)})}static generateKey(){return ms(this,void 0,void 0,function*(){let e=Hs.utils.randomPrivateKey(),r=yield On.bytesToPrivateKey({privateKeyBytes:e});return r.kid=yield rr({jwk:r}),r})}static getPublicKey({key:e}){var r;return ms(this,void 0,void 0,function*(){if(!(Kl(e)&&e.crv==="P-256"))throw new Error("Secp256r1: The provided key is not a 'P-256' private JWK.");let{d:n}=e,i=XJe(e,["d"]);return(r=i.kid)!==null&&r!==void 0||(i.kid=yield rr({jwk:i})),i})}static privateKeyToBytes({privateKey:e}){return ms(this,void 0,void 0,function*(){if(!Kl(e))throw new Error("Secp256r1: The provided key is not a valid EC private key.");return We.base64Url(e.d).toUint8Array()})}static publicKeyToBytes({publicKey:e}){return ms(this,void 0,void 0,function*(){if(!(Lw(e)&&e.y))throw new Error("Secp256r1: The provided key is not a valid EC public key.");let r=new Uint8Array([4]),n=We.base64Url(e.x).toUint8Array(),i=We.base64Url(e.y).toUint8Array();return new Uint8Array([...r,...n,...i])})}static sharedSecret({privateKeyA:e,publicKeyB:r}){return ms(this,void 0,void 0,function*(){if("x"in e&&"x"in r&&e.x===r.x)throw new Error("Secp256r1: ECDH shared secret cannot be computed from a single key pair's public and private keys.");let n=yield On.privateKeyToBytes({privateKey:e}),i=yield On.publicKeyToBytes({publicKey:r});return Hs.getSharedSecret(n,i,!0).slice(1)})}static sign({data:e,key:r}){return ms(this,void 0,void 0,function*(){let n=yield On.privateKeyToBytes({privateKey:r}),i=Ec(e);return Hs.sign(i,n).toCompactRawBytes()})}static validatePrivateKey({privateKeyBytes:e}){return ms(this,void 0,void 0,function*(){return Hs.utils.isValidPrivateKey(e)})}static validatePublicKey({publicKeyBytes:e}){return ms(this,void 0,void 0,function*(){try{Hs.ProjectivePoint.fromHex(e).assertValidity()}catch{return!1}return!0})}static verify({key:e,signature:r,data:n}){return ms(this,void 0,void 0,function*(){let i=yield On.publicKeyToBytes({publicKey:e}),o=Ec(n);return Hs.verify(r,o,i,{lowS:!1})})}static getCurvePoint({keyBytes:e}){return ms(this,void 0,void 0,function*(){e.byteLength===32&&(e=Hs.getPublicKey(e));let r=Hs.ProjectivePoint.fromHex(e),n=wa(r.x,32),i=wa(r.y,32);return{x:n,y:i}})}};var E3=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(p){try{m(n.next(p))}catch(w){s(w)}}function d(p){try{m(n.throw(p))}catch(w){s(w)}}function m(p){p.done?o(p.value):i(p.value).then(a,d)}m((n=n.apply(t,e||[])).next())})},S3=class extends zl{computePublicKey({key:e}){return E3(this,void 0,void 0,function*(){if(!Kl(e))throw new TypeError("Invalid key provided. Must be an elliptic curve (EC) private key.");switch(e.crv){case"secp256k1":{let r=yield En.computePublicKey({key:e});return r.alg="ES256K",r}case"P-256":{let r=yield On.computePublicKey({key:e});return r.alg="ES256",r}default:throw new Error(`Unsupported curve: ${e.crv}`)}})}generateKey({algorithm:e}){return E3(this,void 0,void 0,function*(){switch(e){case"ES256K":case"secp256k1":{let r=yield En.generateKey();return r.alg="ES256K",r}case"ES256":case"secp256r1":{let r=yield On.generateKey();return r.alg="ES256",r}}})}getPublicKey({key:e}){return E3(this,void 0,void 0,function*(){if(!Kl(e))throw new TypeError("Invalid key provided. Must be an elliptic curve (EC) private key.");switch(e.crv){case"secp256k1":{let r=yield En.getPublicKey({key:e});return r.alg="ES256K",r}case"P-256":{let r=yield On.getPublicKey({key:e});return r.alg="ES256",r}default:throw new Error(`Unsupported curve: ${e.crv}`)}})}sign({key:e,data:r}){return E3(this,void 0,void 0,function*(){if(!Kl(e))throw new TypeError("Invalid key provided. Must be an elliptic curve (EC) private key.");switch(e.crv){case"secp256k1":return yield En.sign({key:e,data:r});case"P-256":return yield On.sign({key:e,data:r});default:throw new Error(`Unsupported curve: ${e.crv}`)}})}verify({key:e,signature:r,data:n}){return E3(this,void 0,void 0,function*(){if(!Lw(e))throw new TypeError("Invalid key provided. Must be an elliptic curve (EC) public key.");switch(e.crv){case"secp256k1":return yield En.verify({key:e,signature:r,data:n});case"P-256":return yield On.verify({key:e,signature:r,data:n});default:throw new Error(`Unsupported curve: ${e.crv}`)}})}};E();E();E();E();E();var DP=BigInt(4294967295),M$=BigInt(32);function ome(t,e=!1){return e?{h:Number(t&DP),l:Number(t>>M$&DP)}:{h:Number(t>>M$&DP)|0,l:Number(t&DP)|0}}function eYe(t,e=!1){let r=new Uint32Array(t.length),n=new Uint32Array(t.length);for(let i=0;i<t.length;i++){let{h:o,l:s}=ome(t[i],e);[r[i],n[i]]=[o,s]}return[r,n]}var tYe=(t,e)=>BigInt(t>>>0)<<M$|BigInt(e>>>0),rYe=(t,e,r)=>t>>>r,nYe=(t,e,r)=>t<<32-r|e>>>r,iYe=(t,e,r)=>t>>>r|e<<32-r,oYe=(t,e,r)=>t<<32-r|e>>>r,sYe=(t,e,r)=>t<<64-r|e>>>r-32,aYe=(t,e,r)=>t>>>r-32|e<<64-r,cYe=(t,e)=>e,fYe=(t,e)=>t,uYe=(t,e,r)=>t<<r|e>>>32-r,lYe=(t,e,r)=>e<<r|t>>>32-r,dYe=(t,e,r)=>e<<r-32|t>>>64-r,hYe=(t,e,r)=>t<<r-32|e>>>64-r;function pYe(t,e,r,n){let i=(e>>>0)+(n>>>0);return{h:t+r+(i/2**32|0)|0,l:i|0}}var mYe=(t,e,r)=>(t>>>0)+(e>>>0)+(r>>>0),yYe=(t,e,r,n)=>e+r+n+(t/2**32|0)|0,gYe=(t,e,r,n)=>(t>>>0)+(e>>>0)+(r>>>0)+(n>>>0),vYe=(t,e,r,n,i)=>e+r+n+i+(t/2**32|0)|0,bYe=(t,e,r,n,i)=>(t>>>0)+(e>>>0)+(r>>>0)+(n>>>0)+(i>>>0),wYe=(t,e,r,n,i,o)=>e+r+n+i+o+(t/2**32|0)|0;var _Ye={fromBig:ome,split:eYe,toBig:tYe,shrSH:rYe,shrSL:nYe,rotrSH:iYe,rotrSL:oYe,rotrBH:sYe,rotrBL:aYe,rotr32H:cYe,rotr32L:fYe,rotlSH:uYe,rotlSL:lYe,rotlBH:dYe,rotlBL:hYe,add:pYe,add3L:mYe,add3H:yYe,add4L:gYe,add4H:vYe,add5H:wYe,add5L:bYe},fr=_Ye;var[xYe,EYe]=(()=>fr.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(t=>BigInt(t))))(),d0=new Uint32Array(80),h0=new Uint32Array(80),P$=class extends qg{constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){let{Ah:e,Al:r,Bh:n,Bl:i,Ch:o,Cl:s,Dh:a,Dl:d,Eh:m,El:p,Fh:w,Fl:P,Gh:S,Gl:M,Hh:A,Hl:B}=this;return[e,r,n,i,o,s,a,d,m,p,w,P,S,M,A,B]}set(e,r,n,i,o,s,a,d,m,p,w,P,S,M,A,B){this.Ah=e|0,this.Al=r|0,this.Bh=n|0,this.Bl=i|0,this.Ch=o|0,this.Cl=s|0,this.Dh=a|0,this.Dl=d|0,this.Eh=m|0,this.El=p|0,this.Fh=w|0,this.Fl=P|0,this.Gh=S|0,this.Gl=M|0,this.Hh=A|0,this.Hl=B|0}process(e,r){for(let k=0;k<16;k++,r+=4)d0[k]=e.getUint32(r),h0[k]=e.getUint32(r+=4);for(let k=16;k<80;k++){let q=d0[k-15]|0,L=h0[k-15]|0,U=fr.rotrSH(q,L,1)^fr.rotrSH(q,L,8)^fr.shrSH(q,L,7),F=fr.rotrSL(q,L,1)^fr.rotrSL(q,L,8)^fr.shrSL(q,L,7),N=d0[k-2]|0,G=h0[k-2]|0,x=fr.rotrSH(N,G,19)^fr.rotrBH(N,G,61)^fr.shrSH(N,G,6),c=fr.rotrSL(N,G,19)^fr.rotrBL(N,G,61)^fr.shrSL(N,G,6),u=fr.add4L(F,c,h0[k-7],h0[k-16]),y=fr.add4H(u,U,x,d0[k-7],d0[k-16]);d0[k]=y|0,h0[k]=u|0}let{Ah:n,Al:i,Bh:o,Bl:s,Ch:a,Cl:d,Dh:m,Dl:p,Eh:w,El:P,Fh:S,Fl:M,Gh:A,Gl:B,Hh:I,Hl:C}=this;for(let k=0;k<80;k++){let q=fr.rotrSH(w,P,14)^fr.rotrSH(w,P,18)^fr.rotrBH(w,P,41),L=fr.rotrSL(w,P,14)^fr.rotrSL(w,P,18)^fr.rotrBL(w,P,41),U=w&S^~w&A,F=P&M^~P&B,N=fr.add5L(C,L,F,EYe[k],h0[k]),G=fr.add5H(N,I,q,U,xYe[k],d0[k]),x=N|0,c=fr.rotrSH(n,i,28)^fr.rotrBH(n,i,34)^fr.rotrBH(n,i,39),u=fr.rotrSL(n,i,28)^fr.rotrBL(n,i,34)^fr.rotrBL(n,i,39),y=n&o^n&a^o&a,l=i&s^i&d^s&d;I=A|0,C=B|0,A=S|0,B=M|0,S=w|0,M=P|0,{h:w,l:P}=fr.add(m|0,p|0,G|0,x|0),m=a|0,p=d|0,a=o|0,d=s|0,o=n|0,s=i|0;let h=fr.add3L(x,u,l);n=fr.add3H(h,G,c,y),i=h|0}({h:n,l:i}=fr.add(this.Ah|0,this.Al|0,n|0,i|0)),{h:o,l:s}=fr.add(this.Bh|0,this.Bl|0,o|0,s|0),{h:a,l:d}=fr.add(this.Ch|0,this.Cl|0,a|0,d|0),{h:m,l:p}=fr.add(this.Dh|0,this.Dl|0,m|0,p|0),{h:w,l:P}=fr.add(this.Eh|0,this.El|0,w|0,P|0),{h:S,l:M}=fr.add(this.Fh|0,this.Fl|0,S|0,M|0),{h:A,l:B}=fr.add(this.Gh|0,this.Gl|0,A|0,B|0),{h:I,l:C}=fr.add(this.Hh|0,this.Hl|0,I|0,C|0),this.set(n,i,o,s,a,d,m,p,w,P,S,M,A,B,I,C)}roundClean(){d0.fill(0),h0.fill(0)}destroy(){this.buffer.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}};var A$=IE(()=>new P$);E();var mu=BigInt(0),mc=BigInt(1),CP=BigInt(2),SYe=BigInt(8),MYe={zip215:!0};function PYe(t){let e=P1(t);return _c(t,{hash:"function",a:"bigint",d:"bigint",randomBytes:"function"},{adjustScalarBytes:"function",domain:"function",uvRatio:"function",mapToCurve:"function"}),Object.freeze({...e})}function jP(t){let e=PYe(t),{Fp:r,n,prehash:i,hash:o,randomBytes:s,nByteLength:a,h:d}=e,m=CP<<BigInt(a*8)-mc,p=r.create,w=e.uvRatio||((g,f)=>{try{return{isValid:!0,value:r.sqrt(g*r.inv(f))}}catch{return{isValid:!1,value:mu}}}),P=e.adjustScalarBytes||(g=>g),S=e.domain||((g,f,v)=>{if(f.length||v)throw new Error("Contexts/pre-hash are not supported");return g}),M=g=>typeof g=="bigint"&&mu<g,A=(g,f)=>M(g)&&M(f)&&g<f,B=g=>g===mu||A(g,m);function I(g,f){if(A(g,f))return g;throw new Error(`Expected valid scalar < ${f}, got ${typeof g} ${g}`)}function C(g){return g===mu?g:I(g,n)}let k=new Map;function q(g){if(!(g instanceof L))throw new Error("ExtendedPoint expected")}class L{constructor(f,v,O,T){if(this.ex=f,this.ey=v,this.ez=O,this.et=T,!B(f))throw new Error("x required");if(!B(v))throw new Error("y required");if(!B(O))throw new Error("z required");if(!B(T))throw new Error("t required")}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static fromAffine(f){if(f instanceof L)throw new Error("extended point not allowed");let{x:v,y:O}=f||{};if(!B(v)||!B(O))throw new Error("invalid affine point");return new L(v,O,mc,p(v*O))}static normalizeZ(f){let v=r.invertBatch(f.map(O=>O.ez));return f.map((O,T)=>O.toAffine(v[T])).map(L.fromAffine)}_setWindowSize(f){this._WINDOW_SIZE=f,k.delete(this)}assertValidity(){let{a:f,d:v}=e;if(this.is0())throw new Error("bad point: ZERO");let{ex:O,ey:T,ez:R,et:z}=this,V=p(O*O),W=p(T*T),Z=p(R*R),J=p(Z*Z),X=p(V*f),Ee=p(Z*p(X+W)),re=p(J+p(v*p(V*W)));if(Ee!==re)throw new Error("bad point: equation left != right (1)");let ne=p(O*T),qe=p(R*z);if(ne!==qe)throw new Error("bad point: equation left != right (2)")}equals(f){q(f);let{ex:v,ey:O,ez:T}=this,{ex:R,ey:z,ez:V}=f,W=p(v*V),Z=p(R*T),J=p(O*V),X=p(z*T);return W===Z&&J===X}is0(){return this.equals(L.ZERO)}negate(){return new L(p(-this.ex),this.ey,this.ez,p(-this.et))}double(){let{a:f}=e,{ex:v,ey:O,ez:T}=this,R=p(v*v),z=p(O*O),V=p(CP*p(T*T)),W=p(f*R),Z=v+O,J=p(p(Z*Z)-R-z),X=W+z,Ee=X-V,re=W-z,ne=p(J*Ee),qe=p(X*re),ce=p(J*re),ye=p(Ee*X);return new L(ne,qe,ye,ce)}add(f){q(f);let{a:v,d:O}=e,{ex:T,ey:R,ez:z,et:V}=this,{ex:W,ey:Z,ez:J,et:X}=f;if(v===BigInt(-1)){let ot=p((R-T)*(Z+W)),ue=p((R+T)*(Z-W)),he=p(ue-ot);if(he===mu)return this.double();let lt=p(z*CP*X),se=p(V*CP*J),fe=se+lt,Lt=ue+ot,ge=se-lt,ve=p(fe*he),on=p(Lt*ge),xe=p(fe*ge),Pe=p(he*Lt);return new L(ve,on,Pe,xe)}let Ee=p(T*W),re=p(R*Z),ne=p(V*O*X),qe=p(z*J),ce=p((T+R)*(W+Z)-Ee-re),ye=qe-ne,Ne=qe+ne,ie=p(re-v*Ee),oe=p(ce*ye),ze=p(Ne*ie),le=p(ce*ie),me=p(ye*Ne);return new L(oe,ze,me,le)}subtract(f){return this.add(f.negate())}wNAF(f){return N.wNAFCached(this,k,f,L.normalizeZ)}multiply(f){let{p:v,f:O}=this.wNAF(I(f,n));return L.normalizeZ([v,O])[0]}multiplyUnsafe(f){let v=C(f);return v===mu?F:this.equals(F)||v===mc?this:this.equals(U)?this.wNAF(v).p:N.unsafeLadder(this,v)}isSmallOrder(){return this.multiplyUnsafe(d).is0()}isTorsionFree(){return N.unsafeLadder(this,n).is0()}toAffine(f){let{ex:v,ey:O,ez:T}=this,R=this.is0();f==null&&(f=R?SYe:r.inv(T));let z=p(v*f),V=p(O*f),W=p(T*f);if(R)return{x:mu,y:mc};if(W!==mc)throw new Error("invZ was invalid");return{x:z,y:V}}clearCofactor(){let{h:f}=e;return f===mc?this:this.multiplyUnsafe(f)}static fromHex(f,v=!1){let{d:O,a:T}=e,R=r.BYTES;f=Fn("pointHex",f,R);let z=f.slice(),V=f[R-1];z[R-1]=V&-129;let W=wf(z);W===mu||(v?I(W,m):I(W,r.ORDER));let Z=p(W*W),J=p(Z-mc),X=p(O*Z-T),{isValid:Ee,value:re}=w(J,X);if(!Ee)throw new Error("Point.fromHex: invalid y coordinate");let ne=(re&mc)===mc,qe=(V&128)!==0;if(!v&&re===mu&&qe)throw new Error("Point.fromHex: x=0 and x_0=1");return qe!==ne&&(re=p(-re)),L.fromAffine({x:re,y:W})}static fromPrivateKey(f){return c(f).point}toRawBytes(){let{x:f,y:v}=this.toAffine(),O=cd(v,r.BYTES);return O[O.length-1]|=f&mc?128:0,O}toHex(){return sd(this.toRawBytes())}}L.BASE=new L(e.Gx,e.Gy,mc,p(e.Gx*e.Gy)),L.ZERO=new L(mu,mc,mc,mu);let{BASE:U,ZERO:F}=L,N=CE(L,a*8);function G(g){return tn(g,n)}function x(g){return G(wf(g))}function c(g){let f=a;g=Fn("private key",g,f);let v=Fn("hashed private key",o(g),2*f),O=P(v.slice(0,f)),T=v.slice(f,2*f),R=x(O),z=U.multiply(R),V=z.toRawBytes();return{head:O,prefix:T,scalar:R,point:z,pointBytes:V}}function u(g){return c(g).pointBytes}function y(g=new Uint8Array,...f){let v=fd(...f);return x(o(S(v,Fn("context",g),!!i)))}function l(g,f,v={}){g=Fn("message",g),i&&(g=i(g));let{prefix:O,scalar:T,pointBytes:R}=c(f),z=y(v.context,O,g),V=U.multiply(z).toRawBytes(),W=y(v.context,V,R,g),Z=G(z+W*T);C(Z);let J=fd(V,cd(Z,r.BYTES));return Fn("result",J,a*2)}let h=MYe;function b(g,f,v,O=h){let{context:T,zip215:R}=O,z=r.BYTES;g=Fn("signature",g,2*z),f=Fn("message",f),i&&(f=i(f));let V=wf(g.slice(z,2*z)),W,Z,J;try{W=L.fromHex(v,R),Z=L.fromHex(g.slice(0,z),R),J=U.multiplyUnsafe(V)}catch{return!1}if(!R&&W.isSmallOrder())return!1;let X=y(T,Z.toRawBytes(),W.toRawBytes(),f);return Z.add(W.multiplyUnsafe(X)).subtract(J).clearCofactor().equals(L.ZERO)}return U._setWindowSize(8),{CURVE:e,getPublicKey:u,sign:l,verify:b,ExtendedPoint:L,utils:{getExtendedPublicKey:c,randomPrivateKey:()=>s(r.BYTES),precompute(g=8,f=L.BASE){return f._setWindowSize(g),f.multiply(BigInt(3)),f}}}}E();var M3=BigInt(0),T$=BigInt(1);function AYe(t){return _c(t,{a:"bigint"},{montgomeryBits:"isSafeInteger",nByteLength:"isSafeInteger",adjustScalarBytes:"function",domain:"function",powPminus2:"function",Gu:"bigint"}),Object.freeze({...t})}function sme(t){let e=AYe(t),{P:r}=e,n=k=>tn(k,r),i=e.montgomeryBits,o=Math.ceil(i/8),s=e.nByteLength,a=e.adjustScalarBytes||(k=>k),d=e.powPminus2||(k=>RT(k,r-BigInt(2),r));function m(k,q,L){let U=n(k*(q-L));return q=n(q-U),L=n(L+U),[q,L]}function p(k){if(typeof k=="bigint"&&M3<=k&&k<r)return k;throw new Error("Expected valid scalar 0 < scalar < CURVE.P")}let w=(e.a-BigInt(2))/BigInt(4);function P(k,q){let L=p(k),U=p(q),F=L,N=T$,G=M3,x=L,c=T$,u=M3,y;for(let h=BigInt(i-1);h>=M3;h--){let b=U>>h&T$;u^=b,y=m(u,N,x),N=y[0],x=y[1],y=m(u,G,c),G=y[0],c=y[1],u=b;let _=N+G,g=n(_*_),f=N-G,v=n(f*f),O=g-v,T=x+c,R=x-c,z=n(R*_),V=n(T*f),W=z+V,Z=z-V;x=n(W*W),c=n(F*n(Z*Z)),N=n(g*v),G=n(O*(g+n(w*O)))}y=m(u,N,x),N=y[0],x=y[1],y=m(u,G,c),G=y[0],c=y[1];let l=d(G);return n(N*l)}function S(k){return cd(n(k),o)}function M(k){let q=Fn("u coordinate",k,o);return s===32&&(q[31]&=127),wf(q)}function A(k){let q=Fn("scalar",k),L=q.length;if(L!==o&&L!==s)throw new Error(`Expected ${o} or ${s} bytes, got ${L}`);return wf(a(q))}function B(k,q){let L=M(q),U=A(k),F=P(L,U);if(F===M3)throw new Error("Invalid private or public key received");return S(F)}let I=S(e.Gu);function C(k){return B(k,I)}return{scalarMult:B,scalarMultBase:C,getSharedSecret:(k,q)=>B(k,q),getPublicKey:k=>C(k),utils:{randomPrivateKey:()=>e.randomBytes(e.nByteLength)},GuBytes:I}}var P3=BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949"),ame=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752"),TAt=BigInt(0),TYe=BigInt(1),R$=BigInt(2),RYe=BigInt(5),cme=BigInt(10),IYe=BigInt(20),kYe=BigInt(40),fme=BigInt(80);function ume(t){let e=P3,n=t*t%e*t%e,i=zn(n,R$,e)*n%e,o=zn(i,TYe,e)*t%e,s=zn(o,RYe,e)*o%e,a=zn(s,cme,e)*s%e,d=zn(a,IYe,e)*a%e,m=zn(d,kYe,e)*d%e,p=zn(m,fme,e)*m%e,w=zn(p,fme,e)*m%e,P=zn(w,cme,e)*s%e;return{pow_p_5_8:zn(P,R$,e)*t%e,b2:n}}function lme(t){return t[0]&=248,t[31]&=127,t[31]|=64,t}function OYe(t,e){let r=P3,n=tn(e*e*e,r),i=tn(n*n*e,r),o=ume(t*i).pow_p_5_8,s=tn(t*n*o,r),a=tn(e*s*s,r),d=s,m=tn(s*ame,r),p=a===t,w=a===tn(-t,r),P=a===tn(-t*ame,r);return p&&(s=d),(w||P)&&(s=m),OF(s,r)&&(s=tn(-s,r)),{isValid:p||w,value:s}}var df=Ng(P3,void 0,!0),A3={a:BigInt(-1),d:BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),Fp:df,n:BigInt("7237005577332262213973186563042994240857116359379907606001950938285454250989"),h:BigInt(8),Gx:BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),Gy:BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960"),hash:A$,randomBytes:C0,adjustScalarBytes:lme,uvRatio:OYe},p0=jP(A3);function dme(t,e,r){if(e.length>255)throw new Error("Context is too big");return RE(ET("SigEd25519 no Ed25519 collisions"),new Uint8Array([r?1:0,e.length]),e,t)}var RAt=jP({...A3,domain:dme}),IAt=jP({...A3,domain:dme,prehash:A$}),ug=(()=>sme({P:P3,a:BigInt(486662),montgomeryBits:255,nByteLength:32,Gu:BigInt(9),powPminus2:t=>{let e=P3,{pow_p_5_8:r,b2:n}=ume(t);return tn(zn(r,BigInt(3),e)*n,e)},adjustScalarBytes:lme,randomBytes:C0}))();function hme(t){let{y:e}=p0.ExtendedPoint.fromHex(t),r=BigInt(1);return df.toBytes(df.create((r+e)*df.inv(r-e)))}function pme(t){let e=A3.hash(t.subarray(0,32));return A3.adjustScalarBytes(e).subarray(0,32)}var BYe=(df.ORDER+BigInt(3))/BigInt(8),kAt=df.pow(R$,BYe),OAt=df.sqrt(df.neg(df.ONE)),BAt=(df.ORDER-BigInt(5))/BigInt(8),DAt=BigInt(486662);var CAt=BF(df,df.neg(BigInt(486664)));var jAt=BigInt("25063068953384623474111414158702152701244531502492656460079210482610430750235"),NAt=BigInt("54469307008909316920995813868745141605393597292927456921205312896311721017578"),qAt=BigInt("1159843021668779879193775521855586647937357759715417654439879720876111806838"),$At=BigInt("40440834346308536858101042469323190826248399146238708352240133220865137265952");var LAt=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");var hf=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(p){try{m(n.next(p))}catch(w){s(w)}}function d(p){try{m(n.throw(p))}catch(w){s(w)}}function m(p){p.done?o(p.value):i(p.value).then(a,d)}m((n=n.apply(t,e||[])).next())})},DYe=function(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(t);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(t,n[i])&&(r[n[i]]=t[n[i]]);return r},Bn=class{static bytesToPrivateKey({privateKeyBytes:e}){return hf(this,void 0,void 0,function*(){let r=p0.getPublicKey(e),n={crv:"Ed25519",d:We.uint8Array(e).toBase64Url(),kty:"OKP",x:We.uint8Array(r).toBase64Url()};return n.kid=yield rr({jwk:n}),n})}static bytesToPublicKey({publicKeyBytes:e}){return hf(this,void 0,void 0,function*(){let r={kty:"OKP",crv:"Ed25519",x:We.uint8Array(e).toBase64Url()};return r.kid=yield rr({jwk:r}),r})}static computePublicKey({key:e}){return hf(this,void 0,void 0,function*(){let r=yield Bn.privateKeyToBytes({privateKey:e}),n=p0.getPublicKey(r),i={kty:"OKP",crv:"Ed25519",x:We.uint8Array(n).toBase64Url()};return i.kid=yield rr({jwk:i}),i})}static convertPrivateKeyToX25519({privateKey:e}){return hf(this,void 0,void 0,function*(){let r=yield Bn.privateKeyToBytes({privateKey:e}),n=pme(r),i=ug.getPublicKey(n),o={kty:"OKP",crv:"X25519",d:We.uint8Array(n).toBase64Url(),x:We.uint8Array(i).toBase64Url()};return o.kid=yield rr({jwk:o}),o})}static convertPublicKeyToX25519({publicKey:e}){return hf(this,void 0,void 0,function*(){let r=yield Bn.publicKeyToBytes({publicKey:e});if(!(yield Bn.validatePublicKey({publicKeyBytes:r})))throw new Error("Ed25519: Invalid public key.");let i=hme(r),o={kty:"OKP",crv:"X25519",x:We.uint8Array(i).toBase64Url()};return o.kid=yield rr({jwk:o}),o})}static generateKey(){return hf(this,void 0,void 0,function*(){let e=p0.utils.randomPrivateKey(),r=yield Bn.bytesToPrivateKey({privateKeyBytes:e});return r.kid=yield rr({jwk:r}),r})}static getPublicKey({key:e}){var r;return hf(this,void 0,void 0,function*(){if(!(Gl(e)&&e.crv==="Ed25519"))throw new Error("Ed25519: The provided key is not an Ed25519 private JWK.");let{d:n}=e,i=DYe(e,["d"]);return(r=i.kid)!==null&&r!==void 0||(i.kid=yield rr({jwk:i})),i})}static privateKeyToBytes({privateKey:e}){return hf(this,void 0,void 0,function*(){if(!Gl(e))throw new Error("Ed25519: The provided key is not a valid OKP private key.");return We.base64Url(e.d).toUint8Array()})}static publicKeyToBytes({publicKey:e}){return hf(this,void 0,void 0,function*(){if(!Uw(e))throw new Error("Ed25519: The provided key is not a valid OKP public key.");return We.base64Url(e.x).toUint8Array()})}static sign({key:e,data:r}){return hf(this,void 0,void 0,function*(){let n=yield Bn.privateKeyToBytes({privateKey:e});return p0.sign(r,n)})}static validatePublicKey({publicKeyBytes:e}){return hf(this,void 0,void 0,function*(){try{p0.ExtendedPoint.fromHex(e).assertValidity()}catch{return!1}return!0})}static verify({key:e,signature:r,data:n}){return hf(this,void 0,void 0,function*(){let i=yield Bn.publicKeyToBytes({publicKey:e});return p0.verify(r,n,i)})}};var T3=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(p){try{m(n.next(p))}catch(w){s(w)}}function d(p){try{m(n.throw(p))}catch(w){s(w)}}function m(p){p.done?o(p.value):i(p.value).then(a,d)}m((n=n.apply(t,e||[])).next())})},NP=class extends zl{computePublicKey({key:e}){return T3(this,void 0,void 0,function*(){if(!Gl(e))throw new TypeError("Invalid key provided. Must be an octet key pair (OKP) private key.");switch(e.crv){case"Ed25519":{let r=yield Bn.computePublicKey({key:e});return r.alg="EdDSA",r}default:throw new Error(`Unsupported curve: ${e.crv}`)}})}generateKey({algorithm:e}){return T3(this,void 0,void 0,function*(){switch(e){case"Ed25519":{let r=yield Bn.generateKey();return r.alg="EdDSA",r}}})}getPublicKey({key:e}){return T3(this,void 0,void 0,function*(){if(!Gl(e))throw new TypeError("Invalid key provided. Must be an octet key pair (OKP) private key.");switch(e.crv){case"Ed25519":{let r=yield Bn.getPublicKey({key:e});return r.alg="EdDSA",r}default:throw new Error(`Unsupported curve: ${e.crv}`)}})}sign({key:e,data:r}){return T3(this,void 0,void 0,function*(){if(!Gl(e))throw new TypeError("Invalid key provided. Must be an octet key pair (OKP) private key.");switch(e.crv){case"Ed25519":return yield Bn.sign({key:e,data:r});default:throw new Error(`Unsupported curve: ${e.crv}`)}})}verify({key:e,signature:r,data:n}){return T3(this,void 0,void 0,function*(){if(!Uw(e))throw new TypeError("Invalid key provided. Must be an octet key pair (OKP) public key.");switch(e.crv){case"Ed25519":return yield Bn.verify({key:e,signature:r,data:n});default:throw new Error(`Unsupported curve: ${e.crv}`)}})}};var wh=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(p){try{m(n.next(p))}catch(w){s(w)}}function d(p){try{m(n.throw(p))}catch(w){s(w)}}function m(p){p.done?o(p.value):i(p.value).then(a,d)}m((n=n.apply(t,e||[])).next())})},I$={Ed25519:{implementation:NP,names:["Ed25519"]},secp256k1:{implementation:S3,names:["ES256K","secp256k1"]},secp256r1:{implementation:S3,names:["ES256","secp256r1"]},"SHA-256":{implementation:BP,names:["SHA-256"]}},Ks=class{constructor(e){var r;this._algorithmInstances=new Map,this._keyStore=(r=e?.keyStore)!==null&&r!==void 0?r:new oP}digest({algorithm:e,data:r}){return wh(this,void 0,void 0,function*(){return yield this.getAlgorithm({algorithm:e}).digest({algorithm:e,data:r})})}exportKey({keyUri:e}){return wh(this,void 0,void 0,function*(){return yield this.getPrivateKey({keyUri:e})})}generateKey({algorithm:e}){return wh(this,void 0,void 0,function*(){let n=yield this.getAlgorithm({algorithm:e}).generateKey({algorithm:e});if(n?.kid===void 0)throw new Error("Generated key is missing a required property: kid");let i=`${S$}${n.kid}`;return yield this._keyStore.set(i,n),i})}getKeyUri({key:e}){return wh(this,void 0,void 0,function*(){let r=yield rr({jwk:e});return`${S$}${r}`})}getPublicKey({keyUri:e}){return wh(this,void 0,void 0,function*(){let r=yield this.getPrivateKey({keyUri:e}),n=this.getAlgorithmName({key:r});return yield this.getAlgorithm({algorithm:n}).getPublicKey({key:r})})}importKey({key:e}){var r;return wh(this,void 0,void 0,function*(){if(!ime(e))throw new TypeError("Invalid key provided. Must be a private key in JWK format.");let n=structuredClone(e);(r=n.kid)!==null&&r!==void 0||(n.kid=yield rr({jwk:n}));let i=yield this.getKeyUri({key:n});return yield this._keyStore.set(i,n),i})}sign({keyUri:e,data:r}){return wh(this,void 0,void 0,function*(){let n=yield this.getPrivateKey({keyUri:e}),i=this.getAlgorithmName({key:n});return this.getAlgorithm({algorithm:i}).sign({data:r,key:n})})}verify({key:e,signature:r,data:n}){return wh(this,void 0,void 0,function*(){let i=this.getAlgorithmName({key:e});return this.getAlgorithm({algorithm:i}).verify({key:e,signature:r,data:n})})}getAlgorithm({algorithm:e}){var r;let n=(r=I$[e])===null||r===void 0?void 0:r.implementation;if(!n)throw new Error(`Algorithm not supported: ${e}`);return this._algorithmInstances.has(n)||this._algorithmInstances.set(n,new n),this._algorithmInstances.get(n)}getAlgorithmName({key:e}){let r=e.alg,n=e.crv;for(let i in I$){let o=I$[i];if(r&&o.names.includes(r))return i;if(n&&o.names.includes(n))return i}throw new Error(`Unable to determine algorithm based on provided input: alg=${r}, crv=${n}`)}getPrivateKey({keyUri:e}){return wh(this,void 0,void 0,function*(){let r=yield this._keyStore.get(e);if(!r)throw new Error(`Key not found: ${e}`);return r})}};var R3={};Di(R3,{checkRequiredProperty:()=>CYe,checkValidProperty:()=>jYe,getJoseSignatureAlgorithmFromPublicKey:()=>NYe,isWebCryptoSupported:()=>qYe,randomBytes:()=>$Ye,randomUuid:()=>LYe});E();function CYe(t){if(!t||t.property===void 0||t.inObject===void 0)throw new TypeError("One or more required parameters missing: 'property, properties'");let{property:e,inObject:r}=t;if(!(e in r))throw new TypeError(`Required parameter missing: '${e}'`)}function jYe(t){if(!t||t.property===void 0||t.allowedProperties===void 0)throw new TypeError("One or more required parameters missing: 'property, allowedProperties'");let{property:e,allowedProperties:r}=t;if(Array.isArray(r)&&!r.includes(e)||r instanceof Set&&!r.has(e)||r instanceof Map&&!r.has(e)){let n=Array.from(r instanceof Map?r.keys():r).join(", ");throw new TypeError(`Out of range: '${e}'. Must be one of '${n}'`)}}function NYe(t){let e={Ed25519:"EdDSA","P-256":"ES256","P-384":"ES384","P-521":"ES512",secp256k1:"ES256K"};if(t.alg&&Object.values(e).includes(t.alg))return t.alg;if(t.crv&&Object.keys(e).includes(t.crv))return e[t.crv];throw new Error(`Unable to determine algorithm based on provided input: alg=${t.alg}, crv=${t.crv}. Supported 'alg' values: ${Object.values(e).join(", ")}. Supported 'crv' values: ${Object.keys(e).join(", ")}.`)}function qYe(){return!!(globalThis.crypto&&globalThis.crypto.subtle)}function $Ye(t){return C0(t)}function LYe(){return Cg.randomUUID()}E();E();E();E();var UYe=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;E();var _h=t=>new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4));function mme(t){return t instanceof Uint8Array||t!=null&&typeof t=="object"&&t.constructor.name==="Uint8Array"}var yme=t=>new DataView(t.buffer,t.byteOffset,t.byteLength),FYe=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!FYe)throw new Error("Non little-endian hardware is not supported");function qP(t){if(typeof t!="string")throw new Error(`utf8ToBytes expected string, got ${typeof t}`);return new Uint8Array(new TextEncoder().encode(t))}function $P(t){if(typeof t=="string")t=qP(t);else if(mme(t))t=t.slice();else throw new Error(`expected Uint8Array, got ${typeof t}`);return t}var zYe=t=>Object.prototype.toString.call(t)==="[object Object]"&&t.constructor===Object;function gme(t,e){if(e!==void 0&&(typeof e!="object"||!zYe(e)))throw new Error("options must be object or undefined");return Object.assign(t,e)}function lg(t,e){if(!mme(t))throw new Error("Uint8Array expected");if(typeof e=="number"&&t.length!==e)throw new Error(`Uint8Array length ${e} expected`)}function vme(t,e){if(t.length!==e.length)return!1;let r=0;for(let n=0;n<t.length;n++)r|=t[n]^e[n];return r===0}var k$=(t,e)=>(Object.assign(e,t),e);function O$(t,e,r,n){if(typeof t.setBigUint64=="function")return t.setBigUint64(e,r,n);let i=BigInt(32),o=BigInt(4294967295),s=Number(r>>i&o),a=Number(r&o),d=n?4:0,m=n?0:4;t.setUint32(e+d,s,n),t.setUint32(e+m,a,n)}E();function I3(t){if(!Number.isSafeInteger(t)||t<0)throw new Error(`wrong positive integer: ${t}`)}function B$(t){if(typeof t!="boolean")throw new Error(`boolean expected, not ${t}`)}function KYe(t){return t!=null&&typeof t=="object"&&(t instanceof Uint8Array||t.constructor.name==="Uint8Array")}function Fw(t,...e){if(!KYe(t))throw new Error("Uint8Array expected");if(e.length>0&&!e.includes(t.length))throw new Error(`Uint8Array expected of length ${e}, not of length=${t.length}`)}function D$(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}function bme(t,e){Fw(t);let r=e.outputLen;if(t.length<r)throw new Error(`digestInto() expects output buffer of length at least ${r}`)}E();E();E();E();E();E();E();E();var m0=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(p){try{m(n.next(p))}catch(w){s(w)}}function d(p){try{m(n.throw(p))}catch(w){s(w)}}function m(p){p.done?o(p.value):i(p.value).then(a,d)}m((n=n.apply(t,e||[])).next())})},GYe=function(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(t);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(t,n[i])&&(r[n[i]]=t[n[i]]);return r},yu=class{static bytesToPrivateKey({privateKeyBytes:e}){return m0(this,void 0,void 0,function*(){let r=ug.getPublicKey(e),n={kty:"OKP",crv:"X25519",d:We.uint8Array(e).toBase64Url(),x:We.uint8Array(r).toBase64Url()};return n.kid=yield rr({jwk:n}),n})}static bytesToPublicKey({publicKeyBytes:e}){return m0(this,void 0,void 0,function*(){let r={kty:"OKP",crv:"X25519",x:We.uint8Array(e).toBase64Url()};return r.kid=yield rr({jwk:r}),r})}static computePublicKey({key:e}){return m0(this,void 0,void 0,function*(){let r=yield yu.privateKeyToBytes({privateKey:e}),n=ug.getPublicKey(r),i={kty:"OKP",crv:"X25519",x:We.uint8Array(n).toBase64Url()};return i.kid=yield rr({jwk:i}),i})}static generateKey(){return m0(this,void 0,void 0,function*(){let e=ug.utils.randomPrivateKey(),r=yield yu.bytesToPrivateKey({privateKeyBytes:e});return r.kid=yield rr({jwk:r}),r})}static getPublicKey({key:e}){var r;return m0(this,void 0,void 0,function*(){if(!(Gl(e)&&e.crv==="X25519"))throw new Error("X25519: The provided key is not an X25519 private JWK.");let{d:n}=e,i=GYe(e,["d"]);return(r=i.kid)!==null&&r!==void 0||(i.kid=yield rr({jwk:i})),i})}static privateKeyToBytes({privateKey:e}){return m0(this,void 0,void 0,function*(){if(!Gl(e))throw new Error("X25519: The provided key is not a valid OKP private key.");return We.base64Url(e.d).toUint8Array()})}static publicKeyToBytes({publicKey:e}){return m0(this,void 0,void 0,function*(){if(!Uw(e))throw new Error("X25519: The provided key is not a valid OKP public key.");return We.base64Url(e.x).toUint8Array()})}static sharedSecret({privateKeyA:e,publicKeyB:r}){return m0(this,void 0,void 0,function*(){if("x"in e&&"x"in r&&e.x===r.x)throw new Error("X25519: ECDH shared secret cannot be computed from a single key pair's public and private keys.");let n=yield yu.privateKeyToBytes({privateKey:e}),i=yield yu.publicKeyToBytes({publicKey:r});return ug.getSharedSecret(n,i)})}};E();E();E();var ys=(t,e)=>t[e++]&255|(t[e++]&255)<<8,N$=class{constructor(e){this.blockLen=16,this.outputLen=16,this.buffer=new Uint8Array(16),this.r=new Uint16Array(10),this.h=new Uint16Array(10),this.pad=new Uint16Array(8),this.pos=0,this.finished=!1,e=$P(e),lg(e,32);let r=ys(e,0),n=ys(e,2),i=ys(e,4),o=ys(e,6),s=ys(e,8),a=ys(e,10),d=ys(e,12),m=ys(e,14);this.r[0]=r&8191,this.r[1]=(r>>>13|n<<3)&8191,this.r[2]=(n>>>10|i<<6)&7939,this.r[3]=(i>>>7|o<<9)&8191,this.r[4]=(o>>>4|s<<12)&255,this.r[5]=s>>>1&8190,this.r[6]=(s>>>14|a<<2)&8191,this.r[7]=(a>>>11|d<<5)&8065,this.r[8]=(d>>>8|m<<8)&8191,this.r[9]=m>>>5&127;for(let p=0;p<8;p++)this.pad[p]=ys(e,16+2*p)}process(e,r,n=!1){let i=n?0:2048,{h:o,r:s}=this,a=s[0],d=s[1],m=s[2],p=s[3],w=s[4],P=s[5],S=s[6],M=s[7],A=s[8],B=s[9],I=ys(e,r+0),C=ys(e,r+2),k=ys(e,r+4),q=ys(e,r+6),L=ys(e,r+8),U=ys(e,r+10),F=ys(e,r+12),N=ys(e,r+14),G=o[0]+(I&8191),x=o[1]+((I>>>13|C<<3)&8191),c=o[2]+((C>>>10|k<<6)&8191),u=o[3]+((k>>>7|q<<9)&8191),y=o[4]+((q>>>4|L<<12)&8191),l=o[5]+(L>>>1&8191),h=o[6]+((L>>>14|U<<2)&8191),b=o[7]+((U>>>11|F<<5)&8191),_=o[8]+((F>>>8|N<<8)&8191),g=o[9]+(N>>>5|i),f=0,v=f+G*a+x*(5*B)+c*(5*A)+u*(5*M)+y*(5*S);f=v>>>13,v&=8191,v+=l*(5*P)+h*(5*w)+b*(5*p)+_*(5*m)+g*(5*d),f+=v>>>13,v&=8191;let O=f+G*d+x*a+c*(5*B)+u*(5*A)+y*(5*M);f=O>>>13,O&=8191,O+=l*(5*S)+h*(5*P)+b*(5*w)+_*(5*p)+g*(5*m),f+=O>>>13,O&=8191;let T=f+G*m+x*d+c*a+u*(5*B)+y*(5*A);f=T>>>13,T&=8191,T+=l*(5*M)+h*(5*S)+b*(5*P)+_*(5*w)+g*(5*p),f+=T>>>13,T&=8191;let R=f+G*p+x*m+c*d+u*a+y*(5*B);f=R>>>13,R&=8191,R+=l*(5*A)+h*(5*M)+b*(5*S)+_*(5*P)+g*(5*w),f+=R>>>13,R&=8191;let z=f+G*w+x*p+c*m+u*d+y*a;f=z>>>13,z&=8191,z+=l*(5*B)+h*(5*A)+b*(5*M)+_*(5*S)+g*(5*P),f+=z>>>13,z&=8191;let V=f+G*P+x*w+c*p+u*m+y*d;f=V>>>13,V&=8191,V+=l*a+h*(5*B)+b*(5*A)+_*(5*M)+g*(5*S),f+=V>>>13,V&=8191;let W=f+G*S+x*P+c*w+u*p+y*m;f=W>>>13,W&=8191,W+=l*d+h*a+b*(5*B)+_*(5*A)+g*(5*M),f+=W>>>13,W&=8191;let Z=f+G*M+x*S+c*P+u*w+y*p;f=Z>>>13,Z&=8191,Z+=l*m+h*d+b*a+_*(5*B)+g*(5*A),f+=Z>>>13,Z&=8191;let J=f+G*A+x*M+c*S+u*P+y*w;f=J>>>13,J&=8191,J+=l*p+h*m+b*d+_*a+g*(5*B),f+=J>>>13,J&=8191;let X=f+G*B+x*A+c*M+u*S+y*P;f=X>>>13,X&=8191,X+=l*w+h*p+b*m+_*d+g*a,f+=X>>>13,X&=8191,f=(f<<2)+f|0,f=f+v|0,v=f&8191,f=f>>>13,O+=f,o[0]=v,o[1]=O,o[2]=T,o[3]=R,o[4]=z,o[5]=V,o[6]=W,o[7]=Z,o[8]=J,o[9]=X}finalize(){let{h:e,pad:r}=this,n=new Uint16Array(10),i=e[1]>>>13;e[1]&=8191;for(let a=2;a<10;a++)e[a]+=i,i=e[a]>>>13,e[a]&=8191;e[0]+=i*5,i=e[0]>>>13,e[0]&=8191,e[1]+=i,i=e[1]>>>13,e[1]&=8191,e[2]+=i,n[0]=e[0]+5,i=n[0]>>>13,n[0]&=8191;for(let a=1;a<10;a++)n[a]=e[a]+i,i=n[a]>>>13,n[a]&=8191;n[9]-=1<<13;let o=(i^1)-1;for(let a=0;a<10;a++)n[a]&=o;o=~o;for(let a=0;a<10;a++)e[a]=e[a]&o|n[a];e[0]=(e[0]|e[1]<<13)&65535,e[1]=(e[1]>>>3|e[2]<<10)&65535,e[2]=(e[2]>>>6|e[3]<<7)&65535,e[3]=(e[3]>>>9|e[4]<<4)&65535,e[4]=(e[4]>>>12|e[5]<<1|e[6]<<14)&65535,e[5]=(e[6]>>>2|e[7]<<11)&65535,e[6]=(e[7]>>>5|e[8]<<8)&65535,e[7]=(e[8]>>>8|e[9]<<5)&65535;let s=e[0]+r[0];e[0]=s&65535;for(let a=1;a<8;a++)s=(e[a]+r[a]|0)+(s>>>16)|0,e[a]=s&65535}update(e){D$(this);let{buffer:r,blockLen:n}=this;e=$P(e);let i=e.length;for(let o=0;o<i;){let s=Math.min(n-this.pos,i-o);if(s===n){for(;n<=i-o;o+=n)this.process(e,o);continue}r.set(e.subarray(o,o+s),this.pos),this.pos+=s,o+=s,this.pos===n&&(this.process(r,0,!1),this.pos=0)}return this}destroy(){this.h.fill(0),this.r.fill(0),this.buffer.fill(0),this.pad.fill(0)}digestInto(e){D$(this),bme(e,this),this.finished=!0;let{buffer:r,h:n}=this,{pos:i}=this;if(i){for(r[i++]=1;i<16;i++)r[i]=0;this.process(r,0,!0)}this.finalize();let o=0;for(let s=0;s<8;s++)e[o++]=n[s]>>>0,e[o++]=n[s]>>>8;return e}digest(){let{buffer:e,outputLen:r}=this;this.digestInto(e);let n=e.slice(0,r);return this.destroy(),n}};function WYe(t){let e=(n,i)=>t(i).update($P(n)).digest(),r=t(new Uint8Array(32));return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=n=>t(n),e}var wme=WYe(t=>new N$(t));E();var VYe=qP("expand 16-byte k"),HYe=qP("expand 32-byte k"),ZYe=_h(VYe),JYe=_h(HYe);function at(t,e){return t<<e|t>>>32-e}function q$(t){return t.byteOffset%4===0}var LP=64,YYe=16,xme=2**32-1,_me=new Uint32Array;function QYe(t,e,r,n,i,o,s,a){let d=i.length,m=new Uint8Array(LP),p=_h(m),w=q$(i)&&q$(o),P=w?_h(i):_me,S=w?_h(o):_me;for(let M=0;M<d;s++){if(t(e,r,n,p,s,a),s>=xme)throw new Error("arx: counter overflow");let A=Math.min(LP,d-M);if(w&&A===LP){let B=M/4;if(M%4!==0)throw new Error("arx: invalid block position");for(let I=0,C;I<YYe;I++)C=B+I,S[C]=P[C]^p[I];M+=LP;continue}for(let B=0,I;B<A;B++)I=M+B,o[I]=i[I]^m[B];M+=A}}function $$(t,e){let{allowShortKeys:r,extendNonceFn:n,counterLength:i,counterRight:o,rounds:s}=gme({allowShortKeys:!1,counterLength:8,counterRight:!1,rounds:20},e);if(typeof t!="function")throw new Error("core must be a function");return I3(i),I3(s),B$(o),B$(r),(a,d,m,p,w=0)=>{Fw(a),Fw(d),Fw(m);let P=m.length;if(p||(p=new Uint8Array(P)),Fw(p),I3(w),w<0||w>=xme)throw new Error("arx: counter overflow");if(p.length<P)throw new Error(`arx: output (${p.length}) is shorter than data (${P})`);let S=[],M=a.length,A,B;if(M===32)A=a.slice(),S.push(A),B=JYe;else if(M===16&&r)A=new Uint8Array(32),A.set(a),A.set(a,16),B=ZYe,S.push(A);else throw new Error(`arx: invalid 32-byte key, got length=${M}`);q$(d)||(d=d.slice(),S.push(d));let I=_h(A);if(n){if(d.length!==24)throw new Error("arx: extended nonce must be 24 bytes");n(B,I,_h(d.subarray(0,16)),I),d=d.subarray(16)}let C=16-i;if(C!==d.length)throw new Error(`arx: nonce must be ${C} or 16 bytes`);if(C!==12){let q=new Uint8Array(12);q.set(d,o?0:12-d.length),d=q,S.push(d)}let k=_h(d);for(QYe(t,B,I,k,m,p,w,s);S.length>0;)S.pop().fill(0);return p}}function Mme(t,e,r,n,i,o=20){let s=t[0],a=t[1],d=t[2],m=t[3],p=e[0],w=e[1],P=e[2],S=e[3],M=e[4],A=e[5],B=e[6],I=e[7],C=i,k=r[0],q=r[1],L=r[2],U=s,F=a,N=d,G=m,x=p,c=w,u=P,y=S,l=M,h=A,b=B,_=I,g=C,f=k,v=q,O=L;for(let R=0;R<o;R+=2)U=U+x|0,g=at(g^U,16),l=l+g|0,x=at(x^l,12),U=U+x|0,g=at(g^U,8),l=l+g|0,x=at(x^l,7),F=F+c|0,f=at(f^F,16),h=h+f|0,c=at(c^h,12),F=F+c|0,f=at(f^F,8),h=h+f|0,c=at(c^h,7),N=N+u|0,v=at(v^N,16),b=b+v|0,u=at(u^b,12),N=N+u|0,v=at(v^N,8),b=b+v|0,u=at(u^b,7),G=G+y|0,O=at(O^G,16),_=_+O|0,y=at(y^_,12),G=G+y|0,O=at(O^G,8),_=_+O|0,y=at(y^_,7),U=U+c|0,O=at(O^U,16),b=b+O|0,c=at(c^b,12),U=U+c|0,O=at(O^U,8),b=b+O|0,c=at(c^b,7),F=F+u|0,g=at(g^F,16),_=_+g|0,u=at(u^_,12),F=F+u|0,g=at(g^F,8),_=_+g|0,u=at(u^_,7),N=N+y|0,f=at(f^N,16),l=l+f|0,y=at(y^l,12),N=N+y|0,f=at(f^N,8),l=l+f|0,y=at(y^l,7),G=G+x|0,v=at(v^G,16),h=h+v|0,x=at(x^h,12),G=G+x|0,v=at(v^G,8),h=h+v|0,x=at(x^h,7);let T=0;n[T++]=s+U|0,n[T++]=a+F|0,n[T++]=d+N|0,n[T++]=m+G|0,n[T++]=p+x|0,n[T++]=w+c|0,n[T++]=P+u|0,n[T++]=S+y|0,n[T++]=M+l|0,n[T++]=A+h|0,n[T++]=B+b|0,n[T++]=I+_|0,n[T++]=C+g|0,n[T++]=k+f|0,n[T++]=q+v|0,n[T++]=L+O|0}function XYe(t,e,r,n){let i=t[0],o=t[1],s=t[2],a=t[3],d=e[0],m=e[1],p=e[2],w=e[3],P=e[4],S=e[5],M=e[6],A=e[7],B=r[0],I=r[1],C=r[2],k=r[3];for(let L=0;L<20;L+=2)i=i+d|0,B=at(B^i,16),P=P+B|0,d=at(d^P,12),i=i+d|0,B=at(B^i,8),P=P+B|0,d=at(d^P,7),o=o+m|0,I=at(I^o,16),S=S+I|0,m=at(m^S,12),o=o+m|0,I=at(I^o,8),S=S+I|0,m=at(m^S,7),s=s+p|0,C=at(C^s,16),M=M+C|0,p=at(p^M,12),s=s+p|0,C=at(C^s,8),M=M+C|0,p=at(p^M,7),a=a+w|0,k=at(k^a,16),A=A+k|0,w=at(w^A,12),a=a+w|0,k=at(k^a,8),A=A+k|0,w=at(w^A,7),i=i+m|0,k=at(k^i,16),M=M+k|0,m=at(m^M,12),i=i+m|0,k=at(k^i,8),M=M+k|0,m=at(m^M,7),o=o+p|0,B=at(B^o,16),A=A+B|0,p=at(p^A,12),o=o+p|0,B=at(B^o,8),A=A+B|0,p=at(p^A,7),s=s+w|0,I=at(I^s,16),P=P+I|0,w=at(w^P,12),s=s+w|0,I=at(I^s,8),P=P+I|0,w=at(w^P,7),a=a+d|0,C=at(C^a,16),S=S+C|0,d=at(d^S,12),a=a+d|0,C=at(C^a,8),S=S+C|0,d=at(d^S,7);let q=0;n[q++]=i,n[q++]=o,n[q++]=s,n[q++]=a,n[q++]=B,n[q++]=I,n[q++]=C,n[q++]=k}var eQe=$$(Mme,{counterRight:!1,counterLength:4,allowShortKeys:!1}),Pme=$$(Mme,{counterRight:!1,counterLength:8,extendNonceFn:XYe,allowShortKeys:!1});var tQe=new Uint8Array(16),Eme=(t,e)=>{t.update(e);let r=e.length%16;r&&t.update(tQe.subarray(r))},rQe=new Uint8Array(32);function Sme(t,e,r,n,i){let o=t(e,r,rQe),s=wme.create(o);i&&Eme(s,i),Eme(s,n);let a=new Uint8Array(16),d=yme(a);O$(d,0,BigInt(i?i.length:0),!0),O$(d,8,BigInt(n.length),!0),s.update(a);let m=s.digest();return o.fill(0),m}var Ame=t=>(e,r,n)=>(lg(e,32),lg(r),{encrypt:(o,s)=>{let a=o.length,d=a+16;s?lg(s,d):s=new Uint8Array(d),t(e,r,o,s,1);let m=Sme(t,e,r,s.subarray(0,-16),n);return s.set(m,a),s},decrypt:(o,s)=>{let a=o.length,d=a-16;if(a<16)throw new Error(`encrypted data must be at least ${16} bytes`);s?lg(s,d):s=new Uint8Array(d);let m=o.subarray(0,-16),p=o.subarray(-16),w=Sme(t,e,r,m,n);if(!vme(p,w))throw new Error("invalid tag");return t(e,r,m,s,1),s}}),lRt=k$({blockSize:64,nonceLength:12,tagLength:16},Ame(eQe)),nQe=k$({blockSize:64,nonceLength:24,tagLength:16},Ame(Pme));E();var F$={};Di(F$,{extractDidFragment:()=>Na,getServices:()=>oQe,getVerificationMethodByKey:()=>sQe,getVerificationMethodTypes:()=>L$,getVerificationMethods:()=>k3,getVerificationRelationshipsById:()=>U$,isDidService:()=>Tme,isDidVerificationMethod:()=>UP,isDwnDidService:()=>aQe,keyBytesToMultibaseId:()=>FP,multibaseIdToKeyBytes:()=>zP});E();var iQe=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(p){try{m(n.next(p))}catch(w){s(w)}}function d(p){try{m(n.throw(p))}catch(w){s(w)}}function m(p){p.done?o(p.value):i(p.value).then(a,d)}m((n=n.apply(t,e||[])).next())})};function Na(t){if(typeof t=="string"&&t.length!==0)return t.split("#").pop()}function oQe({didDocument:t,id:e,type:r}){var n,i;return(i=(n=t?.service)===null||n===void 0?void 0:n.filter(o=>!(e&&o.id!==e||r&&o.type!==r)))!==null&&i!==void 0?i:[]}function sQe(t){return iQe(this,arguments,void 0,function*({didDocument:e,publicKeyJwk:r,publicKeyMultibase:n}){let i=k3({didDocument:e});for(let o of i)if(r&&o.publicKeyJwk){if((yield rr({jwk:r}))===(yield rr({jwk:o.publicKeyJwk})))return o}else if(n&&o.publicKeyMultibase&&n===o.publicKeyMultibase)return o;return null})}function k3({didDocument:t}){var e,r;if(!t)throw new TypeError("Required parameter missing: 'didDocument'");let n=[];return n.push(...(r=(e=t.verificationMethod)===null||e===void 0?void 0:e.filter(UP))!==null&&r!==void 0?r:[]),Object.keys(Ny).forEach(i=>{var o,s;n.push(...(s=(o=t[i])===null||o===void 0?void 0:o.filter(UP))!==null&&s!==void 0?s:[])}),n}function L$({didDocument:t}){let r=k3({didDocument:t}).map(n=>n.type);return[...new Set(r)]}function U$({didDocument:t,methodId:e}){let r=[];return Object.keys(Ny).forEach(n=>{if(Array.isArray(t[n])){let i=t[n],o=Na(e);i.some(a=>{let d=Na(a)===o,m=UP(a)&&Na(a.id)===o;return d||m})&&r.push(n)}}),r}function Tme(t){return!t||typeof t!="object"||t===null?!1:"id"in t&&"type"in t&&"serviceEndpoint"in t}function aQe(t){if(!Tme(t)||t.type!=="DecentralizedWebNode"||!("enc"in t&&"sig"in t))return!1;let e=r=>typeof r=="string"||Array.isArray(r)&&r.every(n=>typeof n=="string");return e(t.enc)&&e(t.sig)}function UP(t){return!(!t||typeof t!="object"||t===null||!("id"in t&&"type"in t&&"controller"in t)||typeof t.id!="string"||typeof t.type!="string"||typeof t.controller!="string")}function FP({keyBytes:t,multicodecCode:e,multicodecName:r}){let n=ii.addPrefix({code:e,data:t,name:r}),i=We.uint8Array(n).toBase58Btc();return We.base58Btc(i).toMultibase()}function zP({multibaseKeyId:t}){try{let e=We.multibase(t).toBase58Btc(),r=We.base58Btc(e).toUint8Array(),{code:n,data:i,name:o}=ii.removePrefix({prefixedData:r});return{keyBytes:i,multicodecCode:n,multicodecName:o}}catch{throw new ft(ut.InvalidDid,`Invalid multibase identifier: ${t}`)}}var O3=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(p){try{m(n.next(p))}catch(w){s(w)}}function d(p){try{m(n.throw(p))}catch(w){s(w)}}function m(p){p.done?o(p.value):i(p.value).then(a,d)}m((n=n.apply(t,e||[])).next())})},Gs=class{constructor({uri:e,document:r,metadata:n,keyManager:i}){this.uri=e,this.document=r,this.metadata=n,this.keyManager=i}export(){return O3(this,void 0,void 0,function*(){if(!(Array.isArray(this.document.verificationMethod)&&this.document.verificationMethod.length>0))throw new Error(`DID document for '${this.uri}' is missing verification methods`);let e={uri:this.uri,document:this.document,metadata:this.metadata};if("exportKey"in this.keyManager&&typeof this.keyManager.exportKey=="function"){let r=[];for(let n of this.document.verificationMethod){if(!n.publicKeyJwk)throw new Error(`Verification method '${n.id}' does not contain a public key in JWK format`);let i=yield this.keyManager.getKeyUri({key:n.publicKeyJwk}),o=yield this.keyManager.exportKey({keyUri:i});r.push(Object.assign({},o))}e.privateKeys=r}return e})}getSigner(e){return O3(this,void 0,void 0,function*(){var r;let n=(r=this.document.verificationMethod)===null||r===void 0?void 0:r.find(d=>{var m,p;return Na(d.id)===((m=Na(e?.methodId))!==null&&m!==void 0?m:Na((p=this.document.assertionMethod)===null||p===void 0?void 0:p[0]))});if(!(n&&n.publicKeyJwk))throw new ft(ut.InternalError,"A verification method intended for signing could not be determined from the DID Document");let i=yield this.keyManager.getKeyUri({key:n.publicKeyJwk}),o=yield this.keyManager.getPublicKey({keyUri:i}),s=this.keyManager;return{algorithm:R3.getJoseSignatureAlgorithmFromPublicKey(o),keyId:n.id,sign(d){return O3(this,arguments,void 0,function*({data:m}){return yield s.sign({data:m,keyUri:i})})},verify(d){return O3(this,arguments,void 0,function*({data:m,signature:p}){return yield s.verify({data:m,key:o,signature:p})})}}})}static import(e){return O3(this,arguments,void 0,function*({portableDid:r,keyManager:n=new Ks}){var i;let o=k3({didDocument:r.document});if(o.length===0)throw new ft(ut.InvalidDidDocument,"At least one verification method is required but 0 were given");for(let a of(i=r.privateKeys)!==null&&i!==void 0?i:[])yield n.importKey({key:a});for(let a of o){if(!a.publicKeyJwk)throw new Error(`Verification method '${a.id}' does not contain a public key in JWK format`);let d=yield n.getKeyUri({key:a.publicKeyJwk});yield n.getPublicKey({keyUri:d})}return new Gs({uri:r.uri,document:r.document,metadata:r.metadata,keyManager:n})})}};E();E();E();E();E();var z$="0123456789abcdef",Ime=[],Rme=[];for(let t=0;t<256;t++)Ime[t]=z$[t>>4&15]+z$[t&15],t<16&&(t<10?Rme[48+t]=t:Rme[97-10+t]=t);var K$=t=>{let e=t.length,r="",n=0;for(;n<e;)r+=Ime[t[n++]];return r};var kme=(t,e=0)=>{let r=t.length||0;if(!e){let s=r;for(;s--;)e+=t[s].length}let n=new Uint8Array(e),i=e,o=r;for(;o--;)i-=t[o].length,n.set(t[o],i);return n};E();var Ome="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",cQe=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(B3=0;B3<Ome.length;B3++)cQe[Ome.charCodeAt(B3)]=B3;var B3;var fQe=new TextDecoder,G$=(t,e)=>e?new TextDecoder(e).decode(t):fQe.decode(t),uQe=new TextEncoder,pf=t=>uQe.encode(t);var Bme=typeof window<"u"?window:self,Dme=Bme.crypto||Bme.msCrypto||{},yIt=Dme.subtle||Dme.webkitSubtle;E();function zw(t){let e=t<0?1:0;return t=Math.abs(Number(t||1)),Math.floor(Math.log10(t))+1+e}function KP(t){return ArrayBuffer.isView(t)?"arraybufferview":Array.isArray(t)?"array":t instanceof Number?"number":t instanceof Boolean?"boolean":t instanceof Set?"set":t instanceof Map?"map":t instanceof String?"string":t instanceof ArrayBuffer?"arraybuffer":typeof t}function nn(t,e,r){let n=[],i=null;return nn._encode(n,t),i=kme(n),nn.bytes=i.length,ArrayBuffer.isView(e)?(e.set(i,r),e):i}nn.bytes=-1;nn._floatConversionDetected=!1;nn._encode=function(t,e){if(e!=null)switch(KP(e)){case"object":nn.dict(t,e);break;case"map":nn.dictMap(t,e);break;case"array":nn.list(t,e);break;case"set":nn.listSet(t,e);break;case"string":nn.string(t,e);break;case"number":nn.number(t,e);break;case"boolean":nn.number(t,e);break;case"arraybufferview":nn.buffer(t,new Uint8Array(e.buffer,e.byteOffset,e.byteLength));break;case"arraybuffer":nn.buffer(t,new Uint8Array(e));break}};var GP=new Uint8Array([101]),Cme=new Uint8Array([100]),jme=new Uint8Array([108]);nn.buffer=function(t,e){t.push(pf(e.length+":"),e)};nn.string=function(t,e){t.push(pf(pf(e).byteLength+":"+e))};nn.number=function(t,e){if(Number.isInteger(e))return t.push(pf("i"+BigInt(e)+"e"));let r=2147483648,n=e/r<<0,i=e%r<<0,o=n*r+i;t.push(pf("i"+o+"e")),o!==e&&!nn._floatConversionDetected&&(nn._floatConversionDetected=!0,console.warn('WARNING: Possible data corruption detected with value "'+e+'":','Bencoding only defines support for integers, value was converted to "'+o+'"'),console.trace())};nn.dict=function(t,e){t.push(Cme);let r=0,n,i=Object.keys(e).sort(),o=i.length;for(;r<o;r++)n=i[r],e[n]!=null&&(nn.string(t,n),nn._encode(t,e[n]));t.push(GP)};nn.dictMap=function(t,e){t.push(Cme);let r=Array.from(e.keys()).sort();for(let n of r)e.get(n)!=null&&(ArrayBuffer.isView(n)?nn._encode(t,n):nn.string(t,String(n)),nn._encode(t,e.get(n)));t.push(GP)};nn.list=function(t,e){let r=0,n=e.length;for(t.push(jme);r<n;r++)e[r]!=null&&nn._encode(t,e[r]);t.push(GP)};nn.listSet=function(t,e){t.push(jme);for(let r of e)r!=null&&nn._encode(t,r);t.push(GP)};var Nme=nn;E();var lQe=105,dQe=58,hQe=100,pQe=108,W$=101;function qme(t,e,r){let n=0,i=1;for(let o=e;o<r;o++){let s=t[o];if(s<58&&s>=48){n=n*10+(s-48);continue}if(!(o===e&&s===43)){if(o===e&&s===45){i=-1;continue}if(s===46)break;throw new Error("not a number: buffer["+o+"] = "+s)}}return n*i}function $t(t,e,r,n){return t==null||t.length===0?null:(typeof e!="number"&&n==null&&(n=e,e=void 0),typeof r!="number"&&n==null&&(n=r,r=void 0),$t.position=0,$t.encoding=n||null,$t.data=ArrayBuffer.isView(t)?new Uint8Array(t.slice(e,r)):pf(t),$t.bytes=$t.data.length,$t.next())}$t.bytes=0;$t.position=0;$t.data=null;$t.encoding=null;$t.next=function(){switch($t.data[$t.position]){case hQe:return $t.dictionary();case pQe:return $t.list();case lQe:return $t.integer();default:return $t.buffer()}};$t.find=function(t){let e=$t.position,r=$t.data.length,n=$t.data;for(;e<r;){if(n[e]===t)return e;e++}throw new Error('Invalid data: Missing delimiter "'+String.fromCharCode(t)+'" [0x'+t.toString(16)+"]")};$t.dictionary=function(){$t.position++;let t={};for(;$t.data[$t.position]!==W$;){let e=$t.buffer(),r=G$(e);r.includes("\uFFFD")&&(r=K$(e)),t[r]=$t.next()}return $t.position++,t};$t.list=function(){$t.position++;let t=[];for(;$t.data[$t.position]!==W$;)t.push($t.next());return $t.position++,t};$t.integer=function(){let t=$t.find(W$),e=qme($t.data,$t.position+1,t);return $t.position+=t+1-$t.position,e};$t.buffer=function(){let t=$t.find(dQe),e=qme($t.data,$t.position,t),r=++t+e;return $t.position=r,$t.encoding?G$($t.data.slice(t,r)):$t.data.slice(t,r)};var $me=$t;E();function mQe(t){let e=2;for(let r of t)e+=WP(r);return e}function yQe(t){let e=2;for(let[r,n]of t){let i=pf(r).byteLength;e+=zw(i)+1+i,e+=WP(n)}return e}function gQe(t){let e=2,r=Object.keys(t);for(let n=0;n<r.length;n++){let i=pf(r[n]).byteLength;e+=zw(i)+1+i,e+=WP(t[r[n]])}return e}function vQe(t){let e=pf(t).byteLength;return zw(e)+1+e}function bQe(t){let e=t.byteLength-t.byteOffset;return zw(e)+1+e}function WP(t){if(t==null)return 0;let r=KP(t);switch(r){case"arraybufferview":return bQe(t);case"string":return vQe(t);case"array":case"set":return mQe(t);case"number":return 1+zw(Math.floor(t))+1;case"bigint":return 1+t.toString().length+1;case"object":return gQe(t);case"map":return yQe(t);default:throw new TypeError(`Unsupported value of type "${r}"`)}}var V$=WP;var wQe=V$,H$={encode:Nme,decode:$me,byteLength:V$,encodingLength:wQe};E();E();var _Qe=/^(\d{1,3}\.){3,3}\d{1,3}$/;var xQe=/^(::)?(((\d{1,3}\.){3}(\d{1,3}){1})?([0-9a-f]){0,4}:{0,2}){1,8}(::)?$/i;var gu={name:"v4",size:4,isFormat:t=>_Qe.test(t),encode(t,e,r){r=~~r,e=e||new Uint8Array(r+4);let n=t.length,i=0;for(let o=0;o<n;){let s=t.charCodeAt(o++);s===46?(e[r++]=i,i=0):i=i*10+(s-48)}return e[r]=i,e},decode(t,e){return e=~~e,`${t[e++]}.${t[e++]}.${t[e++]}.${t[e]}`}},xh={name:"v6",size:16,isFormat:t=>t.length>0&&xQe.test(t),encode(t,e,r){r=~~r;let n=r+16,i=-1,o=0,s=0,a=!0,d=!1;e=e||new Uint8Array(r+16);for(let m=0;m<t.length;m++){let p=t.charCodeAt(m);p===58?(a?i!==-1?(r<n&&(e[r]=0),r<n-1&&(e[r+1]=0),r+=2):r<n&&(i=r):(d===!0?(r<n&&(e[r]=s),r++):(r<n&&(e[r]=o>>8),r<n-1&&(e[r+1]=o&255),r+=2),o=0,s=0),a=!0,d=!1):p===46?(r<n&&(e[r]=s),r++,s=0,o=0,a=!1,d=!0):(a=!1,p>=97?p-=87:p>=65?p-=55:(p-=48,s=s*10+p),o=(o<<4)+p)}if(a===!1)d===!0?(r<n&&(e[r]=s),r++):(r<n&&(e[r]=o>>8),r<n-1&&(e[r+1]=o&255),r+=2);else if(i===0)r<n&&(e[r]=0),r<n-1&&(e[r+1]=0),r+=2;else if(i!==-1){r+=2;for(let m=Math.min(r-1,n-1);m>=i+2;m--)e[m]=e[m-2];e[i]=0,e[i+1]=0,i=r}if(i!==r&&i!==-1)for(r>n-2&&(r=n-2);n>i;)e[--n]=r<n&&r>i?e[--r]:0;else for(;r<n;)e[r++]=0;return e},decode(t,e){e=~~e;let r="";for(let n=0;n<16;n+=2)n!==0&&(r+=":"),r+=(t[e+n]<<8|t[e+n+1]).toString(16);return r.replace(/(^|:)0(:0)*:0(:|$)/,"$1::$3").replace(/:{3,4}/,"::")}};function Lme(t){if(gu.isFormat(t))return gu.size;if(xh.isFormat(t))return xh.size;throw Error(`Invalid ip address: ${t}`)}function Ume(t){return Lme(t)===gu.size?1:2}function Fme(t,e,r){r=~~r;let n=Lme(t);return typeof e=="function"&&(e=e(r+n)),n===gu.size?gu.encode(t,e,r):xh.encode(t,e,r)}function zme(t,e,r){if(e=~~e,r=r||t.length-e,r===gu.size)return gu.decode(t,e,r);if(r===xh.size)return xh.decode(t,e,r);throw Error(`Invalid buffer size needs to be ${gu.size} for v4 or ${xh.size} for v6.`)}E();function D3(t){switch(t){case 1:return"A";case 10:return"NULL";case 28:return"AAAA";case 18:return"AFSDB";case 42:return"APL";case 257:return"CAA";case 60:return"CDNSKEY";case 59:return"CDS";case 37:return"CERT";case 5:return"CNAME";case 49:return"DHCID";case 32769:return"DLV";case 39:return"DNAME";case 48:return"DNSKEY";case 43:return"DS";case 55:return"HIP";case 13:return"HINFO";case 45:return"IPSECKEY";case 25:return"KEY";case 36:return"KX";case 29:return"LOC";case 15:return"MX";case 35:return"NAPTR";case 2:return"NS";case 47:return"NSEC";case 50:return"NSEC3";case 51:return"NSEC3PARAM";case 12:return"PTR";case 46:return"RRSIG";case 17:return"RP";case 24:return"SIG";case 6:return"SOA";case 99:return"SPF";case 33:return"SRV";case 44:return"SSHFP";case 32768:return"TA";case 249:return"TKEY";case 52:return"TLSA";case 250:return"TSIG";case 16:return"TXT";case 252:return"AXFR";case 251:return"IXFR";case 41:return"OPT";case 255:return"ANY"}return"UNKNOWN_"+t}function Kw(t){switch(t.toUpperCase()){case"A":return 1;case"NULL":return 10;case"AAAA":return 28;case"AFSDB":return 18;case"APL":return 42;case"CAA":return 257;case"CDNSKEY":return 60;case"CDS":return 59;case"CERT":return 37;case"CNAME":return 5;case"DHCID":return 49;case"DLV":return 32769;case"DNAME":return 39;case"DNSKEY":return 48;case"DS":return 43;case"HIP":return 55;case"HINFO":return 13;case"IPSECKEY":return 45;case"KEY":return 25;case"KX":return 36;case"LOC":return 29;case"MX":return 15;case"NAPTR":return 35;case"NS":return 2;case"NSEC":return 47;case"NSEC3":return 50;case"NSEC3PARAM":return 51;case"PTR":return 12;case"RRSIG":return 46;case"RP":return 17;case"SIG":return 24;case"SOA":return 6;case"SPF":return 99;case"SRV":return 33;case"SSHFP":return 44;case"TA":return 32768;case"TKEY":return 249;case"TLSA":return 52;case"TSIG":return 250;case"TXT":return 16;case"AXFR":return 252;case"IXFR":return 251;case"OPT":return 41;case"ANY":return 255;case"*":return 255}return t.toUpperCase().startsWith("UNKNOWN_")?parseInt(t.slice(8)):0}E();function Kme(t){switch(t){case 0:return"NOERROR";case 1:return"FORMERR";case 2:return"SERVFAIL";case 3:return"NXDOMAIN";case 4:return"NOTIMP";case 5:return"REFUSED";case 6:return"YXDOMAIN";case 7:return"YXRRSET";case 8:return"NXRRSET";case 9:return"NOTAUTH";case 10:return"NOTZONE";case 11:return"RCODE_11";case 12:return"RCODE_12";case 13:return"RCODE_13";case 14:return"RCODE_14";case 15:return"RCODE_15"}return"RCODE_"+t}E();function Gme(t){switch(t){case 0:return"QUERY";case 1:return"IQUERY";case 2:return"STATUS";case 3:return"OPCODE_3";case 4:return"NOTIFY";case 5:return"UPDATE";case 6:return"OPCODE_6";case 7:return"OPCODE_7";case 8:return"OPCODE_8";case 9:return"OPCODE_9";case 10:return"OPCODE_10";case 11:return"OPCODE_11";case 12:return"OPCODE_12";case 13:return"OPCODE_13";case 14:return"OPCODE_14";case 15:return"OPCODE_15"}return"OPCODE_"+t}E();function Z$(t){switch(t){case 1:return"IN";case 2:return"CS";case 3:return"CH";case 4:return"HS";case 255:return"ANY"}return"UNKNOWN_"+t}function J$(t){switch(t.toUpperCase()){case"IN":return 1;case"CS":return 2;case"CH":return 3;case"HS":return 4;case"ANY":return 255}return 0}E();function Wme(t){switch(t){case 1:return"LLQ";case 2:return"UL";case 3:return"NSID";case 5:return"DAU";case 6:return"DHU";case 7:return"N3U";case 8:return"CLIENT_SUBNET";case 9:return"EXPIRE";case 10:return"COOKIE";case 11:return"TCP_KEEPALIVE";case 12:return"PADDING";case 13:return"CHAIN";case 14:return"KEY_TAG";case 26946:return"DEVICEID"}return t<0?null:`OPTION_${t}`}function Y$(t){if(typeof t=="number")return t;if(!t)return-1;switch(t.toUpperCase()){case"OPTION_0":return 0;case"LLQ":return 1;case"UL":return 2;case"NSID":return 3;case"OPTION_4":return 4;case"DAU":return 5;case"DHU":return 6;case"N3U":return 7;case"CLIENT_SUBNET":return 8;case"EXPIRE":return 9;case"COOKIE":return 10;case"TCP_KEEPALIVE":return 11;case"PADDING":return 12;case"CHAIN":return 13;case"KEY_TAG":return 14;case"DEVICEID":return 26946;case"OPTION_65535":return 65535}let e=t.match(/_(\d+)$/);return e?parseInt(e[1],10):-1}E();E();function Q$(t){let e=0,r=t.length;for(let n=0;n<r;n+=1){let i=t.charCodeAt(n);if(i<=127)e+=1;else if(i<=2047)e+=2;else if((i&63488)!==55296)e+=3;else{let o=n+1;o===r||i>=56320||(t.charCodeAt(o)&64512)!==56320?e+=3:(n=o,e+=4)}}return e}function Gw(t,e,r){let n=t.length;r==null&&(r=0),e===void 0&&(e=new Uint8Array(Q$(t)+r));let i=r;for(let o=0;o<n;o+=1){let s=t.charCodeAt(o);if(s<=127)e[i++]=s;else if(s<=2047)e[i++]=192|(s&1984)>>6,e[i++]=128|s&63;else if((s&63488)!==55296)e[i++]=224|(s&61440)>>12,e[i++]=128|(s&4032)>>6,e[i++]=128|s&63;else{let a=o+1;if(a===n||s>=56320)e[i++]=239,e[i++]=191,e[i++]=189;else{let d=t.charCodeAt(a);(d&64512)!==56320?(e[i++]=239,e[i++]=191,e[i++]=189):(o=a,s=65536|(s&1023)<<10|d&1023,e[i++]=240|(s&1835008)>>18,e[i++]=128|(s&258048)>>12,e[i++]=128|(s&4032)>>6,e[i++]=128|s&63)}}}return Gw.bytes=i-r,e}Gw.bytes=0;function Ww(t,e,r){let n="";e==null&&(e=0),r==null&&(r=t.length);for(let i=e;i<r;){let o=t[i++],s;if(o<=128)s=o;else if(o>191&&o<224)s=(o&31)<<6|t[i++]&63;else if(o>239&&o<365){s=((o&7)<<18|(t[i++]&63)<<12|(t[i++]&63)<<6|t[i++]&63)-65536;let a=55296|s>>10&1023;n+=String.fromCharCode(a),s=56320|s&1023}else s=(o&15)<<12|(t[i++]&63)<<6|t[i++]&63;n+=String.fromCharCode(s)}return Ww.bytes=r-e,n}Ww.bytes=0;var y0=t=>t instanceof Uint8Array;function Eh(t){return typeof t=="string"?Q$(t):t.byteLength}function VP(t){return t instanceof Uint8Array?t:Array.isArray(t)?new Uint8Array(t):Gw(t)}function HP(t,e,r){if(typeof e!="string")throw new Error("unknown input type");return Gw(e,t,r),Gw.bytes}var C3={},Vme=new Array(255);for(let t=0;t<=15;t+=1){let e=t.toString(16),r=e.toUpperCase();for(let n=0;n<=15;n+=1){let i=n.toString(16),o=i.toUpperCase(),s=t<<4|n,a=`${e}${i}`;Vme[s]=a,C3[a]=s,C3[`${r}${i}`]=s,C3[`${e}${o}`]=s,C3[`${r}${o}`]=s}}function Hme(t,e,r){let n="";for(let i=e;i<r;){let o=t[i++];n+=Vme[o]}return n}function X$(t){return t.length>>>1}function Zme(t,e,r,n){let i=0;for(;r<n;){let o=e.substr(i,2),s=C3[o];if(s===void 0)return;t[r++]=s,i+=2}return t}var IQe=Math.pow(2,24),kQe=Math.pow(2,16),OQe=Math.pow(2,8),Wl=(t,e)=>t[e]*IQe+t[e+1]*kQe+t[e+2]*OQe+t[e+3],ur=(t,e)=>t[e]<<8|t[e+1],Vl=(t,e,r)=>(e=+e,t[r+3]=e,e=e>>>8,t[r+2]=e,e=e>>>8,t[r+1]=e,e=e>>>8,t[r]=e,r+4),Mt=(t,e,r)=>(t[r]=e>>8,t[r+1]=e&255,r+2);function qa(t,e,r,n,i){return r<0&&(n-=r,r=0),n<0&&(n=0),i<0?new Uint8Array(0):r>=e.length||n>=i?0:BQe(t,e,r,n,i)}function BQe(t,e,r,n,i){i-n>e.length-r&&(i=n+e.length-r);let o=i-n,s=t.length-n;return o>s&&(o=s),(n!==0||i<t.length)&&(t=new Uint8Array(t.buffer,t.byteOffset+n,o)),e.set(t,r),o}var CQe=0,Jme=1<<15,tL=1<<15,jQe=~tL,Qme=1<<15,NQe=~Qme;function Dn({bytes:t=0,encode:e,decode:r,encodingLength:n}){return e.bytes=t,r.bytes=t,{encode:e,decode:r,encodingLength:n||(()=>t)}}var dt=Dn({encode(t,e,r){e||(e=new Uint8Array(dt.encodingLength(t))),r||(r=0);let n=r,i=t.replace(/^\.|\.$/gm,"");if(i.length){let o=i.split(".");for(let s=0;s<o.length;s++){let a=HP(e,o[s],r+1);e[r]=a,r+=a+1}}return e[r++]=0,dt.encode.bytes=r-n,e},decode(t,e){e||(e=0);let r=[],n=e,i=0,o=0,s=!1;for(;;){if(e>=t.length)throw new Error("Cannot decode name (buffer overflow)");let a=t[e++];if(o+=s?0:1,a===0)break;if(a&192)if((a&192)===192){if(e+1>t.length)throw new Error("Cannot decode name (buffer overflow)");let d=ur(t,e-1)-49152;if(d>=n)throw new Error("Cannot decode name (bad pointer)");e=d,n=d,o+=s?0:1,s=!0}else throw new Error("Cannot decode name (bad label)");else{if(e+a>t.length)throw new Error("Cannot decode name (buffer overflow)");if(i+=a+1,i>254)throw new Error("Cannot decode name (name too long)");r.push(Ww(t,e,e+a)),e+=a,o+=s?0:a}}return dt.decode.bytes=o,r.length===0?".":r.join(".")},encodingLength(t){return t==="."||t===".."?1:Eh(t.replace(/^\.|\.$/gm,""))+2}}),bo=Dn({encode(t,e,r){e||(e=new Uint8Array(bo.encodingLength(t))),r||(r=0);let n=HP(e,t,r+1);return e[r]=n,bo.encode.bytes=n+1,e},decode(t,e){e||(e=0);let r=t[e],n=Ww(t,e+1,e+1+r);return bo.decode.bytes=r+1,n},encodingLength(t){return Eh(t)+1}}),Vw=Dn({bytes:12,encode(t,e,r){e||(e=new Uint8Array(Vw.encodingLength(t))),r||(r=0);let n=(t.flags||0)&32767,i=t.type==="response"?Jme:CQe;return Mt(e,t.id||0,r),Mt(e,n|i,r+2),Mt(e,t.questions.length,r+4),Mt(e,t.answers.length,r+6),Mt(e,t.authorities.length,r+8),Mt(e,t.additionals.length,r+10),e},decode(t,e){if(e||(e=0),t.length<12)throw new Error("Header must be 12 bytes");let r=ur(t,e+2);return{id:ur(t,e),type:r&Jme?"response":"query",flags:r&32767,flag_qr:(r>>15&1)===1,opcode:Gme(r>>11&15),flag_aa:(r>>10&1)===1,flag_tc:(r>>9&1)===1,flag_rd:(r>>8&1)===1,flag_ra:(r>>7&1)===1,flag_z:(r>>6&1)===1,flag_ad:(r>>5&1)===1,flag_cd:(r>>4&1)===1,rcode:Kme(r&15),questions:new Array(ur(t,e+4)),answers:new Array(ur(t,e+6)),authorities:new Array(ur(t,e+8)),additionals:new Array(ur(t,e+10))}},encodingLength(){return 12}}),JP=Dn({encode(t,e,r){e||(e=new Uint8Array(JP.encodingLength(t))),r||(r=0);let n=t.length;return Mt(e,n,r),qa(t,e,r+2,0,n),JP.encode.bytes=n+2,e},decode(t,e){e||(e=0);let r=ur(t,e),n=t.slice(e+2,e+2+r);return JP.decode.bytes=r+2,n},encodingLength(t){return t.length+2}}),YP=Dn({encode(t,e,r){return e||(e=new Uint8Array(YP.encodingLength(t))),r||(r=0),dt.encode(t,e,r+2),Mt(e,dt.encode.bytes,r),YP.encode.bytes=dt.encode.bytes+2,e},decode(t,e){e||(e=0);let r=ur(t,e),n=dt.decode(t,e+2);return YP.decode.bytes=r+2,n},encodingLength(t){return dt.encodingLength(t)+2}}),QP=Dn({encode(t,e,r){e||(e=new Uint8Array(QP.encodingLength(t))),r||(r=0);let n=r;return r+=2,dt.encode(t.mname,e,r),r+=dt.encode.bytes,dt.encode(t.rname,e,r),r+=dt.encode.bytes,Vl(e,t.serial||0,r),r+=4,Vl(e,t.refresh||0,r),r+=4,Vl(e,t.retry||0,r),r+=4,Vl(e,t.expire||0,r),r+=4,Vl(e,t.minimum||0,r),r+=4,Mt(e,r-n-2,n),QP.encode.bytes=r-n,e},decode(t,e){e||(e=0);let r=e,n={};return e+=2,n.mname=dt.decode(t,e),e+=dt.decode.bytes,n.rname=dt.decode(t,e),e+=dt.decode.bytes,n.serial=Wl(t,e),e+=4,n.refresh=Wl(t,e),e+=4,n.retry=Wl(t,e),e+=4,n.expire=Wl(t,e),e+=4,n.minimum=Wl(t,e),e+=4,QP.decode.bytes=e-r,n},encodingLength(t){return 22+dt.encodingLength(t.mname)+dt.encodingLength(t.rname)}}),XP=Dn({encode(t,e,r){Array.isArray(t)||(t=[t]);for(let i=0;i<t.length;i++)if(typeof t[i]=="string"&&(t[i]=VP(t[i])),!y0(t[i]))throw new Error("Must be a Buffer");e||(e=new Uint8Array(XP.encodingLength(t))),r||(r=0);let n=r;return r+=2,t.forEach(function(i){e[r++]=i.length,qa(i,e,r,0,i.length),r+=i.length}),Mt(e,r-n-2,n),XP.encode.bytes=r-n,e},decode(t,e){e||(e=0);let r=e,n=ur(t,e);e+=2;let i=[];for(;n>0;){let o=t[e++];if(--n,n<o)throw new Error("Buffer overflow");i.push(t.slice(e,e+o)),e+=o,n-=o}return XP.decode.bytes=e-r,i},encodingLength(t){Array.isArray(t)||(t=[t]);let e=2;return t.forEach(function(r){typeof r=="string"?e+=Eh(r)+1:e+=r.length+1}),e}}),eA=Dn({encode(t,e,r){e||(e=new Uint8Array(eA.encodingLength(t))),r||(r=0),typeof t=="string"&&(t=VP(t)),t||(t=new Uint8Array(0));let n=r;r+=2;let i=t.length;return qa(t,e,r,0,i),r+=i,Mt(e,r-n-2,n),eA.encode.bytes=r-n,e},decode(t,e){e||(e=0);let r=e,n=ur(t,e);e+=2;let i=t.slice(e,e+n);return e+=n,eA.decode.bytes=e-r,i},encodingLength(t){return t?(y0(t)?t.length:Eh(t))+2:2}}),tA=Dn({encode(t,e,r){e||(e=new Uint8Array(tA.encodingLength(t))),r||(r=0);let n=r;return r+=2,bo.encode(t.cpu,e,r),r+=bo.encode.bytes,bo.encode(t.os,e,r),r+=bo.encode.bytes,Mt(e,r-n-2,n),tA.encode.bytes=r-n,e},decode(t,e){e||(e=0);let r=e,n={};return e+=2,n.cpu=bo.decode(t,e),e+=bo.decode.bytes,n.os=bo.decode(t,e),e+=bo.decode.bytes,tA.decode.bytes=e-r,n},encodingLength(t){return bo.encodingLength(t.cpu)+bo.encodingLength(t.os)+2}}),Jw=Dn({encode(t,e,r){return e||(e=new Uint8Array(Jw.encodingLength(t))),r||(r=0),dt.encode(t,e,r+2),Mt(e,dt.encode.bytes,r),Jw.encode.bytes=dt.encode.bytes+2,e},decode(t,e){e||(e=0);let r=dt.decode(t,e+2);return Jw.decode.bytes=dt.decode.bytes+2,r},encodingLength(t){return dt.encodingLength(t)+2}}),rA=Dn({encode(t,e,r){e||(e=new Uint8Array(rA.encodingLength(t))),r||(r=0),Mt(e,t.priority||0,r+2),Mt(e,t.weight||0,r+4),Mt(e,t.port||0,r+6),dt.encode(t.target,e,r+8);let n=dt.encode.bytes+6;return Mt(e,n,r),rA.encode.bytes=n+2,e},decode(t,e){e||(e=0);let r=ur(t,e),n={};return n.priority=ur(t,e+2),n.weight=ur(t,e+4),n.port=ur(t,e+6),n.target=dt.decode(t,e+8),rA.decode.bytes=r+2,n},encodingLength(t){return 8+dt.encodingLength(t.target)}}),g0=Dn({encode(t,e,r){let n=g0.encodingLength(t);return e||(e=new Uint8Array(g0.encodingLength(t))),r||(r=0),t.issuerCritical&&(t.flags=g0.ISSUER_CRITICAL),Mt(e,n-2,r),r+=2,e[r]=t.flags||0,r+=1,bo.encode(t.tag,e,r),r+=bo.encode.bytes,HP(e,t.value,r),r+=Eh(t.value),g0.encode.bytes=n,e},decode(t,e){e||(e=0);let r=ur(t,e);e+=2;let n=e,i={};return i.flags=t[e],e+=1,i.tag=bo.decode(t,e),e+=bo.decode.bytes,i.value=Ww(t,e,n+r),i.issuerCritical=!!(i.flags&g0.ISSUER_CRITICAL),g0.decode.bytes=r+2,i},encodingLength(t){return bo.encodingLength(t.tag)+bo.encodingLength(t.value)+2}});g0.ISSUER_CRITICAL=1<<7;var nA=Dn({encode(t,e,r){e||(e=new Uint8Array(nA.encodingLength(t))),r||(r=0);let n=r;return r+=2,Mt(e,t.preference||0,r),r+=2,dt.encode(t.exchange,e,r),r+=dt.encode.bytes,Mt(e,r-n-2,n),nA.encode.bytes=r-n,e},decode(t,e){e||(e=0);let r=e,n={};return e+=2,n.preference=ur(t,e),e+=2,n.exchange=dt.decode(t,e),e+=dt.decode.bytes,nA.decode.bytes=e-r,n},encodingLength(t){return 4+dt.encodingLength(t.exchange)}}),Xme=Dn({encode(t,e,r){return e||(e=new Uint8Array(Xme.encodingLength(t))),r||(r=0),Mt(e,4,r),r+=2,gu.encode(t,e,r),e},decode(t,e){return e||(e=0),e+=2,gu.decode(t,e)},bytes:6}),iA=Dn({encode(t,e,r){return e||(e=new Uint8Array(iA.encodingLength(t))),r||(r=0),Mt(e,16,r),r+=2,xh.encode(t,e,r),iA.encode.bytes=18,e},decode(t,e){e||(e=0),e+=2;let r=xh.decode(t,e);return iA.decode.bytes=18,r},bytes:18}),Yme=t=>new Uint8Array(t),Sh=Dn({encode(t,e,r){e||(e=new Uint8Array(Sh.encodingLength(t))),r||(r=0);let n=r,i=Y$(t.code);if(Mt(e,i,r),r+=2,t.data)Mt(e,t.data.length,r),r+=2,qa(t.data,e,r),r+=t.data.length;else switch(i){case 8:{let o=t.sourcePrefixLength||0,s=t.family||Ume(t.ip,Yme),a=Fme(t.ip,Yme),d=Math.ceil(o/8);Mt(e,d+4,r),r+=2,Mt(e,s,r),r+=2,e[r++]=o,e[r++]=t.scopePrefixLength||0,qa(a,e,r,0,d),r+=d}break;case 11:t.timeout?(Mt(e,2,r),r+=2,Mt(e,t.timeout,r),r+=2):(Mt(e,0,r),r+=2);break;case 12:{let o=t.length||0;Mt(e,o,r),r+=2,e.fill(0,r,r+o),r+=o}break;case 14:{let o=t.tags.length*2;Mt(e,o,r),r+=2;for(let s of t.tags)Mt(e,s,r),r+=2}break;default:throw new Error(`Unknown roption code: ${t.code}`)}return Sh.encode.bytes=r-n,e},decode(t,e){e||(e=0);let r={};r.code=ur(t,e),r.type=Wme(r.code),e+=2;let n=ur(t,e);switch(e+=2,r.data=t.slice(e,e+n),r.code){case 8:r.family=ur(t,e),e+=2,r.sourcePrefixLength=t[e++],r.scopePrefixLength=t[e++];{let i=new Uint8Array(r.family===1?4:16);qa(t,i,0,e,e+n-4),r.ip=zme(i)}break;case 11:n>0&&(r.timeout=ur(t,e),e+=2);break;case 14:r.tags=[];for(let i=0;i<n;i+=2)r.tags.push(ur(t,e)),e+=2}return Sh.decode.bytes=n+4,r},encodingLength(t){if(t.data)return t.data.length+4;switch(Y$(t.code)){case 8:{let r=t.sourcePrefixLength||0;return Math.ceil(r/8)+8}case 11:return typeof t.timeout=="number"?6:4;case 12:return t.length+4;case 14:return 4+t.tags.length*2}throw new Error(`Unknown roption code: ${t.code}`)}}),v0=Dn({encode(t,e,r){e||(e=new Uint8Array(v0.encodingLength(t))),r||(r=0);let n=r,i=Zw(t,Sh);return Mt(e,i,r),r=U3(t,Sh,e,r+2),v0.encode.bytes=r-n,e},decode(t,e){e||(e=0);let r=e,n=[],i=ur(t,e);e+=2;let o=0;for(;i>0;)n[o++]=Sh.decode(t,e),e+=Sh.decode.bytes,i-=Sh.decode.bytes;return v0.decode.bytes=e-r,n},encodingLength(t){return 2+Zw(t||[],Sh)}}),Hl=Dn({encode(t,e,r){e||(e=new Uint8Array(Hl.encodingLength(t))),r||(r=0);let n=r,i=t.key;if(!y0(i))throw new Error("Key must be a Buffer");return r+=2,Mt(e,t.flags,r),r+=2,e[r]=Hl.PROTOCOL_DNSSEC,r+=1,e[r]=t.algorithm,r+=1,qa(i,e,r,0,i.length),r+=i.length,Hl.encode.bytes=r-n,Mt(e,Hl.encode.bytes-2,n),e},decode(t,e){e||(e=0);let r=e,n={},i=ur(t,e);if(e+=2,n.flags=ur(t,e),e+=2,t[e]!==Hl.PROTOCOL_DNSSEC)throw new Error("Protocol must be 3");return e+=1,n.algorithm=t[e],e+=1,n.key=t.slice(e,r+i+2),e+=n.key.length,Hl.decode.bytes=e-r,n},encodingLength(t){return 6+Eh(t.key)}});Hl.PROTOCOL_DNSSEC=3;Hl.ZONE_KEY=128;Hl.SECURE_ENTRYPOINT=32768;var j3=Dn({encode(t,e,r){e||(e=new Uint8Array(j3.encodingLength(t))),r||(r=0);let n=r,i=t.signature;if(!y0(i))throw new Error("Signature must be a Buffer");return r+=2,Mt(e,Kw(t.typeCovered),r),r+=2,e[r]=t.algorithm,r+=1,e[r]=t.labels,r+=1,Vl(e,t.originalTTL,r),r+=4,Vl(e,t.expiration,r),r+=4,Vl(e,t.inception,r),r+=4,Mt(e,t.keyTag,r),r+=2,dt.encode(t.signersName,e,r),r+=dt.encode.bytes,qa(i,e,r,0,i.length),r+=i.length,j3.encode.bytes=r-n,Mt(e,j3.encode.bytes-2,n),e},decode(t,e){e||(e=0);let r=e,n={},i=ur(t,e);return e+=2,n.typeCovered=D3(ur(t,e)),e+=2,n.algorithm=t[e],e+=1,n.labels=t[e],e+=1,n.originalTTL=Wl(t,e),e+=4,n.expiration=Wl(t,e),e+=4,n.inception=Wl(t,e),e+=4,n.keyTag=ur(t,e),e+=2,n.signersName=dt.decode(t,e),e+=dt.decode.bytes,n.signature=t.slice(e,r+i+2),e+=n.signature.length,j3.decode.bytes=e-r,n},encodingLength(t){return 20+dt.encodingLength(t.signersName)+Eh(t.signature)}}),N3=Dn({encode(t,e,r){e||(e=new Uint8Array(N3.encodingLength(t))),r||(r=0);let n=r;return r+=2,dt.encode(t.mbox||".",e,r),r+=dt.encode.bytes,dt.encode(t.txt||".",e,r),r+=dt.encode.bytes,N3.encode.bytes=r-n,Mt(e,N3.encode.bytes-2,n),e},decode(t,e){e||(e=0);let r=e,n={};return e+=2,n.mbox=dt.decode(t,e)||".",e+=dt.decode.bytes,n.txt=dt.decode(t,e)||".",e+=dt.decode.bytes,N3.decode.bytes=e-r,n},encodingLength(t){return 2+dt.encodingLength(t.mbox||".")+dt.encodingLength(t.txt||".")}}),yc=Dn({encode(t,e,r){e||(e=new Uint8Array(yc.encodingLength(t))),r||(r=0);let n=r,i=[];for(let o=0;o<t.length;o++){let s=Kw(t[o]);i[s>>8]===void 0&&(i[s>>8]=[]),i[s>>8][s>>3&31]|=1<<7-(s&7)}for(let o=0;o<i.length;o++)if(i[o]!==void 0){let s=VP(i[o]);e[r]=o,r+=1,e[r]=s.length,r+=1,qa(s,e,r,0,s.length),r+=s.length}return yc.encode.bytes=r-n,e},decode(t,e,r){e||(e=0);let n=e,i=[];for(;e-n<r;){let o=t[e];e+=1;let s=t[e];e+=1;for(let a=0;a<s;a++){let d=t[e+a];for(let m=0;m<8;m++)if(d&1<<7-m){let p=D3(o<<8|a<<3|m);i.push(p)}}e+=s}return yc.decode.bytes=e-n,i},encodingLength(t){let e=[];for(let n=0;n<t.length;n++){let i=Kw(t[n]);e[i>>8]=Math.max(e[i>>8]||0,i&255)}let r=0;for(let n=0;n<e.length;n++)e[n]!==void 0&&(r+=2+Math.ceil((e[n]+1)/8));return r}}),q3=Dn({encode(t,e,r){e||(e=new Uint8Array(q3.encodingLength(t))),r||(r=0);let n=r;return r+=2,dt.encode(t.nextDomain,e,r),r+=dt.encode.bytes,yc.encode(t.rrtypes,e,r),r+=yc.encode.bytes,q3.encode.bytes=r-n,Mt(e,q3.encode.bytes-2,n),e},decode(t,e){e||(e=0);let r=e,n={},i=ur(t,e);return e+=2,n.nextDomain=dt.decode(t,e),e+=dt.decode.bytes,n.rrtypes=yc.decode(t,e,i-(e-r)),e+=yc.decode.bytes,q3.decode.bytes=e-r,n},encodingLength(t){return 2+dt.encodingLength(t.nextDomain)+yc.encodingLength(t.rrtypes)}}),$3=Dn({encode(t,e,r){e||(e=new Uint8Array($3.encodingLength(t))),r||(r=0);let n=r,i=t.salt;if(!y0(i))throw new Error("salt must be a Buffer");let o=t.nextDomain;if(!y0(o))throw new Error("nextDomain must be a Buffer");return r+=2,e[r]=t.algorithm,r+=1,e[r]=t.flags,r+=1,Mt(e,t.iterations,r),r+=2,e[r]=i.length,r+=1,qa(i,e,r,0,i.length),r+=i.length,e[r]=o.length,r+=1,qa(o,e,r,0,o.length),r+=o.length,yc.encode(t.rrtypes,e,r),r+=yc.encode.bytes,$3.encode.bytes=r-n,Mt(e,$3.encode.bytes-2,n),e},decode(t,e){e||(e=0);let r=e,n={},i=ur(t,e);e+=2,n.algorithm=t[e],e+=1,n.flags=t[e],e+=1,n.iterations=ur(t,e),e+=2;let o=t[e];e+=1,n.salt=t.slice(e,e+o),e+=o;let s=t[e];return e+=1,n.nextDomain=t.slice(e,e+s),e+=s,n.rrtypes=yc.decode(t,e,i-(e-r)),e+=yc.decode.bytes,$3.decode.bytes=e-r,n},encodingLength(t){return 8+t.salt.length+t.nextDomain.length+yc.encodingLength(t.rrtypes)}}),L3=Dn({encode(t,e,r){e||(e=new Uint8Array(L3.encodingLength(t))),r||(r=0);let n=r,i=t.digest;if(!y0(i))throw new Error("Digest must be a Buffer");return r+=2,Mt(e,t.keyTag,r),r+=2,e[r]=t.algorithm,r+=1,e[r]=t.digestType,r+=1,qa(i,e,r,0,i.length),r+=i.length,L3.encode.bytes=r-n,Mt(e,L3.encode.bytes-2,n),e},decode(t,e){e||(e=0);let r=e,n={},i=ur(t,e);return e+=2,n.keyTag=ur(t,e),e+=2,n.algorithm=t[e],e+=1,n.digestType=t[e],e+=1,n.digest=t.slice(e,r+i+2),e+=n.digest.length,L3.decode.bytes=e-r,n},encodingLength(t){return 6+Eh(t.digest)}}),Hw=Dn({encode(t,e,r){e||(e=new Uint8Array(Hw.encodingLength(t))),r||(r=0);let n=r;r+=2,e[r]=t.algorithm,r+=1,e[r]=t.hash,r+=1;let i=X$(t.fingerprint),o=rL(t.hash);if(i!==o)throw new Error(`Invalid length of fingerprint "${t.fingerprint}" for hashType=${t.hash}: ${i} != ${o}`);return Zme(e,t.fingerprint,r,r+=i),Hw.encode.bytes=r-n,Mt(e,Hw.encode.bytes-2,n),e},decode(t,e){e||(e=0);let r=e,n={};e+=2,n.algorithm=t[e],e+=1,n.hash=t[e],e+=1;let i=rL(n.hash);return n.fingerprint=Hme(t,e,e+i),e+=i,Hw.decode.bytes=e-r,n},encodingLength(t){return 4+X$(t.fingerprint)}});function rL(t){if(t===1)return 20;if(t===2)return 32;throw new Error(`Invalid hashType=${t}, supported=1,2`)}Hw.getFingerprintLengthForHashType=rL;function eL(t){switch(t.toUpperCase()){case"A":return Xme;case"PTR":return Jw;case"CNAME":return Jw;case"DNAME":return Jw;case"TXT":return XP;case"NULL":return eA;case"AAAA":return iA;case"SRV":return rA;case"HINFO":return tA;case"CAA":return g0;case"NS":return YP;case"SOA":return QP;case"MX":return nA;case"OPT":return v0;case"DNSKEY":return Hl;case"RRSIG":return j3;case"RP":return N3;case"NSEC":return q3;case"NSEC3":return $3;case"SSHFP":return Hw;case"DS":return L3}return JP}var mf=Dn({encode(t,e,r){e||(e=new Uint8Array(mf.encodingLength(t))),r||(r=0);let n=r;if(dt.encode(t.name,e,r),r+=dt.encode.bytes,Mt(e,Kw(t.type),r),t.type.toUpperCase()==="OPT"){if(t.name!==".")throw new Error("OPT name must be root.");Mt(e,t.udpPayloadSize||4096,r+2),e[r+4]=t.extendedRcode||0,e[r+5]=t.ednsVersion||0,Mt(e,t.flags||0,r+6),r+=8,v0.encode(t.options||[],e,r),r+=v0.encode.bytes}else{let i=J$(t.class===void 0?"IN":t.class);t.flush&&(i|=tL),Mt(e,i,r+2),Vl(e,t.ttl||0,r+4),r+=8;let o=eL(t.type);o.encode(t.data,e,r),r+=o.encode.bytes}return mf.encode.bytes=r-n,e},decode(t,e){e||(e=0);let r={},n=e;if(r.name=dt.decode(t,e),e+=dt.decode.bytes,r.type=D3(ur(t,e)),r.type==="OPT")r.udpPayloadSize=ur(t,e+2),r.extendedRcode=t[e+4],r.ednsVersion=t[e+5],r.flags=ur(t,e+6),r.flag_do=(r.flags>>15&1)===1,r.options=v0.decode(t,e+8),e+=8+v0.decode.bytes;else{let i=ur(t,e+2);r.ttl=Wl(t,e+4),r.class=Z$(i&jQe),r.flush=!!(i&tL);let o=eL(r.type);r.data=o.decode(t,e+8),e+=8+o.decode.bytes}return mf.decode.bytes=e-n,r},encodingLength(t){let e=t.data!==null&&t.data!==void 0?t.data:t.options;return dt.encodingLength(t.name)+8+eL(t.type).encodingLength(e)}}),Yw=Dn({encode(t,e,r){e||(e=new Uint8Array(Yw.encodingLength(t))),r||(r=0);let n=r;return dt.encode(t.name,e,r),r+=dt.encode.bytes,Mt(e,Kw(t.type),r),r+=2,Mt(e,J$(t.class===void 0?"IN":t.class),r),r+=2,Yw.encode.bytes=r-n,t},decode(t,e){e||(e=0);let r=e,n={};return n.name=dt.decode(t,e),e+=dt.decode.bytes,n.type=D3(ur(t,e)),e+=2,n.class=Z$(ur(t,e)),e+=2,!!(n.class&Qme)&&(n.class&=NQe),Yw.decode.bytes=e-r,n},encodingLength(t){return dt.encodingLength(t.name)+4}});var eye=1<<10,VIt=1<<9,HIt=1<<8,ZIt=1<<7,JIt=1<<5,YIt=1<<4,QIt=1<<15,gs={encode:function(t,e,r){let n=!e;n&&(e=new Uint8Array(qQe(t))),r||(r=0);let i=r;return t.questions||(t.questions=[]),t.answers||(t.answers=[]),t.authorities||(t.authorities=[]),t.additionals||(t.additionals=[]),Vw.encode(t,e,r),r+=Vw.encode.bytes,r=U3(t.questions,Yw,e,r),r=U3(t.answers,mf,e,r),r=U3(t.authorities,mf,e,r),r=U3(t.additionals,mf,e,r),gs.encode.bytes=r-i,n&&F3.bytes!==e.length?e.slice(0,F3.bytes):e},decode:function(t,e){e||(e=0);let r=e,n=Vw.decode(t,e);return e+=Vw.decode.bytes,e=ZP(n.questions,Yw,t,e),e=ZP(n.answers,mf,t,e),e=ZP(n.authorities,mf,t,e),e=ZP(n.additionals,mf,t,e),gs.decode.bytes=e-r,n},encodingLength:function(t){return Vw.encodingLength(t)+Zw(t.questions||[],Yw)+Zw(t.answers||[],mf)+Zw(t.authorities||[],mf)+Zw(t.additionals||[],mf)}};gs.encode.bytes=0;gs.decode.bytes=0;function oA(t,e){if(t.questions)throw new Error("Only one .question object expected instead of a .questions array!");let r=Object.assign({type:e},t);return r.question&&(r.questions=[r.question],delete r.question),r}var sA={encode:function(t,e,r){return e=gs.encode(oA(t,"query"),e,r),sA.encode.bytes=gs.encode.bytes,e},decode:function(t,e){let r=gs.decode(t,e);return sA.decode.bytes=gs.decode.bytes,r.questions&&(r.question=r.questions[0],delete r.questions),r},encodingLength:function(t){return gs.encodingLength(oA(t,"query"))}};sA.encode.bytes=0;sA.decode.bytes=0;var aA={encode:function(t,e,r){return e=gs.encode(oA(t,"response"),e,r),aA.encode.bytes=gs.encode.bytes,e},decode:function(t,e){let r=gs.decode(t,e);return aA.decode.bytes=gs.decode.bytes,r.questions&&(r.question=r.questions[0],delete r.questions),r},encodingLength:function(t){return gs.encodingLength(oA(t,"response"))}};aA.encode.bytes=0;aA.decode.bytes=0;var F3=gs.encode,cA=gs.decode,qQe=gs.encodingLength;function tye(t){let e=F3(t),r=new Uint8Array(2+e.byteLength);return Mt(r,e.byteLength),qa(e,r,2,0,e.length),tye.bytes=r.byteLength,r}tye.bytes=0;function rye(t){let e=ur(t,0);if(t.byteLength<e+2)return null;let r=cA(t.slice(2));return rye.bytes=cA.bytes,r}rye.bytes=0;function Zw(t,e){let r=0;for(let n=0;n<t.length;n++)r+=e.encodingLength(t[n]);return r}function U3(t,e,r,n){for(let i=0;i<t.length;i++)e.encode(t[i],r,n),n+=e.encode.bytes;return n}function ZP(t,e,r,n){for(let i=0;i<t.length;i++)t[i]=e.decode(r,n),n+=e.decode.bytes;return n}E();var nye=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(p){try{m(n.next(p))}catch(w){s(w)}}function d(p){try{m(n.throw(p))}catch(w){s(w)}}function m(p){p.done?o(p.value):i(p.value).then(a,d)}m((n=n.apply(t,e||[])).next())})},yf=class{static getSigningMethod(e){return nye(this,void 0,void 0,function*(){throw new Error("Not implemented: Classes extending DidMethod must implement getSigningMethod()")})}static resolve(e,r){return nye(this,void 0,void 0,function*(){throw new Error("Not implemented: Classes extending DidMethod must implement resolve()")})}};var Lo=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(p){try{m(n.next(p))}catch(w){s(w)}}function d(p){try{m(n.throw(p))}catch(w){s(w)}}function m(p){p.done?o(p.value):i(p.value).then(a,d)}m((n=n.apply(t,e||[])).next())})},iye=function(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(t);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(t,n[i])&&(r[n[i]]=t[n[i]]);return r},oye="https://diddht.tbddev.org",$Qe=0,b0=7200,fA=";",ma=",",nL;(function(t){t[t.Discoverable=0]="Discoverable",t[t.Organization=1]="Organization",t[t.Government=2]="Government",t[t.Corporation=3]="Corporation",t[t.LocalBusiness=4]="LocalBusiness",t[t.SoftwarePackage=5]="SoftwarePackage",t[t.WebApp=6]="WebApp",t[t.FinancialInstitution=7]="FinancialInstitution"})(nL||(nL={}));var ya;(function(t){t[t.Ed25519=0]="Ed25519",t[t.secp256k1=1]="secp256k1",t[t.secp256r1=2]="secp256r1",t[t.X25519=3]="X25519"})(ya||(ya={}));var iL;(function(t){t.authentication="auth",t.assertionMethod="asm",t.capabilityDelegation="del",t.capabilityInvocation="inv",t.keyAgreement="agm"})(iL||(iL={}));var aye={Ed25519:ya.Ed25519,ES256K:ya.secp256k1,ES256:ya.secp256r1,"P-256":ya.secp256r1,secp256k1:ya.secp256k1,secp256r1:ya.secp256r1,X25519:ya.X25519},sye={[ya.Ed25519]:"Ed25519",[ya.secp256k1]:"ES256K",[ya.secp256r1]:"ES256",[ya.X25519]:"ECDH-ES+A256KW"},Zl=class extends yf{static create(){return Lo(this,arguments,void 0,function*({keyManager:e=new Ks,options:r={}}={}){var n,i,o,s,a,d,m,p,w,P,S;if(!((n=r.verificationMethods)===null||n===void 0)&&n.some(L=>!(L.algorithm in aye)))throw new Error("One or more verification method algorithms are not supported");let M=(i=r.verificationMethods)===null||i===void 0?void 0:i.filter(L=>"id"in L).map(L=>L.id);if(M&&M.length!==new Set(M).size)throw new Error("One or more verification method IDs are not unique");if(!((o=r.services)===null||o===void 0)&&o.some(L=>!L.id||!L.type||!L.serviceEndpoint))throw new Error("One or more services are missing required properties");let A=yield e.generateKey({algorithm:"Ed25519"}),B=yield e.getPublicKey({keyUri:A}),I=yield Oi.identityKeyToIdentifier({identityKey:B}),C=Object.assign(Object.assign({id:I},r.alsoKnownAs&&{alsoKnownAs:r.alsoKnownAs}),r.controllers&&{controller:r.controllers}),k=[...(s=r.verificationMethods)!==null&&s!==void 0?s:[]];k?.some(L=>{var U;return((U=L.id)===null||U===void 0?void 0:U.split("#").pop())==="0"})||k.unshift({algorithm:"Ed25519",id:"0",purposes:["authentication","assertionMethod","capabilityDelegation","capabilityInvocation"]});for(let L of k){let U=L.id&&L.id.split("#").pop()==="0"?A:yield e.generateKey({algorithm:L.algorithm}),F=yield e.getPublicKey({keyUri:U}),N=(d=(a=L.id)!==null&&a!==void 0?a:F.kid)!==null&&d!==void 0?d:yield rr({jwk:F});N=`${I}#${Na(N)}`,(m=C.verificationMethod)!==null&&m!==void 0||(C.verificationMethod=[]),C.verificationMethod.push({id:N,type:"JsonWebKey",controller:(p=L.controller)!==null&&p!==void 0?p:I,publicKeyJwk:F});for(let G of(w=L.purposes)!==null&&w!==void 0?w:[])C[G]||(C[G]=[]),C[G].push(N)}(P=r.services)===null||P===void 0||P.forEach(L=>{var U;(U=C.service)!==null&&U!==void 0||(C.service=[]),L.id=`${I}#${L.id.split("#").pop()}`,C.service.push(L)});let q=new Gs({uri:I,document:C,metadata:Object.assign({published:!1},r.types&&{types:r.types}),keyManager:e});if(!((S=r.publish)!==null&&S!==void 0)||S){let L=yield Zl.publish({did:q,gatewayUri:r.gatewayUri});q.metadata=L.didDocumentMetadata}return q})}static import(e){return Lo(this,arguments,void 0,function*({portableDid:r,keyManager:n=new Ks}){var i;let o=cr.parse(r.uri);if(o?.method!==Zl.methodName)throw new ft(ut.MethodNotSupported,"Method not supported");let s=yield Gs.import({portableDid:r,keyManager:n});if(!(!((i=s.document.verificationMethod)===null||i===void 0)&&i.some(a=>{var d;return((d=a.id)===null||d===void 0?void 0:d.split("#").pop())==="0"})))throw new ft(ut.InvalidDidDocument,"DID document must contain an Identity Key");return s})}static getSigningMethod(e){return Lo(this,arguments,void 0,function*({didDocument:r,methodId:n="#0"}){var i;let o=cr.parse(r.id);if(o&&o.method!==this.methodName)throw new ft(ut.MethodNotSupported,`Method not supported: ${o.method}`);let s=(i=r.verificationMethod)===null||i===void 0?void 0:i.find(a=>{var d,m;return Na(a.id)===((d=Na(n))!==null&&d!==void 0?d:Na((m=r.assertionMethod)===null||m===void 0?void 0:m[0]))});if(!(s&&s.publicKeyJwk))throw new ft(ut.InternalError,"A verification method intended for signing could not be determined from the DID Document");return s})}static publish(e){return Lo(this,arguments,void 0,function*({did:r,gatewayUri:n=oye}){return yield vu.put({did:r,gatewayUri:n})})}static resolve(e){return Lo(this,arguments,void 0,function*(r,n={}){var i;let o=(i=n?.gatewayUri)!==null&&i!==void 0?i:oye;try{yield Oi.identifierToIdentityKey({didUri:r});let{didDocument:s,didDocumentMetadata:a}=yield vu.get({didUri:r,gatewayUri:o});return Object.assign(Object.assign({},pi),{didDocument:s,didDocumentMetadata:a})}catch(s){if(!(s instanceof ft))throw new Error(s);return Object.assign(Object.assign({},pi),{didResolutionMetadata:Object.assign({error:s.code},s.message&&{errorMessage:s.message})})}})}};Zl.methodName="dht";var vu=class{static get(e){return Lo(this,arguments,void 0,function*({didUri:r,gatewayUri:n}){let i=Oi.identifierToIdentityKeyBytes({didUri:r}),o=yield vu.pkarrGet({gatewayUri:n,publicKeyBytes:i}),s=yield Oi.parseBep44GetMessage({bep44Message:o}),a=yield vu.fromDnsPacket({didUri:r,dnsPacket:s});return a.didDocumentMetadata.versionId=o.seq.toString(),a})}static put(e){return Lo(this,arguments,void 0,function*({did:r,gatewayUri:n}){let i=yield vu.toDnsPacket({didDocument:r.document,didMetadata:r.metadata,authoritativeGatewayUris:[n]}),o=yield Oi.createBep44PutMessage({dnsPacket:i,publicKeyBytes:Oi.identifierToIdentityKeyBytes({didUri:r.uri}),signer:yield r.getSigner({methodId:"0"})}),s=yield vu.pkarrPut({gatewayUri:n,bep44Message:o});return{didDocument:r.document,didDocumentMetadata:Object.assign(Object.assign({},r.metadata),{published:s,versionId:o.seq.toString()}),didRegistrationMetadata:{}}})}static pkarrGet(e){return Lo(this,arguments,void 0,function*({gatewayUri:r,publicKeyBytes:n}){let i=We.uint8Array(n).toBase32Z(),o=new URL(i,r).href,s;try{if(s=yield fetch(o,{method:"GET"}),!s.ok)throw new ft(ut.NotFound,`Pkarr record not found for: ${i}`)}catch(m){throw m instanceof ft?m:new ft(ut.InternalError,`Failed to fetch Pkarr record: ${m.message}`)}let a=yield s.arrayBuffer();if(!a)throw new ft(ut.NotFound,`Pkarr record not found for: ${i}`);if(a.byteLength<72)throw new ft(ut.InvalidDidDocumentLength,`Pkarr response must be at least 72 bytes but got: ${a.byteLength}`);if(a.byteLength>1072)throw new ft(ut.InvalidDidDocumentLength,`Pkarr response exceeds 1000 byte limit: ${a.byteLength}`);return{k:n,seq:Number(new DataView(a).getBigUint64(64)),sig:new Uint8Array(a,0,64),v:new Uint8Array(a,72)}})}static pkarrPut(e){return Lo(this,arguments,void 0,function*({gatewayUri:r,bep44Message:n}){let i=We.uint8Array(n.k).toBase32Z(),o=new URL(i,r).href,s=new Uint8Array(n.v.length+72);s.set(n.sig,0),new DataView(s.buffer).setBigUint64(n.sig.length,BigInt(n.seq)),s.set(n.v,n.sig.length+8);let a;try{a=yield fetch(o,{method:"PUT",headers:{"Content-Type":"application/octet-stream"},body:s})}catch(d){throw new ft(ut.InternalError,`Failed to put Pkarr record for identifier ${i}: ${d.message}`)}return a.ok})}static fromDnsPacket(e){return Lo(this,arguments,void 0,function*({didUri:r,dnsPacket:n}){var i,o,s;let a={id:r},d={published:!0},m=new Map;for(let p of(i=n?.answers)!==null&&i!==void 0?i:[]){if(p.type!=="TXT")continue;let w=p.name.split(".")[0].substring(1);switch(!0){case w.startsWith("aka"):{let P=Oi.parseTxtDataToString(p.data);a.alsoKnownAs=P.split(ma);break}case w.startsWith("cnt"):{let P=Oi.parseTxtDataToString(p.data);a.controller=P.includes(ma)?P.split(ma):P;break}case w.startsWith("k"):{let{id:P,t:S,k:M,c:A,a:B}=Oi.parseTxtDataToObject(p.data),I=We.base64Url(M).toUint8Array(),C=ya[Number(S)],k=yield Oi.keyConverter(C).bytesToPublicKey({publicKeyBytes:I});k.alg=B||sye[Number(S)];let q=w==="k0"?"0":P!==void 0?P:yield rr({jwk:k});(o=a.verificationMethod)!==null&&o!==void 0||(a.verificationMethod=[]);let L=`${r}#${q}`;a.verificationMethod.push({id:L,type:"JsonWebKey",controller:A??r,publicKeyJwk:k}),m.set(w,L);break}case w.startsWith("s"):{let P=Oi.parseTxtDataToObject(p.data),{id:S,t:M,se:A}=P,B=iye(P,["id","t","se"]),I=A.includes(ma)?A.split(ma):[A],C=Object.fromEntries(Object.entries(B).map(([k,q])=>[k,q.includes(ma)?q.split(ma):q]));(s=a.service)!==null&&s!==void 0||(a.service=[]),a.service.push(Object.assign(Object.assign({},C),{id:`${r}#${S}`,type:M,serviceEndpoint:I}));break}case w.startsWith("typ"):{let{id:P}=Oi.parseTxtDataToObject(p.data);d.types=P.split(ma).map(S=>Number(S));break}case w.startsWith("did"):{let P=C=>C.split(ma).map(k=>m.get(k)).filter(k=>typeof k=="string"),{auth:S,asm:M,del:A,inv:B,agm:I}=Oi.parseTxtDataToObject(p.data);S&&(a.authentication=P(S)),M&&(a.assertionMethod=P(M)),A&&(a.capabilityDelegation=P(A)),B&&(a.capabilityInvocation=P(B)),I&&(a.keyAgreement=P(I));break}}}return{didDocument:a,didDocumentMetadata:d,didResolutionMetadata:{}}})}static toDnsPacket(e){return Lo(this,arguments,void 0,function*({didDocument:r,didMetadata:n,authoritativeGatewayUris:i,previousDidProof:o}){var s,a,d,m,p;let w=[],P=[],S=new Map,M=[],A=[];if(o!==void 0){let{signature:C,previousDid:k}=o;yield Oi.validatePreviousDidProof({newDid:r.id,previousDidProof:o}),w.push({type:"TXT",name:"_prv._did.",ttl:b0,data:`id=${k};s=${C}`})}if(r.alsoKnownAs&&w.push({type:"TXT",name:"_aka._did.",ttl:b0,data:r.alsoKnownAs.join(ma)}),r.controller){let C=Array.isArray(r.controller)?r.controller.join(ma):r.controller;w.push({type:"TXT",name:"_cnt._did.",ttl:b0,data:C})}for(let[C,k]of(a=(s=r.verificationMethod)===null||s===void 0?void 0:s.entries())!==null&&a!==void 0?a:[]){let q=`k${C}`;A.push(q);let L=k.id.split("#").pop();S.set(L,q);let U=k.publicKeyJwk;if(!(U?.crv&&U.crv in aye))throw new ft(ut.InvalidPublicKeyType,`Verification method '${k.id}' contains an unsupported key type: ${(d=U?.crv)!==null&&d!==void 0?d:"undefined"}`);let F=ya[U.crv],N=yield Oi.keyConverter(U.crv).publicKeyToBytes({publicKey:U}),G=We.uint8Array(N).toBase64Url(),x=[`t=${F}`,`k=${G}`];L!=="0"&&(yield rr({jwk:U}))!==L&&x.unshift(`id=${L}`),U.alg!==sye[F]&&x.push(`a=${U.alg}`),k.controller!==r.id&&x.push(`c=${k.controller}`),w.push({type:"TXT",name:`_${q}._did.`,ttl:b0,data:x.join(fA)})}(m=r.service)===null||m===void 0||m.forEach((C,k)=>{let q=`s${k}`;M.push(q);let{id:L,type:U,serviceEndpoint:F}=C,N=iye(C,["id","type","serviceEndpoint"]);L=Na(L),F=Array.isArray(F)?F.join(","):F;let x=Object.entries(Object.assign({id:L,t:U,se:F},N)).map(([u,y])=>`${u}=${y}`).join(fA),c=Oi.chunkDataIfNeeded(x);w.push({type:"TXT",name:`_${q}._did.`,ttl:b0,data:c})});let B=[`v=${$Qe}`];if(A.length&&B.push(`vm=${A.join(ma)}`),Object.keys(Ny).forEach(C=>{var k;let q=(k=r[C])===null||k===void 0?void 0:k.map(L=>S.get(L.split("#").pop()));if(q){let L=iL[C];B.push(`${L}=${q.join(ma)}`)}}),M.length&&B.push(`svc=${M.join(ma)}`),!((p=n.types)===null||p===void 0)&&p.length){let k=n.types.map(q=>typeof q=="string"?nL[q]:q);w.push({type:"TXT",name:"_typ._did.",ttl:b0,data:`id=${k.join(ma)}`})}w.push({type:"TXT",name:"_did."+vu.getUniqueDidSuffix(r.id)+".",ttl:b0,data:B.join(fA)});for(let C of i||[])P.push({type:"NS",name:"_did."+vu.getUniqueDidSuffix(r.id)+".",ttl:b0,data:C+"."});return{id:0,type:"response",flags:eye,answers:[...w,...P]}})}static getUniqueDidSuffix(e){return e.split(":")[2]}},Oi=class{static createBep44PutMessage(e){return Lo(this,arguments,void 0,function*({dnsPacket:r,publicKeyBytes:n,signer:i}){let o=Math.ceil(Date.now()/1e3),s=F3(r),a=H$.encode({seq:o,v:s}).subarray(1,-1);if(a.length>1e3)throw new ft(ut.InvalidDidDocumentLength,`DNS packet exceeds the 1000 byte maximum size: ${a.length} bytes`);let d=yield i.sign({data:a});return{k:n,seq:o,sig:d,v:s}})}static identifierToIdentityKey(e){return Lo(this,arguments,void 0,function*({didUri:r}){let n=Oi.identifierToIdentityKeyBytes({didUri:r});return yield Bn.bytesToPublicKey({publicKeyBytes:n})})}static identifierToIdentityKeyBytes({didUri:e}){let r=cr.parse(e);if(!r)throw new ft(ut.InvalidDid,`Invalid DID URI: ${e}`);if(r.method!==Zl.methodName)throw new ft(ut.MethodNotSupported,`Method not supported: ${r.method}`);let n;try{n=We.base32Z(r.id).toUint8Array()}catch{throw new ft(ut.InvalidPublicKey,"Failed to decode method-specific identifier")}if(n.length!==32)throw new ft(ut.InvalidPublicKeyLength,`Invalid public key length: ${n.length}`);return n}static identityKeyToIdentifier(e){return Lo(this,arguments,void 0,function*({identityKey:r}){let n=yield Bn.publicKeyToBytes({publicKey:r}),i=We.uint8Array(n).toBase32Z();return`did:${Zl.methodName}:${i}`})}static keyConverter(e){let n={Ed25519:Bn,"P-256":{publicKeyToBytes:i=>Lo(this,[i],void 0,function*({publicKey:o}){let s=yield On.publicKeyToBytes({publicKey:o});return yield On.compressPublicKey({publicKeyBytes:s})}),bytesToPublicKey:On.bytesToPublicKey,privateKeyToBytes:On.privateKeyToBytes,bytesToPrivateKey:On.bytesToPrivateKey},secp256k1:{publicKeyToBytes:i=>Lo(this,[i],void 0,function*({publicKey:o}){let s=yield En.publicKeyToBytes({publicKey:o});return yield En.compressPublicKey({publicKeyBytes:s})}),bytesToPublicKey:En.bytesToPublicKey,privateKeyToBytes:En.privateKeyToBytes,bytesToPrivateKey:En.bytesToPrivateKey},X25519:yu}[e];if(!n)throw new ft(ut.InvalidPublicKeyType,`Unsupported curve: ${e}`);return n}static parseBep44GetMessage(e){return Lo(this,arguments,void 0,function*({bep44Message:r}){let n=yield Bn.bytesToPublicKey({publicKeyBytes:r.k}),i=H$.encode({seq:r.seq,v:r.v}).subarray(1,-1);if(!(yield Bn.verify({key:n,signature:r.sig,data:i})))throw new ft(ut.InvalidSignature,"Invalid signature for DHT BEP44 message");return cA(r.v)})}static parseTxtDataToObject(e){return this.parseTxtDataToString(e).split(fA).reduce((r,n)=>{let[i,o]=n.split("=");return r[i]=o,r},{})}static parseTxtDataToString(e){if(typeof e=="string")return e;if(e instanceof Uint8Array)return We.uint8Array(e).toString();if(Array.isArray(e))return e.map(r=>this.parseTxtDataToString(r)).join("");throw new ft(ut.InternalError,"Pkarr returned DNS TXT record with invalid data type")}static validatePreviousDidProof(e){return Lo(this,arguments,void 0,function*({newDid:r,previousDidProof:n}){let i=yield Oi.identifierToIdentityKey({didUri:n.previousDid}),o=Oi.identifierToIdentityKeyBytes({didUri:r}),s=We.base64Url(n.signature).toUint8Array();if(!(yield Bn.verify({key:i,data:o,signature:s})))throw new ft(ut.InvalidPreviousDidProof,"The previous DID proof is invalid.")})}static chunkDataIfNeeded(e){if(e.length<=255)return e;let r=[];for(let n=0;n<e.length;n+=255)r.push(e.slice(n,n+255));return r}};E();E();E();E();E();var Vn={DeltaExceedsMaximumSize:"DeltaExceedsMaximumSize",DidDocumentPublicKeyIdDuplicated:"DidDocumentPublicKeyIdDuplicated",DidDocumentPublicKeyMissingOrIncorrectType:"DidDocumentPublicKeyMissingOrIncorrectType",DidDocumentServiceIdDuplicated:"DidDocumentServiceIdDuplicated",DidSuffixIncorrectLength:"DidSuffixIncorrectLength",EncodedStringIncorrectEncoding:"EncodedStringIncorrectEncoding",IdNotUsingBase64UrlCharacterSet:"IdNotUsingBase64UrlCharacterSet",IdTooLong:"IdTooLong",JwkEs256kMissingOrInvalidCrv:"JwkEs256kMissingOrInvalidCrv",JwkEs256kMissingOrInvalidKty:"JwkEs256kMissingOrInvalidKty",JwkEs256kHasIncorrectLengthOfX:"JwkEs256kHasIncorrectLengthOfX",JwkEs256kHasIncorrectLengthOfY:"JwkEs256kHasIncorrectLengthOfY",JwkEs256kHasIncorrectLengthOfD:"JwkEs256kHasIncorrectLengthOfD",MultihashStringNotAMultihash:"MultihashStringNotAMultihash",MultihashUnsupportedHashAlgorithm:"MultihashUnsupportedHashAlgorithm",PublicKeyJwkEs256kHasUnexpectedProperty:"PublicKeyJwkEs256kHasUnexpectedProperty",PublicKeyPurposeDuplicated:"PublicKeyPurposeDuplicated",ServiceEndpointCannotBeAnArray:"ServiceEndpointCannotBeAnArray",ServiceEndpointStringNotValidUri:"ServiceEndpointStringNotValidUri",ServiceTypeTooLong:"ServiceTypeTooLong"};E();var Sn=class extends Error{constructor(e,r){super(`${e}: ${r}`),this.code=e,Object.setPrototypeOf(this,new.target.prototype)}};E();E();E();E();var xkt=new Uint8Array(0);var oL=t=>{if(t instanceof Uint8Array&&t.constructor.name==="Uint8Array")return t;if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);throw new Error("Unknown type, must be binary type")};E();var sL=class{constructor(e,r,n){this.name=e,this.prefix=r,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},aL=class{constructor(e,r,n){if(this.name=e,this.prefix=r,r.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return cye(this,e)}},cL=class{constructor(e){this.decoders=e}or(e){return cye(this,e)}decode(e){let r=e[0],n=this.decoders[r];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}},cye=(t,e)=>new cL({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}}),fL=class{constructor(e,r,n,i){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new sL(e,r,n),this.decoder=new aL(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}},LQe=({name:t,prefix:e,encode:r,decode:n})=>new fL(t,e,r,n);var UQe=(t,e,r,n)=>{let i={};for(let p=0;p<e.length;++p)i[e[p]]=p;let o=t.length;for(;t[o-1]==="=";)--o;let s=new Uint8Array(o*r/8|0),a=0,d=0,m=0;for(let p=0;p<o;++p){let w=i[t[p]];if(w===void 0)throw new SyntaxError(`Non-${n} character`);d=d<<r|w,a+=r,a>=8&&(a-=8,s[m++]=255&d>>a)}if(a>=r||255&d<<8-a)throw new SyntaxError("Unexpected end of data");return s},FQe=(t,e,r)=>{let n=e[e.length-1]==="=",i=(1<<r)-1,o="",s=0,a=0;for(let d=0;d<t.length;++d)for(a=a<<8|t[d],s+=8;s>r;)s-=r,o+=e[i&a>>s];if(s&&(o+=e[i&a<<r-s]),n)for(;o.length*r&7;)o+="=";return o},z3=({name:t,prefix:e,bitsPerChar:r,alphabet:n})=>LQe({prefix:e,name:t,encode(i){return FQe(i,n,r)},decode(i){return UQe(i,n,r,t)}});var Bkt=z3({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),Dkt=z3({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),K3=z3({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),Ckt=z3({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var Uo=class{static encode(e){return K3.baseEncode(e)}static decodeAsBytes(e,r){if(!Uo.isBase64UrlString(e))throw new Sn(Vn.EncodedStringIncorrectEncoding,`Given ${r} must be base64url string.`);return K3.baseDecode(e)}static decodeAsString(e,r){let n=Uo.decodeAsBytes(e,r);return Uo.bytesToString(n)}static isBase64UrlString(e){return/^[A-Za-z0-9_-]+$/.test(e)}static stringToBytes(e){return new TextEncoder().encode(e)}static bytesToString(e){return new TextDecoder().decode(e)}};E();var gye=or(pj(),1);E();E();var uL;(function(t){t.Public="public",t.Private="private"})(uL||(uL={}));var gc=uL;var wo=class{static validateEs256kOperationKey(e,r){let n=new Set(["kty","crv","x","y"]);r===gc.Private&&n.add("d");for(let i in e)if(!n.has(i))throw new Sn(Vn.PublicKeyJwkEs256kHasUnexpectedProperty,`SECP256K1 JWK key has unexpected property '${i}'.`);if(e.crv!=="secp256k1")throw new Sn(Vn.JwkEs256kMissingOrInvalidCrv,`SECP256K1 JWK 'crv' property must be 'secp256k1' but got '${e.crv}.'`);if(e.kty!=="EC")throw new Sn(Vn.JwkEs256kMissingOrInvalidKty,`SECP256K1 JWK 'kty' property must be 'EC' but got '${e.kty}.'`);if(e.x.length!==43)throw new Sn(Vn.JwkEs256kHasIncorrectLengthOfX,"SECP256K1 JWK 'x' property must be 43 bytes.");if(e.y.length!==43)throw new Sn(Vn.JwkEs256kHasIncorrectLengthOfY,"SECP256K1 JWK 'y' property must be 43 bytes.");if(r===gc.Private&&(e.d===void 0||e.d.length!==43))throw new Sn(Vn.JwkEs256kHasIncorrectLengthOfD,"SECP256K1 JWK 'd' property must be 43 bytes.")}static validateId(e){if(e.length>50)throw new Sn(Vn.IdTooLong,`Key ID length ${e.length} exceed max allowed length of ${50}.`);if(!Uo.isBase64UrlString(e))throw new Sn(Vn.IdNotUsingBase64UrlCharacterSet,`Key ID '${e}' is not a Base64URL string.`)}static validatePublicKeyPurposes(e){if(e===void 0)return;let r=new Set;for(let n of e){if(r.has(n))throw new Sn(Vn.PublicKeyPurposeDuplicated,`Public key purpose '${n}' already specified.`);r.add(n)}}};E();var G3=class{};G3.hashAlgorithmInMultihashCode=18;G3.maxCanonicalizedDeltaSizeInBytes=1e3;var ga=G3;E();var lye=or(uye(),1);var $a=class{static canonicalizeAsBytes(e){let r=$a.removeAllUndefinedProperties(e),n=lye.default(r);return Uo.stringToBytes(n)}static removeAllUndefinedProperties(e){for(let r in e)typeof e[r]=="object"?$a.removeAllUndefinedProperties(e[r]):e[r]===void 0&&delete e[r];return e}};E();E();E();E();var zQe=pye,dye=128,KQe=127,GQe=~KQe,WQe=Math.pow(2,31);function pye(t,e,r){e=e||[],r=r||0;for(var n=r;t>=WQe;)e[r++]=t&255|dye,t/=128;for(;t&GQe;)e[r++]=t&255|dye,t>>>=7;return e[r]=t|0,pye.bytes=r-n+1,e}var VQe=lL,HQe=128,hye=127;function lL(t,n){var r=0,n=n||0,i=0,o=n,s,a=t.length;do{if(o>=a)throw lL.bytes=0,new RangeError("Could not decode varint");s=t[o++],r+=i<28?(s&hye)<<i:(s&hye)*Math.pow(2,i),i+=7}while(s>=HQe);return lL.bytes=o-n,r}var ZQe=Math.pow(2,7),JQe=Math.pow(2,14),YQe=Math.pow(2,21),QQe=Math.pow(2,28),XQe=Math.pow(2,35),eXe=Math.pow(2,42),tXe=Math.pow(2,49),rXe=Math.pow(2,56),nXe=Math.pow(2,63),iXe=function(t){return t<ZQe?1:t<JQe?2:t<YQe?3:t<QQe?4:t<XQe?5:t<eXe?6:t<tXe?7:t<rXe?8:t<nXe?9:10},oXe={encode:zQe,decode:VQe,encodingLength:iXe},sXe=oXe,W3=sXe;var dL=(t,e=0)=>[W3.decode(t,e),W3.decode.bytes],hL=(t,e,r=0)=>(W3.encode(t,e,r),e),pL=t=>W3.encodingLength(t);var mL=(t,e)=>{let r=e.byteLength,n=pL(t),i=n+pL(r),o=new Uint8Array(i+r);return hL(t,o,0),hL(r,o,n),o.set(e,i),new uA(t,r,e,o)},mye=t=>{let e=oL(t),[r,n]=dL(e),[i,o]=dL(e.subarray(n)),s=e.subarray(n+o);if(s.byteLength!==i)throw new Error("Incorrect length");return new uA(r,i,s,e)};var uA=class{constructor(e,r,n,i){this.code=e,this.size=r,this.digest=n,this.bytes=i}};E();E();var gL=({name:t,code:e,encode:r})=>new yL(t,e,r),yL=class{constructor(e,r,n){this.name=e,this.code=r,this.encode=n}digest(e){if(e instanceof Uint8Array){let r=this.encode(e);return r instanceof Uint8Array?mL(this.code,r):r.then(n=>mL(this.code,n))}else throw Error("Unknown type, must be binary type")}};var yye=t=>async e=>new Uint8Array(await crypto.subtle.digest(t,e)),lA=gL({name:"sha2-256",code:18,encode:yye("SHA-256")}),p9t=gL({name:"sha2-512",code:19,encode:yye("SHA-512")});var V3=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(p){try{m(n.next(p))}catch(w){s(w)}}function d(p){try{m(n.throw(p))}catch(w){s(w)}}function m(p){p.done?o(p.value):i(p.value).then(a,d)}m((n=n.apply(t,e||[])).next())})},yi=class{static hash(e,r){return V3(this,void 0,void 0,function*(){let n;switch(r){case 18:n=(yield lA.digest(e)).bytes;break;default:throw new Sn(Vn.MultihashUnsupportedHashAlgorithm,`Hash algorithm defined in multihash code ${r} is not supported.`)}return n})}static hashAsNonMultihashBytes(e,r){return V3(this,void 0,void 0,function*(){let n;switch(r){case 18:n=yield lA.encode(e);break;default:throw new Sn(Vn.MultihashUnsupportedHashAlgorithm,`Hash algorithm defined in multihash code ${r} is not supported.`)}return n})}static canonicalizeThenHashThenEncode(e,r){return V3(this,void 0,void 0,function*(){let n=$a.canonicalizeAsBytes(e);return yield yi.hashThenEncode(n,r)})}static canonicalizeThenDoubleHashThenEncode(e,r){return V3(this,void 0,void 0,function*(){let n=$a.canonicalizeAsBytes(e),i=yield yi.hashAsNonMultihashBytes(n,r);return yield yi.hashThenEncode(i,r)})}static hashThenEncode(e,r){return V3(this,void 0,void 0,function*(){let n=yield yi.hash(e,r);return Uo.encode(n)})}static validateEncodedHashComputedUsingSupportedHashAlgorithm(e,r){let n,i=Uo.decodeAsBytes(e,r);try{n=mye(i)}catch{throw new Sn(Vn.MultihashStringNotAMultihash,`Given ${r} string '${e}' is not a multihash after decoding.`)}let o=ga.hashAlgorithmInMultihashCode;if(o!==n.code)throw new Sn(Vn.MultihashUnsupportedHashAlgorithm,`Given ${r} uses unsupported multihash algorithm with code ${n.code}, should use ${o} or change IonSdkConfig to desired hashing algorithm.`)}};E();var vL;(function(t){t.Create="create",t.Update="update",t.Deactivate="deactivate",t.Recover="recover"})(vL||(vL={}));var H3=vL;E();var bL;(function(t){t.Replace="replace",t.AddPublicKeys="add-public-keys",t.RemovePublicKeys="remove-public-keys",t.AddServices="add-services",t.RemoveServices="remove-services"})(bL||(bL={}));var dg=bL;var dA=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(p){try{m(n.next(p))}catch(w){s(w)}}function d(p){try{m(n.throw(p))}catch(w){s(w)}}function m(p){p.done?o(p.value):i(p.value).then(a,d)}m((n=n.apply(t,e||[])).next())})},to=class{static createCreateRequest(e){return dA(this,void 0,void 0,function*(){let r=e.recoveryKey,n=e.updateKey,i=e.document.publicKeys,o=e.document.services;wo.validateEs256kOperationKey(r,gc.Public),wo.validateEs256kOperationKey(n,gc.Public),to.validateDidDocumentKeys(i),to.validateServices(o);let s=ga.hashAlgorithmInMultihashCode,a=[{action:dg.Replace,document:e.document}],d={updateCommitment:yield yi.canonicalizeThenDoubleHashThenEncode(n,s),patches:a};to.validateDeltaSize(d);let p={deltaHash:yield yi.canonicalizeThenHashThenEncode(d,s),recoveryCommitment:yield yi.canonicalizeThenDoubleHashThenEncode(r,s)};return{type:H3.Create,suffixData:p,delta:d}})}static createDeactivateRequest(e){return dA(this,void 0,void 0,function*(){to.validateDidSuffix(e.didSuffix),wo.validateEs256kOperationKey(e.recoveryPublicKey,gc.Public);let r=ga.hashAlgorithmInMultihashCode,n=yield yi.canonicalizeThenHashThenEncode(e.recoveryPublicKey,r),i={didSuffix:e.didSuffix,recoveryKey:e.recoveryPublicKey},o=yield e.signer.sign({alg:"ES256K"},i);return{type:H3.Deactivate,didSuffix:e.didSuffix,revealValue:n,signedData:o}})}static createRecoverRequest(e){return dA(this,void 0,void 0,function*(){to.validateDidSuffix(e.didSuffix),wo.validateEs256kOperationKey(e.recoveryPublicKey,gc.Public),wo.validateEs256kOperationKey(e.nextRecoveryPublicKey,gc.Public),wo.validateEs256kOperationKey(e.nextUpdatePublicKey,gc.Public),to.validateDidDocumentKeys(e.document.publicKeys),to.validateServices(e.document.services);let r=ga.hashAlgorithmInMultihashCode,n=yield yi.canonicalizeThenHashThenEncode(e.recoveryPublicKey,r),i=[{action:dg.Replace,document:e.document}],o=yield yi.canonicalizeThenDoubleHashThenEncode(e.nextUpdatePublicKey,r),s={patches:i,updateCommitment:o},a=yield yi.canonicalizeThenHashThenEncode(s,r),m={recoveryCommitment:yield yi.canonicalizeThenDoubleHashThenEncode(e.nextRecoveryPublicKey,r),recoveryKey:e.recoveryPublicKey,deltaHash:a},p=yield e.signer.sign({alg:"ES256K"},m);return{type:H3.Recover,didSuffix:e.didSuffix,revealValue:n,delta:s,signedData:p}})}static createUpdateRequest(e){return dA(this,void 0,void 0,function*(){if(to.validateDidSuffix(e.didSuffix),wo.validateEs256kOperationKey(e.updatePublicKey,gc.Public),wo.validateEs256kOperationKey(e.nextUpdatePublicKey,gc.Public),to.validateServices(e.servicesToAdd),to.validateDidDocumentKeys(e.publicKeysToAdd),e.idsOfServicesToRemove!==void 0)for(let M of e.idsOfServicesToRemove)wo.validateId(M);if(e.idsOfPublicKeysToRemove!==void 0)for(let M of e.idsOfPublicKeysToRemove)wo.validateId(M);let r=[],n=e.servicesToAdd;if(n!==void 0&&n.length>0){let M={action:dg.AddServices,services:n};r.push(M)}let i=e.idsOfServicesToRemove;if(i!==void 0&&i.length>0){let M={action:dg.RemoveServices,ids:i};r.push(M)}let o=e.publicKeysToAdd;if(o!==void 0&&o.length>0){let M={action:dg.AddPublicKeys,publicKeys:o};r.push(M)}let s=e.idsOfPublicKeysToRemove;if(s!==void 0&&s.length>0){let M={action:dg.RemovePublicKeys,ids:s};r.push(M)}let a=ga.hashAlgorithmInMultihashCode,d=yield yi.canonicalizeThenHashThenEncode(e.updatePublicKey,a),m=yield yi.canonicalizeThenDoubleHashThenEncode(e.nextUpdatePublicKey,a),p={patches:r,updateCommitment:m},w=yield yi.canonicalizeThenHashThenEncode(p,a),P={updateKey:e.updatePublicKey,deltaHash:w},S=yield e.signer.sign({alg:"ES256K"},P);return{type:H3.Update,didSuffix:e.didSuffix,revealValue:d,delta:p,signedData:S}})}static validateDidSuffix(e){yi.validateEncodedHashComputedUsingSupportedHashAlgorithm(e,"didSuffix")}static validateDidDocumentKeys(e){if(e===void 0)return;let r=new Set;for(let n of e){if(Array.isArray(n.publicKeyJwk))throw new Sn(Vn.DidDocumentPublicKeyMissingOrIncorrectType,"DID Document key 'publicKeyJwk' property is not a non-array object.");if(wo.validateId(n.id),r.has(n.id))throw new Sn(Vn.DidDocumentPublicKeyIdDuplicated,`DID Document key with ID '${n.id}' already exists.`);r.add(n.id),wo.validatePublicKeyPurposes(n.purposes)}}static validateServices(e){if(e!==void 0&&e.length!==0){let r=new Set;for(let n of e){if(to.validateService(n),r.has(n.id))throw new Sn(Vn.DidDocumentServiceIdDuplicated,"Service id has to be unique");r.add(n.id)}}}static validateService(e){wo.validateId(e.id);let r=30;if(e.type.length>r){let n=`Service endpoint type length ${e.type.length} exceeds max allowed length of ${r}.`;throw new Sn(Vn.ServiceTypeTooLong,n)}if(Array.isArray(e.serviceEndpoint)){let n="Service endpoint value cannot be an array.";throw new Sn(Vn.ServiceEndpointCannotBeAnArray,n)}if(typeof e.serviceEndpoint=="string"&&gye.parse(e.serviceEndpoint).error!==void 0)throw new Sn(Vn.ServiceEndpointStringNotValidUri,`Service endpoint string '${e.serviceEndpoint}' is not a URI.`)}static validateDeltaSize(e){let r=$a.canonicalizeAsBytes(e);if(r.length>ga.maxCanonicalizedDeltaSizeInBytes){let n=`Delta of ${r.length} bytes exceeded limit of ${ga.maxCanonicalizedDeltaSizeInBytes} bytes.`;throw new Sn(Vn.DeltaExceedsMaximumSize,n)}}};var vye=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(p){try{m(n.next(p))}catch(w){s(w)}}function d(p){try{m(n.throw(p))}catch(w){s(w)}}function m(p){p.done?o(p.value):i(p.value).then(a,d)}m((n=n.apply(t,e||[])).next())})},w0=class{static createLongFormDid(e){return vye(this,void 0,void 0,function*(){let r=yield to.createCreateRequest(e),n=yield w0.computeDidUniqueSuffix(r.suffixData),i;ga.network===void 0||ga.network==="mainnet"?i=`did:ion:${n}`:i=`did:ion:${ga.network}:${n}`;let o={suffixData:r.suffixData,delta:r.delta},s=$a.canonicalizeAsBytes(o),a=Uo.encode(s);return`${i}:${a}`})}static computeDidUniqueSuffix(e){return vye(this,void 0,void 0,function*(){let r=$a.canonicalizeAsBytes(e),n=yield yi.hash(r,ga.hashAlgorithmInMultihashCode);return Uo.encode(n)})}};E();E();var bye;(function(t){t.Mainnet="mainnet",t.Testnet="test"})(bye||(bye={}));E();var wye;(function(t){t.Authentication="authentication",t.AssertionMethod="assertionMethod",t.CapabilityInvocation="capabilityInvocation",t.CapabilityDelegation="capabilityDelegation",t.KeyAgreement="keyAgreement"})(wye||(wye={}));E();var _0=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(p){try{m(n.next(p))}catch(w){s(w)}}function d(p){try{m(n.throw(p))}catch(w){s(w)}}function m(p){p.done?o(p.value):i(p.value).then(a,d)}m((n=n.apply(t,e||[])).next())})},Jl;(function(t){t.Ed25519="Ed25519",t.secp256k1="secp256k1",t.secp256r1="secp256r1",t.X25519="X25519"})(Jl||(Jl={}));var fXe={Ed25519:Jl.Ed25519,ES256K:Jl.secp256k1,ES256:Jl.secp256r1,"P-256":Jl.secp256r1,secp256k1:Jl.secp256k1,secp256r1:Jl.secp256r1},_ye="https://ion.tbd.engineering",Yl=class extends yf{static create(){return _0(this,arguments,void 0,function*({keyManager:e=new Ks,options:r={}}={}){var n,i,o,s,a,d,m;if(!((n=r.verificationMethods)===null||n===void 0)&&n.some(L=>!(L.algorithm in fXe)))throw new Error("One or more verification method algorithms are not supported");let p=(i=r.verificationMethods)===null||i===void 0?void 0:i.filter(L=>"id"in L).map(L=>L.id);if(p&&p.length!==new Set(p).size)throw new Error("One or more verification method IDs are not unique");if(!((o=r.services)===null||o===void 0)&&o.some(L=>!L.id||!L.type||!L.serviceEndpoint))throw new Error("One or more services are missing required properties");let w={algorithm:"Ed25519",purposes:["authentication","assertionMethod","capabilityDelegation","capabilityInvocation"]},P=[];for(let L of(s=r.verificationMethods)!==null&&s!==void 0?s:[w]){let U=yield e.generateKey({algorithm:L.algorithm}),F=yield e.getPublicKey({keyUri:U});P.push({id:L.id,publicKeyJwk:F,purposes:(a=L.purposes)!==null&&a!==void 0?a:["authentication","assertionMethod","capabilityDelegation","capabilityInvocation"]})}let S=yield e.generateKey({algorithm:Jl.secp256k1}),M=yield e.getPublicKey({keyUri:S}),A=yield e.generateKey({algorithm:Jl.secp256k1}),B=yield e.getPublicKey({keyUri:A}),I=yield La.computeLongFormDidUri({recoveryKey:M,updateKey:B,services:(d=r.services)!==null&&d!==void 0?d:[],verificationMethods:P}),{didDocument:C,didResolutionMetadata:k}=yield Yl.resolve(I,{gatewayUri:r.gatewayUri});if(C===null)throw new Error(`Unable to resolve DID during creation: ${k?.error}`);let q=new Gs({uri:I,document:C,metadata:{published:!1,canonicalId:I.split(":",3).join(":"),recoveryKey:M,updateKey:B},keyManager:e});if(!((m=r.publish)!==null&&m!==void 0)||m){let L=yield Yl.publish({did:q,gatewayUri:r.gatewayUri});q.metadata=L.didDocumentMetadata}return q})}static getSigningMethod(e){return _0(this,arguments,void 0,function*({didDocument:r,methodId:n}){var i;let o=cr.parse(r.id);if(o&&o.method!==this.methodName)throw new ft(ut.MethodNotSupported,`Method not supported: ${o.method}`);let s=(i=r.verificationMethod)===null||i===void 0?void 0:i.find(a=>{var d;return a.id===(n??((d=r.assertionMethod)===null||d===void 0?void 0:d[0]))});if(!(s&&s.publicKeyJwk))throw new ft(ut.InternalError,"A verification method intended for signing could not be determined from the DID Document");return s})}static import(e){return _0(this,arguments,void 0,function*({portableDid:r,keyManager:n=new Ks}){let i=cr.parse(r.uri);if(i?.method!==Yl.methodName)throw new ft(ut.MethodNotSupported,"Method not supported");return yield Gs.import({portableDid:r,keyManager:n})})}static publish(e){return _0(this,arguments,void 0,function*({did:r,gatewayUri:n=_ye}){var i,o,s;let a=(o=(i=r.document.verificationMethod)===null||i===void 0?void 0:i.map(p=>({id:p.id,publicKeyJwk:p.publicKeyJwk,purposes:U$({didDocument:r.document,methodId:p.id})})))!==null&&o!==void 0?o:[],d=yield La.createIonDocument({services:(s=r.document.service)!==null&&s!==void 0?s:[],verificationMethods:a}),m=yield La.constructCreateRequest({ionDocument:d,recoveryKey:r.metadata.recoveryKey,updateKey:r.metadata.updateKey});try{let p=La.appendPathToUrl({baseUrl:n,path:"/operations"}),w=yield fetch(p,{method:"POST",mode:"cors",headers:{"Content-Type":"application/json"},body:JSON.stringify(m)});return{didDocument:r.document,didDocumentMetadata:Object.assign(Object.assign({},r.metadata),{published:w.ok}),didRegistrationMetadata:{}}}catch{return{didDocument:null,didDocumentMetadata:{published:!1},didRegistrationMetadata:{error:ut.InternalError,errorMessage:`Failed to publish DID document for: ${r.uri}`}}}})}static resolve(e){return _0(this,arguments,void 0,function*(r,n={}){var i,o;let s=cr.parse(r);if(!s)return Object.assign(Object.assign({},pi),{didResolutionMetadata:{error:"invalidDid"}});if(s.method!==Yl.methodName)return Object.assign(Object.assign({},pi),{didResolutionMetadata:{error:"methodNotSupported"}});let a=(i=n?.gatewayUri)!==null&&i!==void 0?i:_ye;try{let d=La.appendPathToUrl({baseUrl:a,path:`/identifiers/${r}`}),m=yield fetch(d);if(!m.ok)throw new ft(ut.NotFound,`Unable to find DID document for: ${r}`);let{didDocument:p,didDocumentMetadata:w}=yield m.json();return Object.assign(Object.assign(Object.assign({},pi),p&&{didDocument:p}),{didDocumentMetadata:Object.assign({published:(o=w?.method)===null||o===void 0?void 0:o.published},w)})}catch(d){if(!(d instanceof ft))throw new Error(d);return Object.assign(Object.assign({},pi),{didResolutionMetadata:Object.assign({error:d.code},d.message&&{errorMessage:d.message})})}})}};Yl.methodName="ion";var La=class{static appendPathToUrl({baseUrl:e,path:r}){let n=new URL(e);return n.pathname=n.pathname.endsWith("/")?n.pathname:n.pathname+"/",n.pathname+=r.startsWith("/")?r.substring(1):r,n.toString()}static computeLongFormDidUri(e){return _0(this,arguments,void 0,function*({recoveryKey:r,updateKey:n,services:i,verificationMethods:o}){let s=yield La.createIonDocument({services:i,verificationMethods:o}),a=La.normalizeJwk(r),d=La.normalizeJwk(n);return yield w0.createLongFormDid({document:s,recoveryKey:a,updateKey:d})})}static constructCreateRequest(e){return _0(this,arguments,void 0,function*({ionDocument:r,recoveryKey:n,updateKey:i}){return yield to.createCreateRequest({document:r,recoveryKey:La.normalizeJwk(n),updateKey:La.normalizeJwk(i)})})}static createIonDocument(e){return _0(this,arguments,void 0,function*({services:r,verificationMethods:n}){var i,o;let s=[];for(let m of n){let p=(o=(i=m.id)!==null&&i!==void 0?i:m.publicKeyJwk.kid)!==null&&o!==void 0?o:yield rr({jwk:m.publicKeyJwk});p=`${p.split("#").pop()}`;let w={id:p,publicKeyJwk:La.normalizeJwk(m.publicKeyJwk),purposes:m.purposes,type:"JsonWebKey2020"};s.push(w)}let a=r.map(m=>Object.assign(Object.assign({},m),{id:`${m.id.split("#").pop()}`}));return{publicKeys:s,services:a}})}static normalizeJwk(e){let r=e.kty,n;if(r==="EC")n={crv:e.crv,kty:e.kty,x:e.x,y:e.y};else if(r==="oct")n={k:e.k,kty:e.kty};else if(r==="OKP")n={crv:e.crv,kty:e.kty,x:e.x};else if(r==="RSA")n={e:e.e,kty:e.kty,n:e.n};else throw new Error(`Unsupported key type: ${r}`);return n}};E();var hA=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(p){try{m(n.next(p))}catch(w){s(w)}}function d(p){try{m(n.throw(p))}catch(w){s(w)}}function m(p){p.done?o(p.value):i(p.value).then(a,d)}m((n=n.apply(t,e||[])).next())})},x0=class extends yf{static create(){return hA(this,arguments,void 0,function*({keyManager:e=new Ks,options:r={}}={}){var n,i,o,s;if(r.algorithm&&r.verificationMethods)throw new Error("The 'algorithm' and 'verificationMethods' options are mutually exclusive");if(r.verificationMethods&&r.verificationMethods.length!==1)throw new Error("The 'verificationMethods' option must contain exactly one entry");let a=(s=(n=r.algorithm)!==null&&n!==void 0?n:(o=(i=r.verificationMethods)===null||i===void 0?void 0:i[0])===null||o===void 0?void 0:o.algorithm)!==null&&s!==void 0?s:"Ed25519",d=yield e.generateKey({algorithm:a}),m=yield e.getPublicKey({keyUri:d}),p=We.object(m).toBase64Url(),w=`did:${x0.methodName}:${p}`,S=(yield x0.resolve(w)).didDocument;return new Gs({uri:w,document:S,metadata:{},keyManager:e})})}static getSigningMethod(e){return hA(this,arguments,void 0,function*({didDocument:r}){var n;let i=cr.parse(r.id);if(i&&i.method!==this.methodName)throw new ft(ut.MethodNotSupported,`Method not supported: ${i.method}`);let[o]=(n=r.verificationMethod)!==null&&n!==void 0?n:[];if(!(o&&o.publicKeyJwk))throw new ft(ut.InternalError,"A verification method intended for signing could not be determined from the DID Document");return o})}static import(e){return hA(this,arguments,void 0,function*({portableDid:r,keyManager:n=new Ks}){let i=cr.parse(r.uri);if(i?.method!==x0.methodName)throw new ft(ut.MethodNotSupported,"Method not supported");let o=yield Gs.import({portableDid:r,keyManager:n});if(o.document.verificationMethod.length!==1)throw new ft(ut.InvalidDidDocument,"DID document must contain exactly one verification method");return o})}static resolve(e,r){return hA(this,void 0,void 0,function*(){let n=cr.parse(e),i;try{i=We.base64Url(n.id).toObject()}catch{}if(!n||!i)return Object.assign(Object.assign({},pi),{didResolutionMetadata:{error:"invalidDid"}});if(n.method!==x0.methodName)return Object.assign(Object.assign({},pi),{didResolutionMetadata:{error:"methodNotSupported"}});let o={"@context":["https://www.w3.org/ns/did/v1"],id:n.uri},s=`${o.id}#0`;switch(o.verificationMethod=[{id:s,type:"JsonWebKey",controller:o.id,publicKeyJwk:i}],o.authentication=[s],o.assertionMethod=[s],o.capabilityInvocation=[s],o.capabilityDelegation=[s],o.keyAgreement=[s],i.use){case"sig":{delete o.keyAgreement;break}case"enc":{delete o.authentication,delete o.assertionMethod,delete o.capabilityInvocation,delete o.capabilityDelegation;break}}return Object.assign(Object.assign({},pi),{didDocument:o})})}};x0.methodName="jwk";E();var bu=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(p){try{m(n.next(p))}catch(w){s(w)}}function d(p){try{m(n.throw(p))}catch(w){s(w)}}function m(p){p.done?o(p.value):i(p.value).then(a,d)}m((n=n.apply(t,e||[])).next())})},Mh;(function(t){t.Ed25519="Ed25519",t.secp256k1="secp256k1",t.secp256r1="secp256r1",t.X25519="X25519"})(Mh||(Mh={}));var wL={Ed25519VerificationKey2020:"https://w3id.org/security/suites/ed25519-2020/v1",JsonWebKey2020:"https://w3id.org/security/suites/jws-2020/v1",X25519KeyAgreementKey2020:"https://w3id.org/security/suites/x25519-2020/v1"},uXe={Ed25519:Mh.Ed25519,ES256K:Mh.secp256k1,ES256:Mh.secp256r1,"P-256":Mh.secp256r1,secp256k1:Mh.secp256k1,secp256r1:Mh.secp256r1,X25519:Mh.X25519},vs=class extends yf{static create(){return bu(this,arguments,void 0,function*({keyManager:e=new Ks,options:r={}}={}){var n,i,o,s;if(r.algorithm&&r.verificationMethods)throw new Error("The 'algorithm' and 'verificationMethods' options are mutually exclusive");if(r.verificationMethods&&r.verificationMethods.length!==1)throw new Error("The 'verificationMethods' option must contain exactly one entry");let a=(s=(n=r.algorithm)!==null&&n!==void 0?n:(o=(i=r.verificationMethods)===null||i===void 0?void 0:i[0])===null||o===void 0?void 0:o.algorithm)!==null&&s!==void 0?s:"Ed25519",d=yield e.generateKey({algorithm:a}),m=yield e.getPublicKey({keyUri:d}),p=yield ro.publicKeyToMultibaseId({publicKey:m}),w=`did:${vs.methodName}:${p}`,S=(yield vs.resolve(w,r)).didDocument;return new Gs({uri:w,document:S,metadata:{},keyManager:e})})}static getSigningMethod(e){return bu(this,arguments,void 0,function*({didDocument:r}){var n;let i=cr.parse(r.id);if(i&&i.method!==this.methodName)throw new ft(ut.MethodNotSupported,`Method not supported: ${i.method}`);let[o]=r.assertionMethod||[],s=(n=r.verificationMethod)===null||n===void 0?void 0:n.find(a=>a.id===o);if(!(s&&s.publicKeyJwk))throw new ft(ut.InternalError,"A verification method intended for signing could not be determined from the DID Document");return s})}static import(e){return bu(this,arguments,void 0,function*({portableDid:r,keyManager:n=new Ks}){let i=cr.parse(r.uri);if(i?.method!==vs.methodName)throw new ft(ut.MethodNotSupported,"Method not supported");let o=yield Gs.import({portableDid:r,keyManager:n});if(o.document.verificationMethod.length!==1)throw new ft(ut.InvalidDidDocument,"DID document must contain exactly one verification method");return o})}static resolve(e,r){return bu(this,void 0,void 0,function*(){try{let n=yield vs.createDocument({didUri:e,options:r});return Object.assign(Object.assign({},pi),{didDocument:n})}catch(n){if(!(n instanceof ft))throw new Error(n);return Object.assign(Object.assign({},pi),{didResolutionMetadata:Object.assign({error:n.code},n.message&&{errorMessage:n.message})})}})}static createDocument(e){return bu(this,arguments,void 0,function*({didUri:r,options:n={}}){let{defaultContext:i="https://www.w3.org/ns/did/v1",enableEncryptionKeyDerivation:o=!1,enableExperimentalPublicKeyTypes:s=!1,publicKeyFormat:a="JsonWebKey2020"}=n,d={id:""},m=cr.parse(r);if(!m)throw new ft(ut.InvalidDid,`Invalid DID URI: ${r}`);let p=m.id;if(m.method!==vs.methodName)throw new ft(ut.MethodNotSupported,`Method not supported: ${m.method}`);if(!vs.validateIdentifier(m))throw new ft(ut.InvalidDid,`Invalid DID URI: ${r}`);let w=yield vs.createSignatureMethod({didUri:r,multibaseValue:p,options:{enableExperimentalPublicKeyTypes:s,publicKeyFormat:a}});if(d.id=m.uri,d.verificationMethod=[w],d.authentication=[w.id],d.assertionMethod=[w.id],d.capabilityInvocation=[w.id],d.capabilityDelegation=[w.id],o===!0){let M=a==="Ed25519VerificationKey2020"?"X25519KeyAgreementKey2020":"JsonWebKey2020",A=yield this.createEncryptionMethod({didUri:r,multibaseValue:p,options:{enableExperimentalPublicKeyTypes:s,publicKeyFormat:M}});d.verificationMethod.push(A),d.keyAgreement=[A.id]}let P=[i];return L$({didDocument:d}).forEach(M=>{let A=wL[M];P.push(A)}),d["@context"]=P,d})}static createEncryptionMethod(e){return bu(this,arguments,void 0,function*({didUri:r,multibaseValue:n,options:i}){let{enableExperimentalPublicKeyTypes:o,publicKeyFormat:s}=i,a={id:"",type:"",controller:""},{keyBytes:d,multicodecCode:m}=yield vs.deriveEncryptionKey({multibaseValue:n}),p=d.byteLength,w=ro.MULTICODEC_PUBLIC_KEY_LENGTH[m];if(p!==w)throw new ft(ut.InvalidPublicKeyLength,`Expected ${p} bytes. Actual: ${w}`);let P=FP({keyBytes:d,multicodecCode:m});a.id=`${r}#${P}`;try{new URL(a.id)}catch{throw new ft(ut.InvalidDidUrl,"Verification Method ID is not a valid DID URL.")}if(!(s in wL))throw new ft(ut.UnsupportedPublicKeyType,`Unsupported format: ${s}`);if(o===!1&&!["Multikey","JsonWebKey2020","X25519KeyAgreementKey2020"].includes(s))throw new ft(ut.InvalidPublicKeyType,`Specified '${s}' without setting enableExperimentalPublicKeyTypes to true.`);if(a.type=s,a.controller=r,s==="X25519KeyAgreementKey2020"&&(a.publicKeyMultibase=P),s==="JsonWebKey2020"){let{crv:M}=yield ro.multicodecToJwk({code:m});a.publicKeyJwk=yield ro.keyConverter(M).bytesToPublicKey({publicKeyBytes:d})}return a})}static createSignatureMethod(e){return bu(this,arguments,void 0,function*({didUri:r,multibaseValue:n,options:i}){let{enableExperimentalPublicKeyTypes:o,publicKeyFormat:s}=i,a={id:"",type:"",controller:""},{keyBytes:d,multicodecCode:m,multicodecName:p}=zP({multibaseKeyId:n}),w=d.byteLength,P=ro.MULTICODEC_PUBLIC_KEY_LENGTH[m];if(w!==P)throw new ft(ut.InvalidPublicKeyLength,`Expected ${w} bytes. Actual: ${P}`);let S=!1;switch(p){case"secp256k1-pub":S=yield En.validatePublicKey({publicKeyBytes:d});break;case"ed25519-pub":S=yield Bn.validatePublicKey({publicKeyBytes:d});break;case"x25519-pub":S=!0;break}if(!S)throw new ft(ut.InvalidPublicKey,"Invalid public key detected.");a.id=`${r}#${n}`;try{new URL(a.id)}catch{throw new ft(ut.InvalidDidUrl,"Verification Method ID is not a valid DID URL.")}if(!(s in wL))throw new ft(ut.UnsupportedPublicKeyType,`Unsupported format: ${s}`);if(o===!1&&!["Multikey","JsonWebKey2020","Ed25519VerificationKey2020"].includes(s))throw new ft(ut.InvalidPublicKeyType,`Specified '${s}' without setting enableExperimentalPublicKeyTypes to true.`);if(a.type=s,a.controller=r,s==="Ed25519VerificationKey2020"&&(a.publicKeyMultibase=n),s==="JsonWebKey2020"){let{crv:A}=yield ro.multicodecToJwk({code:m});a.publicKeyJwk=yield ro.keyConverter(A).bytesToPublicKey({publicKeyBytes:d})}return a})}static deriveEncryptionKey(e){return bu(this,arguments,void 0,function*({multibaseValue:r}){let n={keyBytes:new Uint8Array,multicodecCode:0},{keyBytes:i,multicodecCode:o}=zP({multibaseKeyId:r});if(o===237){let s=yield ro.keyConverter("Ed25519").bytesToPublicKey({publicKeyBytes:i}),a=yield Bn.convertPublicKeyToX25519({publicKey:s});n={keyBytes:yield ro.keyConverter("Ed25519").publicKeyToBytes({publicKey:a}),multicodecCode:236}}return n})}static validateIdentifier(e){let{method:r,id:n}=e,[i]=e.uri.split(":",1);return i==="did"&&r==="key"&&Number("1")>0&&ww(n)==="String"&&n.startsWith("z")}};vs.methodName="key";var ro=class{static jwkToMulticodec(e){return bu(this,arguments,void 0,function*({jwk:r}){let n=[];r.crv&&(n.push(r.crv),r.d?n.push("private"):n.push("public"));let i=n.join(":"),o=ro.JWK_TO_MULTICODEC[i];if(o===void 0)throw new Error(`Unsupported JWK to Multicodec conversion: '${i}'`);return{code:ii.getCodeFromName({name:o}),name:o}})}static keyCompressor(e){let n={"P-256":On.compressPublicKey,secp256k1:En.compressPublicKey}[e];if(!n)throw new ft(ut.InvalidPublicKeyType,`Unsupported curve: ${e}`);return n}static keyConverter(e){let n={Ed25519:Bn,"P-256":On,secp256k1:En,X25519:yu}[e];if(!n)throw new ft(ut.InvalidPublicKeyType,`Unsupported curve: ${e}`);return n}static multicodecToJwk(e){return bu(this,arguments,void 0,function*({code:r,name:n}){if(!(n?!r:r))throw new Error("Either 'name' or 'code' must be defined, but not both.");n=n===void 0?ii.getNameFromCode({code:r}):n;let i=n,o=ro.MULTICODEC_TO_JWK[i];if(o===void 0)throw new Error("Unsupported Multicodec to JWK conversion");return Object.assign({},o)})}static publicKeyToMultibaseId(e){return bu(this,arguments,void 0,function*({publicKey:r}){var n;if(!(r?.crv&&r.crv in uXe))throw new ft(ut.InvalidPublicKeyType,`Public key contains an unsupported key type: ${(n=r?.crv)!==null&&n!==void 0?n:"undefined"}`);let i=yield ro.keyConverter(r.crv).publicKeyToBytes({publicKey:r});/^(secp256k1|P-256|P-384|P-521)$/.test(r.crv)&&(i=yield ro.keyCompressor(r.crv)({publicKeyBytes:i}));let{name:o}=yield ro.jwkToMulticodec({jwk:r});return FP({keyBytes:i,multicodecName:o})})}};ro.JWK_TO_MULTICODEC={"Ed25519:public":"ed25519-pub","Ed25519:private":"ed25519-priv","secp256k1:public":"secp256k1-pub","secp256k1:private":"secp256k1-priv","X25519:public":"x25519-pub","X25519:private":"x25519-priv"};ro.MULTICODEC_PUBLIC_KEY_LENGTH={231:33,236:32,237:32};ro.MULTICODEC_TO_JWK={"ed25519-pub":{crv:"Ed25519",kty:"OKP",x:""},"ed25519-priv":{crv:"Ed25519",kty:"OKP",x:"",d:""},"secp256k1-pub":{crv:"secp256k1",kty:"EC",x:"",y:""},"secp256k1-priv":{crv:"secp256k1",kty:"EC",x:"",y:"",d:""},"x25519-pub":{crv:"X25519",kty:"OKP",x:""},"x25519-priv":{crv:"X25519",kty:"OKP",x:"",d:""}};E();var lXe=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(p){try{m(n.next(p))}catch(w){s(w)}}function d(p){try{m(n.throw(p))}catch(w){s(w)}}function m(p){p.done?o(p.value):i(p.value).then(a,d)}m((n=n.apply(t,e||[])).next())})},Z3=class extends yf{static resolve(e,r){return lXe(this,void 0,void 0,function*(){let n=cr.parse(e);if(!n)return Object.assign(Object.assign({},pi),{didResolutionMetadata:{error:"invalidDid"}});if(n.method!==Z3.methodName)return Object.assign(Object.assign({},pi),{didResolutionMetadata:{error:"methodNotSupported"}});let i=`https://${n.id.replace(/:/g,"/")}`;i=decodeURIComponent(i);let o=n.id.includes(":")?`${i}/did.json`:`${i}/.well-known/did.json`;try{let s=yield fetch(o);if(!s.ok)throw new Error("HTTP error status code returned");let a=yield s.json();return Object.assign(Object.assign({},pi),{didDocument:a})}catch{return Object.assign(Object.assign({},pi),{didResolutionMetadata:{error:"notFound"}})}})}};Z3.methodName="web";E();var Pye=or(Eye(),1),Aye=or(Mye(),1),gXe=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(p){try{m(n.next(p))}catch(w){s(w)}}function d(p){try{m(n.throw(p))}catch(w){s(w)}}function m(p){p.done?o(p.value):i(p.value).then(a,d)}m((n=n.apply(t,e||[])).next())})},mA=class{constructor({db:e,location:r="DATA/DID_RESOLVERCACHE",ttl:n="15m"}={}){this.cache=e??new Aye.Level(r),this.ttl=(0,Pye.default)(n)}get(e){return gXe(this,void 0,void 0,function*(){try{let r=yield this.cache.get(e),n=JSON.parse(r);if(Date.now()>=n.ttlMillis){this.cache.nextTick(()=>this.cache.del(e));return}else return n.value}catch(r){if(r.notFound)return;throw r}})}set(e,r){let n={ttlMillis:Date.now()+this.ttl,value:r},i=JSON.stringify(n);return this.cache.put(e,i)}delete(e){return this.cache.del(e)}clear(){return this.cache.clear()}close(){return this.cache.close()}};E();var Tye={get:function(t){return null},set:function(t,e){return null},delete:function(t){return null},clear:function(){return null},close:function(){return null}};E();var Rye=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(p){try{m(n.next(p))}catch(w){s(w)}}function d(p){try{m(n.throw(p))}catch(w){s(w)}}function m(p){p.done?o(p.value):i(p.value).then(a,d)}m((n=n.apply(t,e||[])).next())})},yA=class{constructor({cache:e,didResolvers:r}){this.didResolvers=new Map,this.cache=e||Tye;for(let n of r)this.didResolvers.set(n.methodName,n)}resolve(e,r){return Rye(this,void 0,void 0,function*(){let n=cr.parse(e);if(!n)return Object.assign(Object.assign({},pi),{didResolutionMetadata:{error:ut.InvalidDid,errorMessage:`Invalid DID URI: ${e}`}});let i=this.didResolvers.get(n.method);if(!i)return Object.assign(Object.assign({},pi),{didResolutionMetadata:{error:ut.MethodNotSupported,errorMessage:`Method not supported: ${n.method}`}});let o=yield this.cache.get(n.uri);if(o)return o;{let s=yield i.resolve(n.uri,r);return s.didResolutionMetadata.error||(yield this.cache.set(n.uri,s)),s}})}dereference(e,r){return Rye(this,void 0,void 0,function*(){let n=cr.parse(e);if(!n)return{dereferencingMetadata:{error:ut.InvalidDidUrl},contentStream:null,contentMetadata:{}};let{didDocument:i,didResolutionMetadata:o,didDocumentMetadata:s}=yield this.resolve(n.uri);if(!i)return{dereferencingMetadata:{error:o.error},contentStream:null,contentMetadata:{}};if(!n.fragment||n.query)return{dereferencingMetadata:{contentType:"application/did+json"},contentStream:i,contentMetadata:s};let{service:a=[],verificationMethod:d=[]}=i,m=new Set([e,n.fragment,`#${n.fragment}`]),p;for(let w of d)if(m.has(w.id)){p=w;break}for(let w of a)if(m.has(w.id)){p=w;break}return p?{dereferencingMetadata:{contentType:"application/did+json"},contentStream:p,contentMetadata:o}:{dereferencingMetadata:{error:ut.NotFound},contentStream:null,contentMetadata:{}}})}};var J3=class{constructor(e){this.didResolver=e.didResolver,this.tenantGate=e.tenantGate,this.eventStream=e.eventStream,this.messageStore=e.messageStore,this.dataStore=e.dataStore,this.eventLog=e.eventLog,this.eventStream=e.eventStream,this.methodHandlers={["Events"+"Get"]:new Z8(this.didResolver,this.eventLog),["Events"+"Query"]:new J8(this.didResolver,this.eventLog),["Events"+"Subscribe"]:new Y8(this.didResolver,this.eventStream),["Messages"+"Get"]:new Q8(this.didResolver,this.messageStore,this.dataStore),["Protocols"+"Configure"]:new gw(this.didResolver,this.messageStore,this.eventLog,this.eventStream),["Protocols"+"Query"]:new k4(this.didResolver,this.messageStore,this.dataStore),["Records"+"Delete"]:new vw(this.didResolver,this.messageStore,this.dataStore,this.eventLog,this.eventStream),["Records"+"Query"]:new fu(this.didResolver,this.messageStore,this.dataStore),["Records"+"Read"]:new bw(this.didResolver,this.messageStore,this.dataStore),["Records"+"Subscribe"]:new lc(this.didResolver,this.messageStore,this.eventStream),["Records"+"Write"]:new Bl(this.didResolver,this.messageStore,this.dataStore,this.eventLog,this.eventStream)}}static async create(e){e.didResolver??=new yA({didResolvers:[Zl,Yl,vs],cache:new mA({location:"RESOLVERCACHE"})}),e.tenantGate??=new hx;let r=new J3(e);return await r.open(),r}async open(){await this.messageStore.open(),await this.dataStore.open(),await this.eventLog.open(),await this.eventStream?.open()}async close(){await this.eventStream?.close(),await this.messageStore.close(),await this.dataStore.close(),await this.eventLog.close()}async processMessage(e,r,n={}){let i=await this.validateTenant(e)??await this.validateMessageIntegrity(r);if(i!==void 0)return i;let{dataStream:o,subscriptionHandler:s}=n,a=r.descriptor.interface+r.descriptor.method;return await this.methodHandlers[a].handle({tenant:e,message:r,dataStream:o,subscriptionHandler:s})}async validateTenant(e){let r=await this.tenantGate.isActiveTenant(e);if(!r.isActiveTenant)return{status:{code:401,detail:r.detail??`DID ${e} is not an active tenant.`}}}async validateMessageIntegrity(e){let r=e?.descriptor?.interface,n=e?.descriptor?.method;if(r===void 0||n===void 0)return{status:{code:400,detail:`Both interface and method must be present, interface: ${r}, method: ${n}`}};try{Ue.validateJsonSchema(e)}catch(i){return er(i,400)}}};E();function vXe(t){return new Promise((e,r)=>{if(t.aborted){r(t.reason);return}t.addEventListener("abort",()=>{r(t.reason)})})}async function no(t,e){return e?Promise.race([t,vXe(e)]):t}E();E();E();var _L=class{static async deriveAndInjectPublicEncryptionKeys(e,r,n){let i=JSON.parse(JSON.stringify(e));async function o(d,m){for(let p in d)if(!p.startsWith("$")){let w=await ia.derivePrivateKey(m,[p]),P=await sn.getPublicJwk(w.derivedPrivateKey);d[p].$encryption={rootKeyId:r,publicKeyJwk:P},await o(d[p],w)}}let s={derivationScheme:"protocolPath",derivedPrivateKey:n,rootKeyId:r},a=await ia.derivePrivateKey(s,["protocolPath",e.protocol]);return await o(i.structure,a),i}};E();E();E();E();var Iye=or(mq(),1);async function wu(t,e){return new Iye.Level(t,{...e,keyEncoding:"utf8"})}var Ph=class{constructor(e,r){this.config={createLevelDatabase:wu,...e},this.db=r}async open(){switch(await this.createLevelDatabase(),this.db.status){case"open":return;case"opening":return new Promise(e=>{this.db.once("open",e)});case"closing":return new Promise((e,r)=>{let n=()=>{this.db.open().then(e).catch(r)};this.db.once("closed",n)});case"closed":return this.db.open()}}async close(){if(this.db)switch(this.db.status){case"open":return this.db.close();case"opening":return new Promise((e,r)=>{let n=()=>{this.db.close().then(e).catch(r)};this.db.once("open",n)});case"closing":return new Promise(e=>{this.db.once("closed",e)});case"closed":return}}async partition(e){return await this.createLevelDatabase(),new Ph(this.config,this.db.sublevel(e,{keyEncoding:"utf8",valueEncoding:this.config.valueEncoding}))}async get(e,r){r?.signal?.throwIfAborted(),await no(this.createLevelDatabase(),r?.signal);try{return await no(this.db.get(String(e)),r?.signal)}catch(n){if(n.code==="LEVEL_NOT_FOUND")return;throw n}}async has(e,r){return!!await this.get(e,r)}async*keys(e){e?.signal?.throwIfAborted(),await no(this.createLevelDatabase(),e?.signal);for await(let r of this.db.keys())e?.signal?.throwIfAborted(),yield r}async*iterator(e,r){r?.signal?.throwIfAborted(),await no(this.createLevelDatabase(),r?.signal);for await(let n of this.db.iterator(e))r?.signal?.throwIfAborted(),yield n}async put(e,r,n){return n?.signal?.throwIfAborted(),await no(this.createLevelDatabase(),n?.signal),no(this.db.put(String(e),r),n?.signal)}async delete(e,r){return r?.signal?.throwIfAborted(),await no(this.createLevelDatabase(),r?.signal),no(this.db.del(String(e)),r?.signal)}async isEmpty(e){for await(let r of this.keys(e))return!1;return!0}async clear(){await this.createLevelDatabase(),await this.db.clear(),await this.compactUnderlyingStorage()}async batch(e,r){return r?.signal?.throwIfAborted(),await no(this.createLevelDatabase(),r?.signal),no(this.db.batch(e),r?.signal)}createPartitionOperation(e,r){return{...r,sublevel:this.db.sublevel(e,{keyEncoding:"utf8",valueEncoding:this.config.valueEncoding})}}async compactUnderlyingStorage(e){e?.signal?.throwIfAborted(),await no(this.createLevelDatabase(),e?.signal);let r=this.sublevelRange;if(!r)return;let n=this.root;if(n.db.supports.additionalMethods.compactRange)return no(n.db.compactRange?.(...r),e?.signal)}get sublevelRange(){let e=this.db.prefix;if(!e)return;let r=e.slice(0,-1)+String.fromCharCode(e.charCodeAt(e.length-1)+1);return[e,r]}get root(){let e=this.db;for(let r=e.db;r&&r!==e;)e=r;return new Ph(this.config,e)}async createLevelDatabase(){this.db??=await this.config.createLevelDatabase(this.config.location,{keyEncoding:"utf8",valueEncoding:this.config.valueEncoding})}};var E0=class{constructor(e,r){this.config={createLevelDatabase:wu,...e},this.db=r??new Ph({...this.config,valueEncoding:"binary"})}async open(){return this.db.open()}async close(){return this.db.close()}async partition(e){let r=await this.db.partition(e);return new E0({...this.config,location:""},r)}async put(e,r,n){return await this.db.put(String(e),r,n),St.parse(e.toString())}async get(e,r){return await this.db.get(String(e),r)}async has(e,r){return this.db.has(String(e),r)}async delete(e,r){return this.db.delete(String(e),r)}async isEmpty(e){return this.db.isEmpty(e)}async*putMany(e,r){for await(let n of e)await this.put(n.cid,n.block,r),yield n.cid}async*getMany(e,r){for await(let n of e)yield{cid:n,block:await this.get(n,r)}}async*getAll(e){let r=this.db.iterator({keys:!0,keyEncoding:"buffer"},e);for await(let[n,i]of r)yield{cid:St.decode(n),block:i}}async*deleteMany(e,r){for await(let n of e)await this.delete(n,r),yield n}async clear(){return this.db.clear()}};E();var RA=or(Va(),1);E();function bXe(t){return t[Symbol.asyncIterator]!=null}function wXe(t){if(bXe(t))return(async()=>{let r;for await(let n of t)r=n;return r})();let e;for(let r of t)e=r;return e}var kye=wXe;E();var age=or(Va(),1);E();var Oye=or(Va(),1);var _Xe=async(t,e,r,n,i,o,s,a)=>{let d=await s.get(t,a),m=bR(d),p=m,w=r;for(;n.length>0;){let P=n[0];if(P in p){n.shift(),w=`${w}/${P}`;let S=St.asCID(p[P]);if(S!=null)return{entry:{type:"object",name:e,path:r,cid:t,node:d,depth:o,size:BigInt(d.length),content:async function*(){yield m}},next:{cid:S,name:P,path:w,toResolve:n}};p=p[P]}else throw(0,Oye.default)(new Error(`No property named ${P} found in cbor node ${t}`),"ERR_NO_PROP")}return{entry:{type:"object",name:e,path:r,cid:t,node:d,depth:o,size:BigInt(d.length),content:async function*(){yield m}}}},Bye=_Xe;E();var Dye=or(Va(),1);E();function xXe(t,e,r,n){let i=BigInt(t.length),o=BigInt(e+i);return r>=o||n<e?new Uint8Array(0):(n>=e&&n<o&&(t=t.subarray(0,Number(n-e))),r>=e&&r<o&&(t=t.subarray(Number(r-e))),t)}var pg=xXe;E();var Y3=or(Va(),1),EXe=(t,e=0,r=t)=>{let n=BigInt(t),i=BigInt(e??0),o=BigInt(r);if(o!==n&&(o=i+o),o>n&&(o=n),i<0n)throw(0,Y3.default)(new Error("Offset must be greater than or equal to 0"),"ERR_INVALID_PARAMS");if(i>n)throw(0,Y3.default)(new Error("Offset must be less than the file size"),"ERR_INVALID_PARAMS");if(o<0n)throw(0,Y3.default)(new Error("Length must be greater than or equal to 0"),"ERR_INVALID_PARAMS");if(o>n)throw(0,Y3.default)(new Error("Length must be less than the file size"),"ERR_INVALID_PARAMS");return{start:i,end:o}},t1=EXe;var SXe=t=>{async function*e(r={}){let{start:n,end:i}=t1(t.length,r.offset,r.length),o=pg(t,0n,n,i);r.onProgress?.(new Si("unixfs:exporter:progress:identity",{bytesRead:BigInt(o.byteLength),totalBytes:i-n,fileSize:BigInt(t.byteLength)})),yield o}return e},MXe=async(t,e,r,n,i,o,s,a)=>{if(n.length>0)throw(0,Dye.default)(new Error(`No link named ${r} found in raw node ${t}`),"ERR_NOT_FOUND");let d=AE(t.multihash.bytes);return{entry:{type:"identity",name:e,path:r,cid:t,content:SXe(d.digest),depth:o,size:BigInt(d.digest.length),node:d.digest}}},Cye=MXe;E();var jye=or(Va(),1);var PXe=t=>{async function*e(r={}){let{start:n,end:i}=t1(t.length,r.offset,r.length),o=pg(t,0n,n,i);r.onProgress?.(new Si("unixfs:exporter:progress:raw",{bytesRead:BigInt(o.byteLength),totalBytes:i-n,fileSize:BigInt(t.byteLength)})),yield o}return e},AXe=async(t,e,r,n,i,o,s,a)=>{if(n.length>0)throw(0,jye.default)(new Error(`No link named ${r} found in raw node ${t}`),"ERR_NOT_FOUND");let d=await s.get(t,a);return{entry:{type:"raw",name:e,path:r,cid:t,content:PXe(d),depth:o,size:BigInt(d.length),node:d}}},Nye=AXe;E();var aE=or(Va(),1);E();var TXe=async function(t){return(await l6.encode(t)).slice(0,8).reverse()},RXe=async(t,e,r)=>{await Promise.all(t.map(async n=>{if(n.Name==null)throw new Error("Unexpected Link without a Name");if(n.Name.length===2){let i=parseInt(n.Name,16);e._putObjectAt(i,new Ao({hash:r._options.hash,bits:r._options.bits},e,i));return}await r.put(n.Name.substring(2),!0)}))},qye=t=>t.toString(16).toUpperCase().padStart(2,"0").substring(0,2),IXe=t=>{let e=t.bucket,r=[];for(;e._parent!=null;)r.push(e),e=e._parent;return r.push(e),r.reverse()},$ye=async(t,e,r,n,i)=>{if(n==null){let p=p6({hashFn:TXe});n={rootBucket:p,hamtDepth:1,lastBucket:p}}await RXe(t.Links,n.lastBucket,n.rootBucket);let o=await n.rootBucket._findNewBucketAndPos(e),s=qye(o.pos),a=IXe(o);a.length>n.hamtDepth&&(n.lastBucket=a[n.hamtDepth],s=qye(n.lastBucket._posAtParent));let d=t.Links.find(p=>{if(p.Name==null)return!1;let w=p.Name.substring(0,2),P=p.Name.substring(2);return!(w!==s||P!==""&&P!==e)});if(d==null)return;if(d.Name!=null&&d.Name.substring(2)===e)return d.Hash;n.hamtDepth++;let m=await r.get(d.Hash,i);return t=vd(m),$ye(t,e,r,n,i)},Lye=$ye;E();E();E();function kXe(t){let[e,r]=t[Symbol.asyncIterator]!=null?[t[Symbol.asyncIterator](),Symbol.asyncIterator]:[t[Symbol.iterator](),Symbol.iterator],n=[];return{peek:()=>e.next(),push:i=>{n.push(i)},next:()=>n.length>0?{done:!1,value:n.shift()}:e.next(),[r](){return this}}}var gA=kXe;function OXe(t){return t[Symbol.asyncIterator]!=null}function BXe(t,e){if(OXe(t))return async function*(){for await(let a of t)await e(a)&&(yield a)}();let r=gA(t),{value:n,done:i}=r.next();if(i===!0)return function*(){}();let o=e(n);if(typeof o.then=="function")return async function*(){await o&&(yield n);for await(let a of r)await e(a)&&(yield a)}();let s=e;return function*(){o===!0&&(yield n);for(let a of r)s(a)&&(yield a)}()}var Uye=BXe;E();function DXe(t){return t[Symbol.asyncIterator]!=null}function CXe(t,e){if(DXe(t))return async function*(){for await(let a of t)yield e(a)}();let r=gA(t),{value:n,done:i}=r.next();if(i===!0)return function*(){}();let o=e(n);if(typeof o.then=="function")return async function*(){yield await o;for await(let a of r)yield e(a)}();let s=e;return function*(){yield o;for(let a of r)yield s(a)}()}var r1=CXe;E();E();function Ah(){let t={};return t.promise=new Promise((e,r)=>{t.resolve=e,t.reject=r}),t}var vA=globalThis.CustomEvent??Event;async function*mg(t,e={}){let r=e.concurrency??1/0;r<1&&(r=1/0);let n=e.ordered==null?!1:e.ordered,i=new EventTarget,o=[],s=Ah(),a=Ah(),d=!1,m,p=!1;i.addEventListener("task-complete",()=>{a.resolve()}),Promise.resolve().then(async()=>{try{for await(let M of t){if(o.length===r&&(s=Ah(),await s.promise),p)break;let A={done:!1};o.push(A),M().then(B=>{A.done=!0,A.ok=!0,A.value=B,i.dispatchEvent(new vA("task-complete"))},B=>{A.done=!0,A.err=B,i.dispatchEvent(new vA("task-complete"))})}d=!0,i.dispatchEvent(new vA("task-complete"))}catch(M){m=M,i.dispatchEvent(new vA("task-complete"))}});function w(){return n?o[0]?.done:Boolean(o.find(M=>M.done))}function*P(){for(;o.length>0&&o[0].done;){let M=o[0];if(o.shift(),M.ok)yield M.value;else throw p=!0,s.resolve(),M.err;s.resolve()}}function*S(){for(;w();)for(let M=0;M<o.length;M++)if(o[M].done){let A=o[M];if(o.splice(M,1),M--,A.ok)yield A.value;else throw p=!0,s.resolve(),A.err;s.resolve()}}for(;;){if(w()||(a=Ah(),await a.promise),m!=null)throw m;if(n?yield*P():yield*S(),d&&o.length===0)break}}E();E();E();var bA=class{buffer;mask;top;btm;next;constructor(e){if(!(e>0)||e-1&e)throw new Error("Max size for a FixedFIFO should be a power of two");this.buffer=new Array(e),this.mask=e-1,this.top=0,this.btm=0,this.next=null}push(e){return this.buffer[this.top]!==void 0?!1:(this.buffer[this.top]=e,this.top=this.top+1&this.mask,!0)}shift(){let e=this.buffer[this.btm];if(e!==void 0)return this.buffer[this.btm]=void 0,this.btm=this.btm+1&this.mask,e}isEmpty(){return this.buffer[this.btm]===void 0}},n1=class{size;hwm;head;tail;constructor(e={}){this.hwm=e.splitLimit??16,this.head=new bA(this.hwm),this.tail=this.head,this.size=0}calculateSize(e){return e?.byteLength!=null?e.byteLength:1}push(e){if(e?.value!=null&&(this.size+=this.calculateSize(e.value)),!this.head.push(e)){let r=this.head;this.head=r.next=new bA(2*this.head.buffer.length),this.head.push(e)}}shift(){let e=this.tail.shift();if(e===void 0&&this.tail.next!=null){let r=this.tail.next;this.tail.next=null,this.tail=r,e=this.tail.shift()}return e?.value!=null&&(this.size-=this.calculateSize(e.value)),e}isEmpty(){return this.head.isEmpty()}};var xL=class extends Error{type;code;constructor(e,r){super(e??"The operation was aborted"),this.type="aborted",this.code=r??"ABORT_ERR"}};function i1(t={}){return jXe(r=>{let n=r.shift();if(n==null)return{done:!0};if(n.error!=null)throw n.error;return{done:n.done===!0,value:n.value}},t)}function jXe(t,e){e=e??{};let r=e.onEnd,n=new n1,i,o,s,a=Ah(),d=async()=>{try{return n.isEmpty()?s?{done:!0}:await new Promise((B,I)=>{o=C=>{o=null,n.push(C);try{B(t(n))}catch(k){I(k)}return i}}):t(n)}finally{n.isEmpty()&&queueMicrotask(()=>{a.resolve(),a=Ah()})}},m=B=>o!=null?o(B):(n.push(B),i),p=B=>(n=new n1,o!=null?o({error:B}):(n.push({error:B}),i)),w=B=>{if(s)return i;if(e?.objectMode!==!0&&B?.byteLength==null)throw new Error("objectMode was not true but tried to push non-Uint8Array value");return m({done:!1,value:B})},P=B=>s?i:(s=!0,B!=null?p(B):m({done:!0})),S=()=>(n=new n1,P(),{done:!0}),M=B=>(P(B),{done:!0});if(i={[Symbol.asyncIterator](){return this},next:d,return:S,throw:M,push:w,end:P,get readableLength(){return n.size},onEmpty:async B=>{let I=B?.signal;if(I?.throwIfAborted(),n.isEmpty())return;let C,k;I!=null&&(C=new Promise((q,L)=>{k=()=>{L(new xL)},I.addEventListener("abort",k)}));try{await Promise.race([a.promise,C])}finally{k!=null&&I!=null&&I?.removeEventListener("abort",k)}}},r==null)return i;let A=i;return i={[Symbol.asyncIterator](){return this},next(){return A.next()},throw(B){return A.throw(B),r!=null&&(r(B),r=void 0),{done:!0}},return(){return A.return(),r!=null&&(r(),r=void 0),{done:!0}},push:w,end(B){return A.end(B),r!=null&&(r(B),r=void 0),i},get readableLength(){return A.readableLength}},i}E();function NXe(t){return t[Symbol.asyncIterator]!=null}function qXe(...t){let e=[];for(let r of t)NXe(r)||e.push(r);return e.length===t.length?function*(){for(let r of e)yield*r}():async function*(){let r=i1({objectMode:!0});Promise.resolve().then(async()=>{try{await Promise.all(t.map(async n=>{for await(let i of n)r.push(i)})),r.end()}catch(n){r.end(n)}}),yield*r}()}var Fye=qXe;function o1(t,...e){if(t==null)throw new Error("Empty pipeline");if(EL(t)){let n=t;t=()=>n.source}else if(Kye(t)||zye(t)){let n=t;t=()=>n}let r=[t,...e];if(r.length>1&&EL(r[r.length-1])&&(r[r.length-1]=r[r.length-1].sink),r.length>2)for(let n=1;n<r.length-1;n++)EL(r[n])&&(r[n]=LXe(r[n]));return $Xe(...r)}var $Xe=(...t)=>{let e;for(;t.length>0;)e=t.shift()(e);return e},zye=t=>t?.[Symbol.asyncIterator]!=null,Kye=t=>t?.[Symbol.iterator]!=null,EL=t=>t==null?!1:t.sink!=null&&t.source!=null,LXe=t=>e=>{let r=t.sink(e);if(r?.then!=null){let n=i1({objectMode:!0});r.then(()=>{n.end()},s=>{n.end(s)});let i,o=t.source;if(zye(o))i=async function*(){yield*o,n.end()};else if(Kye(o))i=function*(){yield*o,n.end()};else throw new Error("Unknown duplex source type - must be Iterable or AsyncIterable");return Fye(n,i())}return t.source};var UXe=(t,e,r,n,i,o,s)=>{async function*a(d={}){let m=d.offset??0,p=d.length??e.Links.length,w=e.Links.slice(m,p);d.onProgress?.(new Si("unixfs:exporter:walk:directory",{cid:t})),yield*o1(w,P=>r1(P,S=>async()=>{let M=S.Name??"",A=`${n}/${M}`;return(await i(S.Hash,M,A,[],o+1,s,d)).entry}),P=>mg(P,{ordered:!0}),P=>Uye(P,S=>S!=null))}return a},Gye=UXe;E();var gg=or(Va(),1);E();var rge=or(Vye(),1);E();var X3=class extends Error{constructor(e){super(e),this.name="TimeoutError"}},ML=class extends Error{constructor(e){super(),this.name="AbortError",this.message=e}},Hye=t=>globalThis.DOMException===void 0?new ML(t):new DOMException(t),Zye=t=>{let e=t.reason===void 0?Hye("This operation was aborted."):t.reason;return e instanceof Error?e:Hye(e)};function PL(t,e,r,n){let i,o=new Promise((s,a)=>{if(typeof e!="number"||Math.sign(e)!==1)throw new TypeError(`Expected \`milliseconds\` to be a positive number, got \`${e}\``);if(e===Number.POSITIVE_INFINITY){s(t);return}if(n={customTimers:{setTimeout,clearTimeout},...n},n.signal){let{signal:d}=n;d.aborted&&a(Zye(d)),d.addEventListener("abort",()=>{a(Zye(d))})}i=n.customTimers.setTimeout.call(void 0,()=>{if(typeof r=="function"){try{s(r())}catch(p){a(p)}return}let d=typeof r=="string"?r:`Promise timed out after ${e} milliseconds`,m=r instanceof Error?r:new X3(d);typeof t.cancel=="function"&&t.cancel(),a(m)},e),(async()=>{try{s(await t)}catch(d){a(d)}finally{n.customTimers.clearTimeout.call(void 0,i)}})()});return o.clear=()=>{clearTimeout(i),i=void 0},o}E();E();function AL(t,e,r){let n=0,i=t.length;for(;i>0;){let o=Math.trunc(i/2),s=n+o;r(t[s],e)<=0?(n=++s,i-=o+1):i=o}return n}var yg=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},Th,eE=class{constructor(){Th.set(this,[])}enqueue(e,r){r={priority:0,...r};let n={priority:r.priority,run:e};if(this.size&&yg(this,Th,"f")[this.size-1].priority>=r.priority){yg(this,Th,"f").push(n);return}let i=AL(yg(this,Th,"f"),n,(o,s)=>s.priority-o.priority);yg(this,Th,"f").splice(i,0,n)}dequeue(){let e=yg(this,Th,"f").shift();return e?.run}filter(e){return yg(this,Th,"f").filter(r=>r.priority===e.priority).map(r=>r.run)}get size(){return yg(this,Th,"f").length}};Th=new WeakMap;var gi=function(t,e,r,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r},ht=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},Hi,rE,nE,M0,PA,iE,_A,_u,tE,vc,xA,bc,oE,S0,EA,Jye,Yye,ege,Qye,Xye,SA,TL,RL,AA,tge,MA,TA=class extends Error{},sE=class extends rge.default{constructor(e){var r,n,i,o;if(super(),Hi.add(this),rE.set(this,void 0),nE.set(this,void 0),M0.set(this,0),PA.set(this,void 0),iE.set(this,void 0),_A.set(this,0),_u.set(this,void 0),tE.set(this,void 0),vc.set(this,void 0),xA.set(this,void 0),bc.set(this,0),oE.set(this,void 0),S0.set(this,void 0),EA.set(this,void 0),Object.defineProperty(this,"timeout",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),e={carryoverConcurrencyCount:!1,intervalCap:Number.POSITIVE_INFINITY,interval:0,concurrency:Number.POSITIVE_INFINITY,autoStart:!0,queueClass:eE,...e},!(typeof e.intervalCap=="number"&&e.intervalCap>=1))throw new TypeError(`Expected \`intervalCap\` to be a number from 1 and up, got \`${(n=(r=e.intervalCap)===null||r===void 0?void 0:r.toString())!==null&&n!==void 0?n:""}\` (${typeof e.intervalCap})`);if(e.interval===void 0||!(Number.isFinite(e.interval)&&e.interval>=0))throw new TypeError(`Expected \`interval\` to be a finite number >= 0, got \`${(o=(i=e.interval)===null||i===void 0?void 0:i.toString())!==null&&o!==void 0?o:""}\` (${typeof e.interval})`);gi(this,rE,e.carryoverConcurrencyCount,"f"),gi(this,nE,e.intervalCap===Number.POSITIVE_INFINITY||e.interval===0,"f"),gi(this,PA,e.intervalCap,"f"),gi(this,iE,e.interval,"f"),gi(this,vc,new e.queueClass,"f"),gi(this,xA,e.queueClass,"f"),this.concurrency=e.concurrency,this.timeout=e.timeout,gi(this,EA,e.throwOnTimeout===!0,"f"),gi(this,S0,e.autoStart===!1,"f")}get concurrency(){return ht(this,oE,"f")}set concurrency(e){if(!(typeof e=="number"&&e>=1))throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${e}\` (${typeof e})`);gi(this,oE,e,"f"),ht(this,Hi,"m",AA).call(this)}async add(e,r={}){return r={timeout:this.timeout,throwOnTimeout:ht(this,EA,"f"),...r},new Promise((n,i)=>{ht(this,vc,"f").enqueue(async()=>{var o,s,a;gi(this,bc,(s=ht(this,bc,"f"),s++,s),"f"),gi(this,M0,(a=ht(this,M0,"f"),a++,a),"f");try{if(!((o=r.signal)===null||o===void 0)&&o.aborted)throw new TA("The task was aborted.");let d=e({signal:r.signal});r.timeout&&(d=PL(Promise.resolve(d),r.timeout)),r.signal&&(d=Promise.race([d,ht(this,Hi,"m",tge).call(this,r.signal)]));let m=await d;n(m),this.emit("completed",m)}catch(d){if(d instanceof X3&&!r.throwOnTimeout){n();return}i(d),this.emit("error",d)}finally{ht(this,Hi,"m",ege).call(this)}},r),this.emit("add"),ht(this,Hi,"m",SA).call(this)})}async addAll(e,r){return Promise.all(e.map(async n=>this.add(n,r)))}start(){return ht(this,S0,"f")?(gi(this,S0,!1,"f"),ht(this,Hi,"m",AA).call(this),this):this}pause(){gi(this,S0,!0,"f")}clear(){gi(this,vc,new(ht(this,xA,"f")),"f")}async onEmpty(){ht(this,vc,"f").size!==0&&await ht(this,Hi,"m",MA).call(this,"empty")}async onSizeLessThan(e){ht(this,vc,"f").size<e||await ht(this,Hi,"m",MA).call(this,"next",()=>ht(this,vc,"f").size<e)}async onIdle(){ht(this,bc,"f")===0&&ht(this,vc,"f").size===0||await ht(this,Hi,"m",MA).call(this,"idle")}get size(){return ht(this,vc,"f").size}sizeBy(e){return ht(this,vc,"f").filter(e).length}get pending(){return ht(this,bc,"f")}get isPaused(){return ht(this,S0,"f")}};rE=new WeakMap,nE=new WeakMap,M0=new WeakMap,PA=new WeakMap,iE=new WeakMap,_A=new WeakMap,_u=new WeakMap,tE=new WeakMap,vc=new WeakMap,xA=new WeakMap,bc=new WeakMap,oE=new WeakMap,S0=new WeakMap,EA=new WeakMap,Hi=new WeakSet,Jye=function(){return ht(this,nE,"f")||ht(this,M0,"f")<ht(this,PA,"f")},Yye=function(){return ht(this,bc,"f")<ht(this,oE,"f")},ege=function(){var e;gi(this,bc,(e=ht(this,bc,"f"),e--,e),"f"),ht(this,Hi,"m",SA).call(this),this.emit("next")},Qye=function(){ht(this,Hi,"m",RL).call(this),ht(this,Hi,"m",TL).call(this),gi(this,tE,void 0,"f")},Xye=function(){let e=Date.now();if(ht(this,_u,"f")===void 0){let r=ht(this,_A,"f")-e;if(r<0)gi(this,M0,ht(this,rE,"f")?ht(this,bc,"f"):0,"f");else return ht(this,tE,"f")===void 0&&gi(this,tE,setTimeout(()=>{ht(this,Hi,"m",Qye).call(this)},r),"f"),!0}return!1},SA=function(){if(ht(this,vc,"f").size===0)return ht(this,_u,"f")&&clearInterval(ht(this,_u,"f")),gi(this,_u,void 0,"f"),this.emit("empty"),ht(this,bc,"f")===0&&this.emit("idle"),!1;if(!ht(this,S0,"f")){let e=!ht(this,Hi,"a",Xye);if(ht(this,Hi,"a",Jye)&&ht(this,Hi,"a",Yye)){let r=ht(this,vc,"f").dequeue();return r?(this.emit("active"),r(),e&&ht(this,Hi,"m",TL).call(this),!0):!1}}return!1},TL=function(){ht(this,nE,"f")||ht(this,_u,"f")!==void 0||(gi(this,_u,setInterval(()=>{ht(this,Hi,"m",RL).call(this)},ht(this,iE,"f")),"f"),gi(this,_A,Date.now()+ht(this,iE,"f"),"f"))},RL=function(){ht(this,M0,"f")===0&&ht(this,bc,"f")===0&&ht(this,_u,"f")&&(clearInterval(ht(this,_u,"f")),gi(this,_u,void 0,"f")),gi(this,M0,ht(this,rE,"f")?ht(this,bc,"f"):0,"f"),ht(this,Hi,"m",AA).call(this)},AA=function(){for(;ht(this,Hi,"m",SA).call(this););},tge=async function(e){return new Promise((r,n)=>{e.addEventListener("abort",()=>{n(new TA("The task was aborted."))},{once:!0})})},MA=async function(e,r){return new Promise(n=>{let i=()=>{r&&!r()||(this.off(e,i),n())};this.on(e,i)})};async function nge(t,e,r,n,i,o,s){if(e instanceof Uint8Array){let m=pg(e,n,i,o);r.push(m);return}if(e.Data==null)throw(0,gg.default)(new Error("no data in PBNode"),"ERR_NOT_UNIXFS");let a;try{a=Ji.unmarshal(e.Data)}catch(m){throw(0,gg.default)(m,"ERR_NOT_UNIXFS")}if(a.data!=null){let m=a.data,p=pg(m,n,i,o);r.push(p),n+=BigInt(p.byteLength)}let d=[];if(e.Links.length!==a.blockSizes.length)throw(0,gg.default)(new Error("Inconsistent block sizes and dag links"),"ERR_NOT_UNIXFS");for(let m=0;m<e.Links.length;m++){let p=e.Links[m],w=n,P=w+a.blockSizes[m];if((i>=w&&i<P||o>=w&&o<=P||i<w&&o>P)&&d.push({link:p,blockStart:n}),n=P,n>o)break}await o1(d,m=>r1(m,p=>async()=>{let w=await t.get(p.link.Hash,s);return{...p,block:w}}),m=>mg(m,{ordered:!0}),async m=>{for await(let{link:p,block:w,blockStart:P}of m){let S;switch(p.Hash.code){case J1:S=vd(w);break;case Uh:S=w;break;default:r.end((0,gg.default)(new Error(`Unsupported codec: ${p.Hash.code}`),"ERR_NOT_UNIXFS"));return}let M=new sE({concurrency:1});M.on("error",A=>{r.end(A)}),M.add(async()=>{s.onProgress?.(new Si("unixfs:exporter:walk:file",{cid:p.Hash})),await nge(t,S,r,P,i,o,s)}),await M.onIdle()}}),n>=o&&r.end()}var KXe=(t,e,r,n,i,o,s)=>{async function*a(d={}){let m=r.fileSize();if(m===void 0)throw new Error("File was a directory");let{start:p,end:w}=t1(m,d.offset,d.length);if(w===0n)return;let P=0n,S=w-p,M=i1();d.onProgress?.(new Si("unixfs:exporter:walk:file",{cid:t})),nge(s,e,M,0n,p,w,d).catch(A=>{M.end(A)});for await(let A of M)if(A!=null){if(P+=BigInt(A.byteLength),P>S)throw M.end(),(0,gg.default)(new Error("Read too many bytes - the file size reported by the UnixFS data in the root node may be incorrect"),"ERR_OVER_READ");P===S&&M.end(),d.onProgress?.(new Si("unixfs:exporter:progress:unixfs:file",{bytesRead:P,totalBytes:S,fileSize:m})),yield A}if(P<S)throw(0,gg.default)(new Error("Traversed entire DAG but did not read enough bytes"),"ERR_UNDER_READ")}return a},IL=KXe;E();var GXe=(t,e,r,n,i,o,s)=>{function a(d={}){return d.onProgress?.(new Si("unixfs:exporter:walk:hamt-sharded-directory",{cid:t})),ige(e,n,i,o,s,d)}return a};async function*ige(t,e,r,n,i,o){let s=t.Links,a=o1(s,d=>r1(d,m=>async()=>{let p=m.Name!=null?m.Name.substring(2):null;if(p!=null&&p!==""){let w=await r(m.Hash,p,`${e}/${p}`,[],n+1,i,o);return{entries:w.entry==null?[]:[w.entry]}}else{let w=await i.get(m.Hash,o);return t=vd(w),o.onProgress?.(new Si("unixfs:exporter:walk:hamt-sharded-directory",{cid:m.Hash})),{entries:ige(t,e,r,n,i,o)}}}),d=>mg(d,{ordered:!0}));for await(let{entries:d}of a)yield*d}var oge=GXe;var WXe=(t,e)=>t.Links.find(n=>n.Name===e)?.Hash,VXe={raw:IL,file:IL,directory:Gye,"hamt-sharded-directory":oge,metadata:(t,e,r,n,i,o,s)=>()=>[],symlink:(t,e,r,n,i,o,s)=>()=>[]},HXe=async(t,e,r,n,i,o,s,a)=>{let d=await s.get(t,a),m=vd(d),p,w;if(e==null&&(e=t.toString()),m.Data==null)throw(0,aE.default)(new Error("no data in PBNode"),"ERR_NOT_UNIXFS");try{p=Ji.unmarshal(m.Data)}catch(S){throw(0,aE.default)(S,"ERR_NOT_UNIXFS")}if(r==null&&(r=e),n.length>0){let S;if(p?.type==="hamt-sharded-directory"?S=await Lye(m,n[0],s):S=WXe(m,n[0]),S==null)throw(0,aE.default)(new Error("file does not exist"),"ERR_NOT_FOUND");let M=n.shift(),A=`${r}/${M}`;w={cid:S,toResolve:n,name:M??"",path:A}}let P=VXe[p.type](t,m,p,r,i,o,s);if(P==null)throw(0,aE.default)(new Error("could not find content exporter"),"ERR_NOT_FOUND");return p.isDirectory()?{entry:{type:"directory",name:e,path:r,cid:t,content:P,unixfs:p,depth:o,node:m,size:p.fileSize()},next:w}:{entry:{type:"file",name:e,path:r,cid:t,content:P,unixfs:p,depth:o,node:m,size:p.fileSize()},next:w}},sge=HXe;var ZXe={[J1]:sge,[Uh]:Nye,[Vh]:Bye,[GT.code]:Cye},cge=async(t,e,r,n,i,o,s)=>{let a=ZXe[t.code];if(a==null)throw(0,age.default)(new Error(`No resolver for code ${t.code}`),"ERR_NO_RESOLVER");return a(t,e,r,n,cge,i,o,s)},fge=cge;var JXe=(t="")=>(t.trim().match(/([^\\^/]|\\\/)+/g)??[]).filter(Boolean),YXe=t=>{if(t instanceof Uint8Array)return{cid:St.decode(t),toResolve:[]};let e=St.asCID(t);if(e!=null)return{cid:e,toResolve:[]};if(typeof t=="string"){t.indexOf("/ipfs/")===0&&(t=t.substring(6));let r=JXe(t);return{cid:St.parse(r[0]),toResolve:r.slice(1)}}throw(0,RA.default)(new Error(`Unknown path type ${t}`),"ERR_BAD_PATH")};async function*QXe(t,e,r={}){let{cid:n,toResolve:i}=YXe(t),o=n.toString(),s=o,a=i.length;for(;;){let d=await fge(n,o,s,i,a,e,r);if(d.entry==null&&d.next==null)throw(0,RA.default)(new Error(`Could not resolve ${t}`),"ERR_NOT_FOUND");if(d.entry!=null&&(yield d.entry),d.next==null)return;i=d.next.toResolve,n=d.next.cid,o=d.next.name,s=d.next.path}}async function uge(t,e,r={}){let n=await kye(QXe(t,e,r));if(n==null)throw(0,RA.default)(new Error(`Could not resolve ${t}`),"ERR_NOT_FOUND");return n}var lge=or(a8(),1),kL=class{constructor(e={}){this.config={blockstoreLocation:"DATASTORE",createLevelDatabase:wu,...e},this.blockstore=new E0({location:this.config.blockstoreLocation,createLevelDatabase:this.config.createLevelDatabase})}async open(){await this.blockstore.open()}async close(){await this.blockstore.close()}async put(e,r,n,i){let o=await this.getBlockstoreForStoringData(e,r,n),s=l2([{content:i}],o,{cidVersion:1}),a;for await(a of s);return{dataSize:Number(a.unixfs?.fileSize()??a.size)}}async get(e,r,n){let i=await this.getBlockstoreForStoringData(e,r,n);if(!await i.has(n))return;let s=await uge(n,i),a=s.content(),d=new lge.Readable({async read(){let p=await a.next();p.done?this.push(null):this.push(p.value)}}),m=s.size;return(s.type==="file"||s.type==="directory")&&(m=s.unixfs.fileSize()),{dataSize:Number(m),dataStream:d}}async delete(e,r,n){await(await this.getBlockstoreForStoringData(e,r,n)).clear()}async clear(){await this.blockstore.clear()}async getBlockstoreForStoringData(e,r,n){let i="data";return await(await(await(await this.blockstore.partition(i)).partition(e)).partition(r)).partition(n)}};E();E();var dge="index",Bi=class{constructor(e){this.config={createLevelDatabase:wu,...e},this.db=new Ph({location:this.config.location,createLevelDatabase:this.config.createLevelDatabase,keyEncoding:"utf8"})}async open(){await this.db.open()}async close(){await this.db.close()}async clear(){await this.db.clear()}async put(e,r,n,i){if(U_(n))throw new be("IndexMissingIndexableProperty","Index must include at least one valid indexable property");let o={messageCid:r,indexes:n},s=[];for(let p in n){let w=n[p];if(Array.isArray(w))for(let P of w){let S=this.createPutIndexedItemOperation(e,o,p,P);s.push(S)}else{let P=this.createPutIndexedItemOperation(e,o,p,w);s.push(P)}}let a=this.createOperationForIndexesLookupPartition(e,{type:"put",key:r,value:JSON.stringify(n)});s.push(a);let d=await Promise.all(s);await(await this.db.partition(e)).batch(d,i)}async delete(e,r,n){let i=[],o=await this.getIndexes(e,r);if(o===void 0)return;let s=this.createOperationForIndexesLookupPartition(e,{type:"del",key:r});i.push(s);for(let m in o){let p=o[m];if(Array.isArray(p))for(let w of p){let P=this.createDeleteIndexedItemOperation(e,r,m,w);i.push(P)}else{let w=this.createDeleteIndexedItemOperation(e,r,m,p);i.push(w)}}let a=await Promise.all(i);await(await this.db.partition(e)).batch(a,n)}async createPutIndexedItemOperation(e,r,n,i){let{messageCid:o}=r,s=Bi.keySegmentJoin(Bi.encodeValue(i),o);return this.createOperationForIndexPartition(e,n,{type:"put",key:s,value:JSON.stringify(r)})}async createDeleteIndexedItemOperation(e,r,n,i){let o=Bi.keySegmentJoin(Bi.encodeValue(i),r);return this.createOperationForIndexPartition(e,n,{type:"del",key:o})}async createOperationForIndexPartition(e,r,n){let i=await this.db.partition(e),o=Bi.getIndexPartitionName(r);return i.createPartitionOperation(o,n)}async createOperationForIndexesLookupPartition(e,r){return(await this.db.partition(e)).createPartitionOperation(dge,r)}static getIndexPartitionName(e){return`__${e}__`}async getIndexPartition(e,r){let n=Bi.getIndexPartitionName(r);return(await this.db.partition(e)).partition(n)}async getIndexesLookupPartition(e){return(await this.db.partition(e)).partition(dge)}async query(e,r,n,i){return Bi.shouldQueryWithInMemoryPaging(r,n)?this.queryWithInMemoryPaging(e,r,n,i):this.queryWithIteratorPaging(e,r,n,i)}async queryWithIteratorPaging(e,r,n,i){let{cursor:o,limit:s}=n,a=o?this.createStartingKeyFromCursor(o):"",d=[];for await(let m of this.getIndexIterator(e,a,n,i)){if(s!==void 0&&s===d.length)break;let{indexes:p}=m;fi.matchAnyFilter(p,r)&&d.push(m)}return d}async*getIndexIterator(e,r,n,i){let{sortProperty:o,sortDirection:s=1,cursor:a}=n,d={gt:r};s===-1&&(d.reverse=!0,a!==void 0&&(d.lt=r,delete d.gt));let m=await this.getIndexPartition(e,o);for await(let[p,w]of m.iterator(d,i)){let{indexes:P,messageCid:S}=JSON.parse(w);yield{indexes:P,messageCid:S}}}createStartingKeyFromCursor(e){let{messageCid:r,value:n}=e;return Bi.keySegmentJoin(Bi.encodeValue(n),r)}static createCursorFromLastArrayItem(e,r){if(e.length>0)return this.createCursorFromItem(e.at(-1),r)}static createCursorFromItem(e,r){let{messageCid:n,indexes:i}=e,o=i[r];if(o===void 0)throw new be("IndexInvalidCursorSortProperty",`the sort property '${r}' is not defined within the given item.`);if(typeof o=="boolean"||Array.isArray(o))throw new be("IndexInvalidCursorValueType",`only string or number values are supported for cursors, a(n) ${typeof o} was given.`);return{messageCid:n,value:o}}async queryWithInMemoryPaging(e,r,n,i){let{sortProperty:o,sortDirection:s=1,cursor:a,limit:d}=n,m=a?this.createStartingKeyFromCursor(a):void 0,p=new Map;r.length===0&&(r=[{}]);try{await Promise.all(r.map(M=>this.executeSingleFilterQuery(e,M,o,p,i)))}catch(M){if(M.code==="IndexInvalidSortPropertyInMemory")return[]}let w=[...p.values()].sort((M,A)=>this.sortItems(M,A,o,s)),P=m!==void 0?this.findCursorStartingIndex(w,s,o,m):0;if(P<0)return[];let S=d!==void 0?P+d:void 0;return w.slice(P,S)}async executeSingleFilterQuery(e,r,n,i,o){let s=[];if(U_(r)){let d=this.getAllItems(e,n);s.push(d)}let a=u8.reduceFilter(r);for(let d in a){let m=a[d];if(fi.isEqualFilter(m)){let p=this.filterExactMatches(e,d,m,o);s.push(p)}else if(fi.isOneOfFilter(m))for(let p of new Set(m)){let w=this.filterExactMatches(e,d,p,o);s.push(w)}else if(fi.isRangeFilter(m)){let p=this.filterRangeMatches(e,d,m,o);s.push(p)}}for(let d of s){let m=await d;for(let p of m)if(!(i.has(p.messageCid)||!fi.matchFilter(p.indexes,r))){if(p.indexes[n]===void 0)throw new be("IndexInvalidSortPropertyInMemory",`invalid sort property ${n}`);i.set(p.messageCid,p)}}}async getAllItems(e,r){let n=await this.getIndexPartition(e,r),i=[];for await(let[o,s]of n.iterator())i.push(JSON.parse(s));return i}async filterExactMatches(e,r,n,i){let o=Bi.keySegmentJoin(Bi.encodeValue(n)),s={gt:o},a=await this.getIndexPartition(e,r),d=[];for await(let[m,p]of a.iterator(s,i)){if(!m.startsWith(o))break;d.push(JSON.parse(p))}return d}async filterRangeMatches(e,r,n,i){let o={};for(let d in n){let m=d;o[m]=Bi.encodeValue(n[m])}o.gt===void 0&&o.gte===void 0&&(o.reverse=!0);let s=[],a=await this.getIndexPartition(e,r);for await(let[d,m]of a.iterator(o,i))"gt"in n&&this.extractIndexValueFromKey(d)===Bi.encodeValue(n.gt)||s.push(JSON.parse(m));if("lte"in n)for(let d of await this.filterExactMatches(e,r,n.lte,i))s.push(d);return s}sortItems(e,r,n,i){let o=e.indexes[n],s=r.indexes[n],a=Bi.encodeValue(o)+e.messageCid,d=Bi.encodeValue(s)+r.messageCid;return i===1?L_(a,d):L_(d,a)}findCursorStartingIndex(e,r,n,i){let o=s=>{let{messageCid:a,indexes:d}=s,m=d[n],p=Bi.keySegmentJoin(Bi.encodeValue(m),a);return r===1?p>i:p<i};return e.findIndex(o)}async getIndexes(e,r){let i=await(await this.getIndexesLookupPartition(e)).get(r);if(i!==void 0)return JSON.parse(i)}extractIndexValueFromKey(e){let[r]=e.split(Bi.delimiter);return r}static keySegmentJoin(...e){return e.join(Bi.delimiter)}static encodeNumberValue(e){let r=Number.MAX_SAFE_INTEGER,n="!",i=String(Number.MAX_SAFE_INTEGER).length,o=e<0?n:"",s=e<0?r:0;return o+String(e+s).padStart(i,"0")}static encodeValue(e){switch(typeof e){case"number":return this.encodeNumberValue(e);default:return JSON.stringify(e)}}static shouldQueryWithInMemoryPaging(e,r){for(let n of e)if(!Bi.isFilterConcise(n,r))return!1;return!0}static isFilterConcise(e,r){return e.recordId!==void 0?!0:r.cursor!==void 0?!1:e.protocolPath!==void 0||e.contextId!==void 0||e.parentId!==void 0||e.schema!==void 0}},Rh=Bi;Rh.delimiter="\0";E();E();E();E();function cE(t){if(!s1(t))throw new Error("Parameter was not an error")}function s1(t){return XXe(t)==="[object Error]"||t instanceof Error}function XXe(t){return Object.prototype.toString.call(t)}E();function hge(t){let e,r="";if(t.length===0)e={};else if(s1(t[0]))e={cause:t[0]},r=t.slice(1).join(" ")||"";else if(t[0]&&typeof t[0]=="object")e=Object.assign({},t[0]),r=t.slice(1).join(" ")||"";else if(typeof t[0]=="string")e={},r=r=t.join(" ")||"";else throw new Error("Invalid arguments passed to Layerr");return{options:e,shortMessage:r}}var bs=class extends Error{constructor(e,r){let n=[...arguments],{options:i,shortMessage:o}=hge(n),s=o;if(i.cause&&(s=`${s}: ${i.cause.message}`),super(s),this.message=s,i.name&&typeof i.name=="string"?this.name=i.name:this.name="Layerr",i.cause&&Object.defineProperty(this,"_cause",{value:i.cause}),Object.defineProperty(this,"_info",{value:{}}),i.info&&typeof i.info=="object"&&Object.assign(this._info,i.info),Error.captureStackTrace){let a=i.constructorOpt||this.constructor;Error.captureStackTrace(this,a)}}static cause(e){return cE(e),e._cause&&s1(e._cause)?e._cause:null}static fullStack(e){cE(e);let r=bs.cause(e);return r?`${e.stack}
caused by: ${bs.fullStack(r)}`:e.stack}static info(e){cE(e);let r={},n=bs.cause(e);return n&&Object.assign(r,bs.info(n)),e._info&&Object.assign(r,e._info),r}cause(){return bs.cause(this)}toString(){let e=this.name||this.constructor.name||this.constructor.prototype.name;return this.message&&(e=`${e}: ${this.message}`),e}};E();var fE="0123456789ABCDEFGHJKMNPQRSTVWXYZ",a1=32,pge=0xffffffffffff,mge=10,eet=16,vg=Object.freeze({source:"ulid"});function tet(t){let e=t||ret(),r=e&&(e.crypto||e.msCrypto)||null;if(typeof r?.getRandomValues=="function")return()=>{let n=new Uint8Array(1);return r.getRandomValues(n),n[0]/255};if(typeof r?.randomBytes=="function")return()=>r.randomBytes(1).readUInt8()/255;throw new bs({info:{code:"PRNG_DETECT",...vg}},"Failed to find a reliable PRNG")}function ret(){return oet()?self:typeof window<"u"?window:typeof globalThis<"u"||typeof globalThis<"u"?globalThis:null}function net(t,e){let r="";for(;t>0;t--)r=set(e)+r;return r}function yge(t,e){if(isNaN(t))throw new bs({info:{code:"ENC_TIME_NAN",...vg}},`Time must be a number: ${t}`);if(t>pge)throw new bs({info:{code:"ENC_TIME_SIZE_EXCEED",...vg}},`Cannot encode a time larger than ${pge}: ${t}`);if(t<0)throw new bs({info:{code:"ENC_TIME_NEG",...vg}},`Time must be positive: ${t}`);if(Number.isInteger(t)===!1)throw new bs({info:{code:"ENC_TIME_TYPE",...vg}},`Time must be an integer: ${t}`);let r,n="";for(let i=e;i>0;i--)r=t%a1,n=fE.charAt(r)+n,t=(t-r)/a1;return n}function iet(t){let e,r=t.length,n,i,o=t,s=a1-1;for(;!e&&r-->=0;){if(n=o[r],i=fE.indexOf(n),i===-1)throw new bs({info:{code:"B32_INC_ENC",...vg}},"Incorrectly encoded string");if(i===s){o=gge(o,r,fE[0]);continue}e=gge(o,r,fE[i+1])}if(typeof e=="string")return e;throw new bs({info:{code:"B32_INC_INVALID",...vg}},"Failed incrementing string")}function oet(){return typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope}function vge(t){let e=t||tet(),r=0,n;return function(o){let s=isNaN(o)?Date.now():o;if(s<=r){let d=n=iet(n);return yge(r,mge)+d}r=s;let a=n=net(eet,e);return yge(s,mge)+a}}function set(t){let e=Math.floor(t()*a1);return e===a1&&(e=a1-1),fE.charAt(e)}function gge(t,e,r){return e>t.length-1?t:t.substr(0,e)+r+t.substr(e+1)}var OL=class{constructor(e){this.index=new Rh({location:"EVENTLOG",createLevelDatabase:wu,...e}),this.ulidFactory=vge()}async open(){return this.index.open()}async close(){return this.index.close()}async clear(){return this.index.clear()}async append(e,r,n){let i=this.ulidFactory();await this.index.put(e,r,{...n,watermark:i})}async queryEvents(e,r,n){let i=await this.index.query(e,r,{sortProperty:"watermark",cursor:n});return{events:i.map(({messageCid:o})=>o),cursor:Rh.createCursorFromLastArrayItem(i,"watermark")}}async getEvents(e,r){return this.queryEvents(e,[],r)}async deleteEventsByCid(e,r){let n=[];for(let i of r)n.push(this.index.delete(e,i));await Promise.all(n)}};E();E();function IA({enumerable:t=!0,configurable:e=!1}={}){return{enumerable:t,configurable:e,writable:!1}}function*aet(t,e){if(e!=null&&typeof e=="object")if(Array.isArray(e))for(let[r,n]of e.entries()){let i=[...t,r],o=St.asCID(n);o?yield[i.join("/"),o]:typeof n=="object"&&(yield*BL(n,i))}else{let r=St.asCID(e);r?yield[t.join("/"),r]:yield*BL(e,t)}}function*BL(t,e){if(t==null||t instanceof Uint8Array)return;let r=St.asCID(t);r&&(yield[e.join("/"),r]);for(let[n,i]of Object.entries(t)){let o=[...e,n];yield*aet(o,i)}}function*cet(t,e){if(Array.isArray(e))for(let[r,n]of e.entries()){let i=[...t,r];yield i.join("/"),typeof n=="object"&&!St.asCID(n)&&(yield*DL(n,i))}else yield*DL(e,t)}function*DL(t,e){if(!(t==null||typeof t!="object"))for(let[r,n]of Object.entries(t)){let i=[...e,r];yield i.join("/"),n!=null&&!(n instanceof Uint8Array)&&typeof n=="object"&&!St.asCID(n)&&(yield*cet(i,n))}}function fet(t,e){let r=t;for(let[n,i]of e.entries()){if(r=r[i],r==null)throw new Error(`Object has no property at ${e.slice(0,n+1).map(s=>`[${JSON.stringify(s)}]`).join("")}`);let o=St.asCID(r);if(o)return{value:o,remaining:e.slice(n+1).join("/")}}return{value:r}}var kA=class{constructor({cid:e,bytes:r,value:n}){if(!e||!r||typeof n>"u")throw new Error("Missing required argument");this.cid=e,this.bytes=r,this.value=n,this.asBlock=this,Object.defineProperties(this,{cid:IA(),bytes:IA(),value:IA(),asBlock:IA()})}links(){return BL(this.value,[])}tree(){return DL(this.value,[])}get(e="/"){return fet(this.value,e.split("/").filter(Boolean))}};async function bge({value:t,codec:e,hasher:r}){if(typeof t>"u")throw new Error('Missing required argument "value"');if(!e||!r)throw new Error("Missing required argument: codec or hasher");let n=e.encode(t),i=await r.digest(n),o=St.create(1,e.code,i);return new kA({value:t,bytes:n,cid:o})}async function wge({bytes:t,codec:e,hasher:r}){if(!t)throw new Error('Missing required argument "bytes"');if(!e||!r)throw new Error("Missing required argument: codec or hasher");let n=e.decode(t),i=await r.digest(t),o=St.create(1,e.code,i);return new kA({value:n,bytes:t,cid:o})}var uE=class{constructor(e={}){this.config={blockstoreLocation:"MESSAGESTORE",indexLocation:"INDEX",createLevelDatabase:wu,...e},this.blockstore=new E0({location:this.config.blockstoreLocation,createLevelDatabase:this.config.createLevelDatabase}),this.index=new Rh({location:this.config.indexLocation,createLevelDatabase:this.config.createLevelDatabase})}async open(){await this.blockstore.open(),await this.index.open()}async close(){await this.blockstore.close(),await this.index.close()}async get(e,r,n){n?.signal?.throwIfAborted();let i=await no(this.blockstore.partition(e),n?.signal),o=St.parse(r),s=await i.get(o,n);return s?(await no(wge({bytes:s,codec:yd,hasher:xo}),n?.signal)).value:void 0}async query(e,r,n,i,o){o?.signal?.throwIfAborted();let s=uE.buildQueryOptions(n,i),a=await this.index.query(e,r,s,o),d;i?.limit!==void 0&&i.limit<a.length&&(a.splice(-1),d=Rh.createCursorFromLastArrayItem(a,s.sortProperty));let m=[];for(let p=0;p<a.length;p++){let{messageCid:w}=a[p],P=await this.get(e,w,o);P&&m.push(P)}return{messages:m,cursor:d}}static buildQueryOptions(e={},r={}){let{limit:n,cursor:i}=r,{dateCreated:o,datePublished:s,messageTimestamp:a}=e,d=1,m="messageTimestamp";return o!==void 0?m="dateCreated":s!==void 0?m="datePublished":a!==void 0&&(m="messageTimestamp"),e[m]!==void 0&&(d=e[m]),n!==void 0&&n>0&&(n=n+1),{sortDirection:d,sortProperty:m,limit:n,cursor:i}}async delete(e,r,n){n?.signal?.throwIfAborted();let i=await no(this.blockstore.partition(e),n?.signal),o=St.parse(r);await i.delete(o,n),await this.index.delete(e,r,n)}async put(e,r,n,i){i?.signal?.throwIfAborted();let o=await no(this.blockstore.partition(e),i?.signal),s=await no(bge({value:r,codec:yd,hasher:xo}),i?.signal),a=Qn.parseCid(await Ue.getCid(r));await o.put(a,s.bytes,i);let d=a.toString();await this.index.put(e,d,n,i)}async clear(){await this.blockstore.clear(),await this.index.clear()}};E();var _ge=or(Go(),1);var CL="events",jL=class{constructor(e={}){this.isOpen=!1;this.errorHandler=e=>{console.error("event emitter error",e)};this.eventEmitter=new _ge.EventEmitter({captureRejections:!0}),this.eventEmitter.setMaxListeners(0),e.errorHandler&&(this.errorHandler=e.errorHandler),this.eventEmitter.on("error",this.errorHandler)}async subscribe(e,r,n){return this.eventEmitter.on(`${e}_${CL}`,n),{id:r,close:async()=>{this.eventEmitter.off(`${e}_${CL}`,n)}}}async open(){this.isOpen=!0}async close(){this.isOpen=!1,this.eventEmitter.removeAllListeners()}emit(e,r,n){if(!this.isOpen){this.errorHandler(new be("EventEmitterStreamNotOpenError","a message emitted when EventEmitterStream is closed"));return}this.eventEmitter.emit(`${e}_${CL}`,e,r,n)}};E();var ln=class{static async generatePersona(e){let r=e?.did;r||(r=`did:example:${ln.randomString(32)}`);let n=ln.randomString(10),i=e?.keyId??`${r}#${n}`,o=e?.keyPair??await sn.generateKeyPair();return{did:r,keyId:i,keyPair:o,signer:new Fh({privateJwk:o.privateJwk,algorithm:o.privateJwk.alg,keyId:`${r}#${i}`})}}static async generateProtocolsConfigure(e){let r=e?.author??await ln.generatePersona(),n=e?.protocolDefinition;if(!n){let a="record"+ln.randomString(10);n={protocol:ln.randomString(20),published:e?.published??!1,types:{},structure:{}},n.types[a]={schema:"test-object",dataFormats:["text/plain"]},n.structure[a]={}}let i=zt.createSigner(r),o={messageTimestamp:e?.messageTimestamp,definition:n,signer:i,permissionGrantId:e?.permissionGrantId},s=await $o.create(o);return{author:r,message:s.message,protocolsConfigure:s}}static async generateProtocolsQuery(e){let r=e?.author??await ln.generatePersona(),n=zt.createSigner(r),i={messageTimestamp:e?.messageTimestamp,filter:e?.filter,signer:n,permissionGrantId:e?.permissionGrantId};rn(i);let o=await au.create(i);return{author:r,message:o.message,protocolsQuery:o}}static async generateRecordsWrite(e){let r=e?.author??await ln.generatePersona(),n=zt.createSigner(r),i=zt.createSigners(e?.attesters??[]),o=e?.dataCid,s=e?.dataSize,a,d;o===void 0&&s===void 0&&(a=e?.data??ln.randomBytes(32),d=cs.fromBytes(a));let m={recipient:e?.recipient,protocol:e?.protocol,protocolPath:e?.protocolPath,protocolRole:e?.protocolRole,schema:e?.schema??`http://${ln.randomString(20)}`,tags:e?.tags,recordId:e?.recordId,parentContextId:e?.parentContextId,published:e?.published,dataFormat:e?.dataFormat??"application/json",dateCreated:e?.dateCreated,messageTimestamp:e?.messageTimestamp,datePublished:e?.datePublished,data:a,dataCid:o,dataSize:s,signer:n,attestationSigners:i,encryptionInput:e?.encryptionInput,permissionGrantId:e?.permissionGrantId},p=await At.create(m),w=p.message;return{author:r,message:w,dataCid:o,dataSize:s,dataBytes:a,dataStream:d,recordsWrite:p}}static async generateProtocolEncryptedRecordsWrite(e){let{plaintextBytes:r,author:n,recipient:i,protocolDefinition:o,protocolPath:s,protocolParentContextId:a,protocolContextDerivingRootKeyId:d,protocolContextDerivedPublicJwk:m}=e,p=cs.fromBytes(r),w=ln.randomBytes(16),P=ln.randomBytes(32),S=await Qc.aes256CtrEncrypt(P,w,p),M=await cs.toBytes(S),A=s.split("/"),B=A[A.length-1],{message:I,dataStream:C,recordsWrite:k}=await ln.generateRecordsWrite({author:n,recipient:i,protocol:o.protocol,protocolPath:s,parentContextId:a,schema:o.types[B].schema,dataFormat:o.types[B].dataFormats?.[0],data:M}),q={initializationVector:w,key:P,keyEncryptionInputs:[]};if(e.encryptSymmetricKeyWithProtocolPathDerivedKey){let L=o.structure;for(let G of A)L=L[G];let U=L.$encryption?.publicKeyJwk,N={publicKeyId:L.$encryption?.rootKeyId,publicKey:U,derivationScheme:"protocolPath"};q.keyEncryptionInputs.push(N)}if(e.encryptSymmetricKeyWithProtocolContextDerivedKey){let L;if(a===void 0){let U={rootKeyId:n.keyId,derivationScheme:"protocolContext",derivedPrivateKey:n.keyPair.privateJwk},F=await At.getEntryId(n.did,I.descriptor),N=pt.constructKeyDerivationPathUsingProtocolContextScheme(F),G=await ia.derivePublicKey(U,N);L={publicKeyId:n.keyId,publicKey:G,derivationScheme:"protocolContext"}}else{if(d===void 0||m===void 0)throw new Error("`protocolContextDerivingRootKeyId` and `protocolContextDerivedPublicJwk` must both be defined if `protocolContextId` is given");L={publicKeyId:d,publicKey:m,derivationScheme:"protocolContext"}}q.keyEncryptionInputs.push(L)}return await k.encryptSymmetricEncryptionKey(q),await k.sign({signer:zt.createSigner(n)}),{message:I,dataStream:C,recordsWrite:k,encryptedDataBytes:M,encryptionInput:q}}static async generateFromRecordsWrite(e){let r=e.existingWrite.message,n=Zt.getCurrentTimestamp(),i=!(e.published??r.descriptor.published),o=e.datePublished??(i?n:void 0),s=e.data??ln.randomBytes(32),a=cs.fromBytes(s),d={recordsWriteMessage:e.existingWrite.message,data:s,published:i,datePublished:o,messageTimestamp:e.messageTimestamp,protocolRole:e.protocolRole,tags:e.tags,signer:zt.createSigner(e.author)},m=await At.createFrom(d);return{message:m.message,recordsWrite:m,dataBytes:s,dataStream:a}}static async generateRecordsQuery(e){let r=e?.author,n=e?.anonymous??!1;if(n&&r)throw new Error("Cannot have `author` and be anonymous at the same time.");r===void 0&&!n&&(r=await ln.generatePersona());let i;r!==void 0&&(i=zt.createSigner(r));let o={messageTimestamp:e?.messageTimestamp,signer:i,filter:e?.filter??{schema:ln.randomString(10)},dateSort:e?.dateSort,pagination:e?.pagination,protocolRole:e?.protocolRole};rn(o);let a=(await Sl.create(o)).message;return{author:r,message:a}}static async generateRecordsSubscribe(e){let r=e?.author,n=e?.anonymous??!1;if(n&&r)throw new Error("Cannot have `author` and be anonymous at the same time.");r===void 0&&!n&&(r=await ln.generatePersona());let i;r!==void 0&&(i=zt.createSigner(r));let o={messageTimestamp:e?.messageTimestamp,signer:i,filter:e?.filter??{schema:ln.randomString(10)},protocolRole:e?.protocolRole};rn(o);let a=(await Ol.create(o)).message;return{author:r,message:a}}static async generateRecordsDelete(e){let r=e?.author??await ln.generateDidKeyPersona(),n=await kl.create({recordId:e?.recordId??await ln.randomCborSha256Cid(),protocolRole:e?.protocolRole,signer:zt.createSigner(r)});return{author:r,recordsDelete:n,message:n.message}}static async generateEventsGet(e){let r=e?.author??await ln.generatePersona(),i={signer:zt.createSigner(r)};e?.cursor&&(i.cursor=e.cursor);let o=await Ml.create(i);return{author:r,eventsGet:o,message:o.message}}static async generateEventsQuery(e){let{filters:r,cursor:n}=e,i=e.author??await ln.generatePersona(),s={signer:zt.createSigner(i),filters:r,cursor:n},a=await Pl.create(s);return{author:i,eventsQuery:a,message:a.message}}static async generateEventsSubscribe(e){let r=e?.author??await ln.generatePersona(),n=zt.createSigner(r),i={filters:e?.filters,messageTimestamp:e?.messageTimestamp,signer:n};rn(i);let o=await Al.create(i),s=o.message;return{author:r,eventsSubscribe:o,message:s}}static async generateMessagesGet(e){let r=e?.author??await ln.generatePersona(),i={signer:zt.createSigner(r),messageCids:e.messageCids},o=await tu.create(i);return{author:r,messagesGet:o,message:o.message}}static generateAuthorization(){return{signature:ln.generateAuthorizationSignature()}}static generateAuthorizationSignature(){return{payload:"anyPayload",signatures:[{protected:"anyProtectedHeader",signature:"anySignature"}]}}static async randomSignatureString(){let e=await m1.generateKeyPair(),r=await m1.sign(ln.randomBytes(32),e.privateJwk);return et.bytesToBase64Url(r)}static randomString(e){let r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",n="";for(let i=0;i<e;i++)n+=r.charAt(Math.floor(Math.random()*r.length));return n}static randomBytes(e){let r=new Uint8Array(e);for(let n=0;n<e;n++)r[n]=Math.floor(Math.random()*256);return r}static async randomCborSha256Cid(){let e=ln.randomBytes(32),r=await xo.digest(e);return(await St.createV1(Vh,r)).toString()}static randomInt(e,r){return Math.floor(Math.random()*(r-e)+e)}static randomTimestamp(e){let{year:r,month:n,day:i,hour:o,minute:s,second:a,millisecond:d,microsecond:m}=e||{};return Zt.createTimestamp({year:r||this.randomInt(2e3,2022),month:n||this.randomInt(1,12),day:i||this.randomInt(1,28),hour:o||this.randomInt(0,23),minute:s||this.randomInt(0,59),second:a||this.randomInt(0,59),millisecond:d||this.randomInt(0,1e3),microsecond:m||this.randomInt(0,1e3)})}static createDidResolutionResult(e){return{didResolutionMetadata:{},didDocument:{id:e.did,verificationMethod:[{controller:e.did,id:e.keyId,type:"JsonWebKey2020",publicKeyJwk:e.keyPair.publicJwk}]},didDocumentMetadata:{}}}static async generateDidKeyPersona(){let e=await vs.create(),r=await vs.getSigningMethod({didDocument:e.document}),n=r.id,i=await e.export(),o={publicJwk:r.publicKeyJwk,privateJwk:i.privateKeys[0]};return{did:e.uri,keyId:n,keyPair:o,signer:new Fh({privateJwk:o.privateJwk,algorithm:o.privateJwk.alg,keyId:n})}}};export{hx as AllowAllTenantGate,Qn as Cid,kL as DataStoreLevel,cs as DataStream,F_ as DateSort,J3 as Dwn,ch as DwnConstant,be as DwnError,Gr as DwnErrorCode,jn as DwnInterfaceName,Nn as DwnMethodName,et as Encoder,Qc as Encryption,yD as EncryptionAlgorithm,jL as EventEmitterStream,OL as EventLogLevel,Ml as EventsGet,Pl as EventsQuery,Al as EventsSubscribe,ia as HdKey,zt as Jws,Bb as KeyDerivationScheme,Ue as Message,uE as MessageStoreLevel,tu as MessagesGet,Gi as PermissionsProtocol,Fh as PrivateKeySigner,_L as Protocols,$o as ProtocolsConfigure,au as ProtocolsQuery,pt as Records,kl as RecordsDelete,Sl as RecordsQuery,e0 as RecordsRead,Ol as RecordsSubscribe,At as RecordsWrite,sn as Secp256k1,Js as Secp256r1,Gx as SortDirection,ln as TestDataGenerator,Zt as Time,di as authenticate,no as executeUnlessAborted};
/*! Bundled license information:
ieee754/index.js:
(*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> *)
buffer/index.js:
(*!
* The buffer module from node.js, for the browser.
*
* @author Feross Aboukhadijeh <https://feross.org>
* @license MIT
*)
safe-buffer/index.js:
(*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> *)
safe-buffer/index.js:
(*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> *)
safe-buffer/index.js:
(*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> *)
@noble/ciphers/utils.js:
(*! noble-ciphers - MIT License (c) 2023 Paul Miller (paulmillr.com) *)
@noble/hashes/utils.js:
(*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
@noble/curves/abstract/utils.js:
(*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
@noble/curves/abstract/modular.js:
(*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
@noble/curves/abstract/curve.js:
(*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
@noble/curves/abstract/edwards.js:
(*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
@noble/curves/abstract/montgomery.js:
(*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
@noble/curves/ed25519.js:
(*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
@noble/curves/abstract/weierstrass.js:
(*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
@noble/curves/_shortw_utils.js:
(*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
@noble/curves/secp256k1.js:
(*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
uri-js/dist/es5/uri.all.js:
(** @license URI.js v4.4.1 (c) 2011 Gary Court. License: http://github.com/garycourt/uri-js *)
queue-microtask/index.js:
(*! queue-microtask. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> *)
run-parallel-limit/index.js:
(*! run-parallel-limit. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> *)
@noble/ed25519/index.js:
(*! noble-ed25519 - MIT License (c) 2019 Paul Miller (paulmillr.com) *)
@noble/secp256k1/index.js:
(*! noble-secp256k1 - MIT License (c) 2019 Paul Miller (paulmillr.com) *)
@noble/hashes/esm/utils.js:
(*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
@noble/curves/esm/abstract/utils.js:
(*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
@noble/curves/esm/abstract/modular.js:
(*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
@noble/curves/esm/abstract/curve.js:
(*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
@noble/curves/esm/abstract/weierstrass.js:
(*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
@noble/curves/esm/_shortw_utils.js:
(*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
@noble/curves/esm/p256.js:
(*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
@noble/curves/esm/secp256k1.js:
(*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
@noble/curves/esm/abstract/edwards.js:
(*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
@noble/curves/esm/abstract/montgomery.js:
(*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
@noble/curves/esm/ed25519.js:
(*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
@noble/ciphers/esm/utils.js:
(*! noble-ciphers - MIT License (c) 2023 Paul Miller (paulmillr.com) *)
uint8-util/util.js:
(* Common package for dealing with hex/string/uint8 conversions (and sha1 hashing)
*
* @author Jimmy Wärting <jimmy@warting.se> (https://jimmy.warting.se/opensource)
* @license MIT
*)
*/